diff --git a/lib/node_modules/@stdlib/plot/base/assert/is-line-style/README.md b/lib/node_modules/@stdlib/plot/base/assert/is-line-style/README.md new file mode 100644 index 000000000000..f3fcb712152c --- /dev/null +++ b/lib/node_modules/@stdlib/plot/base/assert/is-line-style/README.md @@ -0,0 +1,119 @@ + + +# isLineStyle + +> Test if an input value is a supported [line style][@stdlib/plot/base/line-styles]. + + + +
+ +
+ + + + + +
+ +## Usage + +```javascript +var isLineStyle = require( '@stdlib/plot/base/assert/is-line-style' ); +``` + +#### isLineStyle( value ) + +Tests if an input value is a supported [line style][@stdlib/plot/base/line-styles]. + +```javascript +var bool = isLineStyle( '-' ); +// returns true + +bool = isLineStyle( 'foo' ); +// returns false +``` + +
+ + + + + +
+ +
+ + + + + +
+ +## Examples + + + +```javascript +var isLineStyle = require( '@stdlib/plot/base/assert/is-line-style' ); + +var bool = isLineStyle( '-' ); +// returns true + +bool = isLineStyle( '--' ); +// returns true + +bool = isLineStyle( '' ); +// returns false + +bool = isLineStyle( 'foo' ); +// returns false +``` + +
+ + + + + +
+ +
+ + + + + + + + + + + + + + diff --git a/lib/node_modules/@stdlib/plot/base/assert/is-line-style/benchmark/benchmark.js b/lib/node_modules/@stdlib/plot/base/assert/is-line-style/benchmark/benchmark.js new file mode 100644 index 000000000000..b4512dadf40f --- /dev/null +++ b/lib/node_modules/@stdlib/plot/base/assert/is-line-style/benchmark/benchmark.js @@ -0,0 +1,62 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var bench = require( '@stdlib/bench' ); +var isBoolean = require( '@stdlib/assert/is-boolean' ).isPrimitive; +var pkg = require( './../package.json' ).name; +var isLineStyle = require( './../lib' ); + + +// MAIN // + +bench( pkg, function benchmark( b ) { + var values; + var out; + var v; + var i; + + values = [ + '-', + '--', + + 'foo', + 'bar', + '', + 'beep', + 'boop' + ]; + + b.tic(); + for ( i = 0; i < b.iterations; i++ ) { + v = values[ i%values.length ]; + out = isLineStyle( v ); + if ( typeof out !== 'boolean' ) { + b.fail( 'should return a boolean' ); + } + } + b.toc(); + if ( !isBoolean( out ) ) { + b.fail( 'should return a boolean' ); + } + b.pass( 'benchmark finished' ); + b.end(); +}); diff --git a/lib/node_modules/@stdlib/plot/base/assert/is-line-style/docs/repl.txt b/lib/node_modules/@stdlib/plot/base/assert/is-line-style/docs/repl.txt new file mode 100644 index 000000000000..dae3e0188fb8 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/base/assert/is-line-style/docs/repl.txt @@ -0,0 +1,28 @@ + +{{alias}}( value ) + Tests if an input value is a supported line style. + + Parameters + ---------- + value: any + Value to test. + + Returns + ------- + bool: boolean + Boolean indicating if an input value is a supported line style. + + Examples + -------- + > var bool = {{alias}}( '-' ) + true + > bool = {{alias}}( '--' ) + true + > bool = {{alias}}( '' ) + false + > bool = {{alias}}( 'beep' ) + false + + See Also + -------- + diff --git a/lib/node_modules/@stdlib/plot/base/assert/is-line-style/docs/types/index.d.ts b/lib/node_modules/@stdlib/plot/base/assert/is-line-style/docs/types/index.d.ts new file mode 100644 index 000000000000..7194e496caa8 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/base/assert/is-line-style/docs/types/index.d.ts @@ -0,0 +1,45 @@ +/* +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +// TypeScript Version: 4.1 + +/** +* Tests whether an input value is a supported line style. +* +* @param v - value to test +* @returns boolean indicating whether an input value is a supported line style +* +* @example +* var bool = isLineStyle( '-' ); +* // returns true +* +* bool = isLineStyle( '--' ); +* // returns true +* +* bool = isLineStyle( 'bar' ); +* // returns false +* +* bool = isLineStyle( 'foo' ); +* // returns false +*/ +declare function isLineStyle( v: any ): boolean; + + +// EXPORTS // + +export = isLineStyle; diff --git a/lib/node_modules/@stdlib/plot/base/assert/is-line-style/docs/types/test.ts b/lib/node_modules/@stdlib/plot/base/assert/is-line-style/docs/types/test.ts new file mode 100644 index 000000000000..d1104a1c7fc4 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/base/assert/is-line-style/docs/types/test.ts @@ -0,0 +1,34 @@ +/* +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +import isLineStyle = require( './index' ); + + +// TESTS // + +// The function returns a boolean... +{ + isLineStyle( '--' ); // $ExpectType boolean + isLineStyle( 'foo' ); // $ExpectType boolean +} + +// The compiler throws an error if the function is provided an unsupported number of arguments... +{ + isLineStyle(); // $ExpectError + isLineStyle( undefined, 123 ); // $ExpectError +} diff --git a/lib/node_modules/@stdlib/plot/base/assert/is-line-style/examples/index.js b/lib/node_modules/@stdlib/plot/base/assert/is-line-style/examples/index.js new file mode 100644 index 000000000000..5bfb90c96c8e --- /dev/null +++ b/lib/node_modules/@stdlib/plot/base/assert/is-line-style/examples/index.js @@ -0,0 +1,37 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +var isLineStyle = require( './../lib' ); + +var bool = isLineStyle( '-' ); +console.log( bool ); +// => true + +bool = isLineStyle( '--' ); +console.log( bool ); +// => true + +bool = isLineStyle( '' ); +console.log( bool ); +// => false + +bool = isLineStyle( 'foo' ); +console.log( bool ); +// => false diff --git a/lib/node_modules/@stdlib/plot/base/assert/is-line-style/lib/index.js b/lib/node_modules/@stdlib/plot/base/assert/is-line-style/lib/index.js new file mode 100644 index 000000000000..fbdde753976f --- /dev/null +++ b/lib/node_modules/@stdlib/plot/base/assert/is-line-style/lib/index.js @@ -0,0 +1,49 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +/** +* Test whether an input value is a supported line style. +* +* @module @stdlib/plot/base/assert/is-line-style +* +* @example +* var isLineStyle = require( '@stdlib/plot/base/assert/is-line-style' ); +* +* var bool = isLineStyle( '-' ); +* // returns true +* +* bool = isLineStyle( '--' ); +* // returns true +* +* bool = isLineStyle( 'bar' ); +* // returns false +* +* bool = isLineStyle( 'foo' ); +* // returns false +*/ + +// MODULES // + +var main = require( './main.js' ); + + +// EXPORTS // + +module.exports = main; diff --git a/lib/node_modules/@stdlib/plot/base/assert/is-line-style/lib/main.js b/lib/node_modules/@stdlib/plot/base/assert/is-line-style/lib/main.js new file mode 100644 index 000000000000..ac5006f4fb74 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/base/assert/is-line-style/lib/main.js @@ -0,0 +1,55 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var contains = require( '@stdlib/array/base/assert/contains' ).factory; +var lineStyles = require( '@stdlib/plot/base/line-styles' ); + + +// MAIN // + +/** +* Tests whether an input value is a supported line style. +* +* @name isLineStyle +* @type {Function} +* @param {*} v - value to test +* @returns {boolean} boolean indicating whether an input value is a supported line style +* +* @example +* var bool = isLineStyle( '-' ); +* // returns true +* +* bool = isLineStyle( '--' ); +* // returns true +* +* bool = isLineStyle( 'bar' ); +* // returns false +* +* bool = isLineStyle( 'foo' ); +* // returns false +*/ +var isLineStyle = contains( lineStyles() ); + + +// EXPORTS // + +module.exports = isLineStyle; diff --git a/lib/node_modules/@stdlib/plot/base/assert/is-line-style/package.json b/lib/node_modules/@stdlib/plot/base/assert/is-line-style/package.json new file mode 100644 index 000000000000..e48fc323b614 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/base/assert/is-line-style/package.json @@ -0,0 +1,71 @@ +{ + "name": "@stdlib/plot/base/assert/is-line-style", + "version": "0.0.0", + "description": "Test if an input value is a supported line style.", + "license": "Apache-2.0", + "author": { + "name": "The Stdlib Authors", + "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" + }, + "contributors": [ + { + "name": "The Stdlib Authors", + "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" + } + ], + "main": "./lib", + "directories": { + "benchmark": "./benchmark", + "doc": "./docs", + "example": "./examples", + "lib": "./lib", + "test": "./test" + }, + "types": "./docs/types", + "scripts": {}, + "homepage": "https://github.com/stdlib-js/stdlib", + "repository": { + "type": "git", + "url": "git://github.com/stdlib-js/stdlib.git" + }, + "bugs": { + "url": "https://github.com/stdlib-js/stdlib/issues" + }, + "dependencies": {}, + "devDependencies": {}, + "engines": { + "node": ">=0.10.0", + "npm": ">2.7.0" + }, + "os": [ + "aix", + "darwin", + "freebsd", + "linux", + "macos", + "openbsd", + "sunos", + "win32", + "windows" + ], + "keywords": [ + "stdlib", + "plot", + "base", + "linestyle", + "line-style", + "utilities", + "utility", + "utils", + "util", + "assert", + "test", + "check", + "is", + "valid", + "validate", + "validation", + "isvalid" + ], + "__stdlib__": {} +} diff --git a/lib/node_modules/@stdlib/plot/base/assert/is-line-style/test/test.js b/lib/node_modules/@stdlib/plot/base/assert/is-line-style/test/test.js new file mode 100644 index 000000000000..cf7d3802571a --- /dev/null +++ b/lib/node_modules/@stdlib/plot/base/assert/is-line-style/test/test.js @@ -0,0 +1,79 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var tape = require( 'tape' ); +var isLineStyle = require( './../lib' ); + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof isLineStyle, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'the function returns `true` if provided a supported line style', function test( t ) { + var values; + var bool; + var i; + + values = [ + '-', + '--', + ':', + '-.' + ]; + for ( i = 0; i < values.length; i++ ) { + bool = isLineStyle( values[ i ] ); + t.strictEqual( bool, true, 'returns expected value when provided '+values[ i ] ); + } + t.end(); +}); + +tape( 'the function returns `false` if not provided a supported line style', function test( t ) { + var values; + var bool; + var i; + + values = [ + '', + 'beep', + 'boop', + 'foo', + 'bar', + 5, + NaN, + true, + false, + null, + void 0, + [], + {}, + function noop() {} + ]; + for ( i = 0; i < values.length; i++ ) { + bool = isLineStyle( values[ i ] ); + t.strictEqual( bool, false, 'returns expected value when provided '+values[ i ] ); + } + t.end(); +}); diff --git a/lib/node_modules/@stdlib/plot/base/ctor/examples/index.js b/lib/node_modules/@stdlib/plot/base/ctor/examples/index.js deleted file mode 100644 index 2cc86a1a5e6d..000000000000 --- a/lib/node_modules/@stdlib/plot/base/ctor/examples/index.js +++ /dev/null @@ -1,32 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -var Plot = require( './../lib' ); - -// Create a new plot: -var plot = new Plot({ - 'width': 600, - 'height': 480, - 'xScale': 'time', - 'xTickFormat': '%H:%M', - 'renderFormat': 'html' -}); - -console.log( plot.toString() ); diff --git a/lib/node_modules/@stdlib/plot/base/ctor/lib/defaults.js b/lib/node_modules/@stdlib/plot/base/ctor/lib/defaults.js deleted file mode 100644 index 4d0e929a11c3..000000000000 --- a/lib/node_modules/@stdlib/plot/base/ctor/lib/defaults.js +++ /dev/null @@ -1,139 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var isNodeREPL = require( '@stdlib/assert/is-node-repl' ); - - -// MAIN // - -/** -* Returns default options. -* -* @private -* @returns {Object} default options -*/ -function defaults() { - var isREPL; - var o; - - isREPL = isNodeREPL(); - o = {}; - - // Boolean indicating whether to re-render on a change event: - o.autoRender = false; - - // Boolean indicating whether to generate an updated view on a render event: - o.autoView = false; - - // Plot description: - o.description = ''; - - // Rendering engine: - o.engine = 'svg'; - - // Plot height: - o.height = 400; // px - - // Data labels: - o.labels = []; - - // Line opacity: - o.lineOpacity = 0.9; // [0,1] - - // Line style: - o.lineStyle = '-'; - - // Data line width(s): - o.lineWidth = 2; // px - - // FIXME: padding props depend on orientation (may require using `null` to flag) - - // Bottom padding: - o.paddingBottom = 80; // px - - // Left padding: - o.paddingLeft = 90; // px - - // Right padding: - o.paddingRight = 20; // px - - // Top padding: - o.paddingTop = 80; // px - - // Render format: - o.renderFormat = 'vdom'; - - // Plot title: - o.title = ''; - - // Plot viewer: - if ( isREPL ) { - o.viewer = 'window'; - } else { - o.viewer = 'none'; - } - // Plot width: - o.width = 400; // px - - // x-axis orientation: - o.xAxisOrient = 'bottom'; - - // x-axis label: - o.xLabel = 'x'; - - // Maximum value of x-axis domain: - o.xMax = null; - - // Minimum value of x-axis domain: - o.xMin = null; - - // Number of x-axis tick marks: - o.xNumTicks = 5; - - // x-axis tick format: - o.xTickFormat = null; - - // y-axis orientation: - o.yAxisOrient = 'left'; - - // y-axis label: - o.yLabel = 'y'; - - // Maximum value of y-axis domain: - o.yMax = null; - - // Minimum value of y-axis domain: - o.yMin = null; - - // Number of y-axis tick marks: - o.yNumTicks = 5; - - // y-axis tick format: - o.yTickFormat = null; - - return o; -} - - -// EXPORTS // - -module.exports = defaults; diff --git a/lib/node_modules/@stdlib/plot/base/ctor/lib/index.js b/lib/node_modules/@stdlib/plot/base/ctor/lib/index.js deleted file mode 100644 index 3ca3c3fc3a9f..000000000000 --- a/lib/node_modules/@stdlib/plot/base/ctor/lib/index.js +++ /dev/null @@ -1,39 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -/** -* Base constructor for a 2-dimensional plot. -* -* @module @stdlib/plot/base/ctor -* -* @example -* var Plot = require( '@stdlib/plot/base/ctor' ); -* -* var plot = new Plot(); -*/ - -// MODULES // - -var main = require( './main.js' ); - - -// EXPORTS // - -module.exports = main; diff --git a/lib/node_modules/@stdlib/plot/base/ctor/lib/main.js b/lib/node_modules/@stdlib/plot/base/ctor/lib/main.js deleted file mode 100644 index d06d83cb323c..000000000000 --- a/lib/node_modules/@stdlib/plot/base/ctor/lib/main.js +++ /dev/null @@ -1,1251 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var EventEmitter = require( 'events' ).EventEmitter; -var logger = require( 'debug' ); -var objectKeys = require( '@stdlib/utils/keys' ); -var inherit = require( '@stdlib/utils/inherit' ); -var copy = require( '@stdlib/utils/copy' ); -var mergeFcn = require( '@stdlib/utils/merge' ).factory; -var defineProperty = require( '@stdlib/utils/define-property' ); -var setReadOnly = require( '@stdlib/utils/define-read-only-property' ); -var isObject = require( '@stdlib/assert/is-plain-object' ); -var minstd = require( '@stdlib/random/base/minstd' ); -var format = require( '@stdlib/string/format' ); -var defaults = require( './defaults.js' ); -var view = require( './view' ); -var setAutoRender = require( './props/auto-render/set.js' ); -var getAutoRender = require( './props/auto-render/get.js' ); -var setAutoView = require( './props/auto-view/set.js' ); -var getAutoView = require( './props/auto-view/get.js' ); -var setDescription = require( './props/description/set.js' ); -var getDescription = require( './props/description/get.js' ); -var setEngine = require( './props/engine/set.js' ); -var getEngine = require( './props/engine/get.js' ); -var getGraphHeight = require( './props/graph-height/get.js' ); -var getGraphWidth = require( './props/graph-width/get.js' ); -var setHeight = require( './props/height/set.js' ); -var getHeight = require( './props/height/get.js' ); -var setLabels = require( './props/labels/set.js' ); -var getLabels = require( './props/labels/get.js' ); -var setLineOpacity = require( './props/line-opacity/set.js' ); -var getLineOpacity = require( './props/line-opacity/get.js' ); -var setLineStyle = require( './props/line-style/set.js' ); -var getLineStyle = require( './props/line-style/get.js' ); -var setLineWidth = require( './props/line-width/set.js' ); -var getLineWidth = require( './props/line-width/get.js' ); -var setPaddingBottom = require( './props/padding-bottom/set.js' ); -var getPaddingBottom = require( './props/padding-bottom/get.js' ); -var setPaddingLeft = require( './props/padding-left/set.js' ); -var getPaddingLeft = require( './props/padding-left/get.js' ); -var setPaddingRight = require( './props/padding-right/set.js' ); -var getPaddingRight = require( './props/padding-right/get.js' ); -var setPaddingTop = require( './props/padding-top/set.js' ); -var getPaddingTop = require( './props/padding-top/get.js' ); -var render = require( './render' ); -var stub = require( './render/stub.js' ); -var setRenderFormat = require( './props/render-format/set.js' ); -var getRenderFormat = require( './props/render-format/get.js' ); -var setTitle = require( './props/title/set.js' ); -var getTitle = require( './props/title/get.js' ); -var setViewer = require( './props/viewer/set.js' ); -var getViewer = require( './props/viewer/get.js' ); -var setWidth = require( './props/width/set.js' ); -var getWidth = require( './props/width/get.js' ); -var setXAxisOrient = require( './props/x-axis-orient/set.js' ); -var getXAxisOrient = require( './props/x-axis-orient/get.js' ); -var getXDomain = require( './props/x-domain/get.js' ); -var setXLabel = require( './props/x-label/set.js' ); -var getXLabel = require( './props/x-label/get.js' ); -var setXNumTicks = require( './props/x-num-ticks/set.js' ); -var getXNumTicks = require( './props/x-num-ticks/get.js' ); -var getXPos = require( './props/x-pos/get.js' ); -var getXRange = require( './props/x-range/get.js' ); -var setXTickFormat = require( './props/x-tick-format/set.js' ); -var getXTickFormat = require( './props/x-tick-format/get.js' ); -var setYAxisOrient = require( './props/y-axis-orient/set.js' ); -var getYAxisOrient = require( './props/y-axis-orient/get.js' ); -var getYDomain = require( './props/y-domain/get.js' ); -var setYLabel = require( './props/y-label/set.js' ); -var getYLabel = require( './props/y-label/get.js' ); -var setYNumTicks = require( './props/y-num-ticks/set.js' ); -var getYNumTicks = require( './props/y-num-ticks/get.js' ); -var getYPos = require( './props/y-pos/get.js' ); -var getYRange = require( './props/y-range/get.js' ); -var setYTickFormat = require( './props/y-tick-format/set.js' ); -var getYTickFormat = require( './props/y-tick-format/get.js' ); - - -// VARIABLES // - -var debug = logger( 'plot:base:main' ); -var PRIVATE_PROPS = [ - '_autoRender', - '_autoView', - '_description', - '_engine', - '_height', - '_isDefined', - '_labels', - '_lineOpacity', - '_lineStyle', - '_lineWidth', - '_paddingBottom', - '_paddingLeft', - '_paddingRight', - '_paddingTop', - '_renderFormat', - '_title', - '_viewer', - '_width', - '_xAxisOrient', - '_xData', - '_xLabel', - '_xMax', - '_xMin', - '_xNumTicks', - '_xScale', - '_xTickFormat', - '_yAxisOrient', - '_yData', - '_yLabel', - '_yMax', - '_yMin', - '_yNumTicks', - '_yScale', - '_yTickFormat' -]; - - -// FUNCTIONS // - -var merge = mergeFcn({ - 'extend': false -}); - - -// MAIN // - -/** -* Base plot constructor. -* -* @constructor -* @param {Array} [x] - x values -* @param {Array} [y] - y values -* @param {Options} [options] - constructor options -* @param {boolean} [options.autoRender=false] - indicates whether to re-render on a change event -* @param {boolean} [options.autoView=false] - indicates whether to generate an updated view on a render event -* @param {string} [options.description=''] - description -* @param {string} [options.engine='svg'] - render engine -* @param {PositiveNumber} [options.height=400] - plot height -* @param {(StringArray|EmptyArray)} [options.labels] - data labels -* @param {(number|NumberArray)} [options.lineOpacity=0.9] - line opacity -* @param {(string|StringArray)} [options.lineStyle='-'] - line style(s) -* @param {(NonNegativeInteger|Array)} [options.lineWidth=2] - line width(s) -* @param {NonNegativeInteger} [options.paddingBottom=80] - bottom padding -* @param {NonNegativeInteger} [options.paddingLeft=90] - left padding -* @param {NonNegativeInteger} [options.paddingRight=20] - right padding -* @param {NonNegativeInteger} [options.paddingTop=80] - top padding -* @param {string} [options.renderFormat='vdom'] - render format -* @param {string} [options.title=''] - title -* @param {string} [options.viewer='none'] - viewer -* @param {PositiveNumber} [options.width=400] - plot width -* @param {string} [options.xAxisOrient='bottom'] - x-axis orientation -* @param {string} [options.xLabel='x'] - x-axis label -* @param {(Date|FiniteNumber|null)} [options.xMax=null] - maximum value of x-axis domain -* @param {(Date|FiniteNumber|null)} [options.xMin=null] - minimum value of x-axis domain -* @param {(NonNegativeInteger|null)} [options.xNumTicks=5] - number of x-axis tick marks -* @param {(string|null)} [options.xTickFormat=null] - x-axis tick format -* @param {string} [options.yAxisOrient='left'] - y-axis orientation -* @param {string} [options.yLabel='y'] - y-axis label -* @param {(FiniteNumber|null)} [options.yMax=null] - maximum value of y-axis domain -* @param {(FiniteNumber|null)} [options.yMin=null] - minimum value of y-axis domain -* @param {(NonNegativeInteger|null)} [options.yNumTicks=5] - number of y-axis tick marks -* @param {(string|null)} [options.yTickFormat=null] - y-axis tick format -* @throws {TypeError} must provide valid options -* @returns {Plot} Plot instance -* -* @example -* var plot = new Plot(); -*/ -function Plot() { - var options; - var nargs; - var keys; - var self; - var opts; - var key; - var i; - - nargs = arguments.length; - if ( !(this instanceof Plot) ) { - if ( nargs === 0 ) { - return new Plot(); - } - if ( nargs === 1 ) { - return new Plot( arguments[0] ); - } - if ( nargs === 2 ) { - return new Plot( arguments[0], arguments[1] ); - } - return new Plot( arguments[0], arguments[1], arguments[2] ); - } - self = this; - - opts = defaults(); - if ( nargs === 0 ) { - options = {}; - } else if ( nargs === 1 ) { - options = arguments[ 0 ]; - if ( !isObject( options ) ) { - throw new TypeError( format( 'invalid argument. Options argument must be an object. Value: `%s`.', options ) ); - } - } else if ( nargs === 2 ) { - options = {}; - } else if ( nargs > 2 ) { - if ( !isObject( arguments[ 2 ] ) ) { - throw new TypeError( format( 'invalid argument. Options argument must be an object. Value: `%s`.', arguments[2] ) ); - } - options = copy( arguments[ 2 ] ); // avoid mutation - } - opts = merge( opts, options ); - - debug( 'Creating an instance with the following configuration: %s.', JSON.stringify( opts ) ); - EventEmitter.call( this ); - - for ( i = 0; i < PRIVATE_PROPS.length; i++ ) { - defineProperty( this, PRIVATE_PROPS[i], { - 'configurable': false, - 'enumerable': false, - 'writable': true, - 'value': null - }); - } - // Set a clipping path id: - defineProperty( this, '_clipPathId', { - 'configurable': false, - 'enumerable': false, - 'writable': false, - 'value': minstd().toString() // TODO: uuid - }); - - // Initialize an internal cache for renderers... - defineProperty( this, '$', { - 'configurable': false, - 'enumerable': false, - 'writable': false, - 'value': {} - }); - defineProperty( this.$, 'svg', { - 'configurable': false, - 'enumerable': false, - 'writable': false, - 'value': {} - }); - - // Set options... - keys = objectKeys( opts ); - for ( i = 0; i < keys.length; i++ ) { - key = keys[ i ]; - this[ key ] = opts[ key ]; - } - - // Add event listeners: - this.on( 'change', onChange ); - this.on( 'render', onRender ); - - return this; - - /** - * Callback invoked upon receiving a change event. - * - * @private - */ - function onChange() { - /* eslint-disable no-underscore-dangle */ - debug( 'Received a change event.' ); - if ( self._autoRender ) { - self.render(); - } - } - - /** - * Callback invoked upon receiving a render event. - * - * @private - * @param {*} plot - rendered plot - */ - function onRender( plot ) { - /* eslint-disable no-underscore-dangle */ - debug( 'Received a render event.' ); - if ( self._autoView ) { - debug( 'Viewer: %s.', self._viewer ); - debug( 'Generating view...' ); - view( self, self._viewer, plot ); - } - } -} - -/* -* Inherit from the `EventEmitter` prototype. -*/ -inherit( Plot, EventEmitter ); - -/** -* Rendering mode. -* -* ## Notes -* -* - If `true`, an instance re-renders on each `'change'` event. -* -* @name autoRender -* @memberof Plot.prototype -* @type {boolean} -* @throws {TypeError} must be a boolean -* @default true -* -* @example -* var plot = new Plot({ -* 'autoRender': true -* }); -* -* var mode = plot.autoRender; -* // returns true -*/ -defineProperty( Plot.prototype, 'autoRender', { - 'configurable': false, - 'enumerable': true, - 'set': setAutoRender, - 'get': getAutoRender -}); - -/** -* Viewer mode. -* -* ## Notes -* -* - If `true`, an instance generates an updated view on each render event. -* -* @name autoView -* @memberof Plot.prototype -* @type {boolean} -* @throws {TypeError} must be a boolean -* @default false -* -* @example -* var plot = new Plot({ -* 'autoView': false -* }); -* -* var mode = plot.autoView; -* // returns false -*/ -defineProperty( Plot.prototype, 'autoView', { - 'configurable': false, - 'enumerable': true, - 'set': setAutoView, - 'get': getAutoView -}); - -/** -* Plot description. -* -* @name description -* @memberof Plot.prototype -* @type {string} -* @throws {TypeError} must be a string -* @default '' -* -* @example -* var plot = new Plot(); -* plot.description = 'A plot description.'; -* -* @example -* var plot = new Plot({ -* 'description': 'A plot description.' -* }); -* var desc = plot.description; -* // returns 'A plot description.' -*/ -defineProperty( Plot.prototype, 'description', { - 'configurable': false, - 'enumerable': true, - 'set': setDescription, - 'get': getDescription -}); - -/** -* Render engine. -* -* @name engine -* @memberof Plot.prototype -* @type {string} -* @throws {TypeError} must be a recognized engine -* @default 'svg' -* -* @example -* var plot = new Plot(); -* plot.engine = 'svg'; -* -* @example -* var plot = new Plot({ -* 'engine': 'svg' -* }); -* var engine = plot.engine; -* // returns 'svg' -*/ -defineProperty( Plot.prototype, 'engine', { - 'configurable': false, - 'enumerable': true, - 'set': setEngine, - 'get': getEngine -}); - -/** -* Expected graph height. -* -* @name graphHeight -* @memberof Plot.prototype -* @type {number} -* -* @example -* var plot = new Plot({ -* 'height': 100, -* 'paddingTop': 10, -* 'paddingBottom': 20 -* }); -* var height = plot.graphHeight; -* // returns 70 -*/ -defineProperty( Plot.prototype, 'graphHeight', { - 'configurable': false, - 'enumerable': true, - 'get': getGraphHeight -}); - -/** -* Expected graph width. -* -* @name graphWidth -* @memberof Plot.prototype -* @type {number} -* -* @example -* var plot = new Plot({ -* 'width': 100, -* 'paddingLeft': 10, -* 'paddingRight': 10 -* }); -* var width = plot.graphWidth; -* // returns 80 -*/ -defineProperty( Plot.prototype, 'graphWidth', { - 'configurable': false, - 'enumerable': true, - 'get': getGraphWidth -}); - -/** -* Plot height. -* -* @name height -* @memberof Plot.prototype -* @type {PositiveNumber} -* @throws {TypeError} must be a positive number -* @default 400 (px) -* -* @example -* var plot = new Plot(); -* plot.height = 100; -* -* @example -* var plot = new Plot({ -* 'height': 360 -* }); -* var height = plot.height; -* // returns 360 -*/ -defineProperty( Plot.prototype, 'height', { - 'configurable': false, - 'enumerable': true, - 'set': setHeight, - 'get': getHeight -}); - -/** -* Data labels. -* -* @name labels -* @memberof Plot.prototype -* @type {(StringArray|EmptyArray)} -* @throws {TypeError} must be either an array of strings or an empty array -* @default [] -* -* @example -* var plot = new Plot(); -* plot.labels = [ 'beep', 'boop' ]; -* -* @example -* var plot = new Plot({ -* 'labels': [ 'beep', 'boop' ] -* }); -* var labels = plot.labels; -* // returns [ 'beep', 'boop' ] -*/ -defineProperty( Plot.prototype, 'labels', { - 'configurable': false, - 'enumerable': true, - 'set': setLabels, - 'get': getLabels -}); - -/** -* Line opacity. -* -* ## Notes -* -* - When retrieved, the returned value is always an `array`. -* -* @name lineOpacity -* @memberof Plot.prototype -* @type {(number|NumberArray)} -* @throws {TypeError} must be a number or number array -* @throws {RangeError} must be a number on the interval `[0,1]` -* @default '0.9' -* -* @example -* var plot = new Plot(); -* plot.lineOpacity = [ 1.0, 0.5 ]; -* -* @example -* var plot = new Plot({ -* 'lineOpacity': 0.5 -* }); -* var opacity = plot.lineOpacity; -* // returns [ 0.5 ] -*/ -defineProperty( Plot.prototype, 'lineOpacity', { - 'configurable': false, - 'enumerable': true, - 'set': setLineOpacity, - 'get': getLineOpacity -}); - -/** -* Line style(s). -* -* ## Notes -* -* - When retrieved, the returned value is always an `array`. -* -* @name lineStyle -* @memberof Plot.prototype -* @type {(string|StringArray)} -* @throws {TypeError} must be a string or string array -* @throws {Error} must be a supported line style -* @default '-' -* -* @example -* var plot = new Plot(); -* plot.lineStyle = [ '-', 'none' ]; -* -* @example -* var plot = new Plot({ -* 'lineStyle': 'none' -* }); -* var lineStyle = plot.lineStyle; -* // returns [ 'none' ] -*/ -defineProperty( Plot.prototype, 'lineStyle', { - 'configurable': false, - 'enumerable': true, - 'set': setLineStyle, - 'get': getLineStyle -}); - -/** -* Line width. -* -* ## Notes -* -* - When retrieved, the returned value is always an `array`. -* -* @name lineWidth -* @memberof Plot.prototype -* @type {(NonNegativeInteger|NonNegativeIntegerArray)} -* @throws {TypeError} must be a nonnegative integer or nonnegative integer array -* @default 2 -* -* @example -* var plot = new Plot(); -* plot.lineWidth = 1; -* -* @example -* var plot = new Plot({ -* 'lineWidth': [ 1, 3 ] -* }); -* var width = plot.lineWidth; -* // returns [ 1, 3 ] -*/ -defineProperty( Plot.prototype, 'lineWidth', { - 'configurable': false, - 'enumerable': true, - 'set': setLineWidth, - 'get': getLineWidth -}); - -/** -* Plot bottom padding. -* -* ## Notes -* -* - Typically used to create space for a bottom-oriented y-axis. -* -* @name paddingBottom -* @memberof Plot.prototype -* @type {NonNegativeInteger} -* @throws {TypeError} must be a nonnegative integer -* @default 80 (px) -* -* @example -* var plot = new Plot(); -* plot.paddingBottom = 100; -* -* @example -* var plot = new Plot({ -* 'paddingBottom': 100 -* }); -* var padding = plot.paddingBottom; -* // returns 100 -*/ -defineProperty( Plot.prototype, 'paddingBottom', { - 'configurable': false, - 'enumerable': true, - 'set': setPaddingBottom, - 'get': getPaddingBottom -}); - -/** -* Plot left padding. -* -* ## Notes -* -* - Typically used to create space for a left-oriented y-axis. -* -* @name paddingLeft -* @memberof Plot.prototype -* @type {NonNegativeInteger} -* @throws {TypeError} must be a nonnegative integer -* @default 90 (px) -* -* @example -* var plot = new Plot(); -* plot.paddingLeft = 100; -* -* @example -* var plot = new Plot({ -* 'paddingLeft': 100 -* }); -* var padding = plot.paddingLeft; -* // returns 100 -*/ -defineProperty( Plot.prototype, 'paddingLeft', { - 'configurable': false, - 'enumerable': true, - 'set': setPaddingLeft, - 'get': getPaddingLeft -}); - -/** -* Plot right padding. -* -* ## Notes -* -* - Typically used to create space for a right-oriented y-axis. -* -* @name paddingRight -* @memberof Plot.prototype -* @type {NonNegativeInteger} -* @throws {TypeError} must be a nonnegative integer -* @default 20 (px) -* -* @example -* var plot = new Plot(); -* plot.paddingRight = 100; -* -* @example -* var plot = new Plot({ -* 'paddingRight': 100 -* }); -* var padding = plot.paddingRight; -* // returns 100 -*/ -defineProperty( Plot.prototype, 'paddingRight', { - 'configurable': false, - 'enumerable': true, - 'set': setPaddingRight, - 'get': getPaddingRight -}); - -/** -* Plot top padding. -* -* ## Notes -* -* - Typically used to create space for a title or top-oriented x-axis. -* -* @name paddingTop -* @memberof Plot.prototype -* @type {NonNegativeInteger} -* @throws {TypeError} must be a nonnegative integer -* @default 80 (px) -* -* @example -* var plot = new Plot(); -* plot.paddingTop = 100; -* -* @example -* var plot = new Plot({ -* 'paddingTop': 100 -* }); -* var padding = plot.paddingTop; -* // returns 100 -*/ -defineProperty( Plot.prototype, 'paddingTop', { - 'configurable': false, - 'enumerable': true, - 'set': setPaddingTop, - 'get': getPaddingTop -}); - -/** -* Renders a plot. -* -* @name render -* @memberof Plot.prototype -* @type {Function} -* @param {string} [format] - render format -* @throws {TypeError} must provide a recognized format -* @returns {(VTree|string)} virtual tree or string -* -* @example -* var plot = new Plot(); -* var out = plot.render(); -* -* @example -* var plot = new Plot(); -* var out = plot.render( 'html' ); -*/ -setReadOnly( Plot.prototype, 'render', render ); - -/** -* Renders a plot. -* -* ## Notes -* -* - This method **should** be implemented by descendants. -* -* @private -* @name _render -* @memberof Plot.prototype -* @type {Function} -* @param {string} format - render format -* @returns {(VTree|string)} rendered plot -*/ -setReadOnly( Plot.prototype, '_render', stub ); - -/** -* Render format. -* -* @name renderFormat -* @memberof Plot.prototype -* @type {string} -* @throws {TypeError} must be a recognized format -* @default 'vdom' -* -* @example -* var plot = new Plot(); -* plot.renderFormat = 'vdom'; -* -* @example -* var plot = new Plot({ -* 'renderFormat': 'html' -* }); -* var fmt = plot.renderFormat; -* // returns 'html' -*/ -defineProperty( Plot.prototype, 'renderFormat', { - 'configurable': false, - 'enumerable': true, - 'set': setRenderFormat, - 'get': getRenderFormat -}); - -/** -* Plot title. -* -* @name title -* @memberof Plot.prototype -* @type {string} -* @throws {TypeError} must be a string -* @default '' -* -* @example -* var plot = new Plot(); -* plot.title = 'Plot'; -* -* @example -* var plot = new Plot({ -* 'title': 'Plot' -* }); -* var t = plot.title; -* // returns 'Plot' -*/ -defineProperty( Plot.prototype, 'title', { - 'configurable': false, - 'enumerable': true, - 'set': setTitle, - 'get': getTitle -}); - -/** -* Plot viewer. -* -* @name viewer -* @memberof Plot.prototype -* @type {string} -* @throws {TypeError} must be a recognized viewer -* @default 'none' -* -* @example -* var plot = new Plot(); -* plot.viewer = 'none'; -* -* @example -* var plot = new Plot({ -* 'viewer': 'none' -* }); -* var viewer = plot.viewer; -* // returns 'none' -*/ -defineProperty( Plot.prototype, 'viewer', { - 'configurable': false, - 'enumerable': true, - 'set': setViewer, - 'get': getViewer -}); - -/** -* Plot width. -* -* @name width -* @memberof Plot.prototype -* @type {PositiveNumber} -* @throws {TypeError} must be a positive number -* @default 400 (px) -* -* @example -* var plot = new Plot(); -* plot.width = 100; -* -* @example -* var plot = new Plot({ -* 'width': 480 -* }); -* var width = plot.width; -* // returns 480 -*/ -defineProperty( Plot.prototype, 'width', { - 'configurable': false, - 'enumerable': true, - 'set': setWidth, - 'get': getWidth -}); - -/** -* x-axis orientation. -* -* @name xAxisOrient -* @memberof Plot.prototype -* @type {string} -* @throws {TypeError} must be either `'top'` or `'bottom'` -* @default 'bottom' -* -* @example -* var plot = new Plot(); -* plot.xAxisOrient = 'bottom'; -* -* @example -* var plot = new Plot({ -* 'xAxisOrient': 'bottom' -* }); -* var orientation = plot.xAxisOrient; -* // returns 'bottom' -*/ -defineProperty( Plot.prototype, 'xAxisOrient', { - 'configurable': false, - 'enumerable': true, - 'set': setXAxisOrient, - 'get': getXAxisOrient -}); - -/** -* x-axis domain. -* -* @name xDomain -* @memberof Plot.prototype -* @type {Array} -* -* @example -* var plot = new Plot({ -* 'xMin': 0, -* 'xMax': 100 -* }); -* var domain = plot.xDomain; -* // returns [ 0, 100 ] -*/ -defineProperty( Plot.prototype, 'xDomain', { - 'configurable': false, - 'enumerable': true, - 'get': getXDomain -}); - -/** -* x-axis label. -* -* @name xLabel -* @memberof Plot.prototype -* @type {string} -* @throws {TypeError} must be a string -* @default 'x' -* -* @example -* var plot = new Plot(); -* plot.xLabel = 'time'; -* -* @example -* var plot = new Plot({ -* 'xLabel': 'time' -* }); -* var xLabel = plot.xLabel; -* // returns 'time' -*/ -defineProperty( Plot.prototype, 'xLabel', { - 'configurable': false, - 'enumerable': true, - 'set': setXLabel, - 'get': getXLabel -}); - -/** -* Number of x-axis tick marks. -* -* @name xNumTicks -* @memberof Plot.prototype -* @type {(NonNegativeInteger|null)} -* @throws {TypeError} must be a nonnegative integer or null -* @default 5 -* -* @example -* var plot = new Plot(); -* plot.xNumTicks = 10; -* -* @example -* var plot = new Plot({ -* 'xNumTicks': 10 -* }); -* var ticks = plot.xNumTicks; -* // returns 10 -*/ -defineProperty( Plot.prototype, 'xNumTicks', { - 'configurable': false, - 'enumerable': true, - 'set': setXNumTicks, - 'get': getXNumTicks -}); - -/** -* Function to map values to x-axis coordinate values. -* -* @name xPos -* @memberof Plot.prototype -* @type {Function} -* -* @example -* var plot = new Plot(); -* var xPos = plot.xPos; -* // returns -*/ -defineProperty( Plot.prototype, 'xPos', { - 'configurable': false, - 'enumerable': true, - 'get': getXPos -}); - -/** -* x-axis range. -* -* @name xRange -* @memberof Plot.prototype -* @type {NumberArray} -* -* @example -* var plot = new Plot({ -* 'width': 100, -* 'paddingLeft': 10, -* 'paddingRight': 10 -* }); -* var range = plot.xRange; -* // returns [ 0, 80 ] -*/ -defineProperty( Plot.prototype, 'xRange', { - 'configurable': false, - 'enumerable': true, - 'get': getXRange -}); - -/** -* x-axis tick format. -* -* ## Notes -* -* - When retrieved, if the value is not `null`, the returned value is a formatting function. -* -* @name xTickFormat -* @memberof Plot.prototype -* @type {(string|null)} -* @throws {TypeError} must be a string or null -* @default null -* -* @example -* var plot = new Plot(); -* plot.xScale = 'time'; -* plot.xTickFormat = '%H:%M'; -* -* @example -* var plot = new Plot({ -* 'xScale': 'time', -* 'xTickFormat': '%H:%M' -* }); -* var fmt = plot.xTickFormat; -* // returns -*/ -defineProperty( Plot.prototype, 'xTickFormat', { - 'configurable': false, - 'enumerable': true, - 'set': setXTickFormat, - 'get': getXTickFormat -}); - -/** -* y-axis orientation. -* -* @name yAxisOrient -* @memberof Plot.prototype -* @type {string} -* @throws {TypeError} must be either `'left'` or `'right'` -* @default 'left' -* -* @example -* var plot = new Plot(); -* plot.yAxisOrient = 'left'; -* -* @example -* var plot = new Plot({ -* 'yAxisOrient': 'left' -* }); -* var orientation = plot.yAxisOrient; -* // returns 'left' -*/ -defineProperty( Plot.prototype, 'yAxisOrient', { - 'configurable': false, - 'enumerable': true, - 'set': setYAxisOrient, - 'get': getYAxisOrient -}); - -/** -* y-axis domain. -* -* @name yDomain -* @memberof Plot.prototype -* @type {Array} -* -* @example -* var plot = new Plot({ -* 'yMin': 0, -* 'yMax': 100 -* }); -* var domain = plot.yDomain; -* // returns [ 0, 100 ] -*/ -defineProperty( Plot.prototype, 'yDomain', { - 'configurable': false, - 'enumerable': true, - 'get': getYDomain -}); - -/** -* y-axis label. -* -* @name yLabel -* @memberof Plot.prototype -* @type {string} -* @throws {TypeError} must be a string -* @default 'y' -* -* @example -* var plot = new Plot(); -* plot.yLabel = 'value'; -* -* @example -* var plot = new Plot({ -* 'yLabel': 'value' -* }); -* var yLabel = plot.yLabel; -* // returns 'value' -*/ -defineProperty( Plot.prototype, 'yLabel', { - 'configurable': false, - 'enumerable': true, - 'set': setYLabel, - 'get': getYLabel -}); - -/** -* Number of y-axis tick marks. -* -* @name yNumTicks -* @memberof Plot.prototype -* @type {(NonNegativeInteger|null)} -* @throws {TypeError} must be a nonnegative integer or null -* @default 5 -* -* @example -* var plot = new Plot(); -* plot.yNumTicks = 10; -* -* @example -* var plot = new Plot({ -* 'yNumTicks': 10 -* }); -* var ticks = plot.yNumTicks; -* // returns 10 -*/ -defineProperty( Plot.prototype, 'yNumTicks', { - 'configurable': false, - 'enumerable': true, - 'set': setYNumTicks, - 'get': getYNumTicks -}); - -/** -* Function to map values to y-axis coordinate values. -* -* @name yPos -* @memberof Plot.prototype -* @type {Function} -* -* @example -* var plot = new Plot(); -* var yPos = plot.yPos; -* // returns -*/ -defineProperty( Plot.prototype, 'yPos', { - 'configurable': false, - 'enumerable': true, - 'get': getYPos -}); - -/** -* y-axis range. -* -* @name yRange -* @memberof Plot.prototype -* @type {NumberArray} -* -* @example -* var plot = new Plot({ -* 'height': 100, -* 'paddingTop': 10, -* 'paddingBottom': 20 -* }); -* var range = plot.yRange; -* // returns [ 70, 0 ] -*/ -defineProperty( Plot.prototype, 'yRange', { - 'configurable': false, - 'enumerable': true, - 'get': getYRange -}); - -/** -* y-axis tick format. -* -* ## Notes -* -* - If the value is not `null`, when retrieved, the returned value is a formatting function. -* -* @name yTickFormat -* @memberof Plot.prototype -* @type {(string|null)} -* @throws {TypeError} must be a string or null -* @default null -* -* @example -* var plot = new Plot(); -* plot.yTickFormat = '.0%'; -* -* @example -* var plot = new Plot({ -* 'yTickFormat': '.0%' -* }); -* var fmt = plot.yTickFormat; -* // returns -*/ -defineProperty( Plot.prototype, 'yTickFormat', { - 'configurable': false, - 'enumerable': true, - 'set': setYTickFormat, - 'get': getYTickFormat -}); - -/** -* Generates a plot view. -* -* @name view -* @memberof Plot.prototype -* @type {Function} -* @param {string} [viewer] - viewer -* @throws {TypeError} must provide a recognized viewer -* -* @example -* var plot = new Plot(); -* plot.x = [ [ 1, 2, 3 ] ]; -* plot.view( 'stdout' ); -*/ -setReadOnly( Plot.prototype, 'view', view ); - - -// EXPORTS // - -module.exports = Plot; diff --git a/lib/node_modules/@stdlib/plot/base/ctor/lib/props/auto-render/get.js b/lib/node_modules/@stdlib/plot/base/ctor/lib/props/auto-render/get.js deleted file mode 100644 index 7df40dec3f47..000000000000 --- a/lib/node_modules/@stdlib/plot/base/ctor/lib/props/auto-render/get.js +++ /dev/null @@ -1,35 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -/** -* Returns the rendering mode. -* -* @private -* @returns {boolean} rendering mode -*/ -function get() { - /* eslint-disable no-invalid-this */ - return this._autoRender; -} - - -// EXPORTS // - -module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/base/ctor/lib/props/auto-render/set.js b/lib/node_modules/@stdlib/plot/base/ctor/lib/props/auto-render/set.js deleted file mode 100644 index de3b2bd4c002..000000000000 --- a/lib/node_modules/@stdlib/plot/base/ctor/lib/props/auto-render/set.js +++ /dev/null @@ -1,60 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); -var isBoolean = require( '@stdlib/assert/is-boolean' ).isPrimitive; -var format = require( '@stdlib/string/format' ); - - -// VARIABLES // - -var debug = logger( 'plot:base:set:auto-render' ); - - -// MAIN // - -/** -* Sets the rendering mode. -* -* @private -* @param {boolean} bool - boolean indicating whether to re-render on a change event -* @throws {TypeError} must be a boolean -*/ -function set( bool ) { - /* eslint-disable no-invalid-this */ - if ( !isBoolean( bool ) ) { - throw new TypeError( format( 'invalid assignment. `%s` must be a boolean. Value: `%s`.', 'autoRender', bool ) ); - } - if ( bool !== this._autoRender ) { - debug( 'Current value: %s.', this._autoRender ); - - this._autoRender = bool; - debug( 'New Value: %s.', this._autoRender ); - - this.emit( 'change' ); - } -} - - -// EXPORTS // - -module.exports = set; diff --git a/lib/node_modules/@stdlib/plot/base/ctor/lib/props/auto-view/get.js b/lib/node_modules/@stdlib/plot/base/ctor/lib/props/auto-view/get.js deleted file mode 100644 index 5b414b91ed3b..000000000000 --- a/lib/node_modules/@stdlib/plot/base/ctor/lib/props/auto-view/get.js +++ /dev/null @@ -1,35 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -/** -* Returns the viewing mode. -* -* @private -* @returns {boolean} viewing mode -*/ -function get() { - /* eslint-disable no-invalid-this */ - return this._autoView; -} - - -// EXPORTS // - -module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/base/ctor/lib/props/auto-view/set.js b/lib/node_modules/@stdlib/plot/base/ctor/lib/props/auto-view/set.js deleted file mode 100644 index 3200d9164ffa..000000000000 --- a/lib/node_modules/@stdlib/plot/base/ctor/lib/props/auto-view/set.js +++ /dev/null @@ -1,60 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); -var isBoolean = require( '@stdlib/assert/is-boolean' ).isPrimitive; -var format = require( '@stdlib/string/format' ); - - -// VARIABLES // - -var debug = logger( 'plot:base:set:auto-view' ); - - -// MAIN // - -/** -* Sets the viewing mode. -* -* @private -* @param {boolean} bool - boolean indicating whether to generate an updated view on a render event -* @throws {TypeError} must be a boolean -*/ -function set( bool ) { - /* eslint-disable no-invalid-this */ - if ( !isBoolean( bool ) ) { - throw new TypeError( format( 'invalid assignment. `%s` must be a boolean. Value: `%s`.', 'autoView', bool ) ); - } - if ( bool !== this._autoView ) { - debug( 'Current value: %s.', this._autoView ); - - this._autoView = bool; - debug( 'New Value: %s.', this._autoView ); - - this.emit( 'change' ); - } -} - - -// EXPORTS // - -module.exports = set; diff --git a/lib/node_modules/@stdlib/plot/base/ctor/lib/props/description/get.js b/lib/node_modules/@stdlib/plot/base/ctor/lib/props/description/get.js deleted file mode 100644 index d67c978f180b..000000000000 --- a/lib/node_modules/@stdlib/plot/base/ctor/lib/props/description/get.js +++ /dev/null @@ -1,35 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -/** -* Returns the description. -* -* @private -* @returns {string} description -*/ -function get() { - /* eslint-disable no-invalid-this */ - return this._description; -} - - -// EXPORTS // - -module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/base/ctor/lib/props/description/set.js b/lib/node_modules/@stdlib/plot/base/ctor/lib/props/description/set.js deleted file mode 100644 index 1f20f569d930..000000000000 --- a/lib/node_modules/@stdlib/plot/base/ctor/lib/props/description/set.js +++ /dev/null @@ -1,60 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); -var isString = require( '@stdlib/assert/is-string' ).isPrimitive; -var format = require( '@stdlib/string/format' ); - - -// VARIABLES // - -var debug = logger( 'plot:base:set:description' ); - - -// MAIN // - -/** -* Sets the description. -* -* @private -* @param {string} str - description -* @throws {TypeError} must be a string -*/ -function set( str ) { - /* eslint-disable no-invalid-this */ - if ( !isString( str ) ) { - throw new TypeError( format( 'invalid assignment. `%s` must be a string. Value: `%s`.', 'description', str ) ); - } - if ( str !== this._description ) { - debug( 'Current value: %s.', this._description ); - - this._description = str; - debug( 'New value: %s.', this._description ); - - this.emit( 'change' ); - } -} - - -// EXPORTS // - -module.exports = set; diff --git a/lib/node_modules/@stdlib/plot/base/ctor/lib/props/engine/engines.json b/lib/node_modules/@stdlib/plot/base/ctor/lib/props/engine/engines.json deleted file mode 100644 index 00a90ebbc0fc..000000000000 --- a/lib/node_modules/@stdlib/plot/base/ctor/lib/props/engine/engines.json +++ /dev/null @@ -1,3 +0,0 @@ -[ - "svg" -] diff --git a/lib/node_modules/@stdlib/plot/base/ctor/lib/props/engine/get.js b/lib/node_modules/@stdlib/plot/base/ctor/lib/props/engine/get.js deleted file mode 100644 index adcb427d9065..000000000000 --- a/lib/node_modules/@stdlib/plot/base/ctor/lib/props/engine/get.js +++ /dev/null @@ -1,35 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -/** -* Returns the render engine. -* -* @private -* @returns {string} engine -*/ -function get() { - /* eslint-disable no-invalid-this */ - return this._engine; -} - - -// EXPORTS // - -module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/base/ctor/lib/props/engine/set.js b/lib/node_modules/@stdlib/plot/base/ctor/lib/props/engine/set.js deleted file mode 100644 index a830f484c6a5..000000000000 --- a/lib/node_modules/@stdlib/plot/base/ctor/lib/props/engine/set.js +++ /dev/null @@ -1,61 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); -var contains = require( '@stdlib/assert/contains' ); -var format = require( '@stdlib/string/format' ); -var ENGINES = require( './engines.json' ); - - -// VARIABLES // - -var debug = logger( 'plot:base:set:engine' ); - - -// MAIN // - -/** -* Sets the engine. -* -* @private -* @param {string} engine - engine -* @throws {TypeError} must be a recognized engine -*/ -function set( engine ) { - /* eslint-disable no-invalid-this */ - if ( !contains( ENGINES, engine ) ) { - throw new TypeError( format( 'invalid assignment. `%s` must be one of the following: "%s". Value: `%s`.', 'engine', ENGINES.join( '", "' ), engine ) ); - } - if ( engine !== this._engine ) { - debug( 'Current value: %s.', this._engine ); - - this._engine = engine; - debug( 'New value: %s.', this._engine ); - - this.emit( 'change' ); - } -} - - -// EXPORTS // - -module.exports = set; diff --git a/lib/node_modules/@stdlib/plot/base/ctor/lib/props/graph-height/get.js b/lib/node_modules/@stdlib/plot/base/ctor/lib/props/graph-height/get.js deleted file mode 100644 index a3da4e01eb4d..000000000000 --- a/lib/node_modules/@stdlib/plot/base/ctor/lib/props/graph-height/get.js +++ /dev/null @@ -1,35 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -/** -* Returns the expected graph height. -* -* @private -* @returns {number} graph height -*/ -function get() { - /* eslint-disable no-invalid-this */ - return this._height - this._paddingTop - this._paddingBottom; -} - - -// EXPORTS // - -module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/base/ctor/lib/props/graph-width/get.js b/lib/node_modules/@stdlib/plot/base/ctor/lib/props/graph-width/get.js deleted file mode 100644 index 21a60f9fb9d3..000000000000 --- a/lib/node_modules/@stdlib/plot/base/ctor/lib/props/graph-width/get.js +++ /dev/null @@ -1,35 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -/** -* Returns the expected graph width. -* -* @private -* @returns {number} graph width -*/ -function get() { - /* eslint-disable no-invalid-this */ - return this._width - this._paddingLeft - this._paddingRight; -} - - -// EXPORTS // - -module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/base/ctor/lib/props/height/get.js b/lib/node_modules/@stdlib/plot/base/ctor/lib/props/height/get.js deleted file mode 100644 index 64bcb891b201..000000000000 --- a/lib/node_modules/@stdlib/plot/base/ctor/lib/props/height/get.js +++ /dev/null @@ -1,35 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -/** -* Returns the height. -* -* @private -* @returns {number} height -*/ -function get() { - /* eslint-disable no-invalid-this */ - return this._height; -} - - -// EXPORTS // - -module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/base/ctor/lib/props/height/set.js b/lib/node_modules/@stdlib/plot/base/ctor/lib/props/height/set.js deleted file mode 100644 index d965f9dbd6c8..000000000000 --- a/lib/node_modules/@stdlib/plot/base/ctor/lib/props/height/set.js +++ /dev/null @@ -1,60 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); -var isPositiveNumber = require( '@stdlib/assert/is-positive-number' ).isPrimitive; -var format = require( '@stdlib/string/format' ); - - -// VARIABLES // - -var debug = logger( 'plot:base:set:height' ); - - -// MAIN // - -/** -* Sets the height. -* -* @private -* @param {PositiveNumber} height - height -* @throws {TypeError} must be a positive number -*/ -function set( height ) { - /* eslint-disable no-invalid-this */ - if ( !isPositiveNumber( height ) ) { - throw new TypeError( format( 'invalid assignment. `%s` must be a positive number. Value: `%s`.', 'height', height ) ); - } - if ( height !== this._height ) { - debug( 'Current value: %d.', this._height ); - - this._height = height; - debug( 'New Value: %d.', this._height ); - - this.emit( 'change' ); - } -} - - -// EXPORTS // - -module.exports = set; diff --git a/lib/node_modules/@stdlib/plot/base/ctor/lib/props/labels/get.js b/lib/node_modules/@stdlib/plot/base/ctor/lib/props/labels/get.js deleted file mode 100644 index 8188d4f4916d..000000000000 --- a/lib/node_modules/@stdlib/plot/base/ctor/lib/props/labels/get.js +++ /dev/null @@ -1,35 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -/** -* Returns the data labels. -* -* @private -* @returns {(EmptyArray|StringArray)} labels -*/ -function get() { - /* eslint-disable no-invalid-this */ - return this._labels.slice(); -} - - -// EXPORTS // - -module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/base/ctor/lib/props/labels/set.js b/lib/node_modules/@stdlib/plot/base/ctor/lib/props/labels/set.js deleted file mode 100644 index 6d680d56c97c..000000000000 --- a/lib/node_modules/@stdlib/plot/base/ctor/lib/props/labels/set.js +++ /dev/null @@ -1,59 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); -var isEmptyArray = require( '@stdlib/assert/is-empty-array' ); -var isStringArray = require( '@stdlib/assert/is-string-array' ).primitives; -var format = require( '@stdlib/string/format' ); - - -// VARIABLES // - -var debug = logger( 'plot:base:set:labels' ); - - -// MAIN // - -/** -* Sets the data labels. -* -* @private -* @param {(StringArray|EmptyArray)} labels - data labels -* @throws {TypeError} must be either an array of strings or an empty array -*/ -function set( labels ) { - /* eslint-disable no-invalid-this */ - if ( !isEmptyArray( labels ) && !isStringArray( labels ) ) { - throw new TypeError( format( 'invalid assignment. `%s` must be an array of strings or an empty array. Value: `%s`.', 'labels', labels ) ); - } - debug( 'Current value: %s.', JSON.stringify( this._labels ) ); - - this._labels = labels.slice(); - debug( 'New Value: %s.', JSON.stringify( this._labels ) ); - - this.emit( 'change' ); -} - - -// EXPORTS // - -module.exports = set; diff --git a/lib/node_modules/@stdlib/plot/base/ctor/lib/props/line-opacity/get.js b/lib/node_modules/@stdlib/plot/base/ctor/lib/props/line-opacity/get.js deleted file mode 100644 index b6793668e589..000000000000 --- a/lib/node_modules/@stdlib/plot/base/ctor/lib/props/line-opacity/get.js +++ /dev/null @@ -1,35 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -/** -* Returns the line opacity. -* -* @private -* @returns {NumberArray} line opacity -*/ -function get() { - /* eslint-disable no-invalid-this */ - return this._lineOpacity.slice(); -} - - -// EXPORTS // - -module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/base/ctor/lib/props/line-opacity/set.js b/lib/node_modules/@stdlib/plot/base/ctor/lib/props/line-opacity/set.js deleted file mode 100644 index 35abfb4677ad..000000000000 --- a/lib/node_modules/@stdlib/plot/base/ctor/lib/props/line-opacity/set.js +++ /dev/null @@ -1,72 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); -var isNumber = require( '@stdlib/assert/is-number' ).isPrimitive; -var isNumberArray = require( '@stdlib/assert/is-number-array' ).primitives; -var format = require( '@stdlib/string/format' ); - - -// VARIABLES // - -var debug = logger( 'plot:base:set:line-opacity' ); - - -// MAIN // - -/** -* Sets the line opacity. -* -* @private -* @param {(number|NumberArray)} v - opacity -* @throws {TypeError} must be a number or number array -* @throws {RangeError} must be a number on the interval `[0,1]` -*/ -function set( v ) { - /* eslint-disable no-invalid-this */ - var isNum = isNumber( v ); - var i; - if ( !isNum && !isNumberArray( v ) ) { - throw new TypeError( format( 'invalid assignment. `%s` must be a number or an array of numbers. Value: `%s`.', 'lineOpacity', v ) ); - } - if ( isNum ) { - v = [ v ]; - } else { - v = v.slice(); - } - for ( i = 0; i < v.length; i++ ) { - if ( v[ i ] < 0.0 || v[ i ] > 1.0 ) { - throw new RangeError( format( 'invalid assignment. A `%s` must be a number on the interval: [0, 1]. Value: `%f`.', 'lineOpacity', v[i] ) ); - } - } - debug( 'Current value: %s.', JSON.stringify( this._lineOpacity ) ); - - this._lineOpacity = v; - debug( 'New Value: %s.', JSON.stringify( this._lineOpacity ) ); - - this.emit( 'change' ); -} - - -// EXPORTS // - -module.exports = set; diff --git a/lib/node_modules/@stdlib/plot/base/ctor/lib/props/line-style/get.js b/lib/node_modules/@stdlib/plot/base/ctor/lib/props/line-style/get.js deleted file mode 100644 index 61d078c0c175..000000000000 --- a/lib/node_modules/@stdlib/plot/base/ctor/lib/props/line-style/get.js +++ /dev/null @@ -1,35 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -/** -* Returns the line style(s). -* -* @private -* @returns {StringArray} line style(s) -*/ -function get() { - /* eslint-disable no-invalid-this */ - return this._lineStyle.slice(); -} - - -// EXPORTS // - -module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/base/ctor/lib/props/line-style/line_styles.json b/lib/node_modules/@stdlib/plot/base/ctor/lib/props/line-style/line_styles.json deleted file mode 100644 index 94d97ef15ffa..000000000000 --- a/lib/node_modules/@stdlib/plot/base/ctor/lib/props/line-style/line_styles.json +++ /dev/null @@ -1,7 +0,0 @@ -[ - "-", - "--", - ":", - "-.", - "none" -] diff --git a/lib/node_modules/@stdlib/plot/base/ctor/lib/props/line-style/set.js b/lib/node_modules/@stdlib/plot/base/ctor/lib/props/line-style/set.js deleted file mode 100644 index f539119d5af0..000000000000 --- a/lib/node_modules/@stdlib/plot/base/ctor/lib/props/line-style/set.js +++ /dev/null @@ -1,74 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); -var isString = require( '@stdlib/assert/is-string' ).isPrimitive; -var isStringArray = require( '@stdlib/assert/is-string-array' ).primitives; -var format = require( '@stdlib/string/format' ); -var indexOf = require( '@stdlib/utils/index-of' ); -var LINESTYLES = require( './line_styles.json' ); - - -// VARIABLES // - -var debug = logger( 'plot:base:set:line-style' ); - - -// MAIN // - -/** -* Sets the line style(s). -* -* @private -* @param {(string|StringArray)} v - line style(s) -* @throws {TypeError} must be a string or string array -* @throws {Error} must be a supported line style -*/ -function set( v ) { - /* eslint-disable no-invalid-this */ - var isStr = isString( v ); - var i; - if ( !isStr && !isStringArray( v ) ) { - throw new TypeError( format( 'invalid assignment. `%s` must be a string or an array of strings. Value: `%s`.', 'lineStyle', v ) ); - } - if ( isStr ) { - v = [ v ]; - } else { - v = v.slice(); - } - for ( i = 0; i < v.length; i++ ) { - if ( indexOf( LINESTYLES, v[i] ) === -1 ) { - throw new Error( format( 'invalid assignment. Unsupported/unrecognized line style. Must be one of the following: "%s". Value: `%s`.', LINESTYLES.join( '", "' ), v[i] ) ); - } - } - debug( 'Current value: %s.', JSON.stringify( this._lineStyle ) ); - - this._lineStyle = v; - debug( 'New Value: %s.', JSON.stringify( this._lineStyle ) ); - - this.emit( 'change' ); -} - - -// EXPORTS // - -module.exports = set; diff --git a/lib/node_modules/@stdlib/plot/base/ctor/lib/props/line-width/get.js b/lib/node_modules/@stdlib/plot/base/ctor/lib/props/line-width/get.js deleted file mode 100644 index 4a4469808504..000000000000 --- a/lib/node_modules/@stdlib/plot/base/ctor/lib/props/line-width/get.js +++ /dev/null @@ -1,35 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -/** -* Returns the line width. -* -* @private -* @returns {Array} line width(s) -*/ -function get() { - /* eslint-disable no-invalid-this */ - return this._lineWidth.slice(); -} - - -// EXPORTS // - -module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/base/ctor/lib/props/line-width/set.js b/lib/node_modules/@stdlib/plot/base/ctor/lib/props/line-width/set.js deleted file mode 100644 index 54fbe80c7e13..000000000000 --- a/lib/node_modules/@stdlib/plot/base/ctor/lib/props/line-width/set.js +++ /dev/null @@ -1,65 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); -var isNonNegativeInteger = require( '@stdlib/assert/is-nonnegative-integer' ).isPrimitive; -var isNonNegativeIntegerArray = require( '@stdlib/assert/is-nonnegative-integer-array' ).primitives; -var format = require( '@stdlib/string/format' ); - - -// VARIABLES // - -var debug = logger( 'plot:base:set:line-width' ); - - -// MAIN // - -/** -* Sets the line width(s). -* -* @private -* @param {(NonNegativeInteger|Array)} v - width -* @throws {TypeError} must be a nonnegative integer or nonnegative integer array -*/ -function set( v ) { - /* eslint-disable no-invalid-this */ - var isInt = isNonNegativeInteger( v ); - if ( !isInt && !isNonNegativeIntegerArray( v ) ) { - throw new TypeError( format( 'invalid assignment. `%s` must be a nonnegative integer or an array of nonnegative integers. Value: `%s`.', 'lineWidth', v ) ); - } - if ( isInt ) { - v = [ v ]; - } else { - v = v.slice(); - } - debug( 'Current value: %s.', JSON.stringify( this._lineWidth ) ); - - this._lineWidth = v; - debug( 'New Value: %s.', JSON.stringify( this._lineWidth ) ); - - this.emit( 'change' ); -} - - -// EXPORTS // - -module.exports = set; diff --git a/lib/node_modules/@stdlib/plot/base/ctor/lib/props/padding-bottom/get.js b/lib/node_modules/@stdlib/plot/base/ctor/lib/props/padding-bottom/get.js deleted file mode 100644 index af214a0d0f90..000000000000 --- a/lib/node_modules/@stdlib/plot/base/ctor/lib/props/padding-bottom/get.js +++ /dev/null @@ -1,35 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -/** -* Returns the bottom padding. -* -* @private -* @returns {number} padding -*/ -function get() { - /* eslint-disable no-invalid-this */ - return this._paddingBottom; -} - - -// EXPORTS // - -module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/base/ctor/lib/props/padding-bottom/set.js b/lib/node_modules/@stdlib/plot/base/ctor/lib/props/padding-bottom/set.js deleted file mode 100644 index fa8027b39122..000000000000 --- a/lib/node_modules/@stdlib/plot/base/ctor/lib/props/padding-bottom/set.js +++ /dev/null @@ -1,60 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); -var isNonNegativeInteger = require( '@stdlib/assert/is-nonnegative-integer' ).isPrimitive; -var format = require( '@stdlib/string/format' ); - - -// VARIABLES // - -var debug = logger( 'plot:base:set:padding-bottom' ); - - -// MAIN // - -/** -* Sets the bottom padding. -* -* @private -* @param {NonNegativeInteger} padding - padding -* @throws {TypeError} must be a nonnegative integer -*/ -function set( padding ) { - /* eslint-disable no-invalid-this */ - if ( !isNonNegativeInteger( padding ) ) { - throw new TypeError( format( 'invalid assignment. `%s` must be a nonnegative integer. Value: `%s`.', 'paddingBottom', padding ) ); - } - if ( padding !== this._paddingBottom ) { - debug( 'Current value: %d.', this._paddingBottom ); - - this._paddingBottom = padding; - debug( 'New value: %d.', this._paddingBottom ); - - this.emit( 'change' ); - } -} - - -// EXPORTS // - -module.exports = set; diff --git a/lib/node_modules/@stdlib/plot/base/ctor/lib/props/padding-left/get.js b/lib/node_modules/@stdlib/plot/base/ctor/lib/props/padding-left/get.js deleted file mode 100644 index 162c41b11c0a..000000000000 --- a/lib/node_modules/@stdlib/plot/base/ctor/lib/props/padding-left/get.js +++ /dev/null @@ -1,35 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -/** -* Returns the left padding. -* -* @private -* @returns {number} padding -*/ -function get() { - /* eslint-disable no-invalid-this */ - return this._paddingLeft; -} - - -// EXPORTS // - -module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/base/ctor/lib/props/padding-left/set.js b/lib/node_modules/@stdlib/plot/base/ctor/lib/props/padding-left/set.js deleted file mode 100644 index 1de72a88c30d..000000000000 --- a/lib/node_modules/@stdlib/plot/base/ctor/lib/props/padding-left/set.js +++ /dev/null @@ -1,60 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); -var isNonNegativeInteger = require( '@stdlib/assert/is-nonnegative-integer' ).isPrimitive; -var format = require( '@stdlib/string/format' ); - - -// VARIABLES // - -var debug = logger( 'plot:base:set:padding-left' ); - - -// MAIN // - -/** -* Sets the left padding. -* -* @private -* @param {NonNegativeInteger} padding - padding -* @throws {TypeError} must be a nonnegative integer -*/ -function set( padding ) { - /* eslint-disable no-invalid-this */ - if ( !isNonNegativeInteger( padding ) ) { - throw new TypeError( format( 'invalid assignment. `%s` must be a nonnegative integer. Value: `%s`.', 'paddingLeft', padding ) ); - } - if ( padding !== this._paddingLeft ) { - debug( 'Current value: %d.', this._paddingLeft ); - - this._paddingLeft = padding; - debug( 'New value: %d.', this._paddingLeft ); - - this.emit( 'change' ); - } -} - - -// EXPORTS // - -module.exports = set; diff --git a/lib/node_modules/@stdlib/plot/base/ctor/lib/props/padding-right/get.js b/lib/node_modules/@stdlib/plot/base/ctor/lib/props/padding-right/get.js deleted file mode 100644 index 3da30d190e78..000000000000 --- a/lib/node_modules/@stdlib/plot/base/ctor/lib/props/padding-right/get.js +++ /dev/null @@ -1,35 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -/** -* Returns the right padding. -* -* @private -* @returns {number} padding -*/ -function get() { - /* eslint-disable no-invalid-this */ - return this._paddingRight; -} - - -// EXPORTS // - -module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/base/ctor/lib/props/padding-right/set.js b/lib/node_modules/@stdlib/plot/base/ctor/lib/props/padding-right/set.js deleted file mode 100644 index 82ae5a627ef7..000000000000 --- a/lib/node_modules/@stdlib/plot/base/ctor/lib/props/padding-right/set.js +++ /dev/null @@ -1,60 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); -var isNonNegativeInteger = require( '@stdlib/assert/is-nonnegative-integer' ).isPrimitive; -var format = require( '@stdlib/string/format' ); - - -// VARIABLES // - -var debug = logger( 'plot:base:set:padding-right' ); - - -// MAIN // - -/** -* Sets the right padding. -* -* @private -* @param {NonNegativeInteger} padding - padding -* @throws {TypeError} must be a nonnegative integer -*/ -function set( padding ) { - /* eslint-disable no-invalid-this */ - if ( !isNonNegativeInteger( padding ) ) { - throw new TypeError( format( 'invalid assignment. `%s` must be a nonnegative integer. Value: `%s`.', 'paddingRight', padding ) ); - } - if ( padding !== this._paddingRight ) { - debug( 'Current value: %d.', this._paddingRight ); - - this._paddingRight = padding; - debug( 'New value: %d.', this._paddingRight ); - - this.emit( 'change' ); - } -} - - -// EXPORTS // - -module.exports = set; diff --git a/lib/node_modules/@stdlib/plot/base/ctor/lib/props/padding-top/get.js b/lib/node_modules/@stdlib/plot/base/ctor/lib/props/padding-top/get.js deleted file mode 100644 index 4afa6177a7b1..000000000000 --- a/lib/node_modules/@stdlib/plot/base/ctor/lib/props/padding-top/get.js +++ /dev/null @@ -1,35 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -/** -* Returns the top padding. -* -* @private -* @returns {number} padding -*/ -function get() { - /* eslint-disable no-invalid-this */ - return this._paddingTop; -} - - -// EXPORTS // - -module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/base/ctor/lib/props/padding-top/set.js b/lib/node_modules/@stdlib/plot/base/ctor/lib/props/padding-top/set.js deleted file mode 100644 index c20f63e677cc..000000000000 --- a/lib/node_modules/@stdlib/plot/base/ctor/lib/props/padding-top/set.js +++ /dev/null @@ -1,60 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); -var isNonNegativeInteger = require( '@stdlib/assert/is-nonnegative-integer' ).isPrimitive; -var format = require( '@stdlib/string/format' ); - - -// VARIABLES // - -var debug = logger( 'plot:base:set:padding-top' ); - - -// MAIN // - -/** -* Sets the top padding. -* -* @private -* @param {NonNegativeInteger} padding - padding -* @throws {TypeError} must be a nonnegative integer -*/ -function set( padding ) { - /* eslint-disable no-invalid-this */ - if ( !isNonNegativeInteger( padding ) ) { - throw new TypeError( format( 'invalid assignment. `%s` must be a nonnegative integer. Value: `%s`.', 'paddingTop', padding ) ); - } - if ( padding !== this._paddingTop ) { - debug( 'Current value: %d.', this._paddingTop ); - - this._paddingTop = padding; - debug( 'New value: %d.', this._paddingTop ); - - this.emit( 'change' ); - } -} - - -// EXPORTS // - -module.exports = set; diff --git a/lib/node_modules/@stdlib/plot/base/ctor/lib/props/render-format/formats.json b/lib/node_modules/@stdlib/plot/base/ctor/lib/props/render-format/formats.json deleted file mode 100644 index 7479e772e50e..000000000000 --- a/lib/node_modules/@stdlib/plot/base/ctor/lib/props/render-format/formats.json +++ /dev/null @@ -1,4 +0,0 @@ -[ - "vdom", - "html" -] diff --git a/lib/node_modules/@stdlib/plot/base/ctor/lib/props/render-format/get.js b/lib/node_modules/@stdlib/plot/base/ctor/lib/props/render-format/get.js deleted file mode 100644 index 8b424640115e..000000000000 --- a/lib/node_modules/@stdlib/plot/base/ctor/lib/props/render-format/get.js +++ /dev/null @@ -1,35 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -/** -* Returns the render format. -* -* @private -* @returns {string} format -*/ -function get() { - /* eslint-disable no-invalid-this */ - return this._renderFormat; -} - - -// EXPORTS // - -module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/base/ctor/lib/props/render-format/set.js b/lib/node_modules/@stdlib/plot/base/ctor/lib/props/render-format/set.js deleted file mode 100644 index 9eb41a1fd6c5..000000000000 --- a/lib/node_modules/@stdlib/plot/base/ctor/lib/props/render-format/set.js +++ /dev/null @@ -1,61 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); -var indexOf = require( '@stdlib/utils/index-of' ); -var format = require( '@stdlib/string/format' ); -var FORMATS = require( './formats.json' ); - - -// VARIABLES // - -var debug = logger( 'plot:base:set:render-format' ); - - -// MAIN // - -/** -* Sets the render format. -* -* @private -* @param {string} fmt - format -* @throws {TypeError} must be a recognized render format -*/ -function set( fmt ) { - /* eslint-disable no-invalid-this */ - if ( indexOf( FORMATS, fmt ) === -1 ) { - throw new TypeError( format( 'invalid assignment. Unrecognized/unsupported `%s`. Must be one of the following: "%s". Value: `%s`.', 'format', FORMATS.join( '", "' ), fmt ) ); - } - if ( fmt !== this._renderFormat ) { - debug( 'Current value: %s.', this._renderFormat ); - - this._renderFormat = fmt; - debug( 'New value: %s.', this._renderFormat ); - - this.emit( 'change' ); - } -} - - -// EXPORTS // - -module.exports = set; diff --git a/lib/node_modules/@stdlib/plot/base/ctor/lib/props/title/get.js b/lib/node_modules/@stdlib/plot/base/ctor/lib/props/title/get.js deleted file mode 100644 index 9417faaac109..000000000000 --- a/lib/node_modules/@stdlib/plot/base/ctor/lib/props/title/get.js +++ /dev/null @@ -1,35 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -/** -* Returns the title. -* -* @private -* @returns {string} title -*/ -function get() { - /* eslint-disable no-invalid-this */ - return this._title; -} - - -// EXPORTS // - -module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/base/ctor/lib/props/title/set.js b/lib/node_modules/@stdlib/plot/base/ctor/lib/props/title/set.js deleted file mode 100644 index fcb285de8ecc..000000000000 --- a/lib/node_modules/@stdlib/plot/base/ctor/lib/props/title/set.js +++ /dev/null @@ -1,60 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); -var isString = require( '@stdlib/assert/is-string' ).isPrimitive; -var format = require( '@stdlib/string/format' ); - - -// VARIABLES // - -var debug = logger( 'plot:base:set:title' ); - - -// MAIN // - -/** -* Sets the title. -* -* @private -* @param {string} str - title -* @throws {TypeError} must be a string -*/ -function set( str ) { - /* eslint-disable no-invalid-this */ - if ( !isString( str ) ) { - throw new TypeError( format( 'invalid assignment. `%s` must be a string. Value: `%s`.', 'title', str ) ); - } - if ( str !== this._title ) { - debug( 'Current value: %s.', this._title ); - - this._title = str; - debug( 'New value: %s.', this._title ); - - this.emit( 'change' ); - } -} - - -// EXPORTS // - -module.exports = set; diff --git a/lib/node_modules/@stdlib/plot/base/ctor/lib/props/viewer/get.js b/lib/node_modules/@stdlib/plot/base/ctor/lib/props/viewer/get.js deleted file mode 100644 index a8044cae0cef..000000000000 --- a/lib/node_modules/@stdlib/plot/base/ctor/lib/props/viewer/get.js +++ /dev/null @@ -1,35 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -/** -* Returns the plot viewer. -* -* @private -* @returns {string} viewer -*/ -function get() { - /* eslint-disable no-invalid-this */ - return this._viewer; -} - - -// EXPORTS // - -module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/base/ctor/lib/props/viewer/set.js b/lib/node_modules/@stdlib/plot/base/ctor/lib/props/viewer/set.js deleted file mode 100644 index fd2fb24798c5..000000000000 --- a/lib/node_modules/@stdlib/plot/base/ctor/lib/props/viewer/set.js +++ /dev/null @@ -1,61 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); -var indexOf = require( '@stdlib/utils/index-of' ); -var format = require( '@stdlib/string/format' ); -var VIEWERS = require( './viewers.json' ); - - -// VARIABLES // - -var debug = logger( 'plot:base:set:viewer' ); - - -// MAIN // - -/** -* Sets the viewer. -* -* @private -* @param {string} viewer - viewer -* @throws {TypeError} must be a recognized viewer -*/ -function set( viewer ) { - /* eslint-disable no-invalid-this */ - if ( indexOf( VIEWERS, viewer ) === -1 ) { - throw new TypeError( format( 'invalid assignment. Unrecognized/unsupported `%s`. Value: `%s`.', 'viewer', viewer ) ); - } - if ( viewer !== this._viewer ) { - debug( 'Current value: %s.', this._viewer ); - - this._viewer = viewer; - debug( 'New value: %s.', this._viewer ); - - this.emit( 'change' ); - } -} - - -// EXPORTS // - -module.exports = set; diff --git a/lib/node_modules/@stdlib/plot/base/ctor/lib/props/viewer/viewers.json b/lib/node_modules/@stdlib/plot/base/ctor/lib/props/viewer/viewers.json deleted file mode 100644 index f515292564fb..000000000000 --- a/lib/node_modules/@stdlib/plot/base/ctor/lib/props/viewer/viewers.json +++ /dev/null @@ -1,7 +0,0 @@ -[ - "none", - "browser", - "terminal", - "stdout", - "window" -] diff --git a/lib/node_modules/@stdlib/plot/base/ctor/lib/props/width/get.js b/lib/node_modules/@stdlib/plot/base/ctor/lib/props/width/get.js deleted file mode 100644 index cfa5f0e70adf..000000000000 --- a/lib/node_modules/@stdlib/plot/base/ctor/lib/props/width/get.js +++ /dev/null @@ -1,35 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -/** -* Returns the width. -* -* @private -* @returns {number} width -*/ -function get() { - /* eslint-disable no-invalid-this */ - return this._width; -} - - -// EXPORTS // - -module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/base/ctor/lib/props/width/set.js b/lib/node_modules/@stdlib/plot/base/ctor/lib/props/width/set.js deleted file mode 100644 index 1368f5e1aa31..000000000000 --- a/lib/node_modules/@stdlib/plot/base/ctor/lib/props/width/set.js +++ /dev/null @@ -1,60 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); -var isPositiveNumber = require( '@stdlib/assert/is-positive-number' ).isPrimitive; -var format = require( '@stdlib/string/format' ); - - -// VARIABLES // - -var debug = logger( 'plot:base:set:width' ); - - -// MAIN // - -/** -* Sets the width. -* -* @private -* @param {PositiveNumber} width - width -* @throws {TypeError} must be a positive number -*/ -function set( width ) { - /* eslint-disable no-invalid-this */ - if ( !isPositiveNumber( width ) ) { - throw new TypeError( format( 'invalid assignment. `%s` must be a positive number. Value: `%s`.', 'width', width ) ); - } - if ( width !== this._width ) { - debug( 'Current value: %d.', this._width ); - - this._width = width; - debug( 'New value: %d.', this._width ); - - this.emit( 'change' ); - } -} - - -// EXPORTS // - -module.exports = set; diff --git a/lib/node_modules/@stdlib/plot/base/ctor/lib/props/x-axis-orient/get.js b/lib/node_modules/@stdlib/plot/base/ctor/lib/props/x-axis-orient/get.js deleted file mode 100644 index a96e518039c6..000000000000 --- a/lib/node_modules/@stdlib/plot/base/ctor/lib/props/x-axis-orient/get.js +++ /dev/null @@ -1,35 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -/** -* Returns the x-axis orientation. -* -* @private -* @returns {string} orientation -*/ -function get() { - /* eslint-disable no-invalid-this */ - return this._xAxisOrient; -} - - -// EXPORTS // - -module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/base/ctor/lib/props/x-axis-orient/orientations.json b/lib/node_modules/@stdlib/plot/base/ctor/lib/props/x-axis-orient/orientations.json deleted file mode 100644 index 1e375c31f6f7..000000000000 --- a/lib/node_modules/@stdlib/plot/base/ctor/lib/props/x-axis-orient/orientations.json +++ /dev/null @@ -1,4 +0,0 @@ -[ - "bottom", - "top" -] diff --git a/lib/node_modules/@stdlib/plot/base/ctor/lib/props/x-axis-orient/set.js b/lib/node_modules/@stdlib/plot/base/ctor/lib/props/x-axis-orient/set.js deleted file mode 100644 index 23cfa4f40195..000000000000 --- a/lib/node_modules/@stdlib/plot/base/ctor/lib/props/x-axis-orient/set.js +++ /dev/null @@ -1,61 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); -var indexOf = require( '@stdlib/utils/index-of' ); -var format = require( '@stdlib/string/format' ); -var ORIENTATIONS = require( './orientations.json' ); - - -// VARIABLES // - -var debug = logger( 'plot:base:set:x-axis-orient' ); - - -// MAIN // - -/** -* Sets the x-axis orientation. -* -* @private -* @param {string} orientation - axis orientation -* @throws {TypeError} must be either `'bottom'` or `'top'` -*/ -function set( orientation ) { - /* eslint-disable no-invalid-this */ - if ( indexOf( ORIENTATIONS, orientation ) === -1 ) { - throw new TypeError( format( 'invalid assignment. `%s` must be one of the following: "%s". Value: `%s`.', 'xAxisOrient', ORIENTATIONS.join( '", "' ), orientation ) ); - } - if ( orientation !== this._xAxisOrient ) { - debug( 'Current value: %s.', this._xAxisOrient ); - - this._xAxisOrient = orientation; - debug( 'New value: %s.', this._xAxisOrient ); - - this.emit( 'change' ); - } -} - - -// EXPORTS // - -module.exports = set; diff --git a/lib/node_modules/@stdlib/plot/base/ctor/lib/props/x-domain/get.js b/lib/node_modules/@stdlib/plot/base/ctor/lib/props/x-domain/get.js deleted file mode 100644 index 44e571f78fd4..000000000000 --- a/lib/node_modules/@stdlib/plot/base/ctor/lib/props/x-domain/get.js +++ /dev/null @@ -1,35 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -/** -* Returns the x-axis domain. -* -* @private -* @returns {Array} domain -*/ -function get() { - /* eslint-disable no-invalid-this */ - return [ this.xMin, this.xMax ]; -} - - -// EXPORTS // - -module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/base/ctor/lib/props/x-label/get.js b/lib/node_modules/@stdlib/plot/base/ctor/lib/props/x-label/get.js deleted file mode 100644 index eeec342fbd86..000000000000 --- a/lib/node_modules/@stdlib/plot/base/ctor/lib/props/x-label/get.js +++ /dev/null @@ -1,35 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -/** -* Returns the x-axis label. -* -* @private -* @returns {string} label -*/ -function get() { - /* eslint-disable no-invalid-this */ - return this._xLabel; -} - - -// EXPORTS // - -module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/base/ctor/lib/props/x-label/set.js b/lib/node_modules/@stdlib/plot/base/ctor/lib/props/x-label/set.js deleted file mode 100644 index 1774448ab5b6..000000000000 --- a/lib/node_modules/@stdlib/plot/base/ctor/lib/props/x-label/set.js +++ /dev/null @@ -1,60 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); -var isString = require( '@stdlib/assert/is-string' ).isPrimitive; -var format = require( '@stdlib/string/format' ); - - -// VARIABLES // - -var debug = logger( 'plot:base:set:x-label' ); - - -// MAIN // - -/** -* Sets the x-axis label. -* -* @private -* @param {string} label - axis label -* @throws {TypeError} must be a string -*/ -function set( label ) { - /* eslint-disable no-invalid-this */ - if ( !isString( label ) ) { - throw new TypeError( format( 'invalid assignment. `%s` must be a string. Value: `%s`.', 'xLabel', label ) ); - } - if ( label !== this._xLabel ) { - debug( 'Current value: %s.', this._xLabel ); - - this._xLabel = label; - debug( 'New value: %s.', this._xLabel ); - - this.emit( 'change' ); - } -} - - -// EXPORTS // - -module.exports = set; diff --git a/lib/node_modules/@stdlib/plot/base/ctor/lib/props/x-num-ticks/get.js b/lib/node_modules/@stdlib/plot/base/ctor/lib/props/x-num-ticks/get.js deleted file mode 100644 index 02dc4efd718c..000000000000 --- a/lib/node_modules/@stdlib/plot/base/ctor/lib/props/x-num-ticks/get.js +++ /dev/null @@ -1,35 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -/** -* Returns the number of x-axis tick marks. -* -* @private -* @returns {(NonNegativeInteger|null)} number of ticks -*/ -function get() { - /* eslint-disable no-invalid-this */ - return this._xNumTicks; -} - - -// EXPORTS // - -module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/base/ctor/lib/props/x-num-ticks/set.js b/lib/node_modules/@stdlib/plot/base/ctor/lib/props/x-num-ticks/set.js deleted file mode 100644 index dffc6f437321..000000000000 --- a/lib/node_modules/@stdlib/plot/base/ctor/lib/props/x-num-ticks/set.js +++ /dev/null @@ -1,61 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); -var isNull = require( '@stdlib/assert/is-null' ); -var isNonNegativeInteger = require( '@stdlib/assert/is-nonnegative-integer' ).isPrimitive; -var format = require( '@stdlib/string/format' ); - - -// VARIABLES // - -var debug = logger( 'plot:base:set:x-num-ticks' ); - - -// MAIN // - -/** -* Sets the number of x-axis tick marks. -* -* @private -* @param {(NonNegativeInteger|null)} ticks - number of ticks -* @throws {TypeError} must be a nonnegative integer or null -*/ -function set( ticks ) { - /* eslint-disable no-invalid-this */ - if ( !isNull( ticks ) && !isNonNegativeInteger( ticks ) ) { - throw new TypeError( format( 'invalid assignment. `%s` must be a nonnegative integer or null. Value: `%s`.', 'xNumTicks', ticks ) ); - } - if ( ticks !== this._xNumTicks ) { - debug( 'Current value: %d.', this._xNumTicks ); - - this._xNumTicks = ticks; - debug( 'New value: %d.', this._xNumTicks ); - - this.emit( 'change' ); - } -} - - -// EXPORTS // - -module.exports = set; diff --git a/lib/node_modules/@stdlib/plot/base/ctor/lib/props/x-pos/get.js b/lib/node_modules/@stdlib/plot/base/ctor/lib/props/x-pos/get.js deleted file mode 100644 index f231fc5db30b..000000000000 --- a/lib/node_modules/@stdlib/plot/base/ctor/lib/props/x-pos/get.js +++ /dev/null @@ -1,61 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); - - -// VARIABLES // - -var debug = logger( 'plot:base:x-pos' ); - - -// MAIN // - -/** -* Returns a function to map values to x-axis coordinate values. -* -* @private -* @returns {Function} map function -*/ -function get() { - /* eslint-disable no-invalid-this */ - var scale = this.xScale; - return xPos; - - /** - * Maps a value to a x-axis coordinate value. - * - * @private - * @param {number} d - datum - * @returns {number} pixel value - */ - function xPos( d ) { - var px = scale( d ); - debug( 'Value: %d => Pixel: %d.', d, px ); - return px; - } -} - - -// EXPORTS // - -module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/base/ctor/lib/props/x-range/get.js b/lib/node_modules/@stdlib/plot/base/ctor/lib/props/x-range/get.js deleted file mode 100644 index 15069e3c8c1a..000000000000 --- a/lib/node_modules/@stdlib/plot/base/ctor/lib/props/x-range/get.js +++ /dev/null @@ -1,35 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -/** -* Returns the x-axis range. -* -* @private -* @returns {NumberArray} range -*/ -function get() { - /* eslint-disable no-invalid-this */ - return [ 0, this.graphWidth ]; -} - - -// EXPORTS // - -module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/base/ctor/lib/props/x-tick-format/get.js b/lib/node_modules/@stdlib/plot/base/ctor/lib/props/x-tick-format/get.js deleted file mode 100644 index 8a6fc705016f..000000000000 --- a/lib/node_modules/@stdlib/plot/base/ctor/lib/props/x-tick-format/get.js +++ /dev/null @@ -1,50 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var format = require( 'd3-format' ).format; // TODO: remove -var timeFormat = require( 'd3-time-format' ).timeFormat; // TODO: remove -var isNull = require( '@stdlib/assert/is-null' ); - - -// MAIN // - -/** -* Returns the x-axis tick format. -* -* @private -* @returns {(Function|null)} format function or null -*/ -function get() { - /* eslint-disable no-invalid-this */ - if ( isNull( this._xTickFormat ) ) { - return this._xTickFormat; - } - if ( this._xScale === 'time' ) { - return timeFormat( this._xTickFormat ); - } - return format( this._xTickFormat ); -} - - -// EXPORTS // - -module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/base/ctor/lib/props/x-tick-format/set.js b/lib/node_modules/@stdlib/plot/base/ctor/lib/props/x-tick-format/set.js deleted file mode 100644 index 15106476fbec..000000000000 --- a/lib/node_modules/@stdlib/plot/base/ctor/lib/props/x-tick-format/set.js +++ /dev/null @@ -1,61 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); -var isNull = require( '@stdlib/assert/is-null' ); -var isString = require( '@stdlib/assert/is-string' ).isPrimitive; -var format = require( '@stdlib/string/format' ); - - -// VARIABLES // - -var debug = logger( 'plot:base:set:x-tick-format' ); - - -// MAIN // - -/** -* Sets the x-axis tick format. -* -* @private -* @param {(string|null)} fmt - axis tick format -* @throws {TypeError} must be a string -*/ -function set( fmt ) { - /* eslint-disable no-invalid-this */ - if ( !isNull( fmt ) && !isString( fmt ) ) { - throw new TypeError( format( 'invalid assignment. `%s` must be a string or null. Value: `%s`.', 'xTickFormat', fmt ) ); - } - if ( fmt !== this._xTickFormat ) { - debug( 'Current value: %s.', this._xTickFormat ); - - this._xTickFormat = fmt; - debug( 'New value: %s.', this._xTickFormat ); - - this.emit( 'change' ); - } -} - - -// EXPORTS // - -module.exports = set; diff --git a/lib/node_modules/@stdlib/plot/base/ctor/lib/props/y-axis-orient/get.js b/lib/node_modules/@stdlib/plot/base/ctor/lib/props/y-axis-orient/get.js deleted file mode 100644 index 599ea8ed8fab..000000000000 --- a/lib/node_modules/@stdlib/plot/base/ctor/lib/props/y-axis-orient/get.js +++ /dev/null @@ -1,35 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -/** -* Returns the y-axis orientation. -* -* @private -* @returns {string} orientation -*/ -function get() { - /* eslint-disable no-invalid-this */ - return this._yAxisOrient; -} - - -// EXPORTS // - -module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/base/ctor/lib/props/y-axis-orient/orientations.json b/lib/node_modules/@stdlib/plot/base/ctor/lib/props/y-axis-orient/orientations.json deleted file mode 100644 index d2d3df74d8c8..000000000000 --- a/lib/node_modules/@stdlib/plot/base/ctor/lib/props/y-axis-orient/orientations.json +++ /dev/null @@ -1,4 +0,0 @@ -[ - "left", - "right" -] diff --git a/lib/node_modules/@stdlib/plot/base/ctor/lib/props/y-axis-orient/set.js b/lib/node_modules/@stdlib/plot/base/ctor/lib/props/y-axis-orient/set.js deleted file mode 100644 index 7e2defe9c2b3..000000000000 --- a/lib/node_modules/@stdlib/plot/base/ctor/lib/props/y-axis-orient/set.js +++ /dev/null @@ -1,61 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); -var indexOf = require( '@stdlib/utils/index-of' ); -var format = require( '@stdlib/string/format' ); -var ORIENTATIONS = require( './orientations.json' ); - - -// VARIABLES // - -var debug = logger( 'plot:base:set:y-axis-orient' ); - - -// MAIN // - -/** -* Sets the y-axis orientation. -* -* @private -* @param {string} orientation - axis orientation -* @throws {TypeError} must be either `'left'` or `'right'` -*/ -function set( orientation ) { - /* eslint-disable no-invalid-this */ - if ( indexOf( ORIENTATIONS, orientation ) === -1 ) { - throw new TypeError( format( 'invalid assignment. `%s` must be one of the following: "%s". Value: `%s`.', 'yAxisOrient', ORIENTATIONS.join( '", "' ), orientation ) ); - } - if ( orientation !== this._yAxisOrient ) { - debug( 'Current value: %s.', this._yAxisOrient ); - - this._yAxisOrient = orientation; - debug( 'New value: %s.', this._yAxisOrient ); - - this.emit( 'change' ); - } -} - - -// EXPORTS // - -module.exports = set; diff --git a/lib/node_modules/@stdlib/plot/base/ctor/lib/props/y-domain/get.js b/lib/node_modules/@stdlib/plot/base/ctor/lib/props/y-domain/get.js deleted file mode 100644 index cf17fe4d171a..000000000000 --- a/lib/node_modules/@stdlib/plot/base/ctor/lib/props/y-domain/get.js +++ /dev/null @@ -1,35 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -/** -* Returns the y-axis domain. -* -* @private -* @returns {Array} domain -*/ -function get() { - /* eslint-disable no-invalid-this */ - return [ this.yMin, this.yMax ]; -} - - -// EXPORTS // - -module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/base/ctor/lib/props/y-label/get.js b/lib/node_modules/@stdlib/plot/base/ctor/lib/props/y-label/get.js deleted file mode 100644 index 4b36a06ee061..000000000000 --- a/lib/node_modules/@stdlib/plot/base/ctor/lib/props/y-label/get.js +++ /dev/null @@ -1,35 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -/** -* Returns the y-axis label. -* -* @private -* @returns {string} label -*/ -function get() { - /* eslint-disable no-invalid-this */ - return this._yLabel; -} - - -// EXPORTS // - -module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/base/ctor/lib/props/y-label/set.js b/lib/node_modules/@stdlib/plot/base/ctor/lib/props/y-label/set.js deleted file mode 100644 index e8fdab47fbd4..000000000000 --- a/lib/node_modules/@stdlib/plot/base/ctor/lib/props/y-label/set.js +++ /dev/null @@ -1,60 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); -var isString = require( '@stdlib/assert/is-string' ).isPrimitive; -var format = require( '@stdlib/string/format' ); - - -// VARIABLES // - -var debug = logger( 'plot:base:set:y-label' ); - - -// MAIN // - -/** -* Sets the y-axis label. -* -* @private -* @param {string} label - axis label -* @throws {TypeError} must be a string -*/ -function set( label ) { - /* eslint-disable no-invalid-this */ - if ( !isString( label ) ) { - throw new TypeError( format( 'invalid assignment. `%s` must be a string. Value: `%s`.', 'yLabel', label ) ); - } - if ( label !== this._yLabel ) { - debug( 'Current value: %s.', this._yLabel ); - - this._yLabel = label; - debug( 'New value: %s.', this._yLabel ); - - this.emit( 'change' ); - } -} - - -// EXPORTS // - -module.exports = set; diff --git a/lib/node_modules/@stdlib/plot/base/ctor/lib/props/y-num-ticks/get.js b/lib/node_modules/@stdlib/plot/base/ctor/lib/props/y-num-ticks/get.js deleted file mode 100644 index 5aec4efb05eb..000000000000 --- a/lib/node_modules/@stdlib/plot/base/ctor/lib/props/y-num-ticks/get.js +++ /dev/null @@ -1,35 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -/** -* Returns the number of y-axis tick marks. -* -* @private -* @returns {(NonNegativeInteger|null)} number of ticks -*/ -function get() { - /* eslint-disable no-invalid-this */ - return this._yNumTicks; -} - - -// EXPORTS // - -module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/base/ctor/lib/props/y-num-ticks/set.js b/lib/node_modules/@stdlib/plot/base/ctor/lib/props/y-num-ticks/set.js deleted file mode 100644 index b8eb61522630..000000000000 --- a/lib/node_modules/@stdlib/plot/base/ctor/lib/props/y-num-ticks/set.js +++ /dev/null @@ -1,61 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); -var isNull = require( '@stdlib/assert/is-null' ); -var isNonNegativeInteger = require( '@stdlib/assert/is-nonnegative-integer' ).isPrimitive; -var format = require( '@stdlib/string/format' ); - - -// VARIABLES // - -var debug = logger( 'plot:base:set:y-num-ticks' ); - - -// MAIN // - -/** -* Sets the number of y-axis tick marks. -* -* @private -* @param {(NonNegativeInteger|null)} ticks - number of ticks -* @throws {TypeError} must be a nonnegative integer or null -*/ -function set( ticks ) { - /* eslint-disable no-invalid-this */ - if ( !isNull( ticks ) && !isNonNegativeInteger( ticks ) ) { - throw new TypeError( format( 'invalid assignment. `%s` must be a nonnegative integer or null. Value: `%s`.', 'yNumTicks', ticks ) ); - } - if ( ticks !== this._yNumTicks ) { - debug( 'Current value: %d.', this._yNumTicks ); - - this._yNumTicks = ticks; - debug( 'New value: %d.', this._yNumTicks ); - - this.emit( 'change' ); - } -} - - -// EXPORTS // - -module.exports = set; diff --git a/lib/node_modules/@stdlib/plot/base/ctor/lib/props/y-pos/get.js b/lib/node_modules/@stdlib/plot/base/ctor/lib/props/y-pos/get.js deleted file mode 100644 index 1a0ff92cbec2..000000000000 --- a/lib/node_modules/@stdlib/plot/base/ctor/lib/props/y-pos/get.js +++ /dev/null @@ -1,61 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); - - -// VARIABLES // - -var debug = logger( 'plot:base:y-pos' ); - - -// MAIN // - -/** -* Returns a function to map values to y-axis coordinate values. -* -* @private -* @returns {Function} map function -*/ -function get() { - /* eslint-disable no-invalid-this */ - var scale = this.yScale; - return yPos; - - /** - * Maps a value to a y-axis coordinate value. - * - * @private - * @param {number} d - datum - * @returns {number} pixel value - */ - function yPos( d ) { - var px = scale( d ); - debug( 'Value: %d => Pixel: %d.', d, px ); - return px; - } -} - - -// EXPORTS // - -module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/base/ctor/lib/props/y-range/get.js b/lib/node_modules/@stdlib/plot/base/ctor/lib/props/y-range/get.js deleted file mode 100644 index 8bf31ee69185..000000000000 --- a/lib/node_modules/@stdlib/plot/base/ctor/lib/props/y-range/get.js +++ /dev/null @@ -1,35 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -/** -* Returns the y-axis range. -* -* @private -* @returns {NumberArray} range -*/ -function get() { - /* eslint-disable no-invalid-this */ - return [ this.graphHeight, 0 ]; -} - - -// EXPORTS // - -module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/base/ctor/lib/props/y-tick-format/get.js b/lib/node_modules/@stdlib/plot/base/ctor/lib/props/y-tick-format/get.js deleted file mode 100644 index 2490f0a38d06..000000000000 --- a/lib/node_modules/@stdlib/plot/base/ctor/lib/props/y-tick-format/get.js +++ /dev/null @@ -1,46 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var format = require( 'd3-format' ).format; // TODO: remove -var isNull = require( '@stdlib/assert/is-null' ); - - -// MAIN // - -/** -* Returns the y-axis tick format. -* -* @private -* @returns {(Function|null)} format function or null -*/ -function get() { - /* eslint-disable no-invalid-this */ - if ( isNull( this._yTickFormat ) ) { - return this._yTickFormat; - } - return format( this._yTickFormat ); -} - - -// EXPORTS // - -module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/base/ctor/lib/props/y-tick-format/set.js b/lib/node_modules/@stdlib/plot/base/ctor/lib/props/y-tick-format/set.js deleted file mode 100644 index 85640da51fe3..000000000000 --- a/lib/node_modules/@stdlib/plot/base/ctor/lib/props/y-tick-format/set.js +++ /dev/null @@ -1,61 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); -var isNull = require( '@stdlib/assert/is-null' ); -var isString = require( '@stdlib/assert/is-string' ).isPrimitive; -var format = require( '@stdlib/string/format' ); - - -// VARIABLES // - -var debug = logger( 'plot:base:set:y-tick-format' ); - - -// MAIN // - -/** -* Sets the y-axis tick format. -* -* @private -* @param {(string|null)} fmt - axis tick format -* @throws {TypeError} must be a string or null -*/ -function set( fmt ) { - /* eslint-disable no-invalid-this */ - if ( !isNull( fmt ) && !isString( fmt ) ) { - throw new TypeError( format( 'invalid assignment. `%s` must be a string or null. Value: `%s`.', 'yTickFormat', fmt ) ); - } - if ( fmt !== this._yTickFormat ) { - debug( 'Current value: %s.', this._yTickFormat ); - - this._yTickFormat = fmt; - debug( 'New value: %s.', this._yTickFormat ); - - this.emit( 'change' ); - } -} - - -// EXPORTS // - -module.exports = set; diff --git a/lib/node_modules/@stdlib/plot/base/ctor/lib/render/index.js b/lib/node_modules/@stdlib/plot/base/ctor/lib/render/index.js deleted file mode 100644 index 66ed0ae82de2..000000000000 --- a/lib/node_modules/@stdlib/plot/base/ctor/lib/render/index.js +++ /dev/null @@ -1,70 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); - - -// VARIABLES // - -var debug = logger( 'plot:base:render' ); - - -// MAIN // - -/** -* Renders a plot. -* -* @private -* @param {string} [format] - render format -* @returns {(VTree|string)} virtual tree or a string -*/ -function render( format ) { - /* eslint-disable no-invalid-this */ - var out; - var tmp; - var fmt; - - tmp = this.renderFormat; - if ( arguments.length ) { - // Temporarily set the render format: - this.renderFormat = format; - fmt = format; - } else { - fmt = tmp; - } - debug( 'Render format: %s.', this.renderFormat ); - - debug( 'Rendering...' ); - out = this._render( fmt ); - this.emit( 'render', out ); - - if ( arguments.length ) { - // Restore the render format: - this.renderFormat = tmp; - } - return out; -} - - -// EXPORTS // - -module.exports = render; diff --git a/lib/node_modules/@stdlib/plot/base/ctor/lib/render/stub.js b/lib/node_modules/@stdlib/plot/base/ctor/lib/render/stub.js deleted file mode 100644 index d7046a7a6463..000000000000 --- a/lib/node_modules/@stdlib/plot/base/ctor/lib/render/stub.js +++ /dev/null @@ -1,35 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -/** -* Placeholder `render` function. -* -* @private -* @param {string} fmt - render format -* @throws {Error} must be implemented by descendant classes -*/ -function render() { - throw new Error( 'not implemented' ); -} - - -// EXPORTS // - -module.exports = render; diff --git a/lib/node_modules/@stdlib/plot/base/ctor/lib/view/browser/index.html b/lib/node_modules/@stdlib/plot/base/ctor/lib/view/browser/index.html deleted file mode 100644 index 79dc0c842de1..000000000000 --- a/lib/node_modules/@stdlib/plot/base/ctor/lib/view/browser/index.html +++ /dev/null @@ -1,708 +0,0 @@ - - - - - - - - -   - - - - - -
{{plot}}
- - diff --git a/lib/node_modules/@stdlib/plot/base/ctor/lib/view/browser/index.js b/lib/node_modules/@stdlib/plot/base/ctor/lib/view/browser/index.js deleted file mode 100644 index f47b382bac42..000000000000 --- a/lib/node_modules/@stdlib/plot/base/ctor/lib/view/browser/index.js +++ /dev/null @@ -1,62 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var path = require( 'path' ); -var toHTML = require( 'vdom-to-html' ); -var readFileSync = require( '@stdlib/fs/read-file' ).sync; -var httpServer = require( '@stdlib/net/disposable-http-server' ); - - -// MAIN // - -/** -* Opens a plot in a browser window. -* -* @private -* @param {VTree} vtree - virtual DOM tree -*/ -function view( vtree ) { - var index; - var html; - - // Transform the virtual DOM tree to HTML: - html = toHTML( vtree ); - - // Inject the HTML: - index = path.join( __dirname, 'index.html' ); - index = readFileSync( index, { - 'encoding': 'utf8' - }); - - index = index.replace( /\{\{plot\}\}/, html ); - - // Create a disposable HTTP server: - httpServer({ - 'html': index, - 'open': true - }); -} - - -// EXPORTS // - -module.exports = view; diff --git a/lib/node_modules/@stdlib/plot/base/ctor/lib/view/electron/css/styles.css b/lib/node_modules/@stdlib/plot/base/ctor/lib/view/electron/css/styles.css deleted file mode 100644 index ed86f1a33289..000000000000 --- a/lib/node_modules/@stdlib/plot/base/ctor/lib/view/electron/css/styles.css +++ /dev/null @@ -1,135 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -.canvas { - display: block; - margin: 0 auto; -} - -.graph .hidden { - opacity: 0; -} - -/*.annotation .marker { - cursor: pointer; - opacity: 0.2; - fill: #ff0000; - stroke: none; -} - -.annotation .vline { - stroke: #000; - stroke-opacity: 0.2; -}*/ - -.annotations .title { - display: block; - /*font-size: 2em;*/ - line-height: 2em; - padding: 0 10px; - /*background-color: #474747;*/ - /*color: #ffffff;*/ - font-size: 1.5em; - color: #474747; -} - -.legend { - position: absolute; - top: 0; - left: 0; - width: 100%; - height: 60px; -} - -.legend .entry { - cursor: pointer; - margin-bottom: 10px; -} - -.legend .symbol { - display: inline-block; - height: 4px; - width: 10px; - line-height: 0.3em; -} - -.legend .label { - margin-left: 10px; -} - -.legend .hidden { - opacity: 0.25; -} - -.noselect { - -webkit-touch-callout: none; - -webkit-user-select: none; - -khtml-user-select: none; - -moz-user-select: none; - -ms-user-select: none; - user-select: none; -} - -/* http://css-tricks.com/guide-responsive-friendly-css-columns/ */ -.multicolumn-1 { - -webkit-column-count: 1; - -moz-column-count: 1; - -ms-column-count: 1; - column-count: 1; - - -webkit-column-width: 150px; - -moz-column-width: 150px; - -ms-column-width: 150px; - column-width: 150px; -} - -.multicolumn-2 { - -webkit-column-count: 2; - -moz-column-count: 2; - -ms-column-count: 2; - column-count: 2; - - -webkit-column-width: 150px; - -moz-column-width: 150px; - -ms-column-width: 150px; - column-width: 150px; -} - -.multicolumn-3 { - -webkit-column-count: 3; - -moz-column-count: 3; - -ms-column-count: 3; - column-count: 3; - - -webkit-column-width: 150px; - -moz-column-width: 150px; - -ms-column-width: 150px; - column-width: 150px; -} - -.multicolumn-4 { - -webkit-column-count: 4; - -moz-column-count: 4; - -ms-column-count: 4; - column-count: 4; - - -webkit-column-width: 150px; - -moz-column-width: 150px; - -ms-column-width: 150px; - column-width: 150px; -} diff --git a/lib/node_modules/@stdlib/plot/base/ctor/lib/view/electron/index.html b/lib/node_modules/@stdlib/plot/base/ctor/lib/view/electron/index.html deleted file mode 100644 index 76ba506589fb..000000000000 --- a/lib/node_modules/@stdlib/plot/base/ctor/lib/view/electron/index.html +++ /dev/null @@ -1,45 +0,0 @@ - - - - - - - - -   - - - - - -
{{plot}}
- - - diff --git a/lib/node_modules/@stdlib/plot/base/ctor/lib/view/electron/index.js b/lib/node_modules/@stdlib/plot/base/ctor/lib/view/electron/index.js deleted file mode 100644 index 380ca2617ab0..000000000000 --- a/lib/node_modules/@stdlib/plot/base/ctor/lib/view/electron/index.js +++ /dev/null @@ -1,149 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// TODO: refactor. Remove disposable server. Create a server in the electron process and have it serve assets from local directories. Should be similar to SimpleServer. - -// MODULES // - -var spawn = require( 'child_process' ).spawn; -var path = require( 'path' ); -var logger = require( 'debug' ); -var toHTML = require( 'vdom-to-html' ); -var instanceOf = require( '@stdlib/assert/instance-of' ); -var ENV = require( '@stdlib/process/env' ); -var copy = require( '@stdlib/utils/copy' ); -var merge = require( '@stdlib/utils/merge' ); -var readFileSync = require( '@stdlib/fs/read-file' ).sync; -var httpServer = require( '@stdlib/net/disposable-http-server' ); -var tryRequire = require( '@stdlib/utils/try-require' ); - - -// VARIABLES // - -var debug = logger( 'plot:base:view:electron:main' ); -var electron = tryRequire( '@stdlib/electron' ); - - -// MAIN // - -/** -* Opens a plot in an electron window. -* -* @private -* @param {Plot} plot - plot context -* @param {VTree} vtree - virtual tree -* @throws {Error} Electron must be properly installed -*/ -function view( plot, vtree ) { - var index; - var html; - var opts; - var css; - - if ( instanceOf( electron, Error ) ) { - throw new Error( 'invalid operation. Unable to load Electron. Ensure Electron is installed and try again.' ); - } - debug( 'Transforming virtual DOM tree to HTML...' ); - html = toHTML( vtree ); - - // Define `fs` options: - opts = { - 'encoding': 'utf8' - }; - - debug( 'Injecting HTML into HTML template...' ); - index = path.join( __dirname, 'index.html' ); - index = readFileSync( index, opts ); - index = index.replace( /\{\{plot\}\}/, html ); - - debug( 'Injecting CSS into HTML template...' ); - css = path.join( __dirname, 'css', 'reset.css' ); - css = readFileSync( css, opts ); - index = index.replace( /\{\{reset\}\}/, css ); - - css = path.join( __dirname, 'css', 'colors.css' ); - css = readFileSync( css, opts ); - index = index.replace( /\{\{colors\}\}/, css ); - - css = path.join( __dirname, 'css', 'styles.css' ); - css = readFileSync( css, opts ); - index = index.replace( /\{\{styles\}\}/, css ); - - debug( 'Creating a disposable HTTP server...' ); - opts = { - 'html': index, - 'open': false - }; - httpServer( opts, onReady ); - - /** - * Callback invoked once a server is ready to receive requests. - * - * @private - * @param {(Error|null)} error - error object - * @param {Server} server - HTTP server - * @throws {Error} unexpected error - */ - function onReady( error, server ) { - var child; - var addr; - var opts; - var env; - if ( error ) { - throw error; - } - addr = server.address(); - debug( 'HTTP server initialized. Server is listening for requests on %s:%d.', addr.address, addr.port ); - - debug( 'Electron executable: %s.', electron ); - - // TODO: extract fixed env vars to config file and then won't need to pass via environment variables, but can simply require - env = { - 'SERVER_PORT': addr.port, - 'SERVER_ADDRESS': addr.address, - 'PLOT_WIDTH': plot.width, - 'PLOT_HEIGHT': plot.height, - 'PLOT_APP_PATH': __dirname, - 'PLOT_MIN_WIDTH': 100, - 'PLOT_MIN_HEIGHT': 100, - 'PLOT_TITLE': plot.title || 'stdlib' - }; - debug( 'Electron process environment variables: %s.', JSON.stringify( env ) ); - - opts = { - 'cwd': __dirname, - 'detached': true, - 'stdio': 'ignore' - }; - debug( 'Electron process options: %s.', JSON.stringify( opts ) ); - - // Merge the current process' environment variables: - opts.env = merge( {}, copy( ENV ), env ); - - debug( 'Spawning an electron process...' ); - child = spawn( electron, [ './main.js' ], opts ); - child.unref(); - } -} - - -// EXPORTS // - -module.exports = view; diff --git a/lib/node_modules/@stdlib/plot/base/ctor/lib/view/electron/main.js b/lib/node_modules/@stdlib/plot/base/ctor/lib/view/electron/main.js deleted file mode 100644 index a7f113613389..000000000000 --- a/lib/node_modules/@stdlib/plot/base/ctor/lib/view/electron/main.js +++ /dev/null @@ -1,103 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); -var app = require( 'electron' ).app; -var BrowserWindow = require( 'electron' ).BrowserWindow; -var ENV = require( '@stdlib/process/env' ); - - -// VARIABLES // - -var debug = logger( 'plot:base:view:electron:main-process' ); -var mainWindow = null; - - -// FUNCTIONS // - -/** -* Creates a browser window. -* -* @private -*/ -function createWindow() { - var opts; - var url; - - opts = { - 'width': parseInt( ENV.PLOT_WIDTH, 10 ) + 80, - 'height': parseInt( ENV.PLOT_HEIGHT, 10 ) + 20, - 'title': ENV.PLOT_TITLE, - - // 'minWidth': parseInt( ENV.PLOT_MIN_WIDTH, 10 ), // TODO: needed? - - // 'minHeight': parseInt( ENV.PLOT_MIN_HEIGHT, 10 ), // TODO: needed? - - // 'titleBarStyle': 'hidden-inset', // hide title bar on OS X - - 'useContentSize': true // specify web page size only considering the content - }; - debug( 'Creating a new browser window configured with the following options: %s.', JSON.stringify( opts ) ); - mainWindow = new BrowserWindow( opts ); - - mainWindow.on( 'close', onClose ); - - url = 'http://'+ENV.SERVER_ADDRESS+':'+ENV.SERVER_PORT+'/index.html'; - debug( 'Loading %s.', url ); - mainWindow.loadURL( url ); -} - -/** -* Callback invoked once a window closes. -* -* @private -*/ -function onClose() { - debug( 'Window closed. Dereferencing window object to allow for GC...' ); - mainWindow = null; -} - -/** -* Quits the application. -* -* @private -*/ -function quit() { - debug( 'Quitting application...' ); - app.quit(); -} - - -// MAIN // - -/** -* Runs the application. -* -* @private -*/ -function main() { - app.on( 'ready', createWindow ); - app.on( 'window-all-closed', quit ); -} - -debug( 'Running application...' ); -main(); diff --git a/lib/node_modules/@stdlib/plot/base/ctor/lib/view/index.js b/lib/node_modules/@stdlib/plot/base/ctor/lib/view/index.js deleted file mode 100644 index 36affde53c13..000000000000 --- a/lib/node_modules/@stdlib/plot/base/ctor/lib/view/index.js +++ /dev/null @@ -1,59 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); -var createView = require( './view.js' ); - - -// VARIABLES // - -var debug = logger( 'plot:base:view' ); - - -// MAIN // - -/** -* Generates a plot view. -* -* @private -* @param {string} viewer - plot viewer -*/ -function view( viewer ) { - /* eslint-disable no-invalid-this */ - var tmp = this.viewer; - if ( arguments.length ) { - // Temporarily set the viewer: - this.viewer = viewer; - } - debug( 'Viewer: %s.', this.viewer ); - debug( 'Generating view...' ); - createView( this, this.viewer, this.render() ); - if ( arguments.length ) { - // Restore the viewer: - this.viewer = tmp; - } -} - - -// EXPORTS // - -module.exports = view; diff --git a/lib/node_modules/@stdlib/plot/base/ctor/lib/view/stdout/index.js b/lib/node_modules/@stdlib/plot/base/ctor/lib/view/stdout/index.js deleted file mode 100644 index be3992695bc2..000000000000 --- a/lib/node_modules/@stdlib/plot/base/ctor/lib/view/stdout/index.js +++ /dev/null @@ -1,34 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -/** -* Writes a plot (rendered as a virtual DOM tree) to `stdout`. -* -* @private -* @param {VTree} plot - virtual tree -*/ -function view( plot ) { - console.log( JSON.stringify( plot ) ); -} - - -// EXPORTS // - -module.exports = view; diff --git a/lib/node_modules/@stdlib/plot/base/ctor/lib/view/view.browser.js b/lib/node_modules/@stdlib/plot/base/ctor/lib/view/view.browser.js deleted file mode 100644 index 91e2b3561cc4..000000000000 --- a/lib/node_modules/@stdlib/plot/base/ctor/lib/view/view.browser.js +++ /dev/null @@ -1,59 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var format = require( '@stdlib/string/format' ); -var stdout = require( './stdout' ); - - -// MAIN // - -/** -* Generates a plot view. -* -* @private -* @param {Plot} plot - plot context -* @param {string} viewer - plot viewer -* @param {VTree} vtree - virtual tree -* @throws {Error} must specify a supported viewer -* @returns {void} -*/ -function view( plot, viewer, vtree ) { - if ( viewer === 'none' ) { - return; - } - if ( viewer === 'stdout' ) { - return stdout( vtree ); - } - if ( viewer === 'browser' ) { - throw new Error( format( 'invalid argument. Must provide a supported viewer. Value: `%s`.', viewer ) ); - } - if ( viewer === 'terminal' ) { - // TODO: ASCII - return; - } - throw new Error( format( 'invalid argument. Must provide a supported viewer. Value: `%s`.', viewer ) ); -} - - -// EXPORTS // - -module.exports = view; diff --git a/lib/node_modules/@stdlib/plot/base/ctor/lib/view/view.js b/lib/node_modules/@stdlib/plot/base/ctor/lib/view/view.js deleted file mode 100644 index 362970ed3e18..000000000000 --- a/lib/node_modules/@stdlib/plot/base/ctor/lib/view/view.js +++ /dev/null @@ -1,60 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var stdout = require( './stdout' ); -var browser = require( './browser' ); -var electron = require( './electron' ); - - -// MAIN // - -/** -* Generates a plot view. -* -* @private -* @param {Plot} plot - plot context -* @param {string} viewer - plot viewer -* @param {VTree} vtree - virtual -* @returns {void} -*/ -function view( plot, viewer, vtree ) { - if ( viewer === 'none' ) { - return; - } - if ( viewer === 'stdout' ) { - return stdout( vtree ); - } - if ( viewer === 'browser' ) { - return browser( vtree ); - } - if ( viewer === 'terminal' ) { - // TODO: ASCII - return; - } - // viewer === 'window' - electron( plot, vtree ); -} - - -// EXPORTS // - -module.exports = view; diff --git a/lib/node_modules/@stdlib/plot/base/ctor/package.json b/lib/node_modules/@stdlib/plot/base/ctor/package.json deleted file mode 100644 index 00a2c390017c..000000000000 --- a/lib/node_modules/@stdlib/plot/base/ctor/package.json +++ /dev/null @@ -1,71 +0,0 @@ -{ - "name": "@stdlib/plot/base/ctor", - "version": "0.0.0", - "description": "Base 2-dimensional plot constructor.", - "license": "Apache-2.0", - "author": { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - }, - "contributors": [ - { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - } - ], - "main": "./lib", - "browser": { - "./lib/view/view.js": "./lib/view/view.browser.js" - }, - "directories": { - "example": "./examples", - "lib": "./lib" - }, - "scripts": {}, - "homepage": "https://github.com/stdlib-js/stdlib", - "repository": { - "type": "git", - "url": "git://github.com/stdlib-js/stdlib.git" - }, - "bugs": { - "url": "https://github.com/stdlib-js/stdlib/issues" - }, - "dependencies": {}, - "devDependencies": {}, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], - "keywords": [ - "stdlib", - "plot", - "base", - "constructor", - "ctor", - "figure", - "fig", - "graph", - "chart", - "diagram", - "2-dimensional", - "2d", - "data", - "visualize", - "visualization", - "dataviz", - "explore", - "exploratory", - "analysis" - ] -} diff --git a/lib/node_modules/@stdlib/plot/base/line-styles/README.md b/lib/node_modules/@stdlib/plot/base/line-styles/README.md new file mode 100644 index 000000000000..366e19b9938e --- /dev/null +++ b/lib/node_modules/@stdlib/plot/base/line-styles/README.md @@ -0,0 +1,117 @@ + + +# lineStyles + +> List of supported line styles. + + + +
+ +
+ + + + + +
+ +## Usage + +```javascript +var lineStyles = require( '@stdlib/plot/base/line-styles' ); +``` + +#### lineStyles() + +Returns a list of line styles. + +```javascript +var out = lineStyles(); +// returns [ '-', '--', '-.', ':' ] +``` + +
+ + + + + +
+ +
+ + + + + +
+ +## Examples + + + +```javascript +var contains = require( '@stdlib/array/base/assert/contains' ).factory; +var lineStyles = require( '@stdlib/plot/base/line-styles' ); + +var isLineStyle = contains( lineStyles() ); + +var bool = isLineStyle( '-' ); +// returns true + +bool = isLineStyle( ':' ); +// returns true + +bool = isLineStyle( '*' ); +// returns false + +bool = isLineStyle( '+' ); +// returns false +``` + +
+ + + + + +
+ +
+ + + + + + + + + + + + + + diff --git a/lib/node_modules/@stdlib/plot/base/line-styles/benchmark/benchmark.js b/lib/node_modules/@stdlib/plot/base/line-styles/benchmark/benchmark.js new file mode 100644 index 000000000000..71a105c7d9a4 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/base/line-styles/benchmark/benchmark.js @@ -0,0 +1,48 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var bench = require( '@stdlib/bench' ); +var isStringArray = require( '@stdlib/assert/is-string-array' ).primitives; +var pkg = require( './../package.json' ).name; +var lineStyles = require( './../lib' ); + + +// MAIN // + +bench( pkg, function benchmark( b ) { + var out; + var i; + + b.tic(); + for ( i = 0; i < b.iterations; i++ ) { + out = lineStyles(); + if ( out.length < 2 ) { + b.fail( 'should return an array' ); + } + } + b.toc(); + if ( !isStringArray( out ) ) { + b.fail( 'should return an array of strings' ); + } + b.pass( 'benchmark finished' ); + b.end(); +}); diff --git a/lib/node_modules/@stdlib/plot/base/line-styles/docs/repl.txt b/lib/node_modules/@stdlib/plot/base/line-styles/docs/repl.txt new file mode 100644 index 000000000000..f7bbf08e295e --- /dev/null +++ b/lib/node_modules/@stdlib/plot/base/line-styles/docs/repl.txt @@ -0,0 +1,17 @@ + +{{alias}}() + Returns a list of line styles. + + Returns + ------- + out: Array + List of line styles. + + Examples + -------- + > var out = {{alias}}() + [ '-', '--', '-.', ':' ] + + See Also + -------- + diff --git a/lib/node_modules/@stdlib/plot/base/line-styles/docs/types/index.d.ts b/lib/node_modules/@stdlib/plot/base/line-styles/docs/types/index.d.ts new file mode 100644 index 000000000000..e29085d29789 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/base/line-styles/docs/types/index.d.ts @@ -0,0 +1,35 @@ +/* +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +// TypeScript Version: 4.1 + +/** +* Returns a list of line styles. +* +* @returns list of line styles +* +* @example +* var list = lineStyles(); +* // returns [ '-', '--', '-.', ':' ] +*/ +declare function lineStyles(): Array; + + +// EXPORTS // + +export = lineStyles; diff --git a/lib/node_modules/@stdlib/plot/base/line-styles/docs/types/test.ts b/lib/node_modules/@stdlib/plot/base/line-styles/docs/types/test.ts new file mode 100644 index 000000000000..668336fe99fa --- /dev/null +++ b/lib/node_modules/@stdlib/plot/base/line-styles/docs/types/test.ts @@ -0,0 +1,32 @@ +/* +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +import lineStyles = require( './index' ); + + +// TESTS // + +// The function returns an array of strings... +{ + lineStyles(); // $ExpectType string[] +} + +// The compiler throws an error if the function is provided any arguments... +{ + lineStyles( 9 ); // $ExpectError +} diff --git a/lib/node_modules/@stdlib/plot/base/line-styles/examples/index.js b/lib/node_modules/@stdlib/plot/base/line-styles/examples/index.js new file mode 100644 index 000000000000..41fe1dda0057 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/base/line-styles/examples/index.js @@ -0,0 +1,40 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +var contains = require( '@stdlib/array/base/assert/contains' ).factory; +var lineStyles = require( './../lib' ); + +var isLineStyle = contains( lineStyles() ); + +var bool = isLineStyle( '-' ); +console.log( bool ); +// => true + +bool = isLineStyle( ':' ); +console.log( bool ); +// => true + +bool = isLineStyle( '*' ); +console.log( bool ); +// => false + +bool = isLineStyle( '+' ); +console.log( bool ); +// => false diff --git a/lib/node_modules/@stdlib/plot/base/line-styles/lib/data.json b/lib/node_modules/@stdlib/plot/base/line-styles/lib/data.json new file mode 100644 index 000000000000..5fb1c6b6621b --- /dev/null +++ b/lib/node_modules/@stdlib/plot/base/line-styles/lib/data.json @@ -0,0 +1,6 @@ +[ + "-", + "--", + "-.", + ":" +] diff --git a/lib/node_modules/@stdlib/plot/base/line-styles/lib/index.js b/lib/node_modules/@stdlib/plot/base/line-styles/lib/index.js new file mode 100644 index 000000000000..80e03dcf3adf --- /dev/null +++ b/lib/node_modules/@stdlib/plot/base/line-styles/lib/index.js @@ -0,0 +1,40 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +/** +* Return a list of line styles. +* +* @module @stdlib/plot/base/line-styles +* +* @example +* var lineStyles = require( '@stdlib/plot/base/line-styles' ); +* +* var out = lineStyles(); +* // returns [ '-', '--', '-.', ':' ] +*/ + +// MODULES // + +var main = require( './main.js' ); + + +// EXPORTS // + +module.exports = main; diff --git a/lib/node_modules/@stdlib/plot/base/line-styles/lib/main.js b/lib/node_modules/@stdlib/plot/base/line-styles/lib/main.js new file mode 100644 index 000000000000..b208b51dbc88 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/base/line-styles/lib/main.js @@ -0,0 +1,44 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var DATA = require( './data.json' ); + + +// MAIN // + +/** +* Returns a list of line styles. +* +* @returns {StringArray} list of line styles +* +* @example +* var out = lineStyles(); +* // returns [ '-', '--', '-.', ':' ] +*/ +function lineStyles() { + return DATA.slice(); +} + + +// EXPORTS // + +module.exports = lineStyles; diff --git a/lib/node_modules/@stdlib/plot/base/line-styles/package.json b/lib/node_modules/@stdlib/plot/base/line-styles/package.json new file mode 100644 index 000000000000..83a57d4ce0d0 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/base/line-styles/package.json @@ -0,0 +1,62 @@ +{ + "name": "@stdlib/plot/base/line-styles", + "version": "0.0.0", + "description": "List of supported line styles.", + "license": "Apache-2.0", + "author": { + "name": "The Stdlib Authors", + "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" + }, + "contributors": [ + { + "name": "The Stdlib Authors", + "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" + } + ], + "main": "./lib", + "directories": { + "benchmark": "./benchmark", + "doc": "./docs", + "example": "./examples", + "lib": "./lib", + "test": "./test" + }, + "types": "./docs/types", + "scripts": {}, + "homepage": "https://github.com/stdlib-js/stdlib", + "repository": { + "type": "git", + "url": "git://github.com/stdlib-js/stdlib.git" + }, + "bugs": { + "url": "https://github.com/stdlib-js/stdlib/issues" + }, + "dependencies": {}, + "devDependencies": {}, + "engines": { + "node": ">=0.10.0", + "npm": ">2.7.0" + }, + "os": [ + "aix", + "darwin", + "freebsd", + "linux", + "macos", + "openbsd", + "sunos", + "win32", + "windows" + ], + "keywords": [ + "stdlib", + "plot", + "line-style", + "linestyle", + "utilities", + "utility", + "utils", + "util" + ], + "__stdlib__": {} +} diff --git a/lib/node_modules/@stdlib/plot/base/line-styles/test/test.js b/lib/node_modules/@stdlib/plot/base/line-styles/test/test.js new file mode 100644 index 000000000000..c5df987ec1ba --- /dev/null +++ b/lib/node_modules/@stdlib/plot/base/line-styles/test/test.js @@ -0,0 +1,49 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var tape = require( 'tape' ); +var lineStyles = require( './../lib' ); + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof lineStyles, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'the function returns a list of line styles', function test( t ) { + var expected; + var actual; + + expected = [ + '-', + '--', + '-.', + ':' + ]; + actual = lineStyles(); + + t.deepEqual( actual, expected, 'returns expected value' ); + t.end(); +}); diff --git a/lib/node_modules/@stdlib/plot/base/linestyle2dasharray/README.md b/lib/node_modules/@stdlib/plot/base/linestyle2dasharray/README.md new file mode 100644 index 000000000000..74d4dfb99763 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/base/linestyle2dasharray/README.md @@ -0,0 +1,121 @@ + + +# linestyle2dasharray + +> Convert a [line style][@stdlib/plot/base/line-styles] string to a stroke dash array. + + + +
+ +
+ + + + + +
+ +## Usage + +```javascript +var linestyle2dasharray = require( '@stdlib/plot/base/linestyle2dasharray' ); +``` + +#### linestyle2dasharray( value ) + +Converts a [line style][@stdlib/plot/base/line-styles] string to a [`stroke-dasharray`][mdn-stroke-dasharray]. + +```javascript +var out = linestyle2dasharray( '--' ); +// returns [ 5, 1 ] +``` + +If unable to resolve a stroke dash array, the function returns `null`. + +```javascript +var out = linestyle2dasharray( '===' ); +// returns null +``` + +
+ + + + + +
+ +## Notes + +- A dash array consists of `[stroke, space, ...]` lengths for creating dashed or dotted lines. + +
+ + + + + +
+ +## Examples + + + +```javascript +var logEachMap = require( '@stdlib/console/log-each-map' ); +var lineStyles = require( '@stdlib/plot/base/line-styles' ); +var linestyle2dasharray = require( '@stdlib/plot/base/linestyle2dasharray' ); + +logEachMap( '%s => [%s]', lineStyles(), linestyle2dasharray ); +``` + +
+ + + + + +
+ +
+ + + + + + + + + + + + + + diff --git a/lib/node_modules/@stdlib/plot/base/linestyle2dasharray/benchmark/benchmark.js b/lib/node_modules/@stdlib/plot/base/linestyle2dasharray/benchmark/benchmark.js new file mode 100644 index 000000000000..e1393cfcfbd8 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/base/linestyle2dasharray/benchmark/benchmark.js @@ -0,0 +1,56 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var bench = require( '@stdlib/bench' ); +var isArray = require( '@stdlib/assert/is-array' ); +var pkg = require( './../package.json' ).name; +var linestyle2dasharray = require( './../lib' ); + + +// MAIN // + +bench( pkg, function benchmark( b ) { + var values; + var out; + var i; + + values = [ + '-', + ':', + '-.', + '--' + ]; + + b.tic(); + for ( i = 0; i < b.iterations; i++ ) { + out = linestyle2dasharray( values[ i%values.length ] ); + if ( typeof out !== 'object' ) { + b.fail( 'should return an array' ); + } + } + b.toc(); + if ( !isArray( out ) ) { + b.fail( 'should return an array' ); + } + b.pass( 'benchmark finished' ); + b.end(); +}); diff --git a/lib/node_modules/@stdlib/plot/base/linestyle2dasharray/docs/repl.txt b/lib/node_modules/@stdlib/plot/base/linestyle2dasharray/docs/repl.txt new file mode 100644 index 000000000000..41fb3e56934a --- /dev/null +++ b/lib/node_modules/@stdlib/plot/base/linestyle2dasharray/docs/repl.txt @@ -0,0 +1,24 @@ + +{{alias}}( value ) + Converts a line style string to a stroke dash array. + + If unable to resolve a stroke-dasharray, the function returns `null`. + + Parameters + ---------- + value: string + Line style string. + + Returns + ------- + out: Array|null + Dash array. + + Examples + -------- + > var out = {{alias}}( '--' ) + [ 5, 1 ] + + See Also + -------- + diff --git a/lib/node_modules/@stdlib/plot/base/linestyle2dasharray/docs/types/index.d.ts b/lib/node_modules/@stdlib/plot/base/linestyle2dasharray/docs/types/index.d.ts new file mode 100644 index 000000000000..32daa1059d94 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/base/linestyle2dasharray/docs/types/index.d.ts @@ -0,0 +1,49 @@ +/* +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +// TypeScript Version: 4.1 + +/** +* Converts a line style string to a [`stroke-dasharray`][1]. +* +* ## Notes +* +* - A dash array consists of `[stroke, space, ...]` lengths for creating dashed or dotted lines. +* - If unable to resolve a stroke dash array, the function returns `null`. +* +* [1]: https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/stroke-dasharray +* +* @param value - line style string +* @returns stroke dash array +* +* @example +* var v = linestyle2dasharray( '-' ); +* // returns [] +* +* v = linestyle2dasharray( '--' ); +* // returns [ 5, 1 ] +* +* v = linestyle2dasharray( '=' ); +* // returns null +*/ +declare function linestyle2dasharray( value: string ): Array | null; + + +// EXPORTS // + +export = linestyle2dasharray; diff --git a/lib/node_modules/@stdlib/plot/base/linestyle2dasharray/docs/types/test.ts b/lib/node_modules/@stdlib/plot/base/linestyle2dasharray/docs/types/test.ts new file mode 100644 index 000000000000..ef579eed8d06 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/base/linestyle2dasharray/docs/types/test.ts @@ -0,0 +1,45 @@ +/* +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +import linestyle2dasharray = require( './index' ); + + +// TESTS // + +// The function returns an array or null... +{ + linestyle2dasharray( '-' ); // $ExpectType number[] | null +} + +// The compiler throws an error if the function is not provided a string... +{ + linestyle2dasharray( 1 ); // $ExpectError + linestyle2dasharray( true ); // $ExpectError + linestyle2dasharray( false ); // $ExpectError + linestyle2dasharray( null ); // $ExpectError + linestyle2dasharray( undefined ); // $ExpectError + linestyle2dasharray( [] ); // $ExpectError + linestyle2dasharray( {} ); // $ExpectError + linestyle2dasharray( ( x: number ): number => x ); // $ExpectError +} + +// The compiler throws an error if the function is provided an unsupported number of arguments... +{ + linestyle2dasharray(); // $ExpectError + linestyle2dasharray( '-', {} ); // $ExpectError +} diff --git a/lib/node_modules/@stdlib/plot/base/linestyle2dasharray/examples/index.js b/lib/node_modules/@stdlib/plot/base/linestyle2dasharray/examples/index.js new file mode 100644 index 000000000000..2cf14e7c463b --- /dev/null +++ b/lib/node_modules/@stdlib/plot/base/linestyle2dasharray/examples/index.js @@ -0,0 +1,25 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +var logEachMap = require( '@stdlib/console/log-each-map' ); +var lineStyles = require( '@stdlib/plot/base/line-styles' ); +var linestyle2dasharray = require( './../lib' ); + +logEachMap( '%s => [%s]', lineStyles(), linestyle2dasharray ); diff --git a/lib/node_modules/@stdlib/plot/base/linestyle2dasharray/lib/index.js b/lib/node_modules/@stdlib/plot/base/linestyle2dasharray/lib/index.js new file mode 100644 index 000000000000..c1fb92fc4ea8 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/base/linestyle2dasharray/lib/index.js @@ -0,0 +1,46 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +/** +* Convert a line style string to a stroke dash array. +* +* @module @stdlib/plot/base/linestyle2dasharray +* +* @example +* var linestyle2dasharray = require( '@stdlib/plot/base/linestyle2dasharray' ); +* +* var v = linestyle2dasharray( '-' ); +* // returns [] +* +* v = linestyle2dasharray( '--' ); +* // returns [ 5, 1 ] +* +* v = linestyle2dasharray( '=' ); +* // returns null +*/ + +// MODULES // + +var main = require( './main.js' ); + + +// EXPORTS // + +module.exports = main; diff --git a/lib/node_modules/@stdlib/plot/base/linestyle2dasharray/lib/main.js b/lib/node_modules/@stdlib/plot/base/linestyle2dasharray/lib/main.js new file mode 100644 index 000000000000..2a2d4599b588 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/base/linestyle2dasharray/lib/main.js @@ -0,0 +1,70 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// VARIABLES // + +var STYLES = { + // Solid path: + '-': [], + + // Dashes: + '--': [ 5, 1 ], + + // Dotted path: + ':': [ 0.9 ], + + // Dash-dotted path: + '-.': [ 5, 1, 1, 1 ] +}; + + +// MAIN // + +/** +* Converts a line style string to a [`stroke-dasharray`][1]. +* +* ## Notes +* +* - A dash array consists of `[stroke, space, ...]` lengths for creating dashed or dotted lines. +* +* [1]: https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/stroke-dasharray +* +* @param {string} value - line style +* @returns {(Array|null)} dash array or null +* +* @example +* var v = linestyle2dasharray( '-' ); +* // returns [] +* +* v = linestyle2dasharray( '--' ); +* // returns [ 5, 1 ] +* +* v = linestyle2dasharray( '=' ); +* // returns null +*/ +function linestyle2dasharray( value ) { + var v = STYLES[ value ]; + return ( v ) ? v.slice() : null; +} + + +// EXPORTS // + +module.exports = linestyle2dasharray; diff --git a/lib/node_modules/@stdlib/plot/base/linestyle2dasharray/package.json b/lib/node_modules/@stdlib/plot/base/linestyle2dasharray/package.json new file mode 100644 index 000000000000..ef0044bd17a6 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/base/linestyle2dasharray/package.json @@ -0,0 +1,65 @@ +{ + "name": "@stdlib/plot/base/linestyle2dasharray", + "version": "0.0.0", + "description": "Convert a line style string to a stroke dash array.", + "license": "Apache-2.0", + "author": { + "name": "The Stdlib Authors", + "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" + }, + "contributors": [ + { + "name": "The Stdlib Authors", + "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" + } + ], + "main": "./lib", + "directories": { + "benchmark": "./benchmark", + "doc": "./docs", + "example": "./examples", + "lib": "./lib", + "test": "./test" + }, + "types": "./docs/types", + "scripts": {}, + "homepage": "https://github.com/stdlib-js/stdlib", + "repository": { + "type": "git", + "url": "git://github.com/stdlib-js/stdlib.git" + }, + "bugs": { + "url": "https://github.com/stdlib-js/stdlib/issues" + }, + "dependencies": {}, + "devDependencies": {}, + "engines": { + "node": ">=0.10.0", + "npm": ">2.7.0" + }, + "os": [ + "aix", + "darwin", + "freebsd", + "linux", + "macos", + "openbsd", + "sunos", + "win32", + "windows" + ], + "keywords": [ + "stdlib", + "plot", + "linestyle", + "line-style", + "dasharray", + "stroke", + "stroke-dasharray", + "utilities", + "utility", + "utils", + "util" + ], + "__stdlib__": {} +} diff --git a/lib/node_modules/@stdlib/plot/base/linestyle2dasharray/test/test.js b/lib/node_modules/@stdlib/plot/base/linestyle2dasharray/test/test.js new file mode 100644 index 000000000000..d398138cfe01 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/base/linestyle2dasharray/test/test.js @@ -0,0 +1,66 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var tape = require( 'tape' ); +var isNumericArray = require( '@stdlib/assert/is-numeric-array' ); +var lineStyles = require( '@stdlib/plot/base/line-styles' ); +var linestyle2dasharray = require( './../lib' ); + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof linestyle2dasharray, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'the function converts a line style string to a stroke dash array', function test( t ) { + var values; + var i; + + values = lineStyles(); + for ( i = 0; i < values.length; i++ ) { + t.strictEqual( isNumericArray( linestyle2dasharray( values[ i ] ) ), true, 'returns expected value for ' + values[ i ] ); + } + t.end(); +}); + +tape( 'if unable to resolve a stroke dash array, the function returns `null`', function test( t ) { + var expected; + var actual; + var values; + var i; + + values = [ + '==', + '^^', + '**', + '*' + ]; + expected = null; + for ( i = 0; i < values.length; i++ ) { + actual = linestyle2dasharray( values[ i ] ); + t.strictEqual( actual, expected, 'returns expected value for ' + values[ i ] ); + } + t.end(); +}); diff --git a/lib/node_modules/@stdlib/plot/base/view/lib/browser/index.html b/lib/node_modules/@stdlib/plot/base/view/lib/browser/index.html new file mode 100644 index 000000000000..0e9e5360990a --- /dev/null +++ b/lib/node_modules/@stdlib/plot/base/view/lib/browser/index.html @@ -0,0 +1,708 @@ + + + + + + + + +   + + + + + +
{{plot}}
+ + diff --git a/lib/node_modules/@stdlib/plot/base/view/lib/browser/index.js b/lib/node_modules/@stdlib/plot/base/view/lib/browser/index.js new file mode 100644 index 000000000000..d8dd5f215c41 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/base/view/lib/browser/index.js @@ -0,0 +1,57 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var path = require( 'path' ); +var readFileSync = require( '@stdlib/fs/read-file' ).sync; +var replace = require( '@stdlib/string/base/replace' ); +var httpServer = require( '@stdlib/net/disposable-http-server' ); + + +// VARIABLES // + +var TEMPLATE = path.join( __dirname, 'index.html' ); +var FOPTS = { + 'encoding': 'utf8' +}; +var RE_PLOT = /\{\{plot\}\}/; + + +// MAIN // + +/** +* Opens a plot in a browser window. +* +* @private +* @param {string} html - HTML string +*/ +function view( html ) { + // Create a disposable HTTP server... + httpServer({ + 'html': replace( readFileSync( TEMPLATE, FOPTS ), RE_PLOT, html ), + 'open': true + }); +} + + +// EXPORTS // + +module.exports = view; diff --git a/lib/node_modules/@stdlib/plot/base/ctor/lib/view/electron/css/colors.css b/lib/node_modules/@stdlib/plot/base/view/lib/electron/css/colors.css similarity index 99% rename from lib/node_modules/@stdlib/plot/base/ctor/lib/view/electron/css/colors.css rename to lib/node_modules/@stdlib/plot/base/view/lib/electron/css/colors.css index 4aef35fbf55f..081894b67a40 100644 --- a/lib/node_modules/@stdlib/plot/base/ctor/lib/view/electron/css/colors.css +++ b/lib/node_modules/@stdlib/plot/base/view/lib/electron/css/colors.css @@ -1,7 +1,7 @@ /* * @license Apache-2.0 * -* Copyright (c) 2018 The Stdlib Authors. +* Copyright (c) 2025 The Stdlib Authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/lib/node_modules/@stdlib/plot/base/ctor/lib/view/electron/css/reset.css b/lib/node_modules/@stdlib/plot/base/view/lib/electron/css/reset.css similarity index 94% rename from lib/node_modules/@stdlib/plot/base/ctor/lib/view/electron/css/reset.css rename to lib/node_modules/@stdlib/plot/base/view/lib/electron/css/reset.css index 753131e3589b..8ff404a7c401 100644 --- a/lib/node_modules/@stdlib/plot/base/ctor/lib/view/electron/css/reset.css +++ b/lib/node_modules/@stdlib/plot/base/view/lib/electron/css/reset.css @@ -1,7 +1,7 @@ /* * @license Apache-2.0 * -* Copyright (c) 2018 The Stdlib Authors. +* Copyright (c) 2025 The Stdlib Authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -17,8 +17,8 @@ */ /* http://meyerweb.com/eric/tools/css/reset/ - v2.0 | 20110126 - License: none (public domain) +* v2.0 | 20110126 +* License: none (public domain) */ html, body, div, span, applet, object, iframe, diff --git a/lib/node_modules/@stdlib/plot/base/view/lib/electron/css/styles.css b/lib/node_modules/@stdlib/plot/base/view/lib/electron/css/styles.css new file mode 100644 index 000000000000..9c3a08eefbc1 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/base/view/lib/electron/css/styles.css @@ -0,0 +1,135 @@ +/* +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +.canvas { + display: block; + margin: 0 auto; +} + +.graph .hidden { + opacity: 0; +} + +/*.annotation .marker { + cursor: pointer; + opacity: 0.2; + fill: #ff0000; + stroke: none; +} + +.annotation .vline { + stroke: #000; + stroke-opacity: 0.2; +}*/ + +.annotations .title { + display: block; + /*font-size: 2em;*/ + line-height: 2em; + padding: 0 10px; + /*background-color: #474747;*/ + /*color: #ffffff;*/ + font-size: 1.5em; + color: #474747; +} + +.legend { + position: absolute; + top: 0; + left: 0; + width: 100%; + height: 60px; +} + +.legend .entry { + cursor: pointer; + margin-bottom: 10px; +} + +.legend .symbol { + display: inline-block; + height: 4px; + width: 10px; + line-height: 0.3em; +} + +.legend .label { + margin-left: 10px; +} + +.legend .hidden { + opacity: 0.25; +} + +.noselect { + -webkit-touch-callout: none; + -webkit-user-select: none; + -khtml-user-select: none; + -moz-user-select: none; + -ms-user-select: none; + user-select: none; +} + +/* http://css-tricks.com/guide-responsive-friendly-css-columns/ */ +.multicolumn-1 { + -webkit-column-count: 1; + -moz-column-count: 1; + -ms-column-count: 1; + column-count: 1; + + -webkit-column-width: 150px; + -moz-column-width: 150px; + -ms-column-width: 150px; + column-width: 150px; +} + +.multicolumn-2 { + -webkit-column-count: 2; + -moz-column-count: 2; + -ms-column-count: 2; + column-count: 2; + + -webkit-column-width: 150px; + -moz-column-width: 150px; + -ms-column-width: 150px; + column-width: 150px; +} + +.multicolumn-3 { + -webkit-column-count: 3; + -moz-column-count: 3; + -ms-column-count: 3; + column-count: 3; + + -webkit-column-width: 150px; + -moz-column-width: 150px; + -ms-column-width: 150px; + column-width: 150px; +} + +.multicolumn-4 { + -webkit-column-count: 4; + -moz-column-count: 4; + -ms-column-count: 4; + column-count: 4; + + -webkit-column-width: 150px; + -moz-column-width: 150px; + -ms-column-width: 150px; + column-width: 150px; +} diff --git a/lib/node_modules/@stdlib/plot/base/view/lib/electron/index.html b/lib/node_modules/@stdlib/plot/base/view/lib/electron/index.html new file mode 100644 index 000000000000..40a36789b809 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/base/view/lib/electron/index.html @@ -0,0 +1,45 @@ + + + + + + + + +   + + + + + +
{{plot}}
+ + + diff --git a/lib/node_modules/@stdlib/plot/base/view/lib/electron/index.js b/lib/node_modules/@stdlib/plot/base/view/lib/electron/index.js new file mode 100644 index 000000000000..ca58345cb1ea --- /dev/null +++ b/lib/node_modules/@stdlib/plot/base/view/lib/electron/index.js @@ -0,0 +1,147 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// TODO: refactor. Remove disposable server. Create a server in the electron process and have it serve assets from local directories. Should be similar to SimpleServer. + +// MODULES // + +var spawn = require( 'child_process' ).spawn; +var path = require( 'path' ); +var logger = require( 'debug' ); +var instanceOf = require( '@stdlib/assert/instance-of' ); +var ENV = require( '@stdlib/process/env' ); +var copy = require( '@stdlib/utils/copy' ); +var merge = require( '@stdlib/utils/merge' ); +var readFileSync = require( '@stdlib/fs/read-file' ).sync; +var httpServer = require( '@stdlib/net/disposable-http-server' ); +var tryRequire = require( '@stdlib/utils/try-require' ); + + +// VARIABLES // + +var debug = logger( 'plot:view:electron:main' ); +var electron = tryRequire( '@stdlib/electron' ); + + +// MAIN // + +/** +* Opens a plot in an electron window. +* +* @private +* @param {Object} plot - plot context +* @param {NonNegativeInteger} plot.width - plot width +* @param {NonNegativeInteger} plot.height - plot height +* @param {string} plot.title - plot title +* @param {string} html - HTML string +* @throws {Error} Electron must be properly installed +*/ +function view( plot, html ) { + var index; + var opts; + var css; + + if ( instanceOf( electron, Error ) ) { + throw new Error( 'invalid operation. Unable to load Electron. Ensure Electron is installed and try again.' ); + } + // Define `fs` options: + opts = { + 'encoding': 'utf8' + }; + + debug( 'Injecting HTML into HTML template...' ); + index = path.join( __dirname, 'index.html' ); + index = readFileSync( index, opts ); + index = index.replace( /\{\{plot\}\}/, html ); + + debug( 'Injecting CSS into HTML template...' ); + css = path.join( __dirname, 'css', 'reset.css' ); + css = readFileSync( css, opts ); + index = index.replace( /\{\{reset\}\}/, css ); + + css = path.join( __dirname, 'css', 'colors.css' ); + css = readFileSync( css, opts ); + index = index.replace( /\{\{colors\}\}/, css ); + + css = path.join( __dirname, 'css', 'styles.css' ); + css = readFileSync( css, opts ); + index = index.replace( /\{\{styles\}\}/, css ); + + debug( 'Creating a disposable HTTP server...' ); + opts = { + 'html': index, + 'open': false + }; + httpServer( opts, onReady ); + + /** + * Callback invoked once a server is ready to receive requests. + * + * @private + * @param {(Error|null)} error - error object + * @param {Server} server - HTTP server + * @throws {Error} unexpected error + */ + function onReady( error, server ) { + var child; + var addr; + var opts; + var env; + if ( error ) { + throw error; + } + addr = server.address(); + debug( 'HTTP server initialized. Server is listening for requests on %s:%d.', addr.address, addr.port ); + + debug( 'Electron executable: %s.', electron ); + + // TODO: extract fixed env vars to config file and then won't need to pass via environment variables, but can simply require + env = { + 'SERVER_PORT': addr.port, + 'SERVER_ADDRESS': addr.address, + 'PLOT_WIDTH': plot.width, + 'PLOT_HEIGHT': plot.height, + 'PLOT_APP_PATH': __dirname, + 'PLOT_MIN_WIDTH': 100, + 'PLOT_MIN_HEIGHT': 100, + 'PLOT_TITLE': plot.title || 'stdlib' + }; + debug( 'Electron process environment variables: %s.', JSON.stringify( env ) ); + + opts = { + 'cwd': __dirname, + 'detached': true, + 'stdio': 'ignore' + }; + debug( 'Electron process options: %s.', JSON.stringify( opts ) ); + + // Merge the current process' environment variables: + opts.env = merge( {}, copy( ENV ), env ); + + debug( 'Spawning an electron process...' ); + child = spawn( electron, [ './main.js' ], opts ); + child.unref(); + } +} + + +// EXPORTS // + +module.exports = view; diff --git a/lib/node_modules/@stdlib/plot/base/ctor/lib/view/electron/js/debug.js b/lib/node_modules/@stdlib/plot/base/view/lib/electron/js/debug.js similarity index 91% rename from lib/node_modules/@stdlib/plot/base/ctor/lib/view/electron/js/debug.js rename to lib/node_modules/@stdlib/plot/base/view/lib/electron/js/debug.js index d736a98ef255..9e7edb01eaa4 100644 --- a/lib/node_modules/@stdlib/plot/base/ctor/lib/view/electron/js/debug.js +++ b/lib/node_modules/@stdlib/plot/base/view/lib/electron/js/debug.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2018 The Stdlib Authors. +* Copyright (c) 2025 The Stdlib Authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -31,7 +31,7 @@ var debug; localStorage.debug = ENV.DEBUG; // Load `debug`: -debug = require( 'debug/browser' ); // eslint-disable-line stdlib/require-order +debug = require( 'debug/browser' ); // eslint-disable-line stdlib/require-order, stdlib/require-file-extensions // EXPORTS // diff --git a/lib/node_modules/@stdlib/plot/base/ctor/lib/view/electron/js/script.js b/lib/node_modules/@stdlib/plot/base/view/lib/electron/js/script.js similarity index 94% rename from lib/node_modules/@stdlib/plot/base/ctor/lib/view/electron/js/script.js rename to lib/node_modules/@stdlib/plot/base/view/lib/electron/js/script.js index 39a44c2a0b0b..6896bc63a21b 100644 --- a/lib/node_modules/@stdlib/plot/base/ctor/lib/view/electron/js/script.js +++ b/lib/node_modules/@stdlib/plot/base/view/lib/electron/js/script.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2018 The Stdlib Authors. +* Copyright (c) 2025 The Stdlib Authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -30,7 +30,7 @@ var logger = require( './debug.js' ); // VARIABLES // var DIR = path.join( ENV.PLOT_APP_PATH, 'css' ); -var debug = logger( 'plot:base:view:electron:script' ); +var debug = logger( 'plot:view:electron:script' ); // FUNCTIONS // diff --git a/lib/node_modules/@stdlib/plot/base/view/lib/electron/main.js b/lib/node_modules/@stdlib/plot/base/view/lib/electron/main.js new file mode 100644 index 000000000000..c5e9bf09ebbb --- /dev/null +++ b/lib/node_modules/@stdlib/plot/base/view/lib/electron/main.js @@ -0,0 +1,103 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var logger = require( 'debug' ); +var app = require( 'electron' ).app; // eslint-disable-line stdlib/require-file-extensions +var BrowserWindow = require( 'electron' ).BrowserWindow; // eslint-disable-line stdlib/require-file-extensions +var ENV = require( '@stdlib/process/env' ); + + +// VARIABLES // + +var debug = logger( 'plot:view:electron:main-process' ); +var mainWindow = null; + + +// FUNCTIONS // + +/** +* Creates a browser window. +* +* @private +*/ +function createWindow() { + var opts; + var url; + + opts = { + 'width': parseInt( ENV.PLOT_WIDTH, 10 ) + 80, + 'height': parseInt( ENV.PLOT_HEIGHT, 10 ) + 20, + 'title': ENV.PLOT_TITLE, + + // 'minWidth': parseInt( ENV.PLOT_MIN_WIDTH, 10 ), // TODO: needed? + + // 'minHeight': parseInt( ENV.PLOT_MIN_HEIGHT, 10 ), // TODO: needed? + + // 'titleBarStyle': 'hidden-inset', // hide title bar on OS X + + 'useContentSize': true // specify web page size only considering the content + }; + debug( 'Creating a new browser window configured with the following options: %s.', JSON.stringify( opts ) ); + mainWindow = new BrowserWindow( opts ); + + mainWindow.on( 'close', onClose ); + + url = 'http://'+ENV.SERVER_ADDRESS+':'+ENV.SERVER_PORT+'/index.html'; + debug( 'Loading %s.', url ); + mainWindow.loadURL( url ); +} + +/** +* Callback invoked once a window closes. +* +* @private +*/ +function onClose() { + debug( 'Window closed. Dereferencing window object to allow for GC...' ); + mainWindow = null; +} + +/** +* Quits the application. +* +* @private +*/ +function quit() { + debug( 'Quitting application...' ); + app.quit(); +} + + +// MAIN // + +/** +* Runs the application. +* +* @private +*/ +function main() { + app.on( 'ready', createWindow ); + app.on( 'window-all-closed', quit ); +} + +debug( 'Running application...' ); +main(); diff --git a/lib/node_modules/@stdlib/plot/base/view/lib/index.js b/lib/node_modules/@stdlib/plot/base/view/lib/index.js new file mode 100644 index 000000000000..95bd2b7d0d23 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/base/view/lib/index.js @@ -0,0 +1,39 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +/** +* Create a plot view. +* +* @module @stdlib/plot/base/view +* +* @example +* var view = require( '@stdlib/plot/base/view' ); +* +* // TODO: example +*/ + +// MODULES // + +var main = require( './main.js' ); + + +// EXPORTS // + +module.exports = main; diff --git a/lib/node_modules/@stdlib/plot/base/view/lib/main.browser.js b/lib/node_modules/@stdlib/plot/base/view/lib/main.browser.js new file mode 100644 index 000000000000..fae3aab65618 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/base/view/lib/main.browser.js @@ -0,0 +1,49 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var format = require( '@stdlib/string/format' ); +var stdout = require( './stdout' ); + + +// MAIN // + +/** +* Generates a plot view. +* +* @private +* @param {Plot} plot - plot context +* @param {string} viewer - plot viewer +* @param {string} html - rendered plot +* @throws {Error} must specify a supported viewer +* @returns {void} +*/ +function view( plot, viewer, html ) { + if ( viewer === 'stdout' ) { + return stdout( html ); + } + throw new Error( format( 'invalid argument. Must provide a supported viewer. Value: `%s`.', viewer ) ); +} + + +// EXPORTS // + +module.exports = view; diff --git a/lib/node_modules/@stdlib/plot/base/view/lib/main.js b/lib/node_modules/@stdlib/plot/base/view/lib/main.js new file mode 100644 index 000000000000..8d831508eece --- /dev/null +++ b/lib/node_modules/@stdlib/plot/base/view/lib/main.js @@ -0,0 +1,56 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var stdout = require( './stdout' ); +var browser = require( './browser' ); +var electron = require( './electron' ); + + +// MAIN // + +/** +* Generates a plot view. +* +* @private +* @param {Plot} plot - plot context +* @param {NonNegativeInteger} plot.width - plot width +* @param {NonNegativeInteger} plot.height - plot height +* @param {string} plot.title - plot title +* @param {string} viewer - plot viewer +* @param {html} html - rendered plot +* @returns {void} +*/ +function view( plot, viewer, html ) { + if ( viewer === 'stdout' ) { + return stdout( html ); + } + if ( viewer === 'browser' ) { + return browser( html ); + } + // viewer === 'window' + electron( plot, html ); +} + + +// EXPORTS // + +module.exports = view; diff --git a/lib/node_modules/@stdlib/plot/base/view/lib/stdout/index.js b/lib/node_modules/@stdlib/plot/base/view/lib/stdout/index.js new file mode 100644 index 000000000000..ff40ac464684 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/base/view/lib/stdout/index.js @@ -0,0 +1,41 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var log = require( '@stdlib/console/log' ); + + +// MAIN // + +/** +* Writes a rendered plot to `stdout`. +* +* @private +* @param {string} str - rendered plot +*/ +function view( str ) { + log( str ); +} + + +// EXPORTS // + +module.exports = view; diff --git a/lib/node_modules/@stdlib/plot/base/view/package.json b/lib/node_modules/@stdlib/plot/base/view/package.json new file mode 100644 index 000000000000..a709e6f3891f --- /dev/null +++ b/lib/node_modules/@stdlib/plot/base/view/package.json @@ -0,0 +1,70 @@ +{ + "name": "@stdlib/plot/base/view", + "version": "0.0.0", + "description": "Create a plot view.", + "license": "Apache-2.0", + "author": { + "name": "The Stdlib Authors", + "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" + }, + "contributors": [ + { + "name": "The Stdlib Authors", + "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" + } + ], + "main": "./lib", + "browser": { + "./lib/main.js": "./lib/main.browser.js" + }, + "directories": { + "doc": "./docs", + "example": "./examples", + "lib": "./lib", + "test": "./test" + }, + "scripts": {}, + "homepage": "https://github.com/stdlib-js/stdlib", + "repository": { + "type": "git", + "url": "git://github.com/stdlib-js/stdlib.git" + }, + "bugs": { + "url": "https://github.com/stdlib-js/stdlib/issues" + }, + "dependencies": {}, + "devDependencies": {}, + "engines": { + "node": ">=0.10.0", + "npm": ">2.7.0" + }, + "os": [ + "aix", + "darwin", + "freebsd", + "linux", + "macos", + "openbsd", + "sunos", + "win32", + "windows" + ], + "keywords": [ + "stdlib", + "plot", + "view", + "render", + "figure", + "fig", + "graph", + "chart", + "diagram", + "data", + "visualize", + "visualization", + "dataviz", + "explore", + "exploratory", + "analysis" + ] +} diff --git a/lib/node_modules/@stdlib/plot/charts/base/ctor/examples/index.js b/lib/node_modules/@stdlib/plot/charts/base/ctor/examples/index.js new file mode 100644 index 000000000000..278b62b672ee --- /dev/null +++ b/lib/node_modules/@stdlib/plot/charts/base/ctor/examples/index.js @@ -0,0 +1,26 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +var Chart = require( './../lib' ); + +var chart = new Chart({ + 'title': 'Hello World!' +}); +console.log( chart.toJSON() ); diff --git a/lib/node_modules/@stdlib/plot/charts/base/ctor/lib/autosize/get.js b/lib/node_modules/@stdlib/plot/charts/base/ctor/lib/autosize/get.js new file mode 100644 index 000000000000..30dc9714fb5b --- /dev/null +++ b/lib/node_modules/@stdlib/plot/charts/base/ctor/lib/autosize/get.js @@ -0,0 +1,38 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable no-invalid-this */ + +'use strict'; + +// MAIN // + +/** +* Returns the autosize configuration. +* +* @private +* @returns {Autosize} autosize configuration +*/ +function get() { + return this.config.autosize; +} + + +// EXPORTS // + +module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/charts/base/ctor/lib/autosize/set.js b/lib/node_modules/@stdlib/plot/charts/base/ctor/lib/autosize/set.js new file mode 100644 index 000000000000..8044eaea3ea9 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/charts/base/ctor/lib/autosize/set.js @@ -0,0 +1,48 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable no-invalid-this */ + +'use strict'; + +// MODULES // + +var Autosize = require( '@stdlib/plot/vega/autosize/ctor' ); + + +// MAIN // + +/** +* Sets the autosize configuration. +* +* @private +* @param {(Object|Autosize)} value - input value +* @throws {TypeError} must be a valid configuration +* @returns {void} +*/ +function set( value ) { + if ( !( value instanceof Autosize ) ) { + value = new Autosize( value ); // note: this accounts for both vanilla objects and cross-realm instances + } + this.config.autosize = value; +} + + +// EXPORTS // + +module.exports = set; diff --git a/lib/node_modules/@stdlib/plot/charts/base/ctor/lib/background/get.js b/lib/node_modules/@stdlib/plot/charts/base/ctor/lib/background/get.js new file mode 100644 index 000000000000..baec6f9824e3 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/charts/base/ctor/lib/background/get.js @@ -0,0 +1,38 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable no-invalid-this */ + +'use strict'; + +// MAIN // + +/** +* Returns the chart background color. +* +* @private +* @returns {string} color +*/ +function get() { + return this.config.background; +} + + +// EXPORTS // + +module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/charts/base/ctor/lib/background/set.js b/lib/node_modules/@stdlib/plot/charts/base/ctor/lib/background/set.js new file mode 100644 index 000000000000..823ee32def32 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/charts/base/ctor/lib/background/set.js @@ -0,0 +1,40 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable no-invalid-this */ + +'use strict'; + +// MAIN // + +/** +* Sets the chart background color. +* +* @private +* @param {string} value - input value +* @throws {TypeError} must be a string +* @returns {void} +*/ +function set( value ) { + this.config.background = value; +} + + +// EXPORTS // + +module.exports = set; diff --git a/lib/node_modules/@stdlib/plot/charts/base/ctor/lib/defaults.js b/lib/node_modules/@stdlib/plot/charts/base/ctor/lib/defaults.js new file mode 100644 index 000000000000..f4508a98da20 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/charts/base/ctor/lib/defaults.js @@ -0,0 +1,71 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var isNodeREPL = require( '@stdlib/assert/is-node-repl' ); +var Autosize = require( '@stdlib/plot/vega/autosize/ctor' ); +var Padding = require( '@stdlib/plot/vega/padding/ctor' ); + + +// MAIN // + +/** +* Returns defaults. +* +* @private +* @returns {Object} defaults +* +* @example +* var obj = defaults(); +* // returns {...} +*/ +function defaults() { + var isREPL = isNodeREPL(); + return { + // Autosize configuration: + 'autosize': new Autosize({ + 'type': 'none', + 'contains': 'padding' + }), + + // Height (in pixels): + 'height': 480, + + // Chart padding (in pixels): + 'padding': new Padding({ + 'bottom': 80, + 'left': 90, + 'right': 20, + 'top': 80 + }), + + // Chart viewer: + 'viewer': ( isREPL ) ? 'window' : 'stdout', + + // Width (in pixels): + 'width': 600 + }; +} + + +// EXPORTS // + +module.exports = defaults; diff --git a/lib/node_modules/@stdlib/plot/charts/base/ctor/lib/description/get.js b/lib/node_modules/@stdlib/plot/charts/base/ctor/lib/description/get.js new file mode 100644 index 000000000000..994f75ed5617 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/charts/base/ctor/lib/description/get.js @@ -0,0 +1,38 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable no-invalid-this */ + +'use strict'; + +// MAIN // + +/** +* Returns the chart description. +* +* @private +* @returns {string} description +*/ +function get() { + return this.config.description; +} + + +// EXPORTS // + +module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/charts/base/ctor/lib/description/set.js b/lib/node_modules/@stdlib/plot/charts/base/ctor/lib/description/set.js new file mode 100644 index 000000000000..9943b0aa1228 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/charts/base/ctor/lib/description/set.js @@ -0,0 +1,40 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable no-invalid-this */ + +'use strict'; + +// MAIN // + +/** +* Sets the chart description. +* +* @private +* @param {string} value - input value +* @throws {TypeError} must be a string +* @returns {void} +*/ +function set( value ) { + this.config.description = value; +} + + +// EXPORTS // + +module.exports = set; diff --git a/lib/node_modules/@stdlib/plot/charts/base/ctor/lib/height/get.js b/lib/node_modules/@stdlib/plot/charts/base/ctor/lib/height/get.js new file mode 100644 index 000000000000..99ca2ba7dcbf --- /dev/null +++ b/lib/node_modules/@stdlib/plot/charts/base/ctor/lib/height/get.js @@ -0,0 +1,38 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable no-invalid-this */ + +'use strict'; + +// MAIN // + +/** +* Returns the chart height (in pixels). +* +* @private +* @returns {NonNegativeNumber} height +*/ +function get() { + return this.config.height; +} + + +// EXPORTS // + +module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/charts/base/ctor/lib/height/set.js b/lib/node_modules/@stdlib/plot/charts/base/ctor/lib/height/set.js new file mode 100644 index 000000000000..1f3f8f455bc5 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/charts/base/ctor/lib/height/set.js @@ -0,0 +1,40 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable no-invalid-this */ + +'use strict'; + +// MAIN // + +/** +* Sets the chart height (in pixels). +* +* @private +* @param {NonNegativeNumber} value - input value +* @throws {TypeError} must be a nonnegative number +* @returns {void} +*/ +function set( value ) { + this.config.height = value; +} + + +// EXPORTS // + +module.exports = set; diff --git a/lib/node_modules/@stdlib/plot/charts/base/ctor/lib/index.js b/lib/node_modules/@stdlib/plot/charts/base/ctor/lib/index.js new file mode 100644 index 000000000000..8365332c7647 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/charts/base/ctor/lib/index.js @@ -0,0 +1,42 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +/** +* Base chart constructor. +* +* @module @stdlib/plot/charts/base/ctor +* +* @example +* var Chart = require( '@stdlib/plot/charts/base/ctor' ); +* +* var chart = new Chart(); +* // returns +* +* // TODO: update example +*/ + +// MODULES // + +var main = require( './main.js' ); + + +// EXPORTS // + +module.exports = main; diff --git a/lib/node_modules/@stdlib/plot/charts/base/ctor/lib/main.js b/lib/node_modules/@stdlib/plot/charts/base/ctor/lib/main.js new file mode 100644 index 000000000000..947d76f7a1cd --- /dev/null +++ b/lib/node_modules/@stdlib/plot/charts/base/ctor/lib/main.js @@ -0,0 +1,468 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable no-restricted-syntax, no-invalid-this */ + +'use strict'; + +// MODULES // + +var EventEmitter = require( 'events' ).EventEmitter; +var logger = require( 'debug' ); +var isObject = require( '@stdlib/assert/is-object' ); +var isFunction = require( '@stdlib/assert/is-function' ); +var hasProp = require( '@stdlib/assert/has-property' ); +var setReadWriteAccessor = require( '@stdlib/utils/define-read-write-accessor' ); +var setReadOnly = require( '@stdlib/utils/define-nonenumerable-read-only-property' ); +var inherit = require( '@stdlib/utils/inherit' ); +var Visualization = require( '@stdlib/plot/vega/builder' ); +var Padding = require( '@stdlib/plot/vega/padding/ctor' ); +var Title = require( '@stdlib/plot/vega/title/ctor' ); +var spec2svg = require( '@stdlib/plot/vega/base/spec2svg' ); +var createView = require( '@stdlib/plot/base/view' ); +var format = require( '@stdlib/string/format' ); +var defaults = require( './defaults.js' ); + +// Note: keep the following in alphabetical order according to the `require` path... +var getAutosize = require( './autosize/get.js' ); +var setAutosize = require( './autosize/set.js' ); + +var getBackground = require( './background/get.js' ); +var setBackground = require( './background/set.js' ); + +var getDescription = require( './description/get.js' ); +var setDescription = require( './description/set.js' ); + +var getHeight = require( './height/get.js' ); +var setHeight = require( './height/set.js' ); + +var getPadding = require( './padding/get.js' ); +var setPadding = require( './padding/set.js' ); + +var getTheme = require( './theme/get.js' ); +var setTheme = require( './theme/set.js' ); + +var getTitle = require( './title/get.js' ); +var setTitle = require( './title/set.js' ); + +var getViewer = require( './viewer/get.js' ); +var setViewer = require( './viewer/set.js' ); + +var getWidth = require( './width/get.js' ); +var setWidth = require( './width/set.js' ); + + +// VARIABLES // + +var debug = logger( 'chart:base:main' ); + +var OPTIONS = [ + 'background', + 'description', + 'height', + 'padding', + 'theme', + 'title', + 'viewer', + 'width' +]; + + +// MAIN // + +/** +* Base chart constructor. +* +* @constructor +* @param {Options} [options] - constructor options +* @param {string} [options.background] - background color +* @param {string} [options.description=''] - chart description +* @param {number} [options.height=400] - chart height (in pixels) +* @param {Object} [options.padding] - chart padding +* @param {number} [options.padding.bottom=0] - chart bottom padding (in pixels) +* @param {number} [options.padding.left=0] - chart left padding (in pixels) +* @param {number} [options.padding.right=0] - chart right padding (in pixels) +* @param {number} [options.padding.top=0] - chart top padding (in pixels) +* @param {Object} [options.theme] - chart theme +* @param {(string|Array)} [options.title=''] - chart title +* @param {string} [options.viewer] - default chart viewer +* @param {number} [options.width=400] - chart width (in pixels) +* @throws {TypeError} options argument must be an object +* @throws {TypeError} must provide valid options +* @returns {Chart} chart instance +* +* @example +* var chart = new Chart(); +* // returns +*/ +function Chart( options ) { + var config; + var nargs; + var self; + var opts; + var o; + var t; + var k; + var i; + + nargs = arguments.length; + if ( !( this instanceof Chart ) ) { + if ( nargs ) { + return new Chart( options ); + } + return new Chart(); + } + self = this; + EventEmitter.call( this ); + + opts = defaults(); + if ( nargs ) { + if ( !isObject( options ) ) { + throw new TypeError( format( 'invalid argument. Options argument must be an object. Value: `%s`.', options ) ); + } + for ( i = 0; i < OPTIONS.length; i++ ) { + k = OPTIONS[ i ]; + if ( !hasProp( options, k ) ) { + continue; + } + switch ( k ) { + case 'padding': + opts[ k ] = new Padding( options[ k ] ); + break; + case 'theme': + opts.config = options[ k ]; + break; + case 'title': + o = { + 'text': options[ k ] + }; + try { + t = new Title( o ); + } catch ( err ) { // eslint-disable-line no-unused-vars + // We should only get here if provided an invalid title... + throw new TypeError( format( 'invalid option. `%s` option must be a string or an array of strings. Option: `%s`.', 'title', options[ k ] ) ); + } + opts[ k ] = t; + break; + default: + opts[ k ] = options[ k ]; + break; + } + } + } + if ( opts.viewer ) { + this.viewer = opts.viewer; + } + config = new Visualization( opts ); + + setReadOnly( this, 'config', config ); + config.on( 'change', onChange ); + + return this; + + /** + * Callback invoked upon a change event. + * + * @private + */ + function onChange() { + debug( 'Received a change event.' ); + self.emit( 'change' ); + } +} + +/* +* Inherit from the `EventEmitter` prototype. +*/ +inherit( Chart, EventEmitter ); + +/** +* Constructor name. +* +* @private +* @name name +* @memberof Chart +* @readonly +* @type {string} +*/ +setReadOnly( Chart, 'name', 'Chart' ); + +/** +* Chart autosize configuration. +* +* @name autosize +* @memberof Chart.prototype +* @type {Autosize} +* +* @example +* var chart = new Chart(); +* // returns +* +* var v = chart.autosize; +* // returns +*/ +setReadWriteAccessor( Chart.prototype, 'autosize', getAutosize, setAutosize ); + +/** +* Chart background. +* +* @name background +* @memberof Chart.prototype +* @type {string} +* +* @example +* var chart = new Chart({ +* 'background': 'white' +* }); +* // returns +* +* var v = chart.background; +* // returns 'white' +*/ +setReadWriteAccessor( Chart.prototype, 'background', getBackground, setBackground ); + +/** +* Chart description. +* +* @name description +* @memberof Chart.prototype +* @type {string} +* +* @example +* var chart = new Chart({ +* 'description': 'Hello world' +* }); +* // returns +* +* var v = chart.description; +* // returns 'Hello world' +*/ +setReadWriteAccessor( Chart.prototype, 'description', getDescription, setDescription ); + +/** +* Chart height (in pixels). +* +* @name background +* @memberof Chart.prototype +* @type {NonNegativeNumber} +* +* @example +* var chart = new Chart({ +* 'height': 600 +* }); +* // returns +* +* var v = chart.height; +* // returns 600 +*/ +setReadWriteAccessor( Chart.prototype, 'height', getHeight, setHeight ); + +/** +* Chart padding (in pixels). +* +* @name padding +* @memberof Chart.prototype +* @type {Padding} +* +* @example +* var chart = new Chart({ +* 'left': 10, +* 'right': 10 +* }); +* // returns +* +* var v = chart.padding; +* // returns +*/ +setReadWriteAccessor( Chart.prototype, 'padding', getPadding, setPadding ); + +/** +* Chart theme. +* +* @name theme +* @memberof Chart.prototype +* @type {Object} +* +* @example +* var chart = new Chart(); +* // returns +* +* var v = chart.theme; +* // returns {...} +*/ +setReadWriteAccessor( Chart.prototype, 'theme', getTheme, setTheme ); + +/** +* Chart title. +* +* @name title +* @memberof Chart.prototype +* @type {Title} +* +* @example +* var chart = new Chart(); +* // returns +* +* var v = chart.title; +* // returns +*/ +setReadWriteAccessor( Chart.prototype, 'title', getTitle, setTitle ); + +/** +* Chart width (in pixels). +* +* @name background +* @memberof Chart.prototype +* @type {NonNegativeNumber} +* +* @example +* var chart = new Chart({ +* 'width': 600 +* }); +* // returns <Chart> +* +* var v = chart.width; +* // returns 600 +*/ +setReadWriteAccessor( Chart.prototype, 'width', getWidth, setWidth ); + +/** +* Default chart viewer. +* +* @name viewer +* @memberof Chart.prototype +* @type {string} +* +* @example +* var chart = new Chart(); +* // returns <Chart> +* +* var v = chart.viewer; +* // returns '...' +*/ +setReadWriteAccessor( Chart.prototype, 'viewer', getViewer, setViewer ); + +/** +* Renders a chart. +* +* @name render +* @memberof Chart.prototype +* @type {Function} +* @param {Callback} clbk - callback to invoke upon rendering a chart +* @returns {void} +* +* @example +* var chart = new Chart(); +* +* function clbk( error, result ) { +* if ( error ) { +* throw error; +* } +* console.log( result ); +* } +* +* chart.render( clbk ); +*/ +setReadOnly( Chart.prototype, 'render', function render( clbk ) { + if ( !isFunction( clbk ) ) { + throw new TypeError( format( 'invalid argument. First argument must be a function. Value: `%s`.', clbk ) ); + } + spec2svg( this.toJSON(), clbk ); +}); + +/** +* Serializes a chart to a JSON object. +* +* ## Notes +* +* - This method is implicitly invoked by `JSON.stringify`. +* +* @name toJSON +* @memberof Chart.prototype +* @type {Function} +* @returns {Object} JSON object +* +* @example +* var chart = new Chart(); +* +* var v = chart.toJSON(); +* // returns {...} +*/ +setReadOnly( Chart.prototype, 'toJSON', function toJSON() { + return this.config.toJSON(); +}); + +/** +* Creates a chart view. +* +* @name view +* @memberof Chart.prototype +* @type {Function} +* @param {string} [viewer] - viewer +* +* @example +* var chart = new Chart(); +* +* // ... +* +* chart.view( 'stdout' ); +*/ +setReadOnly( Chart.prototype, 'view', function view( viewer ) { + var ctx; + var v; + + // FIXME: validate viewer argument + + if ( arguments.length ) { + v = viewer; + } else { + v = this.viewer; + } + debug( 'Viewer: %s', v ); + + // Cache various properties in order to avoid mutation during asynchronous rendering... + ctx = { + 'width': this.width, + 'height': this.height, + 'title': this.title.text.join( '\n' ) + }; + + // Render the chart to a string: + this.render( onRender ); + + /** + * Callback invoked upon render completion. + * + * @private + * @param {(Error|null)} error - error object or null + * @param {string} result - result + * @throws {Error} unexpected error + */ + function onRender( error, result ) { + if ( error ) { + throw error; + } + debug( 'Generating view...' ); + createView( ctx, v, result ); + } +}); + + +// EXPORTS // + +module.exports = Chart; diff --git a/lib/node_modules/@stdlib/plot/charts/base/ctor/lib/options.json b/lib/node_modules/@stdlib/plot/charts/base/ctor/lib/options.json new file mode 100644 index 000000000000..0c635878bb7a --- /dev/null +++ b/lib/node_modules/@stdlib/plot/charts/base/ctor/lib/options.json @@ -0,0 +1,11 @@ +[ + "autosize", + "background", + "description", + "height", + "padding", + "theme", + "title", + "viewer", + "width" +] diff --git a/lib/node_modules/@stdlib/plot/charts/base/ctor/lib/padding/get.js b/lib/node_modules/@stdlib/plot/charts/base/ctor/lib/padding/get.js new file mode 100644 index 000000000000..5b586dc271c5 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/charts/base/ctor/lib/padding/get.js @@ -0,0 +1,38 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable no-invalid-this */ + +'use strict'; + +// MAIN // + +/** +* Returns the chart padding (in pixels). +* +* @private +* @returns {Padding} padding +*/ +function get() { + return this.config.padding; +} + + +// EXPORTS // + +module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/charts/base/ctor/lib/padding/set.js b/lib/node_modules/@stdlib/plot/charts/base/ctor/lib/padding/set.js new file mode 100644 index 000000000000..daaf36b80e5e --- /dev/null +++ b/lib/node_modules/@stdlib/plot/charts/base/ctor/lib/padding/set.js @@ -0,0 +1,56 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable no-invalid-this */ + +'use strict'; + +// MODULES // + +var isNumber = require( '@stdlib/assert/is-number' ).isPrimitive; +var Padding = require( '@stdlib/plot/vega/padding/ctor' ); + + +// MAIN // + +/** +* Sets the chart padding. +* +* @private +* @param {(Object|Padding|number)} value - input value +* @throws {TypeError} must be a valid padding value +* @returns {void} +*/ +function set( value ) { + if ( isNumber( value ) ) { + value = new Padding({ + 'bottom': value, + 'left': value, + 'right': value, + 'top': value + }); + } else if ( !( value instanceof Padding ) ) { + value = new Padding( value ); // note: this accounts for both vanilla objects and cross-realm instances + } + this.config.padding = value; +} + + +// EXPORTS // + +module.exports = set; diff --git a/lib/node_modules/@stdlib/plot/charts/base/ctor/lib/theme/get.js b/lib/node_modules/@stdlib/plot/charts/base/ctor/lib/theme/get.js new file mode 100644 index 000000000000..042e6b06d575 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/charts/base/ctor/lib/theme/get.js @@ -0,0 +1,38 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable no-invalid-this */ + +'use strict'; + +// MAIN // + +/** +* Returns the chart theme. +* +* @private +* @returns {Config} theme +*/ +function get() { + return this.config.config; +} + + +// EXPORTS // + +module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/charts/base/ctor/lib/theme/set.js b/lib/node_modules/@stdlib/plot/charts/base/ctor/lib/theme/set.js new file mode 100644 index 000000000000..432c9a572abe --- /dev/null +++ b/lib/node_modules/@stdlib/plot/charts/base/ctor/lib/theme/set.js @@ -0,0 +1,40 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable no-invalid-this */ + +'use strict'; + +// MAIN // + +/** +* Sets the chart theme. +* +* @private +* @param {(Object|Config)} value - input value +* @throws {TypeError} must be a valid configuration +* @returns {void} +*/ +function set( value ) { + this.config.config = value; // FIXME: account for cross-realm theme objects and general objects +} + + +// EXPORTS // + +module.exports = set; diff --git a/lib/node_modules/@stdlib/plot/charts/base/ctor/lib/title/get.js b/lib/node_modules/@stdlib/plot/charts/base/ctor/lib/title/get.js new file mode 100644 index 000000000000..c6d029e27147 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/charts/base/ctor/lib/title/get.js @@ -0,0 +1,38 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable no-invalid-this */ + +'use strict'; + +// MAIN // + +/** +* Returns the chart title. +* +* @private +* @returns {Title} title +*/ +function get() { + return this.config.title; +} + + +// EXPORTS // + +module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/charts/base/ctor/lib/title/set.js b/lib/node_modules/@stdlib/plot/charts/base/ctor/lib/title/set.js new file mode 100644 index 000000000000..16822ec6a963 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/charts/base/ctor/lib/title/set.js @@ -0,0 +1,54 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable no-invalid-this */ + +'use strict'; + +// MODULES // + +var isString = require( '@stdlib/assert/is-string' ).isPrimitive; +var Title = require( '@stdlib/plot/vega/title/ctor' ); + + +// MAIN // + +/** +* Sets the chart title. +* +* @private +* @param {(Object|Title|string)} value - input value +* @throws {TypeError} must be a valid title +* @returns {void} +*/ +function set( value ) { + var tmp; + if ( isString( value ) ) { + tmp = new Title( this.config.title ); + tmp.title = value; + value = tmp; + } else if ( !( value instanceof Title ) ) { + value = new Title( value ); // note: this accounts for both vanilla objects and cross-realm instances + } + this.config.title = value; +} + + +// EXPORTS // + +module.exports = set; diff --git a/lib/node_modules/@stdlib/plot/charts/base/ctor/lib/viewer/get.js b/lib/node_modules/@stdlib/plot/charts/base/ctor/lib/viewer/get.js new file mode 100644 index 000000000000..4521967b634d --- /dev/null +++ b/lib/node_modules/@stdlib/plot/charts/base/ctor/lib/viewer/get.js @@ -0,0 +1,38 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable no-invalid-this */ + +'use strict'; + +// MAIN // + +/** +* Returns the chart viewer. +* +* @private +* @returns {string} viewer +*/ +function get() { + return this._viewer; +} + + +// EXPORTS // + +module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/charts/base/ctor/lib/viewer/set.js b/lib/node_modules/@stdlib/plot/charts/base/ctor/lib/viewer/set.js new file mode 100644 index 000000000000..87722110d6f4 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/charts/base/ctor/lib/viewer/set.js @@ -0,0 +1,56 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable no-invalid-this */ + +'use strict'; + +// MODULES // + +var contains = require( '@stdlib/array/base/assert/contains' ).factory; +var join = require( '@stdlib/array/base/join' ); +var format = require( '@stdlib/string/format' ); +var VIEWERS = require( './viewers.json' ); + + +// VARIABLES // + +var isViewer = contains( VIEWERS ); + + +// MAIN // + +/** +* Sets the chart viewer. +* +* @private +* @param {string} value - input value +* @throws {TypeError} must be a valid viewer +* @returns {void} +*/ +function set( value ) { + if ( !isViewer( value ) ) { + throw new TypeError( format( 'invalid assignment. `%s` must be one of the following: "%s". Value: `%s`.', 'viewer', join( VIEWERS, '", "' ), value ) ); + } + this._viewer = value; +} + + +// EXPORTS // + +module.exports = set; diff --git a/lib/node_modules/@stdlib/plot/charts/base/ctor/lib/viewer/viewers.browser.json b/lib/node_modules/@stdlib/plot/charts/base/ctor/lib/viewer/viewers.browser.json new file mode 100644 index 000000000000..20f300d8f591 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/charts/base/ctor/lib/viewer/viewers.browser.json @@ -0,0 +1,3 @@ +[ + "stdout" +] diff --git a/lib/node_modules/@stdlib/plot/charts/base/ctor/lib/viewer/viewers.json b/lib/node_modules/@stdlib/plot/charts/base/ctor/lib/viewer/viewers.json new file mode 100644 index 000000000000..be6d9a158354 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/charts/base/ctor/lib/viewer/viewers.json @@ -0,0 +1,5 @@ +[ + "stdout", + "window", + "browser" +] diff --git a/lib/node_modules/@stdlib/plot/charts/base/ctor/lib/width/get.js b/lib/node_modules/@stdlib/plot/charts/base/ctor/lib/width/get.js new file mode 100644 index 000000000000..98384875d906 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/charts/base/ctor/lib/width/get.js @@ -0,0 +1,38 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable no-invalid-this */ + +'use strict'; + +// MAIN // + +/** +* Returns the chart width (in pixels). +* +* @private +* @returns {NonNegativeNumber} width +*/ +function get() { + return this.config.width; +} + + +// EXPORTS // + +module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/charts/base/ctor/lib/width/set.js b/lib/node_modules/@stdlib/plot/charts/base/ctor/lib/width/set.js new file mode 100644 index 000000000000..06bc492ec9f8 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/charts/base/ctor/lib/width/set.js @@ -0,0 +1,40 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable no-invalid-this */ + +'use strict'; + +// MAIN // + +/** +* Sets the chart width (in pixels). +* +* @private +* @param {NonNegativeNumber} value - input value +* @throws {TypeError} must be a nonnegative number +* @returns {void} +*/ +function set( value ) { + this.config.width = value; +} + + +// EXPORTS // + +module.exports = set; diff --git a/lib/node_modules/@stdlib/plot/charts/base/ctor/package.json b/lib/node_modules/@stdlib/plot/charts/base/ctor/package.json new file mode 100644 index 000000000000..c8a03734e0db --- /dev/null +++ b/lib/node_modules/@stdlib/plot/charts/base/ctor/package.json @@ -0,0 +1,68 @@ +{ + "name": "@stdlib/plot/charts/base/ctor", + "version": "0.0.0", + "description": "Base chart constructor.", + "license": "Apache-2.0", + "author": { + "name": "The Stdlib Authors", + "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" + }, + "contributors": [ + { + "name": "The Stdlib Authors", + "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" + } + ], + "main": "./lib", + "browser": { + "./lib/viewer/viewers.json": "./lib/viewer/viewers.browser.json" + }, + "directories": { + "doc": "./docs", + "example": "./examples", + "lib": "./lib", + "test": "./test" + }, + "scripts": {}, + "homepage": "https://github.com/stdlib-js/stdlib", + "repository": { + "type": "git", + "url": "git://github.com/stdlib-js/stdlib.git" + }, + "bugs": { + "url": "https://github.com/stdlib-js/stdlib/issues" + }, + "dependencies": {}, + "devDependencies": {}, + "engines": { + "node": ">=0.10.0", + "npm": ">2.7.0" + }, + "os": [ + "aix", + "darwin", + "freebsd", + "linux", + "macos", + "openbsd", + "sunos", + "win32", + "windows" + ], + "keywords": [ + "stdlib", + "plot", + "figure", + "fig", + "graph", + "chart", + "diagram", + "data", + "visualize", + "visualization", + "dataviz", + "explore", + "exploratory", + "analysis" + ] +} diff --git a/lib/node_modules/@stdlib/plot/charts/base/quantitative/examples/index.js b/lib/node_modules/@stdlib/plot/charts/base/quantitative/examples/index.js new file mode 100644 index 000000000000..06784fd8cba6 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/charts/base/quantitative/examples/index.js @@ -0,0 +1,28 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +var QuantitativeChart = require( './../lib' ); + +var chart = new QuantitativeChart({ + 'title': 'Hello World!', + 'xTitle': 'Hello', + 'yTitle': 'World' +}); +console.log( chart.toJSON() ); diff --git a/lib/node_modules/@stdlib/plot/charts/base/quantitative/lib/change_event.js b/lib/node_modules/@stdlib/plot/charts/base/quantitative/lib/change_event.js new file mode 100644 index 000000000000..e406e971fe4e --- /dev/null +++ b/lib/node_modules/@stdlib/plot/charts/base/quantitative/lib/change_event.js @@ -0,0 +1,41 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MAIN // + +/** +* Returns a new change event object. +* +* @private +* @param {string} property - property name +* @returns {Object} event object +*/ +function event( property ) { // eslint-disable-line stdlib/no-redeclare + return { + 'type': 'update', + 'source': 'visualization', + 'property': property + }; +} + + +// EXPORTS // + +module.exports = event; diff --git a/lib/node_modules/@stdlib/plot/charts/base/quantitative/lib/channels/get.js b/lib/node_modules/@stdlib/plot/charts/base/quantitative/lib/channels/get.js new file mode 100644 index 000000000000..60896f07842e --- /dev/null +++ b/lib/node_modules/@stdlib/plot/charts/base/quantitative/lib/channels/get.js @@ -0,0 +1,44 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable no-invalid-this */ + +'use strict'; + +// MODULES // + +var objectAssign = require( '@stdlib/object/assign' ); +var prop = require( './properties.js' ); + + +// MAIN // + +/** +* Returns an object mapping chart data field names to encoding channels. +* +* @private +* @returns {Object} channels +*/ +function get() { + return objectAssign( {}, this[ prop.private ] ); +} + + +// EXPORTS // + +module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/charts/base/quantitative/lib/channels/properties.js b/lib/node_modules/@stdlib/plot/charts/base/quantitative/lib/channels/properties.js new file mode 100644 index 000000000000..5940cbd8d1c2 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/charts/base/quantitative/lib/channels/properties.js @@ -0,0 +1,33 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var property2object = require( '@stdlib/plot/vega/base/property2object' ); + + +// MAIN // + +var obj = property2object( 'channels' ); + + +// EXPORTS // + +module.exports = obj; diff --git a/lib/node_modules/@stdlib/plot/charts/base/quantitative/lib/channels/set.js b/lib/node_modules/@stdlib/plot/charts/base/quantitative/lib/channels/set.js new file mode 100644 index 000000000000..4c0e94b99b95 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/charts/base/quantitative/lib/channels/set.js @@ -0,0 +1,63 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable no-invalid-this */ + +'use strict'; + +// MODULES // + +var logger = require( 'debug' ); +var isObject = require( '@stdlib/assert/is-object' ); +var objectAssignIn = require( '@stdlib/object/assign-in' ); +var format = require( '@stdlib/string/format' ); +var changeEvent = require( './../change_event.js' ); +var prop = require( './properties.js' ); + + +// VARIABLES // + +var debug = logger( 'quantitative-chart:channels:set:'+prop.name ); + + +// MAIN // + +/** +* Sets an object mapping chart data field names to encoding channels. +* +* @private +* @param {Object} value - input value +* @throws {TypeError} must be an object +* @returns {void} +*/ +function set( value ) { + if ( !isObject( value ) ) { + throw new TypeError( format( 'invalid assignment. `%s` must be an object. Value: `%s`.', prop.name, value ) ); + } + // FIXME: verify that the object has valid field mappings (i.e., string-to-string) + + value = objectAssignIn( {}, value ); + debug( 'Current value: %s. New value: %s.', JSON.stringify( this[ prop.private ] ), JSON.stringify( value ) ); + this[ prop.private ] = value; + this.emit( 'change', changeEvent( prop.name ) ); +} + + +// EXPORTS // + +module.exports = set; diff --git a/lib/node_modules/@stdlib/plot/charts/base/quantitative/lib/data/get.js b/lib/node_modules/@stdlib/plot/charts/base/quantitative/lib/data/get.js new file mode 100644 index 000000000000..3f8569f84b79 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/charts/base/quantitative/lib/data/get.js @@ -0,0 +1,43 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable no-invalid-this */ + +'use strict'; + +// MODULES // + +var copy = require( '@stdlib/array/base/copy' ); + + +// MAIN // + +/** +* Returns chart data. +* +* @private +* @returns {Array<DataSet>} data sets +*/ +function get() { + return copy( this.config.data ); +} + + +// EXPORTS // + +module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/charts/base/quantitative/lib/data/properties.js b/lib/node_modules/@stdlib/plot/charts/base/quantitative/lib/data/properties.js new file mode 100644 index 000000000000..f2a3cb70b387 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/charts/base/quantitative/lib/data/properties.js @@ -0,0 +1,33 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var property2object = require( '@stdlib/plot/vega/base/property2object' ); + + +// MAIN // + +var obj = property2object( 'data' ); + + +// EXPORTS // + +module.exports = obj; diff --git a/lib/node_modules/@stdlib/plot/charts/base/quantitative/lib/data/set.js b/lib/node_modules/@stdlib/plot/charts/base/quantitative/lib/data/set.js new file mode 100644 index 000000000000..4fe86784eaec --- /dev/null +++ b/lib/node_modules/@stdlib/plot/charts/base/quantitative/lib/data/set.js @@ -0,0 +1,75 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable no-invalid-this */ + +'use strict'; + +// MODULES // + +var logger = require( 'debug' ); +var isDataSetArray = require( '@stdlib/plot/vega/base/assert/is-dataset-array' ); +var isArrayLikeObject = require( '@stdlib/assert/is-array-like-object' ); +var hasEqualValues = require( '@stdlib/array/base/assert/has-equal-values' ); +var min = require( '@stdlib/math/base/special/fast/min' ); +var xyargs2tidy = require( '@stdlib/plot/vega/data/tidy/from-xy-arguments' ); +var format = require( '@stdlib/string/format' ); +var prop = require( './properties.js' ); + + +// VARIABLES // + +var debug = logger( 'quantitative-chart:data:set:'+prop.name ); + + +// MAIN // + +/** +* Sets chart data. +* +* @private +* @param {ArrayLikeObject} value - input value +* @throws {TypeError} must be an array-like object +* @returns {void} +*/ +function set( value ) { + var data; + var N; + var i; + if ( !isArrayLikeObject( value ) ) { + throw new TypeError( format( 'invalid assignment. `%s` must be an array-like object. Value: `%s`.', prop.name, value ) ); + } + if ( !hasEqualValues( value, this.config.data ) ) { + debug( 'New chart data.' ); + if ( isDataSetArray( value ) ) { + data = value; + } else { + data = xyargs2tidy( value, this._channels ); + N = min( data.length, this._labels.length ); + for ( i = 0; i < N; i++ ) { + data[ i ].name = this._labels[ i ]; + } + } + this.config.data = data; + } +} + + +// EXPORTS // + +module.exports = set; diff --git a/lib/node_modules/@stdlib/plot/charts/base/quantitative/lib/defaults.js b/lib/node_modules/@stdlib/plot/charts/base/quantitative/lib/defaults.js new file mode 100644 index 000000000000..62e459334401 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/charts/base/quantitative/lib/defaults.js @@ -0,0 +1,64 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MAIN // + +/** +* Returns defaults. +* +* @private +* @returns {Object} defaults +* +* @example +* var obj = defaults(); +* // returns {...} +*/ +function defaults() { + return { + // Object mapping data field names to encoding channels: + 'channels': { + 'x': 'x', + 'y': 'y' + }, + + // Chart data: + 'data': [], + + // Data labels: + 'labels': [], + + // x-axis scale type: + 'xScaleType': 'linear', + + // x-axis label: + 'xTitle': 'x', + + // y-axis scale type: + 'yScaleType': 'linear', + + // y-axis label: + 'yTitle': 'y' + }; +} + + +// EXPORTS // + +module.exports = defaults; diff --git a/lib/node_modules/@stdlib/plot/charts/base/quantitative/lib/index.js b/lib/node_modules/@stdlib/plot/charts/base/quantitative/lib/index.js new file mode 100644 index 000000000000..3a0252e0bb55 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/charts/base/quantitative/lib/index.js @@ -0,0 +1,42 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +/** +* Quantitative chart constructor. +* +* @module @stdlib/plot/charts/base/quantitative +* +* @example +* var Chart = require( '@stdlib/plot/charts/base/quantitative' ); +* +* var chart = new Chart(); +* // returns <QuantitativeChart> +* +* // TODO: update example +*/ + +// MODULES // + +var main = require( './main.js' ); + + +// EXPORTS // + +module.exports = main; diff --git a/lib/node_modules/@stdlib/plot/charts/base/quantitative/lib/labels/get.js b/lib/node_modules/@stdlib/plot/charts/base/quantitative/lib/labels/get.js new file mode 100644 index 000000000000..a721d1f874e5 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/charts/base/quantitative/lib/labels/get.js @@ -0,0 +1,44 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable no-invalid-this */ + +'use strict'; + +// MODULES // + +var copy = require( '@stdlib/array/base/copy' ); +var prop = require( './properties.js' ); + + +// MAIN // + +/** +* Returns the data labels. +* +* @private +* @returns {Array<string>} labels +*/ +function get() { + return copy( this[ prop.private ] ); +} + + +// EXPORTS // + +module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/charts/base/quantitative/lib/labels/properties.js b/lib/node_modules/@stdlib/plot/charts/base/quantitative/lib/labels/properties.js new file mode 100644 index 000000000000..9709d425d345 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/charts/base/quantitative/lib/labels/properties.js @@ -0,0 +1,33 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var property2object = require( '@stdlib/plot/vega/base/property2object' ); + + +// MAIN // + +var obj = property2object( 'labels' ); + + +// EXPORTS // + +module.exports = obj; diff --git a/lib/node_modules/@stdlib/plot/charts/base/quantitative/lib/labels/set.js b/lib/node_modules/@stdlib/plot/charts/base/quantitative/lib/labels/set.js new file mode 100644 index 000000000000..e5187206b0cd --- /dev/null +++ b/lib/node_modules/@stdlib/plot/charts/base/quantitative/lib/labels/set.js @@ -0,0 +1,78 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable no-invalid-this */ + +'use strict'; + +// MODULES // + +var logger = require( 'debug' ); +var isStringArray = require( '@stdlib/assert/is-string-array' ).primitives; +var isEmptyArrayLikeObject = require( '@stdlib/assert/is-empty-array-like-object' ); +var hasEqualValues = require( '@stdlib/array/base/assert/has-equal-values' ); +var min = require( '@stdlib/math/base/special/fast/min' ); +var copy = require( '@stdlib/array/base/copy' ); +var join = require( '@stdlib/array/base/join' ); +var format = require( '@stdlib/string/format' ); +var changeEvent = require( './../change_event.js' ); +var prop = require( './properties.js' ); + + +// VARIABLES // + +var debug = logger( 'quantitative-chart:labels:set:'+prop.name ); + + +// MAIN // + +/** +* Sets data labels. +* +* @private +* @param {Array<string>} value - input value +* @throws {TypeError} must be an array of strings +* @returns {void} +*/ +function set( value ) { + var labels; + var data; + var N; + var i; + if ( !isStringArray( value ) && !isEmptyArrayLikeObject( value ) ) { + throw new TypeError( format( 'invalid assignment. `%s` must be an array of strings. Value: `%s`.', prop.name, value ) ); + } + // FIXME: verify that the list of data labels is unique + + if ( !hasEqualValues( value, this[ prop.private ] ) ) { + debug( 'Current value: [%s]. New value: [%s].', join( this[ prop.private ], ', ' ), join( value, ', ' ) ); + labels = copy( value ); + data = this.config.data; + N = min( data.length, labels.length ); + for ( i = 0; i < N; i++ ) { + data[ i ].name = labels[ i ]; + } + this[ prop.private ] = labels; + this.emit( 'change', changeEvent( prop.name ) ); + } +} + + +// EXPORTS // + +module.exports = set; diff --git a/lib/node_modules/@stdlib/plot/charts/base/quantitative/lib/main.js b/lib/node_modules/@stdlib/plot/charts/base/quantitative/lib/main.js new file mode 100644 index 000000000000..42e3d0b0e6de --- /dev/null +++ b/lib/node_modules/@stdlib/plot/charts/base/quantitative/lib/main.js @@ -0,0 +1,910 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable no-restricted-syntax, no-invalid-this */ + +'use strict'; + +// MODULES // + +var isObject = require( '@stdlib/assert/is-object' ); +var hasProp = require( '@stdlib/assert/has-property' ); +var setReadWriteAccessor = require( '@stdlib/utils/define-read-write-accessor' ); +var setReadOnlyAccessor = require( '@stdlib/utils/define-read-only-accessor' ); +var setNonEnumerableReadOnly = require( '@stdlib/utils/define-nonenumerable-read-only-property' ); +var setNonEnumerableReadOnlyAccessor = require( '@stdlib/utils/define-nonenumerable-read-only-accessor' ); // eslint-disable-line id-length +var inherit = require( '@stdlib/utils/inherit' ); +var replace = require( '@stdlib/string/base/replace' ); +var nanminBy = require( '@stdlib/stats/array/nanmin-by' ); +var nanmin = require( '@stdlib/stats/array/nanmin' ); +var nanmaxBy = require( '@stdlib/stats/array/nanmax-by' ); +var nanmax = require( '@stdlib/stats/array/nanmax' ); +var zeros = require( '@stdlib/array/base/zeros' ); +var BaseChart = require( '@stdlib/plot/charts/base/ctor' ); +var xScale = require( '@stdlib/plot/vega/scale/x-quantitative' ); +var yScale = require( '@stdlib/plot/vega/scale/y-quantitative' ); +var Axis = require( '@stdlib/plot/vega/axis/ctor' ); +var format = require( '@stdlib/string/format' ); +var properties = require( './properties.json' ); +var defaults = require( './defaults.js' ); + +// Note: keep the following in alphabetical order according to the `require` path... +var getChannels = require( './channels/get.js' ); +var setChannels = require( './channels/set.js' ); + +var getData = require( './data/get.js' ); +var setData = require( './data/set.js' ); + +var getLabels = require( './labels/get.js' ); +var setLabels = require( './labels/set.js' ); + +var getXFormat = require( './x-format/get.js' ); +var setXFormat = require( './x-format/set.js' ); +var getXMax = require( './x-max/get.js' ); +var setXMax = require( './x-max/set.js' ); +var getXMin = require( './x-min/get.js' ); +var setXMin = require( './x-min/set.js' ); +var getXScaleType = require( './x-scale-type/get.js' ); +var setXScaleType = require( './x-scale-type/set.js' ); +var getXTickCount = require( './x-tick-count/get.js' ); +var setXTickCount = require( './x-tick-count/set.js' ); +var getXTitle = require( './x-title/get.js' ); +var setXTitle = require( './x-title/set.js' ); + +var getYFormat = require( './y-format/get.js' ); +var setYFormat = require( './y-format/set.js' ); +var getYMax = require( './y-max/get.js' ); +var setYMax = require( './y-max/set.js' ); +var getYMin = require( './y-min/get.js' ); +var setYMin = require( './y-min/set.js' ); +var getYScaleType = require( './y-scale-type/get.js' ); +var setYScaleType = require( './y-scale-type/set.js' ); +var getYTickCount = require( './y-tick-count/get.js' ); +var setYTickCount = require( './y-tick-count/set.js' ); +var getYTitle = require( './y-title/get.js' ); +var setYTitle = require( './y-title/set.js' ); + + +// VARIABLES // + +// Options from parent constructor(s): +var PARENT_OPTIONS = [ + 'background', + 'description', + 'height', + 'padding', + 'theme', + 'title', + 'viewer', + 'width' +]; + +// Options for this constructor: +var OPTIONS = [ + 'channels', // note: this option MUST come before `data` in order to ensure expected data transformation and encoding + 'data', + 'labels', + + 'xFormat', + 'xMax', + 'xMin', + 'xScaleType', + 'xTickCount', + 'xTitle', + + 'yFormat', + 'yMax', + 'yMin', + 'yScaleType', + 'yTickCount', + 'yTitle' +]; + +// Table mapping options to component properties: +var opt2prop = { + 'channels': 'channels', // chart.channels + 'data': 'data', // chart.data + 'labels': 'labels', // chart.labels + + 'xFormat': 'format', // axis.format + 'xMax': 'domainMax', // scale.domainMax + 'xMin': 'domainMin', // scale.domainMin + 'xScaleType': 'type', // scale.type + 'xTickCount': 'tickCount', // axis.tickCount + 'xTitle': 'title', // axis.title + + 'yFormat': 'format', // axis.format + 'yMax': 'domainMax', // scale.domainMax + 'yMin': 'domainMin', // scale.domainMin + 'yScaleType': 'type', // scale.type + 'yTickCount': 'tickCount', // axis.tickCount + 'yTitle': 'title' // axis.title +}; + + +// FUNCTIONS // + +/** +* Transforms an "assignment" error message to an "option validation" error message. +* +* @private +* @param {string} msg - error message +* @param {string} name - property name +* @returns {string} transformed message +*/ +function transformErrorMessage( msg, name ) { + var m = replace( msg, /invalid assignment\. `([^ ]+)`/, format( 'invalid option. `%s` option', name ) ); + return replace( m, /\. Value:/, '. Option:' ); +} + +/** +* Attempts to assign an option value to a component property. +* +* @private +* @param {Object} component - component +* @param {string} option - option name +* @param {*} value - value to assign +* @throws {TypeError} unexpected error +*/ +function assignOption( component, option, value ) { + try { + component[ opt2prop[ option ] ] = value; + } catch ( err ) { + // FIXME: retain error type + throw new TypeError( transformErrorMessage( err.message, option ) ); + } +} + +/** +* Returns an `x`-value. +* +* @private +* @param {Object} value - input value +* @returns {number} value +*/ +function xAccessor( value ) { + return value.x; +} + +/** +* Returns a `y`-value. +* +* @private +* @param {Object} value - input value +* @returns {number} value +*/ +function yAccessor( value ) { + return value.y; +} + + +// MAIN // + +/** +* Quantitative chart constructor. +* +* @constructor +* @param {Options} [options] - constructor options +* @param {string} [options.background] - background color +* @param {Object} [options.channels={'x':'x','y':'y'}] - object mapping chart data field names to encoding channels ('x', 'y', and 'z') +* @param {ArrayLikeObject} [options.data=[]] - chart data +* @param {string} [options.description=''] - chart description +* @param {number} [options.height=480] - chart height (in pixels) +* @param {Array<string>} [options.labels=[]] - data labels +* @param {Object} [options.padding] - chart padding +* @param {number} [options.padding.bottom=0] - chart bottom padding (in pixels) +* @param {number} [options.padding.left=0] - chart left padding (in pixels) +* @param {number} [options.padding.right=0] - chart right padding (in pixels) +* @param {number} [options.padding.top=0] - chart top padding (in pixels) +* @param {Object} [options.theme] - chart theme +* @param {(string|Array<string>)} [options.title=''] - chart title +* @param {string} [options.viewer] - default chart viewer +* @param {number} [options.width=600] - chart width (in pixels) +* @param {(string|Array<string>)} [options.xTitle='x'] - x-axis label +* @param {(string|Object)} [options.xFormat] - x-axis tick format +* @param {number} [options.xMax] - maximum value of the x-axis domain +* @param {number} [options.xMin] - minimum value of the x-axis domain +* @param {string} [options.xScaleType='linear'] - x-axis scale type +* @param {(number|string|Object)} [options.xTickCount] - number of x-axis tick marks +* @param {(string|Object)} [options.yFormat] - y-axis tick format +* @param {number} [options.yMax] - maximum value of the y-axis domain +* @param {number} [options.yMin] - minimum value of the y-axis domain +* @param {string} [options.yScaleType='linear'] - y-axis scale type +* @param {(number|string|Object)} [options.yTickCount] - number of y-axis tick marks +* @param {(string|Array<string>)} [options.yTitle='y'] - y-axis label +* @throws {TypeError} options argument must be an object +* @throws {TypeError} must provide valid options +* @returns {QuantitativeChart} chart instance +* +* @example +* var chart = new QuantitativeChart(); +* // returns <QuantitativeChart> +*/ +function QuantitativeChart( options ) { + var config; + var nargs; + var xAxis; + var yAxis; + var table; + var opts; + var xs; + var ys; + var k; + var i; + + nargs = arguments.length; + if ( !( this instanceof QuantitativeChart ) ) { + if ( nargs ) { + return new QuantitativeChart( options ); + } + return new QuantitativeChart(); + } + opts = defaults(); + + // Set internal properties according to the default configuration... + for ( i = 0; i < properties.length; i++ ) { + k = properties[ i ]; + if ( hasProp( opts, k ) ) { + this[ '_'+k ] = opts[ k ]; + } + } + // Resolve user-provided options... + if ( nargs ) { + if ( !isObject( options ) ) { + throw new TypeError( format( 'invalid argument. Options argument must be an object. Value: `%s`.', options ) ); + } + for ( i = 0; i < PARENT_OPTIONS.length; i++ ) { + k = PARENT_OPTIONS[ i ]; + if ( !hasProp( options, k ) ) { + continue; + } + opts[ k ] = options[ k ]; + } + for ( i = 0; i < OPTIONS.length; i++ ) { + k = OPTIONS[ i ]; + if ( !hasProp( options, k ) ) { + continue; + } + opts[ k ] = options[ k ]; + } + } + BaseChart.call( this, opts ); + setNonEnumerableReadOnly( this, '_parent', BaseChart ); + + // Initialize axis scales: + xs = xScale({ + 'domain': [ 0, 1 ] + }); + ys = yScale({ + 'domain': [ 0, 1 ] + }); + + // Initialize axes: + xAxis = new Axis({ // FIXME: replace with axisBottom + 'scale': xs.name, + 'orient': 'bottom' + }); + yAxis = new Axis({ // FIXME: replace with axisLeft + 'scale': ys.name, + 'orient': 'left' + }); + + // Define a table mapping options to corresponding components: + table = { + 'channels': this, + 'data': this, + 'labels': this, + + 'xFormat': xAxis, + 'xMax': xs, + 'xMin': xs, + 'xScaleType': xs, + 'xTickCount': xAxis, + 'xTitle': xAxis, + + 'yFormat': yAxis, + 'yMax': ys, + 'yMin': ys, + 'yScaleType': ys, + 'yTickCount': yAxis, + 'yTitle': yAxis + }; + + // Validate provided options by attempting to assign option values to corresponding fields... + for ( i = 0; i < OPTIONS.length; i++ ) { + k = OPTIONS[ i ]; + if ( hasProp( opts, k ) ) { + assignOption( table[ k ], k, opts[ k ] ); + } + } + + // Update the visualization configuration: + config = this.config; + config.scales = [ xs, ys ]; + config.axes = [ xAxis, yAxis ]; + + return this; +} + +/* +* Inherit from the `BaseChart` prototype. +*/ +inherit( QuantitativeChart, BaseChart ); + +/** +* Constructor name. +* +* @private +* @name name +* @memberof QuantitativeChart +* @readonly +* @type {string} +*/ +setNonEnumerableReadOnly( QuantitativeChart, 'name', 'QuantitativeChart' ); + +/** +* Returns the maximum value according to a specified field accessor. +* +* @private +* @name _maxBy +* @memberof QuantitativeChart.prototype +* @type {Function} +* @param {Function} accessor - field accessor +* @returns {number} +*/ +setNonEnumerableReadOnly( QuantitativeChart.prototype, '_maxBy', function getMax( accessor ) { + var values; + var data; + var N; + var i; + + data = this.config.data; + N = data.length; + if ( N === 0 ) { + return 1; + } + values = zeros( N ); + for ( i = 0; i < N; i++ ) { + values[ i ] = nanmaxBy( data[ i ].values, accessor ); + } + return nanmax( values ); +}); + +/** +* Returns the minimum value according to a specified field accessor. +* +* @private +* @name _minBy +* @memberof QuantitativeChart.prototype +* @type {Function} +* @param {Function} accessor - field accessor +* @returns {number} +*/ +setNonEnumerableReadOnly( QuantitativeChart.prototype, '_minBy', function getMin( accessor ) { + var values; + var data; + var N; + var i; + + data = this.config.data; + N = data.length; + if ( N === 0 ) { + return 1; + } + values = zeros( N ); + for ( i = 0; i < N; i++ ) { + values[ i ] = nanminBy( data[ i ].values, accessor ); + } + return nanmin( values ); +}); + +/** +* Graph height (in pixels). +* +* @private +* @name _graphHeight +* @memberof QuantitativeChart.prototype +* @type {number} +*/ +setNonEnumerableReadOnlyAccessor( QuantitativeChart.prototype, '_graphHeight', function getGraphHeight() { + var padding; + var config; + + config = this.config; + padding = config.padding; + + return config.height - padding.top - padding.bottom; +}); + +/** +* Graph width (in pixels). +* +* @private +* @name _graphWidth +* @memberof QuantitativeChart.prototype +* @type {number} +*/ +setNonEnumerableReadOnlyAccessor( QuantitativeChart.prototype, '_graphWidth', function getGraphWidth() { + var padding; + var config; + + config = this.config; + padding = config.padding; + + return config.width - padding.left - padding.right; +}); + +/** +* Returns the maximum `x` value. +* +* @private +* @name _xMax +* @memberof QuantitativeChart.prototype +* @type {number} +*/ +setNonEnumerableReadOnlyAccessor( QuantitativeChart.prototype, '_xMax', function getXMax() { + return this._maxBy( xAccessor ); +}); + +/** +* Returns the minimum `x` value. +* +* @private +* @name _xMin +* @memberof QuantitativeChart.prototype +* @type {number} +*/ +setNonEnumerableReadOnlyAccessor( QuantitativeChart.prototype, '_xMin', function getXMin() { + return this._minBy( xAccessor ); +}); + +/** +* Returns the maximum `y` value. +* +* @private +* @name _yMax +* @memberof QuantitativeChart.prototype +* @type {number} +*/ +setNonEnumerableReadOnlyAccessor( QuantitativeChart.prototype, '_yMax', function getYMax() { + return this._maxBy( yAccessor ); +}); + +/** +* Returns the minimum `y` value. +* +* @private +* @name _yMin +* @memberof QuantitativeChart.prototype +* @type {number} +*/ +setNonEnumerableReadOnlyAccessor( QuantitativeChart.prototype, '_yMin', function getYMin() { + return this._minBy( yAccessor ); +}); + +/** +* Object mapping chart data field names to encoding channels. +* +* ## Notes +* +* - Encoding channels: +* +* - **x**: x-coordinate encoding channel. +* - **y**: y-coordinate encoding channel. +* - **z**: group encoding channel. +* +* - The `z` encoding channel only applies to datasets which are arrays of objects and is used to split an array of objects into multiple data sets whose elements are grouped according to the values assigned to the corresponding channel field. +* +* @name channels +* @memberof QuantitativeChart.prototype +* @type {Object} +* @default { 'x': 'x', 'y': 'y' } +* +* @example +* var chart = new QuantitativeChart({ +* 'channels': { +* 'x': 'a', +* 'y': 'b' +* } +* }); +* // returns <QuantitativeChart> +* +* var v = chart.channels; +* // returns { 'x': 'a', 'y': 'b' } +*/ +setReadWriteAccessor( QuantitativeChart.prototype, 'channels', getChannels, setChannels ); + +/** +* Data sets. +* +* @name data +* @memberof QuantitativeChart.prototype +* @type {Array<DataSet>} +* @default [] +* +* @example +* var chart = new QuantitativeChart({ +* 'data': [ [ 1, 2, 3 ], [ 4, 5, 6 ] ] +* }); +* // returns <QuantitativeChart> +* +* var v = chart.data; +* // returns [ <DataSet> ] +*/ +setReadWriteAccessor( QuantitativeChart.prototype, 'data', getData, setData ); + +/** +* Data labels. +* +* @name labels +* @memberof QuantitativeChart.prototype +* @type {Array<string>} +* @default [] +* +* @example +* var chart = new QuantitativeChart({ +* 'labels': [ 'foo', 'bar' ] +* }); +* // returns <QuantitativeChart> +* +* var v = chart.labels; +* // returns [ 'foo', 'bar' ] +*/ +setReadWriteAccessor( QuantitativeChart.prototype, 'labels', getLabels, setLabels ); + +/** +* Chart legend. +* +* @name legend +* @memberof QuantitativeChart.prototype +* @type {(Legend|null)} +* +* @example +* var chart = new QuantitativeChart(); +* // returns <QuantitativeChart> +* +* var v = chart.legend; +* // returns null +*/ +setReadOnlyAccessor( QuantitativeChart.prototype, 'legend', function getLegend() { + var legends = this.config.legends; + return ( legends.length === 0 ) ? null : legends[ 0 ]; +}); + +/** +* Chart x-axis. +* +* @name xAxis +* @memberof QuantitativeChart.prototype +* @type {Axis} +* +* @example +* var chart = new QuantitativeChart(); +* // returns <QuantitativeChart> +* +* var v = chart.xAxis; +* // returns <Axis> +*/ +setReadOnlyAccessor( QuantitativeChart.prototype, 'xAxis', function getXAxis() { + return this.config.axes[ 0 ]; +}); + +/** +* Chart x-axis tick format. +* +* @name xFormat +* @memberof QuantitativeChart.prototype +* @type {(string|Object)} +* +* @example +* var chart = new QuantitativeChart({ +* 'xFormat': '%0.4f' +* }); +* // returns <QuantitativeChart> +* +* var v = chart.xFormat; +* // returns '%0.4f' +*/ +setReadWriteAccessor( QuantitativeChart.prototype, 'xFormat', getXFormat, setXFormat ); + +/** +* Maximum value of the x-axis scale domain (if set). +* +* @name xMax +* @memberof QuantitativeChart.prototype +* @type {(number|void)} +* +* @example +* var chart = new QuantitativeChart({ +* 'xMax': 1 +* }); +* // returns <QuantitativeChart> +* +* var v = chart.xMax; +* // returns 1 +*/ +setReadWriteAccessor( QuantitativeChart.prototype, 'xMax', getXMax, setXMax ); + +/** +* Minimum value of the x-axis scale domain (if set). +* +* @name xMin +* @memberof QuantitativeChart.prototype +* @type {(number|void)} +* +* @example +* var chart = new QuantitativeChart({ +* 'xMin': 0 +* }); +* // returns <QuantitativeChart> +* +* var v = chart.xMin; +* // returns 0 +*/ +setReadWriteAccessor( QuantitativeChart.prototype, 'xMin', getXMin, setXMin ); + +/** +* Chart x-axis scale. +* +* @name xScale +* @memberof QuantitativeChart.prototype +* @type {Scale} +* +* @example +* var chart = new QuantitativeChart(); +* // returns <QuantitativeChart> +* +* var y = chart.xScale; +* // returns <Scale> +*/ +setReadOnlyAccessor( QuantitativeChart.prototype, 'xScale', function getXScale() { + return this.config.scales[ 0 ]; +}); + +/** +* Chart x-axis scale type. +* +* @name xScaleType +* @memberof QuantitativeChart.prototype +* @type {string} +* @default 'linear' +* +* @example +* var chart = new QuantitativeChart({ +* 'xScaleType': 'log' +* }); +* // returns <QuantitativeChart> +* +* var v = chart.xScaleType; +* // returns 'log' +*/ +setReadWriteAccessor( QuantitativeChart.prototype, 'xScaleType', getXScaleType, setXScaleType ); + +/** +* Number of desired x-axis tick marks. +* +* @name xTickCount +* @memberof QuantitativeChart.prototype +* @type {(string|number|Object)} +* +* @example +* var chart = new QuantitativeChart({ +* 'xTickCount': 10 +* }); +* // returns <QuantitativeChart> +* +* var v = chart.xTickCount; +* // returns 10 +*/ +setReadWriteAccessor( QuantitativeChart.prototype, 'xTickCount', getXTickCount, setXTickCount ); + +/** +* Chart x-axis title. +* +* @name xTitle +* @memberof QuantitativeChart.prototype +* @type {Array<string>} +* @default [ 'x' ] +* +* @example +* var chart = new QuantitativeChart({ +* 'xTitle': 'Foo' +* }); +* // returns <QuantitativeChart> +* +* var v = chart.xTitle; +* // returns [ 'Foo' ] +*/ +setReadWriteAccessor( QuantitativeChart.prototype, 'xTitle', getXTitle, setXTitle ); + +/** +* Chart y-axis. +* +* @name yAxis +* @memberof QuantitativeChart.prototype +* @type {Axis} +* +* @example +* var chart = new QuantitativeChart(); +* // returns <QuantitativeChart> +* +* var v = chart.yAxis; +* // returns <Axis> +*/ +setReadOnlyAccessor( QuantitativeChart.prototype, 'yAxis', function getXAxis() { + return this.config.axes[ 1 ]; +}); + +/** +* Chart y-axis tick format. +* +* @name yFormat +* @memberof QuantitativeChart.prototype +* @type {(string|Object)} +* +* @example +* var chart = new QuantitativeChart({ +* 'yFormat': '%0.4f' +* }); +* // returns <QuantitativeChart> +* +* var v = chart.yFormat; +* // returns '%0.4f' +*/ +setReadWriteAccessor( QuantitativeChart.prototype, 'yFormat', getYFormat, setYFormat ); + +/** +* Maximum value of the y-axis scale domain (if set). +* +* @name yMax +* @memberof QuantitativeChart.prototype +* @type {(number|void)} +* +* @example +* var chart = new QuantitativeChart({ +* 'yMax': 1 +* }); +* // returns <QuantitativeChart> +* +* var v = chart.yMax; +* // returns 1 +*/ +setReadWriteAccessor( QuantitativeChart.prototype, 'yMax', getYMax, setYMax ); + +/** +* Minimum value of the y-axis scale domain (if set). +* +* @name yMin +* @memberof QuantitativeChart.prototype +* @type {(number|void)} +* +* @example +* var chart = new QuantitativeChart({ +* 'yMin': 0 +* }); +* // returns <QuantitativeChart> +* +* var v = chart.yMin; +* // returns 0 +*/ +setReadWriteAccessor( QuantitativeChart.prototype, 'yMin', getYMin, setYMin ); + +/** +* Chart y-axis scale. +* +* @name yScale +* @memberof QuantitativeChart.prototype +* @type {Scale} +* +* @example +* var chart = new QuantitativeChart(); +* // returns <QuantitativeChart> +* +* var y = chart.yScale; +* // returns <Scale> +*/ +setReadOnlyAccessor( QuantitativeChart.prototype, 'yScale', function getYScale() { + return this.config.scales[ 1 ]; +}); + +/** +* Chart y-axis scale type. +* +* @name yScaleType +* @memberof QuantitativeChart.prototype +* @type {string} +* @default 'linear' +* +* @example +* var chart = new QuantitativeChart({ +* 'yScaleType': 'log' +* }); +* // returns <QuantitativeChart> +* +* var v = chart.yScaleType; +* // returns 'log' +*/ +setReadWriteAccessor( QuantitativeChart.prototype, 'yScaleType', getYScaleType, setYScaleType ); + +/** +* Number of desired x-axis tick marks. +* +* @name yTickCount +* @memberof QuantitativeChart.prototype +* @type {(string|number|Object)} +* +* @example +* var chart = new QuantitativeChart({ +* 'yTickCount': 10 +* }); +* // returns <QuantitativeChart> +* +* var v = chart.yTickCount; +* // returns 10 +*/ +setReadWriteAccessor( QuantitativeChart.prototype, 'yTickCount', getYTickCount, setYTickCount ); + +/** +* Chart y-axis title. +* +* @name yTitle +* @memberof QuantitativeChart.prototype +* @type {Array<string>} +* @default [ 'y' ] +* +* @example +* var chart = new QuantitativeChart({ +* 'yTitle': 'Bar' +* }); +* // returns <QuantitativeChart> +* +* var v = chart.yTitle; +* // returns [ 'Bar' ] +*/ +setReadWriteAccessor( QuantitativeChart.prototype, 'yTitle', getYTitle, setYTitle ); + +/** +* Serializes a chart to a JSON object. +* +* ## Notes +* +* - This method is implicitly invoked by `JSON.stringify`. +* +* @name toJSON +* @memberof QuantitativeChart.prototype +* @type {Function} +* @returns {Object} JSON object +* +* @example +* var chart = new QuantitativeChart(); +* +* var v = chart.toJSON(); +* // returns {...} +*/ +setNonEnumerableReadOnly( QuantitativeChart.prototype, 'toJSON', function toJSON() { + this.xScale.domain = [ this._xMin, this._xMax ]; + this.yScale.domain = [ this._yMin, this._yMax ]; + this.xScale.range = [ 0, this._graphWidth ]; + this.yScale.range = [ this._graphHeight, 0 ]; + return this.config.toJSON(); +}); + + +// EXPORTS // + +module.exports = QuantitativeChart; diff --git a/lib/node_modules/@stdlib/plot/charts/base/quantitative/lib/properties.json b/lib/node_modules/@stdlib/plot/charts/base/quantitative/lib/properties.json new file mode 100644 index 000000000000..24127b1e4d26 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/charts/base/quantitative/lib/properties.json @@ -0,0 +1,5 @@ +[ + "channels", + "data", + "labels" +] diff --git a/lib/node_modules/@stdlib/plot/charts/base/quantitative/lib/x-format/get.js b/lib/node_modules/@stdlib/plot/charts/base/quantitative/lib/x-format/get.js new file mode 100644 index 000000000000..6ffa12600f41 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/charts/base/quantitative/lib/x-format/get.js @@ -0,0 +1,38 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable no-invalid-this */ + +'use strict'; + +// MAIN // + +/** +* Returns the x-axis tick format. +* +* @private +* @returns {(string|Object)} format +*/ +function get() { + return this.xAxis.format; +} + + +// EXPORTS // + +module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/charts/base/quantitative/lib/x-format/set.js b/lib/node_modules/@stdlib/plot/charts/base/quantitative/lib/x-format/set.js new file mode 100644 index 000000000000..06d9640c0b15 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/charts/base/quantitative/lib/x-format/set.js @@ -0,0 +1,40 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable no-invalid-this */ + +'use strict'; + +// MAIN // + +/** +* Sets the x-axis tick format. +* +* @private +* @param {(Object|string)} value - input value +* @throws {TypeError} must be a valid format +* @returns {void} +*/ +function set( value ) { + this.xAxis.format = value; +} + + +// EXPORTS // + +module.exports = set; diff --git a/lib/node_modules/@stdlib/plot/charts/base/quantitative/lib/x-max/get.js b/lib/node_modules/@stdlib/plot/charts/base/quantitative/lib/x-max/get.js new file mode 100644 index 000000000000..196ec618f72c --- /dev/null +++ b/lib/node_modules/@stdlib/plot/charts/base/quantitative/lib/x-max/get.js @@ -0,0 +1,38 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable no-invalid-this */ + +'use strict'; + +// MAIN // + +/** +* Returns the maximum value in the x-axis scale domain (if set). +* +* @private +* @returns {(void|number)} maximum value +*/ +function get() { + return this.xScale.domainMax; +} + + +// EXPORTS // + +module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/charts/base/quantitative/lib/x-max/set.js b/lib/node_modules/@stdlib/plot/charts/base/quantitative/lib/x-max/set.js new file mode 100644 index 000000000000..1ccd5c1e1c7c --- /dev/null +++ b/lib/node_modules/@stdlib/plot/charts/base/quantitative/lib/x-max/set.js @@ -0,0 +1,40 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable no-invalid-this */ + +'use strict'; + +// MAIN // + +/** +* Sets the maximum value in the x-axis scale domain. +* +* @private +* @param {(number|void)} value - input value +* @throws {TypeError} must be a valid value +* @returns {void} +*/ +function set( value ) { + this.xScale.domainMax = value; +} + + +// EXPORTS // + +module.exports = set; diff --git a/lib/node_modules/@stdlib/plot/charts/base/quantitative/lib/x-min/get.js b/lib/node_modules/@stdlib/plot/charts/base/quantitative/lib/x-min/get.js new file mode 100644 index 000000000000..b39ae46bbbeb --- /dev/null +++ b/lib/node_modules/@stdlib/plot/charts/base/quantitative/lib/x-min/get.js @@ -0,0 +1,38 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable no-invalid-this */ + +'use strict'; + +// MAIN // + +/** +* Returns the minimum value in the x-axis scale domain (if set). +* +* @private +* @returns {(void|number)} minimum value +*/ +function get() { + return this.xScale.domainMin; +} + + +// EXPORTS // + +module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/charts/base/quantitative/lib/x-min/set.js b/lib/node_modules/@stdlib/plot/charts/base/quantitative/lib/x-min/set.js new file mode 100644 index 000000000000..4204b2f59c26 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/charts/base/quantitative/lib/x-min/set.js @@ -0,0 +1,40 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable no-invalid-this */ + +'use strict'; + +// MAIN // + +/** +* Sets the minimum value in the x-axis scale domain. +* +* @private +* @param {(number|void)} value - input value +* @throws {TypeError} must be a valid value +* @returns {void} +*/ +function set( value ) { + this.xScale.domainMin = value; +} + + +// EXPORTS // + +module.exports = set; diff --git a/lib/node_modules/@stdlib/plot/charts/base/quantitative/lib/x-scale-type/get.js b/lib/node_modules/@stdlib/plot/charts/base/quantitative/lib/x-scale-type/get.js new file mode 100644 index 000000000000..705bf6f8e03f --- /dev/null +++ b/lib/node_modules/@stdlib/plot/charts/base/quantitative/lib/x-scale-type/get.js @@ -0,0 +1,38 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable no-invalid-this */ + +'use strict'; + +// MAIN // + +/** +* Returns the x-axis scale type. +* +* @private +* @returns {string} scale type +*/ +function get() { + return this.xScale.type; +} + + +// EXPORTS // + +module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/charts/base/quantitative/lib/x-scale-type/set.js b/lib/node_modules/@stdlib/plot/charts/base/quantitative/lib/x-scale-type/set.js new file mode 100644 index 000000000000..51fb60f24cf4 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/charts/base/quantitative/lib/x-scale-type/set.js @@ -0,0 +1,40 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable no-invalid-this */ + +'use strict'; + +// MAIN // + +/** +* Sets the x-axis scale type. +* +* @private +* @param {string} value - input value +* @throws {TypeError} must be a valid type +* @returns {void} +*/ +function set( value ) { + this.xScale.type = value; +} + + +// EXPORTS // + +module.exports = set; diff --git a/lib/node_modules/@stdlib/plot/charts/base/quantitative/lib/x-tick-count/get.js b/lib/node_modules/@stdlib/plot/charts/base/quantitative/lib/x-tick-count/get.js new file mode 100644 index 000000000000..5aa0eb066091 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/charts/base/quantitative/lib/x-tick-count/get.js @@ -0,0 +1,38 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable no-invalid-this */ + +'use strict'; + +// MAIN // + +/** +* Returns the number of desired x-axis tick marks. +* +* @private +* @returns {(string|number|Object)} number of ticks +*/ +function get() { + return this.xAxis.tickCount; +} + + +// EXPORTS // + +module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/charts/base/quantitative/lib/x-tick-count/set.js b/lib/node_modules/@stdlib/plot/charts/base/quantitative/lib/x-tick-count/set.js new file mode 100644 index 000000000000..1a2be9da17bb --- /dev/null +++ b/lib/node_modules/@stdlib/plot/charts/base/quantitative/lib/x-tick-count/set.js @@ -0,0 +1,40 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable no-invalid-this */ + +'use strict'; + +// MAIN // + +/** +* Sets the number of desired x-axis tick marks. +* +* @private +* @param {(Object|string|number)} value - input value +* @throws {TypeError} must be a valid value +* @returns {void} +*/ +function set( value ) { + this.xAxis.tickCount = value; +} + + +// EXPORTS // + +module.exports = set; diff --git a/lib/node_modules/@stdlib/plot/charts/base/quantitative/lib/x-title/get.js b/lib/node_modules/@stdlib/plot/charts/base/quantitative/lib/x-title/get.js new file mode 100644 index 000000000000..f40a97498af4 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/charts/base/quantitative/lib/x-title/get.js @@ -0,0 +1,38 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable no-invalid-this */ + +'use strict'; + +// MAIN // + +/** +* Returns the x-axis title. +* +* @private +* @returns {Array<string>} title +*/ +function get() { + return this.xAxis.title; +} + + +// EXPORTS // + +module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/charts/base/quantitative/lib/x-title/set.js b/lib/node_modules/@stdlib/plot/charts/base/quantitative/lib/x-title/set.js new file mode 100644 index 000000000000..e097a880fc19 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/charts/base/quantitative/lib/x-title/set.js @@ -0,0 +1,40 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable no-invalid-this */ + +'use strict'; + +// MAIN // + +/** +* Sets the x-axis title. +* +* @private +* @param {(string|Array<string>)} value - input value +* @throws {TypeError} must be a title +* @returns {void} +*/ +function set( value ) { + this.xAxis.title = value; +} + + +// EXPORTS // + +module.exports = set; diff --git a/lib/node_modules/@stdlib/plot/charts/base/quantitative/lib/y-format/get.js b/lib/node_modules/@stdlib/plot/charts/base/quantitative/lib/y-format/get.js new file mode 100644 index 000000000000..67e1a6d275d1 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/charts/base/quantitative/lib/y-format/get.js @@ -0,0 +1,38 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable no-invalid-this */ + +'use strict'; + +// MAIN // + +/** +* Returns the y-axis tick format. +* +* @private +* @returns {(string|Object)} format +*/ +function get() { + return this.yAxis.format; +} + + +// EXPORTS // + +module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/charts/base/quantitative/lib/y-format/set.js b/lib/node_modules/@stdlib/plot/charts/base/quantitative/lib/y-format/set.js new file mode 100644 index 000000000000..8a6dfab8512b --- /dev/null +++ b/lib/node_modules/@stdlib/plot/charts/base/quantitative/lib/y-format/set.js @@ -0,0 +1,40 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable no-invalid-this */ + +'use strict'; + +// MAIN // + +/** +* Sets the y-axis tick format. +* +* @private +* @param {(Object|string)} value - input value +* @throws {TypeError} must be a valid format +* @returns {void} +*/ +function set( value ) { + this.yAxis.format = value; +} + + +// EXPORTS // + +module.exports = set; diff --git a/lib/node_modules/@stdlib/plot/charts/base/quantitative/lib/y-max/get.js b/lib/node_modules/@stdlib/plot/charts/base/quantitative/lib/y-max/get.js new file mode 100644 index 000000000000..1dcccf427e0a --- /dev/null +++ b/lib/node_modules/@stdlib/plot/charts/base/quantitative/lib/y-max/get.js @@ -0,0 +1,38 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable no-invalid-this */ + +'use strict'; + +// MAIN // + +/** +* Returns the maximum value in the y-axis scale domain (if set). +* +* @private +* @returns {(void|number)} maximum value +*/ +function get() { + return this.yScale.domainMax; +} + + +// EXPORTS // + +module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/charts/base/quantitative/lib/y-max/set.js b/lib/node_modules/@stdlib/plot/charts/base/quantitative/lib/y-max/set.js new file mode 100644 index 000000000000..077b27cb1d83 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/charts/base/quantitative/lib/y-max/set.js @@ -0,0 +1,40 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable no-invalid-this */ + +'use strict'; + +// MAIN // + +/** +* Sets the maximum value in the y-axis scale domain. +* +* @private +* @param {(number|void)} value - input value +* @throws {TypeError} must be a valid value +* @returns {void} +*/ +function set( value ) { + this.yScale.domainMax = value; +} + + +// EXPORTS // + +module.exports = set; diff --git a/lib/node_modules/@stdlib/plot/charts/base/quantitative/lib/y-min/get.js b/lib/node_modules/@stdlib/plot/charts/base/quantitative/lib/y-min/get.js new file mode 100644 index 000000000000..84f97c756b1f --- /dev/null +++ b/lib/node_modules/@stdlib/plot/charts/base/quantitative/lib/y-min/get.js @@ -0,0 +1,38 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable no-invalid-this */ + +'use strict'; + +// MAIN // + +/** +* Returns the minimum value in the y-axis scale domain (if set). +* +* @private +* @returns {(void|number)} minimum value +*/ +function get() { + return this.yScale.domainMin; +} + + +// EXPORTS // + +module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/charts/base/quantitative/lib/y-min/set.js b/lib/node_modules/@stdlib/plot/charts/base/quantitative/lib/y-min/set.js new file mode 100644 index 000000000000..be3d924b9747 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/charts/base/quantitative/lib/y-min/set.js @@ -0,0 +1,40 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable no-invalid-this */ + +'use strict'; + +// MAIN // + +/** +* Sets the minimum value in the y-axis scale domain. +* +* @private +* @param {(number|void)} value - input value +* @throws {TypeError} must be a valid value +* @returns {void} +*/ +function set( value ) { + this.yScale.domainMin = value; +} + + +// EXPORTS // + +module.exports = set; diff --git a/lib/node_modules/@stdlib/plot/charts/base/quantitative/lib/y-scale-type/get.js b/lib/node_modules/@stdlib/plot/charts/base/quantitative/lib/y-scale-type/get.js new file mode 100644 index 000000000000..6504f69d93eb --- /dev/null +++ b/lib/node_modules/@stdlib/plot/charts/base/quantitative/lib/y-scale-type/get.js @@ -0,0 +1,38 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable no-invalid-this */ + +'use strict'; + +// MAIN // + +/** +* Returns the y-axis scale type. +* +* @private +* @returns {string} scale type +*/ +function get() { + return this.yScale.type; +} + + +// EXPORTS // + +module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/charts/base/quantitative/lib/y-scale-type/set.js b/lib/node_modules/@stdlib/plot/charts/base/quantitative/lib/y-scale-type/set.js new file mode 100644 index 000000000000..85540c7e69e7 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/charts/base/quantitative/lib/y-scale-type/set.js @@ -0,0 +1,40 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable no-invalid-this */ + +'use strict'; + +// MAIN // + +/** +* Sets the y-axis scale type. +* +* @private +* @param {string} value - input value +* @throws {TypeError} must be a valid type +* @returns {void} +*/ +function set( value ) { + this.yScale.type = value; +} + + +// EXPORTS // + +module.exports = set; diff --git a/lib/node_modules/@stdlib/plot/charts/base/quantitative/lib/y-tick-count/get.js b/lib/node_modules/@stdlib/plot/charts/base/quantitative/lib/y-tick-count/get.js new file mode 100644 index 000000000000..70fbc8727a2c --- /dev/null +++ b/lib/node_modules/@stdlib/plot/charts/base/quantitative/lib/y-tick-count/get.js @@ -0,0 +1,38 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable no-invalid-this */ + +'use strict'; + +// MAIN // + +/** +* Returns the number of desired y-axis tick marks. +* +* @private +* @returns {(string|number|Object)} number of ticks +*/ +function get() { + return this.yAxis.tickCount; +} + + +// EXPORTS // + +module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/charts/base/quantitative/lib/y-tick-count/set.js b/lib/node_modules/@stdlib/plot/charts/base/quantitative/lib/y-tick-count/set.js new file mode 100644 index 000000000000..90398a90d160 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/charts/base/quantitative/lib/y-tick-count/set.js @@ -0,0 +1,40 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable no-invalid-this */ + +'use strict'; + +// MAIN // + +/** +* Sets the number of desired y-axis tick marks. +* +* @private +* @param {(Object|string|number)} value - input value +* @throws {TypeError} must be a valid value +* @returns {void} +*/ +function set( value ) { + this.yAxis.tickCount = value; +} + + +// EXPORTS // + +module.exports = set; diff --git a/lib/node_modules/@stdlib/plot/charts/base/quantitative/lib/y-title/get.js b/lib/node_modules/@stdlib/plot/charts/base/quantitative/lib/y-title/get.js new file mode 100644 index 000000000000..a840e736c623 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/charts/base/quantitative/lib/y-title/get.js @@ -0,0 +1,38 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable no-invalid-this */ + +'use strict'; + +// MAIN // + +/** +* Returns the y-axis title. +* +* @private +* @returns {Array<string>} title +*/ +function get() { + return this.yAxis.title; +} + + +// EXPORTS // + +module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/charts/base/quantitative/lib/y-title/set.js b/lib/node_modules/@stdlib/plot/charts/base/quantitative/lib/y-title/set.js new file mode 100644 index 000000000000..f10e732caff9 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/charts/base/quantitative/lib/y-title/set.js @@ -0,0 +1,40 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable no-invalid-this */ + +'use strict'; + +// MAIN // + +/** +* Sets the y-axis title. +* +* @private +* @param {(string|Array<string>)} value - input value +* @throws {TypeError} must be a title +* @returns {void} +*/ +function set( value ) { + this.yAxis.title = value; +} + + +// EXPORTS // + +module.exports = set; diff --git a/lib/node_modules/@stdlib/plot/charts/base/quantitative/package.json b/lib/node_modules/@stdlib/plot/charts/base/quantitative/package.json new file mode 100644 index 000000000000..c036af7fe58b --- /dev/null +++ b/lib/node_modules/@stdlib/plot/charts/base/quantitative/package.json @@ -0,0 +1,66 @@ +{ + "name": "@stdlib/plot/charts/base/quantitative", + "version": "0.0.0", + "description": "Quantitative chart constructor.", + "license": "Apache-2.0", + "author": { + "name": "The Stdlib Authors", + "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" + }, + "contributors": [ + { + "name": "The Stdlib Authors", + "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" + } + ], + "main": "./lib", + "directories": { + "doc": "./docs", + "example": "./examples", + "lib": "./lib", + "test": "./test" + }, + "scripts": {}, + "homepage": "https://github.com/stdlib-js/stdlib", + "repository": { + "type": "git", + "url": "git://github.com/stdlib-js/stdlib.git" + }, + "bugs": { + "url": "https://github.com/stdlib-js/stdlib/issues" + }, + "dependencies": {}, + "devDependencies": {}, + "engines": { + "node": ">=0.10.0", + "npm": ">2.7.0" + }, + "os": [ + "aix", + "darwin", + "freebsd", + "linux", + "macos", + "openbsd", + "sunos", + "win32", + "windows" + ], + "keywords": [ + "stdlib", + "plot", + "figure", + "fig", + "graph", + "chart", + "diagram", + "data", + "visualize", + "visualization", + "dataviz", + "explore", + "exploratory", + "analysis", + "quantitative" + ] +} diff --git a/lib/node_modules/@stdlib/plot/color-schemes/category10/README.md b/lib/node_modules/@stdlib/plot/color-schemes/category10/README.md new file mode 100644 index 000000000000..7ed23967fb79 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/color-schemes/category10/README.md @@ -0,0 +1,105 @@ +<!-- + +@license Apache-2.0 + +Copyright (c) 2025 The Stdlib Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + +--> + +# category10 + +> List of 10 colors as RGB hexadecimal strings for use as a categorical scheme. + +<!-- Section to include introductory text. Make sure to keep an empty line after the intro `section` element and another before the `/section` close. --> + +<section class="intro"> + +</section> + +<!-- /.intro --> + +<!-- Package usage documentation. --> + +<section class="usage"> + +## Usage + +```javascript +var category10 = require( '@stdlib/plot/color-schemes/category10' ); +``` + +#### category10() + +Returns a list of 10 colors as RGB hexadecimal strings for use as a categorical scheme. + +```javascript +var out = category10(); +// returns [...] +``` + +</section> + +<!-- /.usage --> + +<!-- Package usage notes. Make sure to keep an empty line after the `section` element and another before the `/section` close. --> + +<section class="notes"> + +</section> + +<!-- /.notes --> + +<!-- Package usage examples. --> + +<section class="examples"> + +## Examples + +<!-- eslint no-undef: "error" --> + +```javascript +var logEach = require( '@stdlib/console/log-each' ); +var category10 = require( '@stdlib/plot/color-schemes/category10' ); + +logEach( '%s', category10() ); +``` + +</section> + +<!-- /.examples --> + +<!-- Section to include cited references. If references are included, add a horizontal rule *before* the section. Make sure to keep an empty line after the `section` element and another before the `/section` close. --> + +<section class="references"> + +</section> + +<!-- /.references --> + +<!-- Section for related `stdlib` packages. Do not manually edit this section, as it is automatically populated. --> + +<section class="related"> + +</section> + +<!-- /.related --> + +<!-- Section for all links. Make sure to keep an empty line after the `section` element and another before the `/section` close. --> + +<section class="links"> + +</section> + +<!-- /.links --> diff --git a/lib/node_modules/@stdlib/plot/color-schemes/category10/benchmark/benchmark.js b/lib/node_modules/@stdlib/plot/color-schemes/category10/benchmark/benchmark.js new file mode 100644 index 000000000000..8ee0d77948ee --- /dev/null +++ b/lib/node_modules/@stdlib/plot/color-schemes/category10/benchmark/benchmark.js @@ -0,0 +1,48 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var bench = require( '@stdlib/bench' ); +var isStringArray = require( '@stdlib/assert/is-string-array' ).primitives; +var pkg = require( './../package.json' ).name; +var category10 = require( './../lib' ); + + +// MAIN // + +bench( pkg, function benchmark( b ) { + var out; + var i; + + b.tic(); + for ( i = 0; i < b.iterations; i++ ) { + out = category10(); + if ( out.length < 2 ) { + b.fail( 'should return an array' ); + } + } + b.toc(); + if ( !isStringArray( out ) ) { + b.fail( 'should return an array of strings' ); + } + b.pass( 'benchmark finished' ); + b.end(); +}); diff --git a/lib/node_modules/@stdlib/plot/color-schemes/category10/docs/repl.txt b/lib/node_modules/@stdlib/plot/color-schemes/category10/docs/repl.txt new file mode 100644 index 000000000000..51a1be39c8c8 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/color-schemes/category10/docs/repl.txt @@ -0,0 +1,18 @@ + +{{alias}}() + Returns a list of 10 colors as RGB hexadecimal strings for use as a + categorical scheme. + + Returns + ------- + out: Array<string> + List of colors. + + Examples + -------- + > var out = {{alias}}() + [...] + + See Also + -------- + diff --git a/lib/node_modules/@stdlib/plot/color-schemes/category10/docs/types/index.d.ts b/lib/node_modules/@stdlib/plot/color-schemes/category10/docs/types/index.d.ts new file mode 100644 index 000000000000..a392fb1a2e68 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/color-schemes/category10/docs/types/index.d.ts @@ -0,0 +1,35 @@ +/* +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +// TypeScript Version: 4.1 + +/** +* Returns a list of 10 colors as RGB hexadecimal strings for use as a categorical scheme. +* +* @returns list of colors +* +* @example +* var list = category10(); +* // returns [...] +*/ +declare function category10(): Array<string>; + + +// EXPORTS // + +export = category10; diff --git a/lib/node_modules/@stdlib/plot/color-schemes/category10/docs/types/test.ts b/lib/node_modules/@stdlib/plot/color-schemes/category10/docs/types/test.ts new file mode 100644 index 000000000000..a2048aa9a3ec --- /dev/null +++ b/lib/node_modules/@stdlib/plot/color-schemes/category10/docs/types/test.ts @@ -0,0 +1,32 @@ +/* +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +import category10 = require( './index' ); + + +// TESTS // + +// The function returns an array of strings... +{ + category10(); // $ExpectType string[] +} + +// The compiler throws an error if the function is provided any arguments... +{ + category10( 9 ); // $ExpectError +} diff --git a/lib/node_modules/@stdlib/plot/color-schemes/category10/examples/index.js b/lib/node_modules/@stdlib/plot/color-schemes/category10/examples/index.js new file mode 100644 index 000000000000..2dedc6684448 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/color-schemes/category10/examples/index.js @@ -0,0 +1,24 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +var logEach = require( '@stdlib/console/log-each' ); +var category10 = require( './../lib' ); + +logEach( '%s', category10() ); diff --git a/lib/node_modules/@stdlib/plot/color-schemes/category10/lib/index.js b/lib/node_modules/@stdlib/plot/color-schemes/category10/lib/index.js new file mode 100644 index 000000000000..640658d0506c --- /dev/null +++ b/lib/node_modules/@stdlib/plot/color-schemes/category10/lib/index.js @@ -0,0 +1,40 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +/** +* List of 10 colors as RGB hexadecimal strings for use as a categorical scheme. +* +* @module @stdlib/plot/color-schemes/category10 +* +* @example +* var category10 = require( '@stdlib/plot/color-schemes/category10' ); +* +* var list = category10(); +* // returns [...] +*/ + +// MODULES // + +var main = require( './main.js' ); + + +// EXPORTS // + +module.exports = main; diff --git a/lib/node_modules/@stdlib/plot/color-schemes/category10/lib/main.js b/lib/node_modules/@stdlib/plot/color-schemes/category10/lib/main.js new file mode 100644 index 000000000000..eeca05560cd1 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/color-schemes/category10/lib/main.js @@ -0,0 +1,50 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MAIN // + +/** +* Returns a list of 10 colors as RGB hexadecimal strings for use as a categorical scheme. +* +* @returns {Array<string>} list of colors +* +* @example +* var list = category10(); +* // returns [...] +*/ +function category10() { + return [ + '#1f77b4', + '#ff7f0e', + '#2ca02c', + '#d62728', + '#9467bd', + '#8c564b', + '#e377c2', + '#7f7f7f', + '#bcdb22', + '#17becf' + ]; +} + + +// EXPORTS // + +module.exports = category10; diff --git a/lib/node_modules/@stdlib/plot/color-schemes/category10/package.json b/lib/node_modules/@stdlib/plot/color-schemes/category10/package.json new file mode 100644 index 000000000000..e4bdb4130956 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/color-schemes/category10/package.json @@ -0,0 +1,64 @@ +{ + "name": "@stdlib/plot/color-schemes/category10", + "version": "0.0.0", + "description": "List of 10 colors as RGB hexadecimal strings for use as a categorical scheme.", + "license": "Apache-2.0", + "author": { + "name": "The Stdlib Authors", + "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" + }, + "contributors": [ + { + "name": "The Stdlib Authors", + "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" + } + ], + "main": "./lib", + "directories": { + "benchmark": "./benchmark", + "doc": "./docs", + "example": "./examples", + "lib": "./lib", + "test": "./test" + }, + "types": "./docs/types", + "scripts": {}, + "homepage": "https://github.com/stdlib-js/stdlib", + "repository": { + "type": "git", + "url": "git://github.com/stdlib-js/stdlib.git" + }, + "bugs": { + "url": "https://github.com/stdlib-js/stdlib/issues" + }, + "dependencies": {}, + "devDependencies": {}, + "engines": { + "node": ">=0.10.0", + "npm": ">2.7.0" + }, + "os": [ + "aix", + "darwin", + "freebsd", + "linux", + "macos", + "openbsd", + "sunos", + "win32", + "windows" + ], + "keywords": [ + "stdlib", + "plot", + "colors", + "color-scheme", + "scheme", + "theme", + "utilities", + "utility", + "utils", + "util" + ], + "__stdlib__": {} +} diff --git a/lib/node_modules/@stdlib/plot/color-schemes/category10/test/test.js b/lib/node_modules/@stdlib/plot/color-schemes/category10/test/test.js new file mode 100644 index 000000000000..aee6e334c74d --- /dev/null +++ b/lib/node_modules/@stdlib/plot/color-schemes/category10/test/test.js @@ -0,0 +1,41 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var tape = require( 'tape' ); +var isStringArray = require( '@stdlib/assert/is-string-array' ).primitives; +var category10 = require( './../lib' ); + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof category10, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'the function returns a list of colors', function test( t ) { + var actual = category10(); + t.strictEqual( isStringArray( actual ), true, 'returns expected value' ); + t.strictEqual( actual.length, 10, 'returns expected value' ); + t.end(); +}); diff --git a/lib/node_modules/@stdlib/plot/color-schemes/category20/README.md b/lib/node_modules/@stdlib/plot/color-schemes/category20/README.md new file mode 100644 index 000000000000..dc18c2db5eca --- /dev/null +++ b/lib/node_modules/@stdlib/plot/color-schemes/category20/README.md @@ -0,0 +1,105 @@ +<!-- + +@license Apache-2.0 + +Copyright (c) 2025 The Stdlib Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + +--> + +# category20 + +> List of 20 colors as RGB hexadecimal strings for use as a categorical scheme. + +<!-- Section to include introductory text. Make sure to keep an empty line after the intro `section` element and another before the `/section` close. --> + +<section class="intro"> + +</section> + +<!-- /.intro --> + +<!-- Package usage documentation. --> + +<section class="usage"> + +## Usage + +```javascript +var category20 = require( '@stdlib/plot/color-schemes/category20' ); +``` + +#### category20() + +Returns a list of 20 colors as RGB hexadecimal strings for use as a categorical scheme. + +```javascript +var out = category20(); +// returns [...] +``` + +</section> + +<!-- /.usage --> + +<!-- Package usage notes. Make sure to keep an empty line after the `section` element and another before the `/section` close. --> + +<section class="notes"> + +</section> + +<!-- /.notes --> + +<!-- Package usage examples. --> + +<section class="examples"> + +## Examples + +<!-- eslint no-undef: "error" --> + +```javascript +var logEach = require( '@stdlib/console/log-each' ); +var category20 = require( '@stdlib/plot/color-schemes/category20' ); + +logEach( '%s', category20() ); +``` + +</section> + +<!-- /.examples --> + +<!-- Section to include cited references. If references are included, add a horizontal rule *before* the section. Make sure to keep an empty line after the `section` element and another before the `/section` close. --> + +<section class="references"> + +</section> + +<!-- /.references --> + +<!-- Section for related `stdlib` packages. Do not manually edit this section, as it is automatically populated. --> + +<section class="related"> + +</section> + +<!-- /.related --> + +<!-- Section for all links. Make sure to keep an empty line after the `section` element and another before the `/section` close. --> + +<section class="links"> + +</section> + +<!-- /.links --> diff --git a/lib/node_modules/@stdlib/plot/color-schemes/category20/benchmark/benchmark.js b/lib/node_modules/@stdlib/plot/color-schemes/category20/benchmark/benchmark.js new file mode 100644 index 000000000000..537e5e7b9f01 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/color-schemes/category20/benchmark/benchmark.js @@ -0,0 +1,48 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var bench = require( '@stdlib/bench' ); +var isStringArray = require( '@stdlib/assert/is-string-array' ).primitives; +var pkg = require( './../package.json' ).name; +var category20 = require( './../lib' ); + + +// MAIN // + +bench( pkg, function benchmark( b ) { + var out; + var i; + + b.tic(); + for ( i = 0; i < b.iterations; i++ ) { + out = category20(); + if ( out.length < 2 ) { + b.fail( 'should return an array' ); + } + } + b.toc(); + if ( !isStringArray( out ) ) { + b.fail( 'should return an array of strings' ); + } + b.pass( 'benchmark finished' ); + b.end(); +}); diff --git a/lib/node_modules/@stdlib/plot/color-schemes/category20/docs/repl.txt b/lib/node_modules/@stdlib/plot/color-schemes/category20/docs/repl.txt new file mode 100644 index 000000000000..ceb17abc41a9 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/color-schemes/category20/docs/repl.txt @@ -0,0 +1,18 @@ + +{{alias}}() + Returns a list of 20 colors as RGB hexadecimal strings for use as a + categorical scheme. + + Returns + ------- + out: Array<string> + List of colors. + + Examples + -------- + > var out = {{alias}}() + [...] + + See Also + -------- + diff --git a/lib/node_modules/@stdlib/plot/color-schemes/category20/docs/types/index.d.ts b/lib/node_modules/@stdlib/plot/color-schemes/category20/docs/types/index.d.ts new file mode 100644 index 000000000000..b5bded823f2d --- /dev/null +++ b/lib/node_modules/@stdlib/plot/color-schemes/category20/docs/types/index.d.ts @@ -0,0 +1,35 @@ +/* +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +// TypeScript Version: 4.1 + +/** +* Returns a list of 20 colors as RGB hexadecimal strings for use as a categorical scheme. +* +* @returns list of colors +* +* @example +* var list = category20(); +* // returns [...] +*/ +declare function category20(): Array<string>; + + +// EXPORTS // + +export = category20; diff --git a/lib/node_modules/@stdlib/plot/color-schemes/category20/docs/types/test.ts b/lib/node_modules/@stdlib/plot/color-schemes/category20/docs/types/test.ts new file mode 100644 index 000000000000..6ee77f96fe3b --- /dev/null +++ b/lib/node_modules/@stdlib/plot/color-schemes/category20/docs/types/test.ts @@ -0,0 +1,32 @@ +/* +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +import category20 = require( './index' ); + + +// TESTS // + +// The function returns an array of strings... +{ + category20(); // $ExpectType string[] +} + +// The compiler throws an error if the function is provided any arguments... +{ + category20( 9 ); // $ExpectError +} diff --git a/lib/node_modules/@stdlib/plot/color-schemes/category20/examples/index.js b/lib/node_modules/@stdlib/plot/color-schemes/category20/examples/index.js new file mode 100644 index 000000000000..4148897ed0da --- /dev/null +++ b/lib/node_modules/@stdlib/plot/color-schemes/category20/examples/index.js @@ -0,0 +1,24 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +var logEach = require( '@stdlib/console/log-each' ); +var category20 = require( './../lib' ); + +logEach( '%s', category20() ); diff --git a/lib/node_modules/@stdlib/plot/color-schemes/category20/lib/index.js b/lib/node_modules/@stdlib/plot/color-schemes/category20/lib/index.js new file mode 100644 index 000000000000..ce238aee8038 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/color-schemes/category20/lib/index.js @@ -0,0 +1,40 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +/** +* List of 20 colors as RGB hexadecimal strings for use as a categorical scheme. +* +* @module @stdlib/plot/color-schemes/category20 +* +* @example +* var category20 = require( '@stdlib/plot/color-schemes/category20' ); +* +* var list = category20(); +* // returns [...] +*/ + +// MODULES // + +var main = require( './main.js' ); + + +// EXPORTS // + +module.exports = main; diff --git a/lib/node_modules/@stdlib/plot/color-schemes/category20/lib/main.js b/lib/node_modules/@stdlib/plot/color-schemes/category20/lib/main.js new file mode 100644 index 000000000000..9a9c19ebaaaf --- /dev/null +++ b/lib/node_modules/@stdlib/plot/color-schemes/category20/lib/main.js @@ -0,0 +1,60 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MAIN // + +/** +* Returns a list of 20 colors as RGB hexadecimal strings for use as a categorical scheme. +* +* @returns {Array<string>} list of colors +* +* @example +* var list = category20(); +* // returns [...] +*/ +function category20() { + return [ + '#1f77b4', + '#aec7e8', + '#ff7f0e', + '#ffbb78', + '#2ca02c', + '#98df8a', + '#d62728', + '#ff9896', + '#9467bd', + '#c5b0d5', + '#8c564b', + '#c49c94', + '#e377c2', + '#f7b6d2', + '#7f7f7f', + '#c7c7c7', + '#bcbd22', + '#dbdb8d', + '#17becf', + '#9edae5' + ]; +} + + +// EXPORTS // + +module.exports = category20; diff --git a/lib/node_modules/@stdlib/plot/color-schemes/category20/package.json b/lib/node_modules/@stdlib/plot/color-schemes/category20/package.json new file mode 100644 index 000000000000..49f99c6c1c6b --- /dev/null +++ b/lib/node_modules/@stdlib/plot/color-schemes/category20/package.json @@ -0,0 +1,64 @@ +{ + "name": "@stdlib/plot/color-schemes/category20", + "version": "0.0.0", + "description": "List of 20 colors as RGB hexadecimal strings for use as a categorical scheme.", + "license": "Apache-2.0", + "author": { + "name": "The Stdlib Authors", + "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" + }, + "contributors": [ + { + "name": "The Stdlib Authors", + "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" + } + ], + "main": "./lib", + "directories": { + "benchmark": "./benchmark", + "doc": "./docs", + "example": "./examples", + "lib": "./lib", + "test": "./test" + }, + "types": "./docs/types", + "scripts": {}, + "homepage": "https://github.com/stdlib-js/stdlib", + "repository": { + "type": "git", + "url": "git://github.com/stdlib-js/stdlib.git" + }, + "bugs": { + "url": "https://github.com/stdlib-js/stdlib/issues" + }, + "dependencies": {}, + "devDependencies": {}, + "engines": { + "node": ">=0.10.0", + "npm": ">2.7.0" + }, + "os": [ + "aix", + "darwin", + "freebsd", + "linux", + "macos", + "openbsd", + "sunos", + "win32", + "windows" + ], + "keywords": [ + "stdlib", + "plot", + "colors", + "color-scheme", + "scheme", + "theme", + "utilities", + "utility", + "utils", + "util" + ], + "__stdlib__": {} +} diff --git a/lib/node_modules/@stdlib/plot/color-schemes/category20/test/test.js b/lib/node_modules/@stdlib/plot/color-schemes/category20/test/test.js new file mode 100644 index 000000000000..471fecd51252 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/color-schemes/category20/test/test.js @@ -0,0 +1,41 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var tape = require( 'tape' ); +var isStringArray = require( '@stdlib/assert/is-string-array' ).primitives; +var category20 = require( './../lib' ); + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof category20, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'the function returns a list of colors', function test( t ) { + var actual = category20(); + t.strictEqual( isStringArray( actual ), true, 'returns expected value' ); + t.strictEqual( actual.length, 20, 'returns expected value' ); + t.end(); +}); diff --git a/lib/node_modules/@stdlib/plot/color-schemes/category20b/README.md b/lib/node_modules/@stdlib/plot/color-schemes/category20b/README.md new file mode 100644 index 000000000000..2f5b2cd3505c --- /dev/null +++ b/lib/node_modules/@stdlib/plot/color-schemes/category20b/README.md @@ -0,0 +1,105 @@ +<!-- + +@license Apache-2.0 + +Copyright (c) 2025 The Stdlib Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + +--> + +# category20b + +> List of 20 colors as RGB hexadecimal strings for use as a categorical scheme. + +<!-- Section to include introductory text. Make sure to keep an empty line after the intro `section` element and another before the `/section` close. --> + +<section class="intro"> + +</section> + +<!-- /.intro --> + +<!-- Package usage documentation. --> + +<section class="usage"> + +## Usage + +```javascript +var category20b = require( '@stdlib/plot/color-schemes/category20b' ); +``` + +#### category20b() + +Returns a list of 20 colors as RGB hexadecimal strings for use as a categorical scheme. + +```javascript +var out = category20b(); +// returns [...] +``` + +</section> + +<!-- /.usage --> + +<!-- Package usage notes. Make sure to keep an empty line after the `section` element and another before the `/section` close. --> + +<section class="notes"> + +</section> + +<!-- /.notes --> + +<!-- Package usage examples. --> + +<section class="examples"> + +## Examples + +<!-- eslint no-undef: "error" --> + +```javascript +var logEach = require( '@stdlib/console/log-each' ); +var category20b = require( '@stdlib/plot/color-schemes/category20b' ); + +logEach( '%s', category20b() ); +``` + +</section> + +<!-- /.examples --> + +<!-- Section to include cited references. If references are included, add a horizontal rule *before* the section. Make sure to keep an empty line after the `section` element and another before the `/section` close. --> + +<section class="references"> + +</section> + +<!-- /.references --> + +<!-- Section for related `stdlib` packages. Do not manually edit this section, as it is automatically populated. --> + +<section class="related"> + +</section> + +<!-- /.related --> + +<!-- Section for all links. Make sure to keep an empty line after the `section` element and another before the `/section` close. --> + +<section class="links"> + +</section> + +<!-- /.links --> diff --git a/lib/node_modules/@stdlib/plot/color-schemes/category20b/benchmark/benchmark.js b/lib/node_modules/@stdlib/plot/color-schemes/category20b/benchmark/benchmark.js new file mode 100644 index 000000000000..8b6cc8d17bbe --- /dev/null +++ b/lib/node_modules/@stdlib/plot/color-schemes/category20b/benchmark/benchmark.js @@ -0,0 +1,48 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var bench = require( '@stdlib/bench' ); +var isStringArray = require( '@stdlib/assert/is-string-array' ).primitives; +var pkg = require( './../package.json' ).name; +var category20b = require( './../lib' ); + + +// MAIN // + +bench( pkg, function benchmark( b ) { + var out; + var i; + + b.tic(); + for ( i = 0; i < b.iterations; i++ ) { + out = category20b(); + if ( out.length < 2 ) { + b.fail( 'should return an array' ); + } + } + b.toc(); + if ( !isStringArray( out ) ) { + b.fail( 'should return an array of strings' ); + } + b.pass( 'benchmark finished' ); + b.end(); +}); diff --git a/lib/node_modules/@stdlib/plot/color-schemes/category20b/docs/repl.txt b/lib/node_modules/@stdlib/plot/color-schemes/category20b/docs/repl.txt new file mode 100644 index 000000000000..ceb17abc41a9 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/color-schemes/category20b/docs/repl.txt @@ -0,0 +1,18 @@ + +{{alias}}() + Returns a list of 20 colors as RGB hexadecimal strings for use as a + categorical scheme. + + Returns + ------- + out: Array<string> + List of colors. + + Examples + -------- + > var out = {{alias}}() + [...] + + See Also + -------- + diff --git a/lib/node_modules/@stdlib/plot/color-schemes/category20b/docs/types/index.d.ts b/lib/node_modules/@stdlib/plot/color-schemes/category20b/docs/types/index.d.ts new file mode 100644 index 000000000000..3257d626f73c --- /dev/null +++ b/lib/node_modules/@stdlib/plot/color-schemes/category20b/docs/types/index.d.ts @@ -0,0 +1,35 @@ +/* +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +// TypeScript Version: 4.1 + +/** +* Returns a list of 20 colors as RGB hexadecimal strings for use as a categorical scheme. +* +* @returns list of colors +* +* @example +* var list = category20b(); +* // returns [...] +*/ +declare function category20b(): Array<string>; + + +// EXPORTS // + +export = category20b; diff --git a/lib/node_modules/@stdlib/plot/color-schemes/category20b/docs/types/test.ts b/lib/node_modules/@stdlib/plot/color-schemes/category20b/docs/types/test.ts new file mode 100644 index 000000000000..d86c4579b965 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/color-schemes/category20b/docs/types/test.ts @@ -0,0 +1,32 @@ +/* +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +import category20b = require( './index' ); + + +// TESTS // + +// The function returns an array of strings... +{ + category20b(); // $ExpectType string[] +} + +// The compiler throws an error if the function is provided any arguments... +{ + category20b( 9 ); // $ExpectError +} diff --git a/lib/node_modules/@stdlib/plot/color-schemes/category20b/examples/index.js b/lib/node_modules/@stdlib/plot/color-schemes/category20b/examples/index.js new file mode 100644 index 000000000000..e4ffc2759075 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/color-schemes/category20b/examples/index.js @@ -0,0 +1,24 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +var logEach = require( '@stdlib/console/log-each' ); +var category20b = require( './../lib' ); + +logEach( '%s', category20b() ); diff --git a/lib/node_modules/@stdlib/plot/color-schemes/category20b/lib/index.js b/lib/node_modules/@stdlib/plot/color-schemes/category20b/lib/index.js new file mode 100644 index 000000000000..ff1a920c20a4 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/color-schemes/category20b/lib/index.js @@ -0,0 +1,40 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +/** +* List of 20 colors as RGB hexadecimal strings for use as a categorical scheme. +* +* @module @stdlib/plot/color-schemes/category20b +* +* @example +* var category20b = require( '@stdlib/plot/color-schemes/category20b' ); +* +* var list = category20b(); +* // returns [...] +*/ + +// MODULES // + +var main = require( './main.js' ); + + +// EXPORTS // + +module.exports = main; diff --git a/lib/node_modules/@stdlib/plot/color-schemes/category20b/lib/main.js b/lib/node_modules/@stdlib/plot/color-schemes/category20b/lib/main.js new file mode 100644 index 000000000000..95432b3d10a3 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/color-schemes/category20b/lib/main.js @@ -0,0 +1,60 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MAIN // + +/** +* Returns a list of 20 colors as RGB hexadecimal strings for use as a categorical scheme. +* +* @returns {Array<string>} list of colors +* +* @example +* var list = category20b(); +* // returns [...] +*/ +function category20b() { + return [ + '#393b79', + '#5254a3', + '#6b6ecf', + '#9c9ede', + '#637939', + '#8ca252', + '#b5cf6b', + '#cedb9c', + '#8c6d31', + '#bd9e39', + '#e7ba52', + '#e7cb94', + '#843c39', + '#ad494a', + '#d6616b', + '#e7969c', + '#7b4173', + '#a55194', + '#ce6dbd', + '#de9ed6' + ]; +} + + +// EXPORTS // + +module.exports = category20b; diff --git a/lib/node_modules/@stdlib/plot/color-schemes/category20b/package.json b/lib/node_modules/@stdlib/plot/color-schemes/category20b/package.json new file mode 100644 index 000000000000..f276a377d983 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/color-schemes/category20b/package.json @@ -0,0 +1,64 @@ +{ + "name": "@stdlib/plot/color-schemes/category20b", + "version": "0.0.0", + "description": "List of 20 colors as RGB hexadecimal strings for use as a categorical scheme.", + "license": "Apache-2.0", + "author": { + "name": "The Stdlib Authors", + "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" + }, + "contributors": [ + { + "name": "The Stdlib Authors", + "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" + } + ], + "main": "./lib", + "directories": { + "benchmark": "./benchmark", + "doc": "./docs", + "example": "./examples", + "lib": "./lib", + "test": "./test" + }, + "types": "./docs/types", + "scripts": {}, + "homepage": "https://github.com/stdlib-js/stdlib", + "repository": { + "type": "git", + "url": "git://github.com/stdlib-js/stdlib.git" + }, + "bugs": { + "url": "https://github.com/stdlib-js/stdlib/issues" + }, + "dependencies": {}, + "devDependencies": {}, + "engines": { + "node": ">=0.10.0", + "npm": ">2.7.0" + }, + "os": [ + "aix", + "darwin", + "freebsd", + "linux", + "macos", + "openbsd", + "sunos", + "win32", + "windows" + ], + "keywords": [ + "stdlib", + "plot", + "colors", + "color-scheme", + "scheme", + "theme", + "utilities", + "utility", + "utils", + "util" + ], + "__stdlib__": {} +} diff --git a/lib/node_modules/@stdlib/plot/color-schemes/category20b/test/test.js b/lib/node_modules/@stdlib/plot/color-schemes/category20b/test/test.js new file mode 100644 index 000000000000..a9e2016f71aa --- /dev/null +++ b/lib/node_modules/@stdlib/plot/color-schemes/category20b/test/test.js @@ -0,0 +1,41 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var tape = require( 'tape' ); +var isStringArray = require( '@stdlib/assert/is-string-array' ).primitives; +var category20b = require( './../lib' ); + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof category20b, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'the function returns a list of colors', function test( t ) { + var actual = category20b(); + t.strictEqual( isStringArray( actual ), true, 'returns expected value' ); + t.strictEqual( actual.length, 20, 'returns expected value' ); + t.end(); +}); diff --git a/lib/node_modules/@stdlib/plot/color-schemes/category20c/README.md b/lib/node_modules/@stdlib/plot/color-schemes/category20c/README.md new file mode 100644 index 000000000000..823a1e1d47d5 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/color-schemes/category20c/README.md @@ -0,0 +1,105 @@ +<!-- + +@license Apache-2.0 + +Copyright (c) 2025 The Stdlib Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + +--> + +# category20c + +> List of 20 colors as RGB hexadecimal strings for use as a categorical scheme. + +<!-- Section to include introductory text. Make sure to keep an empty line after the intro `section` element and another before the `/section` close. --> + +<section class="intro"> + +</section> + +<!-- /.intro --> + +<!-- Package usage documentation. --> + +<section class="usage"> + +## Usage + +```javascript +var category20c = require( '@stdlib/plot/color-schemes/category20c' ); +``` + +#### category20c() + +Returns a list of 20 colors as RGB hexadecimal strings for use as a categorical scheme. + +```javascript +var out = category20c(); +// returns [...] +``` + +</section> + +<!-- /.usage --> + +<!-- Package usage notes. Make sure to keep an empty line after the `section` element and another before the `/section` close. --> + +<section class="notes"> + +</section> + +<!-- /.notes --> + +<!-- Package usage examples. --> + +<section class="examples"> + +## Examples + +<!-- eslint no-undef: "error" --> + +```javascript +var logEach = require( '@stdlib/console/log-each' ); +var category20c = require( '@stdlib/plot/color-schemes/category20c' ); + +logEach( '%s', category20c() ); +``` + +</section> + +<!-- /.examples --> + +<!-- Section to include cited references. If references are included, add a horizontal rule *before* the section. Make sure to keep an empty line after the `section` element and another before the `/section` close. --> + +<section class="references"> + +</section> + +<!-- /.references --> + +<!-- Section for related `stdlib` packages. Do not manually edit this section, as it is automatically populated. --> + +<section class="related"> + +</section> + +<!-- /.related --> + +<!-- Section for all links. Make sure to keep an empty line after the `section` element and another before the `/section` close. --> + +<section class="links"> + +</section> + +<!-- /.links --> diff --git a/lib/node_modules/@stdlib/plot/color-schemes/category20c/benchmark/benchmark.js b/lib/node_modules/@stdlib/plot/color-schemes/category20c/benchmark/benchmark.js new file mode 100644 index 000000000000..9a1b24f51798 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/color-schemes/category20c/benchmark/benchmark.js @@ -0,0 +1,48 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var bench = require( '@stdlib/bench' ); +var isStringArray = require( '@stdlib/assert/is-string-array' ).primitives; +var pkg = require( './../package.json' ).name; +var category20c = require( './../lib' ); + + +// MAIN // + +bench( pkg, function benchmark( b ) { + var out; + var i; + + b.tic(); + for ( i = 0; i < b.iterations; i++ ) { + out = category20c(); + if ( out.length < 2 ) { + b.fail( 'should return an array' ); + } + } + b.toc(); + if ( !isStringArray( out ) ) { + b.fail( 'should return an array of strings' ); + } + b.pass( 'benchmark finished' ); + b.end(); +}); diff --git a/lib/node_modules/@stdlib/plot/color-schemes/category20c/docs/repl.txt b/lib/node_modules/@stdlib/plot/color-schemes/category20c/docs/repl.txt new file mode 100644 index 000000000000..ceb17abc41a9 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/color-schemes/category20c/docs/repl.txt @@ -0,0 +1,18 @@ + +{{alias}}() + Returns a list of 20 colors as RGB hexadecimal strings for use as a + categorical scheme. + + Returns + ------- + out: Array<string> + List of colors. + + Examples + -------- + > var out = {{alias}}() + [...] + + See Also + -------- + diff --git a/lib/node_modules/@stdlib/plot/color-schemes/category20c/docs/types/index.d.ts b/lib/node_modules/@stdlib/plot/color-schemes/category20c/docs/types/index.d.ts new file mode 100644 index 000000000000..3779372bbe40 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/color-schemes/category20c/docs/types/index.d.ts @@ -0,0 +1,35 @@ +/* +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +// TypeScript Version: 4.1 + +/** +* Returns a list of 20 colors as RGB hexadecimal strings for use as a categorical scheme. +* +* @returns list of colors +* +* @example +* var list = category20c(); +* // returns [...] +*/ +declare function category20c(): Array<string>; + + +// EXPORTS // + +export = category20c; diff --git a/lib/node_modules/@stdlib/plot/color-schemes/category20c/docs/types/test.ts b/lib/node_modules/@stdlib/plot/color-schemes/category20c/docs/types/test.ts new file mode 100644 index 000000000000..4d8ecf6012b3 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/color-schemes/category20c/docs/types/test.ts @@ -0,0 +1,32 @@ +/* +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +import category20c = require( './index' ); + + +// TESTS // + +// The function returns an array of strings... +{ + category20c(); // $ExpectType string[] +} + +// The compiler throws an error if the function is provided any arguments... +{ + category20c( 9 ); // $ExpectError +} diff --git a/lib/node_modules/@stdlib/plot/color-schemes/category20c/examples/index.js b/lib/node_modules/@stdlib/plot/color-schemes/category20c/examples/index.js new file mode 100644 index 000000000000..a955f0a06ef5 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/color-schemes/category20c/examples/index.js @@ -0,0 +1,24 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +var logEach = require( '@stdlib/console/log-each' ); +var category20c = require( './../lib' ); + +logEach( '%s', category20c() ); diff --git a/lib/node_modules/@stdlib/plot/color-schemes/category20c/lib/index.js b/lib/node_modules/@stdlib/plot/color-schemes/category20c/lib/index.js new file mode 100644 index 000000000000..6268b6624557 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/color-schemes/category20c/lib/index.js @@ -0,0 +1,40 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +/** +* List of 20 colors as RGB hexadecimal strings for use as a categorical scheme. +* +* @module @stdlib/plot/color-schemes/category20c +* +* @example +* var category20c = require( '@stdlib/plot/color-schemes/category20c' ); +* +* var list = category20c(); +* // returns [...] +*/ + +// MODULES // + +var main = require( './main.js' ); + + +// EXPORTS // + +module.exports = main; diff --git a/lib/node_modules/@stdlib/plot/color-schemes/category20c/lib/main.js b/lib/node_modules/@stdlib/plot/color-schemes/category20c/lib/main.js new file mode 100644 index 000000000000..549ad56b9272 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/color-schemes/category20c/lib/main.js @@ -0,0 +1,60 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MAIN // + +/** +* Returns a list of 20 colors as RGB hexadecimal strings for use as a categorical scheme. +* +* @returns {Array<string>} list of colors +* +* @example +* var list = category20c(); +* // returns [...] +*/ +function category20c() { + return [ + '#3182bd', + '#6baed6', + '#9ecae1', + '#c6dbef', + '#e6550d', + '#fd8d3c', + '#fdae6b', + '#fdd0a2', + '#31a354', + '#74c476', + '#a1d99b', + '#c7e9c0', + '#756bb1', + '#9e9ac8', + '#bcbddc', + '#dadaeb', + '#636363', + '#969696', + '#bdbdbd', + '#d9d9d9' + ]; +} + + +// EXPORTS // + +module.exports = category20c; diff --git a/lib/node_modules/@stdlib/plot/color-schemes/category20c/package.json b/lib/node_modules/@stdlib/plot/color-schemes/category20c/package.json new file mode 100644 index 000000000000..2021ddf34f8e --- /dev/null +++ b/lib/node_modules/@stdlib/plot/color-schemes/category20c/package.json @@ -0,0 +1,64 @@ +{ + "name": "@stdlib/plot/color-schemes/category20c", + "version": "0.0.0", + "description": "List of 20 colors as RGB hexadecimal strings for use as a categorical scheme.", + "license": "Apache-2.0", + "author": { + "name": "The Stdlib Authors", + "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" + }, + "contributors": [ + { + "name": "The Stdlib Authors", + "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" + } + ], + "main": "./lib", + "directories": { + "benchmark": "./benchmark", + "doc": "./docs", + "example": "./examples", + "lib": "./lib", + "test": "./test" + }, + "types": "./docs/types", + "scripts": {}, + "homepage": "https://github.com/stdlib-js/stdlib", + "repository": { + "type": "git", + "url": "git://github.com/stdlib-js/stdlib.git" + }, + "bugs": { + "url": "https://github.com/stdlib-js/stdlib/issues" + }, + "dependencies": {}, + "devDependencies": {}, + "engines": { + "node": ">=0.10.0", + "npm": ">2.7.0" + }, + "os": [ + "aix", + "darwin", + "freebsd", + "linux", + "macos", + "openbsd", + "sunos", + "win32", + "windows" + ], + "keywords": [ + "stdlib", + "plot", + "colors", + "color-scheme", + "scheme", + "theme", + "utilities", + "utility", + "utils", + "util" + ], + "__stdlib__": {} +} diff --git a/lib/node_modules/@stdlib/plot/color-schemes/category20c/test/test.js b/lib/node_modules/@stdlib/plot/color-schemes/category20c/test/test.js new file mode 100644 index 000000000000..0bdcc78c5c00 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/color-schemes/category20c/test/test.js @@ -0,0 +1,41 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var tape = require( 'tape' ); +var isStringArray = require( '@stdlib/assert/is-string-array' ).primitives; +var category20c = require( './../lib' ); + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof category20c, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'the function returns a list of colors', function test( t ) { + var actual = category20c(); + t.strictEqual( isStringArray( actual ), true, 'returns expected value' ); + t.strictEqual( actual.length, 20, 'returns expected value' ); + t.end(); +}); diff --git a/lib/node_modules/@stdlib/plot/components/svg/annotations/README.md b/lib/node_modules/@stdlib/plot/components/svg/annotations/README.md deleted file mode 100644 index 5db95da6c16a..000000000000 --- a/lib/node_modules/@stdlib/plot/components/svg/annotations/README.md +++ /dev/null @@ -1,198 +0,0 @@ -<!-- - -@license Apache-2.0 - -Copyright (c) 2018 The Stdlib Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. - ---> - -# Annotations - -> [SVG][svg] plot annotations. - -<!-- Section to include introductory text. Make sure to keep an empty line after the intro `section` element and another before the `/section` close. --> - -<section class="intro"> - -</section> - -<!-- /.intro --> - -<!-- Package usage documentation. --> - -<section class="usage"> - -## Usage - -```javascript -var Annotations = require( '@stdlib/plot/components/svg/annotations' ); -``` - -#### Annotations() - -Returns an `Annotations` instance. - -```javascript -var node = new Annotations(); -// returns <Annotations> -``` - -* * * - -### Methods - -<a name="method-render"></a> - -#### Annotations.prototype.render() - -Renders an instance as a [Virtual DOM tree][virtual-dom]. - -```javascript -var node = new Annotations(); - -var vtree = node.render(); -/* e.g., returns - { - 'tagName': 'g', - 'properties': { - 'property': 'annotations', - 'className': 'annotations', - 'attributes': { - 'transform': 'translate(0,0)' - }, - 'namespace': void 0 - }, - 'children': [], - 'namespace': 'http://www.w3.org/2000/svg', - 'count': 0, - 'hasWidgets': false, - 'hasThunks': false, - 'descendantHooks': false, - 'hooks': void 0, - 'key': void 0 - } -*/ -``` - -* * * - -### Events - -<a name='event-render'></a> - -#### 'render' - -Event emitted when an instance renders. The event object is the rendered [Virtual DOM tree][virtual-dom]. - -```javascript -var node = new Annotations(); - -function onRender( vtree ) { - console.log( vtree ); -} - -node.on( 'render', onRender ); -node.render(); -``` - -* * * - -### Listeners - -<a name='listener-change'></a> - -#### 'change' - -Upon receiving a `'change'` event, an instance re-renders. - -```javascript -var node = new Annotations(); - -function onRender( vtree ) { - console.log( vtree ); -} - -node.on( 'render', onRender ); -node.emit( 'change' ); -``` - -</section> - -<!-- /.usage --> - -<!-- Package usage notes. Make sure to keep an empty line after the `section` element and another before the `/section` close. --> - -<section class="notes"> - -</section> - -<!-- /.notes --> - -<!-- Package usage examples. --> - -* * * - -<section class="examples"> - -## Examples - -<!-- eslint no-undef: "error" --> - -```javascript -var toHTML = require( 'vdom-to-html' ); -var annotations = require( '@stdlib/plot/components/svg/annotations' ); - -// Create a new component: -var node = annotations(); - -// Render as a virtual DOM tree: -var vtree = node.render(); - -// Transform the virtual DOM tree to HTML: -var html = toHTML( vtree ); -// returns <g property="annotations" class="annotations" transform="translate(0,0)"></g> -``` - -</section> - -<!-- /.examples --> - -<!-- Section to include cited references. If references are included, add a horizontal rule *before* the section. Make sure to keep an empty line after the `section` element and another before the `/section` close. --> - -<section class="references"> - -</section> - -<!-- /.references --> - -<!-- Section for related `stdlib` packages. Do not manually edit this section, as it is automatically populated. --> - -<section class="related"> - -</section> - -<!-- /.related --> - -<!-- Section for all links. Make sure to keep an empty line after the `section` element and another before the `/section` close. --> - -<section class="links"> - -[svg]: https://www.w3.org/Graphics/SVG/ - -[virtual-dom]: https://github.com/Matt-Esch/virtual-dom - -</section> - -<!-- /.links --> diff --git a/lib/node_modules/@stdlib/plot/components/svg/annotations/benchmark/benchmark.js b/lib/node_modules/@stdlib/plot/components/svg/annotations/benchmark/benchmark.js deleted file mode 100644 index e8b4073f7e7a..000000000000 --- a/lib/node_modules/@stdlib/plot/components/svg/annotations/benchmark/benchmark.js +++ /dev/null @@ -1,90 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench' ); -var pkg = require( './../package.json' ).name; -var Annotations = require( './../lib' ); - - -// MAIN // - -bench( pkg+'::instantiation', function benchmark( b ) { - var node; - var i; - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - node = new Annotations(); - if ( !( node instanceof Annotations ) ) { - b.fail( 'should return an instance' ); - } - } - b.toc(); - if ( !( node instanceof Annotations ) ) { - b.fail( 'should return an instance' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::instantiation,no_new', function benchmark( b ) { - var ctor; - var node; - var i; - - ctor = Annotations; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - node = ctor(); - if ( !( node instanceof Annotations ) ) { - b.fail( 'should return an instance' ); - } - } - b.toc(); - if ( !( node instanceof Annotations ) ) { - b.fail( 'should return an instance' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+':render', function benchmark( b ) { - var vtree; - var node; - var i; - - node = new Annotations(); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - vtree = node.render(); - if ( typeof vtree !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( typeof vtree !== 'object' ) { - b.fail( 'should return an object' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/lib/node_modules/@stdlib/plot/components/svg/annotations/examples/index.js b/lib/node_modules/@stdlib/plot/components/svg/annotations/examples/index.js deleted file mode 100644 index 743fb8eb7642..000000000000 --- a/lib/node_modules/@stdlib/plot/components/svg/annotations/examples/index.js +++ /dev/null @@ -1,34 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -var toHTML = require( 'vdom-to-html' ); -var annotations = require( './../lib' ); - -// Create a new component: -var node = annotations(); - -// Render as a virtual DOM tree: -var vtree = node.render(); -console.log( JSON.stringify( vtree ) ); - -// Transform the virtual DOM tree to HTML: -var html = toHTML( vtree ); -console.log( html ); -// => <g property="annotations" class="annotations" transform="translate(0,0)"></g> diff --git a/lib/node_modules/@stdlib/plot/components/svg/annotations/lib/index.js b/lib/node_modules/@stdlib/plot/components/svg/annotations/lib/index.js deleted file mode 100644 index b2d44c26eed8..000000000000 --- a/lib/node_modules/@stdlib/plot/components/svg/annotations/lib/index.js +++ /dev/null @@ -1,39 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -/** -* SVG plot annotations. -* -* @module @stdlib/plot/components/svg/annotations -* -* @example -* var Annotations = require( '@stdlib/plot/components/svg/annotations' ); -* -* var node = new Annotations(); -*/ - -// MODULES // - -var main = require( './main.js' ); - - -// EXPORTS // - -module.exports = main; diff --git a/lib/node_modules/@stdlib/plot/components/svg/annotations/lib/main.js b/lib/node_modules/@stdlib/plot/components/svg/annotations/lib/main.js deleted file mode 100644 index d7f5ea9b4b35..000000000000 --- a/lib/node_modules/@stdlib/plot/components/svg/annotations/lib/main.js +++ /dev/null @@ -1,111 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var EventEmitter = require( 'events' ).EventEmitter; -var logger = require( 'debug' ); -var setReadOnly = require( '@stdlib/utils/define-nonenumerable-read-only-property' ); -var inherit = require( '@stdlib/utils/inherit' ); -var instanceOf = require( '@stdlib/assert/instance-of' ); -var render = require( './render.js' ); - - -// VARIABLES // - -var debug = logger( 'annotations:main' ); - - -// MAIN // - -/** -* Annotations constructor. -* -* @constructor -* @returns {Annotations} annotations instance -* -* @example -* var node = new Annotations(); -*/ -function Annotations() { - var self; - if ( !instanceOf( this, Annotations ) ) { - return new Annotations(); - } - self = this; - debug( 'Creating an instance...' ); - EventEmitter.call( this ); - this.on( 'change', onChange ); - this.on( '_render', onRender ); - return this; - - /** - * Callback invoked upon receiving a change event. - * - * @private - */ - function onChange() { - debug( 'Received a change event.' ); - self.render(); - } - - /** - * Re-emits a render event. - * - * @private - */ - function onRender() { - var args; - var i; - debug( 'Received a render event. Re-emitting...' ); - args = new Array( arguments.length+1 ); - args[ 0 ] = 'render'; - for ( i = 0; i < arguments.length; i++ ) { - args[ i+1 ] = arguments[ i ]; - } - self.emit.apply( self, args ); - } -} - -/* -* Inherit from the `EventEmitter` prototype. -*/ -inherit( Annotations, EventEmitter ); - -/** -* Renders a virtual DOM tree. -* -* @name render -* @memberof Annotations.prototype -* @type {Function} -* @returns {VTree} virtual tree -* -* @example -* var node = new Annotations(); -* -* var vtree = node.render(); -* // returns <Object> -*/ -setReadOnly( Annotations.prototype, 'render', render ); - - -// EXPORTS // - -module.exports = Annotations; diff --git a/lib/node_modules/@stdlib/plot/components/svg/annotations/lib/render.js b/lib/node_modules/@stdlib/plot/components/svg/annotations/lib/render.js deleted file mode 100644 index 80fd83069e13..000000000000 --- a/lib/node_modules/@stdlib/plot/components/svg/annotations/lib/render.js +++ /dev/null @@ -1,69 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); -var h = require( 'virtual-dom/h.js' ); - - -// VARIABLES // - -var debug = logger( 'annotations:render' ); -var ELEMENT = 'g'; - - -// MAIN // - -/** -* Renders a virtual DOM tree. -* -* @private -* @returns {VTree} virtual tree -*/ -function render() { - /* eslint-disable no-invalid-this */ - var vtree; - var props; - - debug( 'Rendering...' ); - - props = { - 'namespace': 'http://www.w3.org/2000/svg', - 'property': 'annotations', - 'className': 'annotations', - 'attributes': { - 'transform': 'translate(0,0)' - } - }; - - debug( 'Generating a virtual DOM tree (%s) with properties: %s.', ELEMENT, JSON.stringify( props ) ); - vtree = h( ELEMENT, props, [] ); - - // Announce that a new tree has been rendered: - this.emit( '_render', vtree ); - - return vtree; -} - - -// EXPORTS // - -module.exports = render; diff --git a/lib/node_modules/@stdlib/plot/components/svg/annotations/package.json b/lib/node_modules/@stdlib/plot/components/svg/annotations/package.json deleted file mode 100644 index 96f6cacf2d3e..000000000000 --- a/lib/node_modules/@stdlib/plot/components/svg/annotations/package.json +++ /dev/null @@ -1,67 +0,0 @@ -{ - "name": "@stdlib/plot/components/svg/annotations", - "version": "0.0.0", - "description": "SVG plot annotations.", - "license": "Apache-2.0", - "author": { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - }, - "contributors": [ - { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - } - ], - "main": "./lib", - "directories": { - "benchmark": "./benchmark", - "example": "./examples", - "lib": "./lib", - "test": "./test" - }, - "scripts": {}, - "homepage": "https://github.com/stdlib-js/stdlib", - "repository": { - "type": "git", - "url": "git://github.com/stdlib-js/stdlib.git" - }, - "bugs": { - "url": "https://github.com/stdlib-js/stdlib/issues" - }, - "dependencies": {}, - "devDependencies": {}, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], - "keywords": [ - "stdlib", - "plot", - "graph", - "chart", - "engine", - "svg", - "scalable", - "vector", - "graphics", - "annotations", - "annotate", - "component", - "virtual", - "dom", - "vdom", - "virtual-dom" - ] -} diff --git a/lib/node_modules/@stdlib/plot/components/svg/annotations/test/fixtures/vtree.js b/lib/node_modules/@stdlib/plot/components/svg/annotations/test/fixtures/vtree.js deleted file mode 100644 index 1d704f0dead3..000000000000 --- a/lib/node_modules/@stdlib/plot/components/svg/annotations/test/fixtures/vtree.js +++ /dev/null @@ -1,46 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MAIN // - -var vtree = { - 'tagName': 'g', - 'properties': { - 'property': 'annotations', - 'className': 'annotations', - 'attributes': { - 'transform': 'translate(0,0)' - }, - 'namespace': void 0 - }, - 'children': [], - 'namespace': 'http://www.w3.org/2000/svg', - 'count': 0, - 'hasWidgets': false, - 'hasThunks': false, - 'descendantHooks': false, - 'hooks': void 0, - 'key': void 0 -}; - - -// EXPORTS // - -module.exports = vtree; diff --git a/lib/node_modules/@stdlib/plot/components/svg/annotations/test/test.js b/lib/node_modules/@stdlib/plot/components/svg/annotations/test/test.js deleted file mode 100644 index 97c0696e726f..000000000000 --- a/lib/node_modules/@stdlib/plot/components/svg/annotations/test/test.js +++ /dev/null @@ -1,86 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var EventEmitter = require( 'events' ).EventEmitter; -var tape = require( 'tape' ); -var instanceOf = require( '@stdlib/assert/instance-of' ); -var Annotations = require( './../lib' ); - - -// FIXTURES // - -var VTREE = require( './fixtures/vtree.js' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof Annotations, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function is a constructor', function test( t ) { - var node = new Annotations(); - t.strictEqual( instanceOf( node, Annotations ), true, 'is an instance' ); - t.end(); -}); - -tape( 'the constructor does not require the `new` operator', function test( t ) { - var ctor; - var node; - - ctor = Annotations; - node = ctor(); - - t.strictEqual( instanceOf( node, Annotations ), true, 'is an instance' ); - t.end(); -}); - -tape( 'the constructor returns an event emitter', function test( t ) { - var node = new Annotations(); - t.strictEqual( instanceOf( node, EventEmitter ), true, 'is an event emitter' ); - t.end(); -}); - -tape( 'when a returned instance receives a `change` event, it re-renders and emits a `render` event', function test( t ) { - var node = new Annotations(); - node.on( 'render', onRender ); - node.emit( 'change' ); - - function onRender( obj ) { - t.ok( true, 'emits a render event' ); - t.deepEqual( obj, VTREE, 'provides virtual tree' ); - t.end(); - } -}); - -tape( 'the `render` method returns a rendered virtual tree', function test( t ) { - var vtree; - var node; - - node = new Annotations(); - vtree = node.render(); - - t.deepEqual( vtree, VTREE, 'returns a virtual tree' ); - t.end(); -}); diff --git a/lib/node_modules/@stdlib/plot/components/svg/axis/examples/index.js b/lib/node_modules/@stdlib/plot/components/svg/axis/examples/index.js deleted file mode 100644 index 8d063c6e6559..000000000000 --- a/lib/node_modules/@stdlib/plot/components/svg/axis/examples/index.js +++ /dev/null @@ -1,55 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -var toHTML = require( 'vdom-to-html' ); -var linear = require( 'd3-scale' ).scaleLinear; // TODO: remove -var createAxis = require( './../lib' ); - -// Create a function to map data values to pixel values: -var scale = linear(); -scale.domain( [0, 1] ).range( [0, 100] ); - -// Create a new axis: -var axis = createAxis({ - 'scale': scale, - 'orientation': 'bottom', - 'autoRender': true -}); - -// Render as a virtual DOM tree: -var vtree = axis.render(); -console.log( JSON.stringify( vtree ) ); - -// Transform the virtual DOM tree to HTML: -var html = toHTML( vtree ); -console.log( html ); - -// Listen for 'render' events (e.g., when triggered due to changes in state): -axis.on( 'render', onRender ); - -setTimeout( update, 1000 ); - -function update() { - axis.tickSize = 12; -} - -function onRender( vtree ) { - console.log( toHTML( vtree ) ); -} diff --git a/lib/node_modules/@stdlib/plot/components/svg/axis/lib/components/domain.js b/lib/node_modules/@stdlib/plot/components/svg/axis/lib/components/domain.js deleted file mode 100644 index 779535170836..000000000000 --- a/lib/node_modules/@stdlib/plot/components/svg/axis/lib/components/domain.js +++ /dev/null @@ -1,103 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -/* -* For manually constructing SVG paths, see [MDN]{@link https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/d} -*/ - -// MODULES // - -var logger = require( 'debug' ); -var h = require( 'virtual-dom/h.js' ); - - -// VARIABLES // - -var debug = logger( 'axis:components:domain' ); -var ELEMENT = 'path'; - - -// MAIN // - -/** -* Renders an axis domain. -* -* @private -* @param {Object} ctx - context -* @returns {VTree} virtual tree -*/ -function render( ctx ) { - /* eslint-disable no-underscore-dangle */ - var orient; - var stroke; - var range0; - var range1; - var offset; - var range; - var props; - var d; - - orient = ctx._orientation; - debug( 'Axis orientation: %s.', orient ); - - range = ctx._scale.range(); - debug( 'Axis range: %s.', JSON.stringify( range ) ); - - range0 = range[ 0 ] + 0.5; - range1 = range[ range.length-1 ] + 0.5; - - offset = ctx.tickDir * ctx._outerTickSize; - d = ''; - if ( orient === 'left' || orient === 'right' ) { - d += 'M' + offset + ',' + range0; - d += 'H0.5'; - d += 'V' + range1; - d += 'H' + offset; - - stroke = 'none'; - } else { - d += 'M' + range0 + ',' + offset; - d += 'V0.5'; - d += 'H' + range1; - d += 'V' + offset; - - stroke = '#aaa'; - } - props = { - 'namespace': 'http://www.w3.org/2000/svg', - 'property': 'axis.domain', - 'className': 'domain', - 'attributes': { - 'fill': 'none', - 'stroke': stroke, - 'stroke-width': 1, - 'd': d - } - }; - - debug( 'Generating a virtual DOM tree (%s) with properties: %s.', ELEMENT, JSON.stringify( props ) ); - - return h( ELEMENT, props, [] ); -} - - -// EXPORTS // - -module.exports = render; diff --git a/lib/node_modules/@stdlib/plot/components/svg/axis/lib/components/index.js b/lib/node_modules/@stdlib/plot/components/svg/axis/lib/components/index.js deleted file mode 100644 index 81c8273cbc3e..000000000000 --- a/lib/node_modules/@stdlib/plot/components/svg/axis/lib/components/index.js +++ /dev/null @@ -1,79 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); -var h = require( 'virtual-dom/h.js' ); -var textAnchor = require( './../utils/text_anchor.js' ); -var domain = require( './domain.js' ); -var ticks = require( './ticks.js' ); -var label = require( './label.js' ); - - -// VARIABLES // - -var debug = logger( 'axis:components:main' ); -var ELEMENT = 'g'; - - -// MAIN // - -/** -* Renders an axis. -* -* @private -* @param {Object} ctx - context -* @returns {VTree} virtual tree -*/ -function render( ctx ) { - var children; - var props; - - props = { - 'namespace': 'http://www.w3.org/2000/svg', - 'property': 'axis', - 'className': 'axis', - 'attributes': { - 'fill': 'none', - 'font-size': 10, // TODO: option - 'font-family': 'sans-serif', // TODO: option - 'text-anchor': textAnchor( ctx._orientation ) // eslint-disable-line no-underscore-dangle - } - }; - - debug( 'Rendering tick marks...' ); - children = ticks( ctx ); - - debug( 'Rendering domain line...' ); - children.unshift( domain( ctx ) ); - - debug( 'Rendering label...' ); - children.push( label( ctx ) ); - - debug( 'Generating a virtual DOM tree (%s) with properties: %s.', ELEMENT, JSON.stringify( props ) ); - - return h( ELEMENT, props, children ); -} - - -// EXPORTS // - -module.exports = render; diff --git a/lib/node_modules/@stdlib/plot/components/svg/axis/lib/components/label.js b/lib/node_modules/@stdlib/plot/components/svg/axis/lib/components/label.js deleted file mode 100644 index 035be045701e..000000000000 --- a/lib/node_modules/@stdlib/plot/components/svg/axis/lib/components/label.js +++ /dev/null @@ -1,77 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); -var h = require( 'virtual-dom/h.js' ); -var labelTransform = require( './../utils/label_transform.js' ); -var labelXPos = require( './../utils/label_x_pos.js' ); -var labelYPos = require( './../utils/label_y_pos.js' ); - - -// VARIABLES // - -var debug = logger( 'axis:components:label' ); -var ELEMENT = 'text'; - - -// MAIN // - -/** -* Renders an axis label. -* -* @private -* @param {Object} ctx - context -* @returns {VTree} virtual tree -*/ -function render( ctx ) { - /* eslint-disable no-underscore-dangle */ - var orient; - var props; - - orient = ctx._orientation; - debug( 'Axis orientation: %s.', orient ); - - props = { - 'namespace': 'http://www.w3.org/2000/svg', - 'property': 'axis.label', - 'className': 'label noselect', - 'attributes': { - 'fill': '#000', - 'stroke': 'none', - 'text-anchor': 'middle', - 'transform': labelTransform( orient ), - 'x': labelXPos( orient, ctx._scale.range() ), - 'y': labelYPos( orient ) - } - }; - - debug( 'Axis label: %s.', ctx._label ); - - debug( 'Generating a virtual DOM tree (%s) with properties: %s.', ELEMENT, JSON.stringify( props ) ); - - return h( ELEMENT, props, ctx._label ); -} - - -// EXPORTS // - -module.exports = render; diff --git a/lib/node_modules/@stdlib/plot/components/svg/axis/lib/components/line.js b/lib/node_modules/@stdlib/plot/components/svg/axis/lib/components/line.js deleted file mode 100644 index ada610cffd81..000000000000 --- a/lib/node_modules/@stdlib/plot/components/svg/axis/lib/components/line.js +++ /dev/null @@ -1,73 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); -var h = require( 'virtual-dom/h.js' ); -var xAttr = require( './../utils/x_attr.js' ); -var yAttr = require( './../utils/y_attr.js' ); - - -// VARIABLES // - -var debug = logger( 'axis:components:line' ); -var ELEMENT = 'line'; - - -// MAIN // - -/** -* Renders a tick line. -* -* @private -* @param {Object} ctx - context -* @returns {VTree} virtual tree -*/ -function render( ctx ) { - /* eslint-disable no-underscore-dangle */ - var props; - var x; - var y; - - props = { - 'namespace': 'http://www.w3.org/2000/svg', - 'attributes': { - 'stroke': '#aaa', - 'stroke-width': 1 - } - }; - - x = xAttr( ctx._orientation ); - y = yAttr( ctx._orientation ); - - props.attributes[ x+'2' ] = ctx.tickDir * ctx._innerTickSize; - props.attributes[ y+'1' ] = 0.5; - props.attributes[ y+'2' ] = 0.5; - - debug( 'Generating a virtual DOM tree (%s) with properties: %s.', ELEMENT, JSON.stringify( props ) ); - - return h( ELEMENT, props, [] ); -} - - -// EXPORTS // - -module.exports = render; diff --git a/lib/node_modules/@stdlib/plot/components/svg/axis/lib/components/text.js b/lib/node_modules/@stdlib/plot/components/svg/axis/lib/components/text.js deleted file mode 100644 index f28dd7c8234c..000000000000 --- a/lib/node_modules/@stdlib/plot/components/svg/axis/lib/components/text.js +++ /dev/null @@ -1,82 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); -var h = require( 'virtual-dom/h.js' ); -var dy = require( './../utils/text_dy.js' ); -var xAttr = require( './../utils/x_attr.js' ); -var yAttr = require( './../utils/y_attr.js' ); - - -// VARIABLES // - -var debug = logger( 'axis:components:text' ); -var ELEMENT = 'text'; - - -// MAIN // - -/** -* Renders tick text. -* -* @private -* @param {Object} ctx - context -* @param {*} d - tick value -* @returns {VTree} virtual tree -*/ -function render( ctx, d ) { - /* eslint-disable no-underscore-dangle */ - var orient; - var props; - var txt; - var x; - var y; - - orient = ctx._orientation; - debug( 'Axis orientation: %s.', orient ); - - props = { - 'namespace': 'http://www.w3.org/2000/svg', - 'attributes': { - 'fill': '#000', - 'dy': dy( orient ) - } - }; - - x = xAttr( orient ); - y = yAttr( orient ); - - props.attributes[ x ] = ctx.tickDir * ctx.tickSpacing; - props.attributes[ y ] = 0.5; - - txt = ctx.tickFormat( d ); - debug( 'Tick text: %s.', txt ); - - debug( 'Generating a virtual DOM tree (%s) with properties: %s.', ELEMENT, JSON.stringify( props ) ); - - return h( ELEMENT, props, txt ); -} - - -// EXPORTS // - -module.exports = render; diff --git a/lib/node_modules/@stdlib/plot/components/svg/axis/lib/components/tick.js b/lib/node_modules/@stdlib/plot/components/svg/axis/lib/components/tick.js deleted file mode 100644 index 7b1c46a3255d..000000000000 --- a/lib/node_modules/@stdlib/plot/components/svg/axis/lib/components/tick.js +++ /dev/null @@ -1,75 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); -var h = require( 'virtual-dom/h.js' ); -var line = require( './line.js' ); -var text = require( './text.js' ); - - -// VARIABLES // - -var debug = logger( 'axis:components:tick' ); -var ELEMENT = 'g'; - - -// MAIN // - -/** -* Renders an axis tick. -* -* @private -* @param {Object} ctx - context -* @param {*} d - tick value -* @param {Function} transform - tick transform -* @returns {VTree} virtual tree -*/ -function render( ctx, d, transform ) { - var children; - var props; - - props = { - 'namespace': 'http://www.w3.org/2000/svg', - 'property': 'axis.tick', - 'className': 'tick', - 'attributes': { - 'opacity': 1, - 'transform': transform( d ) - } - }; - children = new Array( 2 ); - - debug( 'Rendering a tick line...' ); - children[ 0 ] = line( ctx ); - - debug( 'Rendering tick text...' ); - children[ 1 ] = text( ctx, d ); - - debug( 'Generating a virtual DOM tree (%s) with properties: %s.', ELEMENT, JSON.stringify( props ) ); - - return h( ELEMENT, props, children ); -} - - -// EXPORTS // - -module.exports = render; diff --git a/lib/node_modules/@stdlib/plot/components/svg/axis/lib/components/ticks.js b/lib/node_modules/@stdlib/plot/components/svg/axis/lib/components/ticks.js deleted file mode 100644 index 88580a64c5ad..000000000000 --- a/lib/node_modules/@stdlib/plot/components/svg/axis/lib/components/ticks.js +++ /dev/null @@ -1,68 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); -var tickTransform = require( './../utils/tick_transform.js' ); -var tick = require( './tick.js' ); - - -// VARIABLES // - -var debug = logger( 'axis:components:ticks' ); - - -// MAIN // - -/** -* Renders axis ticks. -* -* @private -* @param {Object} ctx - context -* @returns {Array<VTree>} array of virtual DOM trees -*/ -function render( ctx ) { - /* eslint-disable no-underscore-dangle */ - var transform; - var values; - var out; - var i; - - values = ctx.ticks; - debug( 'Tick values: %s.', JSON.stringify( values ) ); - - debug( 'Generating tick transform...' ); - transform = tickTransform( ctx._orientation, ctx._scale ); - - debug( 'Rendering ticks...' ); - out = new Array( values.length ); - for ( i = 0; i < values.length; i++ ) { - debug( 'Rendering tick %d with value %s...', i, values[i] ); - out[ i ] = tick( ctx, values[i], transform ); - } - debug( 'Finished rendering ticks.' ); - return out; -} - - -// EXPORTS // - -module.exports = render; diff --git a/lib/node_modules/@stdlib/plot/components/svg/axis/lib/defaults.json b/lib/node_modules/@stdlib/plot/components/svg/axis/lib/defaults.json deleted file mode 100644 index cf038cd02d53..000000000000 --- a/lib/node_modules/@stdlib/plot/components/svg/axis/lib/defaults.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "scale": null, - "label": "", - "ticks": null, - "numTicks": null, - "tickFormat": null, - "tickSize": 6, - "innerTickSize": 6, - "outerTickSize": 6, - "tickPadding": 3, - "orientation": "bottom", - "autoRender": false -} diff --git a/lib/node_modules/@stdlib/plot/components/svg/axis/lib/etc/orientations.json b/lib/node_modules/@stdlib/plot/components/svg/axis/lib/etc/orientations.json deleted file mode 100644 index 2dbe8426b9bc..000000000000 --- a/lib/node_modules/@stdlib/plot/components/svg/axis/lib/etc/orientations.json +++ /dev/null @@ -1,6 +0,0 @@ -[ - "left", - "right", - "top", - "bottom" -] diff --git a/lib/node_modules/@stdlib/plot/components/svg/axis/lib/events/events.json b/lib/node_modules/@stdlib/plot/components/svg/axis/lib/events/events.json deleted file mode 100644 index 2a5ecc0ace26..000000000000 --- a/lib/node_modules/@stdlib/plot/components/svg/axis/lib/events/events.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "label": "change", - "numTicks": "change", - "orientation": "change", - "scale": "change", - "tickFormat": "change", - "tickPadding": "change", - "ticks": "change", - "tickSize": "change", - "innerTickSize": "change", - "outerTickSize": "change", - "autoRender": "change" -} diff --git a/lib/node_modules/@stdlib/plot/components/svg/axis/lib/events/index.js b/lib/node_modules/@stdlib/plot/components/svg/axis/lib/events/index.js deleted file mode 100644 index ef68b2b8fdb7..000000000000 --- a/lib/node_modules/@stdlib/plot/components/svg/axis/lib/events/index.js +++ /dev/null @@ -1,42 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var EVENTS = require( './events.json' ); - - -// MAIN // - -/** -* Provided a property, returns a corresponding event name for when a property value changes. -* -* @private -* @param {string} prop - property -* @returns {string} event name -*/ -function get( prop ) { - return EVENTS[ prop ]; -} - - -// EXPORTS // - -module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/components/svg/axis/lib/index.js b/lib/node_modules/@stdlib/plot/components/svg/axis/lib/index.js deleted file mode 100644 index 320fba9aa6b3..000000000000 --- a/lib/node_modules/@stdlib/plot/components/svg/axis/lib/index.js +++ /dev/null @@ -1,45 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// TODO: remove d3-scale - -/** -* Plot axis. -* -* @module @stdlib/plot/components/svg/axis -* -* @example -* var linear = require( 'd3-scale' ).scaleLinear(); -* var Axis = require( '@stdlib/plot/components/svg/axis' ); -* -* var axis = new Axis({ -* 'scale': linear(), -* 'orient': 'bottom' -* }); -*/ - -// MODULES // - -var main = require( './main.js' ); - - -// EXPORTS // - -module.exports = main; diff --git a/lib/node_modules/@stdlib/plot/components/svg/axis/lib/main.js b/lib/node_modules/@stdlib/plot/components/svg/axis/lib/main.js deleted file mode 100644 index 372f5b19ee19..000000000000 --- a/lib/node_modules/@stdlib/plot/components/svg/axis/lib/main.js +++ /dev/null @@ -1,573 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// TODO: improve JSDoc examples - -// MODULES // - -var EventEmitter = require( 'events' ).EventEmitter; -var logger = require( 'debug' ); -var linear = require( 'd3-scale' ).scaleLinear; // TODO: remove -var defineProperty = require( '@stdlib/utils/define-property' ); -var setReadOnly = require( '@stdlib/utils/define-read-only-property' ); -var copy = require( '@stdlib/utils/copy' ); -var defaults = require( './defaults.json' ); -var validate = require( './validate.js' ); -var setScale = require( './props/scale/set.js' ); -var getScale = require( './props/scale/get.js' ); -var setOrientation = require( './props/orientation/set.js' ); -var getOrientation = require( './props/orientation/get.js' ); -var setLabel = require( './props/label/set.js' ); -var getLabel = require( './props/label/get.js' ); -var setTicks = require( './props/ticks/set.js' ); -var getTicks = require( './props/ticks/get.js' ); -var setNumTicks = require( './props/num-ticks/set.js' ); -var getNumTicks = require( './props/num-ticks/get.js' ); -var setTickFormat = require( './props/tick-format/set.js' ); -var getTickFormat = require( './props/tick-format/get.js' ); -var setTickSize = require( './props/tick-size/set.js' ); -var getTickSize = require( './props/tick-size/get.js' ); -var setInnerTickSize = require( './props/inner-tick-size/set.js' ); -var getInnerTickSize = require( './props/inner-tick-size/get.js' ); -var setOuterTickSize = require( './props/outer-tick-size/set.js' ); -var getOuterTickSize = require( './props/outer-tick-size/get.js' ); -var setTickPadding = require( './props/tick-padding/set.js' ); -var getTickPadding = require( './props/tick-padding/get.js' ); -var getTickSpacing = require( './props/tick-spacing/get.js' ); -var getTickDir = require( './props/tick-dir/get.js' ); -var getTickPos = require( './props/tick-pos/get.js' ); -var setAutoRender = require( './props/auto-render/set.js' ); -var getAutoRender = require( './props/auto-render/get.js' ); -var render = require( './methods/render.js' ); - - -// VARIABLES // - -var debug = logger( 'axis:main' ); - - -// MAIN // - -/** -* Axis constructor. -* -* @constructor -* @param {Options} options - constructor options -* @param {Function} [options.scale] - scale function -* @param {string} [options.orientation='bottom'] - axis orientation -* @param {string} [options.label] - axis label -* @param {(Array|null)} [options.ticks] - tick values -* @param {(NonNegativeInteger|null)} [options.numTicks] - number of ticks -* @param {(null|string|Function)} [options.tickFormat] - tick format -* @param {NonNegativeInteger} [options.tickSize=6] - tick size -* @param {NonNegativeInteger} [options.innerTickSize=6] - inner tick size -* @param {NonNegativeInteger} [options.outerTickSize=6] - outer tick size -* @param {NonNegativeInteger} [options.tickPadding=3] - tick padding -* @param {boolean} [options.autoRender=false] - indicates whether to re-render on a change event -* @throws {TypeError} must provide valid options -* @returns {Axis} axis instance -* -* @example -* var axis = new Axis({ -* 'orientation': 'bottom' -* }); -*/ -function Axis( options ) { - var self; - var opts; - var err; - if ( !( this instanceof Axis ) ) { - return new Axis( options ); - } - self = this; - opts = copy( defaults ); - err = validate( opts, options ); - if ( err ) { - throw err; - } - debug( 'Creating an instance with the following configuration: %s.', JSON.stringify( opts ) ); - EventEmitter.call( this ); - - defineProperty( this, '_scale', { - 'configurable': false, - 'enumerable': false, - 'writable': true, - 'value': opts.scale || linear() - }); - defineProperty( this, '_orientation', { - 'configurable': false, - 'enumerable': false, - 'writable': true, - 'value': opts.orientation - }); - defineProperty( this, '_label', { - 'configurable': false, - 'enumerable': false, - 'writable': true, - 'value': opts.label - }); - defineProperty( this, '_ticks', { - 'configurable': false, - 'enumerable': false, - 'writable': true, - 'value': opts.ticks - }); - defineProperty( this, '_numTicks', { - 'configurable': false, - 'enumerable': false, - 'writable': true, - 'value': opts.numTicks - }); - defineProperty( this, '_tickFormat', { - 'configurable': false, - 'enumerable': false, - 'writable': true, - 'value': opts.tickFormat - }); - defineProperty( this, '_tickSize', { - 'configurable': false, - 'enumerable': false, - 'writable': true, - 'value': opts.tickSize - }); - defineProperty( this, '_innerTickSize', { - 'configurable': false, - 'enumerable': false, - 'writable': true, - 'value': opts.innerTickSize - }); - defineProperty( this, '_outerTickSize', { - 'configurable': false, - 'enumerable': false, - 'writable': true, - 'value': opts.outerTickSize - }); - defineProperty( this, '_tickPadding', { - 'configurable': false, - 'enumerable': false, - 'writable': true, - 'value': opts.tickPadding - }); - defineProperty( this, '_autoRender', { - 'configurable': false, - 'enumerable': false, - 'writable': true, - 'value': opts.autoRender - }); - - this.on( 'change', onChange ); - this.on( '_render', onRender ); - - return this; - - /** - * Callback invoked upon receiving a change event. - * - * @private - */ - function onChange() { - debug( 'Received a change event.' ); - if ( self._autoRender ) { // eslint-disable-line no-underscore-dangle - self.render(); - } - } - - /** - * Re-emits a render event. - * - * @private - */ - function onRender() { - var args; - var i; - debug( 'Received a render event. Re-emitting...' ); - args = new Array( arguments.length+1 ); - args[ 0 ] = 'render'; - for ( i = 0; i < arguments.length; i++ ) { - args[ i+1 ] = arguments[ i ]; - } - self.emit.apply( self, args ); - } -} - -/* -* Create a prototype which inherits from the parent prototype. -*/ -Axis.prototype = Object.create( EventEmitter.prototype ); - -/* -* Set the constructor. -*/ -Axis.prototype.constructor = Axis; - -/** -* Scale function. -* -* @name scale -* @memberof Axis.prototype -* @type {Function} -* @throws {TypeError} must be a function -* -* @example -* var axis = new Axis({ -* 'orientation': 'top' -* }); -* -* var f = axis.scale; -* // returns <Function> -*/ -defineProperty( Axis.prototype, 'scale', { - 'configurable': false, - 'enumerable': true, - 'set': setScale, - 'get': getScale -}); - -/** -* Axis orientation. -* -* @name orientation -* @memberof Axis.prototype -* @type {string} -* @throws {TypeError} must be a string -* @default 'bottom' -* -* @example -* var axis = new Axis({ -* 'orientation': 'bottom' -* }); -* axis.orientation = 'top'; -* -* var v = axis.orientation; -* // returns 'top' -*/ -defineProperty( Axis.prototype, 'orientation', { - 'configurable': false, - 'enumerable': true, - 'set': setOrientation, - 'get': getOrientation -}); - -/** -* Axis label. -* -* @name label -* @memberof Axis.prototype -* @type {string} -* @throws {TypeError} must be a string -* -* @example -* var axis = new Axis({ -* 'label': 'y' -* }); -* axis.label = 'Counts'; -* -* var v = axis.label; -* // returns 'Counts' -*/ -defineProperty( Axis.prototype, 'label', { - 'configurable': false, - 'enumerable': true, - 'set': setLabel, - 'get': getLabel -}); - -/** -* Axis tick values. When set to `null`, the retrieved values are the computed tick values. -* -* @name ticks -* @memberof Axis.prototype -* @type {(Array|null)} -* @throws {TypeError} must be an array or null -* @default null -* -* @example -* var axis = new Axis({ -* 'orientation': 'bottom', -* 'ticks': [1,2,3] -* }); -* axis.ticks = ['a','b','c']; -* -* var v = axis.ticks; -* // returns <Array> -*/ -defineProperty( Axis.prototype, 'ticks', { - 'configurable': false, - 'enumerable': true, - 'set': setTicks, - 'get': getTicks -}); - -/** -* Number of axis ticks. -* -* @name numTicks -* @memberof Axis.prototype -* @type {(NonNegativeInteger|null)} -* @throws {TypeError} must be a nonnegative integer or null -* @default null -* -* @example -* var axis = new Axis({ -* 'orientation': 'bottom', -* 'numTicks': 10 -* }); -* axis.numTicks = 5; -* -* var v = axis.numTicks; -* // returns 5 -*/ -defineProperty( Axis.prototype, 'numTicks', { - 'configurable': false, - 'enumerable': true, - 'set': setNumTicks, - 'get': getNumTicks -}); - -/** -* Tick format. When retrieved, the returned value is a formatting function. -* -* @name tickFormat -* @memberof Axis.prototype -* @type {(null|string|Function)} -* @throws {TypeError} must be either null, a string, or a function -* @default null -* -* @example -* var axis = new Axis({ -* 'orientation': 'bottom', -* 'tickFormat': ',f' -* }); -* axis.tickFormat = ',.0f'; -* -* var v = axis.tickFormat; -* // returns <Function> -*/ -defineProperty( Axis.prototype, 'tickFormat', { - 'configurable': false, - 'enumerable': true, - 'set': setTickFormat, - 'get': getTickFormat -}); - -/** -* Axis tick size. -* -* @name tickSize -* @memberof Axis.prototype -* @type {NonNegativeInteger} -* @throws {TypeError} must be a nonnegative integer -* @default 6 -* -* @example -* var axis = new Axis({ -* 'orientation': 'bottom', -* 'tickSize': 12 -* }); -* axis.tickSize = 8; -* -* var v = axis.tickSize; -* // returns 8 -*/ -defineProperty( Axis.prototype, 'tickSize', { - 'configurable': false, - 'enumerable': true, - 'set': setTickSize, - 'get': getTickSize -}); - -/** -* Axis inner tick size. -* -* @name innerTickSize -* @memberof Axis.prototype -* @type {NonNegativeInteger} -* @throws {TypeError} must be a nonnegative integer -* @default 6 -* -* @example -* var axis = new Axis({ -* 'orientation': 'bottom', -* 'innerTickSize': 10 -* }); -* axis.innerTickSize = 5; -* -* var v = axis.innerTickSize; -* // returns 5 -*/ -defineProperty( Axis.prototype, 'innerTickSize', { - 'configurable': false, - 'enumerable': true, - 'set': setInnerTickSize, - 'get': getInnerTickSize -}); - -/** -* Axis outer tick size. -* -* @name outerTickSize -* @memberof Axis.prototype -* @type {NonNegativeInteger} -* @throws {TypeError} must be a nonnegative integer -* @default 6 -* -* @example -* var axis = new Axis({ -* 'orientation': 'bottom', -* 'outerTickSize': 10 -* }); -* axis.outerTickSize = 5; -* -* var v = axis.outerTickSize; -* // returns 5 -*/ -defineProperty( Axis.prototype, 'outerTickSize', { - 'configurable': false, - 'enumerable': true, - 'set': setOuterTickSize, - 'get': getOuterTickSize -}); - -/** -* Axis tick padding. -* -* @name tickPadding -* @memberof Axis.prototype -* @type {NonNegativeInteger} -* @throws {TypeError} must be a nonnegative integer -* @default 3 -* -* @example -* var axis = new Axis({ -* 'orientation': 'bottom', -* 'tickPadding': 10 -* }); -* axis.tickPadding = 5; -* -* var v = axis.tickPadding; -* // returns 5 -*/ -defineProperty( Axis.prototype, 'tickPadding', { - 'configurable': false, - 'enumerable': true, - 'set': setTickPadding, - 'get': getTickPadding -}); - -/** -* Tick spacing. -* -* @name tickSpacing -* @memberof Axis.prototype -* @type {number} -* -* @example -* var axis = new Axis( {} ); -* -* var spacing = axis.tickSpacing; -* // returns <number> -*/ -defineProperty( Axis.prototype, 'tickSpacing', { - 'configurable': false, - 'enumerable': true, - 'get': getTickSpacing -}); - -/** -* Tick direction. -* -* @name tickDir -* @memberof Axis.prototype -* @type {number} -* -* @example -* var axis = new Axis( {} ); -* -* var dir = axis.tickDir; -* // returns <number> -*/ -defineProperty( Axis.prototype, 'tickDir', { - 'configurable': false, - 'enumerable': true, - 'get': getTickDir -}); - -/** -* Function for computing tick positions. -* -* @name tickPos -* @memberof Axis.prototype -* @type {Function} -* -* @example -* var axis = new Axis( {} ); -* -* var tickPos = axis.tickPos; -* // returns <Function> -*/ -defineProperty( Axis.prototype, 'tickPos', { - 'configurable': false, - 'enumerable': true, - 'get': getTickPos -}); - -/** -* Rendering mode. If `true`, an instance re-renders on each change event. -* -* @name autoRender -* @memberof Axis.prototype -* @type {boolean} -* @throws {TypeError} must be a boolean -* @default false -* -* @example -* var axis = new Axis({ -* 'autoRender': true -* }); -* -* var mode = axis.autoRender; -* // returns true -*/ -defineProperty( Axis.prototype, 'autoRender', { - 'configurable': false, - 'enumerable': true, - 'set': setAutoRender, - 'get': getAutoRender -}); - -/** -* Renders a virtual DOM tree. -* -* @name render -* @memberof Axis.prototype -* @type {Function} -* @returns {VTree} virtual tree -* -* @example -* var axis = new Axis( {} ); -* -* var out = axis.render(); -*/ -setReadOnly( Axis.prototype, 'render', render ); - - -// EXPORTS // - -module.exports = Axis; diff --git a/lib/node_modules/@stdlib/plot/components/svg/axis/lib/methods/render.js b/lib/node_modules/@stdlib/plot/components/svg/axis/lib/methods/render.js deleted file mode 100644 index 7452869afa05..000000000000 --- a/lib/node_modules/@stdlib/plot/components/svg/axis/lib/methods/render.js +++ /dev/null @@ -1,56 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); -var components = require( './../components' ); - - -// VARIABLES // - -var debug = logger( 'axis:render' ); - - -// MAIN // - -/** -* Renders a virtual DOM tree. -* -* @private -* @returns {VTree} virtual tree -*/ -function render() { - /* eslint-disable no-invalid-this */ - var vtree; - - debug( 'Rendering...' ); - vtree = components( this ); - - // Announce that a new tree has been rendered: - this.emit( '_render', vtree ); - - return vtree; -} - - -// EXPORTS // - -module.exports = render; diff --git a/lib/node_modules/@stdlib/plot/components/svg/axis/lib/props/auto-render/get.js b/lib/node_modules/@stdlib/plot/components/svg/axis/lib/props/auto-render/get.js deleted file mode 100644 index 7df40dec3f47..000000000000 --- a/lib/node_modules/@stdlib/plot/components/svg/axis/lib/props/auto-render/get.js +++ /dev/null @@ -1,35 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -/** -* Returns the rendering mode. -* -* @private -* @returns {boolean} rendering mode -*/ -function get() { - /* eslint-disable no-invalid-this */ - return this._autoRender; -} - - -// EXPORTS // - -module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/components/svg/axis/lib/props/auto-render/set.js b/lib/node_modules/@stdlib/plot/components/svg/axis/lib/props/auto-render/set.js deleted file mode 100644 index 758fcf0aa1ba..000000000000 --- a/lib/node_modules/@stdlib/plot/components/svg/axis/lib/props/auto-render/set.js +++ /dev/null @@ -1,60 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); -var events = require( './../../events' ); -var isValid = require( './../../validators/auto_render.js' ); - - -// VARIABLES // - -var debug = logger( 'axis:set:auto-render' ); -var CHANGE_EVENT = events( 'autoRender' ); - - -// MAIN // - -/** -* Sets the rendering mode. -* -* @private -* @param {boolean} bool - boolean indicating whether to re-render on a change event -* @throws {TypeError} must be a positive number -*/ -function set( bool ) { - /* eslint-disable no-invalid-this */ - var err = isValid( bool ); - if ( err ) { - throw err; - } - debug( 'Current value: %d.', this._autoRender ); - - this._autoRender = bool; - debug( 'New Value: %d.', this._autoRender ); - - this.emit( CHANGE_EVENT ); -} - - -// EXPORTS // - -module.exports = set; diff --git a/lib/node_modules/@stdlib/plot/components/svg/axis/lib/props/inner-tick-size/get.js b/lib/node_modules/@stdlib/plot/components/svg/axis/lib/props/inner-tick-size/get.js deleted file mode 100644 index f343d33712ec..000000000000 --- a/lib/node_modules/@stdlib/plot/components/svg/axis/lib/props/inner-tick-size/get.js +++ /dev/null @@ -1,35 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -/** -* Returns the inner tick size. -* -* @private -* @returns {NonNegativeInteger} tick size -*/ -function get() { - /* eslint-disable no-invalid-this */ - return this._innerTickSize; -} - - -// EXPORTS // - -module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/components/svg/axis/lib/props/inner-tick-size/set.js b/lib/node_modules/@stdlib/plot/components/svg/axis/lib/props/inner-tick-size/set.js deleted file mode 100644 index fd5118a93f37..000000000000 --- a/lib/node_modules/@stdlib/plot/components/svg/axis/lib/props/inner-tick-size/set.js +++ /dev/null @@ -1,60 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); -var events = require( './../../events' ); -var isValid = require( './../../validators/inner_tick_size.js' ); - - -// VARIABLES // - -var debug = logger( 'axis:set:ticksize-inner' ); -var CHANGE_EVENT = events( 'innerTickSize' ); - - -// MAIN // - -/** -* Sets the inner tick size. -* -* @private -* @param {NonNegativeInteger} size - size -* @throws {TypeError} must be a nonnegative integer -*/ -function set( size ) { - /* eslint-disable no-invalid-this */ - var err = isValid( size ); - if ( err ) { - throw err; - } - debug( 'Current value: %d.', size ); - - this._innerTickSize = size; - debug( 'New Value: %s.', this._innerTickSize ); - - this.emit( CHANGE_EVENT ); -} - - -// EXPORTS // - -module.exports = set; diff --git a/lib/node_modules/@stdlib/plot/components/svg/axis/lib/props/label/get.js b/lib/node_modules/@stdlib/plot/components/svg/axis/lib/props/label/get.js deleted file mode 100644 index a6d7816c7e90..000000000000 --- a/lib/node_modules/@stdlib/plot/components/svg/axis/lib/props/label/get.js +++ /dev/null @@ -1,35 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -/** -* Returns the axis label. -* -* @private -* @returns {string} label -*/ -function get() { - /* eslint-disable no-invalid-this */ - return this._label; -} - - -// EXPORTS // - -module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/components/svg/axis/lib/props/label/set.js b/lib/node_modules/@stdlib/plot/components/svg/axis/lib/props/label/set.js deleted file mode 100644 index 96e8db14b6c3..000000000000 --- a/lib/node_modules/@stdlib/plot/components/svg/axis/lib/props/label/set.js +++ /dev/null @@ -1,60 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); -var events = require( './../../events' ); -var isValid = require( './../../validators/label.js' ); - - -// VARIABLES // - -var debug = logger( 'axis:set:xlabel' ); -var CHANGE_EVENT = events( 'label' ); - - -// MAIN // - -/** -* Sets the axis label. -* -* @private -* @param {string} label - axis label -* @throws {TypeError} must be a string -*/ -function set( label ) { - /* eslint-disable no-invalid-this */ - var err = isValid( label ); - if ( err ) { - throw err; - } - debug( 'Current value: %s.', this._label ); - - this._label = label; - debug( 'New value: %s.', this._label ); - - this.emit( CHANGE_EVENT ); -} - - -// EXPORTS // - -module.exports = set; diff --git a/lib/node_modules/@stdlib/plot/components/svg/axis/lib/props/num-ticks/get.js b/lib/node_modules/@stdlib/plot/components/svg/axis/lib/props/num-ticks/get.js deleted file mode 100644 index 792d7ab1ba13..000000000000 --- a/lib/node_modules/@stdlib/plot/components/svg/axis/lib/props/num-ticks/get.js +++ /dev/null @@ -1,35 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -/** -* Returns the number of axis ticks. -* -* @private -* @returns {(NonNegativeInteger|null)} number of ticks -*/ -function get() { - /* eslint-disable no-invalid-this */ - return this._numTicks; -} - - -// EXPORTS // - -module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/components/svg/axis/lib/props/num-ticks/set.js b/lib/node_modules/@stdlib/plot/components/svg/axis/lib/props/num-ticks/set.js deleted file mode 100644 index c0ef5a8937d1..000000000000 --- a/lib/node_modules/@stdlib/plot/components/svg/axis/lib/props/num-ticks/set.js +++ /dev/null @@ -1,60 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); -var events = require( './../../events' ); -var isValid = require( './../../validators/num_ticks.js' ); - - -// VARIABLES // - -var debug = logger( 'axis:set:numticks' ); -var CHANGE_EVENT = events( 'numTicks' ); - - -// MAIN // - -/** -* Sets the number of axis ticks. -* -* @private -* @param {(NonNegativeInteger|null)} num - num -* @throws {TypeError} must be a nonnegative integer or null -*/ -function set( num ) { - /* eslint-disable no-invalid-this */ - var err = isValid( num ); - if ( err ) { - throw err; - } - debug( 'Current value: %d.', num ); - - this._numTicks = num; - debug( 'New Value: %s.', this._numTicks ); - - this.emit( CHANGE_EVENT ); -} - - -// EXPORTS // - -module.exports = set; diff --git a/lib/node_modules/@stdlib/plot/components/svg/axis/lib/props/orientation/get.js b/lib/node_modules/@stdlib/plot/components/svg/axis/lib/props/orientation/get.js deleted file mode 100644 index 0d5b896d2aad..000000000000 --- a/lib/node_modules/@stdlib/plot/components/svg/axis/lib/props/orientation/get.js +++ /dev/null @@ -1,35 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -/** -* Returns the axis orientation. -* -* @private -* @returns {string} orientation -*/ -function get() { - /* eslint-disable no-invalid-this */ - return this._orientation; -} - - -// EXPORTS // - -module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/components/svg/axis/lib/props/orientation/set.js b/lib/node_modules/@stdlib/plot/components/svg/axis/lib/props/orientation/set.js deleted file mode 100644 index 93629fe2daa3..000000000000 --- a/lib/node_modules/@stdlib/plot/components/svg/axis/lib/props/orientation/set.js +++ /dev/null @@ -1,60 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); -var events = require( './../../events' ); -var isValid = require( './../../validators/orientation.js' ); - - -// VARIABLES // - -var debug = logger( 'axis:set:orientation' ); -var CHANGE_EVENT = events( 'orientation' ); - - -// MAIN // - -/** -* Sets the axis orientation. -* -* @private -* @param {string} orient - axis orientation -* @throws {TypeError} must be a string -*/ -function set( orient ) { - /* eslint-disable no-invalid-this */ - var err = isValid( orient ); - if ( err ) { - throw err; - } - debug( 'Current value: %s.', this._orientation ); - - this._orientation = orient; - debug( 'New Value: %s.', this._orientation ); - - this.emit( CHANGE_EVENT ); -} - - -// EXPORTS // - -module.exports = set; diff --git a/lib/node_modules/@stdlib/plot/components/svg/axis/lib/props/outer-tick-size/get.js b/lib/node_modules/@stdlib/plot/components/svg/axis/lib/props/outer-tick-size/get.js deleted file mode 100644 index 3dfecb362723..000000000000 --- a/lib/node_modules/@stdlib/plot/components/svg/axis/lib/props/outer-tick-size/get.js +++ /dev/null @@ -1,35 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -/** -* Returns the axis outer tick size. -* -* @private -* @returns {NonNegativeInteger} tick size -*/ -function get() { - /* eslint-disable no-invalid-this */ - return this._outerTickSize; -} - - -// EXPORTS // - -module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/components/svg/axis/lib/props/outer-tick-size/set.js b/lib/node_modules/@stdlib/plot/components/svg/axis/lib/props/outer-tick-size/set.js deleted file mode 100644 index cf552520b9b8..000000000000 --- a/lib/node_modules/@stdlib/plot/components/svg/axis/lib/props/outer-tick-size/set.js +++ /dev/null @@ -1,60 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); -var events = require( './../../events' ); -var isValid = require( './../../validators/outer_tick_size.js' ); - - -// VARIABLES // - -var debug = logger( 'axis:set:ticksize-outer' ); -var CHANGE_EVENT = events( 'outerTickSize' ); - - -// MAIN // - -/** -* Sets the axis outer tick size. -* -* @private -* @param {NonNegativeInteger} size - size -* @throws {TypeError} must be a nonnegative integer -*/ -function set( size ) { - /* eslint-disable no-invalid-this */ - var err = isValid( size ); - if ( err ) { - throw err; - } - debug( 'Current value: %d.', size ); - - this._outerTickSize = size; - debug( 'New Value: %s.', this._outerTickSize ); - - this.emit( CHANGE_EVENT ); -} - - -// EXPORTS // - -module.exports = set; diff --git a/lib/node_modules/@stdlib/plot/components/svg/axis/lib/props/scale/get.js b/lib/node_modules/@stdlib/plot/components/svg/axis/lib/props/scale/get.js deleted file mode 100644 index 4ef9bb2c0ea8..000000000000 --- a/lib/node_modules/@stdlib/plot/components/svg/axis/lib/props/scale/get.js +++ /dev/null @@ -1,35 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -/** -* Returns the scale function. -* -* @private -* @returns {Function} scale function -*/ -function get() { - /* eslint-disable no-invalid-this */ - return this._scale; -} - - -// EXPORTS // - -module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/components/svg/axis/lib/props/scale/set.js b/lib/node_modules/@stdlib/plot/components/svg/axis/lib/props/scale/set.js deleted file mode 100644 index e4f706550877..000000000000 --- a/lib/node_modules/@stdlib/plot/components/svg/axis/lib/props/scale/set.js +++ /dev/null @@ -1,60 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); -var events = require( './../../events' ); -var isValid = require( './../../validators/scale.js' ); - - -// VARIABLES // - -var debug = logger( 'axis:set:scale' ); -var CHANGE_EVENT = events( 'scale' ); - - -// MAIN // - -/** -* Sets the scale function. -* -* @private -* @param {Function} fcn - scale -* @throws {TypeError} must be a function -*/ -function set( fcn ) { - /* eslint-disable no-invalid-this */ - var err = isValid( fcn ); - if ( err ) { - throw err; - } - debug( 'Current value: %s.', this._scale ); - - this._scale = fcn; - debug( 'New Value: %s.', this._scale ); - - this.emit( CHANGE_EVENT ); -} - - -// EXPORTS // - -module.exports = set; diff --git a/lib/node_modules/@stdlib/plot/components/svg/axis/lib/props/tick-dir/get.js b/lib/node_modules/@stdlib/plot/components/svg/axis/lib/props/tick-dir/get.js deleted file mode 100644 index 6b9296428fd1..000000000000 --- a/lib/node_modules/@stdlib/plot/components/svg/axis/lib/props/tick-dir/get.js +++ /dev/null @@ -1,41 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -/** -* Returns the tick direction. -* -* @private -* @returns {number} tick direction -*/ -function get() { - /* eslint-disable no-invalid-this */ - if ( - this._orientation === 'top' || - this._orientation === 'left' - ) { - return -1; - } - return 1; -} - - -// EXPORTS // - -module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/components/svg/axis/lib/props/tick-format/get.js b/lib/node_modules/@stdlib/plot/components/svg/axis/lib/props/tick-format/get.js deleted file mode 100644 index e7cd439aa332..000000000000 --- a/lib/node_modules/@stdlib/plot/components/svg/axis/lib/props/tick-format/get.js +++ /dev/null @@ -1,54 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var format = require( 'd3-format' ).format; // TODO: remove -var isString = require( '@stdlib/assert/is-string' ).isPrimitive; -var isNull = require( '@stdlib/assert/is-null' ); -var identity = require( '@stdlib/utils/identity-function' ); - - -// MAIN // - -/** -* Returns the axis tick format. -* -* @private -* @returns {Function} format function -*/ -function get() { - /* eslint-disable no-invalid-this */ - if ( isString( this._tickFormat ) ) { - return format( this._tickFormat ); - } - if ( isNull( this._tickFormat ) ) { - if ( this._scale.tickFormat ) { - return this._scale.tickFormat( this._numTicks, this._tickFormat ); - } - return identity; - } - return this._tickFormat; -} - - -// EXPORTS // - -module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/components/svg/axis/lib/props/tick-format/set.js b/lib/node_modules/@stdlib/plot/components/svg/axis/lib/props/tick-format/set.js deleted file mode 100644 index 0f5da333f521..000000000000 --- a/lib/node_modules/@stdlib/plot/components/svg/axis/lib/props/tick-format/set.js +++ /dev/null @@ -1,60 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); -var events = require( './../../events' ); -var isValid = require( './../../validators/tick_format.js' ); - - -// VARIABLES // - -var debug = logger( 'axis:set:tickformat' ); -var CHANGE_EVENT = events( 'tickFormat' ); - - -// MAIN // - -/** -* Sets the axis tick format. -* -* @private -* @param {(null|string|Function)} fmt - tick format -* @throws {TypeError} must be either null, a string, or a function -*/ -function set( fmt ) { - /* eslint-disable no-invalid-this */ - var err = isValid( fmt ); - if ( err ) { - throw err; - } - debug( 'Current value: %s.', this._tickFormat ); - - this._tickFormat = fmt; - debug( 'New Value: %s.', this._tickFormat ); - - this.emit( CHANGE_EVENT ); -} - - -// EXPORTS // - -module.exports = set; diff --git a/lib/node_modules/@stdlib/plot/components/svg/axis/lib/props/tick-padding/get.js b/lib/node_modules/@stdlib/plot/components/svg/axis/lib/props/tick-padding/get.js deleted file mode 100644 index e5d5072b94aa..000000000000 --- a/lib/node_modules/@stdlib/plot/components/svg/axis/lib/props/tick-padding/get.js +++ /dev/null @@ -1,35 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -/** -* Returns the axis tick padding. -* -* @private -* @returns {NonNegativeInteger} padding -*/ -function get() { - /* eslint-disable no-invalid-this */ - return this._tickPadding; -} - - -// EXPORTS // - -module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/components/svg/axis/lib/props/tick-padding/set.js b/lib/node_modules/@stdlib/plot/components/svg/axis/lib/props/tick-padding/set.js deleted file mode 100644 index 841285dfff75..000000000000 --- a/lib/node_modules/@stdlib/plot/components/svg/axis/lib/props/tick-padding/set.js +++ /dev/null @@ -1,60 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); -var events = require( './../../events' ); -var isValid = require( './../../validators/tick_padding.js' ); - - -// VARIABLES // - -var debug = logger( 'axis:set:tickpadding' ); -var CHANGE_EVENT = events( 'tickPadding' ); - - -// MAIN // - -/** -* Sets the axis tick padding. -* -* @private -* @param {NonNegativeInteger} padding - padding -* @throws {TypeError} must be a nonnegative integer -*/ -function set( padding ) { - /* eslint-disable no-invalid-this */ - var err = isValid( padding ); - if ( err ) { - throw err; - } - debug( 'Current value: %d.', padding ); - - this._tickPadding = padding; - debug( 'New Value: %s.', this._tickPadding ); - - this.emit( CHANGE_EVENT ); -} - - -// EXPORTS // - -module.exports = set; diff --git a/lib/node_modules/@stdlib/plot/components/svg/axis/lib/props/tick-pos/center.js b/lib/node_modules/@stdlib/plot/components/svg/axis/lib/props/tick-pos/center.js deleted file mode 100644 index 5ee11933d7d5..000000000000 --- a/lib/node_modules/@stdlib/plot/components/svg/axis/lib/props/tick-pos/center.js +++ /dev/null @@ -1,61 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); - - -// VARIABLES // - -var debug = logger( 'axis:center' ); - - -// MAIN // - -/** -* Returns a function to center a tick. -* -* @private -* @returns {Function} function to center a tick -*/ -function center() { - /* eslint-disable no-invalid-this */ - var width = this._scale.bandwidth() / 2; - return center; - - /** - * Returns a centered tick position. - * - * @private - * @param {*} d - datum - * @returns {number} tick position - */ - function center( d ) { - var pos = this._scale( d ) + width; - debug( 'Value: %s => Coordinate: %d', d, pos ); - return pos; - } -} - - -// EXPORTS // - -module.exports = center; diff --git a/lib/node_modules/@stdlib/plot/components/svg/axis/lib/props/tick-pos/get.js b/lib/node_modules/@stdlib/plot/components/svg/axis/lib/props/tick-pos/get.js deleted file mode 100644 index e29d88b4b091..000000000000 --- a/lib/node_modules/@stdlib/plot/components/svg/axis/lib/props/tick-pos/get.js +++ /dev/null @@ -1,46 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var center = require( './center.js' ); - - -// MAIN // - -/** -* Returns a function for positioning ticks. -* -* @private -* @returns {Function} position function -*/ -function get() { - /* eslint-disable no-invalid-this */ - var scale = this._scale.copy(); - if ( scale.bandwidth ) { - return center( scale ); - } - return scale; -} - - -// EXPORTS // - -module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/components/svg/axis/lib/props/tick-size/get.js b/lib/node_modules/@stdlib/plot/components/svg/axis/lib/props/tick-size/get.js deleted file mode 100644 index 63c5fb3254a1..000000000000 --- a/lib/node_modules/@stdlib/plot/components/svg/axis/lib/props/tick-size/get.js +++ /dev/null @@ -1,35 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -/** -* Returns the axis tick size. -* -* @private -* @returns {NonNegativeInteger} tick size -*/ -function get() { - /* eslint-disable no-invalid-this */ - return this._tickSize; -} - - -// EXPORTS // - -module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/components/svg/axis/lib/props/tick-size/set.js b/lib/node_modules/@stdlib/plot/components/svg/axis/lib/props/tick-size/set.js deleted file mode 100644 index ffdeb3363129..000000000000 --- a/lib/node_modules/@stdlib/plot/components/svg/axis/lib/props/tick-size/set.js +++ /dev/null @@ -1,60 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); -var events = require( './../../events' ); -var isValid = require( './../../validators/tick_size.js' ); - - -// VARIABLES // - -var debug = logger( 'axis:set:ticksize' ); -var CHANGE_EVENT = events( 'tickSize' ); - - -// MAIN // - -/** -* Sets the axis tick size. -* -* @private -* @param {NonNegativeInteger} size - size -* @throws {TypeError} must be a nonnegative integer -*/ -function set( size ) { - /* eslint-disable no-invalid-this */ - var err = isValid( size ); - if ( err ) { - throw err; - } - debug( 'Current value: %d.', size ); - - this._tickSize = size; - debug( 'New Value: %s.', this._tickSize ); - - this.emit( CHANGE_EVENT ); -} - - -// EXPORTS // - -module.exports = set; diff --git a/lib/node_modules/@stdlib/plot/components/svg/axis/lib/props/tick-spacing/get.js b/lib/node_modules/@stdlib/plot/components/svg/axis/lib/props/tick-spacing/get.js deleted file mode 100644 index 90403259efc2..000000000000 --- a/lib/node_modules/@stdlib/plot/components/svg/axis/lib/props/tick-spacing/get.js +++ /dev/null @@ -1,35 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -/** -* Returns the tick spacing. -* -* @private -* @returns {number} tick spacing -*/ -function get() { - /* eslint-disable no-invalid-this */ - return this._innerTickSize + this._tickPadding; -} - - -// EXPORTS // - -module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/components/svg/axis/lib/props/ticks/get.js b/lib/node_modules/@stdlib/plot/components/svg/axis/lib/props/ticks/get.js deleted file mode 100644 index 58240995fb45..000000000000 --- a/lib/node_modules/@stdlib/plot/components/svg/axis/lib/props/ticks/get.js +++ /dev/null @@ -1,48 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var isNull = require( '@stdlib/assert/is-null' ); - - -// MAIN // - -/** -* Returns the axis tick values. -* -* @private -* @returns {Array} ticks -*/ -function get() { - /* eslint-disable no-invalid-this */ - if ( isNull( this._ticks ) ) { - if ( this._scale.ticks ) { - return this._scale.ticks( this._numTicks, this._tickFormat ); - } - return this._scale.domain(); - } - return this._ticks.slice(); -} - - -// EXPORTS // - -module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/components/svg/axis/lib/props/ticks/set.js b/lib/node_modules/@stdlib/plot/components/svg/axis/lib/props/ticks/set.js deleted file mode 100644 index f16e33210034..000000000000 --- a/lib/node_modules/@stdlib/plot/components/svg/axis/lib/props/ticks/set.js +++ /dev/null @@ -1,65 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); -var isNull = require( '@stdlib/assert/is-null' ); -var events = require( './../../events' ); -var isValid = require( './../../validators/ticks.js' ); - - -// VARIABLES // - -var debug = logger( 'axis:set:ticks' ); -var CHANGE_EVENT = events( 'ticks' ); - - -// MAIN // - -/** -* Sets the axis tick values. -* -* @private -* @param {(Array|null)} ticks - tick values -* @throws {TypeError} must be an array or null -*/ -function set( ticks ) { - /* eslint-disable no-invalid-this */ - var err = isValid( ticks ); - if ( err ) { - throw err; - } - debug( 'Current value: %s.', JSON.stringify( this._ticks ) ); - - if ( isNull( ticks ) ) { - this._ticks = ticks; - } else { - this._ticks = ticks.slice(); - } - debug( 'New Value: %s.', JSON.stringify( this._ticks ) ); - - this.emit( CHANGE_EVENT ); -} - - -// EXPORTS // - -module.exports = set; diff --git a/lib/node_modules/@stdlib/plot/components/svg/axis/lib/utils/label_transform.js b/lib/node_modules/@stdlib/plot/components/svg/axis/lib/utils/label_transform.js deleted file mode 100644 index 3c5111b37a66..000000000000 --- a/lib/node_modules/@stdlib/plot/components/svg/axis/lib/utils/label_transform.js +++ /dev/null @@ -1,42 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -/** -* Returns a label SVG transform. -* -* @private -* @param {string} orient - axis orientation -* @returns {string} SVG transform -*/ -function labelTransform( orient ) { - if ( orient === 'bottom' || orient === 'top' ) { - return 'rotate(0)'; - } - if ( orient === 'left' ) { - return 'rotate(-90)'; - } - // orient === 'right' - return 'rotate(90)'; -} - - -// EXPORTS // - -module.exports = labelTransform; diff --git a/lib/node_modules/@stdlib/plot/components/svg/axis/lib/utils/label_x_pos.js b/lib/node_modules/@stdlib/plot/components/svg/axis/lib/utils/label_x_pos.js deleted file mode 100644 index 5b92f87a1a6f..000000000000 --- a/lib/node_modules/@stdlib/plot/components/svg/axis/lib/utils/label_x_pos.js +++ /dev/null @@ -1,39 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -/** -* Returns the label `x` coordinate. -* -* @private -* @param {string} orient - axis orientation -* @param {NumericArray} range - scale range -* @returns {number} `x` coordinate -*/ -function labelXPos( orient, range ) { - if ( orient === 'left' || orient === 'right' ) { - return -range[0] / 2; - } - return range[1] / 2; -} - - -// EXPORTS // - -module.exports = labelXPos; diff --git a/lib/node_modules/@stdlib/plot/components/svg/axis/lib/utils/label_y_pos.js b/lib/node_modules/@stdlib/plot/components/svg/axis/lib/utils/label_y_pos.js deleted file mode 100644 index 6c277c09fb4b..000000000000 --- a/lib/node_modules/@stdlib/plot/components/svg/axis/lib/utils/label_y_pos.js +++ /dev/null @@ -1,45 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -/** -* Returns the label `y` coordinate. -* -* @private -* @param {string} orient - axis orientation -* @returns {number} `y` coordinate -*/ -function labelYPos( orient ) { - if ( orient === 'left' ) { - return -72; - } - if ( orient === 'right' ) { - return 72; - } - if ( orient === 'bottom' ) { - return 45; - } - // orient === 'top' - return -45; -} - - -// EXPORTS // - -module.exports = labelYPos; diff --git a/lib/node_modules/@stdlib/plot/components/svg/axis/lib/utils/text_anchor.js b/lib/node_modules/@stdlib/plot/components/svg/axis/lib/utils/text_anchor.js deleted file mode 100644 index c46a92a9c9ce..000000000000 --- a/lib/node_modules/@stdlib/plot/components/svg/axis/lib/utils/text_anchor.js +++ /dev/null @@ -1,41 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -/** -* Returns the text anchor value for text positioning. -* -* @private -* @param {string} orient - axis orientation -* @returns {string} text anchor value -*/ -function textAnchor( orient ) { - if ( orient === 'left' ) { - return 'end'; - } - if ( orient === 'right' ) { - return 'start'; - } - return 'middle'; -} - - -// EXPORTS // - -module.exports = textAnchor; diff --git a/lib/node_modules/@stdlib/plot/components/svg/axis/lib/utils/text_dy.js b/lib/node_modules/@stdlib/plot/components/svg/axis/lib/utils/text_dy.js deleted file mode 100644 index 8b9d22af276c..000000000000 --- a/lib/node_modules/@stdlib/plot/components/svg/axis/lib/utils/text_dy.js +++ /dev/null @@ -1,41 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -/** -* Returns vertical shift for aligning tick text. -* -* @private -* @param {string} orient - axis orientation -* @returns {string} text shift -*/ -function dy( orient ) { - if ( orient === 'top' ) { - return '0em'; - } - if ( orient === 'bottom' ) { - return '.71em'; - } - return '.32em'; -} - - -// EXPORTS // - -module.exports = dy; diff --git a/lib/node_modules/@stdlib/plot/components/svg/axis/lib/utils/tick_transform.js b/lib/node_modules/@stdlib/plot/components/svg/axis/lib/utils/tick_transform.js deleted file mode 100644 index 6bc43ae07f0e..000000000000 --- a/lib/node_modules/@stdlib/plot/components/svg/axis/lib/utils/tick_transform.js +++ /dev/null @@ -1,47 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var translateX = require( './translate_x.js' ); -var translateY = require( './translate_y.js' ); - - -// MAIN // - -/** -* Returns a function to translate ticks. -* -* @private -* @param {string} orient - axis orientation -* @param {Function} scale - scale function -* @returns {Function} transform function -*/ -function tickTransform( orient, scale ) { - if ( orient === 'top' || orient === 'bottom' ) { - return translateX( scale ); - } - return translateY( scale ); -} - - -// EXPORTS // - -module.exports = tickTransform; diff --git a/lib/node_modules/@stdlib/plot/components/svg/axis/lib/utils/translate_x.js b/lib/node_modules/@stdlib/plot/components/svg/axis/lib/utils/translate_x.js deleted file mode 100644 index 367e71d7d265..000000000000 --- a/lib/node_modules/@stdlib/plot/components/svg/axis/lib/utils/translate_x.js +++ /dev/null @@ -1,60 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); - - -// VARIABLES // - -var debug = logger( 'axis:engine:translate-x' ); - - -// MAIN // - -/** -* Returns a function to horizontally translate a tick. -* -* @private -* @param {Function} scale - scale function -* @returns {Function} function to translate a tick -*/ -function translateX( scale ) { - return translateX; - - /** - * Horizontally translates a tick. - * - * @private - * @param {*} d - datum - * @returns {string} transform - */ - function translateX( d ) { - var t = 'translate('+scale( d )+',0)'; - debug( 'Value: %s => Transform: %s.', d, t ); - return t; - } -} - - -// EXPORTS // - -module.exports = translateX; diff --git a/lib/node_modules/@stdlib/plot/components/svg/axis/lib/utils/translate_y.js b/lib/node_modules/@stdlib/plot/components/svg/axis/lib/utils/translate_y.js deleted file mode 100644 index d887e7a4d2ac..000000000000 --- a/lib/node_modules/@stdlib/plot/components/svg/axis/lib/utils/translate_y.js +++ /dev/null @@ -1,60 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); - - -// VARIABLES // - -var debug = logger( 'axis:engine:translate-y' ); - - -// MAIN // - -/** -* Returns a function to vertically translate a tick. -* -* @private -* @param {Function} scale - scale function -* @returns {Function} function to translate a tick -*/ -function translateY( scale ) { - return translateY; - - /** - * Vertically translates a tick. - * - * @private - * @param {*} d - datum - * @returns {string} transform - */ - function translateY( d ) { - var t = 'translate(0,'+scale( d )+')'; - debug( 'Value: %s => Transform: %s.', d, t ); - return t; - } -} - - -// EXPORTS // - -module.exports = translateY; diff --git a/lib/node_modules/@stdlib/plot/components/svg/axis/lib/utils/x_attr.js b/lib/node_modules/@stdlib/plot/components/svg/axis/lib/utils/x_attr.js deleted file mode 100644 index a191df230338..000000000000 --- a/lib/node_modules/@stdlib/plot/components/svg/axis/lib/utils/x_attr.js +++ /dev/null @@ -1,38 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -/** -* Returns the "x" attribute for tick positioning. -* -* @private -* @param {string} orient - axis orientation -* @returns {string} attribute -*/ -function xAttr( orient ) { - if ( orient === 'left' || orient === 'right' ) { - return 'x'; - } - return 'y'; -} - - -// EXPORTS // - -module.exports = xAttr; diff --git a/lib/node_modules/@stdlib/plot/components/svg/axis/lib/utils/y_attr.js b/lib/node_modules/@stdlib/plot/components/svg/axis/lib/utils/y_attr.js deleted file mode 100644 index ad146b7e92f4..000000000000 --- a/lib/node_modules/@stdlib/plot/components/svg/axis/lib/utils/y_attr.js +++ /dev/null @@ -1,38 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -/** -* Returns the "y" attribute for tick positioning. -* -* @private -* @param {string} orient - axis orientation -* @returns {string} attribute -*/ -function yAttr( orient ) { - if ( orient === 'left' || orient === 'right' ) { - return 'y'; - } - return 'x'; -} - - -// EXPORTS // - -module.exports = yAttr; diff --git a/lib/node_modules/@stdlib/plot/components/svg/axis/lib/validate.js b/lib/node_modules/@stdlib/plot/components/svg/axis/lib/validate.js deleted file mode 100644 index 7f7be86c96c7..000000000000 --- a/lib/node_modules/@stdlib/plot/components/svg/axis/lib/validate.js +++ /dev/null @@ -1,92 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var objectKeys = require( '@stdlib/utils/keys' ); -var isObject = require( '@stdlib/assert/is-plain-object' ); -var hasOwnProp = require( '@stdlib/assert/has-own-property' ); -var format = require( '@stdlib/string/format' ); -var validators = require( './validators' ); - - -// VARIABLES // - -var KEYS = objectKeys( validators ); - - -// MAIN // - -/** -* Validates function options. -* -* @private -* @param {Object} opts - destination object -* @param {Options} options - function options -* @param {Function} [options.scale] - scale function -* @param {string} [options.orientation] - axis orientation -* @param {string} [options.label] - axis label -* @param {(Array|null)} [options.ticks] - tick values -* @param {(NonNegativeInteger|null)} [options.numTicks] - number of ticks -* @param {(null|string|Function)} [options.tickFormat] - tick format -* @param {NonNegativeInteger} [options.tickSize] - tick size -* @param {NonNegativeInteger} [options.innerTickSize] - inner tick size -* @param {NonNegativeInteger} [options.outerTickSize] - outer tick size -* @param {NonNegativeInteger} [options.tickPadding] - tick padding -* @returns {(Error|null)} error or null -* -* @example -* var opts = {}; -* var options = { -* 'scale': function scale(){}, -* 'orientation': 'left', -* 'tickSize': 10 -* }; -* var err = validate( opts, options ); -* if ( err ) { -* throw err; -* } -*/ -function validate( opts, options ) { - var err; - var key; - var val; - var i; - if ( !isObject( options ) ) { - return new TypeError( format( 'invalid argument. Options argument must be an object. Value: `%s`.', options ) ); - } - for ( i = 0; i < KEYS.length; i++ ) { - key = KEYS[ i ]; - if ( hasOwnProp( options, key ) ) { - val = options[ key ]; - err = validators[ key ]( val ); - if ( err ) { - return err; - } - opts[ key ] = val; - } - } - return null; -} - - -// EXPORTS // - -module.exports = validate; diff --git a/lib/node_modules/@stdlib/plot/components/svg/axis/lib/validators/auto_render.js b/lib/node_modules/@stdlib/plot/components/svg/axis/lib/validators/auto_render.js deleted file mode 100644 index 08da79ff51a6..000000000000 --- a/lib/node_modules/@stdlib/plot/components/svg/axis/lib/validators/auto_render.js +++ /dev/null @@ -1,46 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var isBoolean = require( '@stdlib/assert/is-boolean' ).isPrimitive; -var format = require( '@stdlib/string/format' ); - - -// MAIN // - -/** -* Validates `autoRender`. -* -* @private -* @param {*} v - value to test -* @returns {(Error|null)} error object or null -*/ -function test( v ) { - if ( !isBoolean( v ) ) { - return new TypeError( format( 'invalid assignment. `%s` must be a boolean. Value: `%s`.', 'autoRender', v ) ); - } - return null; -} - - -// EXPORTS // - -module.exports = test; diff --git a/lib/node_modules/@stdlib/plot/components/svg/axis/lib/validators/index.js b/lib/node_modules/@stdlib/plot/components/svg/axis/lib/validators/index.js deleted file mode 100644 index b849e7fae9af..000000000000 --- a/lib/node_modules/@stdlib/plot/components/svg/axis/lib/validators/index.js +++ /dev/null @@ -1,55 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var autoRender = require( './auto_render.js' ); -var label = require( './label.js' ); -var numTicks = require( './num_ticks.js' ); -var orientation = require( './orientation.js' ); -var scale = require( './scale.js' ); -var tickFormat = require( './tick_format.js' ); -var tickPadding = require( './tick_padding.js' ); -var ticks = require( './ticks.js' ); -var tickSize = require( './tick_size.js' ); -var innerTickSize = require( './inner_tick_size.js' ); -var outerTickSize = require( './outer_tick_size.js' ); - - -// MAIN // - -var validators = { - 'autoRender': autoRender, - 'label': label, - 'numTicks': numTicks, - 'orientation': orientation, - 'scale': scale, - 'tickFormat': tickFormat, - 'tickPadding': tickPadding, - 'ticks': ticks, - 'tickSize': tickSize, - 'innerTickSize': innerTickSize, - 'outerTickSize': outerTickSize -}; - - -// EXPORTS // - -module.exports = validators; diff --git a/lib/node_modules/@stdlib/plot/components/svg/axis/lib/validators/inner_tick_size.js b/lib/node_modules/@stdlib/plot/components/svg/axis/lib/validators/inner_tick_size.js deleted file mode 100644 index 8271f9cc5363..000000000000 --- a/lib/node_modules/@stdlib/plot/components/svg/axis/lib/validators/inner_tick_size.js +++ /dev/null @@ -1,46 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var isNonNegativeInteger = require( '@stdlib/assert/is-nonnegative-integer' ).isPrimitive; -var format = require( '@stdlib/string/format' ); - - -// MAIN // - -/** -* Validates `innerTickSize`. -* -* @private -* @param {*} v - value to test -* @returns {(Error|null)} error object or null -*/ -function test( v ) { - if ( !isNonNegativeInteger( v ) ) { - return new TypeError( format( 'invalid assignment. `%s` must be a nonnegative integer. Value: `%s`.', 'innerTickSize', v ) ); - } - return null; -} - - -// EXPORTS // - -module.exports = test; diff --git a/lib/node_modules/@stdlib/plot/components/svg/axis/lib/validators/label.js b/lib/node_modules/@stdlib/plot/components/svg/axis/lib/validators/label.js deleted file mode 100644 index ca11a1c778d9..000000000000 --- a/lib/node_modules/@stdlib/plot/components/svg/axis/lib/validators/label.js +++ /dev/null @@ -1,46 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var isString = require( '@stdlib/assert/is-string' ).isPrimitive; -var format = require( '@stdlib/string/format' ); - - -// MAIN // - -/** -* Validates `label`. -* -* @private -* @param {*} v - value to test -* @returns {(Error|null)} error object or null -*/ -function test( v ) { - if ( !isString( v ) ) { - return new TypeError( format( 'invalid assignment. `%s` must be a string. Value: `%s`.', 'label', v ) ); - } - return null; -} - - -// EXPORTS // - -module.exports = test; diff --git a/lib/node_modules/@stdlib/plot/components/svg/axis/lib/validators/num_ticks.js b/lib/node_modules/@stdlib/plot/components/svg/axis/lib/validators/num_ticks.js deleted file mode 100644 index 51e366b31580..000000000000 --- a/lib/node_modules/@stdlib/plot/components/svg/axis/lib/validators/num_ticks.js +++ /dev/null @@ -1,50 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var isNull = require( '@stdlib/assert/is-null' ); -var isNonNegativeInteger = require( '@stdlib/assert/is-nonnegative-integer' ).isPrimitive; -var format = require( '@stdlib/string/format' ); - - -// MAIN // - -/** -* Validates `numTicks`. -* -* @private -* @param {*} v - value to test -* @returns {(Error|null)} error object or null -*/ -function test( v ) { - if ( - !isNull( v ) && - !isNonNegativeInteger( v ) - ) { - return new TypeError( format( 'invalid assignment. `%s` must be a nonnegative integer or null. Value: `%s`.', 'numTicks', v ) ); - } - return null; -} - - -// EXPORTS // - -module.exports = test; diff --git a/lib/node_modules/@stdlib/plot/components/svg/axis/lib/validators/orientation.js b/lib/node_modules/@stdlib/plot/components/svg/axis/lib/validators/orientation.js deleted file mode 100644 index c38f5abdbf13..000000000000 --- a/lib/node_modules/@stdlib/plot/components/svg/axis/lib/validators/orientation.js +++ /dev/null @@ -1,47 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var indexOf = require( '@stdlib/utils/index-of' ); -var format = require( '@stdlib/string/format' ); -var ORIENTATIONS = require( './../etc/orientations.json' ); - - -// MAIN // - -/** -* Validates `orientation`. -* -* @private -* @param {*} v - value to test -* @returns {(Error|null)} error object or null -*/ -function test( v ) { - if ( indexOf( ORIENTATIONS, v ) === -1 ) { - return new TypeError( format( 'invalid assignment. `%s` must be one of the following: "%s". Value: `%s`.', 'orientation', ORIENTATIONS.join( '", "' ), v ) ); - } - return null; -} - - -// EXPORTS // - -module.exports = test; diff --git a/lib/node_modules/@stdlib/plot/components/svg/axis/lib/validators/outer_tick_size.js b/lib/node_modules/@stdlib/plot/components/svg/axis/lib/validators/outer_tick_size.js deleted file mode 100644 index 6f78b85fb5c5..000000000000 --- a/lib/node_modules/@stdlib/plot/components/svg/axis/lib/validators/outer_tick_size.js +++ /dev/null @@ -1,46 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var isNonNegativeInteger = require( '@stdlib/assert/is-nonnegative-integer' ).isPrimitive; -var format = require( '@stdlib/string/format' ); - - -// MAIN // - -/** -* Validates `outerTickSize`. -* -* @private -* @param {*} v - value to test -* @returns {(Error|null)} error object or null -*/ -function test( v ) { - if ( !isNonNegativeInteger( v ) ) { - return new TypeError( format( 'invalid assignment. `%s` must be a nonnegative integer. Value: `%s`.', 'outerTickSize', v ) ); - } - return null; -} - - -// EXPORTS // - -module.exports = test; diff --git a/lib/node_modules/@stdlib/plot/components/svg/axis/lib/validators/scale.js b/lib/node_modules/@stdlib/plot/components/svg/axis/lib/validators/scale.js deleted file mode 100644 index d0636cd6c636..000000000000 --- a/lib/node_modules/@stdlib/plot/components/svg/axis/lib/validators/scale.js +++ /dev/null @@ -1,46 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var isFunction = require( '@stdlib/assert/is-function' ); -var format = require( '@stdlib/string/format' ); - - -// MAIN // - -/** -* Validates `scale`. -* -* @private -* @param {*} v - value to test -* @returns {(Error|null)} error object or null -*/ -function test( v ) { - if ( !isFunction( v ) ) { - return new TypeError( format( 'invalid assignment. `%s` must be a function. Value: `%s`.', 'scale', v ) ); - } - return null; -} - - -// EXPORTS // - -module.exports = test; diff --git a/lib/node_modules/@stdlib/plot/components/svg/axis/lib/validators/tick_format.js b/lib/node_modules/@stdlib/plot/components/svg/axis/lib/validators/tick_format.js deleted file mode 100644 index 8cf488b563d7..000000000000 --- a/lib/node_modules/@stdlib/plot/components/svg/axis/lib/validators/tick_format.js +++ /dev/null @@ -1,52 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var isNull = require( '@stdlib/assert/is-null' ); -var isString = require( '@stdlib/assert/is-string' ).isPrimitive; -var isFunction = require( '@stdlib/assert/is-function' ); -var format = require( '@stdlib/string/format' ); - - -// MAIN // - -/** -* Validates `tickFormat`. -* -* @private -* @param {*} v - value to test -* @returns {(Error|null)} error object or null -*/ -function test( v ) { - if ( - !isNull( v ) && - !isString( v ) && - !isFunction( v ) - ) { - return new TypeError( format( 'invalid assignment. `%s` must be a string, function, or null. Value: `%s`.', 'tickFormat', v ) ); - } - return null; -} - - -// EXPORTS // - -module.exports = test; diff --git a/lib/node_modules/@stdlib/plot/components/svg/axis/lib/validators/tick_padding.js b/lib/node_modules/@stdlib/plot/components/svg/axis/lib/validators/tick_padding.js deleted file mode 100644 index ac7a62486fab..000000000000 --- a/lib/node_modules/@stdlib/plot/components/svg/axis/lib/validators/tick_padding.js +++ /dev/null @@ -1,46 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var isNonNegativeInteger = require( '@stdlib/assert/is-nonnegative-integer' ).isPrimitive; -var format = require( '@stdlib/string/format' ); - - -// MAIN // - -/** -* Validates `tickPadding`. -* -* @private -* @param {*} v - value to test -* @returns {(Error|null)} error object or null -*/ -function test( v ) { - if ( !isNonNegativeInteger( v ) ) { - return new TypeError( format( 'invalid assignment. `%s` must be a nonnegative integer. Value: `%s`.', 'tickPadding', v ) ); - } - return null; -} - - -// EXPORTS // - -module.exports = test; diff --git a/lib/node_modules/@stdlib/plot/components/svg/axis/lib/validators/tick_size.js b/lib/node_modules/@stdlib/plot/components/svg/axis/lib/validators/tick_size.js deleted file mode 100644 index 53659948533a..000000000000 --- a/lib/node_modules/@stdlib/plot/components/svg/axis/lib/validators/tick_size.js +++ /dev/null @@ -1,46 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var isNonNegativeInteger = require( '@stdlib/assert/is-nonnegative-integer' ).isPrimitive; -var format = require( '@stdlib/string/format' ); - - -// MAIN // - -/** -* Validates `tickSize`. -* -* @private -* @param {*} v - value to test -* @returns {(Error|null)} error object or null -*/ -function test( v ) { - if ( !isNonNegativeInteger( v ) ) { - return new TypeError( format( 'invalid assignment. `%s` must be a nonnegative integer. Value: `%s`.', 'tickSize', v ) ); - } - return null; -} - - -// EXPORTS // - -module.exports = test; diff --git a/lib/node_modules/@stdlib/plot/components/svg/axis/lib/validators/ticks.js b/lib/node_modules/@stdlib/plot/components/svg/axis/lib/validators/ticks.js deleted file mode 100644 index 5bdbd378332f..000000000000 --- a/lib/node_modules/@stdlib/plot/components/svg/axis/lib/validators/ticks.js +++ /dev/null @@ -1,50 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var isNull = require( '@stdlib/assert/is-null' ); -var isArray = require( '@stdlib/assert/is-array' ); -var format = require( '@stdlib/string/format' ); - - -// MAIN // - -/** -* Validates `ticks`. -* -* @private -* @param {*} v - value to test -* @returns {(Error|null)} error object or null -*/ -function test( v ) { - if ( - !isNull( v ) && - !isArray( v ) - ) { - return new TypeError( format( 'invalid assignment. `%s` must be null or an array. Value: `%s`.', 'ticks', v ) ); - } - return null; -} - - -// EXPORTS // - -module.exports = test; diff --git a/lib/node_modules/@stdlib/plot/components/svg/axis/package.json b/lib/node_modules/@stdlib/plot/components/svg/axis/package.json deleted file mode 100644 index 549278eb924e..000000000000 --- a/lib/node_modules/@stdlib/plot/components/svg/axis/package.json +++ /dev/null @@ -1,61 +0,0 @@ -{ - "name": "@stdlib/plot/components/svg/axis", - "version": "0.0.0", - "description": "Axis.", - "license": "Apache-2.0", - "author": { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - }, - "contributors": [ - { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - } - ], - "main": "./lib", - "directories": { - "example": "./examples", - "lib": "./lib" - }, - "scripts": {}, - "homepage": "https://github.com/stdlib-js/stdlib", - "repository": { - "type": "git", - "url": "git://github.com/stdlib-js/stdlib.git" - }, - "bugs": { - "url": "https://github.com/stdlib-js/stdlib/issues" - }, - "dependencies": {}, - "devDependencies": {}, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], - "keywords": [ - "stdlib", - "plot", - "graph", - "chart", - "engine", - "svg", - "scalable", - "vector", - "graphics", - "axis", - "axes", - "component" - ] -} diff --git a/lib/node_modules/@stdlib/plot/components/svg/background/examples/index.js b/lib/node_modules/@stdlib/plot/components/svg/background/examples/index.js deleted file mode 100644 index 8fe2b59a215a..000000000000 --- a/lib/node_modules/@stdlib/plot/components/svg/background/examples/index.js +++ /dev/null @@ -1,50 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -var toHTML = require( 'vdom-to-html' ); -var background = require( './../lib' ); - -// Create a new background: -var bkgd = background({ - 'width': 400, - 'height': 400, - 'autoRender': true -}); - -// Render as a virtual DOM tree: -var vtree = bkgd.render(); -console.log( JSON.stringify( vtree ) ); - -// Transform the virtual DOM tree to HTML: -var html = toHTML( vtree ); -console.log( html ); - -// Listen for 'render' events (e.g., when triggered due to changes in state): -bkgd.on( 'render', onRender ); - -setTimeout( update, 1000 ); - -function update() { - bkgd.width = 500; -} - -function onRender( vtree ) { - console.log( toHTML( vtree ) ); -} diff --git a/lib/node_modules/@stdlib/plot/components/svg/background/lib/defaults.json b/lib/node_modules/@stdlib/plot/components/svg/background/lib/defaults.json deleted file mode 100644 index 93a4318963e3..000000000000 --- a/lib/node_modules/@stdlib/plot/components/svg/background/lib/defaults.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "width": 400, - "height": 400, - "autoRender": false -} diff --git a/lib/node_modules/@stdlib/plot/components/svg/background/lib/events/events.json b/lib/node_modules/@stdlib/plot/components/svg/background/lib/events/events.json deleted file mode 100644 index de277aabe209..000000000000 --- a/lib/node_modules/@stdlib/plot/components/svg/background/lib/events/events.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "width": "change", - "height": "change", - "autoRender": "change" -} diff --git a/lib/node_modules/@stdlib/plot/components/svg/background/lib/events/index.js b/lib/node_modules/@stdlib/plot/components/svg/background/lib/events/index.js deleted file mode 100644 index ef68b2b8fdb7..000000000000 --- a/lib/node_modules/@stdlib/plot/components/svg/background/lib/events/index.js +++ /dev/null @@ -1,42 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var EVENTS = require( './events.json' ); - - -// MAIN // - -/** -* Provided a property, returns a corresponding event name for when a property value changes. -* -* @private -* @param {string} prop - property -* @returns {string} event name -*/ -function get( prop ) { - return EVENTS[ prop ]; -} - - -// EXPORTS // - -module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/components/svg/background/lib/index.js b/lib/node_modules/@stdlib/plot/components/svg/background/lib/index.js deleted file mode 100644 index 538b38a4962c..000000000000 --- a/lib/node_modules/@stdlib/plot/components/svg/background/lib/index.js +++ /dev/null @@ -1,42 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -/** -* Background. -* -* @module @stdlib/plot/components/svg/background -* -* @example -* var Background = require( '@stdlib/plot/components/svg/background' ); -* -* var bkgd = new Background({ -* 'width': 400, -* 'height': 400 -* }); -*/ - -// MODULES // - -var main = require( './main.js' ); - - -// EXPORTS // - -module.exports = main; diff --git a/lib/node_modules/@stdlib/plot/components/svg/background/lib/main.js b/lib/node_modules/@stdlib/plot/components/svg/background/lib/main.js deleted file mode 100644 index 4f9050b878f3..000000000000 --- a/lib/node_modules/@stdlib/plot/components/svg/background/lib/main.js +++ /dev/null @@ -1,233 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var EventEmitter = require( 'events' ).EventEmitter; -var logger = require( 'debug' ); -var defineProperty = require( '@stdlib/utils/define-property' ); -var setReadOnly = require( '@stdlib/utils/define-read-only-property' ); -var copy = require( '@stdlib/utils/copy' ); -var defaults = require( './defaults.json' ); -var validate = require( './validate.js' ); -var setWidth = require( './props/width/set.js' ); -var getWidth = require( './props/width/get.js' ); -var setHeight = require( './props/height/set.js' ); -var getHeight = require( './props/height/get.js' ); -var setAutoRender = require( './props/auto-render/set.js' ); -var getAutoRender = require( './props/auto-render/get.js' ); -var render = require( './methods/render.js' ); - - -// VARIABLES // - -var debug = logger( 'background:main' ); - - -// MAIN // - -/** -* Background constructor. -* -* @constructor -* @param {Options} options - constructor options -* @param {PositiveNumber} [options.width=400] - width -* @param {PositiveNumber} [options.height=400] - height -* @param {boolean} [options.autoRender=false] - indicates whether to re-render on a change event -* @throws {TypeError} must provide valid options -* @returns {Background} background instance -* -* @example -* var bkgd = new Background({ -* 'width': 500, -* 'height': 500 -* }); -*/ -function Background( options ) { - var self; - var opts; - var err; - if ( !( this instanceof Background ) ) { - return new Background( options ); - } - self = this; - opts = copy( defaults ); - err = validate( opts, options ); - if ( err ) { - throw err; - } - debug( 'Creating an instance with the following configuration: %s.', JSON.stringify( opts ) ); - EventEmitter.call( this ); - - defineProperty( this, '_width', { - 'configurable': false, - 'enumerable': false, - 'writable': true, - 'value': opts.width - }); - defineProperty( this, '_height', { - 'configurable': false, - 'enumerable': false, - 'writable': true, - 'value': opts.height - }); - defineProperty( this, '_autoRender', { - 'configurable': false, - 'enumerable': false, - 'writable': true, - 'value': opts.autoRender - }); - - this.on( 'change', onChange ); - this.on( '_render', onRender ); - - return this; - - /** - * Callback invoked upon receiving a change event. - * - * @private - */ - function onChange() { - debug( 'Received a change event.' ); - if ( self._autoRender ) { // eslint-disable-line no-underscore-dangle - self.render(); - } - } - - /** - * Re-emits a render event. - * - * @private - */ - function onRender() { - var args; - var i; - debug( 'Received a render event. Re-emitting...' ); - args = new Array( arguments.length+1 ); - args[ 0 ] = 'render'; - for ( i = 0; i < arguments.length; i++ ) { - args[ i+1 ] = arguments[ i ]; - } - self.emit.apply( self, args ); - } -} - -/* -* Create a prototype which inherits from the parent prototype. -*/ -Background.prototype = Object.create( EventEmitter.prototype ); - -/* -* Set the constructor. -*/ -Background.prototype.constructor = Background; - -/** -* Width. -* -* @name width -* @memberof Background.prototype -* @type {PositiveNumber} -* @throws {TypeError} must be a positive number -* @default 400 -* -* @example -* var bkgd = new Background({ -* 'width': 500 -* }); -* -* var width = bkgd.width; -* // returns 500 -*/ -defineProperty( Background.prototype, 'width', { - 'configurable': false, - 'enumerable': true, - 'set': setWidth, - 'get': getWidth -}); - -/** -* Height. -* -* @name height -* @memberof Background.prototype -* @type {PositiveNumber} -* @throws {TypeError} must be a positive number -* @default 400 -* -* @example -* var bkgd = new Background({ -* 'height': 500 -* }); -* -* var height = bkgd.height; -* // returns 500 -*/ -defineProperty( Background.prototype, 'height', { - 'configurable': false, - 'enumerable': true, - 'set': setHeight, - 'get': getHeight -}); - -/** -* Rendering mode. If `true`, an instance re-renders on each change event. -* -* @name autoRender -* @memberof Background.prototype -* @type {boolean} -* @throws {TypeError} must be a boolean -* @default false -* -* @example -* var bkgd = new Background({ -* 'autoRender': true -* }); -* -* var mode = bkgd.autoRender; -* // returns true -*/ -defineProperty( Background.prototype, 'autoRender', { - 'configurable': false, - 'enumerable': true, - 'set': setAutoRender, - 'get': getAutoRender -}); - -/** -* Renders a virtual DOM tree. -* -* @name render -* @memberof Background.prototype -* @type {Function} -* @returns {VTree} virtual tree -* -* @example -* var bkgd = new Background(); -* -* var out = bkgd.render(); -*/ -setReadOnly( Background.prototype, 'render', render ); - - -// EXPORTS // - -module.exports = Background; diff --git a/lib/node_modules/@stdlib/plot/components/svg/background/lib/methods/render.js b/lib/node_modules/@stdlib/plot/components/svg/background/lib/methods/render.js deleted file mode 100644 index c924b42881b1..000000000000 --- a/lib/node_modules/@stdlib/plot/components/svg/background/lib/methods/render.js +++ /dev/null @@ -1,72 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); -var h = require( 'virtual-dom/h.js' ); - - -// VARIABLES // - -var debug = logger( 'background:render' ); -var ELEMENT = 'rect'; - - -// MAIN // - -/** -* Renders a virtual DOM tree. -* -* @private -* @returns {VTree} virtual DOM tree -*/ -function render() { - /* eslint-disable no-invalid-this */ - var props; - var vtree; - - debug( 'Rendering...' ); - - props = { - 'namespace': 'http://www.w3.org/2000/svg', - 'className': 'background', - 'attributes': { - 'x': 0, - 'y': 0, - 'width': this.width, - 'height': this.height, - 'fill': 'none', - 'stroke': 'none' - } - }; - debug( 'Generating a virtual DOM tree (%s) with properties: %s.', ELEMENT, JSON.stringify( props ) ); - vtree = h( ELEMENT, props, [] ); - - // Announce that a new tree has been rendered: - this.emit( '_render', vtree ); - - return vtree; -} - - -// EXPORTS // - -module.exports = render; diff --git a/lib/node_modules/@stdlib/plot/components/svg/background/lib/props/auto-render/get.js b/lib/node_modules/@stdlib/plot/components/svg/background/lib/props/auto-render/get.js deleted file mode 100644 index 7df40dec3f47..000000000000 --- a/lib/node_modules/@stdlib/plot/components/svg/background/lib/props/auto-render/get.js +++ /dev/null @@ -1,35 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -/** -* Returns the rendering mode. -* -* @private -* @returns {boolean} rendering mode -*/ -function get() { - /* eslint-disable no-invalid-this */ - return this._autoRender; -} - - -// EXPORTS // - -module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/components/svg/background/lib/props/auto-render/set.js b/lib/node_modules/@stdlib/plot/components/svg/background/lib/props/auto-render/set.js deleted file mode 100644 index b1097de03c37..000000000000 --- a/lib/node_modules/@stdlib/plot/components/svg/background/lib/props/auto-render/set.js +++ /dev/null @@ -1,60 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); -var events = require( './../../events' ); -var isValid = require( './../../validators/auto_render.js' ); - - -// VARIABLES // - -var debug = logger( 'background:set:auto-render' ); -var CHANGE_EVENT = events( 'autoRender' ); - - -// MAIN // - -/** -* Sets the rendering mode. -* -* @private -* @param {boolean} bool - boolean indicating whether to re-render on a change event -* @throws {TypeError} must be a positive number -*/ -function set( bool ) { - /* eslint-disable no-invalid-this */ - var err = isValid( bool ); - if ( err ) { - throw err; - } - debug( 'Current value: %d.', this._autoRender ); - - this._autoRender = bool; - debug( 'New Value: %d.', this._autoRender ); - - this.emit( CHANGE_EVENT ); -} - - -// EXPORTS // - -module.exports = set; diff --git a/lib/node_modules/@stdlib/plot/components/svg/background/lib/props/height/get.js b/lib/node_modules/@stdlib/plot/components/svg/background/lib/props/height/get.js deleted file mode 100644 index 64bcb891b201..000000000000 --- a/lib/node_modules/@stdlib/plot/components/svg/background/lib/props/height/get.js +++ /dev/null @@ -1,35 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -/** -* Returns the height. -* -* @private -* @returns {number} height -*/ -function get() { - /* eslint-disable no-invalid-this */ - return this._height; -} - - -// EXPORTS // - -module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/components/svg/background/lib/props/height/set.js b/lib/node_modules/@stdlib/plot/components/svg/background/lib/props/height/set.js deleted file mode 100644 index ef83a9918d9f..000000000000 --- a/lib/node_modules/@stdlib/plot/components/svg/background/lib/props/height/set.js +++ /dev/null @@ -1,60 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); -var events = require( './../../events' ); -var isValid = require( './../../validators/height.js' ); - - -// VARIABLES // - -var debug = logger( 'background:set:height' ); -var CHANGE_EVENT = events( 'height' ); - - -// MAIN // - -/** -* Sets the height. -* -* @private -* @param {PositiveNumber} height - height -* @throws {TypeError} must be a positive number -*/ -function set( height ) { - /* eslint-disable no-invalid-this */ - var err = isValid( height ); - if ( err ) { - throw err; - } - debug( 'Current value: %d.', this._height ); - - this._height = height; - debug( 'New Value: %d.', this._height ); - - this.emit( CHANGE_EVENT ); -} - - -// EXPORTS // - -module.exports = set; diff --git a/lib/node_modules/@stdlib/plot/components/svg/background/lib/props/width/get.js b/lib/node_modules/@stdlib/plot/components/svg/background/lib/props/width/get.js deleted file mode 100644 index cfa5f0e70adf..000000000000 --- a/lib/node_modules/@stdlib/plot/components/svg/background/lib/props/width/get.js +++ /dev/null @@ -1,35 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -/** -* Returns the width. -* -* @private -* @returns {number} width -*/ -function get() { - /* eslint-disable no-invalid-this */ - return this._width; -} - - -// EXPORTS // - -module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/components/svg/background/lib/props/width/set.js b/lib/node_modules/@stdlib/plot/components/svg/background/lib/props/width/set.js deleted file mode 100644 index 17b609743823..000000000000 --- a/lib/node_modules/@stdlib/plot/components/svg/background/lib/props/width/set.js +++ /dev/null @@ -1,60 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); -var events = require( './../../events' ); -var isValid = require( './../../validators/width.js' ); - - -// VARIABLES // - -var debug = logger( 'background:set:width' ); -var CHANGE_EVENT = events( 'width' ); - - -// MAIN // - -/** -* Sets the width. -* -* @private -* @param {PositiveNumber} width - width -* @throws {TypeError} must be a positive number -*/ -function set( width ) { - /* eslint-disable no-invalid-this */ - var err = isValid( width ); - if ( err ) { - throw err; - } - debug( 'Current value: %d.', this._width ); - - this._width = width; - debug( 'New value: %d.', this._width ); - - this.emit( CHANGE_EVENT ); -} - - -// EXPORTS // - -module.exports = set; diff --git a/lib/node_modules/@stdlib/plot/components/svg/background/lib/validate.js b/lib/node_modules/@stdlib/plot/components/svg/background/lib/validate.js deleted file mode 100644 index 311756cdcf36..000000000000 --- a/lib/node_modules/@stdlib/plot/components/svg/background/lib/validate.js +++ /dev/null @@ -1,84 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var objectKeys = require( '@stdlib/utils/keys' ); -var isObject = require( '@stdlib/assert/is-plain-object' ); -var hasOwnProp = require( '@stdlib/assert/has-own-property' ); -var format = require( '@stdlib/string/format' ); -var validators = require( './validators' ); - - -// VARIABLES // - -var KEYS = objectKeys( validators ); - - -// MAIN // - -/** -* Validates function options. -* -* @private -* @param {Object} opts - destination object -* @param {Options} options - function options -* @param {PositiveNumber} [options.width] - width -* @param {PositiveNumber} [options.height] - height -* @param {boolean} [options.autoRender] - indicates whether to re-render on a change event -* @returns {(Error|null)} error or null -* -* @example -* var opts = {}; -* var options = { -* 'width': 400, -* 'height': 400 -* }; -* var err = validate( opts, options ); -* if ( err ) { -* throw err; -* } -*/ -function validate( opts, options ) { - var err; - var key; - var val; - var i; - if ( !isObject( options ) ) { - return new TypeError( format( 'invalid argument. Options argument must be an object. Value: `%s`.', options ) ); - } - for ( i = 0; i < KEYS.length; i++ ) { - key = KEYS[ i ]; - if ( hasOwnProp( options, key ) ) { - val = options[ key ]; - err = validators[ key ]( val ); - if ( err ) { - return err; - } - opts[ key ] = val; - } - } - return null; -} - - -// EXPORTS // - -module.exports = validate; diff --git a/lib/node_modules/@stdlib/plot/components/svg/background/lib/validators/auto_render.js b/lib/node_modules/@stdlib/plot/components/svg/background/lib/validators/auto_render.js deleted file mode 100644 index 08da79ff51a6..000000000000 --- a/lib/node_modules/@stdlib/plot/components/svg/background/lib/validators/auto_render.js +++ /dev/null @@ -1,46 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var isBoolean = require( '@stdlib/assert/is-boolean' ).isPrimitive; -var format = require( '@stdlib/string/format' ); - - -// MAIN // - -/** -* Validates `autoRender`. -* -* @private -* @param {*} v - value to test -* @returns {(Error|null)} error object or null -*/ -function test( v ) { - if ( !isBoolean( v ) ) { - return new TypeError( format( 'invalid assignment. `%s` must be a boolean. Value: `%s`.', 'autoRender', v ) ); - } - return null; -} - - -// EXPORTS // - -module.exports = test; diff --git a/lib/node_modules/@stdlib/plot/components/svg/background/lib/validators/height.js b/lib/node_modules/@stdlib/plot/components/svg/background/lib/validators/height.js deleted file mode 100644 index 82ea73cef0cc..000000000000 --- a/lib/node_modules/@stdlib/plot/components/svg/background/lib/validators/height.js +++ /dev/null @@ -1,46 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var isPositiveNumber = require( '@stdlib/assert/is-positive-number' ).isPrimitive; -var format = require( '@stdlib/string/format' ); - - -// MAIN // - -/** -* Validates `height`. -* -* @private -* @param {*} v - value to test -* @returns {(Error|null)} error object or null -*/ -function test( v ) { - if ( !isPositiveNumber( v ) ) { - return new TypeError( format( 'invalid assignment. `%s` must be a positive number. Value: `%s`.', 'height', v ) ); - } - return null; -} - - -// EXPORTS // - -module.exports = test; diff --git a/lib/node_modules/@stdlib/plot/components/svg/background/lib/validators/index.js b/lib/node_modules/@stdlib/plot/components/svg/background/lib/validators/index.js deleted file mode 100644 index 9ab29fd15f97..000000000000 --- a/lib/node_modules/@stdlib/plot/components/svg/background/lib/validators/index.js +++ /dev/null @@ -1,39 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var width = require( './width.js' ); -var height = require( './height.js' ); -var autoRender = require( './auto_render.js' ); - - -// MAIN // - -var validators = { - 'width': width, - 'height': height, - 'autoRender': autoRender -}; - - -// EXPORTS // - -module.exports = validators; diff --git a/lib/node_modules/@stdlib/plot/components/svg/background/lib/validators/width.js b/lib/node_modules/@stdlib/plot/components/svg/background/lib/validators/width.js deleted file mode 100644 index e6d8f774bf4f..000000000000 --- a/lib/node_modules/@stdlib/plot/components/svg/background/lib/validators/width.js +++ /dev/null @@ -1,46 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var isPositiveNumber = require( '@stdlib/assert/is-positive-number' ).isPrimitive; -var format = require( '@stdlib/string/format' ); - - -// MAIN // - -/** -* Validates `width`. -* -* @private -* @param {*} v - value to test -* @returns {(Error|null)} error object or null -*/ -function test( v ) { - if ( !isPositiveNumber( v ) ) { - return new TypeError( format( 'invalid assignment. `%s` must be a positive number. Value: `%s`.', 'width', v ) ); - } - return null; -} - - -// EXPORTS // - -module.exports = test; diff --git a/lib/node_modules/@stdlib/plot/components/svg/background/package.json b/lib/node_modules/@stdlib/plot/components/svg/background/package.json deleted file mode 100644 index 91e1169836a1..000000000000 --- a/lib/node_modules/@stdlib/plot/components/svg/background/package.json +++ /dev/null @@ -1,61 +0,0 @@ -{ - "name": "@stdlib/plot/components/svg/background", - "version": "0.0.0", - "description": "SVG background.", - "license": "Apache-2.0", - "author": { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - }, - "contributors": [ - { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - } - ], - "main": "./lib", - "directories": { - "example": "./examples", - "lib": "./lib" - }, - "scripts": {}, - "homepage": "https://github.com/stdlib-js/stdlib", - "repository": { - "type": "git", - "url": "git://github.com/stdlib-js/stdlib.git" - }, - "bugs": { - "url": "https://github.com/stdlib-js/stdlib/issues" - }, - "dependencies": {}, - "devDependencies": {}, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], - "keywords": [ - "stdlib", - "plot", - "graph", - "chart", - "engine", - "svg", - "scalable", - "vector", - "graphics", - "background", - "bkgd", - "component" - ] -} diff --git a/lib/node_modules/@stdlib/plot/components/svg/canvas/examples/index.js b/lib/node_modules/@stdlib/plot/components/svg/canvas/examples/index.js deleted file mode 100644 index a95a9b9d9fd3..000000000000 --- a/lib/node_modules/@stdlib/plot/components/svg/canvas/examples/index.js +++ /dev/null @@ -1,50 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -var toHTML = require( 'vdom-to-html' ); -var canvas = require( './../lib' ); - -// Create a new canvas: -var node = canvas({ - 'width': 400, - 'height': 400, - 'autoRender': true -}); - -// Render as a virtual DOM tree: -var vtree = node.render(); -console.log( JSON.stringify( vtree ) ); - -// Transform the virtual DOM tree to HTML: -var html = toHTML( vtree ); -console.log( html ); - -// Listen for 'render' events (e.g., when triggered due to changes in state): -node.on( 'render', onRender ); - -setTimeout( update, 1000 ); - -function update() { - node.width = 500; -} - -function onRender( vtree ) { - console.log( toHTML( vtree ) ); -} diff --git a/lib/node_modules/@stdlib/plot/components/svg/canvas/lib/defaults.json b/lib/node_modules/@stdlib/plot/components/svg/canvas/lib/defaults.json deleted file mode 100644 index 93a4318963e3..000000000000 --- a/lib/node_modules/@stdlib/plot/components/svg/canvas/lib/defaults.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "width": 400, - "height": 400, - "autoRender": false -} diff --git a/lib/node_modules/@stdlib/plot/components/svg/canvas/lib/events/events.json b/lib/node_modules/@stdlib/plot/components/svg/canvas/lib/events/events.json deleted file mode 100644 index de277aabe209..000000000000 --- a/lib/node_modules/@stdlib/plot/components/svg/canvas/lib/events/events.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "width": "change", - "height": "change", - "autoRender": "change" -} diff --git a/lib/node_modules/@stdlib/plot/components/svg/canvas/lib/events/index.js b/lib/node_modules/@stdlib/plot/components/svg/canvas/lib/events/index.js deleted file mode 100644 index ef68b2b8fdb7..000000000000 --- a/lib/node_modules/@stdlib/plot/components/svg/canvas/lib/events/index.js +++ /dev/null @@ -1,42 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var EVENTS = require( './events.json' ); - - -// MAIN // - -/** -* Provided a property, returns a corresponding event name for when a property value changes. -* -* @private -* @param {string} prop - property -* @returns {string} event name -*/ -function get( prop ) { - return EVENTS[ prop ]; -} - - -// EXPORTS // - -module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/components/svg/canvas/lib/index.js b/lib/node_modules/@stdlib/plot/components/svg/canvas/lib/index.js deleted file mode 100644 index 97a74a84efe7..000000000000 --- a/lib/node_modules/@stdlib/plot/components/svg/canvas/lib/index.js +++ /dev/null @@ -1,42 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -/** -* Canvas. -* -* @module @stdlib/plot/components/svg/canvas -* -* @example -* var Canvas = require( '@stdlib/plot/components/svg/canvas' ); -* -* var canvas = new Canvas({ -* 'width': 400, -* 'height': 400 -* }); -*/ - -// MODULES // - -var main = require( './main.js' ); - - -// EXPORTS // - -module.exports = main; diff --git a/lib/node_modules/@stdlib/plot/components/svg/canvas/lib/main.js b/lib/node_modules/@stdlib/plot/components/svg/canvas/lib/main.js deleted file mode 100644 index bfee5378b671..000000000000 --- a/lib/node_modules/@stdlib/plot/components/svg/canvas/lib/main.js +++ /dev/null @@ -1,233 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var EventEmitter = require( 'events' ).EventEmitter; -var logger = require( 'debug' ); -var defineProperty = require( '@stdlib/utils/define-property' ); -var setReadOnly = require( '@stdlib/utils/define-read-only-property' ); -var copy = require( '@stdlib/utils/copy' ); -var defaults = require( './defaults.json' ); -var validate = require( './validate.js' ); -var setWidth = require( './props/width/set.js' ); -var getWidth = require( './props/width/get.js' ); -var setHeight = require( './props/height/set.js' ); -var getHeight = require( './props/height/get.js' ); -var setAutoRender = require( './props/auto-render/set.js' ); -var getAutoRender = require( './props/auto-render/get.js' ); -var render = require( './methods/render.js' ); - - -// VARIABLES // - -var debug = logger( 'canvas:main' ); - - -// MAIN // - -/** -* Canvas constructor. -* -* @constructor -* @param {Options} options - constructor options -* @param {PositiveNumber} [options.width=400] - width -* @param {PositiveNumber} [options.height=400] - height -* @param {boolean} [options.autoRender=false] - indicates whether to re-render on a change event -* @throws {TypeError} must provide valid options -* @returns {Canvas} canvas instance -* -* @example -* var canvas = new Canvas({ -* 'width': 500, -* 'height': 500 -* }); -*/ -function Canvas( options ) { - var self; - var opts; - var err; - if ( !( this instanceof Canvas ) ) { - return new Canvas( options ); - } - self = this; - opts = copy( defaults ); - err = validate( opts, options ); - if ( err ) { - throw err; - } - debug( 'Creating an instance with the following configuration: %s.', JSON.stringify( opts ) ); - EventEmitter.call( this ); - - defineProperty( this, '_width', { - 'configurable': false, - 'enumerable': false, - 'writable': true, - 'value': opts.width - }); - defineProperty( this, '_height', { - 'configurable': false, - 'enumerable': false, - 'writable': true, - 'value': opts.height - }); - defineProperty( this, '_autoRender', { - 'configurable': false, - 'enumerable': false, - 'writable': true, - 'value': opts.autoRender - }); - - this.on( 'change', onChange ); - this.on( '_render', onRender ); - - return this; - - /** - * Callback invoked upon receiving a change event. - * - * @private - */ - function onChange() { - debug( 'Received a change event.' ); - if ( self._autoRender ) { // eslint-disable-line no-underscore-dangle - self.render(); - } - } - - /** - * Re-emits a render event. - * - * @private - */ - function onRender() { - var args; - var i; - debug( 'Received a render event. Re-emitting...' ); - args = new Array( arguments.length+1 ); - args[ 0 ] = 'render'; - for ( i = 0; i < arguments.length; i++ ) { - args[ i+1 ] = arguments[ i ]; - } - self.emit.apply( self, args ); - } -} - -/* -* Create a prototype which inherits from the parent prototype. -*/ -Canvas.prototype = Object.create( EventEmitter.prototype ); - -/* -* Set the constructor. -*/ -Canvas.prototype.constructor = Canvas; - -/** -* Width. -* -* @name width -* @memberof Canvas.prototype -* @type {PositiveNumber} -* @throws {TypeError} must be a positive number -* @default 400 -* -* @example -* var canvas = new Canvas({ -* 'width': 500 -* }); -* -* var width = canvas.width; -* // returns 500 -*/ -defineProperty( Canvas.prototype, 'width', { - 'configurable': false, - 'enumerable': true, - 'set': setWidth, - 'get': getWidth -}); - -/** -* Height. -* -* @name height -* @memberof Canvas.prototype -* @type {PositiveNumber} -* @throws {TypeError} must be a positive number -* @default 400 -* -* @example -* var canvas = new Canvas({ -* 'height': 500 -* }); -* -* var height = canvas.height; -* // returns 500 -*/ -defineProperty( Canvas.prototype, 'height', { - 'configurable': false, - 'enumerable': true, - 'set': setHeight, - 'get': getHeight -}); - -/** -* Rendering mode. If `true`, an instance re-renders on each change event. -* -* @name autoRender -* @memberof Canvas.prototype -* @type {boolean} -* @throws {TypeError} must be a boolean -* @default false -* -* @example -* var canvas = new Canvas({ -* 'autoRender': true -* }); -* -* var mode = canvas.autoRender; -* // returns true -*/ -defineProperty( Canvas.prototype, 'autoRender', { - 'configurable': false, - 'enumerable': true, - 'set': setAutoRender, - 'get': getAutoRender -}); - -/** -* Renders a virtual DOM tree. -* -* @name render -* @memberof Canvas.prototype -* @type {Function} -* @returns {VTree} virtual tree -* -* @example -* var canvas = new Canvas({}); -* -* var out = canvas.render(); -*/ -setReadOnly( Canvas.prototype, 'render', render ); - - -// EXPORTS // - -module.exports = Canvas; diff --git a/lib/node_modules/@stdlib/plot/components/svg/canvas/lib/methods/render.js b/lib/node_modules/@stdlib/plot/components/svg/canvas/lib/methods/render.js deleted file mode 100644 index f7ec8841bf45..000000000000 --- a/lib/node_modules/@stdlib/plot/components/svg/canvas/lib/methods/render.js +++ /dev/null @@ -1,69 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); -var h = require( 'virtual-dom/h.js' ); - - -// VARIABLES // - -var debug = logger( 'canvas:render' ); -var ELEMENT = 'svg'; - - -// MAIN // - -/** -* Renders a virtual DOM tree. -* -* @private -* @returns {VTree} virtual DOM tree -*/ -function render() { - /* eslint-disable no-invalid-this */ - var props; - var vtree; - - debug( 'Rendering...' ); - - props = { - 'namespace': 'http://www.w3.org/2000/svg', - 'property': 'canvas', - 'className': 'canvas', - 'attributes': { - 'width': this.width, - 'height': this.height - } - }; - debug( 'Generating a virtual DOM tree (%s) with properties: %s.', ELEMENT, JSON.stringify( props ) ); - vtree = h( ELEMENT, props, [] ); - - // Announce that a new tree has been rendered: - this.emit( '_render', vtree ); - - return vtree; -} - - -// EXPORTS // - -module.exports = render; diff --git a/lib/node_modules/@stdlib/plot/components/svg/canvas/lib/props/auto-render/get.js b/lib/node_modules/@stdlib/plot/components/svg/canvas/lib/props/auto-render/get.js deleted file mode 100644 index 7df40dec3f47..000000000000 --- a/lib/node_modules/@stdlib/plot/components/svg/canvas/lib/props/auto-render/get.js +++ /dev/null @@ -1,35 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -/** -* Returns the rendering mode. -* -* @private -* @returns {boolean} rendering mode -*/ -function get() { - /* eslint-disable no-invalid-this */ - return this._autoRender; -} - - -// EXPORTS // - -module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/components/svg/canvas/lib/props/auto-render/set.js b/lib/node_modules/@stdlib/plot/components/svg/canvas/lib/props/auto-render/set.js deleted file mode 100644 index 21191762f48a..000000000000 --- a/lib/node_modules/@stdlib/plot/components/svg/canvas/lib/props/auto-render/set.js +++ /dev/null @@ -1,60 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); -var events = require( './../../events' ); -var isValid = require( './../../validators/auto_render.js' ); - - -// VARIABLES // - -var debug = logger( 'canvas:set:auto-render' ); -var CHANGE_EVENT = events( 'autoRender' ); - - -// MAIN // - -/** -* Sets the rendering mode. -* -* @private -* @param {boolean} bool - boolean indicating whether to re-render on a change event -* @throws {TypeError} must be a positive number -*/ -function set( bool ) { - /* eslint-disable no-invalid-this */ - var err = isValid( bool ); - if ( err ) { - throw err; - } - debug( 'Current value: %d.', this._autoRender ); - - this._autoRender = bool; - debug( 'New Value: %d.', this._autoRender ); - - this.emit( CHANGE_EVENT ); -} - - -// EXPORTS // - -module.exports = set; diff --git a/lib/node_modules/@stdlib/plot/components/svg/canvas/lib/props/height/get.js b/lib/node_modules/@stdlib/plot/components/svg/canvas/lib/props/height/get.js deleted file mode 100644 index 64bcb891b201..000000000000 --- a/lib/node_modules/@stdlib/plot/components/svg/canvas/lib/props/height/get.js +++ /dev/null @@ -1,35 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -/** -* Returns the height. -* -* @private -* @returns {number} height -*/ -function get() { - /* eslint-disable no-invalid-this */ - return this._height; -} - - -// EXPORTS // - -module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/components/svg/canvas/lib/props/height/set.js b/lib/node_modules/@stdlib/plot/components/svg/canvas/lib/props/height/set.js deleted file mode 100644 index 3fa9530dfa3a..000000000000 --- a/lib/node_modules/@stdlib/plot/components/svg/canvas/lib/props/height/set.js +++ /dev/null @@ -1,60 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); -var events = require( './../../events' ); -var isValid = require( './../../validators/height.js' ); - - -// VARIABLES // - -var debug = logger( 'canvas:set:height' ); -var CHANGE_EVENT = events( 'height' ); - - -// MAIN // - -/** -* Sets the height. -* -* @private -* @param {PositiveNumber} height - height -* @throws {TypeError} must be a positive number -*/ -function set( height ) { - /* eslint-disable no-invalid-this */ - var err = isValid( height ); - if ( err ) { - throw err; - } - debug( 'Current value: %d.', this._height ); - - this._height = height; - debug( 'New Value: %d.', this._height ); - - this.emit( CHANGE_EVENT ); -} - - -// EXPORTS // - -module.exports = set; diff --git a/lib/node_modules/@stdlib/plot/components/svg/canvas/lib/props/width/get.js b/lib/node_modules/@stdlib/plot/components/svg/canvas/lib/props/width/get.js deleted file mode 100644 index cfa5f0e70adf..000000000000 --- a/lib/node_modules/@stdlib/plot/components/svg/canvas/lib/props/width/get.js +++ /dev/null @@ -1,35 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -/** -* Returns the width. -* -* @private -* @returns {number} width -*/ -function get() { - /* eslint-disable no-invalid-this */ - return this._width; -} - - -// EXPORTS // - -module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/components/svg/canvas/lib/props/width/set.js b/lib/node_modules/@stdlib/plot/components/svg/canvas/lib/props/width/set.js deleted file mode 100644 index 5fb581d8d855..000000000000 --- a/lib/node_modules/@stdlib/plot/components/svg/canvas/lib/props/width/set.js +++ /dev/null @@ -1,60 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); -var events = require( './../../events' ); -var isValid = require( './../../validators/width.js' ); - - -// VARIABLES // - -var debug = logger( 'canvas:set:width' ); -var CHANGE_EVENT = events( 'width' ); - - -// MAIN // - -/** -* Sets the width. -* -* @private -* @param {PositiveNumber} width - width -* @throws {TypeError} must be a positive number -*/ -function set( width ) { - /* eslint-disable no-invalid-this */ - var err = isValid( width ); - if ( err ) { - throw err; - } - debug( 'Current value: %d.', this._width ); - - this._width = width; - debug( 'New value: %d.', this._width ); - - this.emit( CHANGE_EVENT ); -} - - -// EXPORTS // - -module.exports = set; diff --git a/lib/node_modules/@stdlib/plot/components/svg/canvas/lib/validate.js b/lib/node_modules/@stdlib/plot/components/svg/canvas/lib/validate.js deleted file mode 100644 index 311756cdcf36..000000000000 --- a/lib/node_modules/@stdlib/plot/components/svg/canvas/lib/validate.js +++ /dev/null @@ -1,84 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var objectKeys = require( '@stdlib/utils/keys' ); -var isObject = require( '@stdlib/assert/is-plain-object' ); -var hasOwnProp = require( '@stdlib/assert/has-own-property' ); -var format = require( '@stdlib/string/format' ); -var validators = require( './validators' ); - - -// VARIABLES // - -var KEYS = objectKeys( validators ); - - -// MAIN // - -/** -* Validates function options. -* -* @private -* @param {Object} opts - destination object -* @param {Options} options - function options -* @param {PositiveNumber} [options.width] - width -* @param {PositiveNumber} [options.height] - height -* @param {boolean} [options.autoRender] - indicates whether to re-render on a change event -* @returns {(Error|null)} error or null -* -* @example -* var opts = {}; -* var options = { -* 'width': 400, -* 'height': 400 -* }; -* var err = validate( opts, options ); -* if ( err ) { -* throw err; -* } -*/ -function validate( opts, options ) { - var err; - var key; - var val; - var i; - if ( !isObject( options ) ) { - return new TypeError( format( 'invalid argument. Options argument must be an object. Value: `%s`.', options ) ); - } - for ( i = 0; i < KEYS.length; i++ ) { - key = KEYS[ i ]; - if ( hasOwnProp( options, key ) ) { - val = options[ key ]; - err = validators[ key ]( val ); - if ( err ) { - return err; - } - opts[ key ] = val; - } - } - return null; -} - - -// EXPORTS // - -module.exports = validate; diff --git a/lib/node_modules/@stdlib/plot/components/svg/canvas/lib/validators/auto_render.js b/lib/node_modules/@stdlib/plot/components/svg/canvas/lib/validators/auto_render.js deleted file mode 100644 index 08da79ff51a6..000000000000 --- a/lib/node_modules/@stdlib/plot/components/svg/canvas/lib/validators/auto_render.js +++ /dev/null @@ -1,46 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var isBoolean = require( '@stdlib/assert/is-boolean' ).isPrimitive; -var format = require( '@stdlib/string/format' ); - - -// MAIN // - -/** -* Validates `autoRender`. -* -* @private -* @param {*} v - value to test -* @returns {(Error|null)} error object or null -*/ -function test( v ) { - if ( !isBoolean( v ) ) { - return new TypeError( format( 'invalid assignment. `%s` must be a boolean. Value: `%s`.', 'autoRender', v ) ); - } - return null; -} - - -// EXPORTS // - -module.exports = test; diff --git a/lib/node_modules/@stdlib/plot/components/svg/canvas/lib/validators/height.js b/lib/node_modules/@stdlib/plot/components/svg/canvas/lib/validators/height.js deleted file mode 100644 index 82ea73cef0cc..000000000000 --- a/lib/node_modules/@stdlib/plot/components/svg/canvas/lib/validators/height.js +++ /dev/null @@ -1,46 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var isPositiveNumber = require( '@stdlib/assert/is-positive-number' ).isPrimitive; -var format = require( '@stdlib/string/format' ); - - -// MAIN // - -/** -* Validates `height`. -* -* @private -* @param {*} v - value to test -* @returns {(Error|null)} error object or null -*/ -function test( v ) { - if ( !isPositiveNumber( v ) ) { - return new TypeError( format( 'invalid assignment. `%s` must be a positive number. Value: `%s`.', 'height', v ) ); - } - return null; -} - - -// EXPORTS // - -module.exports = test; diff --git a/lib/node_modules/@stdlib/plot/components/svg/canvas/lib/validators/index.js b/lib/node_modules/@stdlib/plot/components/svg/canvas/lib/validators/index.js deleted file mode 100644 index 9ab29fd15f97..000000000000 --- a/lib/node_modules/@stdlib/plot/components/svg/canvas/lib/validators/index.js +++ /dev/null @@ -1,39 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var width = require( './width.js' ); -var height = require( './height.js' ); -var autoRender = require( './auto_render.js' ); - - -// MAIN // - -var validators = { - 'width': width, - 'height': height, - 'autoRender': autoRender -}; - - -// EXPORTS // - -module.exports = validators; diff --git a/lib/node_modules/@stdlib/plot/components/svg/canvas/lib/validators/width.js b/lib/node_modules/@stdlib/plot/components/svg/canvas/lib/validators/width.js deleted file mode 100644 index e6d8f774bf4f..000000000000 --- a/lib/node_modules/@stdlib/plot/components/svg/canvas/lib/validators/width.js +++ /dev/null @@ -1,46 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var isPositiveNumber = require( '@stdlib/assert/is-positive-number' ).isPrimitive; -var format = require( '@stdlib/string/format' ); - - -// MAIN // - -/** -* Validates `width`. -* -* @private -* @param {*} v - value to test -* @returns {(Error|null)} error object or null -*/ -function test( v ) { - if ( !isPositiveNumber( v ) ) { - return new TypeError( format( 'invalid assignment. `%s` must be a positive number. Value: `%s`.', 'width', v ) ); - } - return null; -} - - -// EXPORTS // - -module.exports = test; diff --git a/lib/node_modules/@stdlib/plot/components/svg/canvas/package.json b/lib/node_modules/@stdlib/plot/components/svg/canvas/package.json deleted file mode 100644 index a40cda12fbd4..000000000000 --- a/lib/node_modules/@stdlib/plot/components/svg/canvas/package.json +++ /dev/null @@ -1,60 +0,0 @@ -{ - "name": "@stdlib/plot/components/svg/canvas", - "version": "0.0.0", - "description": "SVG canvas.", - "license": "Apache-2.0", - "author": { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - }, - "contributors": [ - { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - } - ], - "main": "./lib", - "directories": { - "example": "./examples", - "lib": "./lib" - }, - "scripts": {}, - "homepage": "https://github.com/stdlib-js/stdlib", - "repository": { - "type": "git", - "url": "git://github.com/stdlib-js/stdlib.git" - }, - "bugs": { - "url": "https://github.com/stdlib-js/stdlib/issues" - }, - "dependencies": {}, - "devDependencies": {}, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], - "keywords": [ - "stdlib", - "plot", - "graph", - "chart", - "engine", - "svg", - "scalable", - "vector", - "graphics", - "canvas", - "component" - ] -} diff --git a/lib/node_modules/@stdlib/plot/components/svg/clip-path/examples/index.js b/lib/node_modules/@stdlib/plot/components/svg/clip-path/examples/index.js deleted file mode 100644 index 45fbc5c350dd..000000000000 --- a/lib/node_modules/@stdlib/plot/components/svg/clip-path/examples/index.js +++ /dev/null @@ -1,51 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -var toHTML = require( 'vdom-to-html' ); -var clipPath = require( './../lib' ); - -// Create a new clipPath: -var cp = clipPath({ - 'width': 400, - 'height': 400, - 'id': '1234', - 'autoRender': true -}); - -// Render as a virtual DOM tree: -var vtree = cp.render(); -console.log( JSON.stringify( vtree ) ); - -// Transform the virtual DOM tree to HTML: -var html = toHTML( vtree ); -console.log( html ); - -// Listen for 'render' events (e.g., when triggered due to changes in state): -cp.on( 'render', onRender ); - -setTimeout( update, 1000 ); - -function update() { - cp.id = '4321'; -} - -function onRender( vtree ) { - console.log( toHTML( vtree ) ); -} diff --git a/lib/node_modules/@stdlib/plot/components/svg/clip-path/lib/components/index.js b/lib/node_modules/@stdlib/plot/components/svg/clip-path/lib/components/index.js deleted file mode 100644 index 8226c92ab783..000000000000 --- a/lib/node_modules/@stdlib/plot/components/svg/clip-path/lib/components/index.js +++ /dev/null @@ -1,65 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); -var h = require( 'virtual-dom/h.js' ); -var rect = require( './rect.js' ); - - -// VARIABLES // - -var debug = logger( 'clippath:components:main' ); -var ELEMENT = 'clipPath'; - - -// MAIN // - -/** -* Renders a clipping path. -* -* @private -* @param {Object} ctx - context -* @returns {VTree} virtual tree -*/ -function render( ctx ) { - var children; - var props; - - props = { - 'namespace': 'http://www.w3.org/2000/svg', - 'id': ctx.id - }; - - debug( 'Rendering clipping path rectangle...' ); - children = [ - rect( ctx ) - ]; - - debug( 'Generating a virtual DOM tree (%s) with properties: %s.', ELEMENT, JSON.stringify( props ) ); - - return h( ELEMENT, props, children ); -} - - -// EXPORTS // - -module.exports = render; diff --git a/lib/node_modules/@stdlib/plot/components/svg/clip-path/lib/components/rect.js b/lib/node_modules/@stdlib/plot/components/svg/clip-path/lib/components/rect.js deleted file mode 100644 index e1387d8b1979..000000000000 --- a/lib/node_modules/@stdlib/plot/components/svg/clip-path/lib/components/rect.js +++ /dev/null @@ -1,60 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); -var h = require( 'virtual-dom/h.js' ); - - -// VARIABLES // - -var debug = logger( 'clippath:components:rect' ); -var ELEMENT = 'rect'; - - -// MAIN // - -/** -* Renders a clipping path rectangle. -* -* @private -* @param {Object} ctx - context -* @returns {VTree} virtual tree -*/ -function render( ctx ) { - var props = { - 'namespace': 'http://www.w3.org/2000/svg', - 'className': 'clipPath', - 'attributes': { - 'width': ctx.width, - 'height': ctx.height - } - }; - - debug( 'Generating a virtual DOM tree (%s) with properties: %s.', ELEMENT, JSON.stringify( props ) ); - - return h( ELEMENT, props, [] ); -} - - -// EXPORTS // - -module.exports = render; diff --git a/lib/node_modules/@stdlib/plot/components/svg/clip-path/lib/defaults.json b/lib/node_modules/@stdlib/plot/components/svg/clip-path/lib/defaults.json deleted file mode 100644 index 914f1d7574f9..000000000000 --- a/lib/node_modules/@stdlib/plot/components/svg/clip-path/lib/defaults.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "width": 400, - "height": 400, - "id": "", - "autoRender": false -} diff --git a/lib/node_modules/@stdlib/plot/components/svg/clip-path/lib/events/events.json b/lib/node_modules/@stdlib/plot/components/svg/clip-path/lib/events/events.json deleted file mode 100644 index 8f7744c0b74b..000000000000 --- a/lib/node_modules/@stdlib/plot/components/svg/clip-path/lib/events/events.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "width": "change", - "height": "change", - "id": "change", - "autoRender": "change" -} diff --git a/lib/node_modules/@stdlib/plot/components/svg/clip-path/lib/events/index.js b/lib/node_modules/@stdlib/plot/components/svg/clip-path/lib/events/index.js deleted file mode 100644 index ef68b2b8fdb7..000000000000 --- a/lib/node_modules/@stdlib/plot/components/svg/clip-path/lib/events/index.js +++ /dev/null @@ -1,42 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var EVENTS = require( './events.json' ); - - -// MAIN // - -/** -* Provided a property, returns a corresponding event name for when a property value changes. -* -* @private -* @param {string} prop - property -* @returns {string} event name -*/ -function get( prop ) { - return EVENTS[ prop ]; -} - - -// EXPORTS // - -module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/components/svg/clip-path/lib/index.js b/lib/node_modules/@stdlib/plot/components/svg/clip-path/lib/index.js deleted file mode 100644 index 8be487e379ae..000000000000 --- a/lib/node_modules/@stdlib/plot/components/svg/clip-path/lib/index.js +++ /dev/null @@ -1,42 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -/** -* Clipping path. -* -* @module @stdlib/plot/components/svg/clip-path -* -* @example -* var ClipPath = require( '@stdlib/plot/components/svg/clip-path' ); -* -* var clipPath = new ClipPath({ -* 'width': 400, -* 'height': 400 -* }); -*/ - -// MODULES // - -var main = require( './main.js' ); - - -// EXPORTS // - -module.exports = main; diff --git a/lib/node_modules/@stdlib/plot/components/svg/clip-path/lib/main.js b/lib/node_modules/@stdlib/plot/components/svg/clip-path/lib/main.js deleted file mode 100644 index 38af904b61b6..000000000000 --- a/lib/node_modules/@stdlib/plot/components/svg/clip-path/lib/main.js +++ /dev/null @@ -1,266 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var EventEmitter = require( 'events' ).EventEmitter; -var logger = require( 'debug' ); -var defineProperty = require( '@stdlib/utils/define-property' ); -var setReadOnly = require( '@stdlib/utils/define-read-only-property' ); -var minstd = require( '@stdlib/random/base/minstd' ); -var copy = require( '@stdlib/utils/copy' ); -var defaults = require( './defaults.json' ); -var validate = require( './validate.js' ); -var setWidth = require( './props/width/set.js' ); -var getWidth = require( './props/width/get.js' ); -var setHeight = require( './props/height/set.js' ); -var getHeight = require( './props/height/get.js' ); -var setID = require( './props/id/set.js' ); -var getID = require( './props/id/get.js' ); -var setAutoRender = require( './props/auto-render/set.js' ); -var getAutoRender = require( './props/auto-render/get.js' ); -var render = require( './methods/render.js' ); - - -// VARIABLES // - -var debug = logger( 'clippath:main' ); - - -// MAIN // - -/** -* Clipping path constructor. -* -* @constructor -* @param {Options} options - constructor options -* @param {PositiveNumber} [options.width=400] - width -* @param {PositiveNumber} [options.height=400] - height -* @param {string} [options.id] - clipping path id -* @param {boolean} [options.autoRender=true] - indicates whether to re-render on a change event -* @throws {TypeError} must provide valid options -* @returns {ClipPath} clipping path instance -* -* @example -* var clipPath = new ClipPath({ -* 'width': 500, -* 'height': 500 -* }); -*/ -function ClipPath( options ) { - var self; - var opts; - var err; - if ( !( this instanceof ClipPath ) ) { - return new ClipPath( options ); - } - self = this; - opts = copy( defaults ); - err = validate( opts, options ); - if ( err ) { - throw err; - } - debug( 'Creating an instance with the following configuration: %s.', JSON.stringify( opts ) ); - EventEmitter.call( this ); - - defineProperty( this, '_width', { - 'configurable': false, - 'enumerable': false, - 'writable': true, - 'value': opts.width - }); - defineProperty( this, '_height', { - 'configurable': false, - 'enumerable': false, - 'writable': true, - 'value': opts.height - }); - defineProperty( this, '_id', { - 'configurable': false, - 'enumerable': false, - 'writable': true, - 'value': opts.id || minstd().toString() // TODO: uuid - }); - defineProperty( this, '_autoRender', { - 'configurable': false, - 'enumerable': false, - 'writable': true, - 'value': opts.autoRender - }); - - this.on( 'change', onChange ); - this.on( '_render', onRender ); - - return this; - - /** - * Callback invoked upon receiving a change event. - * - * @private - */ - function onChange() { - debug( 'Received a change event.' ); - if ( self._autoRender ) { // eslint-disable-line no-underscore-dangle - self.render(); - } - } - - /** - * Re-emits a render event. - * - * @private - */ - function onRender() { - var args; - var i; - debug( 'Received a render event. Re-emitting...' ); - args = new Array( arguments.length+1 ); - args[ 0 ] = 'render'; - for ( i = 0; i < arguments.length; i++ ) { - args[ i+1 ] = arguments[ i ]; - } - self.emit.apply( self, args ); - } -} - -/* -* Create a prototype which inherits from the parent prototype. -*/ -ClipPath.prototype = Object.create( EventEmitter.prototype ); - -/* -* Set the constructor. -*/ -ClipPath.prototype.constructor = ClipPath; - -/** -* Width. -* -* @name width -* @memberof ClipPath.prototype -* @type {PositiveNumber} -* @throws {TypeError} must be a positive number -* @default 400 -* -* @example -* var clipPath = new ClipPath({ -* 'width': 500 -* }); -* -* var width = clipPath.width; -* // returns 500 -*/ -defineProperty( ClipPath.prototype, 'width', { - 'configurable': false, - 'enumerable': true, - 'set': setWidth, - 'get': getWidth -}); - -/** -* Height. -* -* @name height -* @memberof ClipPath.prototype -* @type {PositiveNumber} -* @throws {TypeError} must be a positive number -* @default 400 -* -* @example -* var clipPath = new ClipPath({ -* 'height': 500 -* }); -* -* var height = clipPath.height; -* // returns 500 -*/ -defineProperty( ClipPath.prototype, 'height', { - 'configurable': false, - 'enumerable': true, - 'set': setHeight, - 'get': getHeight -}); - -/** -* Clipping path id. -* -* @name id -* @memberof ClipPath.prototype -* @type {string} -* @throws {TypeError} must be a string -* -* @example -* var clipPath = new ClipPath({ -* 'id': '1234' -* }); -* -* var id = clipPath.id; -* // returns '1234' -*/ -defineProperty( ClipPath.prototype, 'id', { - 'configurable': false, - 'enumerable': true, - 'set': setID, - 'get': getID -}); - -/** -* Rendering mode. If `true`, an instance re-renders on each change event. -* -* @name autoRender -* @memberof ClipPath.prototype -* @type {boolean} -* @throws {TypeError} must be a boolean -* @default false -* -* @example -* var clipPath = new ClipPath({ -* 'autoRender': true -* }); -* -* var mode = clipPath.autoRender; -* // returns true -*/ -defineProperty( ClipPath.prototype, 'autoRender', { - 'configurable': false, - 'enumerable': true, - 'set': setAutoRender, - 'get': getAutoRender -}); - -/** -* Renders a virtual DOM tree. -* -* @name render -* @memberof ClipPath.prototype -* @type {Function} -* @returns {VTree} virtual tree -* -* @example -* var clipPath = new ClipPath(); -* -* var out = clipPath.render(); -*/ -setReadOnly( ClipPath.prototype, 'render', render ); - - -// EXPORTS // - -module.exports = ClipPath; diff --git a/lib/node_modules/@stdlib/plot/components/svg/clip-path/lib/methods/render.js b/lib/node_modules/@stdlib/plot/components/svg/clip-path/lib/methods/render.js deleted file mode 100644 index b130497b2fe9..000000000000 --- a/lib/node_modules/@stdlib/plot/components/svg/clip-path/lib/methods/render.js +++ /dev/null @@ -1,56 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); -var components = require( './../components' ); - - -// VARIABLES // - -var debug = logger( 'clippath:render' ); - - -// MAIN // - -/** -* Renders a virtual DOM tree. -* -* @private -* @returns {VTree} virtual tree -*/ -function render() { - /* eslint-disable no-invalid-this */ - var vtree; - - debug( 'Rendering...' ); - vtree = components( this ); - - // Announce that a new tree has been rendered: - this.emit( '_render', vtree ); - - return vtree; -} - - -// EXPORTS // - -module.exports = render; diff --git a/lib/node_modules/@stdlib/plot/components/svg/clip-path/lib/props/auto-render/get.js b/lib/node_modules/@stdlib/plot/components/svg/clip-path/lib/props/auto-render/get.js deleted file mode 100644 index 7df40dec3f47..000000000000 --- a/lib/node_modules/@stdlib/plot/components/svg/clip-path/lib/props/auto-render/get.js +++ /dev/null @@ -1,35 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -/** -* Returns the rendering mode. -* -* @private -* @returns {boolean} rendering mode -*/ -function get() { - /* eslint-disable no-invalid-this */ - return this._autoRender; -} - - -// EXPORTS // - -module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/components/svg/clip-path/lib/props/auto-render/set.js b/lib/node_modules/@stdlib/plot/components/svg/clip-path/lib/props/auto-render/set.js deleted file mode 100644 index b2c961c98b41..000000000000 --- a/lib/node_modules/@stdlib/plot/components/svg/clip-path/lib/props/auto-render/set.js +++ /dev/null @@ -1,60 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); -var events = require( './../../events' ); -var isValid = require( './../../validators/auto_render.js' ); - - -// VARIABLES // - -var debug = logger( 'clip-path:set:auto-render' ); -var CHANGE_EVENT = events( 'autoRender' ); - - -// MAIN // - -/** -* Sets the rendering mode. -* -* @private -* @param {boolean} bool - boolean indicating whether to re-render on a change event -* @throws {TypeError} must be a positive number -*/ -function set( bool ) { - /* eslint-disable no-invalid-this */ - var err = isValid( bool ); - if ( err ) { - throw err; - } - debug( 'Current value: %d.', this._autoRender ); - - this._autoRender = bool; - debug( 'New Value: %d.', this._autoRender ); - - this.emit( CHANGE_EVENT ); -} - - -// EXPORTS // - -module.exports = set; diff --git a/lib/node_modules/@stdlib/plot/components/svg/clip-path/lib/props/height/get.js b/lib/node_modules/@stdlib/plot/components/svg/clip-path/lib/props/height/get.js deleted file mode 100644 index 64bcb891b201..000000000000 --- a/lib/node_modules/@stdlib/plot/components/svg/clip-path/lib/props/height/get.js +++ /dev/null @@ -1,35 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -/** -* Returns the height. -* -* @private -* @returns {number} height -*/ -function get() { - /* eslint-disable no-invalid-this */ - return this._height; -} - - -// EXPORTS // - -module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/components/svg/clip-path/lib/props/height/set.js b/lib/node_modules/@stdlib/plot/components/svg/clip-path/lib/props/height/set.js deleted file mode 100644 index b937313a6345..000000000000 --- a/lib/node_modules/@stdlib/plot/components/svg/clip-path/lib/props/height/set.js +++ /dev/null @@ -1,60 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); -var events = require( './../../events' ); -var isValid = require( './../../validators/height.js' ); - - -// VARIABLES // - -var debug = logger( 'clippath:set:height' ); -var CHANGE_EVENT = events( 'height' ); - - -// MAIN // - -/** -* Sets the height. -* -* @private -* @param {PositiveNumber} height - height -* @throws {TypeError} must be a positive number -*/ -function set( height ) { - /* eslint-disable no-invalid-this */ - var err = isValid( height ); - if ( err ) { - throw err; - } - debug( 'Current value: %d.', this._height ); - - this._height = height; - debug( 'New Value: %d.', this._height ); - - this.emit( CHANGE_EVENT ); -} - - -// EXPORTS // - -module.exports = set; diff --git a/lib/node_modules/@stdlib/plot/components/svg/clip-path/lib/props/id/get.js b/lib/node_modules/@stdlib/plot/components/svg/clip-path/lib/props/id/get.js deleted file mode 100644 index 1e2aebe10336..000000000000 --- a/lib/node_modules/@stdlib/plot/components/svg/clip-path/lib/props/id/get.js +++ /dev/null @@ -1,35 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -/** -* Returns the clipping path id. -* -* @private -* @returns {string} id -*/ -function get() { - /* eslint-disable no-invalid-this */ - return this._id; -} - - -// EXPORTS // - -module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/components/svg/clip-path/lib/props/id/set.js b/lib/node_modules/@stdlib/plot/components/svg/clip-path/lib/props/id/set.js deleted file mode 100644 index f85eb4e78742..000000000000 --- a/lib/node_modules/@stdlib/plot/components/svg/clip-path/lib/props/id/set.js +++ /dev/null @@ -1,60 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); -var events = require( './../../events' ); -var isValid = require( './../../validators/id.js' ); - - -// VARIABLES // - -var debug = logger( 'clippath:set:id' ); -var CHANGE_EVENT = events( 'id' ); - - -// MAIN // - -/** -* Sets the clipping path id. -* -* @private -* @param {string} id - id -* @throws {TypeError} must be a string -*/ -function set( id ) { - /* eslint-disable no-invalid-this */ - var err = isValid( id ); - if ( err ) { - throw err; - } - debug( 'Current value: %s.', this._id ); - - this._id = id; - debug( 'New value: %s.', this._id ); - - this.emit( CHANGE_EVENT ); -} - - -// EXPORTS // - -module.exports = set; diff --git a/lib/node_modules/@stdlib/plot/components/svg/clip-path/lib/props/width/get.js b/lib/node_modules/@stdlib/plot/components/svg/clip-path/lib/props/width/get.js deleted file mode 100644 index cfa5f0e70adf..000000000000 --- a/lib/node_modules/@stdlib/plot/components/svg/clip-path/lib/props/width/get.js +++ /dev/null @@ -1,35 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -/** -* Returns the width. -* -* @private -* @returns {number} width -*/ -function get() { - /* eslint-disable no-invalid-this */ - return this._width; -} - - -// EXPORTS // - -module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/components/svg/clip-path/lib/props/width/set.js b/lib/node_modules/@stdlib/plot/components/svg/clip-path/lib/props/width/set.js deleted file mode 100644 index b0f3a0b29b68..000000000000 --- a/lib/node_modules/@stdlib/plot/components/svg/clip-path/lib/props/width/set.js +++ /dev/null @@ -1,60 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); -var events = require( './../../events' ); -var isValid = require( './../../validators/width.js' ); - - -// VARIABLES // - -var debug = logger( 'clippath:set:width' ); -var CHANGE_EVENT = events( 'width' ); - - -// MAIN // - -/** -* Sets the width. -* -* @private -* @param {PositiveNumber} width - width -* @throws {TypeError} must be a positive number -*/ -function set( width ) { - /* eslint-disable no-invalid-this */ - var err = isValid( width ); - if ( err ) { - throw err; - } - debug( 'Current value: %d.', this._width ); - - this._width = width; - debug( 'New value: %d.', this._width ); - - this.emit( CHANGE_EVENT ); -} - - -// EXPORTS // - -module.exports = set; diff --git a/lib/node_modules/@stdlib/plot/components/svg/clip-path/lib/validate.js b/lib/node_modules/@stdlib/plot/components/svg/clip-path/lib/validate.js deleted file mode 100644 index 32a4a2dcaf08..000000000000 --- a/lib/node_modules/@stdlib/plot/components/svg/clip-path/lib/validate.js +++ /dev/null @@ -1,85 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var objectKeys = require( '@stdlib/utils/keys' ); -var isObject = require( '@stdlib/assert/is-plain-object' ); -var hasOwnProp = require( '@stdlib/assert/has-own-property' ); -var format = require( '@stdlib/string/format' ); -var validators = require( './validators' ); - - -// VARIABLES // - -var KEYS = objectKeys( validators ); - - -// MAIN // - -/** -* Validates function options. -* -* @private -* @param {Object} opts - destination object -* @param {Options} options - function options -* @param {PositiveNumber} [options.width] - width -* @param {PositiveNumber} [options.height] - height -* @param {string} [options.id] - clipping path id -* @param {boolean} [options.autoRender] - indicates whether to re-render on a change event -* @returns {(Error|null)} error or null -* -* @example -* var opts = {}; -* var options = { -* 'width': 400, -* 'height': 400 -* }; -* var err = validate( opts, options ); -* if ( err ) { -* throw err; -* } -*/ -function validate( opts, options ) { - var err; - var key; - var val; - var i; - if ( !isObject( options ) ) { - return new TypeError( format( 'invalid argument. Options argument must be an object. Value: `%s`.', options ) ); - } - for ( i = 0; i < KEYS.length; i++ ) { - key = KEYS[ i ]; - if ( hasOwnProp( options, key ) ) { - val = options[ key ]; - err = validators[ key ]( val ); - if ( err ) { - return err; - } - opts[ key ] = val; - } - } - return null; -} - - -// EXPORTS // - -module.exports = validate; diff --git a/lib/node_modules/@stdlib/plot/components/svg/clip-path/lib/validators/auto_render.js b/lib/node_modules/@stdlib/plot/components/svg/clip-path/lib/validators/auto_render.js deleted file mode 100644 index 08da79ff51a6..000000000000 --- a/lib/node_modules/@stdlib/plot/components/svg/clip-path/lib/validators/auto_render.js +++ /dev/null @@ -1,46 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var isBoolean = require( '@stdlib/assert/is-boolean' ).isPrimitive; -var format = require( '@stdlib/string/format' ); - - -// MAIN // - -/** -* Validates `autoRender`. -* -* @private -* @param {*} v - value to test -* @returns {(Error|null)} error object or null -*/ -function test( v ) { - if ( !isBoolean( v ) ) { - return new TypeError( format( 'invalid assignment. `%s` must be a boolean. Value: `%s`.', 'autoRender', v ) ); - } - return null; -} - - -// EXPORTS // - -module.exports = test; diff --git a/lib/node_modules/@stdlib/plot/components/svg/clip-path/lib/validators/height.js b/lib/node_modules/@stdlib/plot/components/svg/clip-path/lib/validators/height.js deleted file mode 100644 index 82ea73cef0cc..000000000000 --- a/lib/node_modules/@stdlib/plot/components/svg/clip-path/lib/validators/height.js +++ /dev/null @@ -1,46 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var isPositiveNumber = require( '@stdlib/assert/is-positive-number' ).isPrimitive; -var format = require( '@stdlib/string/format' ); - - -// MAIN // - -/** -* Validates `height`. -* -* @private -* @param {*} v - value to test -* @returns {(Error|null)} error object or null -*/ -function test( v ) { - if ( !isPositiveNumber( v ) ) { - return new TypeError( format( 'invalid assignment. `%s` must be a positive number. Value: `%s`.', 'height', v ) ); - } - return null; -} - - -// EXPORTS // - -module.exports = test; diff --git a/lib/node_modules/@stdlib/plot/components/svg/clip-path/lib/validators/id.js b/lib/node_modules/@stdlib/plot/components/svg/clip-path/lib/validators/id.js deleted file mode 100644 index 3e14d1226664..000000000000 --- a/lib/node_modules/@stdlib/plot/components/svg/clip-path/lib/validators/id.js +++ /dev/null @@ -1,46 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var isString = require( '@stdlib/assert/is-string' ).isPrimitive; -var format = require( '@stdlib/string/format' ); - - -// MAIN // - -/** -* Validates `id`. -* -* @private -* @param {*} v - value to test -* @returns {(Error|null)} error object or null -*/ -function test( v ) { - if ( !isString( v ) ) { - return new TypeError( format( 'invalid assignment. `%s` must be a string. Value: `%s`.', 'id', v ) ); - } - return null; -} - - -// EXPORTS // - -module.exports = test; diff --git a/lib/node_modules/@stdlib/plot/components/svg/clip-path/lib/validators/index.js b/lib/node_modules/@stdlib/plot/components/svg/clip-path/lib/validators/index.js deleted file mode 100644 index b7f5514b61a3..000000000000 --- a/lib/node_modules/@stdlib/plot/components/svg/clip-path/lib/validators/index.js +++ /dev/null @@ -1,41 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var width = require( './width.js' ); -var height = require( './height.js' ); -var id = require( './id.js' ); -var autoRender = require( './auto_render.js' ); - - -// MAIN // - -var validators = { - 'width': width, - 'height': height, - 'id': id, - 'autoRender': autoRender -}; - - -// EXPORTS // - -module.exports = validators; diff --git a/lib/node_modules/@stdlib/plot/components/svg/clip-path/lib/validators/width.js b/lib/node_modules/@stdlib/plot/components/svg/clip-path/lib/validators/width.js deleted file mode 100644 index e6d8f774bf4f..000000000000 --- a/lib/node_modules/@stdlib/plot/components/svg/clip-path/lib/validators/width.js +++ /dev/null @@ -1,46 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var isPositiveNumber = require( '@stdlib/assert/is-positive-number' ).isPrimitive; -var format = require( '@stdlib/string/format' ); - - -// MAIN // - -/** -* Validates `width`. -* -* @private -* @param {*} v - value to test -* @returns {(Error|null)} error object or null -*/ -function test( v ) { - if ( !isPositiveNumber( v ) ) { - return new TypeError( format( 'invalid assignment. `%s` must be a positive number. Value: `%s`.', 'width', v ) ); - } - return null; -} - - -// EXPORTS // - -module.exports = test; diff --git a/lib/node_modules/@stdlib/plot/components/svg/clip-path/package.json b/lib/node_modules/@stdlib/plot/components/svg/clip-path/package.json deleted file mode 100644 index 193e75a7b016..000000000000 --- a/lib/node_modules/@stdlib/plot/components/svg/clip-path/package.json +++ /dev/null @@ -1,65 +0,0 @@ -{ - "name": "@stdlib/plot/components/svg/clip-path", - "version": "0.0.0", - "description": "SVG clipping path.", - "license": "Apache-2.0", - "author": { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - }, - "contributors": [ - { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - } - ], - "main": "./lib", - "directories": { - "example": "./examples", - "lib": "./lib" - }, - "scripts": {}, - "homepage": "https://github.com/stdlib-js/stdlib", - "repository": { - "type": "git", - "url": "git://github.com/stdlib-js/stdlib.git" - }, - "bugs": { - "url": "https://github.com/stdlib-js/stdlib/issues" - }, - "dependencies": {}, - "devDependencies": {}, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], - "keywords": [ - "stdlib", - "plot", - "graph", - "chart", - "engine", - "svg", - "scalable", - "vector", - "graphics", - "clippath", - "clip-path", - "clipping", - "clip", - "path", - "mask", - "component" - ] -} diff --git a/lib/node_modules/@stdlib/plot/components/svg/defs/README.md b/lib/node_modules/@stdlib/plot/components/svg/defs/README.md deleted file mode 100644 index 10e8f5c52fd8..000000000000 --- a/lib/node_modules/@stdlib/plot/components/svg/defs/README.md +++ /dev/null @@ -1,193 +0,0 @@ -<!-- - -@license Apache-2.0 - -Copyright (c) 2018 The Stdlib Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. - ---> - -# Definitions - -> [SVG][svg] plot definitions. - -<!-- Section to include introductory text. Make sure to keep an empty line after the intro `section` element and another before the `/section` close. --> - -<section class="intro"> - -</section> - -<!-- /.intro --> - -<!-- Package usage documentation. --> - -<section class="usage"> - -## Usage - -```javascript -var Defs = require( '@stdlib/plot/components/svg/defs' ); -``` - -#### Defs() - -Returns a `Defs` instance. - -```javascript -var node = new Defs(); -// returns <Defs> -``` - -* * * - -### Methods - -<a name="method-render"></a> - -#### Defs.prototype.render() - -Renders an instance as a [virtual DOM tree][virtual-dom]. - -```javascript -var node = new Defs(); - -var vtree = node.render(); -/* e.g., returns - { - 'tagName': 'defs', - 'properties': { - 'namespace': void 0 - }, - 'children': [], - 'namespace': 'http://www.w3.org/2000/svg', - 'count': 0, - 'hasWidgets': false, - 'hasThunks': false, - 'descendantHooks': false, - 'hooks': void 0, - 'key': void 0 - } -*/ -``` - -* * * - -### Events - -<a name='event-render'></a> - -#### 'render' - -Event emitted when an instance renders. The event object is the rendered [Virtual DOM tree][virtual-dom]. - -```javascript -var node = new Defs(); - -function onRender( vtree ) { - console.log( vtree ); -} - -node.on( 'render', onRender ); -node.render(); -``` - -* * * - -### Listeners - -<a name='listener-change'></a> - -#### 'change' - -Upon receiving a `'change'` event, an instance re-renders. - -```javascript -var node = new Defs(); - -function onRender( vtree ) { - console.log( vtree ); -} - -node.on( 'render', onRender ); -node.emit( 'change' ); -``` - -</section> - -<!-- /.usage --> - -<!-- Package usage notes. Make sure to keep an empty line after the `section` element and another before the `/section` close. --> - -<section class="notes"> - -</section> - -<!-- /.notes --> - -<!-- Package usage examples. --> - -* * * - -<section class="examples"> - -## Examples - -<!-- eslint no-undef: "error" --> - -```javascript -var toHTML = require( 'vdom-to-html' ); -var defs = require( '@stdlib/plot/components/svg/defs' ); - -// Create a new component: -var node = defs(); - -// Render as a virtual DOM tree: -var vtree = node.render(); - -// Transform the virtual DOM tree to HTML: -var html = toHTML( vtree ); -// returns <defs></defs> -``` - -</section> - -<!-- /.examples --> - -<!-- Section to include cited references. If references are included, add a horizontal rule *before* the section. Make sure to keep an empty line after the `section` element and another before the `/section` close. --> - -<section class="references"> - -</section> - -<!-- /.references --> - -<!-- Section for related `stdlib` packages. Do not manually edit this section, as it is automatically populated. --> - -<section class="related"> - -</section> - -<!-- /.related --> - -<!-- Section for all links. Make sure to keep an empty line after the `section` element and another before the `/section` close. --> - -<section class="links"> - -[svg]: https://www.w3.org/Graphics/SVG/ - -[virtual-dom]: https://github.com/Matt-Esch/virtual-dom - -</section> - -<!-- /.links --> diff --git a/lib/node_modules/@stdlib/plot/components/svg/defs/benchmark/benchmark.js b/lib/node_modules/@stdlib/plot/components/svg/defs/benchmark/benchmark.js deleted file mode 100644 index 171d46cf183e..000000000000 --- a/lib/node_modules/@stdlib/plot/components/svg/defs/benchmark/benchmark.js +++ /dev/null @@ -1,90 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench' ); -var pkg = require( './../package.json' ).name; -var Defs = require( './../lib' ); - - -// MAIN // - -bench( pkg+'::instantiation', function benchmark( b ) { - var node; - var i; - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - node = new Defs(); - if ( !( node instanceof Defs ) ) { - b.fail( 'should return an instance' ); - } - } - b.toc(); - if ( !( node instanceof Defs ) ) { - b.fail( 'should return an instance' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::instantiation,no_new', function benchmark( b ) { - var ctor; - var node; - var i; - - ctor = Defs; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - node = ctor(); - if ( !( node instanceof Defs ) ) { - b.fail( 'should return an instance' ); - } - } - b.toc(); - if ( !( node instanceof Defs ) ) { - b.fail( 'should return an instance' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+':render', function benchmark( b ) { - var vtree; - var node; - var i; - - node = new Defs(); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - vtree = node.render(); - if ( typeof vtree !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( typeof vtree !== 'object' ) { - b.fail( 'should return an object' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/lib/node_modules/@stdlib/plot/components/svg/defs/examples/index.js b/lib/node_modules/@stdlib/plot/components/svg/defs/examples/index.js deleted file mode 100644 index af533f02d62b..000000000000 --- a/lib/node_modules/@stdlib/plot/components/svg/defs/examples/index.js +++ /dev/null @@ -1,34 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -var toHTML = require( 'vdom-to-html' ); -var defs = require( './../lib' ); - -// Create a new definitions component: -var node = defs(); - -// Render as a virtual DOM tree: -var vtree = node.render(); -console.log( JSON.stringify( vtree ) ); - -// Transform the virtual DOM tree to HTML: -var html = toHTML( vtree ); -console.log( html ); -// => <defs></defs> diff --git a/lib/node_modules/@stdlib/plot/components/svg/defs/lib/index.js b/lib/node_modules/@stdlib/plot/components/svg/defs/lib/index.js deleted file mode 100644 index 90a888f776d4..000000000000 --- a/lib/node_modules/@stdlib/plot/components/svg/defs/lib/index.js +++ /dev/null @@ -1,40 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -/** -* SVG plot definitions. -* -* @module @stdlib/plot/components/svg/defs -* -* @example -* var Defs = require( '@stdlib/plot/components/svg/defs' ); -* -* var node = new Defs(); -* // returns <Defs> -*/ - -// MODULES // - -var main = require( './main.js' ); - - -// EXPORTS // - -module.exports = main; diff --git a/lib/node_modules/@stdlib/plot/components/svg/defs/lib/main.js b/lib/node_modules/@stdlib/plot/components/svg/defs/lib/main.js deleted file mode 100644 index 0d2917570fe1..000000000000 --- a/lib/node_modules/@stdlib/plot/components/svg/defs/lib/main.js +++ /dev/null @@ -1,112 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var EventEmitter = require( 'events' ).EventEmitter; -var logger = require( 'debug' ); -var setReadOnly = require( '@stdlib/utils/define-nonenumerable-read-only-property' ); -var inherit = require( '@stdlib/utils/inherit' ); -var instanceOf = require( '@stdlib/assert/instance-of' ); -var render = require( './render.js' ); - - -// VARIABLES // - -var debug = logger( 'defs:main' ); - - -// MAIN // - -/** -* SVG definitions constructor. -* -* @constructor -* @returns {Defs} definitions instance -* -* @example -* var node = new Defs(); -* // returns <Defs> -*/ -function Defs() { - var self; - if ( !instanceOf( this, Defs ) ) { - return new Defs(); - } - self = this; - debug( 'Creating an instance...' ); - EventEmitter.call( this ); - this.on( 'change', onChange ); - this.on( '_render', onRender ); - return this; - - /** - * Callback invoked upon receiving a change event. - * - * @private - */ - function onChange() { - debug( 'Received a change event.' ); - self.render(); - } - - /** - * Re-emits a render event. - * - * @private - */ - function onRender() { - var args; - var i; - debug( 'Received a render event. Re-emitting...' ); - args = new Array( arguments.length+1 ); - args[ 0 ] = 'render'; - for ( i = 0; i < arguments.length; i++ ) { - args[ i+1 ] = arguments[ i ]; - } - self.emit.apply( self, args ); - } -} - -/* -* Inherit from the `EventEmitter` prototype. -*/ -inherit( Defs, EventEmitter ); - -/** -* Renders a virtual DOM tree. -* -* @name render -* @memberof Defs.prototype -* @type {Function} -* @returns {VTree} virtual tree -* -* @example -* var node = new Defs(); -* -* var out = node.render(); -* // returns <Object> -*/ -setReadOnly( Defs.prototype, 'render', render ); - - -// EXPORTS // - -module.exports = Defs; diff --git a/lib/node_modules/@stdlib/plot/components/svg/defs/lib/render.js b/lib/node_modules/@stdlib/plot/components/svg/defs/lib/render.js deleted file mode 100644 index c64af49560d2..000000000000 --- a/lib/node_modules/@stdlib/plot/components/svg/defs/lib/render.js +++ /dev/null @@ -1,64 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); -var h = require( 'virtual-dom/h.js' ); - - -// VARIABLES // - -var debug = logger( 'defs:render' ); -var ELEMENT = 'defs'; - - -// MAIN // - -/** -* Renders a virtual DOM tree. -* -* @private -* @returns {VTree} virtual tree -*/ -function render() { - /* eslint-disable no-invalid-this */ - var vtree; - var props; - - debug( 'Rendering...' ); - - props = { - 'namespace': 'http://www.w3.org/2000/svg' - }; - - debug( 'Generating a virtual DOM tree (%s) with properties: %s.', ELEMENT, JSON.stringify( props ) ); - vtree = h( ELEMENT, props, [] ); - - // Announce that a new tree has been rendered: - this.emit( '_render', vtree ); - - return vtree; -} - - -// EXPORTS // - -module.exports = render; diff --git a/lib/node_modules/@stdlib/plot/components/svg/defs/package.json b/lib/node_modules/@stdlib/plot/components/svg/defs/package.json deleted file mode 100644 index 9159edd46f7f..000000000000 --- a/lib/node_modules/@stdlib/plot/components/svg/defs/package.json +++ /dev/null @@ -1,67 +0,0 @@ -{ - "name": "@stdlib/plot/components/svg/defs", - "version": "0.0.0", - "description": "SVG plot definitions.", - "license": "Apache-2.0", - "author": { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - }, - "contributors": [ - { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - } - ], - "main": "./lib", - "directories": { - "benchmark": "./benchmark", - "example": "./examples", - "lib": "./lib", - "test": "./test" - }, - "scripts": {}, - "homepage": "https://github.com/stdlib-js/stdlib", - "repository": { - "type": "git", - "url": "git://github.com/stdlib-js/stdlib.git" - }, - "bugs": { - "url": "https://github.com/stdlib-js/stdlib/issues" - }, - "dependencies": {}, - "devDependencies": {}, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], - "keywords": [ - "stdlib", - "plot", - "graph", - "chart", - "engine", - "svg", - "scalable", - "vector", - "graphics", - "defs", - "definitions", - "component", - "virtual", - "dom", - "vdom", - "virtual-dom" - ] -} diff --git a/lib/node_modules/@stdlib/plot/components/svg/defs/test/fixtures/vtree.js b/lib/node_modules/@stdlib/plot/components/svg/defs/test/fixtures/vtree.js deleted file mode 100644 index 220d8d648c8b..000000000000 --- a/lib/node_modules/@stdlib/plot/components/svg/defs/test/fixtures/vtree.js +++ /dev/null @@ -1,41 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MAIN // - -var vtree = { - 'tagName': 'defs', - 'properties': { - 'namespace': void 0 - }, - 'children': [], - 'namespace': 'http://www.w3.org/2000/svg', - 'count': 0, - 'hasWidgets': false, - 'hasThunks': false, - 'descendantHooks': false, - 'hooks': void 0, - 'key': void 0 -}; - - -// EXPORTS // - -module.exports = vtree; diff --git a/lib/node_modules/@stdlib/plot/components/svg/defs/test/test.js b/lib/node_modules/@stdlib/plot/components/svg/defs/test/test.js deleted file mode 100644 index cc1df9ea0c62..000000000000 --- a/lib/node_modules/@stdlib/plot/components/svg/defs/test/test.js +++ /dev/null @@ -1,86 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var EventEmitter = require( 'events' ).EventEmitter; -var tape = require( 'tape' ); -var instanceOf = require( '@stdlib/assert/instance-of' ); -var Defs = require( './../lib' ); - - -// FIXTURES // - -var VTREE = require( './fixtures/vtree.js' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof Defs, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function is a constructor', function test( t ) { - var node = new Defs(); - t.strictEqual( instanceOf( node, Defs ), true, 'is an instance' ); - t.end(); -}); - -tape( 'the constructor does not require the `new` operator', function test( t ) { - var ctor; - var node; - - ctor = Defs; - node = ctor(); - - t.strictEqual( instanceOf( node, Defs ), true, 'is an instance' ); - t.end(); -}); - -tape( 'the constructor returns an event emitter', function test( t ) { - var node = new Defs(); - t.strictEqual( instanceOf( node, EventEmitter ), true, 'is an event emitter' ); - t.end(); -}); - -tape( 'when a returned instance receives a `change` event, it re-renders and emits a `render` event', function test( t ) { - var node = new Defs(); - node.on( 'render', onRender ); - node.emit( 'change' ); - - function onRender( obj ) { - t.ok( true, 'emits a render event' ); - t.deepEqual( obj, VTREE, 'provides virtual tree' ); - t.end(); - } -}); - -tape( 'the `render` method returns a rendered virtual tree', function test( t ) { - var vtree; - var node; - - node = new Defs(); - vtree = node.render(); - - t.deepEqual( vtree, VTREE, 'returns a virtual tree' ); - t.end(); -}); diff --git a/lib/node_modules/@stdlib/plot/components/svg/graph/examples/index.js b/lib/node_modules/@stdlib/plot/components/svg/graph/examples/index.js deleted file mode 100644 index 616e8c060000..000000000000 --- a/lib/node_modules/@stdlib/plot/components/svg/graph/examples/index.js +++ /dev/null @@ -1,50 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -var toHTML = require( 'vdom-to-html' ); -var graph = require( './../lib' ); - -// Create a new graph component: -var node = graph({ - 'translateX': 90, - 'translateY': 20, - 'autoRender': true -}); - -// Render as a virtual DOM tree: -var vtree = node.render(); -console.log( JSON.stringify( vtree ) ); - -// Transform the virtual DOM tree to HTML: -var html = toHTML( vtree ); -console.log( html ); - -// Listen for 'render' events (e.g., when triggered due to changes in state): -node.on( 'render', onRender ); - -setTimeout( update, 1000 ); - -function update() { - node.translateX = 80; -} - -function onRender( vtree ) { - console.log( toHTML( vtree ) ); -} diff --git a/lib/node_modules/@stdlib/plot/components/svg/graph/lib/defaults.json b/lib/node_modules/@stdlib/plot/components/svg/graph/lib/defaults.json deleted file mode 100644 index 983fe3639930..000000000000 --- a/lib/node_modules/@stdlib/plot/components/svg/graph/lib/defaults.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "translateX": 0, - "translateY": 0, - "autoRender": false -} diff --git a/lib/node_modules/@stdlib/plot/components/svg/graph/lib/events/events.json b/lib/node_modules/@stdlib/plot/components/svg/graph/lib/events/events.json deleted file mode 100644 index 54b6080da6b1..000000000000 --- a/lib/node_modules/@stdlib/plot/components/svg/graph/lib/events/events.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "translateX": "change", - "translateY": "change", - "autoRender": "change" -} diff --git a/lib/node_modules/@stdlib/plot/components/svg/graph/lib/events/index.js b/lib/node_modules/@stdlib/plot/components/svg/graph/lib/events/index.js deleted file mode 100644 index ef68b2b8fdb7..000000000000 --- a/lib/node_modules/@stdlib/plot/components/svg/graph/lib/events/index.js +++ /dev/null @@ -1,42 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var EVENTS = require( './events.json' ); - - -// MAIN // - -/** -* Provided a property, returns a corresponding event name for when a property value changes. -* -* @private -* @param {string} prop - property -* @returns {string} event name -*/ -function get( prop ) { - return EVENTS[ prop ]; -} - - -// EXPORTS // - -module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/components/svg/graph/lib/index.js b/lib/node_modules/@stdlib/plot/components/svg/graph/lib/index.js deleted file mode 100644 index a5e342abd3ff..000000000000 --- a/lib/node_modules/@stdlib/plot/components/svg/graph/lib/index.js +++ /dev/null @@ -1,42 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -/** -* Graph component. -* -* @module @stdlib/plot/components/svg/graph -* -* @example -* var Graph = require( '@stdlib/plot/components/svg/graph' ); -* -* var graph = new Graph({ -* 'translateX': 90, -* 'translateY': 20 -* }); -*/ - -// MODULES // - -var main = require( './main.js' ); - - -// EXPORTS // - -module.exports = main; diff --git a/lib/node_modules/@stdlib/plot/components/svg/graph/lib/main.js b/lib/node_modules/@stdlib/plot/components/svg/graph/lib/main.js deleted file mode 100644 index 7897874fc1b5..000000000000 --- a/lib/node_modules/@stdlib/plot/components/svg/graph/lib/main.js +++ /dev/null @@ -1,233 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var EventEmitter = require( 'events' ).EventEmitter; -var logger = require( 'debug' ); -var defineProperty = require( '@stdlib/utils/define-property' ); -var setReadOnly = require( '@stdlib/utils/define-read-only-property' ); -var copy = require( '@stdlib/utils/copy' ); -var defaults = require( './defaults.json' ); -var validate = require( './validate.js' ); -var setTranslateX = require( './props/translate-x/set.js' ); -var getTranslateX = require( './props/translate-x/get.js' ); -var setTranslateY = require( './props/translate-y/set.js' ); -var getTranslateY = require( './props/translate-y/get.js' ); -var setAutoRender = require( './props/auto-render/set.js' ); -var getAutoRender = require( './props/auto-render/get.js' ); -var render = require( './methods/render.js' ); - - -// VARIABLES // - -var debug = logger( 'graph:main' ); - - -// MAIN // - -/** -* Graph constructor. -* -* @constructor -* @param {Options} options - constructor options -* @param {NonNegativeInteger} [options.translateX=0] - horizontal translation -* @param {NonNegativeInteger} [options.translateY=0] - vertical translation -* @param {boolean} [options.autoRender=false] - indicates whether to re-render on a change event -* @throws {TypeError} must provide valid options -* @returns {Graph} graph instance -* -* @example -* var graph = new Graph({ -* 'translateX': 90, -* 'translateY': 20 -* }); -*/ -function Graph( options ) { - var self; - var opts; - var err; - if ( !( this instanceof Graph ) ) { - return new Graph( options ); - } - self = this; - opts = copy( defaults ); - err = validate( opts, options ); - if ( err ) { - throw err; - } - debug( 'Creating an instance with the following configuration: %s.', JSON.stringify( opts ) ); - EventEmitter.call( this ); - - defineProperty( this, '_translateX', { - 'configurable': false, - 'enumerable': false, - 'writable': true, - 'value': opts.translateX - }); - defineProperty( this, '_translateY', { - 'configurable': false, - 'enumerable': false, - 'writable': true, - 'value': opts.translateY - }); - defineProperty( this, '_autoRender', { - 'configurable': false, - 'enumerable': false, - 'writable': true, - 'value': opts.autoRender - }); - - this.on( 'change', onChange ); - this.on( '_render', onRender ); - - return this; - - /** - * Callback invoked upon receiving a change event. - * - * @private - */ - function onChange() { - debug( 'Received a change event.' ); - if ( self._autoRender ) { // eslint-disable-line no-underscore-dangle - self.render(); - } - } - - /** - * Re-emits a render event. - * - * @private - */ - function onRender() { - var args; - var i; - debug( 'Received a render event. Re-emitting...' ); - args = new Array( arguments.length+1 ); - args[ 0 ] = 'render'; - for ( i = 0; i < arguments.length; i++ ) { - args[ i+1 ] = arguments[ i ]; - } - self.emit.apply( self, args ); - } -} - -/* -* Create a prototype which inherits from the parent prototype. -*/ -Graph.prototype = Object.create( EventEmitter.prototype ); - -/* -* Set the constructor. -*/ -Graph.prototype.constructor = Graph; - -/** -* Horizontal translation. -* -* @name translateX -* @memberof Graph.prototype -* @type {NonNegativeInteger} -* @throws {TypeError} must be a nonnegative integer -* @default 0 -* -* @example -* var graph = new Graph({ -* 'translateX': 90 -* }); -* -* var v = graph.translateX; -* // returns 90 -*/ -defineProperty( Graph.prototype, 'translateX', { - 'configurable': false, - 'enumerable': true, - 'set': setTranslateX, - 'get': getTranslateX -}); - -/** -* Vertical translation. -* -* @name translateY -* @memberof Graph.prototype -* @type {NonNegativeInteger} -* @throws {TypeError} must be a nonnegative integer -* @default 0 -* -* @example -* var graph = new Graph({ -* 'translateY': 20 -* }); -* -* var v = graph.translateY; -* // returns 20 -*/ -defineProperty( Graph.prototype, 'translateY', { - 'configurable': false, - 'enumerable': true, - 'set': setTranslateY, - 'get': getTranslateY -}); - -/** -* Rendering mode. If `true`, an instance re-renders on each change event. -* -* @name autoRender -* @memberof Graph.prototype -* @type {boolean} -* @throws {TypeError} must be a boolean -* @default false -* -* @example -* var graph = new Graph({ -* 'autoRender': true -* }); -* -* var mode = graph.autoRender; -* // returns true -*/ -defineProperty( Graph.prototype, 'autoRender', { - 'configurable': false, - 'enumerable': true, - 'set': setAutoRender, - 'get': getAutoRender -}); - -/** -* Renders a virtual DOM tree. -* -* @name render -* @memberof Graph.prototype -* @type {Function} -* @returns {VTree} virtual tree -* -* @example -* var graph = new Graph(); -* -* var out = graph.render(); -*/ -setReadOnly( Graph.prototype, 'render', render ); - - -// EXPORTS // - -module.exports = Graph; diff --git a/lib/node_modules/@stdlib/plot/components/svg/graph/lib/methods/render.js b/lib/node_modules/@stdlib/plot/components/svg/graph/lib/methods/render.js deleted file mode 100644 index fcd76b382398..000000000000 --- a/lib/node_modules/@stdlib/plot/components/svg/graph/lib/methods/render.js +++ /dev/null @@ -1,68 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); -var h = require( 'virtual-dom/h.js' ); - - -// VARIABLES // - -var debug = logger( 'graph:render' ); -var ELEMENT = 'g'; - - -// MAIN // - -/** -* Renders a virtual DOM tree. -* -* @private -* @returns {VTree} virtual DOM tree -*/ -function render() { - /* eslint-disable no-invalid-this */ - var props; - var vtree; - - debug( 'Rendering...' ); - - props = { - 'namespace': 'http://www.w3.org/2000/svg', - 'property': 'graph', - 'className': 'graph', - 'attributes': { - 'transform': 'translate('+this.translateX+','+this.translateY+')' - } - }; - debug( 'Generating a virtual DOM tree (%s) with properties: %s.', ELEMENT, JSON.stringify( props ) ); - vtree = h( ELEMENT, props, [] ); - - // Announce that a new tree has been rendered: - this.emit( '_render', vtree ); - - return vtree; -} - - -// EXPORTS // - -module.exports = render; diff --git a/lib/node_modules/@stdlib/plot/components/svg/graph/lib/props/auto-render/get.js b/lib/node_modules/@stdlib/plot/components/svg/graph/lib/props/auto-render/get.js deleted file mode 100644 index 7df40dec3f47..000000000000 --- a/lib/node_modules/@stdlib/plot/components/svg/graph/lib/props/auto-render/get.js +++ /dev/null @@ -1,35 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -/** -* Returns the rendering mode. -* -* @private -* @returns {boolean} rendering mode -*/ -function get() { - /* eslint-disable no-invalid-this */ - return this._autoRender; -} - - -// EXPORTS // - -module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/components/svg/graph/lib/props/auto-render/set.js b/lib/node_modules/@stdlib/plot/components/svg/graph/lib/props/auto-render/set.js deleted file mode 100644 index 21191762f48a..000000000000 --- a/lib/node_modules/@stdlib/plot/components/svg/graph/lib/props/auto-render/set.js +++ /dev/null @@ -1,60 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); -var events = require( './../../events' ); -var isValid = require( './../../validators/auto_render.js' ); - - -// VARIABLES // - -var debug = logger( 'canvas:set:auto-render' ); -var CHANGE_EVENT = events( 'autoRender' ); - - -// MAIN // - -/** -* Sets the rendering mode. -* -* @private -* @param {boolean} bool - boolean indicating whether to re-render on a change event -* @throws {TypeError} must be a positive number -*/ -function set( bool ) { - /* eslint-disable no-invalid-this */ - var err = isValid( bool ); - if ( err ) { - throw err; - } - debug( 'Current value: %d.', this._autoRender ); - - this._autoRender = bool; - debug( 'New Value: %d.', this._autoRender ); - - this.emit( CHANGE_EVENT ); -} - - -// EXPORTS // - -module.exports = set; diff --git a/lib/node_modules/@stdlib/plot/components/svg/graph/lib/props/translate-x/get.js b/lib/node_modules/@stdlib/plot/components/svg/graph/lib/props/translate-x/get.js deleted file mode 100644 index ef5e55ce342f..000000000000 --- a/lib/node_modules/@stdlib/plot/components/svg/graph/lib/props/translate-x/get.js +++ /dev/null @@ -1,35 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -/** -* Returns the horizontal translation. -* -* @private -* @returns {NonNegativeInteger} translation -*/ -function get() { - /* eslint-disable no-invalid-this */ - return this._translateX; -} - - -// EXPORTS // - -module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/components/svg/graph/lib/props/translate-x/set.js b/lib/node_modules/@stdlib/plot/components/svg/graph/lib/props/translate-x/set.js deleted file mode 100644 index 49fe20f732e0..000000000000 --- a/lib/node_modules/@stdlib/plot/components/svg/graph/lib/props/translate-x/set.js +++ /dev/null @@ -1,60 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); -var events = require( './../../events' ); -var isValid = require( './../../validators/translate_x.js' ); - - -// VARIABLES // - -var debug = logger( 'graph:set:translate-x' ); -var CHANGE_EVENT = events( 'translateX' ); - - -// MAIN // - -/** -* Sets the horizontal translation. -* -* @private -* @param {NonNegativeInteger} v - translation -* @throws {TypeError} must be a nonnegative integer -*/ -function set( v ) { - /* eslint-disable no-invalid-this */ - var err = isValid( v ); - if ( err ) { - throw err; - } - debug( 'Current value: %d.', this._translateX ); - - this._translateX = v; - debug( 'New Value: %d.', this._translateX ); - - this.emit( CHANGE_EVENT ); -} - - -// EXPORTS // - -module.exports = set; diff --git a/lib/node_modules/@stdlib/plot/components/svg/graph/lib/props/translate-y/get.js b/lib/node_modules/@stdlib/plot/components/svg/graph/lib/props/translate-y/get.js deleted file mode 100644 index 557271953bdd..000000000000 --- a/lib/node_modules/@stdlib/plot/components/svg/graph/lib/props/translate-y/get.js +++ /dev/null @@ -1,35 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -/** -* Returns the vertical translation. -* -* @private -* @returns {NonNegativeInteger} translation -*/ -function get() { - /* eslint-disable no-invalid-this */ - return this._translateY; -} - - -// EXPORTS // - -module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/components/svg/graph/lib/props/translate-y/set.js b/lib/node_modules/@stdlib/plot/components/svg/graph/lib/props/translate-y/set.js deleted file mode 100644 index e4ce28ff0319..000000000000 --- a/lib/node_modules/@stdlib/plot/components/svg/graph/lib/props/translate-y/set.js +++ /dev/null @@ -1,60 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); -var events = require( './../../events' ); -var isValid = require( './../../validators/translate_y.js' ); - - -// VARIABLES // - -var debug = logger( 'graph:set:translate-y' ); -var CHANGE_EVENT = events( 'translateY' ); - - -// MAIN // - -/** -* Sets the vertical translation. -* -* @private -* @param {NonNegativeInteger} v - translation -* @throws {TypeError} must be a nonnegative integer -*/ -function set( v ) { - /* eslint-disable no-invalid-this */ - var err = isValid( v ); - if ( err ) { - throw err; - } - debug( 'Current value: %d.', this._translateY ); - - this._translateY = v; - debug( 'New Value: %d.', this._translateY ); - - this.emit( CHANGE_EVENT ); -} - - -// EXPORTS // - -module.exports = set; diff --git a/lib/node_modules/@stdlib/plot/components/svg/graph/lib/validate.js b/lib/node_modules/@stdlib/plot/components/svg/graph/lib/validate.js deleted file mode 100644 index 97725e347cc3..000000000000 --- a/lib/node_modules/@stdlib/plot/components/svg/graph/lib/validate.js +++ /dev/null @@ -1,84 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var objectKeys = require( '@stdlib/utils/keys' ); -var isObject = require( '@stdlib/assert/is-plain-object' ); -var hasOwnProp = require( '@stdlib/assert/has-own-property' ); -var format = require( '@stdlib/string/format' ); -var validators = require( './validators' ); - - -// VARIABLES // - -var KEYS = objectKeys( validators ); - - -// MAIN // - -/** -* Validates function options. -* -* @private -* @param {Object} opts - destination object -* @param {Options} options - function options -* @param {NonNegativeInteger} [options.translateX] - horizontal translation -* @param {NonNegativeInteger} [options.translateY] - vertical translation -* @param {boolean} [options.autoRender] - indicates whether to re-render on a change event -* @returns {(Error|null)} error or null -* -* @example -* var opts = {}; -* var options = { -* 'translateX': 90, -* 'translateY': 20 -* }; -* var err = validate( opts, options ); -* if ( err ) { -* throw err; -* } -*/ -function validate( opts, options ) { - var err; - var key; - var val; - var i; - if ( !isObject( options ) ) { - return new TypeError( format( 'invalid argument. Options argument must be an object. Value: `%s`.', options ) ); - } - for ( i = 0; i < KEYS.length; i++ ) { - key = KEYS[ i ]; - if ( hasOwnProp( options, key ) ) { - val = options[ key ]; - err = validators[ key ]( val ); - if ( err ) { - return err; - } - opts[ key ] = val; - } - } - return null; -} - - -// EXPORTS // - -module.exports = validate; diff --git a/lib/node_modules/@stdlib/plot/components/svg/graph/lib/validators/auto_render.js b/lib/node_modules/@stdlib/plot/components/svg/graph/lib/validators/auto_render.js deleted file mode 100644 index 08da79ff51a6..000000000000 --- a/lib/node_modules/@stdlib/plot/components/svg/graph/lib/validators/auto_render.js +++ /dev/null @@ -1,46 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var isBoolean = require( '@stdlib/assert/is-boolean' ).isPrimitive; -var format = require( '@stdlib/string/format' ); - - -// MAIN // - -/** -* Validates `autoRender`. -* -* @private -* @param {*} v - value to test -* @returns {(Error|null)} error object or null -*/ -function test( v ) { - if ( !isBoolean( v ) ) { - return new TypeError( format( 'invalid assignment. `%s` must be a boolean. Value: `%s`.', 'autoRender', v ) ); - } - return null; -} - - -// EXPORTS // - -module.exports = test; diff --git a/lib/node_modules/@stdlib/plot/components/svg/graph/lib/validators/index.js b/lib/node_modules/@stdlib/plot/components/svg/graph/lib/validators/index.js deleted file mode 100644 index 80a856d60e6a..000000000000 --- a/lib/node_modules/@stdlib/plot/components/svg/graph/lib/validators/index.js +++ /dev/null @@ -1,39 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var translateX = require( './translate_x.js' ); -var translateY = require( './translate_y.js' ); -var autoRender = require( './auto_render.js' ); - - -// MAIN // - -var validators = { - 'translateX': translateX, - 'translateY': translateY, - 'autoRender': autoRender -}; - - -// EXPORTS // - -module.exports = validators; diff --git a/lib/node_modules/@stdlib/plot/components/svg/graph/lib/validators/translate_x.js b/lib/node_modules/@stdlib/plot/components/svg/graph/lib/validators/translate_x.js deleted file mode 100644 index 9d9c2b9cae13..000000000000 --- a/lib/node_modules/@stdlib/plot/components/svg/graph/lib/validators/translate_x.js +++ /dev/null @@ -1,46 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var isNonNegativeInteger = require( '@stdlib/assert/is-nonnegative-integer' ).isPrimitive; -var format = require( '@stdlib/string/format' ); - - -// MAIN // - -/** -* Validates `translateX`. -* -* @private -* @param {*} v - value to test -* @returns {(Error|null)} error object or null -*/ -function test( v ) { - if ( !isNonNegativeInteger( v ) ) { - return new TypeError( format( 'invalid assignment. `%s` must be a nonnegative integer. Value: `%s`.', 'translateX', v ) ); - } - return null; -} - - -// EXPORTS // - -module.exports = test; diff --git a/lib/node_modules/@stdlib/plot/components/svg/graph/lib/validators/translate_y.js b/lib/node_modules/@stdlib/plot/components/svg/graph/lib/validators/translate_y.js deleted file mode 100644 index 523ec57433ff..000000000000 --- a/lib/node_modules/@stdlib/plot/components/svg/graph/lib/validators/translate_y.js +++ /dev/null @@ -1,46 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var isNonNegativeInteger = require( '@stdlib/assert/is-nonnegative-integer' ).isPrimitive; -var format = require( '@stdlib/string/format' ); - - -// MAIN // - -/** -* Validates `translateY`. -* -* @private -* @param {*} v - value to test -* @returns {(Error|null)} error object or null -*/ -function test( v ) { - if ( !isNonNegativeInteger( v ) ) { - return new TypeError( format( 'invalid assignment. `%s` must be a nonnegative integer. Value: `%s`.', 'translateY', v ) ); - } - return null; -} - - -// EXPORTS // - -module.exports = test; diff --git a/lib/node_modules/@stdlib/plot/components/svg/graph/package.json b/lib/node_modules/@stdlib/plot/components/svg/graph/package.json deleted file mode 100644 index 935a04e4e1c1..000000000000 --- a/lib/node_modules/@stdlib/plot/components/svg/graph/package.json +++ /dev/null @@ -1,59 +0,0 @@ -{ - "name": "@stdlib/plot/components/svg/graph", - "version": "0.0.0", - "description": "Graph component.", - "license": "Apache-2.0", - "author": { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - }, - "contributors": [ - { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - } - ], - "main": "./lib", - "directories": { - "example": "./examples", - "lib": "./lib" - }, - "scripts": {}, - "homepage": "https://github.com/stdlib-js/stdlib", - "repository": { - "type": "git", - "url": "git://github.com/stdlib-js/stdlib.git" - }, - "bugs": { - "url": "https://github.com/stdlib-js/stdlib/issues" - }, - "dependencies": {}, - "devDependencies": {}, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], - "keywords": [ - "stdlib", - "plot", - "graph", - "chart", - "engine", - "svg", - "scalable", - "vector", - "graphics", - "component" - ] -} diff --git a/lib/node_modules/@stdlib/plot/components/svg/marks/examples/index.js b/lib/node_modules/@stdlib/plot/components/svg/marks/examples/index.js deleted file mode 100644 index 38e827bcd28c..000000000000 --- a/lib/node_modules/@stdlib/plot/components/svg/marks/examples/index.js +++ /dev/null @@ -1,49 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -var toHTML = require( 'vdom-to-html' ); -var marks = require( './../lib' ); - -// Create a new component: -var node = marks({ - 'clipPathId': '1234', - 'autoRender': true -}); - -// Render as a virtual DOM tree: -var vtree = node.render(); -console.log( JSON.stringify( vtree ) ); - -// Transform the virtual DOM tree to HTML: -var html = toHTML( vtree ); -console.log( html ); - -// Listen for 'render' events (e.g., when triggered due to changes in state): -node.on( 'render', onRender ); - -setTimeout( update, 1000 ); - -function update() { - node.clipPathId = '4321'; -} - -function onRender( vtree ) { - console.log( toHTML( vtree ) ); -} diff --git a/lib/node_modules/@stdlib/plot/components/svg/marks/lib/defaults.json b/lib/node_modules/@stdlib/plot/components/svg/marks/lib/defaults.json deleted file mode 100644 index f77788efee5f..000000000000 --- a/lib/node_modules/@stdlib/plot/components/svg/marks/lib/defaults.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "clipPathId": "", - "autoRender": false -} diff --git a/lib/node_modules/@stdlib/plot/components/svg/marks/lib/events/events.json b/lib/node_modules/@stdlib/plot/components/svg/marks/lib/events/events.json deleted file mode 100644 index 3496bcb34947..000000000000 --- a/lib/node_modules/@stdlib/plot/components/svg/marks/lib/events/events.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "clipPathId": "change", - "autoRender": "change" -} diff --git a/lib/node_modules/@stdlib/plot/components/svg/marks/lib/events/index.js b/lib/node_modules/@stdlib/plot/components/svg/marks/lib/events/index.js deleted file mode 100644 index ef68b2b8fdb7..000000000000 --- a/lib/node_modules/@stdlib/plot/components/svg/marks/lib/events/index.js +++ /dev/null @@ -1,42 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var EVENTS = require( './events.json' ); - - -// MAIN // - -/** -* Provided a property, returns a corresponding event name for when a property value changes. -* -* @private -* @param {string} prop - property -* @returns {string} event name -*/ -function get( prop ) { - return EVENTS[ prop ]; -} - - -// EXPORTS // - -module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/components/svg/marks/lib/index.js b/lib/node_modules/@stdlib/plot/components/svg/marks/lib/index.js deleted file mode 100644 index cb305621d1f0..000000000000 --- a/lib/node_modules/@stdlib/plot/components/svg/marks/lib/index.js +++ /dev/null @@ -1,41 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -/** -* Marks. -* -* @module @stdlib/plot/components/svg/marks -* -* @example -* var Marks = require( '@stdlib/plot/components/svg/marks' ); -* -* var marks = new Marks({ -* 'clipPathId': '1234' -* }); -*/ - -// MODULES // - -var main = require( './main.js' ); - - -// EXPORTS // - -module.exports = main; diff --git a/lib/node_modules/@stdlib/plot/components/svg/marks/lib/main.js b/lib/node_modules/@stdlib/plot/components/svg/marks/lib/main.js deleted file mode 100644 index c2997637a971..000000000000 --- a/lib/node_modules/@stdlib/plot/components/svg/marks/lib/main.js +++ /dev/null @@ -1,198 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var EventEmitter = require( 'events' ).EventEmitter; -var logger = require( 'debug' ); -var defineProperty = require( '@stdlib/utils/define-property' ); -var setReadOnly = require( '@stdlib/utils/define-read-only-property' ); -var copy = require( '@stdlib/utils/copy' ); -var defaults = require( './defaults.json' ); -var validate = require( './validate.js' ); -var setClipPathId = require( './props/clip-path-id/set.js' ); -var getClipPathId = require( './props/clip-path-id/get.js' ); -var setAutoRender = require( './props/auto-render/set.js' ); -var getAutoRender = require( './props/auto-render/get.js' ); -var render = require( './methods/render.js' ); - - -// VARIABLES // - -var debug = logger( 'marks:main' ); - - -// MAIN // - -/** -* Marks constructor. -* -* @constructor -* @param {Options} options - constructor options -* @param {string} [options.clipPathId] - clipping path id -* @param {boolean} [options.autoRender=false] - indicates whether to re-render on a change event -* @throws {TypeError} must provide valid options -* @returns {Marks} marks instance -* -* @example -* var marks = new Marks({ -* 'clipPathId': '1234' -* }); -*/ -function Marks( options ) { - var self; - var opts; - var err; - if ( !( this instanceof Marks ) ) { - return new Marks( options ); - } - self = this; - opts = copy( defaults ); - err = validate( opts, options ); - if ( err ) { - throw err; - } - debug( 'Creating an instance with the following configuration: %s.', JSON.stringify( opts ) ); - EventEmitter.call( this ); - - defineProperty( this, '_clipPathId', { - 'configurable': false, - 'enumerable': false, - 'writable': true, - 'value': opts.clipPathId - }); - defineProperty( this, '_autoRender', { - 'configurable': false, - 'enumerable': false, - 'writable': true, - 'value': opts.autoRender - }); - - this.on( 'change', onChange ); - this.on( '_render', onRender ); - - return this; - - /** - * Callback invoked upon receiving a change event. - * - * @private - */ - function onChange() { - debug( 'Received a change event.' ); - if ( self._autoRender ) { // eslint-disable-line no-underscore-dangle - self.render(); - } - } - - /** - * Re-emits a render event. - * - * @private - */ - function onRender() { - var args; - var i; - debug( 'Received a render event. Re-emitting...' ); - args = new Array( arguments.length+1 ); - args[ 0 ] = 'render'; - for ( i = 0; i < arguments.length; i++ ) { - args[ i+1 ] = arguments[ i ]; - } - self.emit.apply( self, args ); - } -} - -/* -* Create a prototype which inherits from the parent prototype. -*/ -Marks.prototype = Object.create( EventEmitter.prototype ); - -/* -* Set the constructor. -*/ -Marks.prototype.constructor = Marks; - -/** -* Clipping path id. -* -* @name clipPathId -* @memberof Marks.prototype -* @type {string} -* @throws {TypeError} must be a string -* -* @example -* var marks = new Marks({ -* 'clipPathId': '1234' -* }); -* -* var id = marks.clipPathId; -* // returns '1234' -*/ -defineProperty( Marks.prototype, 'clipPathId', { - 'configurable': false, - 'enumerable': true, - 'set': setClipPathId, - 'get': getClipPathId -}); - -/** -* Rendering mode. If `true`, an instance re-renders on each change event. -* -* @name autoRender -* @memberof Marks.prototype -* @type {boolean} -* @throws {TypeError} must be a boolean -* @default false -* -* @example -* var marks = new Marks({ -* 'autoRender': true -* }); -* -* var mode = marks.autoRender; -* // returns true -*/ -defineProperty( Marks.prototype, 'autoRender', { - 'configurable': false, - 'enumerable': true, - 'set': setAutoRender, - 'get': getAutoRender -}); - -/** -* Renders a virtual DOM tree. -* -* @name render -* @memberof Marks.prototype -* @type {Function} -* @returns {VTree} virtual tree -* -* @example -* var marks = new Marks(); -* -* var out = marks.render(); -*/ -setReadOnly( Marks.prototype, 'render', render ); - - -// EXPORTS // - -module.exports = Marks; diff --git a/lib/node_modules/@stdlib/plot/components/svg/marks/lib/methods/render.js b/lib/node_modules/@stdlib/plot/components/svg/marks/lib/methods/render.js deleted file mode 100644 index fb5a1f5880bf..000000000000 --- a/lib/node_modules/@stdlib/plot/components/svg/marks/lib/methods/render.js +++ /dev/null @@ -1,69 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); -var h = require( 'virtual-dom/h.js' ); - - -// VARIABLES // - -var debug = logger( 'marks:render' ); -var ELEMENT = 'g'; - - -// MAIN // - -/** -* Renders a virtual DOM tree. -* -* @private -* @returns {VTree} virtual DOM tree -*/ -function render() { - /* eslint-disable no-invalid-this */ - var props; - var vtree; - - debug( 'Rendering...' ); - - props = { - 'namespace': 'http://www.w3.org/2000/svg', - 'property': 'marks', - 'className': 'marks', - 'attributes': { - 'clip-path': 'url(#'+this._clipPathId+')' - } - }; - - debug( 'Generating a virtual DOM tree (%s) with properties: %s.', ELEMENT, JSON.stringify( props ) ); - vtree = h( ELEMENT, props, [] ); - - // Announce that a new tree has been rendered: - this.emit( '_render', vtree ); - - return vtree; -} - - -// EXPORTS // - -module.exports = render; diff --git a/lib/node_modules/@stdlib/plot/components/svg/marks/lib/props/auto-render/get.js b/lib/node_modules/@stdlib/plot/components/svg/marks/lib/props/auto-render/get.js deleted file mode 100644 index 7df40dec3f47..000000000000 --- a/lib/node_modules/@stdlib/plot/components/svg/marks/lib/props/auto-render/get.js +++ /dev/null @@ -1,35 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -/** -* Returns the rendering mode. -* -* @private -* @returns {boolean} rendering mode -*/ -function get() { - /* eslint-disable no-invalid-this */ - return this._autoRender; -} - - -// EXPORTS // - -module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/components/svg/marks/lib/props/auto-render/set.js b/lib/node_modules/@stdlib/plot/components/svg/marks/lib/props/auto-render/set.js deleted file mode 100644 index 5fd14f6198ec..000000000000 --- a/lib/node_modules/@stdlib/plot/components/svg/marks/lib/props/auto-render/set.js +++ /dev/null @@ -1,60 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); -var events = require( './../../events' ); -var isValid = require( './../../validators/auto_render.js' ); - - -// VARIABLES // - -var debug = logger( 'marks:set:auto-render' ); -var CHANGE_EVENT = events( 'autoRender' ); - - -// MAIN // - -/** -* Sets the rendering mode. -* -* @private -* @param {boolean} bool - boolean indicating whether to re-render on a change event -* @throws {TypeError} must be a positive number -*/ -function set( bool ) { - /* eslint-disable no-invalid-this */ - var err = isValid( bool ); - if ( err ) { - throw err; - } - debug( 'Current value: %d.', this._autoRender ); - - this._autoRender = bool; - debug( 'New Value: %d.', this._autoRender ); - - this.emit( CHANGE_EVENT ); -} - - -// EXPORTS // - -module.exports = set; diff --git a/lib/node_modules/@stdlib/plot/components/svg/marks/lib/props/clip-path-id/get.js b/lib/node_modules/@stdlib/plot/components/svg/marks/lib/props/clip-path-id/get.js deleted file mode 100644 index ff6c1a974f56..000000000000 --- a/lib/node_modules/@stdlib/plot/components/svg/marks/lib/props/clip-path-id/get.js +++ /dev/null @@ -1,35 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -/** -* Returns the clipping path id. -* -* @private -* @returns {string} id -*/ -function get() { - /* eslint-disable no-invalid-this */ - return this._clipPathId; -} - - -// EXPORTS // - -module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/components/svg/marks/lib/props/clip-path-id/set.js b/lib/node_modules/@stdlib/plot/components/svg/marks/lib/props/clip-path-id/set.js deleted file mode 100644 index f0677e306567..000000000000 --- a/lib/node_modules/@stdlib/plot/components/svg/marks/lib/props/clip-path-id/set.js +++ /dev/null @@ -1,60 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); -var events = require( './../../events' ); -var isValid = require( './../../validators/clip_path_id.js' ); - - -// VARIABLES // - -var debug = logger( 'marks:set:clip-path-id' ); -var CHANGE_EVENT = events( 'clipPathId' ); - - -// MAIN // - -/** -* Sets the clipping path id. -* -* @private -* @param {string} id - clipping path id -* @throws {TypeError} must be a string -*/ -function set( id ) { - /* eslint-disable no-invalid-this */ - var err = isValid( id ); - if ( err ) { - throw err; - } - debug( 'Current value: %d.', this._clipPathId ); - - this._clipPathId = id; - debug( 'New Value: %d.', this._clipPathId ); - - this.emit( CHANGE_EVENT ); -} - - -// EXPORTS // - -module.exports = set; diff --git a/lib/node_modules/@stdlib/plot/components/svg/marks/lib/validate.js b/lib/node_modules/@stdlib/plot/components/svg/marks/lib/validate.js deleted file mode 100644 index 1b5e996f7cc9..000000000000 --- a/lib/node_modules/@stdlib/plot/components/svg/marks/lib/validate.js +++ /dev/null @@ -1,82 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var objectKeys = require( '@stdlib/utils/keys' ); -var isObject = require( '@stdlib/assert/is-plain-object' ); -var hasOwnProp = require( '@stdlib/assert/has-own-property' ); -var format = require( '@stdlib/string/format' ); -var validators = require( './validators' ); - - -// VARIABLES // - -var KEYS = objectKeys( validators ); - - -// MAIN // - -/** -* Validates function options. -* -* @private -* @param {Object} opts - destination object -* @param {Options} options - function options -* @param {string} [options.clipPathId] - clipping path id -* @param {boolean} [options.autoRender] - indicates whether to re-render on a change event -* @returns {(Error|null)} error or null -* -* @example -* var opts = {}; -* var options = { -* 'clipPathId': '1234' -* }; -* var err = validate( opts, options ); -* if ( err ) { -* throw err; -* } -*/ -function validate( opts, options ) { - var err; - var key; - var val; - var i; - if ( !isObject( options ) ) { - return new TypeError( format( 'invalid argument. Options argument must be an object. Value: `%s`.', options ) ); - } - for ( i = 0; i < KEYS.length; i++ ) { - key = KEYS[ i ]; - if ( hasOwnProp( options, key ) ) { - val = options[ key ]; - err = validators[ key ]( val ); - if ( err ) { - return err; - } - opts[ key ] = val; - } - } - return null; -} - - -// EXPORTS // - -module.exports = validate; diff --git a/lib/node_modules/@stdlib/plot/components/svg/marks/lib/validators/auto_render.js b/lib/node_modules/@stdlib/plot/components/svg/marks/lib/validators/auto_render.js deleted file mode 100644 index 08da79ff51a6..000000000000 --- a/lib/node_modules/@stdlib/plot/components/svg/marks/lib/validators/auto_render.js +++ /dev/null @@ -1,46 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var isBoolean = require( '@stdlib/assert/is-boolean' ).isPrimitive; -var format = require( '@stdlib/string/format' ); - - -// MAIN // - -/** -* Validates `autoRender`. -* -* @private -* @param {*} v - value to test -* @returns {(Error|null)} error object or null -*/ -function test( v ) { - if ( !isBoolean( v ) ) { - return new TypeError( format( 'invalid assignment. `%s` must be a boolean. Value: `%s`.', 'autoRender', v ) ); - } - return null; -} - - -// EXPORTS // - -module.exports = test; diff --git a/lib/node_modules/@stdlib/plot/components/svg/marks/lib/validators/clip_path_id.js b/lib/node_modules/@stdlib/plot/components/svg/marks/lib/validators/clip_path_id.js deleted file mode 100644 index ec90d10ba4de..000000000000 --- a/lib/node_modules/@stdlib/plot/components/svg/marks/lib/validators/clip_path_id.js +++ /dev/null @@ -1,46 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var isString = require( '@stdlib/assert/is-string' ).isPrimitive; -var format = require( '@stdlib/string/format' ); - - -// MAIN // - -/** -* Validates `clipPathId`. -* -* @private -* @param {*} v - value to test -* @returns {(Error|null)} error object or null -*/ -function test( v ) { - if ( !isString( v ) ) { - return new TypeError( format( 'invalid assignment. `%s` must be a string. Value: `%s`.', 'clipPathId', v ) ); - } - return null; -} - - -// EXPORTS // - -module.exports = test; diff --git a/lib/node_modules/@stdlib/plot/components/svg/marks/lib/validators/index.js b/lib/node_modules/@stdlib/plot/components/svg/marks/lib/validators/index.js deleted file mode 100644 index c3bab2a6bb4f..000000000000 --- a/lib/node_modules/@stdlib/plot/components/svg/marks/lib/validators/index.js +++ /dev/null @@ -1,37 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var clipPathId = require( './clip_path_id.js' ); -var autoRender = require( './auto_render.js' ); - - -// MAIN // - -var validators = { - 'clipPathId': clipPathId, - 'autoRender': autoRender -}; - - -// EXPORTS // - -module.exports = validators; diff --git a/lib/node_modules/@stdlib/plot/components/svg/marks/package.json b/lib/node_modules/@stdlib/plot/components/svg/marks/package.json deleted file mode 100644 index 222235933b81..000000000000 --- a/lib/node_modules/@stdlib/plot/components/svg/marks/package.json +++ /dev/null @@ -1,60 +0,0 @@ -{ - "name": "@stdlib/plot/components/svg/marks", - "version": "0.0.0", - "description": "Marks.", - "license": "Apache-2.0", - "author": { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - }, - "contributors": [ - { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - } - ], - "main": "./lib", - "directories": { - "example": "./examples", - "lib": "./lib" - }, - "scripts": {}, - "homepage": "https://github.com/stdlib-js/stdlib", - "repository": { - "type": "git", - "url": "git://github.com/stdlib-js/stdlib.git" - }, - "bugs": { - "url": "https://github.com/stdlib-js/stdlib/issues" - }, - "dependencies": {}, - "devDependencies": {}, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], - "keywords": [ - "stdlib", - "plot", - "graph", - "chart", - "engine", - "svg", - "scalable", - "vector", - "graphics", - "marks", - "component" - ] -} diff --git a/lib/node_modules/@stdlib/plot/components/svg/path/examples/index.js b/lib/node_modules/@stdlib/plot/components/svg/path/examples/index.js deleted file mode 100644 index b68ee2df4cf9..000000000000 --- a/lib/node_modules/@stdlib/plot/components/svg/path/examples/index.js +++ /dev/null @@ -1,50 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -var toHTML = require( 'vdom-to-html' ); -var path = require( './../lib' ); - -// Create a new path: -var node = path({ - 'x': [0.10, 0.50, 0.90], - 'y': [0.43, 0.37, 0.53], - 'autoRender': true -}); - -// Render as a virtual DOM tree: -var vtree = node.render(); -console.log( JSON.stringify( vtree ) ); - -// Transform the virtual DOM tree to HTML: -var html = toHTML( vtree ); -console.log( html ); - -// Listen for 'render' events (e.g., when triggered due to changes in state): -node.on( 'render', onRender ); - -setTimeout( update, 1000 ); - -function update() { - node.y = [0.99, 0.87, 0.92]; -} - -function onRender( vtree ) { - console.log( toHTML( vtree ) ); -} diff --git a/lib/node_modules/@stdlib/plot/components/svg/path/lib/accessors/is_defined.js b/lib/node_modules/@stdlib/plot/components/svg/path/lib/accessors/is_defined.js deleted file mode 100644 index fe50ce480471..000000000000 --- a/lib/node_modules/@stdlib/plot/components/svg/path/lib/accessors/is_defined.js +++ /dev/null @@ -1,50 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); -var isnan = require( '@stdlib/assert/is-nan' ).isPrimitive; - - -// VARIABLES // - -var debug = logger( 'path:accessor:is-defined' ); - - -// MAIN // - -/** -* Accessor function which determines whether a datum is defined. -* -* @private -* @param {number} d - datum -* @returns {boolean} boolean indicating whether a datum is defined -*/ -function isDefined( d ) { - var bool = !isnan( d ); - debug( 'Datum: %s. Defined: %s.', JSON.stringify( d ), bool ); - return bool; -} - - -// EXPORTS // - -module.exports = isDefined; diff --git a/lib/node_modules/@stdlib/plot/components/svg/path/lib/defaults.json b/lib/node_modules/@stdlib/plot/components/svg/path/lib/defaults.json deleted file mode 100644 index a5ca76d7877b..000000000000 --- a/lib/node_modules/@stdlib/plot/components/svg/path/lib/defaults.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "autoRender": false, - "color": "#000", - "isDefined": null, - "label": "", - "opacity": 0.9, - "style": "-", - "width": 2, - "x": [], - "xScale": null, - "y": [], - "yScale": null -} diff --git a/lib/node_modules/@stdlib/plot/components/svg/path/lib/index.js b/lib/node_modules/@stdlib/plot/components/svg/path/lib/index.js deleted file mode 100644 index d3797cbf7d77..000000000000 --- a/lib/node_modules/@stdlib/plot/components/svg/path/lib/index.js +++ /dev/null @@ -1,42 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -/** -* SVG path component. -* -* @module @stdlib/plot/components/svg/path -* -* @example -* var Path = require( '@stdlib/plot/components/svg/path' ); -* -* var path = new Path({ -* 'x': [0.1,0.2,0.3], -* 'y': [0.4,0.5,0.6] -* }); -*/ - -// MODULES // - -var main = require( './main.js' ); - - -// EXPORTS // - -module.exports = main; diff --git a/lib/node_modules/@stdlib/plot/components/svg/path/lib/main.js b/lib/node_modules/@stdlib/plot/components/svg/path/lib/main.js deleted file mode 100644 index d2eaa36951cb..000000000000 --- a/lib/node_modules/@stdlib/plot/components/svg/path/lib/main.js +++ /dev/null @@ -1,541 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// TODO: improve JSDoc examples - -// MODULES // - -var EventEmitter = require( 'events' ).EventEmitter; -var logger = require( 'debug' ); -var linear = require( 'd3-scale' ).scaleLinear; // TODO: remove -var defineProperty = require( '@stdlib/utils/define-property' ); -var setReadOnly = require( '@stdlib/utils/define-read-only-property' ); -var objectKeys = require( '@stdlib/utils/keys' ); -var format = require( '@stdlib/string/format' ); -var copy = require( '@stdlib/utils/copy' ); -var merge = require( '@stdlib/utils/merge' ); -var isObject = require( '@stdlib/assert/is-plain-object' ); -var isDefined = require( './accessors/is_defined.js' ); -var defaults = require( './defaults.json' ); -var setX = require( './props/x/set.js' ); -var getX = require( './props/x/get.js' ); -var setY = require( './props/y/set.js' ); -var getY = require( './props/y/get.js' ); -var setXScale = require( './props/x-scale/set.js' ); -var getXScale = require( './props/x-scale/get.js' ); -var setYScale = require( './props/y-scale/set.js' ); -var getYScale = require( './props/y-scale/get.js' ); -var setIsDefined = require( './props/is-defined/set.js' ); -var getIsDefined = require( './props/is-defined/get.js' ); -var setColor = require( './props/color/set.js' ); -var getColor = require( './props/color/get.js' ); -var setLabel = require( './props/label/set.js' ); -var getLabel = require( './props/label/get.js' ); -var setOpacity = require( './props/opacity/set.js' ); -var getOpacity = require( './props/opacity/get.js' ); -var setWidth = require( './props/width/set.js' ); -var getWidth = require( './props/width/get.js' ); -var setStyle = require( './props/style/set.js' ); -var getStyle = require( './props/style/get.js' ); -var setAutoRender = require( './props/auto-render/set.js' ); -var getAutoRender = require( './props/auto-render/get.js' ); -var getLine = require( './props/line/get.js' ); -var getXPos = require( './props/x-pos/get.js' ); -var getYPos = require( './props/y-pos/get.js' ); -var render = require( './render' ); - - -// VARIABLES // - -var debug = logger( 'path:main' ); -var PRIVATE_PROPS = [ - '_autoRender', - '_color', - '_isDefined', - '_label', - '_opacity', - '_style', - '_width', - '_xData', - '_xScale', - '_yData', - '_yScale' -]; - - -// MAIN // - -/** -* Path constructor. -* -* @constructor -* @param {Options} [options] - constructor options -* @param {ArrayLike} [options.x=[]] - x-values -* @param {ArrayLike} [options.y=[]] - y-values -* @param {Function} [options.xScale] - x scale function -* @param {Function} [options.yScale] - y scale function -* @param {Function} [options.isDefined] - accessor indicating whether a datum is defined -* @param {string} [options.color] - color -* @param {string} [options.label] - label -* @param {NonNegativeInteger} [options.width=2] - width -* @param {number} [options.opacity=0.9] - opacity -* @param {string} [options.style='-'] - style -* @param {boolean} [options.autoRender=false] - indicates whether to re-render on a change event -* @throws {TypeError} must provide valid options -* @returns {Path} Path instance -* -* @example -* var path = new Path({ -* 'x': [0.1,0.2,0.3], -* 'y': [0.4,0.5,0.6] -* }); -*/ -function Path( options ) { - var self; - var keys; - var opts; - var key; - var i; - if ( !( this instanceof Path ) ) { - if ( arguments.length ) { - return new Path( options ); - } - return new Path(); - } - self = this; - - opts = copy( defaults ); - opts.isDefined = isDefined; - opts.xScale = linear(); - opts.yScale = linear(); - - if ( arguments.length ) { - if ( !isObject( options ) ) { - throw new TypeError( format( 'invalid argument. Options argument must be an object. Value: `%s`.', options ) ); - } - opts = merge( opts, options ); - } - debug( 'Creating an instance with the following configuration: %s.', JSON.stringify( opts ) ); - EventEmitter.call( this ); - - for ( i = 0; i < PRIVATE_PROPS.length; i++ ) { - defineProperty( this, PRIVATE_PROPS[i], { - 'configurable': false, - 'enumerable': false, - 'writable': true, - 'value': null - }); - } - // Set options... - keys = objectKeys( opts ); - for ( i = 0; i < keys.length; i++ ) { - key = keys[ i ]; - this[ key ] = opts[ key ]; - } - - this.on( 'change', onChange ); - this.on( '_render', onRender ); - - return this; - - /** - * Callback invoked upon receiving a change event. - * - * @private - */ - function onChange() { - debug( 'Received a change event.' ); - if ( self._autoRender ) { // eslint-disable-line no-underscore-dangle - self.render(); - } - } - - /** - * Re-emits a render event. - * - * @private - */ - function onRender() { - var args; - var i; - debug( 'Received a render event. Re-emitting...' ); - args = new Array( arguments.length+1 ); - args[ 0 ] = 'render'; - for ( i = 0; i < arguments.length; i++ ) { - args[ i+1 ] = arguments[ i ]; - } - self.emit.apply( self, args ); - } -} - -/* -* Create a prototype which inherits from the parent prototype. -*/ -Path.prototype = Object.create( EventEmitter.prototype ); - -/* -* Set the constructor. -*/ -Path.prototype.constructor = Path; - -/** -* `x` values. -* -* @name x -* @memberof Path.prototype -* @type {ArrayLike} -* @throws {TypeError} must be array-like -* @default [] -* -* @example -* var path = new Path({ -* 'x': [0.1,0.2,0.3] -* }); -* -* var x = path.x; -* // returns [0.1,0.2,0.3] -*/ -defineProperty( Path.prototype, 'x', { - 'configurable': false, - 'enumerable': true, - 'set': setX, - 'get': getX -}); - -/** -* `y` values. -* -* @name y -* @memberof Path.prototype -* @type {ArrayLike} -* @throws {TypeError} must be array-like -* @default [] -* -* @example -* var path = new Path({ -* 'y': [0.4,0.5,0.6] -* }); -* -* var y = path.y; -* // returns [0.4,0.5,0.6] -*/ -defineProperty( Path.prototype, 'y', { - 'configurable': false, - 'enumerable': true, - 'set': setY, - 'get': getY -}); - -/** -* `x` scale function. -* -* @name xScale -* @memberof Path.prototype -* @type {Function} -* @throws {TypeError} must be a function -* -* @example -* var path = new Path({ -* 'xScale': function scale(){} -* }); -* -* var f = path.xScale; -* // returns <Function> -*/ -defineProperty( Path.prototype, 'xScale', { - 'configurable': false, - 'enumerable': true, - 'set': setXScale, - 'get': getXScale -}); - -/** -* `y` scale function. -* -* @name yScale -* @memberof Path.prototype -* @type {Function} -* @throws {TypeError} must be a function -* -* @example -* var path = new Path({ -* 'yScale': function scale(){} -* }); -* -* var f = path.yScale; -* // returns <Function> -*/ -defineProperty( Path.prototype, 'yScale', { - 'configurable': false, - 'enumerable': true, - 'set': setYScale, - 'get': getYScale -}); - -/** -* Accessor which defines whether a datum is defined. This accessor is used to define how missing values are encoded. The default behavior is to ignore values which are `NaN`. -* -* @name isDefined -* @memberof Path.prototype -* @type {Function} -* @throws {TypeError} must be a function -* -* @example -* var path = new Path(); -* path.isDefined = function isDefined( d ) { -* // Check for `NaN`: -* return ( d === d ); -* } -* -* @example -* function isDefined( d ) { -* // Check for `NaN`: -* return ( d === d ); -* } -* var path = new Path({ -* 'isDefined': isDefined -* }); -* var fcn = path.isDefined; -* // returns <Function> -*/ -defineProperty( Path.prototype, 'isDefined', { - 'configurable': false, - 'enumerable': true, - 'set': setIsDefined, - 'get': getIsDefined -}); - -/** -* Path color. -* -* @name color -* @memberof Path.prototype -* @type {string} -* @throws {TypeError} must be a string -* -* @example -* var path = new Path({ -* 'color': 'steelblue' -* }); -* -* var color = path.color; -* // returns 'steelblue' -*/ -defineProperty( Path.prototype, 'color', { - 'configurable': false, - 'enumerable': true, - 'set': setColor, - 'get': getColor -}); - -/** -* Path label. -* -* @name label -* @memberof Path.prototype -* @type {string} -* @throws {TypeError} must be a string -* -* @example -* var path = new Path({ -* 'label': 'line-1' -* }); -* -* var label = path.label; -* // returns 'line-1' -*/ -defineProperty( Path.prototype, 'label', { - 'configurable': false, - 'enumerable': true, - 'set': setLabel, - 'get': getLabel -}); - -/** -* Path opacity. -* -* @name opacity -* @memberof Path.prototype -* @type {number} -* @throws {TypeError} must be a number -* @throws {RangeError} must be a number on the interval `[0,1]` -* @default 0.9 -* -* @example -* var path = new Path({ -* 'opacity': 0.5 -* }); -* -* var opacity = path.opacity; -* // returns 0.5 -*/ -defineProperty( Path.prototype, 'opacity', { - 'configurable': false, - 'enumerable': true, - 'set': setOpacity, - 'get': getOpacity -}); - -/** -* Path width. -* -* @name width -* @memberof Path.prototype -* @type {NonNegativeInteger} -* @throws {TypeError} must be a nonnegative integer -* @default 2 -* -* @example -* var path = new Path({ -* 'width': 1 -* }); -* -* var width = path.width; -* // returns 1 -*/ -defineProperty( Path.prototype, 'width', { - 'configurable': false, - 'enumerable': true, - 'set': setWidth, - 'get': getWidth -}); - -/** -* Path style. -* -* @name style -* @memberof Path.prototype -* @type {string} -* @throws {TypeError} must be a string -* @default '-' -* -* @example -* var path = new Path({ -* 'style': '-.' -* }); -* -* var style = path.style; -* // returns '-.' -*/ -defineProperty( Path.prototype, 'style', { - 'configurable': false, - 'enumerable': true, - 'set': setStyle, - 'get': getStyle -}); - -/** -* Rendering mode. If `true`, an instance re-renders on each change event. -* -* @name autoRender -* @memberof Path.prototype -* @type {boolean} -* @throws {TypeError} must be a boolean -* @default false -* -* @example -* var path = new Path({ -* 'autoRender': true -* }); -* -* var mode = path.autoRender; -* // returns true -*/ -defineProperty( Path.prototype, 'autoRender', { - 'configurable': false, - 'enumerable': true, - 'set': setAutoRender, - 'get': getAutoRender -}); - -/** -* Returns a function to generate a line as an SVG path. -* -* @name line -* @memberof Path.prototype -* @type {Function} -* -* @example -* var path = new Path(); -* -* var line = path.line; -* // returns <Function> -*/ -defineProperty( Path.prototype, 'line', { - 'configurable': false, - 'enumerable': true, - 'get': getLine -}); - -/** -* Function to map values to x coordinate values. -* -* @name xPos -* @memberof Path.prototype -* @type {Function} -* -* @example -* var path = new Path(); -* var xPos = path.xPos; -* // returns <Function> -*/ -defineProperty( Path.prototype, 'xPos', { - 'configurable': false, - 'enumerable': true, - 'get': getXPos -}); - -/** -* Function to map values to y coordinate values. -* -* @name yPos -* @memberof Path.prototype -* @type {Function} -* -* @example -* var path = new Path(); -* var yPos = path.yPos; -* // returns <Function> -*/ -defineProperty( Path.prototype, 'yPos', { - 'configurable': false, - 'enumerable': true, - 'get': getYPos -}); - -/** -* Renders a virtual DOM tree. -* -* @name render -* @memberof Path.prototype -* @type {Function} -* @returns {VTree} virtual tree -* -* @example -* var path = new Path(); -* -* var out = path.render(); -*/ -setReadOnly( Path.prototype, 'render', render ); - - -// EXPORTS // - -module.exports = Path; diff --git a/lib/node_modules/@stdlib/plot/components/svg/path/lib/props/auto-render/get.js b/lib/node_modules/@stdlib/plot/components/svg/path/lib/props/auto-render/get.js deleted file mode 100644 index 7df40dec3f47..000000000000 --- a/lib/node_modules/@stdlib/plot/components/svg/path/lib/props/auto-render/get.js +++ /dev/null @@ -1,35 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -/** -* Returns the rendering mode. -* -* @private -* @returns {boolean} rendering mode -*/ -function get() { - /* eslint-disable no-invalid-this */ - return this._autoRender; -} - - -// EXPORTS // - -module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/components/svg/path/lib/props/auto-render/set.js b/lib/node_modules/@stdlib/plot/components/svg/path/lib/props/auto-render/set.js deleted file mode 100644 index 61741759377b..000000000000 --- a/lib/node_modules/@stdlib/plot/components/svg/path/lib/props/auto-render/set.js +++ /dev/null @@ -1,58 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); -var isBoolean = require( '@stdlib/assert/is-boolean' ).isPrimitive; -var format = require( '@stdlib/string/format' ); - - -// VARIABLES // - -var debug = logger( 'path:set:auto-render' ); - - -// MAIN // - -/** -* Sets the rendering mode. -* -* @private -* @param {boolean} bool - boolean indicating whether to re-render on a change event -* @throws {TypeError} must be a positive number -*/ -function set( bool ) { - /* eslint-disable no-invalid-this */ - if ( !isBoolean( bool ) ) { - throw new TypeError( format( 'invalid assignment. `%s` must be a boolean. Value: `%s`.', 'autoRender', bool ) ); - } - debug( 'Current value: %d.', this._autoRender ); - - this._autoRender = bool; - debug( 'New Value: %d.', this._autoRender ); - - this.emit( 'change' ); -} - - -// EXPORTS // - -module.exports = set; diff --git a/lib/node_modules/@stdlib/plot/components/svg/path/lib/props/color/get.js b/lib/node_modules/@stdlib/plot/components/svg/path/lib/props/color/get.js deleted file mode 100644 index 95da35e60da6..000000000000 --- a/lib/node_modules/@stdlib/plot/components/svg/path/lib/props/color/get.js +++ /dev/null @@ -1,35 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -/** -* Returns the path color. -* -* @private -* @returns {string} color -*/ -function get() { - /* eslint-disable no-invalid-this */ - return this._color; -} - - -// EXPORTS // - -module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/components/svg/path/lib/props/color/set.js b/lib/node_modules/@stdlib/plot/components/svg/path/lib/props/color/set.js deleted file mode 100644 index 654fd1948bc2..000000000000 --- a/lib/node_modules/@stdlib/plot/components/svg/path/lib/props/color/set.js +++ /dev/null @@ -1,58 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); -var isString = require( '@stdlib/assert/is-string' ).isPrimitive; -var format = require( '@stdlib/string/format' ); - - -// VARIABLES // - -var debug = logger( 'path:set:color' ); - - -// MAIN // - -/** -* Sets the path color. -* -* @private -* @param {string} color - color -* @throws {TypeError} must be a string -*/ -function set( color ) { - /* eslint-disable no-invalid-this */ - if ( !isString( color ) ) { - throw new TypeError( format( 'invalid assignment. `%s` must be a string. Value: `%s`.', 'color', color ) ); - } - debug( 'Current value: %d.', this._color ); - - this._color = color; - debug( 'New Value: %d.', this._color ); - - this.emit( 'change' ); -} - - -// EXPORTS // - -module.exports = set; diff --git a/lib/node_modules/@stdlib/plot/components/svg/path/lib/props/is-defined/get.js b/lib/node_modules/@stdlib/plot/components/svg/path/lib/props/is-defined/get.js deleted file mode 100644 index fd05f22602d6..000000000000 --- a/lib/node_modules/@stdlib/plot/components/svg/path/lib/props/is-defined/get.js +++ /dev/null @@ -1,35 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -/** -* Returns the accessor for defined values. -* -* @private -* @returns {Function} accessor -*/ -function get() { - /* eslint-disable no-invalid-this */ - return this._isDefined; -} - - -// EXPORTS // - -module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/components/svg/path/lib/props/is-defined/set.js b/lib/node_modules/@stdlib/plot/components/svg/path/lib/props/is-defined/set.js deleted file mode 100644 index 3dc6b175e7ad..000000000000 --- a/lib/node_modules/@stdlib/plot/components/svg/path/lib/props/is-defined/set.js +++ /dev/null @@ -1,58 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); -var isFunction = require( '@stdlib/assert/is-function' ); -var format = require( '@stdlib/string/format' ); - - -// VARIABLES // - -var debug = logger( 'path:set:is-defined' ); - - -// MAIN // - -/** -* Sets the accessor for defined values. -* -* @private -* @param {Function} fcn - accessor -* @throws {TypeError} must be a function -*/ -function set( fcn ) { - /* eslint-disable no-invalid-this */ - if ( !isFunction( fcn ) ) { - throw new TypeError( format( 'invalid assignment. `%s` must be a function. Value: `%s`.', 'isDefined', fcn ) ); - } - debug( 'Current value: %s.', this._isDefined ); - - this._isDefined = fcn; - debug( 'New Value: %s.', this._isDefined ); - - this.emit( 'change' ); -} - - -// EXPORTS // - -module.exports = set; diff --git a/lib/node_modules/@stdlib/plot/components/svg/path/lib/props/label/get.js b/lib/node_modules/@stdlib/plot/components/svg/path/lib/props/label/get.js deleted file mode 100644 index a068a42e6c8f..000000000000 --- a/lib/node_modules/@stdlib/plot/components/svg/path/lib/props/label/get.js +++ /dev/null @@ -1,35 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -/** -* Returns the path label. -* -* @private -* @returns {string} label -*/ -function get() { - /* eslint-disable no-invalid-this */ - return this._label; -} - - -// EXPORTS // - -module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/components/svg/path/lib/props/label/set.js b/lib/node_modules/@stdlib/plot/components/svg/path/lib/props/label/set.js deleted file mode 100644 index 42bb10076108..000000000000 --- a/lib/node_modules/@stdlib/plot/components/svg/path/lib/props/label/set.js +++ /dev/null @@ -1,58 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); -var isString = require( '@stdlib/assert/is-string' ).isPrimitive; -var format = require( '@stdlib/string/format' ); - - -// VARIABLES // - -var debug = logger( 'path:set:label' ); - - -// MAIN // - -/** -* Sets the path label. -* -* @private -* @param {string} label - label -* @throws {TypeError} must be a string -*/ -function set( label ) { - /* eslint-disable no-invalid-this */ - if ( !isString( label ) ) { - throw new TypeError( format( 'invalid assignment. `%s` must be a string. Value: `%s`.', 'label', label ) ); - } - debug( 'Current value: %d.', this._label ); - - this._label = label; - debug( 'New Value: %d.', this._label ); - - this.emit( 'change' ); -} - - -// EXPORTS // - -module.exports = set; diff --git a/lib/node_modules/@stdlib/plot/components/svg/path/lib/props/line/get.js b/lib/node_modules/@stdlib/plot/components/svg/path/lib/props/line/get.js deleted file mode 100644 index 5e784f1cace1..000000000000 --- a/lib/node_modules/@stdlib/plot/components/svg/path/lib/props/line/get.js +++ /dev/null @@ -1,49 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var line = require( 'd3-shape' ).line; // TODO: remove - - -// MAIN // - -/** -* Returns a function to generate a line as an SVG path. -* -* @private -* @returns {Function} function to generate a line as an SVG path -*/ -function get() { - /* eslint-disable no-invalid-this, stdlib/empty-line-before-comment */ - var f = line() - .x( this.xPos ) - .y( this.yPos ) - .defined( this.isDefined ); - // TODO: interpolate (curve factory) - // TODO: tension - - return f; -} - - -// EXPORTS // - -module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/components/svg/path/lib/props/opacity/get.js b/lib/node_modules/@stdlib/plot/components/svg/path/lib/props/opacity/get.js deleted file mode 100644 index eea4f9db00f7..000000000000 --- a/lib/node_modules/@stdlib/plot/components/svg/path/lib/props/opacity/get.js +++ /dev/null @@ -1,35 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -/** -* Returns the opacity. -* -* @private -* @returns {number} opacity -*/ -function get() { - /* eslint-disable no-invalid-this */ - return this._opacity; -} - - -// EXPORTS // - -module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/components/svg/path/lib/props/opacity/set.js b/lib/node_modules/@stdlib/plot/components/svg/path/lib/props/opacity/set.js deleted file mode 100644 index f4867e8c4902..000000000000 --- a/lib/node_modules/@stdlib/plot/components/svg/path/lib/props/opacity/set.js +++ /dev/null @@ -1,65 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); -var isNumber = require( '@stdlib/assert/is-number' ).isPrimitive; -var format = require( '@stdlib/string/format' ); - - -// VARIABLES // - -var debug = logger( 'path:set:opacity' ); - - -// MAIN // - -/** -* Sets the opacity. -* -* @private -* @param {number} opacity - opacity -* @throws {TypeError} must be a number -* @throws {RangeError} must be a number on the interval `[0,1]` -*/ -function set( opacity ) { - /* eslint-disable no-invalid-this */ - if ( !isNumber( opacity ) ) { - throw new TypeError( format( 'invalid assignment. `%s` must be a number. Value: `%s`.', 'opacity', opacity ) ); - } - if ( - opacity < 0.0 || - opacity > 1.0 - ) { - throw new RangeError( format( 'invalid assignment. `%s` must be a number on the interval: [0, 1]. Value: `%f`.', 'opacity', opacity ) ); - } - debug( 'Current value: %d.', this._opacity ); - - this._opacity = opacity; - debug( 'New Value: %d.', this._opacity ); - - this.emit( 'change' ); -} - - -// EXPORTS // - -module.exports = set; diff --git a/lib/node_modules/@stdlib/plot/components/svg/path/lib/props/style/get.js b/lib/node_modules/@stdlib/plot/components/svg/path/lib/props/style/get.js deleted file mode 100644 index 5329c649370a..000000000000 --- a/lib/node_modules/@stdlib/plot/components/svg/path/lib/props/style/get.js +++ /dev/null @@ -1,35 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -/** -* Returns the path style. -* -* @private -* @returns {string} style -*/ -function get() { - /* eslint-disable no-invalid-this */ - return this._style; -} - - -// EXPORTS // - -module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/components/svg/path/lib/props/style/set.js b/lib/node_modules/@stdlib/plot/components/svg/path/lib/props/style/set.js deleted file mode 100644 index 8c46af529fa5..000000000000 --- a/lib/node_modules/@stdlib/plot/components/svg/path/lib/props/style/set.js +++ /dev/null @@ -1,58 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); -var isString = require( '@stdlib/assert/is-string' ).isPrimitive; -var format = require( '@stdlib/string/format' ); - - -// VARIABLES // - -var debug = logger( 'path:set:style' ); - - -// MAIN // - -/** -* Sets the path style. -* -* @private -* @param {string} v - style -* @throws {TypeError} must be a string -*/ -function set( v ) { - /* eslint-disable no-invalid-this */ - if ( !isString( v ) ) { - throw new TypeError( format( 'invalid assignment. `%s` must be a string. Value: `%s`.', 'style', v ) ); - } - debug( 'Current value: %d.', this._style ); - - this._style = v; - debug( 'New Value: %d.', this._style ); - - this.emit( 'change' ); -} - - -// EXPORTS // - -module.exports = set; diff --git a/lib/node_modules/@stdlib/plot/components/svg/path/lib/props/width/get.js b/lib/node_modules/@stdlib/plot/components/svg/path/lib/props/width/get.js deleted file mode 100644 index b2b8e8436891..000000000000 --- a/lib/node_modules/@stdlib/plot/components/svg/path/lib/props/width/get.js +++ /dev/null @@ -1,35 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -/** -* Returns the width. -* -* @private -* @returns {NonNegativeInteger} width -*/ -function get() { - /* eslint-disable no-invalid-this */ - return this._width; -} - - -// EXPORTS // - -module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/components/svg/path/lib/props/width/set.js b/lib/node_modules/@stdlib/plot/components/svg/path/lib/props/width/set.js deleted file mode 100644 index 73d2ce065935..000000000000 --- a/lib/node_modules/@stdlib/plot/components/svg/path/lib/props/width/set.js +++ /dev/null @@ -1,58 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); -var isNonNegativeInteger = require( '@stdlib/assert/is-nonnegative-integer' ).isPrimitive; -var format = require( '@stdlib/string/format' ); - - -// VARIABLES // - -var debug = logger( 'path:set:width' ); - - -// MAIN // - -/** -* Sets the width. -* -* @private -* @param {NonNegativeInteger} v - width -* @throws {TypeError} must be a nonnegative integer -*/ -function set( v ) { - /* eslint-disable no-invalid-this */ - if ( !isNonNegativeInteger( v ) ) { - throw new TypeError( format( 'invalid assignment. `%s` must be a nonnegative integer. Value: `%s`.', 'width', v ) ); - } - debug( 'Current value: %d.', this._width ); - - this._width = v; - debug( 'New Value: %d.', this._width ); - - this.emit( 'change' ); -} - - -// EXPORTS // - -module.exports = set; diff --git a/lib/node_modules/@stdlib/plot/components/svg/path/lib/props/x-pos/get.js b/lib/node_modules/@stdlib/plot/components/svg/path/lib/props/x-pos/get.js deleted file mode 100644 index a0f88087568e..000000000000 --- a/lib/node_modules/@stdlib/plot/components/svg/path/lib/props/x-pos/get.js +++ /dev/null @@ -1,61 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); - - -// VARIABLES // - -var debug = logger( 'path:xpos' ); - - -// MAIN // - -/** -* Returns a function to map values to x coordinate values. -* -* @private -* @returns {Function} map function -*/ -function get() { - /* eslint-disable no-invalid-this */ - var scale = this.xScale; - return xPos; - - /** - * Maps a value to a x coordinate value. - * - * @private - * @param {Array} d - datum - * @returns {number} pixel value - */ - function xPos( d ) { - var px = scale( d[0] ); - debug( 'Value: %d => Pixel: %d.', d[0], px ); - return px; - } -} - - -// EXPORTS // - -module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/components/svg/path/lib/props/x-scale/get.js b/lib/node_modules/@stdlib/plot/components/svg/path/lib/props/x-scale/get.js deleted file mode 100644 index a3ad33fb3c92..000000000000 --- a/lib/node_modules/@stdlib/plot/components/svg/path/lib/props/x-scale/get.js +++ /dev/null @@ -1,35 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -/** -* Returns the x-scale function. -* -* @private -* @returns {Function} scale function -*/ -function get() { - /* eslint-disable no-invalid-this */ - return this._xScale; -} - - -// EXPORTS // - -module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/components/svg/path/lib/props/x-scale/set.js b/lib/node_modules/@stdlib/plot/components/svg/path/lib/props/x-scale/set.js deleted file mode 100644 index e9412f562daf..000000000000 --- a/lib/node_modules/@stdlib/plot/components/svg/path/lib/props/x-scale/set.js +++ /dev/null @@ -1,58 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); -var isFunction = require( '@stdlib/assert/is-function' ); -var format = require( '@stdlib/string/format' ); - - -// VARIABLES // - -var debug = logger( 'path:set:xscale' ); - - -// MAIN // - -/** -* Sets the x-scale function. -* -* @private -* @param {Function} fcn - scale -* @throws {TypeError} must be a function -*/ -function set( fcn ) { - /* eslint-disable no-invalid-this */ - if ( !isFunction( fcn ) ) { - throw new TypeError( format( 'invalid assignment. `%s` must be a function. Value: `%s`.', 'xScale', fcn ) ); - } - debug( 'Current value: %s.', this._xScale ); - - this._xScale = fcn; - debug( 'New Value: %s.', this._xScale ); - - this.emit( 'change' ); -} - - -// EXPORTS // - -module.exports = set; diff --git a/lib/node_modules/@stdlib/plot/components/svg/path/lib/props/x/get.js b/lib/node_modules/@stdlib/plot/components/svg/path/lib/props/x/get.js deleted file mode 100644 index fcddeb2cb0f9..000000000000 --- a/lib/node_modules/@stdlib/plot/components/svg/path/lib/props/x/get.js +++ /dev/null @@ -1,35 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -/** -* Returns the `x` values. -* -* @private -* @returns {ArrayLike} x values -*/ -function get() { - /* eslint-disable no-invalid-this */ - return this._xData; -} - - -// EXPORTS // - -module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/components/svg/path/lib/props/x/set.js b/lib/node_modules/@stdlib/plot/components/svg/path/lib/props/x/set.js deleted file mode 100644 index 830f7f292959..000000000000 --- a/lib/node_modules/@stdlib/plot/components/svg/path/lib/props/x/set.js +++ /dev/null @@ -1,58 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); -var isArrayLike = require( '@stdlib/assert/is-array-like' ); -var format = require( '@stdlib/string/format' ); - - -// VARIABLES // - -var debug = logger( 'path:set:x' ); - - -// MAIN // - -/** -* Sets the `x` values. -* -* @private -* @param {ArrayLike} x - x values -* @throws {TypeError} must be array-like -*/ -function set( x ) { - /* eslint-disable no-invalid-this */ - if ( !isArrayLike( x ) ) { - throw new TypeError( format( 'invalid assignment. `%s` must be array-like. Value: `%s`.', 'x', x ) ); - } - debug( 'Current value: %s.', JSON.stringify( this._xData ) ); - - this._xData = x; - debug( 'New Value: %s.', JSON.stringify( this._xData ) ); - - this.emit( 'change' ); -} - - -// EXPORTS // - -module.exports = set; diff --git a/lib/node_modules/@stdlib/plot/components/svg/path/lib/props/y-pos/get.js b/lib/node_modules/@stdlib/plot/components/svg/path/lib/props/y-pos/get.js deleted file mode 100644 index ea24de704e99..000000000000 --- a/lib/node_modules/@stdlib/plot/components/svg/path/lib/props/y-pos/get.js +++ /dev/null @@ -1,61 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); - - -// VARIABLES // - -var debug = logger( 'path:ypos' ); - - -// MAIN // - -/** -* Returns a function to map values to y coordinate values. -* -* @private -* @returns {Function} map function -*/ -function get() { - /* eslint-disable no-invalid-this */ - var scale = this.yScale; - return yPos; - - /** - * Maps a value to a y coordinate value. - * - * @private - * @param {Array} d - datum - * @returns {number} pixel value - */ - function yPos( d ) { - var px = scale( d[1] ); - debug( 'Value: %d => Pixel: %d.', d[1], px ); - return px; - } -} - - -// EXPORTS // - -module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/components/svg/path/lib/props/y-scale/get.js b/lib/node_modules/@stdlib/plot/components/svg/path/lib/props/y-scale/get.js deleted file mode 100644 index 83f782c5faf5..000000000000 --- a/lib/node_modules/@stdlib/plot/components/svg/path/lib/props/y-scale/get.js +++ /dev/null @@ -1,35 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -/** -* Returns the y-scale function. -* -* @private -* @returns {Function} scale function -*/ -function get() { - /* eslint-disable no-invalid-this */ - return this._yScale; -} - - -// EXPORTS // - -module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/components/svg/path/lib/props/y-scale/set.js b/lib/node_modules/@stdlib/plot/components/svg/path/lib/props/y-scale/set.js deleted file mode 100644 index df1377fb1f7c..000000000000 --- a/lib/node_modules/@stdlib/plot/components/svg/path/lib/props/y-scale/set.js +++ /dev/null @@ -1,58 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); -var isFunction = require( '@stdlib/assert/is-function' ); -var format = require( '@stdlib/string/format' ); - - -// VARIABLES // - -var debug = logger( 'path:set:yscale' ); - - -// MAIN // - -/** -* Sets the y-scale function. -* -* @private -* @param {Function} fcn - scale -* @throws {TypeError} must be a function -*/ -function set( fcn ) { - /* eslint-disable no-invalid-this */ - if ( !isFunction( fcn ) ) { - throw new TypeError( format( 'invalid assignment. `%s` must be a function. Value: `%s`.', 'yScale', fcn ) ); - } - debug( 'Current value: %s.', this._yScale ); - - this._yScale = fcn; - debug( 'New Value: %s.', this._yScale ); - - this.emit( 'change' ); -} - - -// EXPORTS // - -module.exports = set; diff --git a/lib/node_modules/@stdlib/plot/components/svg/path/lib/props/y/get.js b/lib/node_modules/@stdlib/plot/components/svg/path/lib/props/y/get.js deleted file mode 100644 index 459d02249332..000000000000 --- a/lib/node_modules/@stdlib/plot/components/svg/path/lib/props/y/get.js +++ /dev/null @@ -1,35 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -/** -* Returns the `y` values. -* -* @private -* @returns {ArrayLike} y values -*/ -function get() { - /* eslint-disable no-invalid-this */ - return this._yData; -} - - -// EXPORTS // - -module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/components/svg/path/lib/props/y/set.js b/lib/node_modules/@stdlib/plot/components/svg/path/lib/props/y/set.js deleted file mode 100644 index 181b60b69605..000000000000 --- a/lib/node_modules/@stdlib/plot/components/svg/path/lib/props/y/set.js +++ /dev/null @@ -1,58 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); -var isArrayLike = require( '@stdlib/assert/is-array-like' ); -var format = require( '@stdlib/string/format' ); - - -// VARIABLES // - -var debug = logger( 'path:set:y' ); - - -// MAIN // - -/** -* Sets the `y` values. -* -* @private -* @param {ArrayLike} y - y values -* @throws {TypeError} must be array-like -*/ -function set( y ) { - /* eslint-disable no-invalid-this */ - if ( !isArrayLike( y ) ) { - throw new TypeError( format( 'invalid assignment. `%s` must be array-like. Value: `%s`.', 'y', y ) ); - } - debug( 'Current value: %s.', JSON.stringify( this._yData ) ); - - this._yData = y; - debug( 'New Value: %s.', JSON.stringify( this._yData ) ); - - this.emit( 'change' ); -} - - -// EXPORTS // - -module.exports = set; diff --git a/lib/node_modules/@stdlib/plot/components/svg/path/lib/render/index.js b/lib/node_modules/@stdlib/plot/components/svg/path/lib/render/index.js deleted file mode 100644 index 8fd71a989e76..000000000000 --- a/lib/node_modules/@stdlib/plot/components/svg/path/lib/render/index.js +++ /dev/null @@ -1,77 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); -var h = require( 'virtual-dom/h.js' ); -var zip = require( './utils/zip.js' ); -var style = require( './utils/style.js' ); - - -// VARIABLES // - -var debug = logger( 'path:render' ); -var ELEMENT = 'path'; - - -// MAIN // - -/** -* Renders a virtual DOM tree. -* -* @private -* @returns {VTree} virtual DOM tree -*/ -function render() { - /* eslint-disable no-invalid-this */ - var props; - var vtree; - - debug( 'Rendering...' ); - - props = { - 'namespace': 'http://www.w3.org/2000/svg', - 'property': 'line', - 'className': 'path line', - 'attributes': { - 'd': this.line( zip( this._xData, this._yData ) ), - 'fill': 'none', - 'stroke': this.color, - 'stroke-width': this.width, - 'stroke-opacity': this.opacity, - 'stroke-dasharray': style( this.style ), - 'data-label': this.label - } - }; - - debug( 'Generating a virtual DOM tree (%s) with properties: %s.', ELEMENT, JSON.stringify( props ) ); - vtree = h( ELEMENT, props, [] ); - - // Announce that a new tree has been rendered: - this.emit( '_render', vtree ); - - return vtree; -} - - -// EXPORTS // - -module.exports = render; diff --git a/lib/node_modules/@stdlib/plot/components/svg/path/lib/render/utils/style.js b/lib/node_modules/@stdlib/plot/components/svg/path/lib/render/utils/style.js deleted file mode 100644 index cdfee7788598..000000000000 --- a/lib/node_modules/@stdlib/plot/components/svg/path/lib/render/utils/style.js +++ /dev/null @@ -1,60 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// VARIABLES // - -var STYLES = { - // Solid path: - '-': '', - - // Dashes: - '--': '5, 1', - - // Dotted path: - ':': '0.9', - - // Dash-dotted path: - '-.': '5, 1, 1, 1' -}; - - -// MAIN // - -/** -* Checks for a known style. If present, returns the [`stroke-dasharray`][1]. Otherwise, returns the provided input value. -* -* [1]: https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/stroke-dasharray -* -* @private -* @param {string} v - style -* @returns {string} stroke dasharray value -*/ -function style( v ) { - var s = STYLES[ v ]; - if ( s ) { - return s; - } - return v; -} - - -// EXPORTS // - -module.exports = style; diff --git a/lib/node_modules/@stdlib/plot/components/svg/path/lib/render/utils/zip.js b/lib/node_modules/@stdlib/plot/components/svg/path/lib/render/utils/zip.js deleted file mode 100644 index 731735397afc..000000000000 --- a/lib/node_modules/@stdlib/plot/components/svg/path/lib/render/utils/zip.js +++ /dev/null @@ -1,53 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var format = require( '@stdlib/string/format' ); - - -// MAIN // - -/** -* Zips two arrays. -* -* @private -* @param {ArrayLike} x - x-values -* @param {ArrayLike} y - y-values -* @throws {Error} must provide equal length array-like objects -* @returns {Array<Array>} zipped array -*/ -function zip( x, y ) { - var out; - var i; - if ( x.length !== y.length ) { - throw new Error( format( 'invalid arguments. Must provide equal length array-like objects. x length: `%u`. y length: `%u`.', x.length, y.length ) ); - } - out = new Array( x.length ); - for ( i = 0; i < x.length; i++ ) { - out[ i ] = [ x[i], y[i] ]; - } - return out; -} - - -// EXPORTS // - -module.exports = zip; diff --git a/lib/node_modules/@stdlib/plot/components/svg/path/package.json b/lib/node_modules/@stdlib/plot/components/svg/path/package.json deleted file mode 100644 index 09336092da3c..000000000000 --- a/lib/node_modules/@stdlib/plot/components/svg/path/package.json +++ /dev/null @@ -1,62 +0,0 @@ -{ - "name": "@stdlib/plot/components/svg/path", - "version": "0.0.0", - "description": "SVG path.", - "license": "Apache-2.0", - "author": { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - }, - "contributors": [ - { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - } - ], - "main": "./lib", - "directories": { - "example": "./examples", - "lib": "./lib" - }, - "scripts": {}, - "homepage": "https://github.com/stdlib-js/stdlib", - "repository": { - "type": "git", - "url": "git://github.com/stdlib-js/stdlib.git" - }, - "bugs": { - "url": "https://github.com/stdlib-js/stdlib/issues" - }, - "dependencies": {}, - "devDependencies": {}, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], - "keywords": [ - "stdlib", - "plot", - "graph", - "chart", - "engine", - "svg", - "scalable", - "vector", - "graphics", - "path", - "line", - "series", - "component" - ] -} diff --git a/lib/node_modules/@stdlib/plot/components/svg/rects/lib/props/auto-render/get.js b/lib/node_modules/@stdlib/plot/components/svg/rects/lib/props/auto-render/get.js deleted file mode 100644 index 7df40dec3f47..000000000000 --- a/lib/node_modules/@stdlib/plot/components/svg/rects/lib/props/auto-render/get.js +++ /dev/null @@ -1,35 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -/** -* Returns the rendering mode. -* -* @private -* @returns {boolean} rendering mode -*/ -function get() { - /* eslint-disable no-invalid-this */ - return this._autoRender; -} - - -// EXPORTS // - -module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/components/svg/rects/lib/props/auto-render/set.js b/lib/node_modules/@stdlib/plot/components/svg/rects/lib/props/auto-render/set.js deleted file mode 100644 index 5ec6e51bad7b..000000000000 --- a/lib/node_modules/@stdlib/plot/components/svg/rects/lib/props/auto-render/set.js +++ /dev/null @@ -1,60 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); -var isBoolean = require( '@stdlib/assert/is-boolean' ).isPrimitive; -var format = require( '@stdlib/string/format' ); - - -// VARIABLES // - -var debug = logger( 'rects:set:auto-render' ); - - -// MAIN // - -/** -* Sets the rendering mode. -* -* @private -* @param {boolean} bool - boolean indicating whether to re-render on a change event -* @throws {TypeError} must be a boolean -*/ -function set( bool ) { - /* eslint-disable no-invalid-this */ - if ( !isBoolean( bool ) ) { - throw new TypeError( format( 'invalid assignment. `%s` must be a boolean. Value: `%s`.', 'autoRender', bool ) ); - } - if ( bool !== this._autoRender ) { - debug( 'Current value: %d.', this._autoRender ); - - this._autoRender = bool; - debug( 'New Value: %d.', this._autoRender ); - - this.emit( 'change' ); - } -} - - -// EXPORTS // - -module.exports = set; diff --git a/lib/node_modules/@stdlib/plot/components/svg/rects/lib/props/label/get.js b/lib/node_modules/@stdlib/plot/components/svg/rects/lib/props/label/get.js deleted file mode 100644 index b7dbfda965cd..000000000000 --- a/lib/node_modules/@stdlib/plot/components/svg/rects/lib/props/label/get.js +++ /dev/null @@ -1,56 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var isString = require( '@stdlib/assert/is-string' ).isPrimitive; - - -// MAIN // - -/** -* Returns a function to get a rectangle's label. -* -* @private -* @returns {Function} label accessor -*/ -function get() { - /* eslint-disable no-invalid-this */ - var self = this; - if ( isString( this._label ) ) { - return label; - } - return this._label; - - /** - * Returns the label. - * - * @private - * @returns {string} label - */ - function label() { - return self._label; // eslint-disable-line no-underscore-dangle - } -} - - -// EXPORTS // - -module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/components/svg/rects/lib/props/label/set.js b/lib/node_modules/@stdlib/plot/components/svg/rects/lib/props/label/set.js deleted file mode 100644 index ea3aa1c6f337..000000000000 --- a/lib/node_modules/@stdlib/plot/components/svg/rects/lib/props/label/set.js +++ /dev/null @@ -1,61 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); -var isString = require( '@stdlib/assert/is-string' ).isPrimitive; -var isFunction = require( '@stdlib/assert/is-function' ); -var format = require( '@stdlib/string/format' ); - - -// VARIABLES // - -var debug = logger( 'rects:set:label' ); - - -// MAIN // - -/** -* Sets the label. -* -* @private -* @param {(string|Function)} label - label -* @throws {TypeError} must be a string or a function -*/ -function set( label ) { - /* eslint-disable no-invalid-this */ - if ( !isString( label ) && !isFunction( label ) ) { - throw new TypeError( format( 'invalid assignment. `%s` must be a string or a function. Value: `%s`.', 'label', label ) ); - } - if ( label !== this._label ) { - debug( 'Current value: %d.', this._label ); - - this._label = label; - debug( 'New Value: %d.', this._label ); - - this.emit( 'change' ); - } -} - - -// EXPORTS // - -module.exports = set; diff --git a/lib/node_modules/@stdlib/plot/components/svg/rects/lib/props/x-pos/get.js b/lib/node_modules/@stdlib/plot/components/svg/rects/lib/props/x-pos/get.js deleted file mode 100644 index df38da3418c5..000000000000 --- a/lib/node_modules/@stdlib/plot/components/svg/rects/lib/props/x-pos/get.js +++ /dev/null @@ -1,61 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); - - -// VARIABLES // - -var debug = logger( 'rects:x-pos' ); - - -// MAIN // - -/** -* Returns a function to map values to `x` coordinate values. -* -* @private -* @returns {Function} map function -*/ -function get() { - /* eslint-disable no-invalid-this */ - var scale = this.xScale; - - return xPos; - /** - * Maps a value to an `x` coordinate value. - * - * @private - * @param {*} d - datum - * @returns {number} pixel value - */ - function xPos( d ) { - var px = scale( d ); - debug( 'Value: %d => Pixel: %d.', d, px ); - return px; - } -} - - -// EXPORTS // - -module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/components/svg/rects/lib/props/x-scale/get.js b/lib/node_modules/@stdlib/plot/components/svg/rects/lib/props/x-scale/get.js deleted file mode 100644 index a3ad33fb3c92..000000000000 --- a/lib/node_modules/@stdlib/plot/components/svg/rects/lib/props/x-scale/get.js +++ /dev/null @@ -1,35 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -/** -* Returns the x-scale function. -* -* @private -* @returns {Function} scale function -*/ -function get() { - /* eslint-disable no-invalid-this */ - return this._xScale; -} - - -// EXPORTS // - -module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/components/svg/rects/lib/props/x-scale/set.js b/lib/node_modules/@stdlib/plot/components/svg/rects/lib/props/x-scale/set.js deleted file mode 100644 index 3c21e462845c..000000000000 --- a/lib/node_modules/@stdlib/plot/components/svg/rects/lib/props/x-scale/set.js +++ /dev/null @@ -1,60 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); -var isFunction = require( '@stdlib/assert/is-function' ); -var format = require( '@stdlib/string/format' ); - - -// VARIABLES // - -var debug = logger( 'rects:set:xscale' ); - - -// MAIN // - -/** -* Sets the x-scale function. -* -* @private -* @param {Function} fcn - scale -* @throws {TypeError} must be a function -*/ -function set( fcn ) { - /* eslint-disable no-invalid-this */ - if ( !isFunction( fcn ) ) { - throw new TypeError( format( 'invalid assignment. `%s` must be a function. Value: `%s`.', 'xScale', fcn ) ); - } - if ( fcn !== this._xScale ) { - debug( 'Current value: %s.', this._xScale ); - - this._xScale = fcn; - debug( 'New Value: %s.', this._xScale ); - - this.emit( 'change' ); - } -} - - -// EXPORTS // - -module.exports = set; diff --git a/lib/node_modules/@stdlib/plot/components/svg/rects/lib/props/y-pos/get.js b/lib/node_modules/@stdlib/plot/components/svg/rects/lib/props/y-pos/get.js deleted file mode 100644 index 54d127c395bf..000000000000 --- a/lib/node_modules/@stdlib/plot/components/svg/rects/lib/props/y-pos/get.js +++ /dev/null @@ -1,61 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); - - -// VARIABLES // - -var debug = logger( 'rects:y-pos' ); - - -// MAIN // - -/** -* Returns a function to map values to `y` coordinate values. -* -* @private -* @returns {Function} map function -*/ -function get() { - /* eslint-disable no-invalid-this */ - var scale = this.yScale; - return yPos; - - /** - * Maps a value to a `y` coordinate value. - * - * @private - * @param {*} d - datum - * @returns {number} pixel value - */ - function yPos( d ) { - var px = scale( d ); - debug( 'Value: %d => Pixel: %d.', d, px ); - return px; - } -} - - -// EXPORTS // - -module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/components/svg/rects/lib/props/y-scale/get.js b/lib/node_modules/@stdlib/plot/components/svg/rects/lib/props/y-scale/get.js deleted file mode 100644 index 83f782c5faf5..000000000000 --- a/lib/node_modules/@stdlib/plot/components/svg/rects/lib/props/y-scale/get.js +++ /dev/null @@ -1,35 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -/** -* Returns the y-scale function. -* -* @private -* @returns {Function} scale function -*/ -function get() { - /* eslint-disable no-invalid-this */ - return this._yScale; -} - - -// EXPORTS // - -module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/components/svg/rects/lib/props/y-scale/set.js b/lib/node_modules/@stdlib/plot/components/svg/rects/lib/props/y-scale/set.js deleted file mode 100644 index 5cb18935cea5..000000000000 --- a/lib/node_modules/@stdlib/plot/components/svg/rects/lib/props/y-scale/set.js +++ /dev/null @@ -1,60 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); -var isFunction = require( '@stdlib/assert/is-function' ); -var format = require( '@stdlib/string/format' ); - - -// VARIABLES // - -var debug = logger( 'rects:set:yscale' ); - - -// MAIN // - -/** -* Sets the y-scale function. -* -* @private -* @param {Function} fcn - scale -* @throws {TypeError} must be a function -*/ -function set( fcn ) { - /* eslint-disable no-invalid-this */ - if ( !isFunction( fcn ) ) { - throw new TypeError( format( 'invalid assignment. `%s` must be a function. Value: `%s`.', 'yScale', fcn ) ); - } - if ( fcn !== this._yScale ) { - debug( 'Current value: %s.', this._yScale ); - - this._yScale = fcn; - debug( 'New Value: %s.', this._yScale ); - - this.emit( 'change' ); - } -} - - -// EXPORTS // - -module.exports = set; diff --git a/lib/node_modules/@stdlib/plot/components/svg/rects/lib/render/columns.js b/lib/node_modules/@stdlib/plot/components/svg/rects/lib/render/columns.js deleted file mode 100644 index d2e51cb0496c..000000000000 --- a/lib/node_modules/@stdlib/plot/components/svg/rects/lib/render/columns.js +++ /dev/null @@ -1,106 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); -var h = require( 'virtual-dom/h.js' ); - - -// VARIABLES // - -var debug = logger( 'rects:render:rects' ); -var ELEMENT = 'rect'; - - -// MAIN // - -/** -* Renders data as a rectangles. -* -* @private -* @param {Object} state - state -* @returns {Array<VTree>} array of virtual trees -*/ -function render( state ) { - var lineOpacity; - var faceOpacity; - var faceColor; - var lineColor; - var label; - var props; - var xPos; - var yPos; - var data; - var out; - var pos; - var x0; - var x1; - var y; - var i; - var j; - - debug( 'Rendering rectangles...' ); - - label = state.label; - lineOpacity = state.lineOpacity; - faceOpacity = state.faceOpacity; - lineColor = state.lineColor; - faceColor = state.faceColor; - xPos = state.xPos; - yPos = state.yPos; - data = state.data; - - out = new Array( data.length/3 ); - for ( i = 0; i < data.length; i += 3 ) { - j = i / 3; - - x0 = data[ i ]; - x1 = data[ i+1 ]; - y = data[ i+2 ]; - - pos = xPos( x0 ); - - debug( 'Rendering datum %d...', j ); - props = { - 'namespace': 'http://www.w3.org/2000/svg', - 'property': 'column', - 'className': 'column', - 'attributes': { - 'x': pos, - 'width': xPos( x1 ) - pos, - 'height': yPos( y ), // FIXME - 'stroke': lineColor( x0, x1, y, j ), - 'stroke-opacity': lineOpacity( x0, x1, y, j ), - 'fill': faceColor( x0, x1, y, j ), - 'fill-opacity': faceOpacity( x0, x1, y, j ), - 'data-label': label( x0, x1, y, j ) - } - }; - debug( 'Generating a virtual DOM tree (%s) with properties: %s.', ELEMENT, JSON.stringify( props ) ); - out[ j ] = h( ELEMENT, props, [] ); - } - return out; -} - - -// EXPORTS // - -module.exports = render; diff --git a/lib/node_modules/@stdlib/plot/components/svg/rects/lib/render/index.js b/lib/node_modules/@stdlib/plot/components/svg/rects/lib/render/index.js deleted file mode 100644 index c6213fb11369..000000000000 --- a/lib/node_modules/@stdlib/plot/components/svg/rects/lib/render/index.js +++ /dev/null @@ -1,76 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); -var h = require( 'virtual-dom/h.js' ); -var columns = require( './columns.js' ); -var bars = require( './bars.js' ); - - -// VARIABLES // - -var debug = logger( 'rects:render' ); -var ELEMENT = 'g'; -var RENDER = { - 'vertical': columns, - 'horizontal': bars -}; - - -// MAIN // - -/** -* Renders a virtual DOM tree. -* -* @private -* @returns {VTree} virtual DOM tree -*/ -function render() { - /* eslint-disable no-invalid-this */ - var children; - var props; - var vtree; - var f; - - debug( 'Rendering...' ); - - props = { - 'namespace': 'http://www.w3.org/2000/svg', - 'property': 'rects', - 'className': 'rects' - }; - f = RENDER[ this.orientation ]; - children = f( this ); - - debug( 'Generating a virtual DOM tree (%s) with properties: %s.', ELEMENT, JSON.stringify( props ) ); - vtree = h( ELEMENT, props, children ); - - // Announce that a new tree has been rendered: - this.emit( '_render', vtree ); - - return vtree; -} - - -// EXPORTS // - -module.exports = render; diff --git a/lib/node_modules/@stdlib/plot/components/svg/rug/README.md b/lib/node_modules/@stdlib/plot/components/svg/rug/README.md deleted file mode 100644 index 7f0ff357befd..000000000000 --- a/lib/node_modules/@stdlib/plot/components/svg/rug/README.md +++ /dev/null @@ -1,464 +0,0 @@ -<!-- - -@license Apache-2.0 - -Copyright (c) 2018 The Stdlib Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. - ---> - -# Rug - -> [SVG][svg] rug component. - -<!-- Section to include introductory text. Make sure to keep an empty line after the intro `section` element and another before the `/section` close. --> - -<section class="intro"> - -<!-- <figure class="figure" align="center" label="fig:intro_plot" src="./srv/scripts/fig_intro_plot.js" alt="Scatterplot with rug plots along the axes."> --> - -<!-- TODO: add figure --> - -<!-- </figure> --> - -A **rug plot** provides a compact 1-dimensional visualization to supplement higher dimensional plots by displaying a [marginal distribution][marginal-distribution] along one axis. Displaying a [marginal distribution][marginal-distribution] is useful in helping reveal the "shape" of data, especially when visual space is limited. - -</section> - -<!-- /.intro --> - -<!-- Package usage documentation. --> - -<section class="usage"> - -## Usage - -```javascript -var Rug = require( '@stdlib/plot/components/svg/rug' ); -``` - -#### Rug( \[options] ) - -Returns a `Rug` instance. - -```javascript -var node = new Rug(); -// returns <Rug> -``` - -The constructor accepts the following `options`: - -- **autoRender**: `boolean` indicating whether to re-render on a `'change'` event. Default: `true`. -- **color**: tick (tassel) color. May be either a `string` or a `function`. Default: `'#aaa'`. -- **data**: array-like `object` containing tick data. Default: `[]`. -- **isDefined**: predicate function indicating whether a datum is defined. By default, the function treats `NaN` values as undefined data values. -- **label**: tick (tassel) label. May be either a `string` or a `function`. Default: `''`. -- **opacity**: tick (tassel) opacity. Must be on the interval `[0,1]`. Default: `0.9`. -- **orientation**: rug orientation. Must be either bottom, top, right, or left. Default: `'bottom'`. -- **scale**: scale function which maps data values to coordinates. -- **size**: tick (tassel) size. Default: `6` pixels. - -To specify rug plot options at instantiation, provide an `options` object. - -```javascript -var opts = { - 'data': [ 0.1, 0.3, 0.5 ], - 'color': '#ff0000', - 'label': 'group-1', - 'opacity': 0.7, - 'orientation': 'bottom', - 'size': 5, - 'autoRender': false -}; - -var node = new Rug( opts ); -// returns <Rug> -``` - -* * * - -### Properties - -<a name="property-autorender"></a> - -#### Rug.prototype.autoRender - -**Writable** property which specifies whether an instance re-renders on each `'change'` event. - -```javascript -var node = new Rug({ - 'autoRender': false -}); - -var mode = node.autoRender; -// returns false -``` - -<a name="property-color"></a> - -#### Rug.prototype.color - -**Writable** property which specifies tick (tassel) color. A color value may be either a `string` or an accessor `function`. - -```javascript -var node = new Rug({ - 'color': 'steelblue' -}); - -var color = node.color; -// returns <Function> -``` - -When retrieved, the returned value is always an accessor which accepts two parameters: - -- **d**: datum -- **i**: datum index - -<a name="property-data"></a> - -#### Rug.prototype.data - -**Writable** property which specifies the tick (tassel) data. - -```javascript -var node = new Rug({ - 'data': [ 0.1, 0.2, 0.3 ] -}); - -var data = node.data; -// returns [ 0.1, 0.2, 0.3 ] -``` - -<a name="property-isdefined"></a> - -#### Rug.prototype.isDefined( d, i ) - -**Writable** property whose value is a predicate `function` which indicates whether a datum is defined and thus determines how missing values are encoded. When invoked, the function is provided two arguments: - -- **d**: datum. -- **i**: datum index. - -```javascript -function isDefined( d ) { - return ( d !== null ); -} - -var node = new Rug({ - 'isDefined': isDefined -}); - -node.isDefined = isDefined; -// returns <Function> -``` - -The default function behavior defines `NaN` data values as undefined. - -<a name="property-label"></a> - -#### Rug.prototype.label - -**Writable** property specifying a tick (tassel) label. A label value may be either a `string` or an accessor `function`. - -```javascript -var node = new Rug({ - 'label': 'group-1' -}); - -var label = node.label; -// returns <Function> -``` - -When retrieved, the returned value is always an accessor which accepts two parameters: - -- **d**: datum. -- **i**: datum index. - -<a name="property-opacity"></a> - -#### Rug.prototype.opacity - -**Writable** property specifying tick (tassel) opacity. An opacity value may be either a `number` or an accessor `function`. - -```javascript -var node = new Rug({ - 'opacity': 0.5 -}); - -var opacity = node.opacity; -// returns <Function> -``` - -When retrieved, the returned value is always an accessor which accepts two parameters: - -- **d**: datum. -- **i**: datum index. - -<a name="property-orientation"></a> - -#### Rug.prototype.orientation - -**Writable** property specifying the rug plot orientation. - -```javascript -var node = new Rug({ - 'orientation': 'left' -}); - -var orient = node.orientation; -// returns 'left' -``` - -An orientation may be one of the following values: - -- **bottom**: bottom orientation (default) -- **top**: top orientation -- **left**: left orientation -- **right**: right orientation - -<a name="property-scale"></a> - -#### Rug.prototype.scale - -**Writable** property providing a function which maps data values to coordinate values. - -```javascript -function scale( d, i ) { - console.log( d, i ); - return d; -} - -var node = new Rug({ - 'scale': scale -}); - -var fcn = node.scale; -// returns <Function> -``` - -<a name="property-size"></a> - -#### Rug.prototype.size - -**Writable** property specifying tick (tassel) size. - -```javascript -var node = new Rug({ - 'size': 5 -}); - -var size = node.size; -// returns 5 -``` - -* * * - -### Methods - -<a name="method-render"></a> - -#### Rug.prototype.render() - -Renders an instance as a [virtual DOM tree][virtual-dom]. - -```javascript -var node = new Rug({ - 'data': [ 0.1 ] -}); - -var vtree = node.render(); -/* e.g., returns - { - 'tagName': 'g', - 'properties': { - 'property': 'rug', - 'className': 'rug', - 'namespace': void 0 - }, - 'children': [ - { - 'tagName': 'line', - 'properties': { - 'property': 'rug.tick', - 'className': 'tick', - 'attributes': { - 'fill': 'none', - 'opacity': 0.9, - 'stroke': '#aaa', - 'stroke-width': 1, - 'data-label': '', - 'y1': 0, - 'y2': -6, - 'x1': 0.1, - 'x2': 0.1 - }, - 'namespace': void 0 - }, - 'children': [], - 'namespace': 'http://www.w3.org/2000/svg', - 'count': 0, - 'hasWidgets': false, - 'hasThunks': false, - 'descendantHooks': false, - 'hooks': void 0, - 'key': void 0 - } - ], - 'namespace': 'http://www.w3.org/2000/svg', - 'count': 3, - 'hasWidgets': false, - 'hasThunks': false, - 'descendantHooks': false, - 'hooks': void 0, - 'key': void 0 - } -*/ -``` - -* * * - -### Events - -<a name='event-render'></a> - -#### 'render' - -Event emitted when an instance renders. The event object is the rendered [Virtual DOM tree][virtual-dom]. - -```javascript -var node = new Rug(); - -function onRender( vtree ) { - console.log( vtree ); -} - -// Attach an event listener: -node.on( 'render', onRender ); - -// Render an instance: -node.render(); -``` - -* * * - -### Listeners - -<a name='listener-change'></a> - -#### 'change' - -If `autoRender` is `true`, upon receiving a `'change'` event, an instance re-renders. - -```javascript -var node = new Rug({ - 'autoRender': true -}); - -function onRender( vtree ) { - console.log( vtree ); -} - -// Attach an event listener: -node.on( 'render', onRender ); - -// Manually trigger a change event: -node.emit( 'change' ); -``` - -</section> - -<!-- /.usage --> - -<!-- Package usage notes. Make sure to keep an empty line after the `section` element and another before the `/section` close. --> - -<section class="notes"> - -</section> - -<!-- /.notes --> - -<!-- Package usage examples. --> - -* * * - -<section class="examples"> - -## Examples - -<!-- eslint no-undef: "error" --> - -```javascript -var toHTML = require( 'vdom-to-html' ); -var rug = require( '@stdlib/plot/components/svg/rug' ); - -// Create a new rug component: -var opts = { - 'data': [ 0.10, 0.50, 0.90 ], - 'orientation': 'bottom' -}; -var r = rug( opts ); - -// Render as a virtual DOM tree: -var vtree = r.render(); - -// Transform the virtual DOM tree to HTML: -var html = toHTML( vtree ); -// returns <g property="rug" class="rug"><line property="rug.tick" class="tick" fill="none" opacity="0.9" stroke="#aaa" stroke-width="1" data-label="" y1="0" y2="-6" x1="0.1" x2="0.1"></line><line property="rug.tick" class="tick" fill="none" opacity="0.9" stroke="#aaa" stroke-width="1" data-label="" y1="0" y2="-6" x1="0.5" x2="0.5"></line><line property="rug.tick" class="tick" fill="none" opacity="0.9" stroke="#aaa" stroke-width="1" data-label="" y1="0" y2="-6" x1="0.9" x2="0.9"></line></g> - -// Listen for 'render' events (e.g., when triggered due to changes in state): -r.on( 'render', onRender ); - -setTimeout( update, 1000 ); - -function update() { - r.data = [ 0.99, 0.87, 0.92 ]; -} - -function onRender( vtree ) { - console.log( toHTML( vtree ) ); -} -``` - -</section> - -<!-- /.examples --> - -<!-- Section to include cited references. If references are included, add a horizontal rule *before* the section. Make sure to keep an empty line after the `section` element and another before the `/section` close. --> - -<section class="references"> - -</section> - -<!-- /.references --> - -<!-- Section for related `stdlib` packages. Do not manually edit this section, as it is automatically populated. --> - -<section class="related"> - -</section> - -<!-- /.related --> - -<!-- Section for all links. Make sure to keep an empty line after the `section` element and another before the `/section` close. --> - -<section class="links"> - -[svg]: https://www.w3.org/Graphics/SVG/ - -[virtual-dom]: https://github.com/Matt-Esch/virtual-dom - -[marginal-distribution]: https://en.wikipedia.org/wiki/Marginal_distribution - -</section> - -<!-- /.links --> diff --git a/lib/node_modules/@stdlib/plot/components/svg/rug/benchmark/benchmark.js b/lib/node_modules/@stdlib/plot/components/svg/rug/benchmark/benchmark.js deleted file mode 100644 index fae73530b51d..000000000000 --- a/lib/node_modules/@stdlib/plot/components/svg/rug/benchmark/benchmark.js +++ /dev/null @@ -1,336 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench' ); -var noop = require( '@stdlib/utils/noop' ); -var randu = require( '@stdlib/random/base/randu' ); -var isArray = require( '@stdlib/assert/is-array' ); -var pkg = require( './../package.json' ).name; -var Rug = require( './../lib' ); - - -// MAIN // - -bench( pkg+'::instantiation', function benchmark( b ) { - var node; - var i; - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - node = new Rug(); - if ( !( node instanceof Rug ) ) { - b.fail( 'should return an instance' ); - } - } - b.toc(); - if ( !( node instanceof Rug ) ) { - b.fail( 'should return an instance' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::instantiation,no_new', function benchmark( b ) { - var ctor; - var node; - var i; - - ctor = Rug; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - node = ctor(); - if ( !( node instanceof Rug ) ) { - b.fail( 'should return an instance' ); - } - } - b.toc(); - if ( !( node instanceof Rug ) ) { - b.fail( 'should return an instance' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::instantiation,options', function benchmark( b ) { - var node; - var opts; - var i; - - opts = { - 'autoRender': false, - 'color': '#474747', - 'data': [ 1, 2, 3 ], - 'isDefined': noop, - 'label': 'beep', - 'opacity': 1.0, - 'orientation': 'left', - 'size': 10, - 'scale': noop - }; - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - node = new Rug( opts ); - if ( !( node instanceof Rug ) ) { - b.fail( 'should return an instance' ); - } - } - b.toc(); - if ( !( node instanceof Rug ) ) { - b.fail( 'should return an instance' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::set,get:autoRender', function benchmark( b ) { - var node; - var bool; - var i; - - node = new Rug(); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - node.autoRender = !bool; - if ( typeof node.autoRender !== 'boolean' ) { - b.fail( 'should return a boolean' ); - } - } - b.toc(); - if ( typeof node.autoRender !== 'boolean' ) { - b.fail( 'should return a boolean' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::set,get:color', function benchmark( b ) { - var values; - var node; - var i; - - values = [ - '#fff', - '#000' - ]; - node = new Rug(); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - node.color = values[ i % values.length ]; - if ( typeof node.color !== 'function' ) { - b.fail( 'should return a function' ); - } - } - b.toc(); - if ( typeof node.color !== 'function' ) { - b.fail( 'should return a function' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::set,get:data', function benchmark( b ) { - var node; - var i; - - node = new Rug(); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - node.data = [ randu(), randu(), randu() ]; - if ( typeof node.data !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isArray( node.data ) ) { - b.fail( 'should return an array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::set,get:isDefined', function benchmark( b ) { - var node; - var i; - - node = new Rug(); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - node.isDefined = createFcn(); - if ( typeof node.isDefined !== 'function' ) { - b.fail( 'should return a function' ); - } - } - b.toc(); - if ( typeof node.isDefined !== 'function' ) { - b.fail( 'should return a function' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function createFcn() { - return beep; - function beep() { - // No-op... - } - } -}); - -bench( pkg+'::set,get:label', function benchmark( b ) { - var values; - var node; - var i; - - values = [ - 'beep', - 'boop' - ]; - node = new Rug(); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - node.label = values[ i % values.length ]; - if ( typeof node.label !== 'function' ) { - b.fail( 'should return a function' ); - } - } - b.toc(); - if ( typeof node.label !== 'function' ) { - b.fail( 'should return a function' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::set,get:opacity', function benchmark( b ) { - var node; - var i; - - node = new Rug(); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - node.opacity = randu(); - if ( typeof node.opacity !== 'function' ) { - b.fail( 'should return a function' ); - } - } - b.toc(); - if ( typeof node.opacity !== 'function' ) { - b.fail( 'should return a function' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::set,get:orientation', function benchmark( b ) { - var values; - var node; - var v; - var i; - - values = [ - 'left', - 'right', - 'top', - 'bottom' - ]; - node = new Rug(); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = values[ i % values.length ]; - node.orientation = v; - if ( node.orientation !== v ) { - b.fail( 'should return set value' ); - } - } - b.toc(); - if ( typeof node.orientation !== 'string' ) { - b.fail( 'should return a string' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::set,get:scale', function benchmark( b ) { - var node; - var i; - - node = new Rug(); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - node.scale = createFcn(); - if ( typeof node.scale !== 'function' ) { - b.fail( 'should return a function' ); - } - } - b.toc(); - if ( typeof node.scale !== 'function' ) { - b.fail( 'should return a function' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function createFcn() { - return beep; - function beep() { - // No-op... - } - } -}); - -bench( pkg+'::set,get:size', function benchmark( b ) { - var values; - var node; - var v; - var i; - - values = [ - 1, - 2, - 3, - 4, - 5, - 6 - ]; - node = new Rug(); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = values[ i % values.length ]; - node.size = v; - if ( node.size !== v ) { - b.fail( 'should return set value' ); - } - } - b.toc(); - if ( typeof node.size !== 'number' ) { - b.fail( 'should return a number' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/lib/node_modules/@stdlib/plot/components/svg/rug/benchmark/benchmark.render.js b/lib/node_modules/@stdlib/plot/components/svg/rug/benchmark/benchmark.render.js deleted file mode 100644 index e8cf993bf01d..000000000000 --- a/lib/node_modules/@stdlib/plot/components/svg/rug/benchmark/benchmark.render.js +++ /dev/null @@ -1,106 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench' ); -var randu = require( '@stdlib/random/base/randu' ); -var pow = require( '@stdlib/math/base/special/pow' ); -var Float64Array = require( '@stdlib/array/float64' ); -var pkg = require( './../package.json' ).name; -var Rug = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var node; - var x; - var i; - - x = new Float64Array( len ); - for ( i = 0; i < x.length; i++ ) { - x[ i ] = randu(); - } - node = new Rug({ - 'data': x - }); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var vtree; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - x[ x.length-1 ] = randu(); - vtree = node.render(); - if ( typeof vtree !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( typeof vtree !== 'object' ) { - b.fail( 'should return an object' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var len; - var min; - var max; - var f; - var i; - - min = 1; // 10^min - max = 4; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':render:len='+len, f ); - } -} - -main(); diff --git a/lib/node_modules/@stdlib/plot/components/svg/rug/examples/index.js b/lib/node_modules/@stdlib/plot/components/svg/rug/examples/index.js deleted file mode 100644 index d30bc38bdff6..000000000000 --- a/lib/node_modules/@stdlib/plot/components/svg/rug/examples/index.js +++ /dev/null @@ -1,52 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -var toHTML = require( 'vdom-to-html' ); -var rug = require( './../lib' ); - -// Create a new rug component: -var opts = { - 'data': [ 0.10, 0.50, 0.90 ], - 'orientation': 'bottom', - 'autoRender': true -}; -var r = rug( opts ); - -// Render as a virtual DOM tree: -var vtree = r.render(); -console.log( JSON.stringify( vtree ) ); - -// Transform the virtual DOM tree to HTML: -var html = toHTML( vtree ); -console.log( html ); -// => <g property="rug" class="rug"><line property="rug.tick" class="tick" fill="none" opacity="0.9" stroke="#aaa" stroke-width="1" data-label="" y1="0" y2="-6" x1="0.1" x2="0.1"></line><line property="rug.tick" class="tick" fill="none" opacity="0.9" stroke="#aaa" stroke-width="1" data-label="" y1="0" y2="-6" x1="0.5" x2="0.5"></line><line property="rug.tick" class="tick" fill="none" opacity="0.9" stroke="#aaa" stroke-width="1" data-label="" y1="0" y2="-6" x1="0.9" x2="0.9"></line></g> - -// Listen for 'render' events (e.g., when triggered due to changes in state): -r.on( 'render', onRender ); - -setTimeout( update, 1000 ); - -function update() { - r.data = [ 0.99, 0.87, 0.92 ]; -} - -function onRender( vtree ) { - console.log( toHTML( vtree ) ); -} diff --git a/lib/node_modules/@stdlib/plot/components/svg/rug/lib/accessors/is_defined.js b/lib/node_modules/@stdlib/plot/components/svg/rug/lib/accessors/is_defined.js deleted file mode 100644 index 72d4dc4f9d53..000000000000 --- a/lib/node_modules/@stdlib/plot/components/svg/rug/lib/accessors/is_defined.js +++ /dev/null @@ -1,51 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); -var isnan = require( '@stdlib/assert/is-nan' ).isPrimitive; - - -// VARIABLES // - -var debug = logger( 'rug:accessor:is-defined' ); - - -// MAIN // - -/** -* Predicate function which returns a boolean indicating whether a datum is defined. -* -* @private -* @param {number} d - datum -* @param {integer} i - index -* @returns {boolean} boolean indicating whether a datum is defined -*/ -function isDefined( d ) { - var bool = !isnan( d ); - debug( 'Datum: %s. Defined: %s.', JSON.stringify( d ), bool ); - return bool; -} - - -// EXPORTS // - -module.exports = isDefined; diff --git a/lib/node_modules/@stdlib/plot/components/svg/rug/lib/defaults.json b/lib/node_modules/@stdlib/plot/components/svg/rug/lib/defaults.json deleted file mode 100644 index be3c01de77d8..000000000000 --- a/lib/node_modules/@stdlib/plot/components/svg/rug/lib/defaults.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "autoRender": false, - "color": "#aaa", - "data": [], - "isDefined": null, - "label": "", - "opacity": 0.9, - "orientation": "bottom", - "scale": null, - "size": 6 -} diff --git a/lib/node_modules/@stdlib/plot/components/svg/rug/lib/index.js b/lib/node_modules/@stdlib/plot/components/svg/rug/lib/index.js deleted file mode 100644 index 8133d0a2cb20..000000000000 --- a/lib/node_modules/@stdlib/plot/components/svg/rug/lib/index.js +++ /dev/null @@ -1,42 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -/** -* SVG rug component. -* -* @module @stdlib/plot/components/svg/rug -* -* @example -* var Rug = require( '@stdlib/plot/components/svg/rug' ); -* -* var node = new Rug({ -* 'data': [ 0.1, 0.2, 0.3 ] -* }); -* // returns <Rug> -*/ - -// MODULES // - -var main = require( './main.js' ); - - -// EXPORTS // - -module.exports = main; diff --git a/lib/node_modules/@stdlib/plot/components/svg/rug/lib/main.js b/lib/node_modules/@stdlib/plot/components/svg/rug/lib/main.js deleted file mode 100644 index a625d7d2974c..000000000000 --- a/lib/node_modules/@stdlib/plot/components/svg/rug/lib/main.js +++ /dev/null @@ -1,445 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var EventEmitter = require( 'events' ).EventEmitter; -var logger = require( 'debug' ); -var linear = require( 'd3-scale' ).scaleLinear; // TODO: remove -var defineProperty = require( '@stdlib/utils/define-property' ); -var setReadOnly = require( '@stdlib/utils/define-read-only-property' ); -var objectKeys = require( '@stdlib/utils/keys' ); -var format = require( '@stdlib/string/format' ); -var copy = require( '@stdlib/utils/copy' ); -var merge = require( '@stdlib/utils/merge' ); -var isObject = require( '@stdlib/assert/is-plain-object' ); -var instanceOf = require( '@stdlib/assert/instance-of' ); -var inherit = require( '@stdlib/utils/inherit' ); -var isDefined = require( './accessors/is_defined.js' ); -var defaults = require( './defaults.json' ); -var setAutoRender = require( './props/auto-render/set.js' ); -var getAutoRender = require( './props/auto-render/get.js' ); -var setColor = require( './props/color/set.js' ); -var getColor = require( './props/color/get.js' ); -var setData = require( './props/data/set.js' ); -var getData = require( './props/data/get.js' ); -var setIsDefined = require( './props/is-defined/set.js' ); -var getIsDefined = require( './props/is-defined/get.js' ); -var setLabel = require( './props/label/set.js' ); -var getLabel = require( './props/label/get.js' ); -var setOpacity = require( './props/opacity/set.js' ); -var getOpacity = require( './props/opacity/get.js' ); -var setOrientation = require( './props/orientation/set.js' ); -var getOrientation = require( './props/orientation/get.js' ); -var getPos = require( './props/pos/get.js' ); -var setScale = require( './props/scale/set.js' ); -var getScale = require( './props/scale/get.js' ); -var setSize = require( './props/size/set.js' ); -var getSize = require( './props/size/get.js' ); -var render = require( './render' ); - - -// VARIABLES // - -var debug = logger( 'rug:main' ); -var PRIVATE_PROPS = [ - '_autoRender', - '_color', - '_data', - '_isDefined', - '_label', - '_opacity', - '_orientation', - '_scale', - '_size' -]; - - -// MAIN // - -/** -* Rug constructor. -* -* @constructor -* @param {Options} [options] - constructor options -* @param {boolean} [options.autoRender=false] - indicates whether to re-render on a change event -* @param {(string|Function)} [options.color="#aaa"] - color -* @param {ArrayLike} [options.data=[]] - data -* @param {Function} [options.isDefined] - predicate function indicating whether a datum is defined -* @param {(string|Function)} [options.label] - label -* @param {(number|Function)} [options.opacity=0.9] - opacity -* @param {string} [options.orientation="bottom"] - orientation -* @param {Function} [options.scale] - scale function -* @param {NonNegativeInteger} [options.size=6] - tick (tassel) size -* @throws {TypeError} options argument must be an object -* @throws {TypeError} must provide valid options -* @returns {Rug} Rug instance -* -* @example -* var node = new Rug({ -* 'data': [ 0.1, 0.2, 0.3 ] -* }); -* // returns <Rug> -*/ -function Rug( options ) { - var self; - var keys; - var opts; - var key; - var i; - if ( !instanceOf( this, Rug ) ) { - if ( arguments.length ) { - return new Rug( options ); - } - return new Rug(); - } - self = this; - - opts = copy( defaults ); - opts.isDefined = isDefined; - opts.scale = linear(); - - if ( arguments.length ) { - if ( !isObject( options ) ) { - throw new TypeError( format( 'invalid argument. Options argument must be an object. Value: `%s`.', options ) ); - } - opts = merge( opts, options ); - } - debug( 'Creating an instance with the following configuration: %s.', JSON.stringify( opts ) ); - EventEmitter.call( this ); - - for ( i = 0; i < PRIVATE_PROPS.length; i++ ) { - defineProperty( this, PRIVATE_PROPS[i], { - 'configurable': false, - 'enumerable': false, - 'writable': true, - 'value': null - }); - } - // Set options... - keys = objectKeys( opts ); - for ( i = 0; i < keys.length; i++ ) { - key = keys[ i ]; - this[ key ] = opts[ key ]; - } - - this.on( 'change', onChange ); - this.on( '_render', onRender ); - - return this; - - /** - * Callback invoked upon receiving a change event. - * - * @private - */ - function onChange() { - debug( 'Received a change event.' ); - if ( self._autoRender ) { // eslint-disable-line no-underscore-dangle - self.render(); - } - } - - /** - * Re-emits a render event. - * - * @private - */ - function onRender() { - var args; - var i; - debug( 'Received a render event. Re-emitting...' ); - args = new Array( arguments.length+1 ); - args[ 0 ] = 'render'; - for ( i = 0; i < arguments.length; i++ ) { - args[ i+1 ] = arguments[ i ]; - } - self.emit.apply( self, args ); - } -} - -/* -* Inherit from the `EventEmitter` prototype. -*/ -inherit( Rug, EventEmitter ); - -/** -* Rendering mode. If `true`, an instance re-renders on each change event. -* -* @name autoRender -* @memberof Rug.prototype -* @type {boolean} -* @throws {TypeError} must be a boolean -* @default false -* -* @example -* var node = new Rug({ -* 'autoRender': true -* }); -* -* var mode = node.autoRender; -* // returns true -*/ -defineProperty( Rug.prototype, 'autoRender', { - 'configurable': false, - 'enumerable': true, - 'set': setAutoRender, - 'get': getAutoRender -}); - -/** -* Tick color. When retrieved, the returned value is a color accessor. -* -* @name color -* @memberof Rug.prototype -* @type {(string|Function)} -* @throws {TypeError} must be a string or function -* -* @example -* var node = new Rug({ -* 'color': 'steelblue' -* }); -* -* var color = node.color; -* // returns <Function> -*/ -defineProperty( Rug.prototype, 'color', { - 'configurable': false, - 'enumerable': true, - 'set': setColor, - 'get': getColor -}); - -/** -* Data. -* -* @name data -* @memberof Rug.prototype -* @type {ArrayLike} -* @throws {TypeError} must be array-like -* @default [] -* -* @example -* var node = new Rug({ -* 'data': [ 0.1, 0.2, 0.3 ] -* }); -* -* var data = node.data; -* // returns [ 0.1, 0.2, 0.3 ] -*/ -defineProperty( Rug.prototype, 'data', { - 'configurable': false, - 'enumerable': true, - 'set': setData, - 'get': getData -}); - -/** -* Predicate function which defines whether a datum is defined. This accessor is used to define how missing values are encoded. The default behavior is to ignore values which are `NaN`. -* -* @name isDefined -* @memberof Rug.prototype -* @type {Function} -* @throws {TypeError} must be a function -* -* @example -* var node = new Rug(); -* -* function isDefined( d ) { -* // Check for `NaN`: -* return ( d === d ); -* } -* node.isDefined = isDefined; -* -* @example -* function isDefined( d ) { -* // Check for `NaN`: -* return ( d === d ); -* } -* var node = new Rug({ -* 'isDefined': isDefined -* }); -* var fcn = node.isDefined; -* // returns <Function> -*/ -defineProperty( Rug.prototype, 'isDefined', { - 'configurable': false, - 'enumerable': true, - 'set': setIsDefined, - 'get': getIsDefined -}); - -/** -* Tick label. When retrieved, the returned value is a label accessor. -* -* @name label -* @memberof Rug.prototype -* @type {(string|Function)} -* @throws {TypeError} must be a string or function -* -* @example -* var node = new Rug({ -* 'label': 'group-1' -* }); -* -* var label = node.label; -* // returns <Function> -*/ -defineProperty( Rug.prototype, 'label', { - 'configurable': false, - 'enumerable': true, - 'set': setLabel, - 'get': getLabel -}); - -/** -* Tick opacity. When retrieved, the returned value is an opacity accessor. -* -* @name opacity -* @memberof Rug.prototype -* @type {number} -* @throws {TypeError} must be a number -* @throws {RangeError} must be a number on the interval `[0,1]` -* @default 0.9 -* -* @example -* var node = new Rug({ -* 'opacity': 0.5 -* }); -* -* var opacity = node.opacity; -* // returns <Function> -*/ -defineProperty( Rug.prototype, 'opacity', { - 'configurable': false, - 'enumerable': true, - 'set': setOpacity, - 'get': getOpacity -}); - -/** -* Rug orientation. -* -* @name orientation -* @memberof Rug.prototype -* @type {string} -* @throws {TypeError} must be a supported orientation -* -* @example -* var node = new Rug({ -* 'orientation': 'left' -* }); -* -* var orient = node.orientation; -* // returns 'left' -*/ -defineProperty( Rug.prototype, 'orientation', { - 'configurable': false, - 'enumerable': true, - 'set': setOrientation, - 'get': getOrientation -}); - -/** -* Function to map values to x coordinate values. -* -* @name pos -* @memberof Rug.prototype -* @type {Function} -* -* @example -* var node = new Rug(); -* -* var pos = node.pos; -* // returns <Function> -*/ -defineProperty( Rug.prototype, 'pos', { - 'configurable': false, - 'enumerable': true, - 'get': getPos -}); - -/** -* Scale function. -* -* @name scale -* @memberof Rug.prototype -* @type {Function} -* @throws {TypeError} must be a function -* -* @example -* var node = new Rug({ -* 'scale': function scale() {} -* }); -* -* var fcn = node.scale; -* // returns <Function> -*/ -defineProperty( Rug.prototype, 'scale', { - 'configurable': false, - 'enumerable': true, - 'set': setScale, - 'get': getScale -}); - -/** -* Tick (tassel) size. -* -* @name size -* @memberof Rug.prototype -* @type {NonNegativeInteger} -* @throws {TypeError} must be a nonnegative integer -* @default 6 -* -* @example -* var node = new Rug({ -* 'size': 5 -* }); -* -* var size = node.size; -* // returns 5 -*/ -defineProperty( Rug.prototype, 'size', { - 'configurable': false, - 'enumerable': true, - 'set': setSize, - 'get': getSize -}); - -/** -* Renders a Virtual DOM tree. -* -* @name render -* @memberof Rug.prototype -* @type {Function} -* @returns {VTree} virtual tree -* -* @example -* var node = new Rug(); -* -* var out = node.render(); -* // returns <Object> -*/ -setReadOnly( Rug.prototype, 'render', render ); - - -// EXPORTS // - -module.exports = Rug; diff --git a/lib/node_modules/@stdlib/plot/components/svg/rug/lib/props/auto-render/get.js b/lib/node_modules/@stdlib/plot/components/svg/rug/lib/props/auto-render/get.js deleted file mode 100644 index 7df40dec3f47..000000000000 --- a/lib/node_modules/@stdlib/plot/components/svg/rug/lib/props/auto-render/get.js +++ /dev/null @@ -1,35 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -/** -* Returns the rendering mode. -* -* @private -* @returns {boolean} rendering mode -*/ -function get() { - /* eslint-disable no-invalid-this */ - return this._autoRender; -} - - -// EXPORTS // - -module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/components/svg/rug/lib/props/auto-render/set.js b/lib/node_modules/@stdlib/plot/components/svg/rug/lib/props/auto-render/set.js deleted file mode 100644 index a0926869fb93..000000000000 --- a/lib/node_modules/@stdlib/plot/components/svg/rug/lib/props/auto-render/set.js +++ /dev/null @@ -1,60 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); -var isBoolean = require( '@stdlib/assert/is-boolean' ).isPrimitive; -var format = require( '@stdlib/string/format' ); - - -// VARIABLES // - -var debug = logger( 'rug:set:auto-render' ); - - -// MAIN // - -/** -* Sets the rendering mode. -* -* @private -* @param {boolean} bool - boolean indicating whether to re-render on a change event -* @throws {TypeError} must be a boolean -*/ -function set( bool ) { - /* eslint-disable no-invalid-this */ - if ( !isBoolean( bool ) ) { - throw new TypeError( format( 'invalid assignment. `%s` must be a boolean. Value: `%s`.', 'autoRender', bool ) ); - } - if ( bool !== this._autoRender ) { - debug( 'Current value: %d.', this._autoRender ); - - this._autoRender = bool; - debug( 'New Value: %d.', this._autoRender ); - - this.emit( 'change' ); - } -} - - -// EXPORTS // - -module.exports = set; diff --git a/lib/node_modules/@stdlib/plot/components/svg/rug/lib/props/color/get.js b/lib/node_modules/@stdlib/plot/components/svg/rug/lib/props/color/get.js deleted file mode 100644 index cf0aabe11e15..000000000000 --- a/lib/node_modules/@stdlib/plot/components/svg/rug/lib/props/color/get.js +++ /dev/null @@ -1,56 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var isString = require( '@stdlib/assert/is-string' ).isPrimitive; - - -// MAIN // - -/** -* Returns a function to get a color. -* -* @private -* @returns {Function} color accessor -*/ -function get() { - /* eslint-disable no-invalid-this */ - var self = this; - if ( isString( this._color ) ) { - return color; - } - return this._color; - - /** - * Returns a color value. - * - * @private - * @returns {string} color - */ - function color() { - return self._color; // eslint-disable-line no-underscore-dangle - } -} - - -// EXPORTS // - -module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/components/svg/rug/lib/props/color/set.js b/lib/node_modules/@stdlib/plot/components/svg/rug/lib/props/color/set.js deleted file mode 100644 index 0b106193daa6..000000000000 --- a/lib/node_modules/@stdlib/plot/components/svg/rug/lib/props/color/set.js +++ /dev/null @@ -1,61 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); -var isString = require( '@stdlib/assert/is-string' ).isPrimitive; -var isFunction = require( '@stdlib/assert/is-function' ); -var format = require( '@stdlib/string/format' ); - - -// VARIABLES // - -var debug = logger( 'rug:set:color' ); - - -// MAIN // - -/** -* Sets the color. -* -* @private -* @param {(string|Function)} color - color -* @throws {TypeError} must be a string or function -*/ -function set( color ) { - /* eslint-disable no-invalid-this */ - if ( !isString( color ) && !isFunction( color ) ) { - throw new TypeError( format( 'invalid assignment. `%s` must be a string or a function. Value: `%s`.', 'color', color ) ); - } - if ( color !== this._color ) { - debug( 'Current value: %d.', this._color ); - - this._color = color; - debug( 'New Value: %d.', this._color ); - - this.emit( 'change' ); - } -} - - -// EXPORTS // - -module.exports = set; diff --git a/lib/node_modules/@stdlib/plot/components/svg/rug/lib/props/data/get.js b/lib/node_modules/@stdlib/plot/components/svg/rug/lib/props/data/get.js deleted file mode 100644 index 281803ed1a3d..000000000000 --- a/lib/node_modules/@stdlib/plot/components/svg/rug/lib/props/data/get.js +++ /dev/null @@ -1,35 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -/** -* Returns the data values. -* -* @private -* @returns {ArrayLike} data values -*/ -function get() { - /* eslint-disable no-invalid-this */ - return this._data; -} - - -// EXPORTS // - -module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/components/svg/rug/lib/props/data/set.js b/lib/node_modules/@stdlib/plot/components/svg/rug/lib/props/data/set.js deleted file mode 100644 index 4a1afeec39cb..000000000000 --- a/lib/node_modules/@stdlib/plot/components/svg/rug/lib/props/data/set.js +++ /dev/null @@ -1,62 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); -var isArrayLike = require( '@stdlib/assert/is-array-like' ); -var format = require( '@stdlib/string/format' ); - - -// VARIABLES // - -var debug = logger( 'rug:set:data' ); - - -// MAIN // - -/** -* Sets the data values. -* -* ## Notes -* -* - We always fire a `change` event when set, even if the provided reference is the same, to allow signaling that data values have changed (e.g., a data array has mutated). -* -* @private -* @param {ArrayLike} data - data values -* @throws {TypeError} must be array-like -*/ -function set( data ) { - /* eslint-disable no-invalid-this */ - if ( !isArrayLike( data ) ) { - throw new TypeError( format( 'invalid assignment. `%s` must be array-like. Value: `%s`.', 'data', data ) ); - } - debug( 'Current value: %s.', JSON.stringify( this._data ) ); - - this._data = data; - debug( 'New Value: %s.', JSON.stringify( this._data ) ); - - this.emit( 'change' ); -} - - -// EXPORTS // - -module.exports = set; diff --git a/lib/node_modules/@stdlib/plot/components/svg/rug/lib/props/is-defined/get.js b/lib/node_modules/@stdlib/plot/components/svg/rug/lib/props/is-defined/get.js deleted file mode 100644 index 8d6d7448aff0..000000000000 --- a/lib/node_modules/@stdlib/plot/components/svg/rug/lib/props/is-defined/get.js +++ /dev/null @@ -1,35 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -/** -* Returns the predicate function for determining whether a value is defined. -* -* @private -* @returns {Function} predicate function -*/ -function get() { - /* eslint-disable no-invalid-this */ - return this._isDefined; -} - - -// EXPORTS // - -module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/components/svg/rug/lib/props/is-defined/set.js b/lib/node_modules/@stdlib/plot/components/svg/rug/lib/props/is-defined/set.js deleted file mode 100644 index d6aebbe95573..000000000000 --- a/lib/node_modules/@stdlib/plot/components/svg/rug/lib/props/is-defined/set.js +++ /dev/null @@ -1,60 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); -var isFunction = require( '@stdlib/assert/is-function' ); -var format = require( '@stdlib/string/format' ); - - -// VARIABLES // - -var debug = logger( 'rug:set:is-defined' ); - - -// MAIN // - -/** -* Sets the predicate function for determining whether a value is defined. -* -* @private -* @param {Function} fcn - predicate function -* @throws {TypeError} must be a function -*/ -function set( fcn ) { - /* eslint-disable no-invalid-this */ - if ( !isFunction( fcn ) ) { - throw new TypeError( format( 'invalid assignment. `%s` must be a function. Value: `%s`.', 'isDefined', fcn ) ); - } - if ( fcn !== this._isDefined ) { - debug( 'Current value: %s.', this._isDefined ); - - this._isDefined = fcn; - debug( 'New Value: %s.', this._isDefined ); - - this.emit( 'change' ); - } -} - - -// EXPORTS // - -module.exports = set; diff --git a/lib/node_modules/@stdlib/plot/components/svg/rug/lib/props/label/get.js b/lib/node_modules/@stdlib/plot/components/svg/rug/lib/props/label/get.js deleted file mode 100644 index 680c572bb612..000000000000 --- a/lib/node_modules/@stdlib/plot/components/svg/rug/lib/props/label/get.js +++ /dev/null @@ -1,56 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var isString = require( '@stdlib/assert/is-string' ).isPrimitive; - - -// MAIN // - -/** -* Returns a function to get a label. -* -* @private -* @returns {Function} label accessor -*/ -function get() { - /* eslint-disable no-invalid-this */ - var self = this; - if ( isString( this._label ) ) { - return label; - } - return this._label; - - /** - * Returns a label. - * - * @private - * @returns {string} label - */ - function label() { - return self._label; // eslint-disable-line no-underscore-dangle - } -} - - -// EXPORTS // - -module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/components/svg/rug/lib/props/label/set.js b/lib/node_modules/@stdlib/plot/components/svg/rug/lib/props/label/set.js deleted file mode 100644 index 98107f63ecc6..000000000000 --- a/lib/node_modules/@stdlib/plot/components/svg/rug/lib/props/label/set.js +++ /dev/null @@ -1,61 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); -var isString = require( '@stdlib/assert/is-string' ).isPrimitive; -var isFunction = require( '@stdlib/assert/is-function' ); -var format = require( '@stdlib/string/format' ); - - -// VARIABLES // - -var debug = logger( 'rug:set:label' ); - - -// MAIN // - -/** -* Sets the label. -* -* @private -* @param {(string|Function)} label - label -* @throws {TypeError} must be a string or a function -*/ -function set( label ) { - /* eslint-disable no-invalid-this */ - if ( !isString( label ) && !isFunction( label ) ) { - throw new TypeError( format( 'invalid assignment. `%s` must be a string or a function. Value: `%s`.', 'label', label ) ); - } - if ( label !== this._label ) { - debug( 'Current value: %d.', this._label ); - - this._label = label; - debug( 'New Value: %d.', this._label ); - - this.emit( 'change' ); - } -} - - -// EXPORTS // - -module.exports = set; diff --git a/lib/node_modules/@stdlib/plot/components/svg/rug/lib/props/opacity/get.js b/lib/node_modules/@stdlib/plot/components/svg/rug/lib/props/opacity/get.js deleted file mode 100644 index a6e45913780d..000000000000 --- a/lib/node_modules/@stdlib/plot/components/svg/rug/lib/props/opacity/get.js +++ /dev/null @@ -1,56 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var isNumber = require( '@stdlib/assert/is-number' ).isPrimitive; - - -// MAIN // - -/** -* Returns a function to get an opacity. -* -* @private -* @returns {Function} opacity accessor -*/ -function get() { - /* eslint-disable no-invalid-this */ - var self = this; - if ( isNumber( this._opacity ) ) { - return opacity; - } - return this._opacity; - - /** - * Returns the opacity. - * - * @private - * @returns {number} opacity - */ - function opacity() { - return self._opacity; // eslint-disable-line no-underscore-dangle - } -} - - -// EXPORTS // - -module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/components/svg/rug/lib/props/opacity/set.js b/lib/node_modules/@stdlib/plot/components/svg/rug/lib/props/opacity/set.js deleted file mode 100644 index 03fc2c40fce5..000000000000 --- a/lib/node_modules/@stdlib/plot/components/svg/rug/lib/props/opacity/set.js +++ /dev/null @@ -1,66 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); -var isNumber = require( '@stdlib/assert/is-number' ).isPrimitive; -var isFunction = require( '@stdlib/assert/is-function' ); -var format = require( '@stdlib/string/format' ); - - -// VARIABLES // - -var debug = logger( 'rug:set:opacity' ); - - -// MAIN // - -/** -* Sets the opacity. -* -* @private -* @param {(number|Function)} opacity - opacity -* @throws {TypeError} must be a number or a function -* @throws {RangeError} must be a number on the interval `[0,1]` -*/ -function set( opacity ) { - /* eslint-disable no-invalid-this */ - var isNum = isNumber( opacity ); - if ( !isNum && !isFunction( opacity ) ) { - throw new TypeError( format( 'invalid assignment. `%s` must be a number or a function. Value: `%s`.', 'opacity', opacity ) ); - } - if ( isNum && (opacity !== opacity || opacity < 0.0 || opacity > 1.0) ) { - throw new RangeError( format( 'invalid assignment. `%s` must be a number on the interval: [0, 1]. Value: `%f`.', 'opacity', opacity ) ); - } - if ( opacity !== this._opacity ) { - debug( 'Current value: %d.', this._opacity ); - - this._opacity = opacity; - debug( 'New Value: %d.', this._opacity ); - - this.emit( 'change' ); - } -} - - -// EXPORTS // - -module.exports = set; diff --git a/lib/node_modules/@stdlib/plot/components/svg/rug/lib/props/orientation/get.js b/lib/node_modules/@stdlib/plot/components/svg/rug/lib/props/orientation/get.js deleted file mode 100644 index 2067d1d2dc35..000000000000 --- a/lib/node_modules/@stdlib/plot/components/svg/rug/lib/props/orientation/get.js +++ /dev/null @@ -1,35 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -/** -* Returns the orientation. -* -* @private -* @returns {string} orientation -*/ -function get() { - /* eslint-disable no-invalid-this */ - return this._orientation; -} - - -// EXPORTS // - -module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/components/svg/rug/lib/props/orientation/orientations.json b/lib/node_modules/@stdlib/plot/components/svg/rug/lib/props/orientation/orientations.json deleted file mode 100644 index c3d57be9dcb8..000000000000 --- a/lib/node_modules/@stdlib/plot/components/svg/rug/lib/props/orientation/orientations.json +++ /dev/null @@ -1,6 +0,0 @@ -[ - "bottom", - "left", - "right", - "top" -] diff --git a/lib/node_modules/@stdlib/plot/components/svg/rug/lib/props/orientation/set.js b/lib/node_modules/@stdlib/plot/components/svg/rug/lib/props/orientation/set.js deleted file mode 100644 index 4fe7468f49ae..000000000000 --- a/lib/node_modules/@stdlib/plot/components/svg/rug/lib/props/orientation/set.js +++ /dev/null @@ -1,61 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); -var indexOf = require( '@stdlib/utils/index-of' ); -var format = require( '@stdlib/string/format' ); -var ORIENTATIONS = require( './orientations.json' ); - - -// VARIABLES // - -var debug = logger( 'rug:set:orientation' ); - - -// MAIN // - -/** -* Sets the orientation. -* -* @private -* @param {string} orient - orientation -* @throws {TypeError} must be a supported orientation -*/ -function set( orient ) { - /* eslint-disable no-invalid-this */ - if ( indexOf( ORIENTATIONS, orient ) === -1 ) { - throw new TypeError( format( 'invalid assignment. `%s` must be one of the following: "%s". Value: `%s`.', 'orientation', ORIENTATIONS.join( '", "' ), orient ) ); - } - if ( orient !== this._orientation ) { - debug( 'Current value: %d.', this._orientation ); - - this._orientation = orient; - debug( 'New Value: %d.', this._orientation ); - - this.emit( 'change' ); - } -} - - -// EXPORTS // - -module.exports = set; diff --git a/lib/node_modules/@stdlib/plot/components/svg/rug/lib/props/pos/get.js b/lib/node_modules/@stdlib/plot/components/svg/rug/lib/props/pos/get.js deleted file mode 100644 index 3fd54c4aa7c4..000000000000 --- a/lib/node_modules/@stdlib/plot/components/svg/rug/lib/props/pos/get.js +++ /dev/null @@ -1,61 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); - - -// VARIABLES // - -var debug = logger( 'rug:pos' ); - - -// MAIN // - -/** -* Returns a function to map values to coordinate values. -* -* @private -* @returns {Function} map function -*/ -function get() { - /* eslint-disable no-invalid-this */ - var scale = this.scale; - return pos; - - /** - * Maps a value to a coordinate value. - * - * @private - * @param {*} d - datum - * @returns {number} pixel value - */ - function pos( d ) { - var p = scale( d ); - debug( 'Value: %d => Pixel: %d.', d, p ); - return p; - } -} - - -// EXPORTS // - -module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/components/svg/rug/lib/props/scale/get.js b/lib/node_modules/@stdlib/plot/components/svg/rug/lib/props/scale/get.js deleted file mode 100644 index 4ef9bb2c0ea8..000000000000 --- a/lib/node_modules/@stdlib/plot/components/svg/rug/lib/props/scale/get.js +++ /dev/null @@ -1,35 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -/** -* Returns the scale function. -* -* @private -* @returns {Function} scale function -*/ -function get() { - /* eslint-disable no-invalid-this */ - return this._scale; -} - - -// EXPORTS // - -module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/components/svg/rug/lib/props/scale/set.js b/lib/node_modules/@stdlib/plot/components/svg/rug/lib/props/scale/set.js deleted file mode 100644 index 8beb12de3481..000000000000 --- a/lib/node_modules/@stdlib/plot/components/svg/rug/lib/props/scale/set.js +++ /dev/null @@ -1,60 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); -var isFunction = require( '@stdlib/assert/is-function' ); -var format = require( '@stdlib/string/format' ); - - -// VARIABLES // - -var debug = logger( 'rug:set:scale' ); - - -// MAIN // - -/** -* Sets the scale function. -* -* @private -* @param {Function} fcn - scale -* @throws {TypeError} must be a function -*/ -function set( fcn ) { - /* eslint-disable no-invalid-this */ - if ( !isFunction( fcn ) ) { - throw new TypeError( format( 'invalid assignment. `%s` must be a function. Value: `%s`.', 'scale', fcn ) ); - } - if ( fcn !== this._scale ) { - debug( 'Current value: %s.', this._scale ); - - this._scale = fcn; - debug( 'New Value: %s.', this._scale ); - - this.emit( 'change' ); - } -} - - -// EXPORTS // - -module.exports = set; diff --git a/lib/node_modules/@stdlib/plot/components/svg/rug/lib/props/size/get.js b/lib/node_modules/@stdlib/plot/components/svg/rug/lib/props/size/get.js deleted file mode 100644 index b4c45e13cdf6..000000000000 --- a/lib/node_modules/@stdlib/plot/components/svg/rug/lib/props/size/get.js +++ /dev/null @@ -1,37 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MAIN // - -/** -* Returns the tick (tassel) size. -* -* @private -* @returns {NonNegativeInteger} tick size -*/ -function get() { - /* eslint-disable no-invalid-this */ - return this._size; -} - - -// EXPORTS // - -module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/components/svg/rug/lib/props/size/set.js b/lib/node_modules/@stdlib/plot/components/svg/rug/lib/props/size/set.js deleted file mode 100644 index 8db6c48b0084..000000000000 --- a/lib/node_modules/@stdlib/plot/components/svg/rug/lib/props/size/set.js +++ /dev/null @@ -1,60 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); -var isNonNegativeInteger = require( '@stdlib/assert/is-nonnegative-integer' ).isPrimitive; -var format = require( '@stdlib/string/format' ); - - -// VARIABLES // - -var debug = logger( 'rug:set:size' ); - - -// MAIN // - -/** -* Sets the tick (tassel) size. -* -* @private -* @param {NonNegativeInteger} size - size -* @throws {TypeError} must be a nonnegative integer -*/ -function set( size ) { - /* eslint-disable no-invalid-this */ - if ( !isNonNegativeInteger( size ) ) { - throw new TypeError( format( 'invalid assignment. `%s` must be a nonnegative integer. Value: `%s`.', 'size', size ) ); - } - if ( size !== this._size ) { - debug( 'Current value: %d.', this._size ); - - this._size = size; - debug( 'New Value: %d.', this._size ); - - this.emit( 'change' ); - } -} - - -// EXPORTS // - -module.exports = set; diff --git a/lib/node_modules/@stdlib/plot/components/svg/rug/lib/render/index.js b/lib/node_modules/@stdlib/plot/components/svg/rug/lib/render/index.js deleted file mode 100644 index 44b2517ce116..000000000000 --- a/lib/node_modules/@stdlib/plot/components/svg/rug/lib/render/index.js +++ /dev/null @@ -1,70 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); -var h = require( 'virtual-dom/h.js' ); -var ticks = require( './ticks.js' ); - - -// VARIABLES // - -var debug = logger( 'rug:render' ); -var ELEMENT = 'g'; - - -// MAIN // - -/** -* Renders a virtual DOM tree. -* -* @private -* @returns {VTree} virtual tree -*/ -function render() { - /* eslint-disable no-invalid-this */ - var children; - var props; - var vtree; - - debug( 'Rendering...' ); - - props = { - 'namespace': 'http://www.w3.org/2000/svg', - 'property': 'rug', - 'className': 'rug' - }; - - children = ticks( this ); - - debug( 'Generating a virtual DOM tree (%s) with properties: %s.', ELEMENT, JSON.stringify( props ) ); - vtree = h( ELEMENT, props, children ); - - // Announce that a new tree has been rendered: - this.emit( '_render', vtree ); - - return vtree; -} - - -// EXPORTS // - -module.exports = render; diff --git a/lib/node_modules/@stdlib/plot/components/svg/rug/lib/render/ticks.js b/lib/node_modules/@stdlib/plot/components/svg/rug/lib/render/ticks.js deleted file mode 100644 index 19bbfe02bb69..000000000000 --- a/lib/node_modules/@stdlib/plot/components/svg/rug/lib/render/ticks.js +++ /dev/null @@ -1,103 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); -var h = require( 'virtual-dom/h.js' ); -var xAttr = require( './utils/x_attr.js' ); -var yAttr = require( './utils/y_attr.js' ); -var tickDir = require( './utils/tick_dir.js' ); - - -// VARIABLES // - -var debug = logger( 'rug:render:ticks' ); -var ELEMENT = 'line'; - - -// MAIN // - -/** -* Renders rug ticks (tassels). -* -* @private -* @param {Object} ctx - context -* @returns {Array<VTree>} array of virtual trees -*/ -function render( ctx ) { - var props; - var data; - var out; - var pos; - var dir; - var p; - var x; - var y; - var d; - var i; - - debug( 'Rendering ticks...' ); - - data = ctx.data; - pos = ctx.pos; - x = xAttr( ctx.orientation ); - y = yAttr( ctx.orientation ); - dir = tickDir( ctx.orientation ); - - out = new Array( data.length ); - for ( i = 0; i < data.length; i++ ) { - d = data[ i ]; - if ( !ctx.isDefined( d, i ) ) { - debug( 'Datum %d is not defined. Value: %s.', i, d ); - continue; - } - props = { - 'namespace': 'http://www.w3.org/2000/svg', - 'property': 'rug.tick', - 'className': 'tick', - 'attributes': { - 'fill': 'none', - 'opacity': ctx.opacity( d, i ), - 'stroke': ctx.color( d, i ), - 'stroke-width': 1, - 'data-label': ctx.label( d, i ) - } - }; - - p = pos( d ); - props.attributes[ x+'1' ] = 0; - props.attributes[ x+'2' ] = dir * ctx.size; - props.attributes[ y+'1' ] = p; - props.attributes[ y+'2' ] = p; - - debug( 'Rendering tick %d with value %s...', i, d ); - - debug( 'Generating a virtual DOM tree (%s) with properties: %s.', ELEMENT, JSON.stringify( props ) ); - out[ i ] = h( ELEMENT, props, [] ); - } - debug( 'Finished rendering ticks.' ); - return out; -} - - -// EXPORTS // - -module.exports = render; diff --git a/lib/node_modules/@stdlib/plot/components/svg/rug/lib/render/utils/tick_dir.js b/lib/node_modules/@stdlib/plot/components/svg/rug/lib/render/utils/tick_dir.js deleted file mode 100644 index 60ef70606fc6..000000000000 --- a/lib/node_modules/@stdlib/plot/components/svg/rug/lib/render/utils/tick_dir.js +++ /dev/null @@ -1,38 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -/** -* Returns the tick direction. -* -* @private -* @param {string} orient - orientation -* @returns {number} tick direction -*/ -function tickDir( orient ) { - if ( orient === 'bottom' || orient === 'right' ) { - return -1; - } - return 1; -} - - -// EXPORTS // - -module.exports = tickDir; diff --git a/lib/node_modules/@stdlib/plot/components/svg/rug/lib/render/utils/x_attr.js b/lib/node_modules/@stdlib/plot/components/svg/rug/lib/render/utils/x_attr.js deleted file mode 100644 index 8a7ec9f02be6..000000000000 --- a/lib/node_modules/@stdlib/plot/components/svg/rug/lib/render/utils/x_attr.js +++ /dev/null @@ -1,38 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -/** -* Returns the "x" attribute for tick positioning. -* -* @private -* @param {string} orient - rug orientation -* @returns {string} attribute -*/ -function xAttr( orient ) { - if ( orient === 'left' || orient === 'right' ) { - return 'x'; - } - return 'y'; -} - - -// EXPORTS // - -module.exports = xAttr; diff --git a/lib/node_modules/@stdlib/plot/components/svg/rug/lib/render/utils/y_attr.js b/lib/node_modules/@stdlib/plot/components/svg/rug/lib/render/utils/y_attr.js deleted file mode 100644 index e43b62806831..000000000000 --- a/lib/node_modules/@stdlib/plot/components/svg/rug/lib/render/utils/y_attr.js +++ /dev/null @@ -1,38 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -/** -* Returns the "y" attribute for tick positioning. -* -* @private -* @param {string} orient - rug orientation -* @returns {string} attribute -*/ -function yAttr( orient ) { - if ( orient === 'left' || orient === 'right' ) { - return 'y'; - } - return 'x'; -} - - -// EXPORTS // - -module.exports = yAttr; diff --git a/lib/node_modules/@stdlib/plot/components/svg/rug/package.json b/lib/node_modules/@stdlib/plot/components/svg/rug/package.json deleted file mode 100644 index 18048f28dc13..000000000000 --- a/lib/node_modules/@stdlib/plot/components/svg/rug/package.json +++ /dev/null @@ -1,67 +0,0 @@ -{ - "name": "@stdlib/plot/components/svg/rug", - "version": "0.0.0", - "description": "SVG rug component.", - "license": "Apache-2.0", - "author": { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - }, - "contributors": [ - { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - } - ], - "main": "./lib", - "directories": { - "benchmark": "./benchmark", - "example": "./examples", - "lib": "./lib", - "test": "./test" - }, - "scripts": {}, - "homepage": "https://github.com/stdlib-js/stdlib", - "repository": { - "type": "git", - "url": "git://github.com/stdlib-js/stdlib.git" - }, - "bugs": { - "url": "https://github.com/stdlib-js/stdlib/issues" - }, - "dependencies": {}, - "devDependencies": {}, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], - "keywords": [ - "stdlib", - "plot", - "graph", - "chart", - "engine", - "svg", - "scalable", - "vector", - "graphics", - "rug", - "density", - "component", - "vdom", - "virtual", - "dom", - "virtual-dom" - ] -} diff --git a/lib/node_modules/@stdlib/plot/components/svg/rug/srv/scripts/fig_into_plot.js b/lib/node_modules/@stdlib/plot/components/svg/rug/srv/scripts/fig_into_plot.js deleted file mode 100644 index bfac7b92f8b9..000000000000 --- a/lib/node_modules/@stdlib/plot/components/svg/rug/srv/scripts/fig_into_plot.js +++ /dev/null @@ -1,86 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var randn = require( '@stdlib/random/base/box-muller' ); -var Float64Array = require( '@stdlib/array/float64' ); -var Float32Array = require( '@stdlib/array/float32' ); -var Plot = require( '@stdlib/plot/ctor' ); - - -// MAIN // - -/** -* Generates a plot. -* -* @private -*/ -function main() { - var html; - var plot; - var opts; - var x1; - var x2; - var y1; - var y2; - var i; - - // Create some data... - x1 = new Float64Array( 1000 ); - x2 = new Float64Array( x1.length ); - y1 = new Float64Array( x1.length ); - y2 = new Float32Array( x1.length ); - for ( i = 0; i < x1.length; i++ ) { - x1[ i ] = 30.0 + (7.5*randn()); - x2[ i ] = 40.0 + (12.5*randn()); - y1[ i ] = 50.0 + (10.0*randn()); - y2[ i ] = 30.0 + (5.0*randn()); - } - - // Define the plot options: - opts = { - 'width': 600, - 'height': 480, - 'xMin': 0.0, - 'xMax': 100.0, - 'yMin': 0.0, - 'yMax': 100.0, - 'lineStyle': 'none', - 'symbols': 'closed-circle', - 'symbolsSize': 6, - 'symbolsOpacity': 0.2, - 'xRug': true, - 'yRug': true, - 'xRugOrient': 'top', - 'yRugOrient': 'right' - }; - - // Create a new plot: - plot = new Plot( [ x1, x2 ], [ y1, y2 ], opts ); - - // Render as HTML/SVG: - html = plot.render( 'html' ); - - // Write to `stdout`: - console.log( html ); -} - -main(); diff --git a/lib/node_modules/@stdlib/plot/components/svg/rug/test/fixtures/vtree.color_function.js b/lib/node_modules/@stdlib/plot/components/svg/rug/test/fixtures/vtree.color_function.js deleted file mode 100644 index a2448ee8b240..000000000000 --- a/lib/node_modules/@stdlib/plot/components/svg/rug/test/fixtures/vtree.color_function.js +++ /dev/null @@ -1,125 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MAIN // - -var vtree = { - 'tagName': 'g', - 'properties': { - 'property': 'rug', - 'className': 'rug', - 'namespace': void 0 - }, - 'children': [ - { - 'tagName': 'line', - 'properties': { - 'property': 'rug.tick', - 'className': 'tick', - 'attributes': { - 'fill': 'none', - 'opacity': 0.9, - 'stroke': '#ffa', - 'stroke-width': 1, - 'data-label': '', - 'y1': 0, - 'y2': -6, - 'x1': 0.1, - 'x2': 0.1 - }, - 'namespace': void 0 - }, - 'children': [], - 'namespace': 'http://www.w3.org/2000/svg', - 'count': 0, - 'hasWidgets': false, - 'hasThunks': false, - 'descendantHooks': false, - 'hooks': void 0, - 'key': void 0 - }, - { - 'tagName': 'line', - 'properties': { - 'property': 'rug.tick', - 'className': 'tick', - 'attributes': { - 'fill': 'none', - 'opacity': 0.9, - 'stroke': '#ffb', - 'stroke-width': 1, - 'data-label': '', - 'y1': 0, - 'y2': -6, - 'x1': 0.5, - 'x2': 0.5 - }, - 'namespace': void 0 - }, - 'children': [], - 'namespace': 'http://www.w3.org/2000/svg', - 'count': 0, - 'hasWidgets': false, - 'hasThunks': false, - 'descendantHooks': false, - 'hooks': void 0, - 'key': void 0 - }, - { - 'tagName': 'line', - 'properties': { - 'property': 'rug.tick', - 'className': 'tick', - 'attributes': { - 'fill': 'none', - 'opacity': 0.9, - 'stroke': '#ffc', - 'stroke-width': 1, - 'data-label': '', - 'y1': 0, - 'y2': -6, - 'x1': 0.9, - 'x2': 0.9 - }, - 'namespace': void 0 - }, - 'children': [], - 'namespace': 'http://www.w3.org/2000/svg', - 'count': 0, - 'hasWidgets': false, - 'hasThunks': false, - 'descendantHooks': false, - 'hooks': void 0, - 'key': void 0 - } - ], - 'namespace': 'http://www.w3.org/2000/svg', - 'count': 3, - 'hasWidgets': false, - 'hasThunks': false, - 'descendantHooks': false, - 'hooks': void 0, - 'key': void 0 -}; - - -// EXPORTS // - -module.exports = vtree; diff --git a/lib/node_modules/@stdlib/plot/components/svg/rug/test/fixtures/vtree.color_string.js b/lib/node_modules/@stdlib/plot/components/svg/rug/test/fixtures/vtree.color_string.js deleted file mode 100644 index 15176950808f..000000000000 --- a/lib/node_modules/@stdlib/plot/components/svg/rug/test/fixtures/vtree.color_string.js +++ /dev/null @@ -1,125 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MAIN // - -var vtree = { - 'tagName': 'g', - 'properties': { - 'property': 'rug', - 'className': 'rug', - 'namespace': void 0 - }, - 'children': [ - { - 'tagName': 'line', - 'properties': { - 'property': 'rug.tick', - 'className': 'tick', - 'attributes': { - 'fill': 'none', - 'opacity': 0.9, - 'stroke': '#fff', - 'stroke-width': 1, - 'data-label': '', - 'y1': 0, - 'y2': -6, - 'x1': 0.1, - 'x2': 0.1 - }, - 'namespace': void 0 - }, - 'children': [], - 'namespace': 'http://www.w3.org/2000/svg', - 'count': 0, - 'hasWidgets': false, - 'hasThunks': false, - 'descendantHooks': false, - 'hooks': void 0, - 'key': void 0 - }, - { - 'tagName': 'line', - 'properties': { - 'property': 'rug.tick', - 'className': 'tick', - 'attributes': { - 'fill': 'none', - 'opacity': 0.9, - 'stroke': '#fff', - 'stroke-width': 1, - 'data-label': '', - 'y1': 0, - 'y2': -6, - 'x1': 0.5, - 'x2': 0.5 - }, - 'namespace': void 0 - }, - 'children': [], - 'namespace': 'http://www.w3.org/2000/svg', - 'count': 0, - 'hasWidgets': false, - 'hasThunks': false, - 'descendantHooks': false, - 'hooks': void 0, - 'key': void 0 - }, - { - 'tagName': 'line', - 'properties': { - 'property': 'rug.tick', - 'className': 'tick', - 'attributes': { - 'fill': 'none', - 'opacity': 0.9, - 'stroke': '#fff', - 'stroke-width': 1, - 'data-label': '', - 'y1': 0, - 'y2': -6, - 'x1': 0.9, - 'x2': 0.9 - }, - 'namespace': void 0 - }, - 'children': [], - 'namespace': 'http://www.w3.org/2000/svg', - 'count': 0, - 'hasWidgets': false, - 'hasThunks': false, - 'descendantHooks': false, - 'hooks': void 0, - 'key': void 0 - } - ], - 'namespace': 'http://www.w3.org/2000/svg', - 'count': 3, - 'hasWidgets': false, - 'hasThunks': false, - 'descendantHooks': false, - 'hooks': void 0, - 'key': void 0 -}; - - -// EXPORTS // - -module.exports = vtree; diff --git a/lib/node_modules/@stdlib/plot/components/svg/rug/test/fixtures/vtree.data.js b/lib/node_modules/@stdlib/plot/components/svg/rug/test/fixtures/vtree.data.js deleted file mode 100644 index 6ea06b0a449e..000000000000 --- a/lib/node_modules/@stdlib/plot/components/svg/rug/test/fixtures/vtree.data.js +++ /dev/null @@ -1,125 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MAIN // - -var vtree = { - 'tagName': 'g', - 'properties': { - 'property': 'rug', - 'className': 'rug', - 'namespace': void 0 - }, - 'children': [ - { - 'tagName': 'line', - 'properties': { - 'property': 'rug.tick', - 'className': 'tick', - 'attributes': { - 'fill': 'none', - 'opacity': 0.9, - 'stroke': '#aaa', - 'stroke-width': 1, - 'data-label': '', - 'y1': 0, - 'y2': -6, - 'x1': 0.15, - 'x2': 0.15 - }, - 'namespace': void 0 - }, - 'children': [], - 'namespace': 'http://www.w3.org/2000/svg', - 'count': 0, - 'hasWidgets': false, - 'hasThunks': false, - 'descendantHooks': false, - 'hooks': void 0, - 'key': void 0 - }, - { - 'tagName': 'line', - 'properties': { - 'property': 'rug.tick', - 'className': 'tick', - 'attributes': { - 'fill': 'none', - 'opacity': 0.9, - 'stroke': '#aaa', - 'stroke-width': 1, - 'data-label': '', - 'y1': 0, - 'y2': -6, - 'x1': 0.55, - 'x2': 0.55 - }, - 'namespace': void 0 - }, - 'children': [], - 'namespace': 'http://www.w3.org/2000/svg', - 'count': 0, - 'hasWidgets': false, - 'hasThunks': false, - 'descendantHooks': false, - 'hooks': void 0, - 'key': void 0 - }, - { - 'tagName': 'line', - 'properties': { - 'property': 'rug.tick', - 'className': 'tick', - 'attributes': { - 'fill': 'none', - 'opacity': 0.9, - 'stroke': '#aaa', - 'stroke-width': 1, - 'data-label': '', - 'y1': 0, - 'y2': -6, - 'x1': 0.95, - 'x2': 0.95 - }, - 'namespace': void 0 - }, - 'children': [], - 'namespace': 'http://www.w3.org/2000/svg', - 'count': 0, - 'hasWidgets': false, - 'hasThunks': false, - 'descendantHooks': false, - 'hooks': void 0, - 'key': void 0 - } - ], - 'namespace': 'http://www.w3.org/2000/svg', - 'count': 3, - 'hasWidgets': false, - 'hasThunks': false, - 'descendantHooks': false, - 'hooks': void 0, - 'key': void 0 -}; - - -// EXPORTS // - -module.exports = vtree; diff --git a/lib/node_modules/@stdlib/plot/components/svg/rug/test/fixtures/vtree.is_defined.js b/lib/node_modules/@stdlib/plot/components/svg/rug/test/fixtures/vtree.is_defined.js deleted file mode 100644 index decb1a6660ae..000000000000 --- a/lib/node_modules/@stdlib/plot/components/svg/rug/test/fixtures/vtree.is_defined.js +++ /dev/null @@ -1,98 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MAIN // - -var vtree = { - 'tagName': 'g', - 'properties': { - 'property': 'rug', - 'className': 'rug', - 'namespace': void 0 - }, - 'children': [ - { - 'tagName': 'line', - 'properties': { - 'property': 'rug.tick', - 'className': 'tick', - 'attributes': { - 'fill': 'none', - 'opacity': 0.9, - 'stroke': '#aaa', - 'stroke-width': 1, - 'data-label': '', - 'y1': 0, - 'y2': -6, - 'x1': 0.1, - 'x2': 0.1 - }, - 'namespace': void 0 - }, - 'children': [], - 'namespace': 'http://www.w3.org/2000/svg', - 'count': 0, - 'hasWidgets': false, - 'hasThunks': false, - 'descendantHooks': false, - 'hooks': void 0, - 'key': void 0 - }, - { - 'tagName': 'line', - 'properties': { - 'property': 'rug.tick', - 'className': 'tick', - 'attributes': { - 'fill': 'none', - 'opacity': 0.9, - 'stroke': '#aaa', - 'stroke-width': 1, - 'data-label': '', - 'y1': 0, - 'y2': -6, - 'x1': 0.9, - 'x2': 0.9 - }, - 'namespace': void 0 - }, - 'children': [], - 'namespace': 'http://www.w3.org/2000/svg', - 'count': 0, - 'hasWidgets': false, - 'hasThunks': false, - 'descendantHooks': false, - 'hooks': void 0, - 'key': void 0 - } - ], - 'namespace': 'http://www.w3.org/2000/svg', - 'count': 2, - 'hasWidgets': false, - 'hasThunks': false, - 'descendantHooks': false, - 'hooks': void 0, - 'key': void 0 -}; - - -// EXPORTS // - -module.exports = vtree; diff --git a/lib/node_modules/@stdlib/plot/components/svg/rug/test/fixtures/vtree.js b/lib/node_modules/@stdlib/plot/components/svg/rug/test/fixtures/vtree.js deleted file mode 100644 index 8cc704c5b262..000000000000 --- a/lib/node_modules/@stdlib/plot/components/svg/rug/test/fixtures/vtree.js +++ /dev/null @@ -1,125 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MAIN // - -var vtree = { - 'tagName': 'g', - 'properties': { - 'property': 'rug', - 'className': 'rug', - 'namespace': void 0 - }, - 'children': [ - { - 'tagName': 'line', - 'properties': { - 'property': 'rug.tick', - 'className': 'tick', - 'attributes': { - 'fill': 'none', - 'opacity': 0.9, - 'stroke': '#aaa', - 'stroke-width': 1, - 'data-label': '', - 'y1': 0, - 'y2': -6, - 'x1': 0.1, - 'x2': 0.1 - }, - 'namespace': void 0 - }, - 'children': [], - 'namespace': 'http://www.w3.org/2000/svg', - 'count': 0, - 'hasWidgets': false, - 'hasThunks': false, - 'descendantHooks': false, - 'hooks': void 0, - 'key': void 0 - }, - { - 'tagName': 'line', - 'properties': { - 'property': 'rug.tick', - 'className': 'tick', - 'attributes': { - 'fill': 'none', - 'opacity': 0.9, - 'stroke': '#aaa', - 'stroke-width': 1, - 'data-label': '', - 'y1': 0, - 'y2': -6, - 'x1': 0.5, - 'x2': 0.5 - }, - 'namespace': void 0 - }, - 'children': [], - 'namespace': 'http://www.w3.org/2000/svg', - 'count': 0, - 'hasWidgets': false, - 'hasThunks': false, - 'descendantHooks': false, - 'hooks': void 0, - 'key': void 0 - }, - { - 'tagName': 'line', - 'properties': { - 'property': 'rug.tick', - 'className': 'tick', - 'attributes': { - 'fill': 'none', - 'opacity': 0.9, - 'stroke': '#aaa', - 'stroke-width': 1, - 'data-label': '', - 'y1': 0, - 'y2': -6, - 'x1': 0.9, - 'x2': 0.9 - }, - 'namespace': void 0 - }, - 'children': [], - 'namespace': 'http://www.w3.org/2000/svg', - 'count': 0, - 'hasWidgets': false, - 'hasThunks': false, - 'descendantHooks': false, - 'hooks': void 0, - 'key': void 0 - } - ], - 'namespace': 'http://www.w3.org/2000/svg', - 'count': 3, - 'hasWidgets': false, - 'hasThunks': false, - 'descendantHooks': false, - 'hooks': void 0, - 'key': void 0 -}; - - -// EXPORTS // - -module.exports = vtree; diff --git a/lib/node_modules/@stdlib/plot/components/svg/rug/test/fixtures/vtree.label_function.js b/lib/node_modules/@stdlib/plot/components/svg/rug/test/fixtures/vtree.label_function.js deleted file mode 100644 index 4d0e834bf3c6..000000000000 --- a/lib/node_modules/@stdlib/plot/components/svg/rug/test/fixtures/vtree.label_function.js +++ /dev/null @@ -1,125 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MAIN // - -var vtree = { - 'tagName': 'g', - 'properties': { - 'property': 'rug', - 'className': 'rug', - 'namespace': void 0 - }, - 'children': [ - { - 'tagName': 'line', - 'properties': { - 'property': 'rug.tick', - 'className': 'tick', - 'attributes': { - 'fill': 'none', - 'opacity': 0.9, - 'stroke': '#aaa', - 'stroke-width': 1, - 'data-label': 'beep', - 'y1': 0, - 'y2': -6, - 'x1': 0.1, - 'x2': 0.1 - }, - 'namespace': void 0 - }, - 'children': [], - 'namespace': 'http://www.w3.org/2000/svg', - 'count': 0, - 'hasWidgets': false, - 'hasThunks': false, - 'descendantHooks': false, - 'hooks': void 0, - 'key': void 0 - }, - { - 'tagName': 'line', - 'properties': { - 'property': 'rug.tick', - 'className': 'tick', - 'attributes': { - 'fill': 'none', - 'opacity': 0.9, - 'stroke': '#aaa', - 'stroke-width': 1, - 'data-label': 'boop', - 'y1': 0, - 'y2': -6, - 'x1': 0.5, - 'x2': 0.5 - }, - 'namespace': void 0 - }, - 'children': [], - 'namespace': 'http://www.w3.org/2000/svg', - 'count': 0, - 'hasWidgets': false, - 'hasThunks': false, - 'descendantHooks': false, - 'hooks': void 0, - 'key': void 0 - }, - { - 'tagName': 'line', - 'properties': { - 'property': 'rug.tick', - 'className': 'tick', - 'attributes': { - 'fill': 'none', - 'opacity': 0.9, - 'stroke': '#aaa', - 'stroke-width': 1, - 'data-label': 'bop', - 'y1': 0, - 'y2': -6, - 'x1': 0.9, - 'x2': 0.9 - }, - 'namespace': void 0 - }, - 'children': [], - 'namespace': 'http://www.w3.org/2000/svg', - 'count': 0, - 'hasWidgets': false, - 'hasThunks': false, - 'descendantHooks': false, - 'hooks': void 0, - 'key': void 0 - } - ], - 'namespace': 'http://www.w3.org/2000/svg', - 'count': 3, - 'hasWidgets': false, - 'hasThunks': false, - 'descendantHooks': false, - 'hooks': void 0, - 'key': void 0 -}; - - -// EXPORTS // - -module.exports = vtree; diff --git a/lib/node_modules/@stdlib/plot/components/svg/rug/test/fixtures/vtree.label_string.js b/lib/node_modules/@stdlib/plot/components/svg/rug/test/fixtures/vtree.label_string.js deleted file mode 100644 index 94c5b74700ee..000000000000 --- a/lib/node_modules/@stdlib/plot/components/svg/rug/test/fixtures/vtree.label_string.js +++ /dev/null @@ -1,125 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MAIN // - -var vtree = { - 'tagName': 'g', - 'properties': { - 'property': 'rug', - 'className': 'rug', - 'namespace': void 0 - }, - 'children': [ - { - 'tagName': 'line', - 'properties': { - 'property': 'rug.tick', - 'className': 'tick', - 'attributes': { - 'fill': 'none', - 'opacity': 0.9, - 'stroke': '#aaa', - 'stroke-width': 1, - 'data-label': 'beep', - 'y1': 0, - 'y2': -6, - 'x1': 0.1, - 'x2': 0.1 - }, - 'namespace': void 0 - }, - 'children': [], - 'namespace': 'http://www.w3.org/2000/svg', - 'count': 0, - 'hasWidgets': false, - 'hasThunks': false, - 'descendantHooks': false, - 'hooks': void 0, - 'key': void 0 - }, - { - 'tagName': 'line', - 'properties': { - 'property': 'rug.tick', - 'className': 'tick', - 'attributes': { - 'fill': 'none', - 'opacity': 0.9, - 'stroke': '#aaa', - 'stroke-width': 1, - 'data-label': 'beep', - 'y1': 0, - 'y2': -6, - 'x1': 0.5, - 'x2': 0.5 - }, - 'namespace': void 0 - }, - 'children': [], - 'namespace': 'http://www.w3.org/2000/svg', - 'count': 0, - 'hasWidgets': false, - 'hasThunks': false, - 'descendantHooks': false, - 'hooks': void 0, - 'key': void 0 - }, - { - 'tagName': 'line', - 'properties': { - 'property': 'rug.tick', - 'className': 'tick', - 'attributes': { - 'fill': 'none', - 'opacity': 0.9, - 'stroke': '#aaa', - 'stroke-width': 1, - 'data-label': 'beep', - 'y1': 0, - 'y2': -6, - 'x1': 0.9, - 'x2': 0.9 - }, - 'namespace': void 0 - }, - 'children': [], - 'namespace': 'http://www.w3.org/2000/svg', - 'count': 0, - 'hasWidgets': false, - 'hasThunks': false, - 'descendantHooks': false, - 'hooks': void 0, - 'key': void 0 - } - ], - 'namespace': 'http://www.w3.org/2000/svg', - 'count': 3, - 'hasWidgets': false, - 'hasThunks': false, - 'descendantHooks': false, - 'hooks': void 0, - 'key': void 0 -}; - - -// EXPORTS // - -module.exports = vtree; diff --git a/lib/node_modules/@stdlib/plot/components/svg/rug/test/fixtures/vtree.opacity_function.js b/lib/node_modules/@stdlib/plot/components/svg/rug/test/fixtures/vtree.opacity_function.js deleted file mode 100644 index d895e4594257..000000000000 --- a/lib/node_modules/@stdlib/plot/components/svg/rug/test/fixtures/vtree.opacity_function.js +++ /dev/null @@ -1,125 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MAIN // - -var vtree = { - 'tagName': 'g', - 'properties': { - 'property': 'rug', - 'className': 'rug', - 'namespace': void 0 - }, - 'children': [ - { - 'tagName': 'line', - 'properties': { - 'property': 'rug.tick', - 'className': 'tick', - 'attributes': { - 'fill': 'none', - 'opacity': 0.25, - 'stroke': '#aaa', - 'stroke-width': 1, - 'data-label': '', - 'y1': 0, - 'y2': -6, - 'x1': 0.1, - 'x2': 0.1 - }, - 'namespace': void 0 - }, - 'children': [], - 'namespace': 'http://www.w3.org/2000/svg', - 'count': 0, - 'hasWidgets': false, - 'hasThunks': false, - 'descendantHooks': false, - 'hooks': void 0, - 'key': void 0 - }, - { - 'tagName': 'line', - 'properties': { - 'property': 'rug.tick', - 'className': 'tick', - 'attributes': { - 'fill': 'none', - 'opacity': 0.5, - 'stroke': '#aaa', - 'stroke-width': 1, - 'data-label': '', - 'y1': 0, - 'y2': -6, - 'x1': 0.5, - 'x2': 0.5 - }, - 'namespace': void 0 - }, - 'children': [], - 'namespace': 'http://www.w3.org/2000/svg', - 'count': 0, - 'hasWidgets': false, - 'hasThunks': false, - 'descendantHooks': false, - 'hooks': void 0, - 'key': void 0 - }, - { - 'tagName': 'line', - 'properties': { - 'property': 'rug.tick', - 'className': 'tick', - 'attributes': { - 'fill': 'none', - 'opacity': 0.75, - 'stroke': '#aaa', - 'stroke-width': 1, - 'data-label': '', - 'y1': 0, - 'y2': -6, - 'x1': 0.9, - 'x2': 0.9 - }, - 'namespace': void 0 - }, - 'children': [], - 'namespace': 'http://www.w3.org/2000/svg', - 'count': 0, - 'hasWidgets': false, - 'hasThunks': false, - 'descendantHooks': false, - 'hooks': void 0, - 'key': void 0 - } - ], - 'namespace': 'http://www.w3.org/2000/svg', - 'count': 3, - 'hasWidgets': false, - 'hasThunks': false, - 'descendantHooks': false, - 'hooks': void 0, - 'key': void 0 -}; - - -// EXPORTS // - -module.exports = vtree; diff --git a/lib/node_modules/@stdlib/plot/components/svg/rug/test/fixtures/vtree.opacity_number.js b/lib/node_modules/@stdlib/plot/components/svg/rug/test/fixtures/vtree.opacity_number.js deleted file mode 100644 index 764d6e7af6f6..000000000000 --- a/lib/node_modules/@stdlib/plot/components/svg/rug/test/fixtures/vtree.opacity_number.js +++ /dev/null @@ -1,125 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MAIN // - -var vtree = { - 'tagName': 'g', - 'properties': { - 'property': 'rug', - 'className': 'rug', - 'namespace': void 0 - }, - 'children': [ - { - 'tagName': 'line', - 'properties': { - 'property': 'rug.tick', - 'className': 'tick', - 'attributes': { - 'fill': 'none', - 'opacity': 0.1, - 'stroke': '#aaa', - 'stroke-width': 1, - 'data-label': '', - 'y1': 0, - 'y2': -6, - 'x1': 0.1, - 'x2': 0.1 - }, - 'namespace': void 0 - }, - 'children': [], - 'namespace': 'http://www.w3.org/2000/svg', - 'count': 0, - 'hasWidgets': false, - 'hasThunks': false, - 'descendantHooks': false, - 'hooks': void 0, - 'key': void 0 - }, - { - 'tagName': 'line', - 'properties': { - 'property': 'rug.tick', - 'className': 'tick', - 'attributes': { - 'fill': 'none', - 'opacity': 0.1, - 'stroke': '#aaa', - 'stroke-width': 1, - 'data-label': '', - 'y1': 0, - 'y2': -6, - 'x1': 0.5, - 'x2': 0.5 - }, - 'namespace': void 0 - }, - 'children': [], - 'namespace': 'http://www.w3.org/2000/svg', - 'count': 0, - 'hasWidgets': false, - 'hasThunks': false, - 'descendantHooks': false, - 'hooks': void 0, - 'key': void 0 - }, - { - 'tagName': 'line', - 'properties': { - 'property': 'rug.tick', - 'className': 'tick', - 'attributes': { - 'fill': 'none', - 'opacity': 0.1, - 'stroke': '#aaa', - 'stroke-width': 1, - 'data-label': '', - 'y1': 0, - 'y2': -6, - 'x1': 0.9, - 'x2': 0.9 - }, - 'namespace': void 0 - }, - 'children': [], - 'namespace': 'http://www.w3.org/2000/svg', - 'count': 0, - 'hasWidgets': false, - 'hasThunks': false, - 'descendantHooks': false, - 'hooks': void 0, - 'key': void 0 - } - ], - 'namespace': 'http://www.w3.org/2000/svg', - 'count': 3, - 'hasWidgets': false, - 'hasThunks': false, - 'descendantHooks': false, - 'hooks': void 0, - 'key': void 0 -}; - - -// EXPORTS // - -module.exports = vtree; diff --git a/lib/node_modules/@stdlib/plot/components/svg/rug/test/fixtures/vtree.orientation_left.js b/lib/node_modules/@stdlib/plot/components/svg/rug/test/fixtures/vtree.orientation_left.js deleted file mode 100644 index cf3bf599a7b9..000000000000 --- a/lib/node_modules/@stdlib/plot/components/svg/rug/test/fixtures/vtree.orientation_left.js +++ /dev/null @@ -1,125 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MAIN // - -var vtree = { - 'tagName': 'g', - 'properties': { - 'property': 'rug', - 'className': 'rug', - 'namespace': void 0 - }, - 'children': [ - { - 'tagName': 'line', - 'properties': { - 'property': 'rug.tick', - 'className': 'tick', - 'attributes': { - 'fill': 'none', - 'opacity': 0.9, - 'stroke': '#aaa', - 'stroke-width': 1, - 'data-label': '', - 'x1': 0, - 'x2': 6, - 'y1': 0.1, - 'y2': 0.1 - }, - 'namespace': void 0 - }, - 'children': [], - 'namespace': 'http://www.w3.org/2000/svg', - 'count': 0, - 'hasWidgets': false, - 'hasThunks': false, - 'descendantHooks': false, - 'hooks': void 0, - 'key': void 0 - }, - { - 'tagName': 'line', - 'properties': { - 'property': 'rug.tick', - 'className': 'tick', - 'attributes': { - 'fill': 'none', - 'opacity': 0.9, - 'stroke': '#aaa', - 'stroke-width': 1, - 'data-label': '', - 'x1': 0, - 'x2': 6, - 'y1': 0.5, - 'y2': 0.5 - }, - 'namespace': void 0 - }, - 'children': [], - 'namespace': 'http://www.w3.org/2000/svg', - 'count': 0, - 'hasWidgets': false, - 'hasThunks': false, - 'descendantHooks': false, - 'hooks': void 0, - 'key': void 0 - }, - { - 'tagName': 'line', - 'properties': { - 'property': 'rug.tick', - 'className': 'tick', - 'attributes': { - 'fill': 'none', - 'opacity': 0.9, - 'stroke': '#aaa', - 'stroke-width': 1, - 'data-label': '', - 'x1': 0, - 'x2': 6, - 'y1': 0.9, - 'y2': 0.9 - }, - 'namespace': void 0 - }, - 'children': [], - 'namespace': 'http://www.w3.org/2000/svg', - 'count': 0, - 'hasWidgets': false, - 'hasThunks': false, - 'descendantHooks': false, - 'hooks': void 0, - 'key': void 0 - } - ], - 'namespace': 'http://www.w3.org/2000/svg', - 'count': 3, - 'hasWidgets': false, - 'hasThunks': false, - 'descendantHooks': false, - 'hooks': void 0, - 'key': void 0 -}; - - -// EXPORTS // - -module.exports = vtree; diff --git a/lib/node_modules/@stdlib/plot/components/svg/rug/test/fixtures/vtree.orientation_right.js b/lib/node_modules/@stdlib/plot/components/svg/rug/test/fixtures/vtree.orientation_right.js deleted file mode 100644 index 083bff6e09d1..000000000000 --- a/lib/node_modules/@stdlib/plot/components/svg/rug/test/fixtures/vtree.orientation_right.js +++ /dev/null @@ -1,125 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MAIN // - -var vtree = { - 'tagName': 'g', - 'properties': { - 'property': 'rug', - 'className': 'rug', - 'namespace': void 0 - }, - 'children': [ - { - 'tagName': 'line', - 'properties': { - 'property': 'rug.tick', - 'className': 'tick', - 'attributes': { - 'fill': 'none', - 'opacity': 0.9, - 'stroke': '#aaa', - 'stroke-width': 1, - 'data-label': '', - 'x1': 0, - 'x2': -6, - 'y1': 0.1, - 'y2': 0.1 - }, - 'namespace': void 0 - }, - 'children': [], - 'namespace': 'http://www.w3.org/2000/svg', - 'count': 0, - 'hasWidgets': false, - 'hasThunks': false, - 'descendantHooks': false, - 'hooks': void 0, - 'key': void 0 - }, - { - 'tagName': 'line', - 'properties': { - 'property': 'rug.tick', - 'className': 'tick', - 'attributes': { - 'fill': 'none', - 'opacity': 0.9, - 'stroke': '#aaa', - 'stroke-width': 1, - 'data-label': '', - 'x1': 0, - 'x2': -6, - 'y1': 0.5, - 'y2': 0.5 - }, - 'namespace': void 0 - }, - 'children': [], - 'namespace': 'http://www.w3.org/2000/svg', - 'count': 0, - 'hasWidgets': false, - 'hasThunks': false, - 'descendantHooks': false, - 'hooks': void 0, - 'key': void 0 - }, - { - 'tagName': 'line', - 'properties': { - 'property': 'rug.tick', - 'className': 'tick', - 'attributes': { - 'fill': 'none', - 'opacity': 0.9, - 'stroke': '#aaa', - 'stroke-width': 1, - 'data-label': '', - 'x1': 0, - 'x2': -6, - 'y1': 0.9, - 'y2': 0.9 - }, - 'namespace': void 0 - }, - 'children': [], - 'namespace': 'http://www.w3.org/2000/svg', - 'count': 0, - 'hasWidgets': false, - 'hasThunks': false, - 'descendantHooks': false, - 'hooks': void 0, - 'key': void 0 - } - ], - 'namespace': 'http://www.w3.org/2000/svg', - 'count': 3, - 'hasWidgets': false, - 'hasThunks': false, - 'descendantHooks': false, - 'hooks': void 0, - 'key': void 0 -}; - - -// EXPORTS // - -module.exports = vtree; diff --git a/lib/node_modules/@stdlib/plot/components/svg/rug/test/fixtures/vtree.orientation_top.js b/lib/node_modules/@stdlib/plot/components/svg/rug/test/fixtures/vtree.orientation_top.js deleted file mode 100644 index 7f7d21178291..000000000000 --- a/lib/node_modules/@stdlib/plot/components/svg/rug/test/fixtures/vtree.orientation_top.js +++ /dev/null @@ -1,125 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MAIN // - -var vtree = { - 'tagName': 'g', - 'properties': { - 'property': 'rug', - 'className': 'rug', - 'namespace': void 0 - }, - 'children': [ - { - 'tagName': 'line', - 'properties': { - 'property': 'rug.tick', - 'className': 'tick', - 'attributes': { - 'fill': 'none', - 'opacity': 0.9, - 'stroke': '#aaa', - 'stroke-width': 1, - 'data-label': '', - 'y1': 0, - 'y2': 6, - 'x1': 0.1, - 'x2': 0.1 - }, - 'namespace': void 0 - }, - 'children': [], - 'namespace': 'http://www.w3.org/2000/svg', - 'count': 0, - 'hasWidgets': false, - 'hasThunks': false, - 'descendantHooks': false, - 'hooks': void 0, - 'key': void 0 - }, - { - 'tagName': 'line', - 'properties': { - 'property': 'rug.tick', - 'className': 'tick', - 'attributes': { - 'fill': 'none', - 'opacity': 0.9, - 'stroke': '#aaa', - 'stroke-width': 1, - 'data-label': '', - 'y1': 0, - 'y2': 6, - 'x1': 0.5, - 'x2': 0.5 - }, - 'namespace': void 0 - }, - 'children': [], - 'namespace': 'http://www.w3.org/2000/svg', - 'count': 0, - 'hasWidgets': false, - 'hasThunks': false, - 'descendantHooks': false, - 'hooks': void 0, - 'key': void 0 - }, - { - 'tagName': 'line', - 'properties': { - 'property': 'rug.tick', - 'className': 'tick', - 'attributes': { - 'fill': 'none', - 'opacity': 0.9, - 'stroke': '#aaa', - 'stroke-width': 1, - 'data-label': '', - 'y1': 0, - 'y2': 6, - 'x1': 0.9, - 'x2': 0.9 - }, - 'namespace': void 0 - }, - 'children': [], - 'namespace': 'http://www.w3.org/2000/svg', - 'count': 0, - 'hasWidgets': false, - 'hasThunks': false, - 'descendantHooks': false, - 'hooks': void 0, - 'key': void 0 - } - ], - 'namespace': 'http://www.w3.org/2000/svg', - 'count': 3, - 'hasWidgets': false, - 'hasThunks': false, - 'descendantHooks': false, - 'hooks': void 0, - 'key': void 0 -}; - - -// EXPORTS // - -module.exports = vtree; diff --git a/lib/node_modules/@stdlib/plot/components/svg/rug/test/fixtures/vtree.scale.js b/lib/node_modules/@stdlib/plot/components/svg/rug/test/fixtures/vtree.scale.js deleted file mode 100644 index 3934d431d9e9..000000000000 --- a/lib/node_modules/@stdlib/plot/components/svg/rug/test/fixtures/vtree.scale.js +++ /dev/null @@ -1,125 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MAIN // - -var vtree = { - 'tagName': 'g', - 'properties': { - 'property': 'rug', - 'className': 'rug', - 'namespace': void 0 - }, - 'children': [ - { - 'tagName': 'line', - 'properties': { - 'property': 'rug.tick', - 'className': 'tick', - 'attributes': { - 'fill': 'none', - 'opacity': 0.9, - 'stroke': '#aaa', - 'stroke-width': 1, - 'data-label': '', - 'y1': 0, - 'y2': -6, - 'x1': 1.0, - 'x2': 1.0 - }, - 'namespace': void 0 - }, - 'children': [], - 'namespace': 'http://www.w3.org/2000/svg', - 'count': 0, - 'hasWidgets': false, - 'hasThunks': false, - 'descendantHooks': false, - 'hooks': void 0, - 'key': void 0 - }, - { - 'tagName': 'line', - 'properties': { - 'property': 'rug.tick', - 'className': 'tick', - 'attributes': { - 'fill': 'none', - 'opacity': 0.9, - 'stroke': '#aaa', - 'stroke-width': 1, - 'data-label': '', - 'y1': 0, - 'y2': -6, - 'x1': 5.0, - 'x2': 5.0 - }, - 'namespace': void 0 - }, - 'children': [], - 'namespace': 'http://www.w3.org/2000/svg', - 'count': 0, - 'hasWidgets': false, - 'hasThunks': false, - 'descendantHooks': false, - 'hooks': void 0, - 'key': void 0 - }, - { - 'tagName': 'line', - 'properties': { - 'property': 'rug.tick', - 'className': 'tick', - 'attributes': { - 'fill': 'none', - 'opacity': 0.9, - 'stroke': '#aaa', - 'stroke-width': 1, - 'data-label': '', - 'y1': 0, - 'y2': -6, - 'x1': 9.0, - 'x2': 9.0 - }, - 'namespace': void 0 - }, - 'children': [], - 'namespace': 'http://www.w3.org/2000/svg', - 'count': 0, - 'hasWidgets': false, - 'hasThunks': false, - 'descendantHooks': false, - 'hooks': void 0, - 'key': void 0 - } - ], - 'namespace': 'http://www.w3.org/2000/svg', - 'count': 3, - 'hasWidgets': false, - 'hasThunks': false, - 'descendantHooks': false, - 'hooks': void 0, - 'key': void 0 -}; - - -// EXPORTS // - -module.exports = vtree; diff --git a/lib/node_modules/@stdlib/plot/components/svg/rug/test/fixtures/vtree.size.js b/lib/node_modules/@stdlib/plot/components/svg/rug/test/fixtures/vtree.size.js deleted file mode 100644 index 91d52ce06d93..000000000000 --- a/lib/node_modules/@stdlib/plot/components/svg/rug/test/fixtures/vtree.size.js +++ /dev/null @@ -1,125 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MAIN // - -var vtree = { - 'tagName': 'g', - 'properties': { - 'property': 'rug', - 'className': 'rug', - 'namespace': void 0 - }, - 'children': [ - { - 'tagName': 'line', - 'properties': { - 'property': 'rug.tick', - 'className': 'tick', - 'attributes': { - 'fill': 'none', - 'opacity': 0.9, - 'stroke': '#aaa', - 'stroke-width': 1, - 'data-label': '', - 'y1': 0, - 'y2': -12, - 'x1': 0.1, - 'x2': 0.1 - }, - 'namespace': void 0 - }, - 'children': [], - 'namespace': 'http://www.w3.org/2000/svg', - 'count': 0, - 'hasWidgets': false, - 'hasThunks': false, - 'descendantHooks': false, - 'hooks': void 0, - 'key': void 0 - }, - { - 'tagName': 'line', - 'properties': { - 'property': 'rug.tick', - 'className': 'tick', - 'attributes': { - 'fill': 'none', - 'opacity': 0.9, - 'stroke': '#aaa', - 'stroke-width': 1, - 'data-label': '', - 'y1': 0, - 'y2': -12, - 'x1': 0.5, - 'x2': 0.5 - }, - 'namespace': void 0 - }, - 'children': [], - 'namespace': 'http://www.w3.org/2000/svg', - 'count': 0, - 'hasWidgets': false, - 'hasThunks': false, - 'descendantHooks': false, - 'hooks': void 0, - 'key': void 0 - }, - { - 'tagName': 'line', - 'properties': { - 'property': 'rug.tick', - 'className': 'tick', - 'attributes': { - 'fill': 'none', - 'opacity': 0.9, - 'stroke': '#aaa', - 'stroke-width': 1, - 'data-label': '', - 'y1': 0, - 'y2': -12, - 'x1': 0.9, - 'x2': 0.9 - }, - 'namespace': void 0 - }, - 'children': [], - 'namespace': 'http://www.w3.org/2000/svg', - 'count': 0, - 'hasWidgets': false, - 'hasThunks': false, - 'descendantHooks': false, - 'hooks': void 0, - 'key': void 0 - } - ], - 'namespace': 'http://www.w3.org/2000/svg', - 'count': 3, - 'hasWidgets': false, - 'hasThunks': false, - 'descendantHooks': false, - 'hooks': void 0, - 'key': void 0 -}; - - -// EXPORTS // - -module.exports = vtree; diff --git a/lib/node_modules/@stdlib/plot/components/svg/rug/test/test.auto_render.js b/lib/node_modules/@stdlib/plot/components/svg/rug/test/test.auto_render.js deleted file mode 100644 index 3cf3f17be554..000000000000 --- a/lib/node_modules/@stdlib/plot/components/svg/rug/test/test.auto_render.js +++ /dev/null @@ -1,172 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var ctor = require( './../lib' ); - - -// FIXTURES // - -var VTREE = require( './fixtures/vtree.js' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof ctor, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'an instance throws an error if provided an invalid `autoRender` value', function test( t ) { - var values; - var i; - - values = [ - '5', - 5, - NaN, - null, - void 0, - {}, - [], - function noop() {} - ]; - - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[i] ), TypeError, 'throws an error when provided '+values[i] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - var node = ctor(); - node.autoRender = value; - }; - } -}); - -tape( 'an instance supports setting and getting the property value', function test( t ) { - var node; - - node = ctor({ - 'autoRender': false - }); - t.strictEqual( node.autoRender, false, 'returns expected value' ); - - node.autoRender = true; - t.strictEqual( node.autoRender, true, 'returns expected value' ); - - node.autoRender = false; - t.strictEqual( node.autoRender, false, 'returns expected value' ); - - t.end(); -}); - -tape( 'if `autoRender` is `true`, when a returned instance receives a `change` event, it re-renders and emits a `render` event', function test( t ) { - var node = ctor({ - 'autoRender': true, - 'color': '#aaa', - 'data': [ 0.10, 0.50, 0.90 ], - 'label': '', - 'opacity': 0.9, - 'orientation': 'bottom', - 'size': 6 - }); - node.on( 'render', onRender ); - node.emit( 'change' ); - - function onRender( obj ) { - t.ok( true, 'emits a render event' ); - t.deepEqual( obj, VTREE, 'provides virtual tree' ); - t.end(); - } -}); - -tape( 'if `autoRender` is `false`, when a returned instance receives a `change` event, it does not re-render or emit a `render` event', function test( t ) { - var node = ctor({ - 'data': [ 0.10, 0.50, 0.90 ], - 'autoRender': false - }); - node.on( 'render', onRender ); - node.emit( 'change' ); - t.pass( 'is ok' ); - t.end(); - - function onRender() { - t.fail( 'should never be invoked' ); - } -}); - -tape( 'setting the `autoRender` property triggers a `change` event', function test( t ) { - var node = ctor({ - 'autoRender': true - }); - node.on( 'change', onChange ); - node.autoRender = false; - - function onChange() { - t.ok( true, 'triggers event' ); - t.end(); - } -}); - -tape( 'setting the `autoRender` property triggers a `change` event', function test( t ) { - var node = ctor({ - 'autoRender': false - }); - node.on( 'change', onChange ); - node.autoRender = true; - - function onChange() { - t.ok( true, 'triggers event' ); - t.end(); - } -}); - -tape( 'setting the `autoRender` property to an existing value does not trigger a `change` event', function test( t ) { - var node = ctor({ - 'autoRender': true - }); - node.on( 'change', onChange ); - node.autoRender = true; - t.pass( 'is ok' ); - t.end(); - - function onChange() { - t.fail( 'should never be called' ); - } -}); - -tape( 'setting the `autoRender` property to an existing value does not trigger a `change` event', function test( t ) { - var node = ctor({ - 'autoRender': false - }); - node.on( 'change', onChange ); - node.autoRender = false; - t.pass( 'is ok' ); - t.end(); - - function onChange() { - t.fail( 'should never be called' ); - } -}); diff --git a/lib/node_modules/@stdlib/plot/components/svg/rug/test/test.color.js b/lib/node_modules/@stdlib/plot/components/svg/rug/test/test.color.js deleted file mode 100644 index 2dcf0f6623d1..000000000000 --- a/lib/node_modules/@stdlib/plot/components/svg/rug/test/test.color.js +++ /dev/null @@ -1,294 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var ctor = require( './../lib' ); - - -// FIXTURES // - -var VTREE = require( './fixtures/vtree.js' ); -var VTREE_COLOR_STRING = require( './fixtures/vtree.color_string.js' ); -var VTREE_COLOR_FCN = require( './fixtures/vtree.color_function.js' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof ctor, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'an instance throws an error if provided an invalid `color` value', function test( t ) { - var values; - var i; - - values = [ - 5, - NaN, - -3.14, - 3.14, - true, - false, - null, - void 0, - {}, - [] - ]; - - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[i] ), TypeError, 'throws an error when provided '+values[i] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - var node = ctor(); - node.color = value; - }; - } -}); - -tape( 'an instance supports setting and getting the property value (string)', function test( t ) { - var node; - - node = ctor({ - 'autoRender': false, - 'color': '#abc' - }); - t.strictEqual( node.color(), '#abc', 'returns expected value' ); - - node.color = '#cba'; - t.strictEqual( node.color(), '#cba', 'returns expected value' ); - - t.end(); -}); - -tape( 'an instance supports setting and getting the property value (function)', function test( t ) { - var node; - - node = ctor({ - 'autoRender': false, - 'color': color1 - }); - t.strictEqual( node.color, color1, 'returns expected value' ); - - node.color = color2; - t.strictEqual( node.color, color2, 'returns expected value' ); - - t.end(); - - function color1() { - // no-op... - } - - function color2() { - // no-op... - } -}); - -tape( 'a color function is provided two arguments: datum and index', function test( t ) { - var expected; - var actual; - var node; - - node = ctor({ - 'data': [ 0.10, 0.50, 0.90 ], - 'color': color, - 'autoRender': false - }); - - expected = [ - [ 0.10, 0 ], - [ 0.50, 1 ], - [ 0.90, 2 ] - ]; - actual = []; - - node.render(); - - t.deepEqual( actual, expected, 'provides expected arguments' ); - t.end(); - - function color( d, i ) { - actual.push( [ d, i ] ); - } -}); - -tape( 'setting the `color` property triggers a `change` event', function test( t ) { - var node = ctor({ - 'color': '#aaa' - }); - node.on( 'change', onChange ); - node.color = '#fff'; - - function onChange() { - t.ok( true, 'triggers event' ); - t.end(); - } -}); - -tape( 'setting the `color` property triggers a `change` event', function test( t ) { - var node = ctor({ - 'color': '#aaa' - }); - node.on( 'change', onChange ); - node.color = color; - - function color() { - return '#fff'; - } - - function onChange() { - t.ok( true, 'triggers event' ); - t.end(); - } -}); - -tape( 'setting the `color` property triggers a `change` event', function test( t ) { - var node = ctor({ - 'color': color - }); - node.on( 'change', onChange ); - node.color = '#aaa'; - - function color() { - return '#fff'; - } - - function onChange() { - t.ok( true, 'triggers event' ); - t.end(); - } -}); - -tape( 'setting the `color` property triggers a `change` event', function test( t ) { - var node = ctor({ - 'color': color1 - }); - node.on( 'change', onChange ); - node.color = color2; - - function color1() { - return '#fff'; - } - - function color2() { - return '#aaa'; - } - - function onChange() { - t.ok( true, 'triggers event' ); - t.end(); - } -}); - -tape( 'setting the `color` property to an existing value does not trigger a `change` event', function test( t ) { - var node = ctor({ - 'color': '#aaa' - }); - node.on( 'change', onChange ); - node.color = '#aaa'; - t.pass( 'is ok' ); - t.end(); - - function onChange() { - t.fail( 'should never be called' ); - } -}); - -tape( 'setting the `color` property to an existing value does not trigger a `change` event', function test( t ) { - var node = ctor({ - 'color': color - }); - node.on( 'change', onChange ); - node.color = color; - t.pass( 'is ok' ); - t.end(); - - function color() { - return '#fff'; - } - - function onChange() { - t.fail( 'should never be called' ); - } -}); - -tape( 'the value of the color property determines the tick (tassel) color (string)', function test( t ) { - var vtree; - var node; - - node = ctor({ - 'autoRender': false, - 'color': '#aaa', - 'data': [ 0.10, 0.50, 0.90 ], - 'label': '', - 'opacity': 0.9, - 'orientation': 'bottom', - 'size': 6 - }); - vtree = node.render(); - - t.deepEqual( vtree, VTREE, 'default behavior' ); - - node.color = '#fff'; - vtree = node.render(); - - t.deepEqual( vtree, VTREE_COLOR_STRING, 'expected virtual tree' ); - t.end(); -}); - -tape( 'the value of the color property determines the tick (tassel) color (function)', function test( t ) { - var vtree; - var node; - - node = ctor({ - 'autoRender': false, - 'color': '#aaa', - 'data': [ 0.10, 0.50, 0.90 ], - 'label': '', - 'opacity': 0.9, - 'orientation': 'bottom', - 'size': 6 - }); - vtree = node.render(); - - t.deepEqual( vtree, VTREE, 'default behavior' ); - - node.color = color; - vtree = node.render(); - - t.deepEqual( vtree, VTREE_COLOR_FCN, 'expected virtual tree' ); - t.end(); - - function color( d ) { - if ( d === 0.10 ) { - return '#ffa'; - } - if ( d === 0.50 ) { - return '#ffb'; - } - return '#ffc'; - } -}); diff --git a/lib/node_modules/@stdlib/plot/components/svg/rug/test/test.data.js b/lib/node_modules/@stdlib/plot/components/svg/rug/test/test.data.js deleted file mode 100644 index fb29b52f8cbb..000000000000 --- a/lib/node_modules/@stdlib/plot/components/svg/rug/test/test.data.js +++ /dev/null @@ -1,138 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var ctor = require( './../lib' ); - - -// FIXTURES // - -var VTREE = require( './fixtures/vtree.js' ); -var VTREE_DATA = require( './fixtures/vtree.data.js' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof ctor, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'an instance throws an error if provided an invalid `data` value', function test( t ) { - var values; - var i; - - values = [ - 5, - NaN, - true, - false, - null, - void 0, - {}, - function noop() {} - ]; - - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[i] ), TypeError, 'throws an error when provided '+values[i] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - var node = ctor(); - node.data = value; - }; - } -}); - -tape( 'an instance supports setting and getting the property value', function test( t ) { - var node; - - node = ctor({ - 'autoRender': false, - 'data': [ 0.10, 0.50, 0.90 ] - }); - t.deepEqual( node.data, [ 0.10, 0.50, 0.90 ], 'returns expected value' ); - - node.data = [ 0.15, 0.55, 0.95 ]; - t.deepEqual( node.data, [ 0.15, 0.55, 0.95 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'setting the `data` property triggers a `change` event', function test( t ) { - var node = ctor({ - 'autoRender': false, - 'data': [ 0.10, 0.50, 0.90 ] - }); - node.on( 'change', onChange ); - node.data = [ 0.10, 0.50, 0.90 ]; // new reference - - function onChange() { - t.ok( true, 'triggers event' ); - t.end(); - } -}); - -tape( 'setting the `data` property to an existing value triggers a `change` event', function test( t ) { - var node; - var data; - - data = [ 0.10, 0.50, 0.90 ]; - node = ctor({ - 'autoRender': false, - 'data': data - }); - node.on( 'change', onChange ); - node.data = data; - - function onChange() { - t.ok( true, 'triggers event' ); - t.end(); - } -}); - -tape( 'the value of the `data` property determines the tick (tassel) location', function test( t ) { - var vtree; - var node; - - node = ctor({ - 'autoRender': false, - 'color': '#aaa', - 'data': [ 0.10, 0.50, 0.90 ], - 'label': '', - 'opacity': 0.9, - 'orientation': 'bottom', - 'size': 6 - }); - vtree = node.render(); - - t.deepEqual( vtree, VTREE, 'default behavior' ); - - node.data = [ 0.15, 0.55, 0.95 ]; - vtree = node.render(); - - t.deepEqual( vtree, VTREE_DATA, 'expected virtual tree' ); - t.end(); -}); diff --git a/lib/node_modules/@stdlib/plot/components/svg/rug/test/test.is_defined.js b/lib/node_modules/@stdlib/plot/components/svg/rug/test/test.is_defined.js deleted file mode 100644 index 6475cf0f34c8..000000000000 --- a/lib/node_modules/@stdlib/plot/components/svg/rug/test/test.is_defined.js +++ /dev/null @@ -1,193 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var ctor = require( './../lib' ); - - -// FIXTURES // - -var VTREE = require( './fixtures/vtree.js' ); -var VTREE_IS_DEFINED = require( './fixtures/vtree.is_defined.js' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof ctor, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'an instance throws an error if provided an invalid `isDefined` value', function test( t ) { - var values; - var i; - - values = [ - '5', - 5, - NaN, - true, - false, - null, - void 0, - {}, - [] - ]; - - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[i] ), TypeError, 'throws an error when provided '+values[i] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - var node = ctor(); - node.isDefined = value; - }; - } -}); - -tape( 'an instance supports setting and getting the property value', function test( t ) { - var node; - - node = ctor({ - 'autoRender': false, - 'isDefined': isDefined1 - }); - t.deepEqual( node.isDefined, isDefined1, 'returns expected value' ); - - node.isDefined = isDefined2; - t.deepEqual( node.isDefined, isDefined2, 'returns expected value' ); - - t.end(); - - function isDefined1() { - // no-op... - } - - function isDefined2() { - // no-op... - } -}); - -tape( 'an accessor function is provided two arguments: datum and index', function test( t ) { - var expected; - var actual; - var node; - - node = ctor({ - 'data': [ 0.10, 0.50, 0.90 ], - 'isDefined': isDefined, - 'autoRender': false - }); - - expected = [ - [ 0.10, 0 ], - [ 0.50, 1 ], - [ 0.90, 2 ] - ]; - actual = []; - - node.render(); - - t.deepEqual( actual, expected, 'provides expected arguments' ); - t.end(); - - function isDefined( d, i ) { - actual.push( [ d, i ] ); - } -}); - -tape( 'setting the `isDefined` property triggers a `change` event', function test( t ) { - var node = ctor({ - 'autoRender': false, - 'isDefined': isDefined1 - }); - node.on( 'change', onChange ); - node.isDefined = isDefined2; - - function isDefined1() { - // no-op... - } - - function isDefined2() { - // no-op... - } - - function onChange() { - t.ok( true, 'triggers event' ); - t.end(); - } -}); - -tape( 'setting the `isDefined` property to an existing value does not trigger a `change` event', function test( t ) { - var node = ctor({ - 'autoRender': false, - 'isDefined': isDefined - }); - node.on( 'change', onChange ); - node.isDefined = isDefined; - t.pass( 'is ok' ); - t.end(); - - function isDefined() { - // no-op... - } - - function onChange() { - t.fail( 'should never be called' ); - } -}); - -tape( 'the value returned by the `isDefined` accessor determines whether a tick is rendered', function test( t ) { - var vtree; - var node; - - node = ctor({ - 'autoRender': false, - 'color': '#aaa', - 'data': [ 0.10, 0.50, 0.90 ], - 'isDefined': isDefined1, - 'label': '', - 'opacity': 0.9, - 'orientation': 'bottom', - 'size': 6 - }); - vtree = node.render(); - - t.deepEqual( vtree, VTREE, 'default behavior' ); - - node.isDefined = isDefined2; - vtree = node.render(); - - t.deepEqual( vtree, VTREE_IS_DEFINED, 'expected virtual tree' ); - t.end(); - - function isDefined1( d ) { - return ( d === d ); - } - - function isDefined2( d ) { - return ( d !== 0.50 ); - } -}); diff --git a/lib/node_modules/@stdlib/plot/components/svg/rug/test/test.js b/lib/node_modules/@stdlib/plot/components/svg/rug/test/test.js deleted file mode 100644 index 2e3ace3f5ee9..000000000000 --- a/lib/node_modules/@stdlib/plot/components/svg/rug/test/test.js +++ /dev/null @@ -1,58 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var EventEmitter = require( 'events' ).EventEmitter; -var tape = require( 'tape' ); -var instanceOf = require( '@stdlib/assert/instance-of' ); -var Rug = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof Rug, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function is a constructor', function test( t ) { - var node = new Rug(); - t.strictEqual( instanceOf( node, Rug ), true, 'is an instance' ); - t.end(); -}); - -tape( 'the constructor does not require the `new` operator', function test( t ) { - var ctor; - var node; - - ctor = Rug; - node = ctor(); - - t.strictEqual( instanceOf( node, Rug ), true, 'is an instance' ); - t.end(); -}); - -tape( 'the returned instance is an event emitter', function test( t ) { - var node = new Rug(); - t.strictEqual( instanceOf( node, EventEmitter ), true, 'is an event emitter' ); - t.end(); -}); diff --git a/lib/node_modules/@stdlib/plot/components/svg/rug/test/test.label.js b/lib/node_modules/@stdlib/plot/components/svg/rug/test/test.label.js deleted file mode 100644 index b8e46a17f3fb..000000000000 --- a/lib/node_modules/@stdlib/plot/components/svg/rug/test/test.label.js +++ /dev/null @@ -1,294 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var ctor = require( './../lib' ); - - -// FIXTURES // - -var VTREE = require( './fixtures/vtree.js' ); -var VTREE_LABEL_STRING = require( './fixtures/vtree.label_string.js' ); -var VTREE_LABEL_FCN = require( './fixtures/vtree.label_function.js' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof ctor, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'an instance throws an error if provided an invalid `label` value', function test( t ) { - var values; - var i; - - values = [ - 5, - NaN, - -3.14, - 3.14, - true, - false, - null, - void 0, - {}, - [] - ]; - - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[i] ), TypeError, 'throws an error when provided '+values[i] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - var node = ctor(); - node.label = value; - }; - } -}); - -tape( 'an instance supports setting and getting the property value (string)', function test( t ) { - var node; - - node = ctor({ - 'autoRender': false, - 'label': 'beep' - }); - t.strictEqual( node.label(), 'beep', 'returns expected value' ); - - node.label = 'boop'; - t.strictEqual( node.label(), 'boop', 'returns expected value' ); - - t.end(); -}); - -tape( 'an instance supports setting and getting the property value (function)', function test( t ) { - var node; - - node = ctor({ - 'autoRender': false, - 'label': label1 - }); - t.strictEqual( node.label, label1, 'returns expected value' ); - - node.label = label2; - t.strictEqual( node.label, label2, 'returns expected value' ); - - t.end(); - - function label1() { - // no-op... - } - - function label2() { - // no-op... - } -}); - -tape( 'a label function is provided two arguments: datum and index', function test( t ) { - var expected; - var actual; - var node; - - node = ctor({ - 'data': [ 0.10, 0.50, 0.90 ], - 'label': label, - 'autoRender': false - }); - - expected = [ - [ 0.10, 0 ], - [ 0.50, 1 ], - [ 0.90, 2 ] - ]; - actual = []; - - node.render(); - - t.deepEqual( actual, expected, 'provides expected arguments' ); - t.end(); - - function label( d, i ) { - actual.push( [ d, i ] ); - } -}); - -tape( 'setting the `label` property triggers a `change` event', function test( t ) { - var node = ctor({ - 'label': 'beep' - }); - node.on( 'change', onChange ); - node.label = 'boop'; - - function onChange() { - t.ok( true, 'triggers event' ); - t.end(); - } -}); - -tape( 'setting the `label` property triggers a `change` event', function test( t ) { - var node = ctor({ - 'label': 'beep' - }); - node.on( 'change', onChange ); - node.label = label; - - function label() { - return 'boop'; - } - - function onChange() { - t.ok( true, 'triggers event' ); - t.end(); - } -}); - -tape( 'setting the `label` property triggers a `change` event', function test( t ) { - var node = ctor({ - 'label': label - }); - node.on( 'change', onChange ); - node.label = 'boop'; - - function label() { - return 'beep'; - } - - function onChange() { - t.ok( true, 'triggers event' ); - t.end(); - } -}); - -tape( 'setting the `label` property triggers a `change` event', function test( t ) { - var node = ctor({ - 'label': label1 - }); - node.on( 'change', onChange ); - node.label = label2; - - function label1() { - return 'beep'; - } - - function label2() { - return 'boop'; - } - - function onChange() { - t.ok( true, 'triggers event' ); - t.end(); - } -}); - -tape( 'setting the `label` property to an existing value does not trigger a `change` event', function test( t ) { - var node = ctor({ - 'label': 'beep' - }); - node.on( 'change', onChange ); - node.label = 'beep'; - t.pass( 'is ok' ); - t.end(); - - function onChange() { - t.fail( 'should never be called' ); - } -}); - -tape( 'setting the `label` property to an existing value does not trigger a `change` event', function test( t ) { - var node = ctor({ - 'label': label - }); - node.on( 'change', onChange ); - node.label = label; - t.pass( 'is ok' ); - t.end(); - - function label() { - return 'beep'; - } - - function onChange() { - t.fail( 'should never be called' ); - } -}); - -tape( 'the value of the label property determines the tick data label (string)', function test( t ) { - var vtree; - var node; - - node = ctor({ - 'autoRender': false, - 'color': '#aaa', - 'data': [ 0.10, 0.50, 0.90 ], - 'label': '', - 'opacity': 0.9, - 'orientation': 'bottom', - 'size': 6 - }); - vtree = node.render(); - - t.deepEqual( vtree, VTREE, 'default behavior' ); - - node.label = 'beep'; - vtree = node.render(); - - t.deepEqual( vtree, VTREE_LABEL_STRING, 'expected virtual tree' ); - t.end(); -}); - -tape( 'the value of the label property determines the tick data label (function)', function test( t ) { - var vtree; - var node; - - node = ctor({ - 'autoRender': false, - 'color': '#aaa', - 'data': [ 0.10, 0.50, 0.90 ], - 'label': '', - 'opacity': 0.9, - 'orientation': 'bottom', - 'size': 6 - }); - vtree = node.render(); - - t.deepEqual( vtree, VTREE, 'default behavior' ); - - node.label = label; - vtree = node.render(); - - t.deepEqual( vtree, VTREE_LABEL_FCN, 'expected virtual tree' ); - t.end(); - - function label( d ) { - if ( d === 0.10 ) { - return 'beep'; - } - if ( d === 0.50 ) { - return 'boop'; - } - return 'bop'; - } -}); diff --git a/lib/node_modules/@stdlib/plot/components/svg/rug/test/test.opacity.js b/lib/node_modules/@stdlib/plot/components/svg/rug/test/test.opacity.js deleted file mode 100644 index 4fc5a5569988..000000000000 --- a/lib/node_modules/@stdlib/plot/components/svg/rug/test/test.opacity.js +++ /dev/null @@ -1,314 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var ctor = require( './../lib' ); - - -// FIXTURES // - -var VTREE = require( './fixtures/vtree.js' ); -var VTREE_OPACITY_NUM = require( './fixtures/vtree.opacity_number.js' ); -var VTREE_OPACITY_FCN = require( './fixtures/vtree.opacity_function.js' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof ctor, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'an instance throws an error if provided an invalid `opacity` value', function test( t ) { - var values; - var i; - - values = [ - '5', - true, - false, - null, - void 0, - {}, - [] - ]; - - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[i] ), TypeError, 'throws an error when provided '+values[i] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - var node = ctor(); - node.opacity = value; - }; - } -}); - -tape( 'an instance throws a range error if provided an `opacity` value which is not on the interval `[0,1]`', function test( t ) { - var values; - var i; - - values = [ - -3.14, - 3.14, - NaN - ]; - - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[i] ), RangeError, 'throws an error when provided '+values[i] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - var node = ctor(); - node.opacity = value; - }; - } -}); - -tape( 'an instance supports setting and getting the property value (number)', function test( t ) { - var node; - - node = ctor({ - 'autoRender': false, - 'opacity': 0.9 - }); - t.strictEqual( node.opacity(), 0.9, 'returns expected value' ); - - node.opacity = 0.5; - t.strictEqual( node.opacity(), 0.5, 'returns expected value' ); - - t.end(); -}); - -tape( 'an instance supports setting and getting the property value (function)', function test( t ) { - var node; - - node = ctor({ - 'autoRender': false, - 'opacity': opacity1 - }); - t.strictEqual( node.opacity, opacity1, 'returns expected value' ); - - node.opacity = opacity2; - t.strictEqual( node.opacity, opacity2, 'returns expected value' ); - - t.end(); - - function opacity1() { - // no-op... - } - - function opacity2() { - // no-op... - } -}); - -tape( 'an opacity function is provided two arguments: datum and index', function test( t ) { - var expected; - var actual; - var node; - - node = ctor({ - 'data': [ 0.10, 0.50, 0.90 ], - 'opacity': opacity, - 'autoRender': false - }); - - expected = [ - [ 0.10, 0 ], - [ 0.50, 1 ], - [ 0.90, 2 ] - ]; - actual = []; - - node.render(); - - t.deepEqual( actual, expected, 'provides expected arguments' ); - t.end(); - - function opacity( d, i ) { - actual.push( [ d, i ] ); - } -}); - -tape( 'setting the `opacity` property triggers a `change` event', function test( t ) { - var node = ctor({ - 'opacity': 0.9 - }); - node.on( 'change', onChange ); - node.opacity = 0.1; - - function onChange() { - t.ok( true, 'triggers event' ); - t.end(); - } -}); - -tape( 'setting the `opacity` property triggers a `change` event', function test( t ) { - var node = ctor({ - 'opacity': 0.9 - }); - node.on( 'change', onChange ); - node.opacity = opacity; - - function opacity() { - return 0.1; - } - - function onChange() { - t.ok( true, 'triggers event' ); - t.end(); - } -}); - -tape( 'setting the `opacity` property triggers a `change` event', function test( t ) { - var node = ctor({ - 'opacity': opacity - }); - node.on( 'change', onChange ); - node.opacity = 0.9; - - function opacity() { - return 0.1; - } - - function onChange() { - t.ok( true, 'triggers event' ); - t.end(); - } -}); - -tape( 'setting the `opacity` property triggers a `change` event', function test( t ) { - var node = ctor({ - 'opacity': opacity1 - }); - node.on( 'change', onChange ); - node.opacity = opacity2; - - function opacity1() { - return 0.9; - } - - function opacity2() { - return 0.1; - } - - function onChange() { - t.ok( true, 'triggers event' ); - t.end(); - } -}); - -tape( 'setting the `opacity` property to an existing value does not trigger a `change` event', function test( t ) { - var node = ctor({ - 'opacity': 0.9 - }); - node.on( 'change', onChange ); - node.opacity = 0.9; - t.pass( 'is ok' ); - t.end(); - - function onChange() { - t.fail( 'should never be called' ); - } -}); - -tape( 'setting the `opacity` property to an existing value does not trigger a `change` event', function test( t ) { - var node = ctor({ - 'opacity': opacity - }); - node.on( 'change', onChange ); - node.opacity = opacity; - t.pass( 'is ok' ); - t.end(); - - function opacity() { - return 0.9; - } - - function onChange() { - t.fail( 'should never be called' ); - } -}); - -tape( 'the value of the `opacity` property determines the tick (tassel) opacity (number)', function test( t ) { - var vtree; - var node; - - node = ctor({ - 'autoRender': false, - 'color': '#aaa', - 'data': [ 0.10, 0.50, 0.90 ], - 'label': '', - 'opacity': 0.9, - 'orientation': 'bottom', - 'size': 6 - }); - vtree = node.render(); - - t.deepEqual( vtree, VTREE, 'default behavior' ); - - node.opacity = 0.1; - vtree = node.render(); - - t.deepEqual( vtree, VTREE_OPACITY_NUM, 'expected virtual tree' ); - t.end(); -}); - -tape( 'the value of the `opacity` property determines the tick (tassel) opacity (function)', function test( t ) { - var vtree; - var node; - - node = ctor({ - 'autoRender': false, - 'color': '#aaa', - 'data': [ 0.10, 0.50, 0.90 ], - 'label': '', - 'opacity': 0.9, - 'orientation': 'bottom', - 'size': 6 - }); - vtree = node.render(); - - t.deepEqual( vtree, VTREE, 'default behavior' ); - - node.opacity = opacity; - vtree = node.render(); - - t.deepEqual( vtree, VTREE_OPACITY_FCN, 'expected virtual tree' ); - t.end(); - - function opacity( d ) { - if ( d === 0.10 ) { - return 0.25; - } - if ( d === 0.50 ) { - return 0.5; - } - return 0.75; - } -}); diff --git a/lib/node_modules/@stdlib/plot/components/svg/rug/test/test.orientation.js b/lib/node_modules/@stdlib/plot/components/svg/rug/test/test.orientation.js deleted file mode 100644 index be1b1e99b50d..000000000000 --- a/lib/node_modules/@stdlib/plot/components/svg/rug/test/test.orientation.js +++ /dev/null @@ -1,219 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var ctor = require( './../lib' ); - - -// FIXTURES // - -var VTREE = require( './fixtures/vtree.js' ); -var VTREE_ORIENTATION_TOP = require( './fixtures/vtree.orientation_top.js' ); -var VTREE_ORIENTATION_RIGHT = require( './fixtures/vtree.orientation_right.js' ); -var VTREE_ORIENTATION_LEFT = require( './fixtures/vtree.orientation_left.js' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof ctor, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'an instance throws an error if provided an invalid `orientation` value', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'toppy', - 'lefty', - 'righty', - 5, - NaN, - true, - false, - null, - void 0, - {}, - [], - function noop() {} - ]; - - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[i] ), Error, 'throws an error when provided '+values[i] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - var node = ctor(); - node.orientation = value; - }; - } -}); - -tape( 'an instance supports setting and getting the property value', function test( t ) { - var node; - - node = ctor({ - 'autoRender': false, - 'orientation': 'bottom' - }); - t.strictEqual( node.orientation, 'bottom', 'returns expected value' ); - - node.orientation = 'left'; - t.strictEqual( node.orientation, 'left', 'returns expected value' ); - - node.orientation = 'right'; - t.strictEqual( node.orientation, 'right', 'returns expected value' ); - - node.orientation = 'top'; - t.strictEqual( node.orientation, 'top', 'returns expected value' ); - - t.end(); -}); - -tape( 'setting the `orientation` property triggers a `change` event', function test( t ) { - var node = ctor({ - 'orientation': 'bottom' - }); - node.on( 'change', onChange ); - node.orientation = 'right'; - - function onChange() { - t.ok( true, 'triggers event' ); - t.end(); - } -}); - -tape( 'setting the `orientation` property to an existing value does not trigger a `change` event', function test( t ) { - var node = ctor({ - 'orientation': 'bottom' - }); - node.on( 'change', onChange ); - node.orientation = 'bottom'; - t.pass( 'is ok' ); - t.end(); - - function onChange() { - t.fail( 'should never be called' ); - } -}); - -tape( 'the value of the `orientation` property determines the tick (tassel) orientation (top)', function test( t ) { - var vtree; - var node; - - node = ctor({ - 'autoRender': false, - 'color': '#aaa', - 'data': [ 0.10, 0.50, 0.90 ], - 'label': '', - 'opacity': 0.9, - 'orientation': 'bottom', - 'size': 6 - }); - vtree = node.render(); - - t.deepEqual( vtree, VTREE, 'default behavior' ); - - node.orientation = 'top'; - vtree = node.render(); - - t.deepEqual( vtree, VTREE_ORIENTATION_TOP, 'expected virtual tree' ); - t.end(); -}); - -tape( 'the value of the `orientation` property determines the tick (tassel) orientation (right)', function test( t ) { - var vtree; - var node; - - node = ctor({ - 'autoRender': false, - 'color': '#aaa', - 'data': [ 0.10, 0.50, 0.90 ], - 'label': '', - 'opacity': 0.9, - 'orientation': 'bottom', - 'size': 6 - }); - vtree = node.render(); - - t.deepEqual( vtree, VTREE, 'default behavior' ); - - node.orientation = 'right'; - vtree = node.render(); - - t.deepEqual( vtree, VTREE_ORIENTATION_RIGHT, 'expected virtual tree' ); - t.end(); -}); - -tape( 'the value of the `orientation` property determines the tick (tassel) orientation (left)', function test( t ) { - var vtree; - var node; - - node = ctor({ - 'autoRender': false, - 'color': '#aaa', - 'data': [ 0.10, 0.50, 0.90 ], - 'label': '', - 'opacity': 0.9, - 'orientation': 'bottom', - 'size': 6 - }); - vtree = node.render(); - - t.deepEqual( vtree, VTREE, 'default behavior' ); - - node.orientation = 'left'; - vtree = node.render(); - - t.deepEqual( vtree, VTREE_ORIENTATION_LEFT, 'expected virtual tree' ); - t.end(); -}); - -tape( 'the value of the `orientation` property determines the tick (tassel) orientation (bottom)', function test( t ) { - var vtree; - var node; - - node = ctor({ - 'autoRender': false, - 'color': '#aaa', - 'data': [ 0.10, 0.50, 0.90 ], - 'label': '', - 'opacity': 0.9, - 'orientation': 'top', - 'size': 6 - }); - vtree = node.render(); - - t.deepEqual( vtree, VTREE_ORIENTATION_TOP, 'default behavior' ); - - node.orientation = 'bottom'; - vtree = node.render(); - - t.deepEqual( vtree, VTREE, 'expected virtual tree' ); - t.end(); -}); diff --git a/lib/node_modules/@stdlib/plot/components/svg/rug/test/test.render.js b/lib/node_modules/@stdlib/plot/components/svg/rug/test/test.render.js deleted file mode 100644 index 8e490c29a5e0..000000000000 --- a/lib/node_modules/@stdlib/plot/components/svg/rug/test/test.render.js +++ /dev/null @@ -1,57 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var ctor = require( './../lib' ); - - -// FIXTURES // - -var VTREE = require( './fixtures/vtree.js' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof ctor, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the `render` method returns a rendered virtual tree', function test( t ) { - var vtree; - var node; - - node = ctor({ - 'autoRender': false, - 'color': '#aaa', - 'data': [ 0.10, 0.50, 0.90 ], - 'label': '', - 'opacity': 0.9, - 'orientation': 'bottom', - 'size': 6 - }); - vtree = node.render(); - - t.deepEqual( vtree, VTREE, 'returns a virtual tree' ); - t.end(); -}); diff --git a/lib/node_modules/@stdlib/plot/components/svg/rug/test/test.scale.js b/lib/node_modules/@stdlib/plot/components/svg/rug/test/test.scale.js deleted file mode 100644 index f68345c05a9d..000000000000 --- a/lib/node_modules/@stdlib/plot/components/svg/rug/test/test.scale.js +++ /dev/null @@ -1,188 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var ctor = require( './../lib' ); - - -// FIXTURES // - -var VTREE = require( './fixtures/vtree.js' ); -var VTREE_SCALE = require( './fixtures/vtree.scale.js' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof ctor, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'an instance throws an error if provided an invalid `scale` value', function test( t ) { - var values; - var i; - - values = [ - '5', - 5, - NaN, - true, - false, - null, - void 0, - {}, - [] - ]; - - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[i] ), TypeError, 'throws an error when provided '+values[i] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - var node = ctor(); - node.scale = value; - }; - } -}); - -tape( 'an instance supports setting and getting the property value', function test( t ) { - var node; - - node = ctor({ - 'autoRender': false, - 'scale': scale1 - }); - t.deepEqual( node.scale, scale1, 'returns expected value' ); - - node.scale = scale2; - t.deepEqual( node.scale, scale2, 'returns expected value' ); - - t.end(); - - function scale1() { - // no-op... - } - - function scale2() { - // no-op... - } -}); - -tape( 'a scale function is provided one argument: datum', function test( t ) { - var expected; - var actual; - var node; - - node = ctor({ - 'data': [ 0.10, 0.50, 0.90 ], - 'scale': scale, - 'autoRender': false - }); - - expected = [ - 0.10, - 0.50, - 0.90 - ]; - actual = []; - - node.render(); - - t.deepEqual( actual, expected, 'provides expected arguments' ); - t.end(); - - function scale( d ) { - actual.push( d ); - } -}); - -tape( 'setting the `scale` property triggers a `change` event', function test( t ) { - var node = ctor({ - 'autoRender': false, - 'scale': scale1 - }); - node.on( 'change', onChange ); - node.scale = scale2; - - function scale1() { - // no-op... - } - - function scale2() { - // no-op... - } - - function onChange() { - t.ok( true, 'triggers event' ); - t.end(); - } -}); - -tape( 'setting the `scale` property to an existing value does not trigger a `change` event', function test( t ) { - var node = ctor({ - 'autoRender': false, - 'scale': scale - }); - node.on( 'change', onChange ); - node.scale = scale; - t.pass( 'is ok' ); - t.end(); - - function scale() { - // no-op... - } - - function onChange() { - t.fail( 'should never be called' ); - } -}); - -tape( 'a scale function maps each data value to a corresponding coordinate value', function test( t ) { - var vtree; - var node; - - node = ctor({ - 'autoRender': false, - 'color': '#aaa', - 'data': [ 0.10, 0.50, 0.90 ], - 'label': '', - 'opacity': 0.9, - 'orientation': 'bottom', - 'size': 6 - }); - vtree = node.render(); - - t.deepEqual( vtree, VTREE, 'default behavior' ); - - node.scale = scale; - vtree = node.render(); - - t.deepEqual( vtree, VTREE_SCALE, 'expected virtual tree' ); - t.end(); - - function scale( d ) { - return d * 10.0; - } -}); diff --git a/lib/node_modules/@stdlib/plot/components/svg/rug/test/test.size.js b/lib/node_modules/@stdlib/plot/components/svg/rug/test/test.size.js deleted file mode 100644 index 4fe7d91deb27..000000000000 --- a/lib/node_modules/@stdlib/plot/components/svg/rug/test/test.size.js +++ /dev/null @@ -1,136 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var ctor = require( './../lib' ); - - -// FIXTURES // - -var VTREE = require( './fixtures/vtree.js' ); -var VTREE_SIZE = require( './fixtures/vtree.size.js' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof ctor, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'an instance throws an error if provided an invalid `size` value', function test( t ) { - var values; - var i; - - values = [ - '5', - NaN, - -3.14, - 3.14, - true, - false, - null, - void 0, - {}, - [], - function noop() {} - ]; - - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[i] ), TypeError, 'throws an error when provided '+values[i] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - var node = ctor(); - node.size = value; - }; - } -}); - -tape( 'an instance supports setting and getting the property value', function test( t ) { - var node; - - node = ctor({ - 'autoRender': false, - 'size': 6 - }); - t.strictEqual( node.size, 6, 'returns expected value' ); - - node.size = 12; - t.strictEqual( node.size, 12, 'returns expected value' ); - - t.end(); -}); - -tape( 'setting the `size` property triggers a `change` event', function test( t ) { - var node = ctor({ - 'size': 6 - }); - node.on( 'change', onChange ); - node.size = 12; - - function onChange() { - t.ok( true, 'triggers event' ); - t.end(); - } -}); - -tape( 'setting the `size` property to an existing value does not trigger a `change` event', function test( t ) { - var node = ctor({ - 'size': 6 - }); - node.on( 'change', onChange ); - node.size = 6; - t.pass( 'is ok' ); - t.end(); - - function onChange() { - t.fail( 'should never be called' ); - } -}); - -tape( 'the value of the `size` property determines the tick (tassel) size', function test( t ) { - var vtree; - var node; - - node = ctor({ - 'autoRender': false, - 'color': '#aaa', - 'data': [ 0.10, 0.50, 0.90 ], - 'label': '', - 'opacity': 0.9, - 'orientation': 'bottom', - 'size': 6 - }); - vtree = node.render(); - - t.deepEqual( vtree, VTREE, 'default behavior' ); - - node.size = 12; - vtree = node.render(); - - t.deepEqual( vtree, VTREE_SIZE, 'expected virtual tree' ); - t.end(); -}); diff --git a/lib/node_modules/@stdlib/plot/components/svg/rug/test/test.validation.js b/lib/node_modules/@stdlib/plot/components/svg/rug/test/test.validation.js deleted file mode 100644 index 9a05709969e4..000000000000 --- a/lib/node_modules/@stdlib/plot/components/svg/rug/test/test.validation.js +++ /dev/null @@ -1,371 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var ctor = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof ctor, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the constructor throws an error if provided an `options` argument which is not an object', function test( t ) { - var values; - var i; - - values = [ - '5', - 5, - NaN, - true, - false, - null, - void 0, - [], - function noop() {} - ]; - - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[i] ), TypeError, 'throws an error when provided '+values[i] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - var node = ctor( value ); - return node; - }; - } -}); - -tape( 'the constructor throws an error if provided an invalid `autoRender` option', function test( t ) { - var values; - var i; - - values = [ - '5', - 5, - NaN, - null, - void 0, - {}, - [], - function noop() {} - ]; - - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[i] ), TypeError, 'throws an error when provided '+values[i] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - var node = ctor({ - 'autoRender': value - }); - return node; - }; - } -}); - -tape( 'the constructor throws an error if provided an invalid `color` option', function test( t ) { - var values; - var i; - - values = [ - 5, - NaN, - -3.14, - 3.14, - true, - false, - null, - void 0, - {}, - [] - ]; - - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[i] ), TypeError, 'throws an error when provided '+values[i] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - var node = ctor({ - 'color': value - }); - return node; - }; - } -}); - -tape( 'the constructor throws an error if provided an invalid `data` option', function test( t ) { - var values; - var i; - - values = [ - 5, - NaN, - true, - false, - null, - void 0, - {}, - function noop() {} - ]; - - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[i] ), TypeError, 'throws an error when provided '+values[i] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - var node = ctor({ - 'data': value - }); - return node; - }; - } -}); - -tape( 'the constructor throws an error if provided an invalid `isDefined` option', function test( t ) { - var values; - var i; - - values = [ - '5', - 5, - NaN, - true, - false, - null, - void 0, - {}, - [] - ]; - - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[i] ), TypeError, 'throws an error when provided '+values[i] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - var node = ctor({ - 'isDefined': value - }); - return node; - }; - } -}); - -tape( 'the constructor throws an error if provided an invalid `label` option', function test( t ) { - var values; - var i; - - values = [ - 5, - NaN, - -3.14, - 3.14, - true, - false, - null, - void 0, - {}, - [] - ]; - - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[i] ), TypeError, 'throws an error when provided '+values[i] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - var node = ctor({ - 'label': value - }); - return node; - }; - } -}); - -tape( 'the constructor throws an error if provided an invalid `opacity` option', function test( t ) { - var values; - var i; - - values = [ - '5', - true, - false, - null, - void 0, - {}, - [] - ]; - - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[i] ), TypeError, 'throws an error when provided '+values[i] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - var node = ctor({ - 'opacity': value - }); - return node; - }; - } -}); - -tape( 'the constructor throws a range error if provided an `opacity` option which is not on the interval `[0,1]`', function test( t ) { - var values; - var i; - - values = [ - -3.14, - 3.14, - NaN - ]; - - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[i] ), RangeError, 'throws an error when provided '+values[i] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - var node = ctor({ - 'opacity': value - }); - return node; - }; - } -}); - -tape( 'the constructor throws an error if provided an invalid `orientation` option', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'toppy', - 'lefty', - 'righty', - 5, - NaN, - true, - false, - null, - void 0, - {}, - [], - function noop() {} - ]; - - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[i] ), Error, 'throws an error when provided '+values[i] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - var node = ctor({ - 'orientation': value - }); - return node; - }; - } -}); - -tape( 'the constructor throws an error if provided an invalid `scale` option', function test( t ) { - var values; - var i; - - values = [ - '5', - 5, - NaN, - true, - false, - null, - void 0, - {}, - [] - ]; - - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[i] ), TypeError, 'throws an error when provided '+values[i] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - var node = ctor({ - 'scale': value - }); - return node; - }; - } -}); - -tape( 'the constructor throws an error if provided an invalid `size` option', function test( t ) { - var values; - var i; - - values = [ - '5', - NaN, - -3.14, - 3.14, - true, - false, - null, - void 0, - {}, - [], - function noop() {} - ]; - - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[i] ), TypeError, 'throws an error when provided '+values[i] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - var node = ctor({ - 'size': value - }); - return node; - }; - } -}); diff --git a/lib/node_modules/@stdlib/plot/components/svg/symbols/examples/index.js b/lib/node_modules/@stdlib/plot/components/svg/symbols/examples/index.js deleted file mode 100644 index 0e9b2d96b51c..000000000000 --- a/lib/node_modules/@stdlib/plot/components/svg/symbols/examples/index.js +++ /dev/null @@ -1,51 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -var toHTML = require( 'vdom-to-html' ); -var symbols = require( './../lib' ); - -// Create a new symbols component: -var sym = symbols({ - 'x': [0.10, 0.50, 0.90], - 'y': [0.43, 0.37, 0.53], - 'symbol': 'open-circle', - 'autoRender': true -}); - -// Render as a virtual DOM tree: -var vtree = sym.render(); -console.log( JSON.stringify( vtree ) ); - -// Transform the virtual DOM tree to HTML: -var html = toHTML( vtree ); -console.log( html ); - -// Listen for 'render' events (e.g., when triggered due to changes in state): -sym.on( 'render', onRender ); - -setTimeout( update, 1000 ); - -function update() { - sym.y = [0.99, 0.87, 0.92]; -} - -function onRender( vtree ) { - console.log( toHTML( vtree ) ); -} diff --git a/lib/node_modules/@stdlib/plot/components/svg/symbols/lib/accessors/is_defined.js b/lib/node_modules/@stdlib/plot/components/svg/symbols/lib/accessors/is_defined.js deleted file mode 100644 index 347f00b40d6b..000000000000 --- a/lib/node_modules/@stdlib/plot/components/svg/symbols/lib/accessors/is_defined.js +++ /dev/null @@ -1,50 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); -var isnan = require( '@stdlib/assert/is-nan' ).isPrimitive; - - -// VARIABLES // - -var debug = logger( 'symbols:accessor:is-defined' ); - - -// MAIN // - -/** -* Accessor function which determines whether a datum is defined. -* -* @private -* @param {number} d - datum -* @returns {boolean} boolean indicating whether a datum is defined -*/ -function isDefined( d ) { - var bool = !isnan( d ); - debug( 'Datum: %s. Defined: %s.', JSON.stringify( d ), bool ); - return bool; -} - - -// EXPORTS // - -module.exports = isDefined; diff --git a/lib/node_modules/@stdlib/plot/components/svg/symbols/lib/defaults.json b/lib/node_modules/@stdlib/plot/components/svg/symbols/lib/defaults.json deleted file mode 100644 index 76679ca89cac..000000000000 --- a/lib/node_modules/@stdlib/plot/components/svg/symbols/lib/defaults.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "autoRender": false, - "color": "#000", - "isDefined": null, - "label": "", - "opacity": 0.9, - "size": 6, - "symbol": "closed-circle", - "x": [], - "xScale": null, - "y": [], - "yScale": null -} diff --git a/lib/node_modules/@stdlib/plot/components/svg/symbols/lib/index.js b/lib/node_modules/@stdlib/plot/components/svg/symbols/lib/index.js deleted file mode 100644 index c9deaf320c98..000000000000 --- a/lib/node_modules/@stdlib/plot/components/svg/symbols/lib/index.js +++ /dev/null @@ -1,42 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -/** -* SVG symbols. -* -* @module @stdlib/plot/components/svg/symbols -* -* @example -* var Symbols = require( '@stdlib/plot/components/svg/symbols' ); -* -* var symbols = new Symbols({ -* 'x': [0.1,0.2,0.3], -* 'y': [0.4,0.5,0.6] -* }); -*/ - -// MODULES // - -var main = require( './main.js' ); - - -// EXPORTS // - -module.exports = main; diff --git a/lib/node_modules/@stdlib/plot/components/svg/symbols/lib/main.js b/lib/node_modules/@stdlib/plot/components/svg/symbols/lib/main.js deleted file mode 100644 index 0aeb8ca62888..000000000000 --- a/lib/node_modules/@stdlib/plot/components/svg/symbols/lib/main.js +++ /dev/null @@ -1,521 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// TODO: improve JSDoc examples - -// MODULES // - -var EventEmitter = require( 'events' ).EventEmitter; -var logger = require( 'debug' ); -var linear = require( 'd3-scale' ).scaleLinear; // TODO: remove -var defineProperty = require( '@stdlib/utils/define-property' ); -var setReadOnly = require( '@stdlib/utils/define-read-only-property' ); -var objectKeys = require( '@stdlib/utils/keys' ); -var format = require( '@stdlib/string/format' ); -var copy = require( '@stdlib/utils/copy' ); -var merge = require( '@stdlib/utils/merge' ); -var isObject = require( '@stdlib/assert/is-plain-object' ); -var isDefined = require( './accessors/is_defined.js' ); -var defaults = require( './defaults.json' ); -var setSymbol = require( './props/symbol/set.js' ); -var getSymbol = require( './props/symbol/get.js' ); -var setX = require( './props/x/set.js' ); -var getX = require( './props/x/get.js' ); -var setY = require( './props/y/set.js' ); -var getY = require( './props/y/get.js' ); -var setXScale = require( './props/x-scale/set.js' ); -var getXScale = require( './props/x-scale/get.js' ); -var setYScale = require( './props/y-scale/set.js' ); -var getYScale = require( './props/y-scale/get.js' ); -var setIsDefined = require( './props/is-defined/set.js' ); -var getIsDefined = require( './props/is-defined/get.js' ); -var setSize = require( './props/size/set.js' ); -var getSize = require( './props/size/get.js' ); -var setOpacity = require( './props/opacity/set.js' ); -var getOpacity = require( './props/opacity/get.js' ); -var setColor = require( './props/color/set.js' ); -var getColor = require( './props/color/get.js' ); -var setLabel = require( './props/label/set.js' ); -var getLabel = require( './props/label/get.js' ); -var setAutoRender = require( './props/auto-render/set.js' ); -var getAutoRender = require( './props/auto-render/get.js' ); -var getXPos = require( './props/x-pos/get.js' ); -var getYPos = require( './props/y-pos/get.js' ); -var render = require( './render' ); - - -// VARIABLES // - -var debug = logger( 'symbols:main' ); -var PRIVATE_PROPS = [ - '_autoRender', - '_color', - '_isDefined', - '_label', - '_opacity', - '_size', - '_symbol', - '_xData', - '_xScale', - '_yData', - '_yScale' -]; - - -// MAIN // - -/** -* Symbols constructor. -* -* @constructor -* @param {Options} options - constructor options -* @param {ArrayLike} [options.x=[]] - x-values -* @param {ArrayLike} [options.y=[]] - y-values -* @param {Function} [options.xScale] - x scale function -* @param {Function} [options.yScale] - y scale function -* @param {Function} [options.isDefined] - accessor indicating whether a datum is defined -* @param {string} [options.symbol='closed-circle'] - symbol -* @param {(number|Function)} [options.opacity=0.9] - opacity -* @param {(string|Function)} [options.color] - color -* @param {(string|Function)} [options.label] - label -* @param {(NonNegativeInteger|Function)} [options.size=6] - symbol size -* @param {boolean} [options.autoRender=false] - indicates whether to re-render on a change event -* @throws {TypeError} must provide valid options -* @returns {Symbols} Symbols instance -* -* @example -* var symbols = new Symbols({ -* 'x': [0.1,0.2,0.3], -* 'y': [0.4,0.5,0.6] -* }); -*/ -function Symbols( options ) { - var self; - var keys; - var opts; - var key; - var i; - if ( !( this instanceof Symbols ) ) { - if ( arguments.length ) { - return new Symbols( options ); - } - return new Symbols(); - } - self = this; - - opts = copy( defaults ); - opts.isDefined = isDefined; - opts.xScale = linear(); - opts.yScale = linear(); - - if ( arguments.length ) { - if ( !isObject( options ) ) { - throw new TypeError( format( 'invalid argument. Options argument must be an object. Value: `%s`.', options ) ); - } - opts = merge( opts, options ); - } - debug( 'Creating an instance with the following configuration: %s.', JSON.stringify( opts ) ); - EventEmitter.call( this ); - - for ( i = 0; i < PRIVATE_PROPS.length; i++ ) { - defineProperty( this, PRIVATE_PROPS[i], { - 'configurable': false, - 'enumerable': false, - 'writable': true, - 'value': null - }); - } - // Set options... - keys = objectKeys( opts ); - for ( i = 0; i < keys.length; i++ ) { - key = keys[ i ]; - this[ key ] = opts[ key ]; - } - - this.on( 'change', onChange ); - this.on( '_render', onRender ); - - return this; - - /** - * Callback invoked upon receiving a change event. - * - * @private - */ - function onChange() { - debug( 'Received a change event.' ); - if ( self._autoRender ) { // eslint-disable-line no-underscore-dangle - self.render(); - } - } - - /** - * Re-emits a render event. - * - * @private - */ - function onRender() { - var args; - var i; - debug( 'Received a render event. Re-emitting...' ); - args = new Array( arguments.length+1 ); - args[ 0 ] = 'render'; - for ( i = 0; i < arguments.length; i++ ) { - args[ i+1 ] = arguments[ i ]; - } - self.emit.apply( self, args ); - } -} - -/* -* Create a prototype which inherits from the parent prototype. -*/ -Symbols.prototype = Object.create( EventEmitter.prototype ); - -/* -* Set the constructor. -*/ -Symbols.prototype.constructor = Symbols; - -/** -* Symbol. -* -* @name symbol -* @memberof Symbols.prototype -* @type {string} -* @throws {TypeError} must be a supported symbol -* @default 'closed-circle' -* -* @example -* var symbols = new Symbols({ -* 'symbol': 'open-circle' -* }); -* -* var symbol = symbols.symbol; -* // returns 'open-circle' -*/ -defineProperty( Symbols.prototype, 'symbol', { - 'configurable': false, - 'enumerable': true, - 'set': setSymbol, - 'get': getSymbol -}); - -/** -* `x` values. -* -* @name x -* @memberof Symbols.prototype -* @type {ArrayLike} -* @throws {TypeError} must be array-like -* @default [] -* -* @example -* var symbols = new Symbols({ -* 'x': [0.1,0.2,0.3] -* }); -* -* var x = symbols.x; -* // returns [0.1,0.2,0.3] -*/ -defineProperty( Symbols.prototype, 'x', { - 'configurable': false, - 'enumerable': true, - 'set': setX, - 'get': getX -}); - -/** -* `y` values. -* -* @name y -* @memberof Symbols.prototype -* @type {ArrayLike} -* @throws {TypeError} must be array-like -* @default [] -* -* @example -* var symbols = new Symbols({ -* 'y': [0.4,0.5,0.6] -* }); -* -* var y = symbols.y; -* // returns [0.4,0.5,0.6] -*/ -defineProperty( Symbols.prototype, 'y', { - 'configurable': false, - 'enumerable': true, - 'set': setY, - 'get': getY -}); - -/** -* `x` scale function. -* -* @name xScale -* @memberof Symbols.prototype -* @type {Function} -* @throws {TypeError} must be a function -* -* @example -* var symbols = new Symbols({ -* 'xScale': function scale(){} -* }); -* -* var f = symbols.xScale; -* // returns <Function> -*/ -defineProperty( Symbols.prototype, 'xScale', { - 'configurable': false, - 'enumerable': true, - 'set': setXScale, - 'get': getXScale -}); - -/** -* `y` scale function. -* -* @name yScale -* @memberof Symbols.prototype -* @type {Function} -* @throws {TypeError} must be a function -* -* @example -* var symbols = new Symbols({ -* 'yScale': function scale(){} -* }); -* -* var f = symbols.yScale; -* // returns <Function> -*/ -defineProperty( Symbols.prototype, 'yScale', { - 'configurable': false, - 'enumerable': true, - 'set': setYScale, - 'get': getYScale -}); - -/** -* Accessor which defines whether a datum is defined. This accessor is used to define how missing values are encoded. The default behavior is to ignore values which are `NaN`. -* -* @name isDefined -* @memberof Symbols.prototype -* @type {Function} -* @throws {TypeError} must be a function -* -* @example -* var symbols = new Symbols(); -* symbols.isDefined = function isDefined( d ) { -* // Check for `NaN`: -* return ( d === d ); -* } -* -* @example -* function isDefined( d ) { -* // Check for `NaN`: -* return ( d === d ); -* } -* var symbols = new Symbols({ -* 'isDefined': isDefined -* }); -* var fcn = symbols.isDefined; -* // returns <Function> -*/ -defineProperty( Symbols.prototype, 'isDefined', { - 'configurable': false, - 'enumerable': true, - 'set': setIsDefined, - 'get': getIsDefined -}); - -/** -* Symbol size. When retrieved, the returned value is a size accessor. -* -* @name size -* @memberof Symbols.prototype -* @type {(NonNegativeInteger|Function)} -* @throws {TypeError} must be a nonnegative integer or function -* @default 6 -* -* @example -* var symbols = new Symbols({ -* 'size': 5 -* }); -* -* var size = symbols.size; -* // returns <Function> -*/ -defineProperty( Symbols.prototype, 'size', { - 'configurable': false, - 'enumerable': true, - 'set': setSize, - 'get': getSize -}); - -/** -* Symbol opacity. When retrieved, the returned value is an opacity accessor. -* -* @name opacity -* @memberof Symbols.prototype -* @type {(number|Function)} -* @throws {TypeError} must be a number or function -* @throws {RangeError} must be a number on the interval `[0,1]` -* @default 0.9 -* -* @example -* var symbols = new Symbols({ -* 'opacity': 0.5 -* }); -* -* var opacity = symbols.opacity; -* // returns <Function> -*/ -defineProperty( Symbols.prototype, 'opacity', { - 'configurable': false, - 'enumerable': true, - 'set': setOpacity, - 'get': getOpacity -}); - -/** -* Symbols color. When retrieved, the returned value is a color accessor. -* -* @name color -* @memberof Symbols.prototype -* @type {(string|Function)} -* @throws {TypeError} must be a string or function -* -* @example -* var symbols = new Symbols({ -* 'color': 'steelblue' -* }); -* -* var color = symbols.color; -* // returns <Function> -*/ -defineProperty( Symbols.prototype, 'color', { - 'configurable': false, - 'enumerable': true, - 'set': setColor, - 'get': getColor -}); - -/** -* Symbols label. When retrieved, the returned value is a label accessor. -* -* @name label -* @memberof Symbols.prototype -* @type {(string|Function)} -* @throws {TypeError} must be a string or function -* -* @example -* var symbols = new Symbols({ -* 'label': 'group-1' -* }); -* -* var label = symbols.label; -* // returns <Function> -*/ -defineProperty( Symbols.prototype, 'label', { - 'configurable': false, - 'enumerable': true, - 'set': setLabel, - 'get': getLabel -}); - -/** -* Rendering mode. If `true`, an instance re-renders on each change event. -* -* @name autoRender -* @memberof Symbols.prototype -* @type {boolean} -* @throws {TypeError} must be a boolean -* @default false -* -* @example -* var symbols = new Symbols({ -* 'autoRender': true -* }); -* -* var mode = symbols.autoRender; -* // returns true -*/ -defineProperty( Symbols.prototype, 'autoRender', { - 'configurable': false, - 'enumerable': true, - 'set': setAutoRender, - 'get': getAutoRender -}); - -/** -* Function to map values to x coordinate values. -* -* @name xPos -* @memberof Symbols.prototype -* @type {Function} -* -* @example -* var symbols = new Symbols(); -* var xPos = symbols.xPos; -* // returns <Function> -*/ -defineProperty( Symbols.prototype, 'xPos', { - 'configurable': false, - 'enumerable': true, - 'get': getXPos -}); - -/** -* Function to map values to y coordinate values. -* -* @name yPos -* @memberof Symbols.prototype -* @type {Function} -* -* @example -* var symbols = new Symbols(); -* var yPos = symbols.yPos; -* // returns <Function> -*/ -defineProperty( Symbols.prototype, 'yPos', { - 'configurable': false, - 'enumerable': true, - 'get': getYPos -}); - -/** -* Renders a virtual DOM tree. -* -* @name render -* @memberof Symbols.prototype -* @type {Function} -* @returns {VTree} virtual tree -* -* @example -* var symbols = new Symbols(); -* -* var out = symbols.render(); -*/ -setReadOnly( Symbols.prototype, 'render', render ); - - -// EXPORTS // - -module.exports = Symbols; diff --git a/lib/node_modules/@stdlib/plot/components/svg/symbols/lib/props/auto-render/get.js b/lib/node_modules/@stdlib/plot/components/svg/symbols/lib/props/auto-render/get.js deleted file mode 100644 index 7df40dec3f47..000000000000 --- a/lib/node_modules/@stdlib/plot/components/svg/symbols/lib/props/auto-render/get.js +++ /dev/null @@ -1,35 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -/** -* Returns the rendering mode. -* -* @private -* @returns {boolean} rendering mode -*/ -function get() { - /* eslint-disable no-invalid-this */ - return this._autoRender; -} - - -// EXPORTS // - -module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/components/svg/symbols/lib/props/auto-render/set.js b/lib/node_modules/@stdlib/plot/components/svg/symbols/lib/props/auto-render/set.js deleted file mode 100644 index 8509b85a2102..000000000000 --- a/lib/node_modules/@stdlib/plot/components/svg/symbols/lib/props/auto-render/set.js +++ /dev/null @@ -1,58 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); -var isBoolean = require( '@stdlib/assert/is-boolean' ).isPrimitive; -var format = require( '@stdlib/string/format' ); - - -// VARIABLES // - -var debug = logger( 'symbols:set:auto-render' ); - - -// MAIN // - -/** -* Sets the rendering mode. -* -* @private -* @param {boolean} bool - boolean indicating whether to re-render on a change event -* @throws {TypeError} must be a boolean -*/ -function set( bool ) { - /* eslint-disable no-invalid-this */ - if ( !isBoolean( bool ) ) { - throw new TypeError( format( 'invalid assignment. `%s` must be a boolean. Value: `%s`.', 'autoRender', bool ) ); - } - debug( 'Current value: %d.', this._autoRender ); - - this._autoRender = bool; - debug( 'New Value: %d.', this._autoRender ); - - this.emit( 'change' ); -} - - -// EXPORTS // - -module.exports = set; diff --git a/lib/node_modules/@stdlib/plot/components/svg/symbols/lib/props/color/get.js b/lib/node_modules/@stdlib/plot/components/svg/symbols/lib/props/color/get.js deleted file mode 100644 index e087bef3f9b2..000000000000 --- a/lib/node_modules/@stdlib/plot/components/svg/symbols/lib/props/color/get.js +++ /dev/null @@ -1,56 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var isString = require( '@stdlib/assert/is-string' ).isPrimitive; - - -// MAIN // - -/** -* Returns a function to get a symbol's color. -* -* @private -* @returns {Function} color accessor -*/ -function get() { - /* eslint-disable no-invalid-this */ - var self = this; - if ( isString( this._color ) ) { - return color; - } - return this._color; - - /** - * Returns the color. - * - * @private - * @returns {string} color - */ - function color() { - return self._color; // eslint-disable-line no-underscore-dangle - } -} - - -// EXPORTS // - -module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/components/svg/symbols/lib/props/color/set.js b/lib/node_modules/@stdlib/plot/components/svg/symbols/lib/props/color/set.js deleted file mode 100644 index e72fcb11e708..000000000000 --- a/lib/node_modules/@stdlib/plot/components/svg/symbols/lib/props/color/set.js +++ /dev/null @@ -1,62 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); -var isString = require( '@stdlib/assert/is-string' ).isPrimitive; -var isFunction = require( '@stdlib/assert/is-function' ); -var format = require( '@stdlib/string/format' ); - - -// VARIABLES // - -var debug = logger( 'symbols:set:color' ); - - -// MAIN // - -/** -* Sets the color. -* -* @private -* @param {(string|Function)} color - color -* @throws {TypeError} must be a string or function -*/ -function set( color ) { - /* eslint-disable no-invalid-this */ - if ( - !isString( color ) && - !isFunction( color ) - ) { - throw new TypeError( format( 'invalid assignment. `%s` must be a string or a function. Value: `%s`.', 'color', color ) ); - } - debug( 'Current value: %d.', this._color ); - - this._color = color; - debug( 'New Value: %d.', this._color ); - - this.emit( 'change' ); -} - - -// EXPORTS // - -module.exports = set; diff --git a/lib/node_modules/@stdlib/plot/components/svg/symbols/lib/props/is-defined/get.js b/lib/node_modules/@stdlib/plot/components/svg/symbols/lib/props/is-defined/get.js deleted file mode 100644 index fd05f22602d6..000000000000 --- a/lib/node_modules/@stdlib/plot/components/svg/symbols/lib/props/is-defined/get.js +++ /dev/null @@ -1,35 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -/** -* Returns the accessor for defined values. -* -* @private -* @returns {Function} accessor -*/ -function get() { - /* eslint-disable no-invalid-this */ - return this._isDefined; -} - - -// EXPORTS // - -module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/components/svg/symbols/lib/props/is-defined/set.js b/lib/node_modules/@stdlib/plot/components/svg/symbols/lib/props/is-defined/set.js deleted file mode 100644 index 8c449377a333..000000000000 --- a/lib/node_modules/@stdlib/plot/components/svg/symbols/lib/props/is-defined/set.js +++ /dev/null @@ -1,58 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); -var isFunction = require( '@stdlib/assert/is-function' ); -var format = require( '@stdlib/string/format' ); - - -// VARIABLES // - -var debug = logger( 'symbols:set:is-defined' ); - - -// MAIN // - -/** -* Sets the accessor for defined values. -* -* @private -* @param {Function} fcn - accessor -* @throws {TypeError} must be a function -*/ -function set( fcn ) { - /* eslint-disable no-invalid-this */ - if ( !isFunction( fcn ) ) { - throw new TypeError( format( 'invalid assignment. `%s` must be a function. Value: `%s`.', 'isDefined', fcn ) ); - } - debug( 'Current value: %s.', this._isDefined ); - - this._isDefined = fcn; - debug( 'New Value: %s.', this._isDefined ); - - this.emit( 'change' ); -} - - -// EXPORTS // - -module.exports = set; diff --git a/lib/node_modules/@stdlib/plot/components/svg/symbols/lib/props/label/get.js b/lib/node_modules/@stdlib/plot/components/svg/symbols/lib/props/label/get.js deleted file mode 100644 index 8aa635d23880..000000000000 --- a/lib/node_modules/@stdlib/plot/components/svg/symbols/lib/props/label/get.js +++ /dev/null @@ -1,56 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var isString = require( '@stdlib/assert/is-string' ).isPrimitive; - - -// MAIN // - -/** -* Returns a function to get a symbol's label. -* -* @private -* @returns {Function} label accessor -*/ -function get() { - /* eslint-disable no-invalid-this */ - var self = this; - if ( isString( this._label ) ) { - return label; - } - return this._label; - - /** - * Returns the label. - * - * @private - * @returns {string} label - */ - function label() { - return self._label; // eslint-disable-line no-underscore-dangle - } -} - - -// EXPORTS // - -module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/components/svg/symbols/lib/props/label/set.js b/lib/node_modules/@stdlib/plot/components/svg/symbols/lib/props/label/set.js deleted file mode 100644 index 698c3f28491a..000000000000 --- a/lib/node_modules/@stdlib/plot/components/svg/symbols/lib/props/label/set.js +++ /dev/null @@ -1,62 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); -var isString = require( '@stdlib/assert/is-string' ).isPrimitive; -var isFunction = require( '@stdlib/assert/is-function' ); -var format = require( '@stdlib/string/format' ); - - -// VARIABLES // - -var debug = logger( 'symbols:set:label' ); - - -// MAIN // - -/** -* Sets the label. -* -* @private -* @param {(string|Function)} label - label -* @throws {TypeError} must be a string or a function -*/ -function set( label ) { - /* eslint-disable no-invalid-this */ - if ( - !isString( label ) && - !isFunction( label ) - ) { - throw new TypeError( format( 'invalid assignment. `%s` must be a string or a function. Value: `%s`.', 'label', label ) ); - } - debug( 'Current value: %d.', this._label ); - - this._label = label; - debug( 'New Value: %d.', this._label ); - - this.emit( 'change' ); -} - - -// EXPORTS // - -module.exports = set; diff --git a/lib/node_modules/@stdlib/plot/components/svg/symbols/lib/props/opacity/get.js b/lib/node_modules/@stdlib/plot/components/svg/symbols/lib/props/opacity/get.js deleted file mode 100644 index bc8833f554b9..000000000000 --- a/lib/node_modules/@stdlib/plot/components/svg/symbols/lib/props/opacity/get.js +++ /dev/null @@ -1,56 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var isNumber = require( '@stdlib/assert/is-number' ).isPrimitive; - - -// MAIN // - -/** -* Returns a function to get a symbol's opacity. -* -* @private -* @returns {Function} opacity accessor -*/ -function get() { - /* eslint-disable no-invalid-this */ - var self = this; - if ( isNumber( this._opacity ) ) { - return opacity; - } - return this._opacity; - - /** - * Returns the opacity. - * - * @private - * @returns {number} opacity - */ - function opacity() { - return self._opacity; // eslint-disable-line no-underscore-dangle - } -} - - -// EXPORTS // - -module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/components/svg/symbols/lib/props/opacity/set.js b/lib/node_modules/@stdlib/plot/components/svg/symbols/lib/props/opacity/set.js deleted file mode 100644 index e718d2200764..000000000000 --- a/lib/node_modules/@stdlib/plot/components/svg/symbols/lib/props/opacity/set.js +++ /dev/null @@ -1,70 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); -var isNumber = require( '@stdlib/assert/is-number' ).isPrimitive; -var isFunction = require( '@stdlib/assert/is-function' ); -var format = require( '@stdlib/string/format' ); - - -// VARIABLES // - -var debug = logger( 'symbols:set:opacity' ); - - -// MAIN // - -/** -* Sets the symbol opacity. -* -* @private -* @param {(number|Function)} opacity - opacity -* @throws {TypeError} must be a number or a function -* @throws {RangeError} must be a number on the interval `[0,1]` -*/ -function set( opacity ) { - /* eslint-disable no-invalid-this */ - var isNum = isNumber( opacity ); - if ( - !isNum && - !isFunction( opacity ) - ) { - throw new TypeError( format( 'invalid assignment. `%s` must be a number or a function. Value: `%s`.', 'opacity', opacity ) ); - } - if ( - isNum && - (opacity < 0.0 || opacity > 1.0) - ) { - throw new RangeError( format( 'invalid assignment. `%s` must be a number on the interval: [0, 1]. Value: `%f`.', 'opacity', opacity ) ); - } - debug( 'Current value: %d.', this._opacity ); - - this._opacity = opacity; - debug( 'New Value: %d.', this._opacity ); - - this.emit( 'change' ); -} - - -// EXPORTS // - -module.exports = set; diff --git a/lib/node_modules/@stdlib/plot/components/svg/symbols/lib/props/size/get.js b/lib/node_modules/@stdlib/plot/components/svg/symbols/lib/props/size/get.js deleted file mode 100644 index 2958a6befa4e..000000000000 --- a/lib/node_modules/@stdlib/plot/components/svg/symbols/lib/props/size/get.js +++ /dev/null @@ -1,56 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var isNumber = require( '@stdlib/assert/is-number' ).isPrimitive; - - -// MAIN // - -/** -* Returns a function to get a symbol's size. -* -* @private -* @returns {Function} size accessor -*/ -function get() { - /* eslint-disable no-invalid-this */ - var self = this; - if ( isNumber( this._size ) ) { - return size; - } - return this._size; - - /** - * Returns the size. - * - * @private - * @returns {number} size - */ - function size() { - return self._size; // eslint-disable-line no-underscore-dangle - } -} - - -// EXPORTS // - -module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/components/svg/symbols/lib/props/size/set.js b/lib/node_modules/@stdlib/plot/components/svg/symbols/lib/props/size/set.js deleted file mode 100644 index 1c4eef94478f..000000000000 --- a/lib/node_modules/@stdlib/plot/components/svg/symbols/lib/props/size/set.js +++ /dev/null @@ -1,62 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); -var isNonNegativeInteger = require( '@stdlib/assert/is-nonnegative-integer' ).isPrimitive; -var isFunction = require( '@stdlib/assert/is-function' ); -var format = require( '@stdlib/string/format' ); - - -// VARIABLES // - -var debug = logger( 'symbols:set:size' ); - - -// MAIN // - -/** -* Sets the symbol size. -* -* @private -* @param {(NonNegativeInteger|Function)} size - size -* @throws {TypeError} must be a nonnegative integer or a function -*/ -function set( size ) { - /* eslint-disable no-invalid-this */ - if ( - !isNonNegativeInteger( size ) && - !isFunction( size ) - ) { - throw new TypeError( format( 'invalid assignment. `%s` must be a nonnegative integer or a function. Value: `%s`.', 'size', size ) ); - } - debug( 'Current value: %d.', this._size ); - - this._size = size; - debug( 'New Value: %d.', this._size ); - - this.emit( 'change' ); -} - - -// EXPORTS // - -module.exports = set; diff --git a/lib/node_modules/@stdlib/plot/components/svg/symbols/lib/props/symbol/get.js b/lib/node_modules/@stdlib/plot/components/svg/symbols/lib/props/symbol/get.js deleted file mode 100644 index 54e93654d075..000000000000 --- a/lib/node_modules/@stdlib/plot/components/svg/symbols/lib/props/symbol/get.js +++ /dev/null @@ -1,35 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -/** -* Returns the symbol. -* -* @private -* @returns {string} symbol -*/ -function get() { - /* eslint-disable no-invalid-this */ - return this._symbol; -} - - -// EXPORTS // - -module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/components/svg/symbols/lib/props/symbol/set.js b/lib/node_modules/@stdlib/plot/components/svg/symbols/lib/props/symbol/set.js deleted file mode 100644 index 6fd10f88ad17..000000000000 --- a/lib/node_modules/@stdlib/plot/components/svg/symbols/lib/props/symbol/set.js +++ /dev/null @@ -1,59 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); -var indexOf = require( '@stdlib/utils/index-of' ); -var format = require( '@stdlib/string/format' ); -var SYMBOLS = require( './symbols.json' ); - - -// VARIABLES // - -var debug = logger( 'symbols:set:symbol' ); - - -// MAIN // - -/** -* Sets the symbol. -* -* @private -* @param {string} symbol - symbol -* @throws {TypeError} must be a supported symbol -*/ -function set( symbol ) { - /* eslint-disable no-invalid-this */ - if ( indexOf( SYMBOLS, symbol ) === -1 ) { - throw new TypeError( format( 'invalid assignment. `%s` must be a supported symbol. Symbols: "%s". Value: `%s`.', 'symbol', SYMBOLS.join( '", "' ), symbol ) ); - } - debug( 'Current value: %d.', this._symbol ); - - this._symbol = symbol; - debug( 'New Value: %d.', this._symbol ); - - this.emit( 'change' ); -} - - -// EXPORTS // - -module.exports = set; diff --git a/lib/node_modules/@stdlib/plot/components/svg/symbols/lib/props/symbol/symbols.json b/lib/node_modules/@stdlib/plot/components/svg/symbols/lib/props/symbol/symbols.json deleted file mode 100644 index 0f0345a38e1c..000000000000 --- a/lib/node_modules/@stdlib/plot/components/svg/symbols/lib/props/symbol/symbols.json +++ /dev/null @@ -1,4 +0,0 @@ -[ - "closed-circle", - "open-circle" -] diff --git a/lib/node_modules/@stdlib/plot/components/svg/symbols/lib/props/x-pos/get.js b/lib/node_modules/@stdlib/plot/components/svg/symbols/lib/props/x-pos/get.js deleted file mode 100644 index 75c92dcd3e8f..000000000000 --- a/lib/node_modules/@stdlib/plot/components/svg/symbols/lib/props/x-pos/get.js +++ /dev/null @@ -1,61 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); - - -// VARIABLES // - -var debug = logger( 'symbols:xpos' ); - - -// MAIN // - -/** -* Returns a function to map values to x coordinate values. -* -* @private -* @returns {Function} map function -*/ -function get() { - /* eslint-disable no-invalid-this */ - var scale = this.xScale; - - return xPos; - /** - * Maps a value to a x coordinate value. - * - * @private - * @param {*} d - datum - * @returns {number} pixel value - */ - function xPos( d ) { - var px = scale( d ); - debug( 'Value: %d => Pixel: %d.', d, px ); - return px; - } -} - - -// EXPORTS // - -module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/components/svg/symbols/lib/props/x-scale/get.js b/lib/node_modules/@stdlib/plot/components/svg/symbols/lib/props/x-scale/get.js deleted file mode 100644 index a3ad33fb3c92..000000000000 --- a/lib/node_modules/@stdlib/plot/components/svg/symbols/lib/props/x-scale/get.js +++ /dev/null @@ -1,35 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -/** -* Returns the x-scale function. -* -* @private -* @returns {Function} scale function -*/ -function get() { - /* eslint-disable no-invalid-this */ - return this._xScale; -} - - -// EXPORTS // - -module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/components/svg/symbols/lib/props/x-scale/set.js b/lib/node_modules/@stdlib/plot/components/svg/symbols/lib/props/x-scale/set.js deleted file mode 100644 index bb7d9f4eb07b..000000000000 --- a/lib/node_modules/@stdlib/plot/components/svg/symbols/lib/props/x-scale/set.js +++ /dev/null @@ -1,58 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); -var isFunction = require( '@stdlib/assert/is-function' ); -var format = require( '@stdlib/string/format' ); - - -// VARIABLES // - -var debug = logger( 'symbols:set:xscale' ); - - -// MAIN // - -/** -* Sets the x-scale function. -* -* @private -* @param {Function} fcn - scale -* @throws {TypeError} must be a function -*/ -function set( fcn ) { - /* eslint-disable no-invalid-this */ - if ( !isFunction( fcn ) ) { - throw new TypeError( format( 'invalid assignment. `%s` must be a function. Value: `%s`.', 'xScale', fcn ) ); - } - debug( 'Current value: %s.', this._xScale ); - - this._xScale = fcn; - debug( 'New Value: %s.', this._xScale ); - - this.emit( 'change' ); -} - - -// EXPORTS // - -module.exports = set; diff --git a/lib/node_modules/@stdlib/plot/components/svg/symbols/lib/props/x/get.js b/lib/node_modules/@stdlib/plot/components/svg/symbols/lib/props/x/get.js deleted file mode 100644 index fcddeb2cb0f9..000000000000 --- a/lib/node_modules/@stdlib/plot/components/svg/symbols/lib/props/x/get.js +++ /dev/null @@ -1,35 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -/** -* Returns the `x` values. -* -* @private -* @returns {ArrayLike} x values -*/ -function get() { - /* eslint-disable no-invalid-this */ - return this._xData; -} - - -// EXPORTS // - -module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/components/svg/symbols/lib/props/x/set.js b/lib/node_modules/@stdlib/plot/components/svg/symbols/lib/props/x/set.js deleted file mode 100644 index fc654b83eb96..000000000000 --- a/lib/node_modules/@stdlib/plot/components/svg/symbols/lib/props/x/set.js +++ /dev/null @@ -1,58 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); -var isArrayLike = require( '@stdlib/assert/is-array-like' ); -var format = require( '@stdlib/string/format' ); - - -// VARIABLES // - -var debug = logger( 'symbols:set:x' ); - - -// MAIN // - -/** -* Sets the `x` values. -* -* @private -* @param {ArrayLike} x - x values -* @throws {TypeError} must be array-like -*/ -function set( x ) { - /* eslint-disable no-invalid-this */ - if ( !isArrayLike( x ) ) { - throw new TypeError( format( 'invalid assignment. `%s` must be array-like. Value: `%s`.', 'x', x ) ); - } - debug( 'Current value: %s.', JSON.stringify( this._xData ) ); - - this._xData = x; - debug( 'New Value: %s.', JSON.stringify( this._xData ) ); - - this.emit( 'change' ); -} - - -// EXPORTS // - -module.exports = set; diff --git a/lib/node_modules/@stdlib/plot/components/svg/symbols/lib/props/y-pos/get.js b/lib/node_modules/@stdlib/plot/components/svg/symbols/lib/props/y-pos/get.js deleted file mode 100644 index d8bed7c2b1da..000000000000 --- a/lib/node_modules/@stdlib/plot/components/svg/symbols/lib/props/y-pos/get.js +++ /dev/null @@ -1,61 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); - - -// VARIABLES // - -var debug = logger( 'symbols:ypos' ); - - -// MAIN // - -/** -* Returns a function to map values to y coordinate values. -* -* @private -* @returns {Function} map function -*/ -function get() { - /* eslint-disable no-invalid-this */ - var scale = this.yScale; - return yPos; - - /** - * Maps a value to a y coordinate value. - * - * @private - * @param {*} d - datum - * @returns {number} pixel value - */ - function yPos( d ) { - var px = scale( d ); - debug( 'Value: %d => Pixel: %d.', d, px ); - return px; - } -} - - -// EXPORTS // - -module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/components/svg/symbols/lib/props/y-scale/get.js b/lib/node_modules/@stdlib/plot/components/svg/symbols/lib/props/y-scale/get.js deleted file mode 100644 index 83f782c5faf5..000000000000 --- a/lib/node_modules/@stdlib/plot/components/svg/symbols/lib/props/y-scale/get.js +++ /dev/null @@ -1,35 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -/** -* Returns the y-scale function. -* -* @private -* @returns {Function} scale function -*/ -function get() { - /* eslint-disable no-invalid-this */ - return this._yScale; -} - - -// EXPORTS // - -module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/components/svg/symbols/lib/props/y-scale/set.js b/lib/node_modules/@stdlib/plot/components/svg/symbols/lib/props/y-scale/set.js deleted file mode 100644 index 055b20f2712f..000000000000 --- a/lib/node_modules/@stdlib/plot/components/svg/symbols/lib/props/y-scale/set.js +++ /dev/null @@ -1,58 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); -var isFunction = require( '@stdlib/assert/is-function' ); -var format = require( '@stdlib/string/format' ); - - -// VARIABLES // - -var debug = logger( 'symbols:set:yscale' ); - - -// MAIN // - -/** -* Sets the y-scale function. -* -* @private -* @param {Function} fcn - scale -* @throws {TypeError} must be a function -*/ -function set( fcn ) { - /* eslint-disable no-invalid-this */ - if ( !isFunction( fcn ) ) { - throw new TypeError( format( 'invalid assignment. `%s` must be a function. Value: `%s`.', 'yScale', fcn ) ); - } - debug( 'Current value: %s.', this._yScale ); - - this._yScale = fcn; - debug( 'New Value: %s.', this._yScale ); - - this.emit( 'change' ); -} - - -// EXPORTS // - -module.exports = set; diff --git a/lib/node_modules/@stdlib/plot/components/svg/symbols/lib/props/y/get.js b/lib/node_modules/@stdlib/plot/components/svg/symbols/lib/props/y/get.js deleted file mode 100644 index 459d02249332..000000000000 --- a/lib/node_modules/@stdlib/plot/components/svg/symbols/lib/props/y/get.js +++ /dev/null @@ -1,35 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -/** -* Returns the `y` values. -* -* @private -* @returns {ArrayLike} y values -*/ -function get() { - /* eslint-disable no-invalid-this */ - return this._yData; -} - - -// EXPORTS // - -module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/components/svg/symbols/lib/props/y/set.js b/lib/node_modules/@stdlib/plot/components/svg/symbols/lib/props/y/set.js deleted file mode 100644 index 83be3a303db3..000000000000 --- a/lib/node_modules/@stdlib/plot/components/svg/symbols/lib/props/y/set.js +++ /dev/null @@ -1,58 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); -var isArrayLike = require( '@stdlib/assert/is-array-like' ); -var format = require( '@stdlib/string/format' ); - - -// VARIABLES // - -var debug = logger( 'symbols:set:y' ); - - -// MAIN // - -/** -* Sets the `y` values. -* -* @private -* @param {ArrayLike} y - y values -* @throws {TypeError} must be array-like -*/ -function set( y ) { - /* eslint-disable no-invalid-this */ - if ( !isArrayLike( y ) ) { - throw new TypeError( format( 'invalid assignment. `%s` must be array-like. Value: `%s`.', 'y', y ) ); - } - debug( 'Current value: %s.', JSON.stringify( this._yData ) ); - - this._yData = y; - debug( 'New Value: %s.', JSON.stringify( this._yData ) ); - - this.emit( 'change' ); -} - - -// EXPORTS // - -module.exports = set; diff --git a/lib/node_modules/@stdlib/plot/components/svg/symbols/lib/render/closed_circles.js b/lib/node_modules/@stdlib/plot/components/svg/symbols/lib/render/closed_circles.js deleted file mode 100644 index fcc6a30ef2cb..000000000000 --- a/lib/node_modules/@stdlib/plot/components/svg/symbols/lib/render/closed_circles.js +++ /dev/null @@ -1,102 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); -var h = require( 'virtual-dom/h.js' ); - - -// VARIABLES // - -var debug = logger( 'symbols:render:closed-circles' ); -var ELEMENT = 'circle'; - - -// MAIN // - -/** -* Renders data as a closed circles. -* -* @private -* @param {Object} state - state -* @returns {Array<VTree>} array of virtual trees -*/ -function render( state ) { - var isDefined; - var opacity; - var label; - var color; - var props; - var size; - var xPos; - var yPos; - var out; - var xi; - var yi; - var x; - var y; - var i; - - debug( 'Rendering closed circles...' ); - - isDefined = state.isDefined; - opacity = state.opacity; - label = state.label; - color = state.color; - size = state.size; - xPos = state.xPos; - yPos = state.yPos; - x = state.x; - y = state.y; - - out = []; - for ( i = 0; i < x.length; i++ ) { - xi = x[ i ]; - yi = y[ i ]; - if ( !isDefined( xi ) || !isDefined( yi ) ) { - debug( 'Datum %d is undefined. [%s,%s].', i, xi, yi ); - continue; - } - debug( 'Rendering datum %d...', i ); - props = { - 'namespace': 'http://www.w3.org/2000/svg', - 'property': 'closed-circle', - 'className': 'closed-circle', - 'attributes': { - 'cx': xPos( xi ), - 'cy': yPos( yi ), - 'r': size( xi, yi, i ) / 2, - 'stroke': 'none', - 'opacity': opacity( xi, yi, i ), - 'fill': color( xi, yi, i ), - 'data-label': label( xi, yi, i ) - } - }; - debug( 'Generating a virtual DOM tree (%s) with properties: %s.', ELEMENT, JSON.stringify( props ) ); - out.push( h( ELEMENT, props, [] ) ); - } - return out; -} - - -// EXPORTS // - -module.exports = render; diff --git a/lib/node_modules/@stdlib/plot/components/svg/symbols/lib/render/index.js b/lib/node_modules/@stdlib/plot/components/svg/symbols/lib/render/index.js deleted file mode 100644 index 63c13dc8980a..000000000000 --- a/lib/node_modules/@stdlib/plot/components/svg/symbols/lib/render/index.js +++ /dev/null @@ -1,78 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); -var h = require( 'virtual-dom/h.js' ); -var closedCircles = require( './closed_circles.js' ); -var openCircles = require( './open_circles.js' ); - - -// VARIABLES // - -var debug = logger( 'symbols:render' ); -var ELEMENT = 'g'; -var RENDER = { - 'closed-circle': closedCircles, - 'open-circle': openCircles -}; - - -// MAIN // - -/** -* Renders a virtual DOM tree. -* -* @private -* @returns {VTree} virtual DOM tree -*/ -function render() { - /* eslint-disable no-invalid-this */ - var children; - var props; - var vtree; - var f; - - debug( 'Rendering...' ); - - props = { - 'namespace': 'http://www.w3.org/2000/svg', - 'property': 'symbols', - 'className': 'symbols' - }; - debug( 'Symbol: %s.', this.symbol ); - - f = RENDER[ this.symbol ]; - children = f( this ); - - debug( 'Generating a virtual DOM tree (%s) with properties: %s.', ELEMENT, JSON.stringify( props ) ); - vtree = h( ELEMENT, props, children ); - - // Announce that a new tree has been rendered: - this.emit( '_render', vtree ); - - return vtree; -} - - -// EXPORTS // - -module.exports = render; diff --git a/lib/node_modules/@stdlib/plot/components/svg/symbols/lib/render/open_circles.js b/lib/node_modules/@stdlib/plot/components/svg/symbols/lib/render/open_circles.js deleted file mode 100644 index 57f5d5582567..000000000000 --- a/lib/node_modules/@stdlib/plot/components/svg/symbols/lib/render/open_circles.js +++ /dev/null @@ -1,103 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); -var h = require( 'virtual-dom/h.js' ); - - -// VARIABLES // - -var debug = logger( 'symbols:render:open-circles' ); -var ELEMENT = 'circle'; - - -// MAIN // - -/** -* Renders data as a open circles. -* -* @private -* @param {Object} state - state -* @returns {Array<VTree>} array of virtual trees -*/ -function render( state ) { - var isDefined; - var opacity; - var label; - var color; - var props; - var size; - var xPos; - var yPos; - var out; - var xi; - var yi; - var x; - var y; - var i; - - debug( 'Rendering open circles...' ); - - isDefined = state.isDefined; - opacity = state.opacity; - label = state.label; - color = state.color; - size = state.size; - xPos = state.xPos; - yPos = state.yPos; - x = state.x; - y = state.y; - - out = new Array( x.length ); - for ( i = 0; i < x.length; i++ ) { - xi = x[ i ]; - yi = y[ i ]; - if ( !isDefined( xi ) || !isDefined( yi ) ) { - debug( 'Datum %d is undefined. [%s,%s].', i, xi, yi ); - continue; - } - debug( 'Rendering datum %d...', i ); - props = { - 'namespace': 'http://www.w3.org/2000/svg', - 'property': 'open-circle', - 'className': 'open-circle', - 'attributes': { - 'cx': xPos( xi ), - 'cy': yPos( yi ), - 'r': size( xi, yi, i ) / 2, - 'fill': 'none', - 'opacity': opacity( xi, yi, i ), - 'stroke': color( xi, yi, i ), - 'stroke-width': 1, // TODO: make property? I certainly don't see a good reason or use case why this should be a function. - 'data-label': label( xi, yi, i ) - } - }; - debug( 'Generating a virtual DOM tree (%s) with properties: %s.', ELEMENT, JSON.stringify( props ) ); - out[ i ] = h( ELEMENT, props, [] ); - } - return out; -} - - -// EXPORTS // - -module.exports = render; diff --git a/lib/node_modules/@stdlib/plot/components/svg/symbols/package.json b/lib/node_modules/@stdlib/plot/components/svg/symbols/package.json deleted file mode 100644 index 587e0554e1da..000000000000 --- a/lib/node_modules/@stdlib/plot/components/svg/symbols/package.json +++ /dev/null @@ -1,63 +0,0 @@ -{ - "name": "@stdlib/plot/components/svg/symbols", - "version": "0.0.0", - "description": "SVG symbols.", - "license": "Apache-2.0", - "author": { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - }, - "contributors": [ - { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - } - ], - "main": "./lib", - "directories": { - "example": "./examples", - "lib": "./lib" - }, - "scripts": {}, - "homepage": "https://github.com/stdlib-js/stdlib", - "repository": { - "type": "git", - "url": "git://github.com/stdlib-js/stdlib.git" - }, - "bugs": { - "url": "https://github.com/stdlib-js/stdlib/issues" - }, - "dependencies": {}, - "devDependencies": {}, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], - "keywords": [ - "stdlib", - "plot", - "graph", - "chart", - "engine", - "svg", - "scalable", - "vector", - "graphics", - "symbols", - "circles", - "scatter", - "series", - "component" - ] -} diff --git a/lib/node_modules/@stdlib/plot/components/svg/title/examples/index.js b/lib/node_modules/@stdlib/plot/components/svg/title/examples/index.js deleted file mode 100644 index 7f6c4b82d266..000000000000 --- a/lib/node_modules/@stdlib/plot/components/svg/title/examples/index.js +++ /dev/null @@ -1,49 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -var toHTML = require( 'vdom-to-html' ); -var title = require( './../lib' ); - -// Create a new title: -var node = title({ - 'text': 'Beep', - 'autoRender': true -}); - -// Render as a virtual DOM tree: -var vtree = node.render(); -console.log( JSON.stringify( vtree ) ); - -// Transform the virtual DOM tree to HTML: -var html = toHTML( vtree ); -console.log( html ); - -// Listen for 'render' events (e.g., when triggered due to changes in state): -node.on( 'render', onRender ); - -setTimeout( update, 1000 ); - -function update() { - node.text = 'Boop'; -} - -function onRender( vtree ) { - console.log( toHTML( vtree ) ); -} diff --git a/lib/node_modules/@stdlib/plot/components/svg/title/lib/defaults.json b/lib/node_modules/@stdlib/plot/components/svg/title/lib/defaults.json deleted file mode 100644 index c835193348ce..000000000000 --- a/lib/node_modules/@stdlib/plot/components/svg/title/lib/defaults.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "text": "", - "autoRender": false -} diff --git a/lib/node_modules/@stdlib/plot/components/svg/title/lib/events/events.json b/lib/node_modules/@stdlib/plot/components/svg/title/lib/events/events.json deleted file mode 100644 index 31e673d21b55..000000000000 --- a/lib/node_modules/@stdlib/plot/components/svg/title/lib/events/events.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "text": "change", - "autoRender": "change" -} diff --git a/lib/node_modules/@stdlib/plot/components/svg/title/lib/events/index.js b/lib/node_modules/@stdlib/plot/components/svg/title/lib/events/index.js deleted file mode 100644 index ef68b2b8fdb7..000000000000 --- a/lib/node_modules/@stdlib/plot/components/svg/title/lib/events/index.js +++ /dev/null @@ -1,42 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var EVENTS = require( './events.json' ); - - -// MAIN // - -/** -* Provided a property, returns a corresponding event name for when a property value changes. -* -* @private -* @param {string} prop - property -* @returns {string} event name -*/ -function get( prop ) { - return EVENTS[ prop ]; -} - - -// EXPORTS // - -module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/components/svg/title/lib/index.js b/lib/node_modules/@stdlib/plot/components/svg/title/lib/index.js deleted file mode 100644 index 7c83f0a29c40..000000000000 --- a/lib/node_modules/@stdlib/plot/components/svg/title/lib/index.js +++ /dev/null @@ -1,41 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -/** -* Title. -* -* @module @stdlib/plot/components/svg/title -* -* @example -* var Title = require( '@stdlib/plot/components/svg/title' ); -* -* var title = new Title({ -* 'text': 'Beep' -* }); -*/ - -// MODULES // - -var main = require( './main.js' ); - - -// EXPORTS // - -module.exports = main; diff --git a/lib/node_modules/@stdlib/plot/components/svg/title/lib/main.js b/lib/node_modules/@stdlib/plot/components/svg/title/lib/main.js deleted file mode 100644 index e45678b01df7..000000000000 --- a/lib/node_modules/@stdlib/plot/components/svg/title/lib/main.js +++ /dev/null @@ -1,198 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var EventEmitter = require( 'events' ).EventEmitter; -var logger = require( 'debug' ); -var defineProperty = require( '@stdlib/utils/define-property' ); -var setReadOnly = require( '@stdlib/utils/define-read-only-property' ); -var copy = require( '@stdlib/utils/copy' ); -var defaults = require( './defaults.json' ); -var validate = require( './validate.js' ); -var setText = require( './props/text/set.js' ); -var getText = require( './props/text/get.js' ); -var setAutoRender = require( './props/auto-render/set.js' ); -var getAutoRender = require( './props/auto-render/get.js' ); -var render = require( './methods/render.js' ); - - -// VARIABLES // - -var debug = logger( 'title:main' ); - - -// MAIN // - -/** -* Title constructor. -* -* @constructor -* @param {Options} options - constructor options -* @param {string} [options.text] - title text -* @param {boolean} [options.autoRender=false] - indicates whether to re-render on a change event -* @throws {TypeError} must provide valid options -* @returns {Title} title instance -* -* @example -* var title = new Title({ -* 'text':'Beep' -* }); -*/ -function Title( options ) { - var self; - var opts; - var err; - if ( !( this instanceof Title ) ) { - return new Title( options ); - } - self = this; - opts = copy( defaults ); - err = validate( opts, options ); - if ( err ) { - throw err; - } - debug( 'Creating an instance with the following configuration: %s.', JSON.stringify( opts ) ); - EventEmitter.call( this ); - - defineProperty( this, '_text', { - 'configurable': false, - 'enumerable': false, - 'writable': true, - 'value': opts.text - }); - defineProperty( this, '_autoRender', { - 'configurable': false, - 'enumerable': false, - 'writable': true, - 'value': opts.autoRender - }); - - this.on( 'change', onChange ); - this.on( '_render', onRender ); - - return this; - - /** - * Callback invoked upon receiving a change event. - * - * @private - */ - function onChange() { - debug( 'Received a change event.' ); - if ( self._autoRender ) { // eslint-disable-line no-underscore-dangle - self.render(); - } - } - - /** - * Re-emits a render event. - * - * @private - */ - function onRender() { - var args; - var i; - debug( 'Received a render event. Re-emitting...' ); - args = new Array( arguments.length+1 ); - args[ 0 ] = 'render'; - for ( i = 0; i < arguments.length; i++ ) { - args[ i+1 ] = arguments[ i ]; - } - self.emit.apply( self, args ); - } -} - -/* -* Create a prototype which inherits from the parent prototype. -*/ -Title.prototype = Object.create( EventEmitter.prototype ); - -/* -* Set the constructor. -*/ -Title.prototype.constructor = Title; - -/** -* Title text. -* -* @name text -* @memberof Title.prototype -* @type {string} -* @throws {TypeError} must be a string -* -* @example -* var title = new Title({ -* 'text': 'Beep' -* }); -* -* var text = title.text; -* // returns 'Beep' -*/ -defineProperty( Title.prototype, 'text', { - 'configurable': false, - 'enumerable': true, - 'set': setText, - 'get': getText -}); - -/** -* Rendering mode. If `true`, an instance re-renders on each change event. -* -* @name autoRender -* @memberof Title.prototype -* @type {boolean} -* @throws {TypeError} must be a boolean -* @default false -* -* @example -* var title = new Title({ -* 'autoRender': true -* }); -* -* var mode = title.autoRender; -* // returns true -*/ -defineProperty( Title.prototype, 'autoRender', { - 'configurable': false, - 'enumerable': true, - 'set': setAutoRender, - 'get': getAutoRender -}); - -/** -* Renders a virtual DOM tree. -* -* @name render -* @memberof Title.prototype -* @type {Function} -* @returns {VTree} virtual tree -* -* @example -* var title = new Title(); -* -* var out = title.render(); -*/ -setReadOnly( Title.prototype, 'render', render ); - - -// EXPORTS // - -module.exports = Title; diff --git a/lib/node_modules/@stdlib/plot/components/svg/title/lib/methods/render.js b/lib/node_modules/@stdlib/plot/components/svg/title/lib/methods/render.js deleted file mode 100644 index bd7418cd7f97..000000000000 --- a/lib/node_modules/@stdlib/plot/components/svg/title/lib/methods/render.js +++ /dev/null @@ -1,75 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); -var h = require( 'virtual-dom/h.js' ); - - -// VARIABLES // - -var debug = logger( 'title:render' ); -var ELEMENT = 'text'; - - -// MAIN // - -/** -* Renders a virtual DOM tree. -* -* @private -* @returns {VTree} virtual DOM tree -*/ -function render() { - /* eslint-disable no-invalid-this */ - var props; - var vtree; - var text; - - debug( 'Rendering...' ); - - props = { - 'namespace': 'http://www.w3.org/2000/svg', - 'property': 'title', - 'className': 'title noselect', - 'attributes': { - 'x': 0, - 'y': 0, - 'text-anchor': 'middle' - } - }; - - text = this.text; - debug( 'Title: %s.', text ); - - debug( 'Generating a virtual DOM tree (%s) with properties: %s.', ELEMENT, JSON.stringify( props ) ); - vtree = h( ELEMENT, props, text ); - - // Announce that a new tree has been rendered: - this.emit( '_render', vtree ); - - return vtree; -} - - -// EXPORTS // - -module.exports = render; diff --git a/lib/node_modules/@stdlib/plot/components/svg/title/lib/props/auto-render/get.js b/lib/node_modules/@stdlib/plot/components/svg/title/lib/props/auto-render/get.js deleted file mode 100644 index 7df40dec3f47..000000000000 --- a/lib/node_modules/@stdlib/plot/components/svg/title/lib/props/auto-render/get.js +++ /dev/null @@ -1,35 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -/** -* Returns the rendering mode. -* -* @private -* @returns {boolean} rendering mode -*/ -function get() { - /* eslint-disable no-invalid-this */ - return this._autoRender; -} - - -// EXPORTS // - -module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/components/svg/title/lib/props/auto-render/set.js b/lib/node_modules/@stdlib/plot/components/svg/title/lib/props/auto-render/set.js deleted file mode 100644 index 13d40d733f36..000000000000 --- a/lib/node_modules/@stdlib/plot/components/svg/title/lib/props/auto-render/set.js +++ /dev/null @@ -1,60 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); -var events = require( './../../events' ); -var isValid = require( './../../validators/auto_render.js' ); - - -// VARIABLES // - -var debug = logger( 'title:set:auto-render' ); -var CHANGE_EVENT = events( 'autoRender' ); - - -// MAIN // - -/** -* Sets the rendering mode. -* -* @private -* @param {boolean} bool - boolean indicating whether to re-render on a change event -* @throws {TypeError} must be a positive number -*/ -function set( bool ) { - /* eslint-disable no-invalid-this */ - var err = isValid( bool ); - if ( err ) { - throw err; - } - debug( 'Current value: %d.', this._autoRender ); - - this._autoRender = bool; - debug( 'New Value: %d.', this._autoRender ); - - this.emit( CHANGE_EVENT ); -} - - -// EXPORTS // - -module.exports = set; diff --git a/lib/node_modules/@stdlib/plot/components/svg/title/lib/props/text/get.js b/lib/node_modules/@stdlib/plot/components/svg/title/lib/props/text/get.js deleted file mode 100644 index b206c3c53476..000000000000 --- a/lib/node_modules/@stdlib/plot/components/svg/title/lib/props/text/get.js +++ /dev/null @@ -1,35 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -/** -* Returns the title text. -* -* @private -* @returns {string} text -*/ -function get() { - /* eslint-disable no-invalid-this */ - return this._text; -} - - -// EXPORTS // - -module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/components/svg/title/lib/props/text/set.js b/lib/node_modules/@stdlib/plot/components/svg/title/lib/props/text/set.js deleted file mode 100644 index cdc1e4015657..000000000000 --- a/lib/node_modules/@stdlib/plot/components/svg/title/lib/props/text/set.js +++ /dev/null @@ -1,60 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); -var events = require( './../../events' ); -var isValid = require( './../../validators/text.js' ); - - -// VARIABLES // - -var debug = logger( 'title:set:text' ); -var CHANGE_EVENT = events( 'text' ); - - -// MAIN // - -/** -* Sets the title text. -* -* @private -* @param {string} text - text -* @throws {TypeError} must be a string -*/ -function set( text ) { - /* eslint-disable no-invalid-this */ - var err = isValid( text ); - if ( err ) { - throw err; - } - debug( 'Current value: %d.', this._text ); - - this._text = text; - debug( 'New Value: %d.', this._text ); - - this.emit( CHANGE_EVENT ); -} - - -// EXPORTS // - -module.exports = set; diff --git a/lib/node_modules/@stdlib/plot/components/svg/title/lib/validate.js b/lib/node_modules/@stdlib/plot/components/svg/title/lib/validate.js deleted file mode 100644 index fbf33ae1ce80..000000000000 --- a/lib/node_modules/@stdlib/plot/components/svg/title/lib/validate.js +++ /dev/null @@ -1,82 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var objectKeys = require( '@stdlib/utils/keys' ); -var isObject = require( '@stdlib/assert/is-plain-object' ); -var hasOwnProp = require( '@stdlib/assert/has-own-property' ); -var format = require( '@stdlib/string/format' ); -var validators = require( './validators' ); - - -// VARIABLES // - -var KEYS = objectKeys( validators ); - - -// MAIN // - -/** -* Validates function options. -* -* @private -* @param {Object} opts - destination object -* @param {Options} options - function options -* @param {string} [options.text] - title text -* @param {boolean} [options.autoRender] - indicates whether to re-render on a change event -* @returns {(Error|null)} error or null -* -* @example -* var opts = {}; -* var options = { -* 'text': 'Beep' -* }; -* var err = validate( opts, options ); -* if ( err ) { -* throw err; -* } -*/ -function validate( opts, options ) { - var err; - var key; - var val; - var i; - if ( !isObject( options ) ) { - return new TypeError( format( 'invalid argument. Options argument must be an object. Value: `%s`.', options ) ); - } - for ( i = 0; i < KEYS.length; i++ ) { - key = KEYS[ i ]; - if ( hasOwnProp( options, key ) ) { - val = options[ key ]; - err = validators[ key ]( val ); - if ( err ) { - return err; - } - opts[ key ] = val; - } - } - return null; -} - - -// EXPORTS // - -module.exports = validate; diff --git a/lib/node_modules/@stdlib/plot/components/svg/title/lib/validators/auto_render.js b/lib/node_modules/@stdlib/plot/components/svg/title/lib/validators/auto_render.js deleted file mode 100644 index 08da79ff51a6..000000000000 --- a/lib/node_modules/@stdlib/plot/components/svg/title/lib/validators/auto_render.js +++ /dev/null @@ -1,46 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var isBoolean = require( '@stdlib/assert/is-boolean' ).isPrimitive; -var format = require( '@stdlib/string/format' ); - - -// MAIN // - -/** -* Validates `autoRender`. -* -* @private -* @param {*} v - value to test -* @returns {(Error|null)} error object or null -*/ -function test( v ) { - if ( !isBoolean( v ) ) { - return new TypeError( format( 'invalid assignment. `%s` must be a boolean. Value: `%s`.', 'autoRender', v ) ); - } - return null; -} - - -// EXPORTS // - -module.exports = test; diff --git a/lib/node_modules/@stdlib/plot/components/svg/title/lib/validators/index.js b/lib/node_modules/@stdlib/plot/components/svg/title/lib/validators/index.js deleted file mode 100644 index 40a493e740de..000000000000 --- a/lib/node_modules/@stdlib/plot/components/svg/title/lib/validators/index.js +++ /dev/null @@ -1,37 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var text = require( './text.js' ); -var autoRender = require( './auto_render.js' ); - - -// MAIN // - -var validators = { - 'text': text, - 'autoRender': autoRender -}; - - -// EXPORTS // - -module.exports = validators; diff --git a/lib/node_modules/@stdlib/plot/components/svg/title/lib/validators/text.js b/lib/node_modules/@stdlib/plot/components/svg/title/lib/validators/text.js deleted file mode 100644 index 1a15f410f7cb..000000000000 --- a/lib/node_modules/@stdlib/plot/components/svg/title/lib/validators/text.js +++ /dev/null @@ -1,46 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var isString = require( '@stdlib/assert/is-string' ).isPrimitive; -var format = require( '@stdlib/string/format' ); - - -// MAIN // - -/** -* Validates `text`. -* -* @private -* @param {*} v - value to test -* @returns {(Error|null)} error object or null -*/ -function test( v ) { - if ( !isString( v ) ) { - return new TypeError( format( 'invalid assignment. `%s` must be a string. Value: `%s`.', 'text', v ) ); - } - return null; -} - - -// EXPORTS // - -module.exports = test; diff --git a/lib/node_modules/@stdlib/plot/components/svg/title/package.json b/lib/node_modules/@stdlib/plot/components/svg/title/package.json deleted file mode 100644 index 942b88277665..000000000000 --- a/lib/node_modules/@stdlib/plot/components/svg/title/package.json +++ /dev/null @@ -1,60 +0,0 @@ -{ - "name": "@stdlib/plot/components/svg/title", - "version": "0.0.0", - "description": "SVG title.", - "license": "Apache-2.0", - "author": { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - }, - "contributors": [ - { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - } - ], - "main": "./lib", - "directories": { - "example": "./examples", - "lib": "./lib" - }, - "scripts": {}, - "homepage": "https://github.com/stdlib-js/stdlib", - "repository": { - "type": "git", - "url": "git://github.com/stdlib-js/stdlib.git" - }, - "bugs": { - "url": "https://github.com/stdlib-js/stdlib/issues" - }, - "dependencies": {}, - "devDependencies": {}, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], - "keywords": [ - "stdlib", - "plot", - "graph", - "chart", - "engine", - "svg", - "scalable", - "vector", - "graphics", - "title", - "component" - ] -} diff --git a/lib/node_modules/@stdlib/plot/vega/autosize/ctor/examples/index.js b/lib/node_modules/@stdlib/plot/vega/autosize/ctor/examples/index.js new file mode 100644 index 000000000000..3eac54f1d6f8 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/autosize/ctor/examples/index.js @@ -0,0 +1,24 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +var Autosize = require( './../lib' ); + +var autosize = new Autosize(); +console.log( autosize.toJSON() ); diff --git a/lib/node_modules/@stdlib/plot/vega/autosize/ctor/lib/change_event.js b/lib/node_modules/@stdlib/plot/vega/autosize/ctor/lib/change_event.js new file mode 100644 index 000000000000..cec6ecaee47e --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/autosize/ctor/lib/change_event.js @@ -0,0 +1,41 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MAIN // + +/** +* Returns a new change event object. +* +* @private +* @param {string} property - property name +* @returns {Object} event object +*/ +function event( property ) { // eslint-disable-line stdlib/no-redeclare + return { + 'type': 'update', + 'source': 'autosize', + 'property': property + }; +} + + +// EXPORTS // + +module.exports = event; diff --git a/lib/node_modules/@stdlib/plot/vega/autosize/ctor/lib/contains/get.js b/lib/node_modules/@stdlib/plot/vega/autosize/ctor/lib/contains/get.js new file mode 100644 index 000000000000..cb1d26bf7a90 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/autosize/ctor/lib/contains/get.js @@ -0,0 +1,43 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable no-invalid-this */ + +'use strict'; + +// MODULES // + +var prop = require( './properties.js' ); + + +// MAIN // + +/** +* Returns the method for determining how a size calculation should be performed. +* +* @private +* @returns {string} method +*/ +function get() { + return this[ prop.private ]; +} + + +// EXPORTS // + +module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/vega/autosize/ctor/lib/contains/methods.json b/lib/node_modules/@stdlib/plot/vega/autosize/ctor/lib/contains/methods.json new file mode 100644 index 000000000000..9e48e819015d --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/autosize/ctor/lib/contains/methods.json @@ -0,0 +1,4 @@ +[ + "content", + "padding" +] diff --git a/lib/node_modules/@stdlib/plot/vega/autosize/ctor/lib/contains/properties.js b/lib/node_modules/@stdlib/plot/vega/autosize/ctor/lib/contains/properties.js new file mode 100644 index 000000000000..a003bd7f98ce --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/autosize/ctor/lib/contains/properties.js @@ -0,0 +1,33 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var property2object = require( '@stdlib/plot/vega/base/property2object' ); + + +// MAIN // + +var obj = property2object( 'contains' ); + + +// EXPORTS // + +module.exports = obj; diff --git a/lib/node_modules/@stdlib/plot/vega/autosize/ctor/lib/contains/set.js b/lib/node_modules/@stdlib/plot/vega/autosize/ctor/lib/contains/set.js new file mode 100644 index 000000000000..889e978cba02 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/autosize/ctor/lib/contains/set.js @@ -0,0 +1,64 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable no-invalid-this */ + +'use strict'; + +// MODULES // + +var logger = require( 'debug' ); +var contains = require( '@stdlib/array/base/assert/contains' ).factory; +var join = require( '@stdlib/array/base/join' ); +var format = require( '@stdlib/string/format' ); +var changeEvent = require( './../change_event.js' ); +var METHODS = require( './methods.json' ); +var prop = require( './properties.js' ); + + +// VARIABLES // + +var debug = logger( 'vega:autosize:set:'+prop.name ); +var isMethod = contains( METHODS ); + + +// MAIN // + +/** +* Sets the method for determining how a size calculation should be performed. +* +* @private +* @param {string} value - input value +* @throws {TypeError} must be a valid method +* @returns {void} +*/ +function set( value ) { + if ( !isMethod( value ) ) { + throw new TypeError( format( 'invalid assignment. `%s` must be one of the following: "%s". Value: `%s`.', prop.name, join( METHODS, '", "' ), value ) ); + } + if ( value !== this[ prop.private ] ) { + debug( 'Current value: %s. New value: %s.', this[ prop.private ], value ); + this[ prop.private ] = value; + this.emit( 'change', changeEvent( prop.name ) ); + } +} + + +// EXPORTS // + +module.exports = set; diff --git a/lib/node_modules/@stdlib/plot/vega/autosize/ctor/lib/defaults.js b/lib/node_modules/@stdlib/plot/vega/autosize/ctor/lib/defaults.js new file mode 100644 index 000000000000..355468a88e80 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/autosize/ctor/lib/defaults.js @@ -0,0 +1,49 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MAIN // + +/** +* Returns defaults. +* +* @private +* @returns {Object} default options +* +* @example +* var o = defaults(); +* // returns {...} +*/ +function defaults() { + return { + // Method for determining how a size calculation should be performed: + 'contains': 'content', + + // Boolean indicating whether to re-calculate an autosize layout on every view update: + 'resize': false, + + // Autosize type: + 'type': 'pad' + }; +} + + +// EXPORTS // + +module.exports = defaults; diff --git a/lib/node_modules/@stdlib/plot/vega/autosize/ctor/lib/index.js b/lib/node_modules/@stdlib/plot/vega/autosize/ctor/lib/index.js new file mode 100644 index 000000000000..373093a4f2b5 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/autosize/ctor/lib/index.js @@ -0,0 +1,40 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +/** +* Autosize constructor. +* +* @module @stdlib/plot/vega/autosize/ctor +* +* @example +* var Autosize = require( '@stdlib/plot/vega/autosize/ctor' ); +* +* var autosize = new Autosize(); +* // returns <Autosize> +*/ + +// MODULES // + +var main = require( './main.js' ); + + +// EXPORTS // + +module.exports = main; diff --git a/lib/node_modules/@stdlib/plot/vega/autosize/ctor/lib/main.js b/lib/node_modules/@stdlib/plot/vega/autosize/ctor/lib/main.js new file mode 100644 index 000000000000..738544244288 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/autosize/ctor/lib/main.js @@ -0,0 +1,236 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable no-restricted-syntax, no-invalid-this */ + +'use strict'; + +// MODULES // + +var EventEmitter = require( 'events' ).EventEmitter; +var logger = require( 'debug' ); +var isObject = require( '@stdlib/assert/is-object' ); +var setNonEnumerableReadOnly = require( '@stdlib/utils/define-nonenumerable-read-only-property' ); +var setNonEnumerableReadOnlyAccessor = require( '@stdlib/utils/define-nonenumerable-read-only-accessor' ); // eslint-disable-line id-length +var setReadWriteAccessor = require( '@stdlib/utils/define-read-write-accessor' ); +var hasProp = require( '@stdlib/assert/has-property' ); +var inherit = require( '@stdlib/utils/inherit' ); +var objectKeys = require( '@stdlib/utils/keys' ); +var instance2json = require( '@stdlib/plot/vega/base/to-json' ); +var transformErrorMessage = require( '@stdlib/plot/vega/base/transform-validation-message' ); +var format = require( '@stdlib/string/format' ); +var properties = require( './properties.json' ); +var defaults = require( './defaults.js' ); + +// Note: keep the following in alphabetical order according to the `require` path... +var getContains = require( './contains/get.js' ); +var setContains = require( './contains/set.js' ); + +var getProperties = require( './properties/get.js' ); + +var getResize = require( './resize/get.js' ); +var setResize = require( './resize/set.js' ); + +var getType = require( './type/get.js' ); +var setType = require( './type/set.js' ); + + +// VARIABLES // + +var debug = logger( 'vega:autosize:main' ); + + +// MAIN // + +/** +* Autosize constructor. +* +* @constructor +* @param {Options} [options] - constructor options +* @param {string} [options.contains='content'] - method for determining how a size calculation should be performed +* @param {boolean} [options.resize=false] - boolean indicating whether to re-calculate an autosize layout on every view update +* @param {string} [options.type='pad'] - autosize method +* @throws {TypeError} options argument must be an object +* @throws {Error} must provide valid options +* @returns {Autosize} autosize instance +* +* @example +* var autosize = new Autosize(); +* // returns <Autosize> +*/ +function Autosize( options ) { + var nargs; + var opts; + var keys; + var v; + var k; + var i; + + nargs = arguments.length; + if ( !( this instanceof Autosize ) ) { + if ( nargs ) { + return new Autosize( options ); + } + return new Autosize(); + } + EventEmitter.call( this ); + + // Resolve the default configuration: + opts = defaults(); + + // Set internal properties according to the default configuration... + keys = objectKeys( opts ); + for ( i = 0; i < keys.length; i++ ) { + k = keys[ i ]; + this[ '_'+k ] = opts[ k ]; + } + if ( nargs ) { + if ( !isObject( options ) ) { + throw new TypeError( format( 'invalid argument. Options argument must be an object. Value: `%s`.', options ) ); + } + // Validate provided options by attempting to assign option values to corresponding fields... + for ( i = 0; i < properties.length; i++ ) { + k = properties[ i ]; + if ( !hasProp( options, k ) ) { + continue; + } + v = options[ k ]; + try { + this[ k ] = v; + } catch ( err ) { + debug( 'Encountered an error. Error: %s', err.message ); + + // FIXME: retain thrown error type + throw new Error( transformErrorMessage( err.message ) ); + } + } + } + return this; +} + +/* +* Inherit from the `EventEmitter` prototype. +*/ +inherit( Autosize, EventEmitter ); + +/** +* Constructor name. +* +* @private +* @name name +* @memberof Autosize +* @readonly +* @type {string} +*/ +setNonEnumerableReadOnly( Autosize, 'name', 'Autosize' ); + +/** +* Method for determining how a size calculation should be performed. +* +* @name contains +* @memberof Autosize.prototype +* @type {string} +* @default 'content' +* +* @example +* var autosize = new Autosize({ +* 'contains': 'padding' +* }); +* +* var v = autosize.contains; +* // returns 'padding' +*/ +setReadWriteAccessor( Autosize.prototype, 'contains', getContains, setContains ); + +/** +* Autosize properties. +* +* @name properties +* @memberof Autosize.prototype +* @type {Array<string>} +* +* @example +* var autosize = new Autosize(); +* +* var v = autosize.properties; +* // returns [...] +*/ +setNonEnumerableReadOnlyAccessor( Autosize.prototype, 'properties', getProperties ); + +/** +* Boolean indicating whether to re-calculate an autosize layout on every view update. +* +* @name resize +* @memberof Autosize.prototype +* @type {boolean} +* @default false +* +* @example +* var autosize = new Autosize({ +* 'resize': true +* }); +* +* var v = autosize.resize; +* // returns true +*/ +setReadWriteAccessor( Autosize.prototype, 'resize', getResize, setResize ); + +/** +* Autosize type. +* +* @name type +* @memberof Autosize.prototype +* @type {string} +* @default 'pad' +* +* @example +* var autosize = new Autosize({ +* 'type': 'none' +* }); +* +* var v = autosize.type; +* // returns 'none' +*/ +setReadWriteAccessor( Autosize.prototype, 'type', getType, setType ); + +/** +* Serializes an instance to a JSON object. +* +* ## Notes +* +* - This method is implicitly invoked by `JSON.stringify`. +* +* @name toJSON +* @memberof Autosize.prototype +* @type {Function} +* @returns {Object} JSON object +* +* @example +* var autosize = new Autosize(); +* +* var v = autosize.toJSON(); +* // returns {...} +*/ +setNonEnumerableReadOnly( Autosize.prototype, 'toJSON', function toJSON() { + return instance2json( this, properties ); +}); + + +// EXPORTS // + +module.exports = Autosize; diff --git a/lib/node_modules/@stdlib/plot/vega/autosize/ctor/lib/properties.json b/lib/node_modules/@stdlib/plot/vega/autosize/ctor/lib/properties.json new file mode 100644 index 000000000000..846cb1dca855 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/autosize/ctor/lib/properties.json @@ -0,0 +1,5 @@ +[ + "contains", + "resize", + "type" +] diff --git a/lib/node_modules/@stdlib/plot/vega/autosize/ctor/lib/properties/get.js b/lib/node_modules/@stdlib/plot/vega/autosize/ctor/lib/properties/get.js new file mode 100644 index 000000000000..8fc57de14e90 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/autosize/ctor/lib/properties/get.js @@ -0,0 +1,41 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var properties = require( './../properties.json' ); + + +// MAIN // + +/** +* Returns the list of enumerable properties. +* +* @private +* @returns {Array<string>} properties +*/ +function get() { + return properties.slice(); +} + + +// EXPORTS // + +module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/vega/autosize/ctor/lib/resize/get.js b/lib/node_modules/@stdlib/plot/vega/autosize/ctor/lib/resize/get.js new file mode 100644 index 000000000000..93ced0f9c5d2 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/autosize/ctor/lib/resize/get.js @@ -0,0 +1,43 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable no-invalid-this */ + +'use strict'; + +// MODULES // + +var prop = require( './properties.js' ); + + +// MAIN // + +/** +* Returns a boolean indicating whether a layout should be re-calculated on every view update. +* +* @private +* @returns {boolean} boolean flag +*/ +function get() { + return this[ prop.private ]; +} + + +// EXPORTS // + +module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/vega/autosize/ctor/lib/resize/properties.js b/lib/node_modules/@stdlib/plot/vega/autosize/ctor/lib/resize/properties.js new file mode 100644 index 000000000000..7d37293d24ba --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/autosize/ctor/lib/resize/properties.js @@ -0,0 +1,33 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var property2object = require( '@stdlib/plot/vega/base/property2object' ); + + +// MAIN // + +var obj = property2object( 'resize' ); + + +// EXPORTS // + +module.exports = obj; diff --git a/lib/node_modules/@stdlib/plot/vega/autosize/ctor/lib/resize/set.js b/lib/node_modules/@stdlib/plot/vega/autosize/ctor/lib/resize/set.js new file mode 100644 index 000000000000..609a7a4ef50b --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/autosize/ctor/lib/resize/set.js @@ -0,0 +1,61 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable no-invalid-this */ + +'use strict'; + +// MODULES // + +var logger = require( 'debug' ); +var isBoolean = require( '@stdlib/assert/is-boolean' ).isPrimitive; +var format = require( '@stdlib/string/format' ); +var changeEvent = require( './../change_event.js' ); +var prop = require( './properties.js' ); + + +// VARIABLES // + +var debug = logger( 'vega:autosize:set:'+prop.name ); + + +// MAIN // + +/** +* Sets a boolean flag indicating whether a layout should be re-calculated on every view update. +* +* @private +* @param {boolean} value - input value +* @throws {TypeError} must be a boolean +* @returns {void} +*/ +function set( value ) { + if ( !isBoolean( value ) ) { + throw new TypeError( format( 'invalid assignment. `%s` must be a boolean. Value: `%s`.', prop.name, value ) ); + } + if ( value !== this[ prop.private ] ) { + debug( 'Current value: %s. New value: %s.', this[ prop.private ], value ); + this[ prop.private ] = value; + this.emit( 'change', changeEvent( prop.name ) ); + } +} + + +// EXPORTS // + +module.exports = set; diff --git a/lib/node_modules/@stdlib/plot/vega/autosize/ctor/lib/type/get.js b/lib/node_modules/@stdlib/plot/vega/autosize/ctor/lib/type/get.js new file mode 100644 index 000000000000..0dad1909219d --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/autosize/ctor/lib/type/get.js @@ -0,0 +1,43 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable no-invalid-this */ + +'use strict'; + +// VARIABLES // + +var prop = require( './properties.js' ); + + +// MAIN // + +/** +* Returns the autosize method. +* +* @private +* @returns {string} type +*/ +function get() { + return this[ prop.private ]; +} + + +// EXPORTS // + +module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/vega/autosize/ctor/lib/type/properties.js b/lib/node_modules/@stdlib/plot/vega/autosize/ctor/lib/type/properties.js new file mode 100644 index 000000000000..d4cf0dee043b --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/autosize/ctor/lib/type/properties.js @@ -0,0 +1,33 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var property2object = require( '@stdlib/plot/vega/base/property2object' ); + + +// MAIN // + +var obj = property2object( 'type' ); + + +// EXPORTS // + +module.exports = obj; diff --git a/lib/node_modules/@stdlib/plot/vega/autosize/ctor/lib/type/set.js b/lib/node_modules/@stdlib/plot/vega/autosize/ctor/lib/type/set.js new file mode 100644 index 000000000000..788cf577cd4b --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/autosize/ctor/lib/type/set.js @@ -0,0 +1,63 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable no-invalid-this */ + +'use strict'; + +// MODULES // + +var logger = require( 'debug' ); +var isAutosizeMethod = require( '@stdlib/plot/vega/base/assert/is-autosize-method' ); +var join = require( '@stdlib/array/base/join' ); +var autosizeMethods = require( '@stdlib/plot/vega/autosize/methods' ); +var format = require( '@stdlib/string/format' ); +var changeEvent = require( './../change_event.js' ); +var prop = require( './properties.js' ); + + +// VARIABLES // + +var debug = logger( 'vega:autosize:set:'+prop.name ); + + +// MAIN // + +/** +* Sets the autosize method. +* +* @private +* @param {string} value - input value +* @throws {TypeError} must be a valid type +* @returns {void} +*/ +function set( value ) { + if ( !isAutosizeMethod( value ) ) { + throw new TypeError( format( 'invalid assignment. `%s` must be one of the following: "%s". Value: `%s`.', prop.name, join( autosizeMethods(), '", "' ), value ) ); + } + if ( value !== this[ prop.private ] ) { + debug( 'Current value: %s. New value: %s.', this[ prop.private ], value ); + this[ prop.private ] = value; + this.emit( 'change', changeEvent( prop.name ) ); + } +} + + +// EXPORTS // + +module.exports = set; diff --git a/lib/node_modules/@stdlib/plot/vega/autosize/ctor/package.json b/lib/node_modules/@stdlib/plot/vega/autosize/ctor/package.json new file mode 100644 index 000000000000..a304ff2f9ac2 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/autosize/ctor/package.json @@ -0,0 +1,61 @@ +{ + "name": "@stdlib/plot/vega/autosize/ctor", + "version": "0.0.0", + "description": "Autosize constructor.", + "license": "Apache-2.0", + "author": { + "name": "The Stdlib Authors", + "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" + }, + "contributors": [ + { + "name": "The Stdlib Authors", + "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" + } + ], + "main": "./lib", + "directories": { + "benchmark": "./benchmark", + "doc": "./docs", + "example": "./examples", + "lib": "./lib", + "test": "./test" + }, + "types": "./docs/types", + "scripts": {}, + "homepage": "https://github.com/stdlib-js/stdlib", + "repository": { + "type": "git", + "url": "git://github.com/stdlib-js/stdlib.git" + }, + "bugs": { + "url": "https://github.com/stdlib-js/stdlib/issues" + }, + "dependencies": {}, + "devDependencies": {}, + "engines": { + "node": ">=0.10.0", + "npm": ">2.7.0" + }, + "os": [ + "aix", + "darwin", + "freebsd", + "linux", + "macos", + "openbsd", + "sunos", + "win32", + "windows" + ], + "keywords": [ + "stdlib", + "plot", + "vega", + "autosize", + "resize", + "constructor", + "ctor" + ], + "__stdlib__": {} +} diff --git a/lib/node_modules/@stdlib/plot/vega/autosize/methods/README.md b/lib/node_modules/@stdlib/plot/vega/autosize/methods/README.md new file mode 100644 index 000000000000..0b1f4bd82ca4 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/autosize/methods/README.md @@ -0,0 +1,117 @@ +<!-- + +@license Apache-2.0 + +Copyright (c) 2025 The Stdlib Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + +--> + +# autosizeMethods + +> List of supported Vega autosize methods. + +<!-- Section to include introductory text. Make sure to keep an empty line after the intro `section` element and another before the `/section` close. --> + +<section class="intro"> + +</section> + +<!-- /.intro --> + +<!-- Package usage documentation. --> + +<section class="usage"> + +## Usage + +```javascript +var autosizeMethods = require( '@stdlib/plot/vega/autosize/methods' ); +``` + +#### autosizeMethods() + +Returns a list of autosize methods. + +```javascript +var out = autosizeMethods(); +// returns [ 'pad', 'fit', 'fit-x', 'fit-y', 'none' ] +``` + +</section> + +<!-- /.usage --> + +<!-- Package usage notes. Make sure to keep an empty line after the `section` element and another before the `/section` close. --> + +<section class="notes"> + +</section> + +<!-- /.notes --> + +<!-- Package usage examples. --> + +<section class="examples"> + +## Examples + +<!-- eslint no-undef: "error" --> + +```javascript +var contains = require( '@stdlib/array/base/assert/contains' ).factory; +var autosizeMethods = require( '@stdlib/plot/vega/autosize/methods' ); + +var isAutosizeMethod = contains( autosizeMethods() ); + +var bool = isAutosizeMethod( 'pad' ); +// returns true + +bool = isAutosizeMethod( 'none' ); +// returns true + +bool = isAutosizeMethod( 'beep' ); +// returns false + +bool = isAutosizeMethod( 'boop' ); +// returns false +``` + +</section> + +<!-- /.examples --> + +<!-- Section to include cited references. If references are included, add a horizontal rule *before* the section. Make sure to keep an empty line after the `section` element and another before the `/section` close. --> + +<section class="references"> + +</section> + +<!-- /.references --> + +<!-- Section for related `stdlib` packages. Do not manually edit this section, as it is automatically populated. --> + +<section class="related"> + +</section> + +<!-- /.related --> + +<!-- Section for all links. Make sure to keep an empty line after the `section` element and another before the `/section` close. --> + +<section class="links"> + +</section> + +<!-- /.links --> diff --git a/lib/node_modules/@stdlib/plot/vega/autosize/methods/benchmark/benchmark.js b/lib/node_modules/@stdlib/plot/vega/autosize/methods/benchmark/benchmark.js new file mode 100644 index 000000000000..1250bd5bfbd8 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/autosize/methods/benchmark/benchmark.js @@ -0,0 +1,48 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var bench = require( '@stdlib/bench' ); +var isStringArray = require( '@stdlib/assert/is-string-array' ).primitives; +var pkg = require( './../package.json' ).name; +var autosizeMethods = require( './../lib' ); + + +// MAIN // + +bench( pkg, function benchmark( b ) { + var out; + var i; + + b.tic(); + for ( i = 0; i < b.iterations; i++ ) { + out = autosizeMethods(); + if ( out.length < 2 ) { + b.fail( 'should return an array' ); + } + } + b.toc(); + if ( !isStringArray( out ) ) { + b.fail( 'should return an array of strings' ); + } + b.pass( 'benchmark finished' ); + b.end(); +}); diff --git a/lib/node_modules/@stdlib/plot/vega/autosize/methods/docs/repl.txt b/lib/node_modules/@stdlib/plot/vega/autosize/methods/docs/repl.txt new file mode 100644 index 000000000000..40d64460aa4c --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/autosize/methods/docs/repl.txt @@ -0,0 +1,17 @@ + +{{alias}}() + Returns a list of autosize methods. + + Returns + ------- + out: Array<string> + List of autosize methods. + + Examples + -------- + > var out = {{alias}}() + [ 'pad', 'fit', 'fit-x', 'fit-y', 'none' ] + + See Also + -------- + diff --git a/lib/node_modules/@stdlib/plot/vega/autosize/methods/docs/types/index.d.ts b/lib/node_modules/@stdlib/plot/vega/autosize/methods/docs/types/index.d.ts new file mode 100644 index 000000000000..43901c507974 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/autosize/methods/docs/types/index.d.ts @@ -0,0 +1,35 @@ +/* +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +// TypeScript Version: 4.1 + +/** +* Returns a list of autosize methods. +* +* @returns list of autosize methods +* +* @example +* var list = autosizeMethods(); +* // returns [ 'pad', 'fit', 'fit-x', 'fit-y', 'none' ] +*/ +declare function autosizeMethods(): Array<string>; + + +// EXPORTS // + +export = autosizeMethods; diff --git a/lib/node_modules/@stdlib/plot/vega/autosize/methods/docs/types/test.ts b/lib/node_modules/@stdlib/plot/vega/autosize/methods/docs/types/test.ts new file mode 100644 index 000000000000..f4f6cae6bdc3 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/autosize/methods/docs/types/test.ts @@ -0,0 +1,32 @@ +/* +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +import autosizeMethods = require( './index' ); + + +// TESTS // + +// The function returns an array of strings... +{ + autosizeMethods(); // $ExpectType string[] +} + +// The compiler throws an error if the function is provided any arguments... +{ + autosizeMethods( 9 ); // $ExpectError +} diff --git a/lib/node_modules/@stdlib/plot/vega/autosize/methods/examples/index.js b/lib/node_modules/@stdlib/plot/vega/autosize/methods/examples/index.js new file mode 100644 index 000000000000..3f0aa15bfbed --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/autosize/methods/examples/index.js @@ -0,0 +1,40 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +var contains = require( '@stdlib/array/base/assert/contains' ).factory; +var autosizeMethods = require( './../lib' ); + +var isAutosizeMethod = contains( autosizeMethods() ); + +var bool = isAutosizeMethod( 'pad' ); +console.log( bool ); +// => true + +bool = isAutosizeMethod( 'none' ); +console.log( bool ); +// => true + +bool = isAutosizeMethod( 'beep' ); +console.log( bool ); +// => false + +bool = isAutosizeMethod( 'boop' ); +console.log( bool ); +// => false diff --git a/lib/node_modules/@stdlib/plot/vega/autosize/methods/lib/data.json b/lib/node_modules/@stdlib/plot/vega/autosize/methods/lib/data.json new file mode 100644 index 000000000000..108aa2535c1d --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/autosize/methods/lib/data.json @@ -0,0 +1,7 @@ +[ + "pad", + "fit", + "fit-x", + "fit-y", + "none" +] diff --git a/lib/node_modules/@stdlib/plot/vega/autosize/methods/lib/index.js b/lib/node_modules/@stdlib/plot/vega/autosize/methods/lib/index.js new file mode 100644 index 000000000000..cad24ebbff53 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/autosize/methods/lib/index.js @@ -0,0 +1,40 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +/** +* Return a list of autosize methods. +* +* @module @stdlib/plot/vega/autosize/methods +* +* @example +* var autosizeMethods = require( '@stdlib/plot/vega/autosize/methods' ); +* +* var out = autosizeMethods(); +* // returns [ 'pad', 'fit', 'fit-x', 'fit-y', 'none' ] +*/ + +// MODULES // + +var main = require( './main.js' ); + + +// EXPORTS // + +module.exports = main; diff --git a/lib/node_modules/@stdlib/plot/vega/autosize/methods/lib/main.js b/lib/node_modules/@stdlib/plot/vega/autosize/methods/lib/main.js new file mode 100644 index 000000000000..3ac33a5209dc --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/autosize/methods/lib/main.js @@ -0,0 +1,44 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var DATA = require( './data.json' ); + + +// MAIN // + +/** +* Returns a list of autosize methods. +* +* @returns {StringArray} list of autosize methods +* +* @example +* var out = orientations(); +* // returns [ 'pad', 'fit', 'fit-x', 'fit-y', 'none' ] +*/ +function orientations() { + return DATA.slice(); +} + + +// EXPORTS // + +module.exports = orientations; diff --git a/lib/node_modules/@stdlib/plot/vega/autosize/methods/package.json b/lib/node_modules/@stdlib/plot/vega/autosize/methods/package.json new file mode 100644 index 000000000000..8e246cb96a8a --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/autosize/methods/package.json @@ -0,0 +1,63 @@ +{ + "name": "@stdlib/plot/vega/autosize/methods", + "version": "0.0.0", + "description": "List of supported Vega autosize methods.", + "license": "Apache-2.0", + "author": { + "name": "The Stdlib Authors", + "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" + }, + "contributors": [ + { + "name": "The Stdlib Authors", + "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" + } + ], + "main": "./lib", + "directories": { + "benchmark": "./benchmark", + "doc": "./docs", + "example": "./examples", + "lib": "./lib", + "test": "./test" + }, + "types": "./docs/types", + "scripts": {}, + "homepage": "https://github.com/stdlib-js/stdlib", + "repository": { + "type": "git", + "url": "git://github.com/stdlib-js/stdlib.git" + }, + "bugs": { + "url": "https://github.com/stdlib-js/stdlib/issues" + }, + "dependencies": {}, + "devDependencies": {}, + "engines": { + "node": ">=0.10.0", + "npm": ">2.7.0" + }, + "os": [ + "aix", + "darwin", + "freebsd", + "linux", + "macos", + "openbsd", + "sunos", + "win32", + "windows" + ], + "keywords": [ + "stdlib", + "plot", + "vega", + "autosize", + "resize", + "utilities", + "utility", + "utils", + "util" + ], + "__stdlib__": {} +} diff --git a/lib/node_modules/@stdlib/plot/vega/autosize/methods/test/test.js b/lib/node_modules/@stdlib/plot/vega/autosize/methods/test/test.js new file mode 100644 index 000000000000..5cea1700806d --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/autosize/methods/test/test.js @@ -0,0 +1,50 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var tape = require( 'tape' ); +var autosizeMethods = require( './../lib' ); + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof autosizeMethods, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'the function returns a list of autosize methods', function test( t ) { + var expected; + var actual; + + expected = [ + 'pad', + 'fit', + 'fit-x', + 'fit-y', + 'none' + ]; + actual = autosizeMethods(); + + t.deepEqual( actual, expected, 'returns expected value' ); + t.end(); +}); diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/examples/index.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/examples/index.js new file mode 100644 index 000000000000..5a26d589ddf3 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/examples/index.js @@ -0,0 +1,28 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +var Axis = require( './../lib' ); + +var axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' +}); + +console.log( axis.toJSON() ); diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/aria/get.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/aria/get.js new file mode 100644 index 000000000000..53f67df8b546 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/aria/get.js @@ -0,0 +1,43 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable no-invalid-this */ + +'use strict'; + +// MODULES // + +var prop = require( './properties.js' ); + + +// MAIN // + +/** +* Returns a boolean indicating whether ARIA attributes should be included in SVG output. +* +* @private +* @returns {boolean} boolean flag +*/ +function get() { + return this[ prop.private ]; +} + + +// EXPORTS // + +module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/aria/properties.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/aria/properties.js new file mode 100644 index 000000000000..e8ae54164c30 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/aria/properties.js @@ -0,0 +1,33 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var property2object = require( '@stdlib/plot/vega/base/property2object' ); + + +// MAIN // + +var obj = property2object( 'aria' ); + + +// EXPORTS // + +module.exports = obj; diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/aria/set.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/aria/set.js new file mode 100644 index 000000000000..f8afc4bfaf35 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/aria/set.js @@ -0,0 +1,61 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable no-invalid-this */ + +'use strict'; + +// MODULES // + +var logger = require( 'debug' ); +var isBoolean = require( '@stdlib/assert/is-boolean' ).isPrimitive; +var format = require( '@stdlib/string/format' ); +var changeEvent = require( './../change_event.js' ); +var prop = require( './properties.js' ); + + +// VARIABLES // + +var debug = logger( 'vega:axis:set:'+prop.name ); + + +// MAIN // + +/** +* Sets a boolean flag indicating whether ARIA attributes should be included in SVG output. +* +* @private +* @param {boolean} value - input value +* @throws {TypeError} must be a boolean +* @returns {void} +*/ +function set( value ) { + if ( !isBoolean( value ) ) { + throw new TypeError( format( 'invalid assignment. `%s` must be a boolean. Value: `%s`.', prop.name, value ) ); + } + if ( value !== this[ prop.private ] ) { + debug( 'Current value: %s. New value: %s.', this[ prop.private ], value ); + this[ prop.private ] = value; + this.emit( 'change', changeEvent( prop.name ) ); + } +} + + +// EXPORTS // + +module.exports = set; diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/band-position/get.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/band-position/get.js new file mode 100644 index 000000000000..2b490434673b --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/band-position/get.js @@ -0,0 +1,43 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable no-invalid-this */ + +'use strict'; + +// MODULES // + +var prop = require( './properties.js' ); + + +// MAIN // + +/** +* Returns the interpolation fraction (if set) indicating where axis ticks should be positioned when an axis has a band scale. +* +* @private +* @returns {(number|void)} band position +*/ +function get() { + return this[ prop.private ]; +} + + +// EXPORTS // + +module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/band-position/properties.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/band-position/properties.js new file mode 100644 index 000000000000..d0ce99fc4e5a --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/band-position/properties.js @@ -0,0 +1,33 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var property2object = require( '@stdlib/plot/vega/base/property2object' ); + + +// MAIN // + +var obj = property2object( 'bandPosition' ); + + +// EXPORTS // + +module.exports = obj; diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/band-position/set.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/band-position/set.js new file mode 100644 index 000000000000..24d09b089505 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/band-position/set.js @@ -0,0 +1,66 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable no-invalid-this */ + +'use strict'; + +// MODULES // + +var logger = require( 'debug' ); +var isUndefined = require( '@stdlib/assert/is-undefined' ); +var isBetween = require( '@stdlib/assert/is-between' ); +var format = require( '@stdlib/string/format' ); +var changeEvent = require( './../change_event.js' ); +var prop = require( './properties.js' ); + + +// VARIABLES // + +var debug = logger( 'vega:axis:set:'+prop.name ); + + +// MAIN // + +/** +* Sets a band position. +* +* ## Notes +* +* - Providing `undefined` "unsets" the configured value. +* +* @private +* @param {(number|void)} value - input value +* @throws {TypeError} must be a valid value +* @returns {void} +*/ +function set( value ) { + if ( !isBetween( value, 0.0, 1.0 ) && !isUndefined( value ) ) { + throw new TypeError( format( 'invalid assignment. `%s` must be on the interval: [0, 1]. Value: `%s`.', prop.name, value ) ); + } + if ( value !== this[ prop.private ] ) { + debug( 'Current value: %s. New value: %s.', this[ prop.private ], value ); + this[ prop.private ] = value; + this.emit( 'change', changeEvent( prop.name ) ); + } +} + + +// EXPORTS // + +module.exports = set; diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/change_event.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/change_event.js new file mode 100644 index 000000000000..8791df0dd0d2 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/change_event.js @@ -0,0 +1,41 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MAIN // + +/** +* Returns a new change event object. +* +* @private +* @param {string} property - property name +* @returns {Object} event object +*/ +function event( property ) { // eslint-disable-line stdlib/no-redeclare + return { + 'type': 'update', + 'source': 'axis', + 'property': property + }; +} + + +// EXPORTS // + +module.exports = event; diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/defaults.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/defaults.js new file mode 100644 index 000000000000..1198e950738b --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/defaults.js @@ -0,0 +1,124 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MAIN // + +/** +* Returns defaults. +* +* @private +* @returns {Object} default options +* +* @example +* var o = defaults(); +* // returns {...} +*/ +function defaults() { + return { + // Boolean indicating whether to include ARIA attributes in SVG output: + 'aria': true, + + // Axis description: + 'description': '', + + // Boolean indicating whether the axis baseline should be included as part of an axis: + 'domain': true, + + // Stroke cap for the axis domain line: + 'domainCap': 'butt', + + // Stroke dash for the axis domain line: + 'domainDash': [], + + // Opacity of the axis domain line: + 'domainOpacity': 1, + + // Boolean indicating whether axis grid lines should be included as part of an axis: + 'grid': false, + + // Stroke cap for axis grid lines: + 'gridCap': 'butt', + + // Stroke dash for axis grid lines: + 'gridDash': [], + + // Opacity of axis grid lines: + 'gridOpacity': 1, + + // Boolean indicating whether axis tick labels should be included as part of an axis: + 'labels': true, + + // Vertical text baseline of axis tick labels: + 'labelBaseline': 'alphabetic', + + // Boolean indicating whether to hide axis tick labels which exceed the axis range: + 'labelBound': false, + + // Number of pixels by which to offset flush-adjusted labels: + 'labelFlushOffset': 0, + + // Opacity of axis tick labels: + 'labelOpacity': 1, + + // Strategy to use for resolving overlapping axis tick labels: + 'labelOverlap': false, + + // Minimum separation which must be between label bounding boxes for them to be considered non-overlapping: + 'labelSeparation': 0, + + // Axis position of an axis in pixels: + 'position': 0, + + // Boolean indicating whether axis tick marks should be included as part of an axis: + 'ticks': true, + + // Type of tick style to use in conjunction with an axis having a band scale: + 'tickBand': 'center', + + // Stroke cap for axis tick marks: + 'tickCap': 'butt', + + // Stroke dash for axis tick marks: + 'tickDash': [], + + // Opacity of axis tick marks: + 'tickOpacity': 1, + + // Axis title: + 'title': [ '' ], + + // Anchor position for placing an axis title: + 'titleAnchor': null, + + // Opacity of an axis title: + 'titleOpacity': 1, + + // Coordinate space translation offset for an axis layout (in pixels): + 'translate': 0.5, + + // Integer z-index indicating the layering of an axis group relative to other axis, mark, and legend groups: + 'zindex': 0 + }; +} + + +// EXPORTS // + +module.exports = defaults; diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/description/get.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/description/get.js new file mode 100644 index 000000000000..450002a600f8 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/description/get.js @@ -0,0 +1,43 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable no-invalid-this */ + +'use strict'; + +// MODULES // + +var prop = require( './properties.js' ); + + +// MAIN // + +/** +* Returns the axis description. +* +* @private +* @returns {string} axis description +*/ +function get() { + return this[ prop.private ]; +} + + +// EXPORTS // + +module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/description/properties.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/description/properties.js new file mode 100644 index 000000000000..4df8dba29cc1 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/description/properties.js @@ -0,0 +1,33 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var property2object = require( '@stdlib/plot/vega/base/property2object' ); + + +// MAIN // + +var obj = property2object( 'description' ); + + +// EXPORTS // + +module.exports = obj; diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/description/set.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/description/set.js new file mode 100644 index 000000000000..cf03160637aa --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/description/set.js @@ -0,0 +1,61 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable no-invalid-this */ + +'use strict'; + +// MODULES // + +var logger = require( 'debug' ); +var isString = require( '@stdlib/assert/is-string' ).isPrimitive; +var format = require( '@stdlib/string/format' ); +var changeEvent = require( './../change_event.js' ); +var prop = require( './properties.js' ); + + +// VARIABLES // + +var debug = logger( 'vega:axis:set:'+prop.name ); + + +// MAIN // + +/** +* Sets the axis description. +* +* @private +* @param {string} value - input value +* @throws {TypeError} must be a string +* @returns {void} +*/ +function set( value ) { + if ( !isString( value ) ) { + throw new TypeError( format( 'invalid assignment. `%s` must be a string. Value: `%s`.', prop.name, value ) ); + } + if ( value !== this[ prop.private ] ) { + debug( 'Current value: %s. New value: %s.', this[ prop.private ], value ); + this[ prop.private ] = value; + this.emit( 'change', changeEvent( prop.name ) ); + } +} + + +// EXPORTS // + +module.exports = set; diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/domain-cap/get.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/domain-cap/get.js new file mode 100644 index 000000000000..a171f01020a4 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/domain-cap/get.js @@ -0,0 +1,43 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable no-invalid-this */ + +'use strict'; + +// MODULES // + +var prop = require( './properties.js' ); + + +// MAIN // + +/** +* Returns the stroke cap for an axis domain line. +* +* @private +* @returns {string} stroke cap +*/ +function get() { + return this[ prop.private ]; +} + + +// EXPORTS // + +module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/domain-cap/properties.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/domain-cap/properties.js new file mode 100644 index 000000000000..f64d0f396820 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/domain-cap/properties.js @@ -0,0 +1,33 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var property2object = require( '@stdlib/plot/vega/base/property2object' ); + + +// MAIN // + +var obj = property2object( 'domainCap' ); + + +// EXPORTS // + +module.exports = obj; diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/domain-cap/set.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/domain-cap/set.js new file mode 100644 index 000000000000..d11d46c6ec7d --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/domain-cap/set.js @@ -0,0 +1,63 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable no-invalid-this */ + +'use strict'; + +// MODULES // + +var logger = require( 'debug' ); +var isStrokeCap = require( '@stdlib/plot/vega/base/assert/is-stroke-cap' ); +var join = require( '@stdlib/array/base/join' ); +var strokeCaps = require( '@stdlib/plot/vega/base/stroke-caps' ); +var format = require( '@stdlib/string/format' ); +var changeEvent = require( './../change_event.js' ); +var prop = require( './properties.js' ); + + +// VARIABLES // + +var debug = logger( 'vega:axis:set:'+prop.name ); + + +// MAIN // + +/** +* Sets the stroke cap for an axis domain line. +* +* @private +* @param {string} value - input value +* @throws {TypeError} must be a valid stroke cap +* @returns {void} +*/ +function set( value ) { + if ( !isStrokeCap( value ) ) { + throw new TypeError( format( 'invalid assignment. `%s` must be one of the following: "%s". Value: `%s`.', prop.name, join( strokeCaps(), '", "' ), value ) ); + } + if ( value !== this[ prop.private ] ) { + debug( 'Current value: %s. New value: %s.', this[ prop.private ], value ); + this[ prop.private ] = value; + this.emit( 'change', changeEvent( prop.name ) ); + } +} + + +// EXPORTS // + +module.exports = set; diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/domain-color/get.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/domain-color/get.js new file mode 100644 index 000000000000..0d452883e104 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/domain-color/get.js @@ -0,0 +1,43 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable no-invalid-this */ + +'use strict'; + +// MODULES // + +var prop = require( './properties.js' ); + + +// MAIN // + +/** +* Returns the color of the axis domain line. +* +* @private +* @returns {(string|void)} color string +*/ +function get() { + return this[ prop.private ]; +} + + +// EXPORTS // + +module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/domain-color/properties.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/domain-color/properties.js new file mode 100644 index 000000000000..4bf7fbde773e --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/domain-color/properties.js @@ -0,0 +1,33 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var property2object = require( '@stdlib/plot/vega/base/property2object' ); + + +// MAIN // + +var obj = property2object( 'domainColor' ); + + +// EXPORTS // + +module.exports = obj; diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/domain-color/set.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/domain-color/set.js new file mode 100644 index 000000000000..78560d2c6809 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/domain-color/set.js @@ -0,0 +1,66 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable no-invalid-this */ + +'use strict'; + +// MODULES // + +var logger = require( 'debug' ); +var isString = require( '@stdlib/assert/is-string' ).isPrimitive; +var isUndefined = require( '@stdlib/assert/is-undefined' ); +var format = require( '@stdlib/string/format' ); +var changeEvent = require( './../change_event.js' ); +var prop = require( './properties.js' ); + + +// VARIABLES // + +var debug = logger( 'vega:axis:set:'+prop.name ); + + +// MAIN // + +/** +* Sets the color of an axis domain line. +* +* ## Notes +* +* - Providing `undefined` "unsets" the configured value. +* +* @private +* @param {(string|void)} value - input value +* @throws {TypeError} must be a string +* @returns {void} +*/ +function set( value ) { + if ( !isString( value ) && !isUndefined( value ) ) { + throw new TypeError( format( 'invalid assignment. `%s` must be a string. Value: `%s`.', prop.name, value ) ); + } + if ( value !== this[ prop.private ] ) { + debug( 'Current value: %s. New value: %s.', this[ prop.private ], value ); + this[ prop.private ] = value; + this.emit( 'change', changeEvent( prop.name ) ); + } +} + + +// EXPORTS // + +module.exports = set; diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/domain-dash-offset/get.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/domain-dash-offset/get.js new file mode 100644 index 000000000000..c2cbd1deee70 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/domain-dash-offset/get.js @@ -0,0 +1,43 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable no-invalid-this */ + +'use strict'; + +// MODULES // + +var prop = require( './properties.js' ); + + +// MAIN // + +/** +* Returns the pixel offset at which to start an axis domain dash array. +* +* @private +* @returns {(void|number)} pixel offset +*/ +function get() { + return this[ prop.private ]; +} + + +// EXPORTS // + +module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/domain-dash-offset/properties.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/domain-dash-offset/properties.js new file mode 100644 index 000000000000..1bbca12195f9 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/domain-dash-offset/properties.js @@ -0,0 +1,33 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var property2object = require( '@stdlib/plot/vega/base/property2object' ); + + +// MAIN // + +var obj = property2object( 'domainDashOffset' ); + + +// EXPORTS // + +module.exports = obj; diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/domain-dash-offset/set.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/domain-dash-offset/set.js new file mode 100644 index 000000000000..a85691801cb4 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/domain-dash-offset/set.js @@ -0,0 +1,66 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable no-invalid-this */ + +'use strict'; + +// MODULES // + +var logger = require( 'debug' ); +var isNumber = require( '@stdlib/assert/is-number' ).isPrimitive; +var isUndefined = require( '@stdlib/assert/is-undefined' ); +var format = require( '@stdlib/string/format' ); +var changeEvent = require( './../change_event.js' ); +var prop = require( './properties.js' ); + + +// VARIABLES // + +var debug = logger( 'vega:axis:set:'+prop.name ); + + +// MAIN // + +/** +* Sets the pixel offset at which to start an axis domain line dash array. +* +* ## Notes +* +* - Providing `undefined` "unsets" the configured value. +* +* @private +* @param {(void|number)} value - input value +* @throws {TypeError} must be a number +* @returns {void} +*/ +function set( value ) { + if ( !isNumber( value ) && !isUndefined( value ) ) { + throw new TypeError( format( 'invalid assignment. `%s` must be a number. Value: `%s`.', prop.name, value ) ); + } + if ( value !== this[ prop.private ] ) { + debug( 'Current value: %s. New value: %s.', this[ prop.private ], value ); + this[ prop.private ] = value; + this.emit( 'change', changeEvent( prop.name ) ); + } +} + + +// EXPORTS // + +module.exports = set; diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/domain-dash/get.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/domain-dash/get.js new file mode 100644 index 000000000000..8599a28bb7bd --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/domain-dash/get.js @@ -0,0 +1,44 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable no-invalid-this */ + +'use strict'; + +// MODULES // + +var copy = require( '@stdlib/array/base/copy-indexed' ); +var prop = require( './properties.js' ); + + +// MAIN // + +/** +* Returns the stroke dash of the axis domain line. +* +* @private +* @returns {Array} stroke dash +*/ +function get() { + return copy( this[ prop.private ] ); +} + + +// EXPORTS // + +module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/domain-dash/properties.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/domain-dash/properties.js new file mode 100644 index 000000000000..19c0b631da4f --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/domain-dash/properties.js @@ -0,0 +1,33 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var property2object = require( '@stdlib/plot/vega/base/property2object' ); + + +// MAIN // + +var obj = property2object( 'domainDash' ); + + +// EXPORTS // + +module.exports = obj; diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/domain-dash/set.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/domain-dash/set.js new file mode 100644 index 000000000000..b3e85d45d0ad --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/domain-dash/set.js @@ -0,0 +1,65 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable no-invalid-this */ + +'use strict'; + +// MODULES // + +var logger = require( 'debug' ); +var isNumericArray = require( '@stdlib/assert/is-numeric-array' ); +var isEmptyCollection = require( '@stdlib/assert/is-empty-collection' ); +var hasSameValues = require( '@stdlib/array/base/assert/has-same-values' ); +var copy = require( '@stdlib/array/base/copy' ); +var join = require( '@stdlib/array/base/join' ); +var format = require( '@stdlib/string/format' ); +var changeEvent = require( './../change_event.js' ); +var prop = require( './properties.js' ); + + +// VARIABLES // + +var debug = logger( 'vega:axis:set:'+prop.name ); + + +// MAIN // + +/** +* Sets the stroke dash for an axis domain line. +* +* @private +* @param {NumericArray} value - input value +* @throws {TypeError} must be a numeric array +* @returns {void} +*/ +function set( value ) { + if ( !isNumericArray( value ) && !isEmptyCollection( value ) ) { + throw new TypeError( format( 'invalid assignment. `%s` must be a numeric array. Value: `%s`.', prop.name, value ) ); + } + if ( !hasSameValues( value, this[ prop.private ] ) ) { + debug( 'Current value: [%s]. New value: [%s].', join( this[ prop.private ], ', ' ), join( value, ', ' ) ); + this[ prop.private ] = copy( value ); + this.emit( 'change', changeEvent( prop.name ) ); + } +} + + +// EXPORTS // + +module.exports = set; diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/domain-opacity/get.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/domain-opacity/get.js new file mode 100644 index 000000000000..c522072b8f0b --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/domain-opacity/get.js @@ -0,0 +1,43 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable no-invalid-this */ + +'use strict'; + +// MODULES // + +var prop = require( './properties.js' ); + + +// MAIN // + +/** +* Returns the opacity of an axis domain line. +* +* @private +* @returns {number} opacity +*/ +function get() { + return this[ prop.private ]; +} + + +// EXPORTS // + +module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/domain-opacity/properties.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/domain-opacity/properties.js new file mode 100644 index 000000000000..87542531514f --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/domain-opacity/properties.js @@ -0,0 +1,33 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var property2object = require( '@stdlib/plot/vega/base/property2object' ); + + +// MAIN // + +var obj = property2object( 'domainOpacity' ); + + +// EXPORTS // + +module.exports = obj; diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/domain-opacity/set.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/domain-opacity/set.js new file mode 100644 index 000000000000..b61d3ef921a6 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/domain-opacity/set.js @@ -0,0 +1,61 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable no-invalid-this */ + +'use strict'; + +// MODULES // + +var logger = require( 'debug' ); +var isBetween = require( '@stdlib/assert/is-between' ); +var format = require( '@stdlib/string/format' ); +var changeEvent = require( './../change_event.js' ); +var prop = require( './properties.js' ); + + +// VARIABLES // + +var debug = logger( 'vega:axis:set:'+prop.name ); + + +// MAIN // + +/** +* Sets the opacity of an axis domain line. +* +* @private +* @param {number} value - input value +* @throws {TypeError} must be a number on the interval `[0, 1]` +* @returns {void} +*/ +function set( value ) { + if ( !isBetween( value, 0.0, 1.0 ) ) { + throw new TypeError( format( 'invalid assignment. `%s` must be on the interval: [0, 1]. Value: `%s`.', prop.name, value ) ); + } + if ( value !== this[ prop.private ] ) { + debug( 'Current value: %s. New value: %s.', this[ prop.private ], value ); + this[ prop.private ] = value; + this.emit( 'change', changeEvent( prop.name ) ); + } +} + + +// EXPORTS // + +module.exports = set; diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/domain-width/get.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/domain-width/get.js new file mode 100644 index 000000000000..cf10cfa4d606 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/domain-width/get.js @@ -0,0 +1,43 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable no-invalid-this */ + +'use strict'; + +// MODULES // + +var prop = require( './properties.js' ); + + +// MAIN // + +/** +* Returns the stroke width of an axis domain line. +* +* @private +* @returns {(void|number)} stroke width +*/ +function get() { + return this[ prop.private ]; +} + + +// EXPORTS // + +module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/domain-width/properties.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/domain-width/properties.js new file mode 100644 index 000000000000..d0ad12135e92 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/domain-width/properties.js @@ -0,0 +1,33 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var property2object = require( '@stdlib/plot/vega/base/property2object' ); + + +// MAIN // + +var obj = property2object( 'domainWidth' ); + + +// EXPORTS // + +module.exports = obj; diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/domain-width/set.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/domain-width/set.js new file mode 100644 index 000000000000..0af837383eed --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/domain-width/set.js @@ -0,0 +1,66 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable no-invalid-this */ + +'use strict'; + +// MODULES // + +var logger = require( 'debug' ); +var isNonNegativeNumber = require( '@stdlib/assert/is-nonnegative-number' ).isPrimitive; +var isUndefined = require( '@stdlib/assert/is-undefined' ); +var format = require( '@stdlib/string/format' ); +var changeEvent = require( './../change_event.js' ); +var prop = require( './properties.js' ); + + +// VARIABLES // + +var debug = logger( 'vega:axis:set:'+prop.name ); + + +// MAIN // + +/** +* Sets the width of an axis domain line. +* +* ## Notes +* +* - Providing `undefined` "unsets" the configured value. +* +* @private +* @param {(NonNegativeNumber|void)} value - input value +* @throws {TypeError} must be a nonnegative number +* @returns {void} +*/ +function set( value ) { + if ( !isNonNegativeNumber( value ) && !isUndefined( value ) ) { + throw new TypeError( format( 'invalid assignment. `%s` must be a nonnegative number. Value: `%s`.', prop.name, value ) ); + } + if ( value !== this[ prop.private ] ) { + debug( 'Current value: %s. New value: %s.', this[ prop.private ], value ); + this[ prop.private ] = value; + this.emit( 'change', changeEvent( prop.name ) ); + } +} + + +// EXPORTS // + +module.exports = set; diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/domain/get.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/domain/get.js new file mode 100644 index 000000000000..5180721d9326 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/domain/get.js @@ -0,0 +1,43 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable no-invalid-this */ + +'use strict'; + +// MODULES // + +var prop = require( './properties.js' ); + + +// MAIN // + +/** +* Returns a boolean indicating whether the axis baseline should be included as part of the axis. +* +* @private +* @returns {boolean} boolean flag +*/ +function get() { + return this[ prop.private ]; +} + + +// EXPORTS // + +module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/domain/properties.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/domain/properties.js new file mode 100644 index 000000000000..fe79c7fb79f6 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/domain/properties.js @@ -0,0 +1,33 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var property2object = require( '@stdlib/plot/vega/base/property2object' ); + + +// MAIN // + +var obj = property2object( 'domain' ); + + +// EXPORTS // + +module.exports = obj; diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/domain/set.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/domain/set.js new file mode 100644 index 000000000000..cb61b95beef6 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/domain/set.js @@ -0,0 +1,61 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable no-invalid-this */ + +'use strict'; + +// MODULES // + +var logger = require( 'debug' ); +var isBoolean = require( '@stdlib/assert/is-boolean' ).isPrimitive; +var format = require( '@stdlib/string/format' ); +var changeEvent = require( './../change_event.js' ); +var prop = require( './properties.js' ); + + +// VARIABLES // + +var debug = logger( 'vega:axis:set:'+prop.name ); + + +// MAIN // + +/** +* Sets a boolean flag indicating whether the axis baseline should be included as part of the axis. +* +* @private +* @param {boolean} value - input value +* @throws {TypeError} must be a boolean +* @returns {void} +*/ +function set( value ) { + if ( !isBoolean( value ) ) { + throw new TypeError( format( 'invalid assignment. `%s` must be a boolean. Value: `%s`.', prop.name, value ) ); + } + if ( value !== this[ prop.private ] ) { + debug( 'Current value: %s. New value: %s.', this[ prop.private ], value ); + this[ prop.private ] = value; + this.emit( 'change', changeEvent( prop.name ) ); + } +} + + +// EXPORTS // + +module.exports = set; diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/grid-cap/get.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/grid-cap/get.js new file mode 100644 index 000000000000..626e3bf594e7 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/grid-cap/get.js @@ -0,0 +1,43 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable no-invalid-this */ + +'use strict'; + +// MODULES // + +var prop = require( './properties.js' ); + + +// MAIN // + +/** +* Returns the stroke cap for axis grid lines. +* +* @private +* @returns {string} stroke cap +*/ +function get() { + return this[ prop.private ]; +} + + +// EXPORTS // + +module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/grid-cap/properties.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/grid-cap/properties.js new file mode 100644 index 000000000000..f0743b30d81b --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/grid-cap/properties.js @@ -0,0 +1,33 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var property2object = require( '@stdlib/plot/vega/base/property2object' ); + + +// MAIN // + +var obj = property2object( 'gridCap' ); + + +// EXPORTS // + +module.exports = obj; diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/grid-cap/set.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/grid-cap/set.js new file mode 100644 index 000000000000..2d00282944ed --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/grid-cap/set.js @@ -0,0 +1,63 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable no-invalid-this */ + +'use strict'; + +// MODULES // + +var logger = require( 'debug' ); +var isStrokeCap = require( '@stdlib/plot/vega/base/assert/is-stroke-cap' ); +var join = require( '@stdlib/array/base/join' ); +var strokeCaps = require( '@stdlib/plot/vega/base/stroke-caps' ); +var format = require( '@stdlib/string/format' ); +var changeEvent = require( './../change_event.js' ); +var prop = require( './properties.js' ); + + +// VARIABLES // + +var debug = logger( 'vega:axis:set:'+prop.name ); + + +// MAIN // + +/** +* Sets the stroke cap for axis grid lines. +* +* @private +* @param {string} value - input value +* @throws {TypeError} must be a valid stroke cap +* @returns {void} +*/ +function set( value ) { + if ( !isStrokeCap( value ) ) { + throw new TypeError( format( 'invalid assignment. `%s` must be one of the following: "%s". Value: `%s`.', prop.name, join( strokeCaps(), '", "' ), value ) ); + } + if ( value !== this[ prop.private ] ) { + debug( 'Current value: %s. New value: %s.', this[ prop.private ], value ); + this[ prop.private ] = value; + this.emit( 'change', changeEvent( prop.name ) ); + } +} + + +// EXPORTS // + +module.exports = set; diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/grid-color/get.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/grid-color/get.js new file mode 100644 index 000000000000..af91e8589e85 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/grid-color/get.js @@ -0,0 +1,43 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable no-invalid-this */ + +'use strict'; + +// MODULES // + +var prop = require( './properties.js' ); + + +// MAIN // + +/** +* Returns the color of axis grid lines as a CSS color string. +* +* @private +* @returns {(string|void)} color +*/ +function get() { + return this[ prop.private ]; +} + + +// EXPORTS // + +module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/grid-color/properties.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/grid-color/properties.js new file mode 100644 index 000000000000..fac129924922 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/grid-color/properties.js @@ -0,0 +1,33 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var property2object = require( '@stdlib/plot/vega/base/property2object' ); + + +// MAIN // + +var obj = property2object( 'gridColor' ); + + +// EXPORTS // + +module.exports = obj; diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/grid-color/set.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/grid-color/set.js new file mode 100644 index 000000000000..fee3d19703c5 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/grid-color/set.js @@ -0,0 +1,66 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable no-invalid-this */ + +'use strict'; + +// MODULES // + +var logger = require( 'debug' ); +var isString = require( '@stdlib/assert/is-string' ).isPrimitive; +var isUndefined = require( '@stdlib/assert/is-undefined' ); +var format = require( '@stdlib/string/format' ); +var changeEvent = require( './../change_event.js' ); +var prop = require( './properties.js' ); + + +// VARIABLES // + +var debug = logger( 'vega:axis:set:'+prop.name ); + + +// MAIN // + +/** +* Sets the color of axis grid lines. +* +* ## Notes +* +* - Providing `undefined` "unsets" the configured value. +* +* @private +* @param {(string|void)} value - input value +* @throws {TypeError} must be a string +* @returns {void} +*/ +function set( value ) { + if ( !isString( value ) && !isUndefined( value ) ) { + throw new TypeError( format( 'invalid assignment. `%s` must be a string. Value: `%s`.', prop.name, value ) ); + } + if ( value !== this[ prop.private ] ) { + debug( 'Current value: %s. New value: %s.', this[ prop.private ], value ); + this[ prop.private ] = value; + this.emit( 'change', changeEvent( prop.name ) ); + } +} + + +// EXPORTS // + +module.exports = set; diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/grid-dash-offset/get.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/grid-dash-offset/get.js new file mode 100644 index 000000000000..6125e3f4c3d9 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/grid-dash-offset/get.js @@ -0,0 +1,43 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable no-invalid-this */ + +'use strict'; + +// MODULES // + +var prop = require( './properties.js' ); + + +// MAIN // + +/** +* Returns the pixel offset at which to start an axis grid line stroke dash. +* +* @private +* @returns {(void|number)} pixel offset +*/ +function get() { + return this[ prop.private ]; +} + + +// EXPORTS // + +module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/grid-dash-offset/properties.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/grid-dash-offset/properties.js new file mode 100644 index 000000000000..6a0a5652c1b0 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/grid-dash-offset/properties.js @@ -0,0 +1,33 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var property2object = require( '@stdlib/plot/vega/base/property2object' ); + + +// MAIN // + +var obj = property2object( 'gridDashOffset' ); + + +// EXPORTS // + +module.exports = obj; diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/grid-dash-offset/set.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/grid-dash-offset/set.js new file mode 100644 index 000000000000..273cb5898bfa --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/grid-dash-offset/set.js @@ -0,0 +1,66 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable no-invalid-this */ + +'use strict'; + +// MODULES // + +var logger = require( 'debug' ); +var isNumber = require( '@stdlib/assert/is-number' ).isPrimitive; +var isUndefined = require( '@stdlib/assert/is-undefined' ); +var format = require( '@stdlib/string/format' ); +var changeEvent = require( './../change_event.js' ); +var prop = require( './properties.js' ); + + +// VARIABLES // + +var debug = logger( 'vega:axis:set:'+prop.name ); + + +// MAIN // + +/** +* Sets the pixel offset at which to start an axis grid line stroke dash. +* +* ## Notes +* +* - Providing `undefined` "unsets" the configured value. +* +* @private +* @param {(number|void)} value - input value +* @throws {TypeError} must be a number +* @returns {void} +*/ +function set( value ) { + if ( !isNumber( value ) && !isUndefined( value ) ) { + throw new TypeError( format( 'invalid assignment. `%s` must be a number. Value: `%s`.', prop.name, value ) ); + } + if ( value !== this[ prop.private ] ) { + debug( 'Current value: %s. New value: %s.', this[ prop.private ], value ); + this[ prop.private ] = value; + this.emit( 'change', changeEvent( prop.name ) ); + } +} + + +// EXPORTS // + +module.exports = set; diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/grid-dash/get.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/grid-dash/get.js new file mode 100644 index 000000000000..c7cdc5e820a2 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/grid-dash/get.js @@ -0,0 +1,44 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable no-invalid-this */ + +'use strict'; + +// MODULES // + +var copy = require( '@stdlib/array/base/copy-indexed' ); +var prop = require( './properties.js' ); + + +// MAIN // + +/** +* Returns the stroke dash for axis grid lines. +* +* @private +* @returns {Array} stroke dash +*/ +function get() { + return copy( this[ prop.private ] ); +} + + +// EXPORTS // + +module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/grid-dash/properties.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/grid-dash/properties.js new file mode 100644 index 000000000000..5c1da825d3e6 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/grid-dash/properties.js @@ -0,0 +1,33 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var property2object = require( '@stdlib/plot/vega/base/property2object' ); + + +// MAIN // + +var obj = property2object( 'gridDash' ); + + +// EXPORTS // + +module.exports = obj; diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/grid-dash/set.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/grid-dash/set.js new file mode 100644 index 000000000000..fefff96ad59b --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/grid-dash/set.js @@ -0,0 +1,65 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable no-invalid-this */ + +'use strict'; + +// MODULES // + +var logger = require( 'debug' ); +var isNumericArray = require( '@stdlib/assert/is-numeric-array' ); +var isEmptyCollection = require( '@stdlib/assert/is-empty-collection' ); +var hasSameValues = require( '@stdlib/array/base/assert/has-same-values' ); +var copy = require( '@stdlib/array/base/copy' ); +var join = require( '@stdlib/array/base/join' ); +var format = require( '@stdlib/string/format' ); +var changeEvent = require( './../change_event.js' ); +var prop = require( './properties.js' ); + + +// VARIABLES // + +var debug = logger( 'vega:axis:set:'+prop.name ); + + +// MAIN // + +/** +* Sets the stroke dash for axis grid lines. +* +* @private +* @param {NumericArray} value - input value +* @throws {TypeError} must be a numeric array +* @returns {void} +*/ +function set( value ) { + if ( !isNumericArray( value ) && !isEmptyCollection( value ) ) { + throw new TypeError( format( 'invalid assignment. `%s` must be a numeric array. Value: `%s`.', prop.name, value ) ); + } + if ( !hasSameValues( value, this[ prop.private ] ) ) { + debug( 'Current value: [%s]. New value: [%s].', join( this[ prop.private ], ', ' ), join( value, ', ' ) ); + this[ prop.private ] = copy( value ); + this.emit( 'change', changeEvent( prop.name ) ); + } +} + + +// EXPORTS // + +module.exports = set; diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/grid-opacity/get.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/grid-opacity/get.js new file mode 100644 index 000000000000..f6097197919d --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/grid-opacity/get.js @@ -0,0 +1,43 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable no-invalid-this */ + +'use strict'; + +// MODULES // + +var prop = require( './properties.js' ); + + +// MAIN // + +/** +* Returns the opacity of axis grid lines. +* +* @private +* @returns {number} opacity +*/ +function get() { + return this[ prop.private ]; +} + + +// EXPORTS // + +module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/grid-opacity/properties.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/grid-opacity/properties.js new file mode 100644 index 000000000000..85cc27109375 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/grid-opacity/properties.js @@ -0,0 +1,33 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var property2object = require( '@stdlib/plot/vega/base/property2object' ); + + +// MAIN // + +var obj = property2object( 'gridOpacity' ); + + +// EXPORTS // + +module.exports = obj; diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/grid-opacity/set.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/grid-opacity/set.js new file mode 100644 index 000000000000..d80db2ab3380 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/grid-opacity/set.js @@ -0,0 +1,61 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable no-invalid-this */ + +'use strict'; + +// MODULES // + +var logger = require( 'debug' ); +var isBetween = require( '@stdlib/assert/is-between' ); +var format = require( '@stdlib/string/format' ); +var changeEvent = require( './../change_event.js' ); +var prop = require( './properties.js' ); + + +// VARIABLES // + +var debug = logger( 'vega:axis:set:'+prop.name ); + + +// MAIN // + +/** +* Sets the opacity of axis grid lines. +* +* @private +* @param {number} value - input value +* @throws {TypeError} must be a number on the interval `[0, 1]` +* @returns {void} +*/ +function set( value ) { + if ( !isBetween( value, 0.0, 1.0 ) ) { + throw new TypeError( format( 'invalid assignment. `%s` must be on the interval: [0, 1]. Value: `%s`.', prop.name, value ) ); + } + if ( value !== this[ prop.private ] ) { + debug( 'Current value: %s. New value: %s.', this[ prop.private ], value ); + this[ prop.private ] = value; + this.emit( 'change', changeEvent( prop.name ) ); + } +} + + +// EXPORTS // + +module.exports = set; diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/grid-scale/get.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/grid-scale/get.js new file mode 100644 index 000000000000..e33873ee61b3 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/grid-scale/get.js @@ -0,0 +1,43 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable no-invalid-this */ + +'use strict'; + +// MODULES // + +var prop = require( './properties.js' ); + + +// MAIN // + +/** +* Returns the scale name to use for including axis grid lines. +* +* @private +* @returns {(void|string)} scale name +*/ +function get() { + return this[ prop.private ]; +} + + +// EXPORTS // + +module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/grid-scale/properties.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/grid-scale/properties.js new file mode 100644 index 000000000000..97daefd817c8 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/grid-scale/properties.js @@ -0,0 +1,33 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var property2object = require( '@stdlib/plot/vega/base/property2object' ); + + +// MAIN // + +var obj = property2object( 'gridScale' ); + + +// EXPORTS // + +module.exports = obj; diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/grid-scale/set.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/grid-scale/set.js new file mode 100644 index 000000000000..618e1d5748ac --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/grid-scale/set.js @@ -0,0 +1,66 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable no-invalid-this */ + +'use strict'; + +// MODULES // + +var logger = require( 'debug' ); +var isString = require( '@stdlib/assert/is-string' ).isPrimitive; +var isUndefined = require( '@stdlib/assert/is-undefined' ); +var format = require( '@stdlib/string/format' ); +var changeEvent = require( './../change_event.js' ); +var prop = require( './properties.js' ); + + +// VARIABLES // + +var debug = logger( 'vega:axis:set:'+prop.name ); + + +// MAIN // + +/** +* Sets the scale name to use for including axis grid lines. +* +* ## Notes +* +* - Providing `undefined` "unsets" the configured value. +* +* @private +* @param {(string|void)} value - input value +* @throws {TypeError} must be a string +* @returns {void} +*/ +function set( value ) { + if ( !isString( value ) && !isUndefined( value ) ) { + throw new TypeError( format( 'invalid assignment. `%s` must be a string. Value: `%s`.', prop.name, value ) ); + } + if ( value !== this[ prop.private ] ) { + debug( 'Current value: %s. New value: %s.', this[ prop.private ], value ); + this[ prop.private ] = value; + this.emit( 'change', changeEvent( prop.name ) ); + } +} + + +// EXPORTS // + +module.exports = set; diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/grid-width/get.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/grid-width/get.js new file mode 100644 index 000000000000..807431fc96b9 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/grid-width/get.js @@ -0,0 +1,43 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable no-invalid-this */ + +'use strict'; + +// MODULES // + +var prop = require( './properties.js' ); + + +// MAIN // + +/** +* Returns the stroke width of axis grid lines. +* +* @private +* @returns {(void|NonNegativeNumber)} stroke width +*/ +function get() { + return this[ prop.private ]; +} + + +// EXPORTS // + +module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/grid-width/properties.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/grid-width/properties.js new file mode 100644 index 000000000000..cd133f3ef5eb --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/grid-width/properties.js @@ -0,0 +1,33 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var property2object = require( '@stdlib/plot/vega/base/property2object' ); + + +// MAIN // + +var obj = property2object( 'gridWidth' ); + + +// EXPORTS // + +module.exports = obj; diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/grid-width/set.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/grid-width/set.js new file mode 100644 index 000000000000..c473979978e3 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/grid-width/set.js @@ -0,0 +1,66 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable no-invalid-this */ + +'use strict'; + +// MODULES // + +var logger = require( 'debug' ); +var isNonNegativeNumber = require( '@stdlib/assert/is-nonnegative-number' ).isPrimitive; +var isUndefined = require( '@stdlib/assert/is-undefined' ); +var format = require( '@stdlib/string/format' ); +var changeEvent = require( './../change_event.js' ); +var prop = require( './properties.js' ); + + +// VARIABLES // + +var debug = logger( 'vega:axis:set:'+prop.name ); + + +// MAIN // + +/** +* Sets the stroke width of axis grid lines. +* +* ## Notes +* +* - Providing `undefined` "unsets" the configured value. +* +* @private +* @param {(NonNegativeNumber|void)} value - input value +* @throws {TypeError} must be a nonnegative number +* @returns {void} +*/ +function set( value ) { + if ( !isNonNegativeNumber( value ) && !isUndefined( value ) ) { + throw new TypeError( format( 'invalid assignment. `%s` must be a nonnegative number. Value: `%s`.', prop.name, value ) ); + } + if ( value !== this[ prop.private ] ) { + debug( 'Current value: %s. New value: %s.', this[ prop.private ], value ); + this[ prop.private ] = value; + this.emit( 'change', changeEvent( prop.name ) ); + } +} + + +// EXPORTS // + +module.exports = set; diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/grid/get.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/grid/get.js new file mode 100644 index 000000000000..9c22e1b89501 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/grid/get.js @@ -0,0 +1,43 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable no-invalid-this */ + +'use strict'; + +// MODULES // + +var prop = require( './properties.js' ); + + +// MAIN // + +/** +* Returns a boolean indicating whether grid lines should be included as part of an axis. +* +* @private +* @returns {boolean} boolean flag +*/ +function get() { + return this[ prop.private ]; +} + + +// EXPORTS // + +module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/grid/properties.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/grid/properties.js new file mode 100644 index 000000000000..35cab12083df --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/grid/properties.js @@ -0,0 +1,33 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var property2object = require( '@stdlib/plot/vega/base/property2object' ); + + +// MAIN // + +var obj = property2object( 'grid' ); + + +// EXPORTS // + +module.exports = obj; diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/grid/set.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/grid/set.js new file mode 100644 index 000000000000..48570e13107e --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/grid/set.js @@ -0,0 +1,61 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable no-invalid-this */ + +'use strict'; + +// MODULES // + +var logger = require( 'debug' ); +var isBoolean = require( '@stdlib/assert/is-boolean' ).isPrimitive; +var format = require( '@stdlib/string/format' ); +var changeEvent = require( './../change_event.js' ); +var prop = require( './properties.js' ); + + +// VARIABLES // + +var debug = logger( 'vega:axis:set:'+prop.name ); + + +// MAIN // + +/** +* Sets a boolean flag indicating whether grid lines should be included as part of an axis. +* +* @private +* @param {boolean} value - input value +* @throws {TypeError} must be a boolean +* @returns {void} +*/ +function set( value ) { + if ( !isBoolean( value ) ) { + throw new TypeError( format( 'invalid assignment. `%s` must be a boolean. Value: `%s`.', prop.name, value ) ); + } + if ( value !== this[ prop.private ] ) { + debug( 'Current value: %s. New value: %s.', this[ prop.private ], value ); + this[ prop.private ] = value; + this.emit( 'change', changeEvent( prop.name ) ); + } +} + + +// EXPORTS // + +module.exports = set; diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/index.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/index.js new file mode 100644 index 000000000000..362f7549cfb9 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/index.js @@ -0,0 +1,45 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable stdlib/jsdoc-main-export */ + +'use strict'; + +/** +* Axis constructor. +* +* @module @stdlib/plot/vega/axis/ctor +* +* @example +* var Axis = require( '@stdlib/plot/vega/axis/ctor' ); +* +* var axis = new Axis({ +* 'scale': 'xScale', +* 'orient': 'bottom' +* }); +* // returns <Axis> +*/ + +// MODULES // + +var main = require( './main.js' ); + + +// EXPORTS // + +module.exports = main; diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/label-align/get.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/label-align/get.js new file mode 100644 index 000000000000..45c3f82b7c46 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/label-align/get.js @@ -0,0 +1,43 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable no-invalid-this */ + +'use strict'; + +// MODULES // + +var prop = require( './properties.js' ); + + +// MAIN // + +/** +* Returns the horizontal text alignment of axis tick labels. +* +* @private +* @returns {(string|void)} alignment +*/ +function get() { + return this[ prop.private ]; +} + + +// EXPORTS // + +module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/label-align/properties.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/label-align/properties.js new file mode 100644 index 000000000000..d0a561e76454 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/label-align/properties.js @@ -0,0 +1,33 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var property2object = require( '@stdlib/plot/vega/base/property2object' ); + + +// MAIN // + +var obj = property2object( 'labelAlign' ); + + +// EXPORTS // + +module.exports = obj; diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/label-align/set.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/label-align/set.js new file mode 100644 index 000000000000..dbae0519995c --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/label-align/set.js @@ -0,0 +1,67 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable no-invalid-this */ + +'use strict'; + +// MODULES // + +var logger = require( 'debug' ); +var isString = require( '@stdlib/assert/is-string' ).isPrimitive; +var isUndefined = require( '@stdlib/assert/is-undefined' ); +var format = require( '@stdlib/string/format' ); +var changeEvent = require( './../change_event.js' ); +var prop = require( './properties.js' ); + + +// VARIABLES // + +var debug = logger( 'vega:axis:set:'+prop.name ); + + +// MAIN // + +/** +* Sets the horizontal text alignment of axis tick labels. +* +* ## Notes +* +* - Providing `undefined` "unsets" the configured value. +* - Setting the alignment overrides the default setting for the current axis orientation. +* +* @private +* @param {(string|void)} value - input value +* @throws {TypeError} must be a string +* @returns {void} +*/ +function set( value ) { + if ( !isString( value ) && !isUndefined( value ) ) { + throw new TypeError( format( 'invalid assignment. `%s` must be a string. Value: `%s`.', prop.name, value ) ); + } + if ( value !== this[ prop.private ] ) { + debug( 'Current value: %s. New value: %s.', this[ prop.private ], value ); + this[ prop.private ] = value; + this.emit( 'change', changeEvent( prop.name ) ); + } +} + + +// EXPORTS // + +module.exports = set; diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/label-angle/get.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/label-angle/get.js new file mode 100644 index 000000000000..2d9ffffe66c6 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/label-angle/get.js @@ -0,0 +1,43 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable no-invalid-this */ + +'use strict'; + +// MODULES // + +var prop = require( './properties.js' ); + + +// MAIN // + +/** +* Returns the angle (in degrees) of axis tick labels. +* +* @private +* @returns {(void|number)} angle +*/ +function get() { + return this[ prop.private ]; +} + + +// EXPORTS // + +module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/label-angle/properties.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/label-angle/properties.js new file mode 100644 index 000000000000..2ff7349d3768 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/label-angle/properties.js @@ -0,0 +1,33 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var property2object = require( '@stdlib/plot/vega/base/property2object' ); + + +// MAIN // + +var obj = property2object( 'labelAngle' ); + + +// EXPORTS // + +module.exports = obj; diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/label-angle/set.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/label-angle/set.js new file mode 100644 index 000000000000..10205c10a0cd --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/label-angle/set.js @@ -0,0 +1,66 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable no-invalid-this */ + +'use strict'; + +// MODULES // + +var logger = require( 'debug' ); +var isNumber = require( '@stdlib/assert/is-number' ).isPrimitive; +var isUndefined = require( '@stdlib/assert/is-undefined' ); +var format = require( '@stdlib/string/format' ); +var changeEvent = require( './../change_event.js' ); +var prop = require( './properties.js' ); + + +// VARIABLES // + +var debug = logger( 'vega:axis:set:'+prop.name ); + + +// MAIN // + +/** +* Sets the angle (in degrees) of axis tick labels. +* +* ## Notes +* +* - Providing `undefined` "unsets" the configured value. +* +* @private +* @param {(number|void)} value - input value +* @throws {TypeError} must be a number +* @returns {void} +*/ +function set( value ) { + if ( !isNumber( value ) && !isUndefined( value ) ) { + throw new TypeError( format( 'invalid assignment. `%s` must be a number. Value: `%s`.', prop.name, value ) ); + } + if ( value !== this[ prop.private ] ) { + debug( 'Current value: %s. New value: %s.', this[ prop.private ], value ); + this[ prop.private ] = value; + this.emit( 'change', changeEvent( prop.name ) ); + } +} + + +// EXPORTS // + +module.exports = set; diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/label-baseline/get.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/label-baseline/get.js new file mode 100644 index 000000000000..4ee2bb3544a6 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/label-baseline/get.js @@ -0,0 +1,43 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable no-invalid-this */ + +'use strict'; + +// MODULES // + +var prop = require( './properties.js' ); + + +// MAIN // + +/** +* Returns the vertical baseline of axis tick labels. +* +* @private +* @returns {string} vertical baseline +*/ +function get() { + return this[ prop.private ]; +} + + +// EXPORTS // + +module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/label-baseline/properties.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/label-baseline/properties.js new file mode 100644 index 000000000000..9fddd87722a2 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/label-baseline/properties.js @@ -0,0 +1,33 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var property2object = require( '@stdlib/plot/vega/base/property2object' ); + + +// MAIN // + +var obj = property2object( 'labelBaseline' ); + + +// EXPORTS // + +module.exports = obj; diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/label-baseline/set.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/label-baseline/set.js new file mode 100644 index 000000000000..949e6396a1b6 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/label-baseline/set.js @@ -0,0 +1,63 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable no-invalid-this */ + +'use strict'; + +// MODULES // + +var logger = require( 'debug' ); +var isVerticalBaseline = require( '@stdlib/plot/vega/base/assert/is-vertical-baseline' ); +var join = require( '@stdlib/array/base/join' ); +var verticalBaselines = require( '@stdlib/plot/vega/base/vertical-baselines' ); +var format = require( '@stdlib/string/format' ); +var changeEvent = require( './../change_event.js' ); +var prop = require( './properties.js' ); + + +// VARIABLES // + +var debug = logger( 'vega:axis:set:'+prop.name ); + + +// MAIN // + +/** +* Sets the vertical baseline position of axis tick labels. +* +* @private +* @param {string} value - input value +* @throws {TypeError} must be a valid vertical baseline +* @returns {void} +*/ +function set( value ) { + if ( !isVerticalBaseline( value ) ) { + throw new TypeError( format( 'invalid assignment. `%s` must be one of the following: "%s". Value: `%s`.', prop.name, join( verticalBaselines(), '", "' ), value ) ); + } + if ( value !== this[ prop.private ] ) { + debug( 'Current value: %s. New value: %s.', this[ prop.private ], value ); + this[ prop.private ] = value; + this.emit( 'change', changeEvent( prop.name ) ); + } +} + + +// EXPORTS // + +module.exports = set; diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/label-bound/get.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/label-bound/get.js new file mode 100644 index 000000000000..daa83981016e --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/label-bound/get.js @@ -0,0 +1,43 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable no-invalid-this */ + +'use strict'; + +// MODULES // + +var prop = require( './properties.js' ); + + +// MAIN // + +/** +* Returns a setting indicating whether axis tick labels should be hidden if they exceed the axis range. +* +* @private +* @returns {(boolean|number)} value +*/ +function get() { + return this[ prop.private ]; +} + + +// EXPORTS // + +module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/label-bound/properties.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/label-bound/properties.js new file mode 100644 index 000000000000..7c8adf15a162 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/label-bound/properties.js @@ -0,0 +1,33 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var property2object = require( '@stdlib/plot/vega/base/property2object' ); + + +// MAIN // + +var obj = property2object( 'labelBound' ); + + +// EXPORTS // + +module.exports = obj; diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/label-bound/set.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/label-bound/set.js new file mode 100644 index 000000000000..ea6368679dd4 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/label-bound/set.js @@ -0,0 +1,62 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable no-invalid-this */ + +'use strict'; + +// MODULES // + +var logger = require( 'debug' ); +var isBoolean = require( '@stdlib/assert/is-boolean' ).isPrimitive; +var isNumber = require( '@stdlib/assert/is-number' ).isPrimitive; +var format = require( '@stdlib/string/format' ); +var changeEvent = require( './../change_event.js' ); +var prop = require( './properties.js' ); + + +// VARIABLES // + +var debug = logger( 'vega:axis:set:'+prop.name ); + + +// MAIN // + +/** +* Sets a setting indicating whether axis tick labels should be hidden if they exceed the axis range. +* +* @private +* @param {(boolean|number)} value - input value +* @throws {TypeError} must be a boolean or number +* @returns {void} +*/ +function set( value ) { + if ( !isBoolean( value ) && !isNumber( value ) ) { + throw new TypeError( format( 'invalid assignment. `%s` must be a boolean or number. Value: `%s`.', prop.name, value ) ); + } + if ( value !== this[ prop.private ] ) { + debug( 'Current value: %s. New value: %s.', this[ prop.private ], value ); + this[ prop.private ] = value; + this.emit( 'change', changeEvent( prop.name ) ); + } +} + + +// EXPORTS // + +module.exports = set; diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/label-color/get.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/label-color/get.js new file mode 100644 index 000000000000..b4b539ae6d35 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/label-color/get.js @@ -0,0 +1,43 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable no-invalid-this */ + +'use strict'; + +// MODULES // + +var prop = require( './properties.js' ); + + +// MAIN // + +/** +* Returns the color of axis tick labels. +* +* @private +* @returns {(void|string)} color string +*/ +function get() { + return this[ prop.private ]; +} + + +// EXPORTS // + +module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/label-color/properties.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/label-color/properties.js new file mode 100644 index 000000000000..2eee47acfac3 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/label-color/properties.js @@ -0,0 +1,33 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var property2object = require( '@stdlib/plot/vega/base/property2object' ); + + +// MAIN // + +var obj = property2object( 'labelColor' ); + + +// EXPORTS // + +module.exports = obj; diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/label-color/set.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/label-color/set.js new file mode 100644 index 000000000000..037731ec3d47 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/label-color/set.js @@ -0,0 +1,66 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable no-invalid-this */ + +'use strict'; + +// MODULES // + +var logger = require( 'debug' ); +var isString = require( '@stdlib/assert/is-string' ).isPrimitive; +var isUndefined = require( '@stdlib/assert/is-undefined' ); +var format = require( '@stdlib/string/format' ); +var changeEvent = require( './../change_event.js' ); +var prop = require( './properties.js' ); + + +// VARIABLES // + +var debug = logger( 'vega:axis:set:'+prop.name ); + + +// MAIN // + +/** +* Sets the color of axis tick labels. +* +* ## Notes +* +* - Providing `undefined` "unsets" the configured value. +* +* @private +* @param {(string|void)} value - input value +* @throws {TypeError} must be a string +* @returns {void} +*/ +function set( value ) { + if ( !isString( value ) && !isUndefined( value ) ) { + throw new TypeError( format( 'invalid assignment. `%s` must be a string. Value: `%s`.', prop.name, value ) ); + } + if ( value !== this[ prop.private ] ) { + debug( 'Current value: %s. New value: %s.', this[ prop.private ], value ); + this[ prop.private ] = value; + this.emit( 'change', changeEvent( prop.name ) ); + } +} + + +// EXPORTS // + +module.exports = set; diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/label-flush-offset/get.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/label-flush-offset/get.js new file mode 100644 index 000000000000..aa3b7e90ecd9 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/label-flush-offset/get.js @@ -0,0 +1,43 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable no-invalid-this */ + +'use strict'; + +// MODULES // + +var prop = require( './properties.js' ); + + +// MAIN // + +/** +* Returns the number of pixels by which to offset flush-adjusted labels. +* +* @private +* @returns {number} pixel offset +*/ +function get() { + return this[ prop.private ]; +} + + +// EXPORTS // + +module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/label-flush-offset/properties.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/label-flush-offset/properties.js new file mode 100644 index 000000000000..9685d20d30b9 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/label-flush-offset/properties.js @@ -0,0 +1,33 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var property2object = require( '@stdlib/plot/vega/base/property2object' ); + + +// MAIN // + +var obj = property2object( 'labelFlushOffset' ); + + +// EXPORTS // + +module.exports = obj; diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/label-flush-offset/set.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/label-flush-offset/set.js new file mode 100644 index 000000000000..88c2261b08f3 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/label-flush-offset/set.js @@ -0,0 +1,61 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable no-invalid-this */ + +'use strict'; + +// MODULES // + +var logger = require( 'debug' ); +var isNumber = require( '@stdlib/assert/is-number' ).isPrimitive; +var format = require( '@stdlib/string/format' ); +var changeEvent = require( './../change_event.js' ); +var prop = require( './properties.js' ); + + +// VARIABLES // + +var debug = logger( 'vega:axis:set:'+prop.name ); + + +// MAIN // + +/** +* Sets the number of pixels by which to offset flush-adjusted labels. +* +* @private +* @param {number} value - input value +* @throws {TypeError} must be a number +* @returns {void} +*/ +function set( value ) { + if ( !isNumber( value ) ) { + throw new TypeError( format( 'invalid assignment. `%s` must be a number. Value: `%s`.', prop.name, value ) ); + } + if ( value !== this[ prop.private ] ) { + debug( 'Current value: %s. New value: %s.', this[ prop.private ], value ); + this[ prop.private ] = value; + this.emit( 'change', changeEvent( prop.name ) ); + } +} + + +// EXPORTS // + +module.exports = set; diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/label-flush/get.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/label-flush/get.js new file mode 100644 index 000000000000..b207ff50ebc6 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/label-flush/get.js @@ -0,0 +1,43 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable no-invalid-this */ + +'use strict'; + +// MODULES // + +var prop = require( './properties.js' ); + + +// MAIN // + +/** +* Returns a setting indicating whether axis tick labels at the beginning or end of the axis should be aligned flush with the scale range. +* +* @private +* @returns {(void|boolean|number)} value +*/ +function get() { + return this[ prop.private ]; +} + + +// EXPORTS // + +module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/label-flush/properties.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/label-flush/properties.js new file mode 100644 index 000000000000..0e49117cd921 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/label-flush/properties.js @@ -0,0 +1,33 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var property2object = require( '@stdlib/plot/vega/base/property2object' ); + + +// MAIN // + +var obj = property2object( 'labelFlush' ); + + +// EXPORTS // + +module.exports = obj; diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/label-flush/set.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/label-flush/set.js new file mode 100644 index 000000000000..567b68507829 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/label-flush/set.js @@ -0,0 +1,67 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable no-invalid-this */ + +'use strict'; + +// MODULES // + +var logger = require( 'debug' ); +var isBoolean = require( '@stdlib/assert/is-boolean' ).isPrimitive; +var isNumber = require( '@stdlib/assert/is-number' ).isPrimitive; +var isUndefined = require( '@stdlib/assert/is-undefined' ); +var format = require( '@stdlib/string/format' ); +var changeEvent = require( './../change_event.js' ); +var prop = require( './properties.js' ); + + +// VARIABLES // + +var debug = logger( 'vega:axis:set:'+prop.name ); + + +// MAIN // + +/** +* Sets a setting indicating whether axis tick labels at the beginning or end of the axis should be aligned flush with the scale range. +* +* ## Notes +* +* - Providing `undefined` "unsets" the configured value. +* +* @private +* @param {(boolean|number|void)} value - input value +* @throws {TypeError} must be a boolean or number +* @returns {void} +*/ +function set( value ) { + if ( !isBoolean( value ) && !isNumber( value ) && !isUndefined( value ) ) { + throw new TypeError( format( 'invalid assignment. `%s` must be a boolean or number. Value: `%s`.', prop.name, value ) ); + } + if ( value !== this[ prop.private ] ) { + debug( 'Current value: %s. New value: %s.', this[ prop.private ], value ); + this[ prop.private ] = value; + this.emit( 'change', changeEvent( prop.name ) ); + } +} + + +// EXPORTS // + +module.exports = set; diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/label-font-size/get.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/label-font-size/get.js new file mode 100644 index 000000000000..3f3547093b37 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/label-font-size/get.js @@ -0,0 +1,43 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable no-invalid-this */ + +'use strict'; + +// MODULES // + +var prop = require( './properties.js' ); + + +// MAIN // + +/** +* Returns the font size (in pixels) of axis tick labels. +* +* @private +* @returns {(number|void)} font size +*/ +function get() { + return this[ prop.private ]; +} + + +// EXPORTS // + +module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/label-font-size/properties.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/label-font-size/properties.js new file mode 100644 index 000000000000..35ba1e647eb7 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/label-font-size/properties.js @@ -0,0 +1,33 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var property2object = require( '@stdlib/plot/vega/base/property2object' ); + + +// MAIN // + +var obj = property2object( 'labelFontSize' ); + + +// EXPORTS // + +module.exports = obj; diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/label-font-size/set.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/label-font-size/set.js new file mode 100644 index 000000000000..0e1a30daee5e --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/label-font-size/set.js @@ -0,0 +1,66 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable no-invalid-this */ + +'use strict'; + +// MODULES // + +var logger = require( 'debug' ); +var isNumber = require( '@stdlib/assert/is-number' ).isPrimitive; +var isUndefined = require( '@stdlib/assert/is-undefined' ); +var format = require( '@stdlib/string/format' ); +var changeEvent = require( './../change_event.js' ); +var prop = require( './properties.js' ); + + +// VARIABLES // + +var debug = logger( 'vega:axis:set:'+prop.name ); + + +// MAIN // + +/** +* Sets the font size (in pixels) of axis tick labels. +* +* ## Notes +* +* - Providing `undefined` "unsets" the configured value. +* +* @private +* @param {(number|void)} value - input value +* @throws {TypeError} must be a number +* @returns {void} +*/ +function set( value ) { + if ( !isNumber( value ) && !isUndefined( value ) ) { + throw new TypeError( format( 'invalid assignment. `%s` must be a number. Value: `%s`.', prop.name, value ) ); + } + if ( value !== this[ prop.private ] ) { + debug( 'Current value: %s. New value: %s.', this[ prop.private ], value ); + this[ prop.private ] = value; + this.emit( 'change', changeEvent( prop.name ) ); + } +} + + +// EXPORTS // + +module.exports = set; diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/label-font-style/get.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/label-font-style/get.js new file mode 100644 index 000000000000..baded5b9085f --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/label-font-style/get.js @@ -0,0 +1,43 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable no-invalid-this */ + +'use strict'; + +// MODULES // + +var prop = require( './properties.js' ); + + +// MAIN // + +/** +* Returns the font style of axis tick labels. +* +* @private +* @returns {(string|void)} font style +*/ +function get() { + return this[ prop.private ]; +} + + +// EXPORTS // + +module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/label-font-style/properties.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/label-font-style/properties.js new file mode 100644 index 000000000000..2af0062002e1 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/label-font-style/properties.js @@ -0,0 +1,33 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var property2object = require( '@stdlib/plot/vega/base/property2object' ); + + +// MAIN // + +var obj = property2object( 'labelFontStyle' ); + + +// EXPORTS // + +module.exports = obj; diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/label-font-style/set.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/label-font-style/set.js new file mode 100644 index 000000000000..31c67c4a881f --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/label-font-style/set.js @@ -0,0 +1,66 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable no-invalid-this */ + +'use strict'; + +// MODULES // + +var logger = require( 'debug' ); +var isString = require( '@stdlib/assert/is-string' ).isPrimitive; +var isUndefined = require( '@stdlib/assert/is-undefined' ); +var format = require( '@stdlib/string/format' ); +var changeEvent = require( './../change_event.js' ); +var prop = require( './properties.js' ); + + +// VARIABLES // + +var debug = logger( 'vega:axis:set:'+prop.name ); + + +// MAIN // + +/** +* Sets the font style of axis tick labels. +* +* ## Notes +* +* - Providing `undefined` "unsets" the configured value. +* +* @private +* @param {(string|void)} value - input value +* @throws {TypeError} must be a string +* @returns {void} +*/ +function set( value ) { + if ( !isString( value ) && !isUndefined( value ) ) { + throw new TypeError( format( 'invalid assignment. `%s` must be a string. Value: `%s`.', prop.name, value ) ); + } + if ( value !== this[ prop.private ] ) { + debug( 'Current value: %s. New value: %s.', this[ prop.private ], value ); + this[ prop.private ] = value; + this.emit( 'change', changeEvent( prop.name ) ); + } +} + + +// EXPORTS // + +module.exports = set; diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/label-font-weight/get.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/label-font-weight/get.js new file mode 100644 index 000000000000..ee9068d1b8f1 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/label-font-weight/get.js @@ -0,0 +1,43 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable no-invalid-this */ + +'use strict'; + +// MODULES // + +var prop = require( './properties.js' ); + + +// MAIN // + +/** +* Returns the font weight of axis tick labels. +* +* @private +* @returns {(number|string|void)} font weight +*/ +function get() { + return this[ prop.private ]; +} + + +// EXPORTS // + +module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/label-font-weight/properties.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/label-font-weight/properties.js new file mode 100644 index 000000000000..d77bc78a6fda --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/label-font-weight/properties.js @@ -0,0 +1,33 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var property2object = require( '@stdlib/plot/vega/base/property2object' ); + + +// MAIN // + +var obj = property2object( 'labelFontWeight' ); + + +// EXPORTS // + +module.exports = obj; diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/label-font-weight/set.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/label-font-weight/set.js new file mode 100644 index 000000000000..2363fcea1e5d --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/label-font-weight/set.js @@ -0,0 +1,67 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable no-invalid-this */ + +'use strict'; + +// MODULES // + +var logger = require( 'debug' ); +var isNumber = require( '@stdlib/assert/is-number' ).isPrimitive; +var isString = require( '@stdlib/assert/is-string' ).isPrimitive; +var isUndefined = require( '@stdlib/assert/is-undefined' ); +var format = require( '@stdlib/string/format' ); +var changeEvent = require( './../change_event.js' ); +var prop = require( './properties.js' ); + + +// VARIABLES // + +var debug = logger( 'vega:axis:set:'+prop.name ); + + +// MAIN // + +/** +* Sets the font weight of axis tick labels. +* +* ## Notes +* +* - Providing `undefined` "unsets" the configured value. +* +* @private +* @param {(number|string|void)} value - input value +* @throws {TypeError} must be a number or string +* @returns {void} +*/ +function set( value ) { + if ( !isNumber( value ) && !isString( value ) && !isUndefined( value ) ) { + throw new TypeError( format( 'invalid assignment. `%s` must be a number or string. Value: `%s`.', prop.name, value ) ); + } + if ( value !== this[ prop.private ] ) { + debug( 'Current value: %s. New value: %s.', this[ prop.private ], value ); + this[ prop.private ] = value; + this.emit( 'change', changeEvent( prop.name ) ); + } +} + + +// EXPORTS // + +module.exports = set; diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/label-font/get.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/label-font/get.js new file mode 100644 index 000000000000..fc569976f27e --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/label-font/get.js @@ -0,0 +1,43 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable no-invalid-this */ + +'use strict'; + +// MODULES // + +var prop = require( './properties.js' ); + + +// MAIN // + +/** +* Returns the font name for axis tick labels. +* +* @private +* @returns {(string|void)} font name +*/ +function get() { + return this[ prop.private ]; +} + + +// EXPORTS // + +module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/label-font/properties.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/label-font/properties.js new file mode 100644 index 000000000000..44988050dae6 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/label-font/properties.js @@ -0,0 +1,33 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var property2object = require( '@stdlib/plot/vega/base/property2object' ); + + +// MAIN // + +var obj = property2object( 'labelFont' ); + + +// EXPORTS // + +module.exports = obj; diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/label-font/set.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/label-font/set.js new file mode 100644 index 000000000000..786526f61750 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/label-font/set.js @@ -0,0 +1,66 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable no-invalid-this */ + +'use strict'; + +// MODULES // + +var logger = require( 'debug' ); +var isString = require( '@stdlib/assert/is-string' ).isPrimitive; +var isUndefined = require( '@stdlib/assert/is-undefined' ); +var format = require( '@stdlib/string/format' ); +var changeEvent = require( './../change_event.js' ); +var prop = require( './properties.js' ); + + +// VARIABLES // + +var debug = logger( 'vega:axis:set:'+prop.name ); + + +// MAIN // + +/** +* Sets the font name for axis tick labels. +* +* ## Notes +* +* - Providing `undefined` "unsets" the configured value. +* +* @private +* @param {(string|void)} value - input value +* @throws {TypeError} must be a string +* @returns {void} +*/ +function set( value ) { + if ( !isString( value ) && !isUndefined( value ) ) { + throw new TypeError( format( 'invalid assignment. `%s` must be a string. Value: `%s`.', prop.name, value ) ); + } + if ( value !== this[ prop.private ] ) { + debug( 'Current value: %s. New value: %s.', this[ prop.private ], value ); + this[ prop.private ] = value; + this.emit( 'change', changeEvent( prop.name ) ); + } +} + + +// EXPORTS // + +module.exports = set; diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/label-limit/get.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/label-limit/get.js new file mode 100644 index 000000000000..86850900cb32 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/label-limit/get.js @@ -0,0 +1,43 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable no-invalid-this */ + +'use strict'; + +// MODULES // + +var prop = require( './properties.js' ); + + +// MAIN // + +/** +* Returns the maximum allowed length (in pixels) of axis tick labels. +* +* @private +* @returns {(void|NonNegativeNumber)} maximum allowed length +*/ +function get() { + return this[ prop.private ]; +} + + +// EXPORTS // + +module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/label-limit/properties.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/label-limit/properties.js new file mode 100644 index 000000000000..4e92e5c63e8d --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/label-limit/properties.js @@ -0,0 +1,33 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var property2object = require( '@stdlib/plot/vega/base/property2object' ); + + +// MAIN // + +var obj = property2object( 'labelLimit' ); + + +// EXPORTS // + +module.exports = obj; diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/label-limit/set.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/label-limit/set.js new file mode 100644 index 000000000000..2fbe9cf4b93f --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/label-limit/set.js @@ -0,0 +1,66 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable no-invalid-this */ + +'use strict'; + +// MODULES // + +var logger = require( 'debug' ); +var isNonNegativeNumber = require( '@stdlib/assert/is-nonnegative-number' ).isPrimitive; +var isUndefined = require( '@stdlib/assert/is-undefined' ); +var format = require( '@stdlib/string/format' ); +var changeEvent = require( './../change_event.js' ); +var prop = require( './properties.js' ); + + +// VARIABLES // + +var debug = logger( 'vega:axis:set:'+prop.name ); + + +// MAIN // + +/** +* Sets the maximum allowed length (in pixels) of axis tick labels. +* +* ## Notes +* +* - Providing `undefined` "unsets" the configured value. +* +* @private +* @param {(NonNegativeNumber|void)} value - input value +* @throws {TypeError} must be a nonnegative number +* @returns {void} +*/ +function set( value ) { + if ( !isNonNegativeNumber( value ) && !isUndefined( value ) ) { + throw new TypeError( format( 'invalid assignment. `%s` must be a nonnegative number. Value: `%s`.', prop.name, value ) ); + } + if ( value !== this[ prop.private ] ) { + debug( 'Current value: %s. New value: %s.', this[ prop.private ], value ); + this[ prop.private ] = value; + this.emit( 'change', changeEvent( prop.name ) ); + } +} + + +// EXPORTS // + +module.exports = set; diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/label-line-height/get.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/label-line-height/get.js new file mode 100644 index 000000000000..3493a54a6197 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/label-line-height/get.js @@ -0,0 +1,43 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable no-invalid-this */ + +'use strict'; + +// MODULES // + +var prop = require( './properties.js' ); + + +// MAIN // + +/** +* Returns the line height (in pixels) for multi-line axis tick label text or axis tick label text with "line-top" or "line-bottom" baseline. +* +* @private +* @returns {(number|void)} line height +*/ +function get() { + return this[ prop.private ]; +} + + +// EXPORTS // + +module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/label-line-height/properties.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/label-line-height/properties.js new file mode 100644 index 000000000000..4ad67bf6edc0 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/label-line-height/properties.js @@ -0,0 +1,33 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var property2object = require( '@stdlib/plot/vega/base/property2object' ); + + +// MAIN // + +var obj = property2object( 'labelLineHeight' ); + + +// EXPORTS // + +module.exports = obj; diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/label-line-height/set.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/label-line-height/set.js new file mode 100644 index 000000000000..44596cb0dcef --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/label-line-height/set.js @@ -0,0 +1,66 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable no-invalid-this */ + +'use strict'; + +// MODULES // + +var logger = require( 'debug' ); +var isNumber = require( '@stdlib/assert/is-number' ).isPrimitive; +var isUndefined = require( '@stdlib/assert/is-undefined' ); +var format = require( '@stdlib/string/format' ); +var changeEvent = require( './../change_event.js' ); +var prop = require( './properties.js' ); + + +// VARIABLES // + +var debug = logger( 'vega:axis:set:'+prop.name ); + + +// MAIN // + +/** +* Sets the line height (in pixels) for multi-line axis tick label text or axis tick label text with "line-top" or "line-bottom" baseline. +* +* ## Notes +* +* - Providing `undefined` "unsets" the configured value. +* +* @private +* @param {(number|void)} value - input value +* @throws {TypeError} must be a number +* @returns {void} +*/ +function set( value ) { + if ( !isNumber( value ) && !isUndefined( value ) ) { + throw new TypeError( format( 'invalid assignment. `%s` must be a number. Value: `%s`.', prop.name, value ) ); + } + if ( value !== this[ prop.private ] ) { + debug( 'Current value: %s. New value: %s.', this[ prop.private ], value ); + this[ prop.private ] = value; + this.emit( 'change', changeEvent( prop.name ) ); + } +} + + +// EXPORTS // + +module.exports = set; diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/label-offset/get.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/label-offset/get.js new file mode 100644 index 000000000000..6f8c11ffcb9b --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/label-offset/get.js @@ -0,0 +1,43 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable no-invalid-this */ + +'use strict'; + +// MODULES // + +var prop = require( './properties.js' ); + + +// MAIN // + +/** +* Returns the position offset (in pixels) to apply to labels in addition to `tickOffset`. +* +* @private +* @returns {(void|number)} position offset +*/ +function get() { + return this[ prop.private ]; +} + + +// EXPORTS // + +module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/label-offset/properties.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/label-offset/properties.js new file mode 100644 index 000000000000..3682089dc723 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/label-offset/properties.js @@ -0,0 +1,33 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var property2object = require( '@stdlib/plot/vega/base/property2object' ); + + +// MAIN // + +var obj = property2object( 'labelOffset' ); + + +// EXPORTS // + +module.exports = obj; diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/label-offset/set.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/label-offset/set.js new file mode 100644 index 000000000000..8d1943337b30 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/label-offset/set.js @@ -0,0 +1,66 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable no-invalid-this */ + +'use strict'; + +// MODULES // + +var logger = require( 'debug' ); +var isNumber = require( '@stdlib/assert/is-number' ).isPrimitive; +var isUndefined = require( '@stdlib/assert/is-undefined' ); +var format = require( '@stdlib/string/format' ); +var changeEvent = require( './../change_event.js' ); +var prop = require( './properties.js' ); + + +// VARIABLES // + +var debug = logger( 'vega:axis:set:'+prop.name ); + + +// MAIN // + +/** +* Sets the position offset (in pixels) to apply to labels in addition to `tickOffset`. +* +* ## Notes +* +* - Providing `undefined` "unsets" the configured value. +* +* @private +* @param {(number|void)} value - input value +* @throws {TypeError} must be a number +* @returns {void} +*/ +function set( value ) { + if ( !isNumber( value ) && !isUndefined( value ) ) { + throw new TypeError( format( 'invalid assignment. `%s` must be a number. Value: `%s`.', prop.name, value ) ); + } + if ( value !== this[ prop.private ] ) { + debug( 'Current value: %s. New value: %s.', this[ prop.private ], value ); + this[ prop.private ] = value; + this.emit( 'change', changeEvent( prop.name ) ); + } +} + + +// EXPORTS // + +module.exports = set; diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/label-opacity/get.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/label-opacity/get.js new file mode 100644 index 000000000000..36e31d879cbb --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/label-opacity/get.js @@ -0,0 +1,43 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable no-invalid-this */ + +'use strict'; + +// MODULES // + +var prop = require( './properties.js' ); + + +// MAIN // + +/** +* Returns the opacity of axis tick labels. +* +* @private +* @returns {number} opacity +*/ +function get() { + return this[ prop.private ]; +} + + +// EXPORTS // + +module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/label-opacity/properties.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/label-opacity/properties.js new file mode 100644 index 000000000000..dedf2f92d5bb --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/label-opacity/properties.js @@ -0,0 +1,33 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var property2object = require( '@stdlib/plot/vega/base/property2object' ); + + +// MAIN // + +var obj = property2object( 'labelOpacity' ); + + +// EXPORTS // + +module.exports = obj; diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/label-opacity/set.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/label-opacity/set.js new file mode 100644 index 000000000000..6bba5d146e68 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/label-opacity/set.js @@ -0,0 +1,61 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable no-invalid-this */ + +'use strict'; + +// MODULES // + +var logger = require( 'debug' ); +var isBetween = require( '@stdlib/assert/is-between' ); +var format = require( '@stdlib/string/format' ); +var changeEvent = require( './../change_event.js' ); +var prop = require( './properties.js' ); + + +// VARIABLES // + +var debug = logger( 'vega:axis:set:'+prop.name ); + + +// MAIN // + +/** +* Sets the opacity of axis tick labels. +* +* @private +* @param {number} value - input value +* @throws {TypeError} must be a number on the interval `[0, 1]` +* @returns {void} +*/ +function set( value ) { + if ( !isBetween( value, 0.0, 1.0 ) ) { + throw new TypeError( format( 'invalid assignment. `%s` must be on the interval: [0, 1]. Value: `%s`.', prop.name, value ) ); + } + if ( value !== this[ prop.private ] ) { + debug( 'Current value: %s. New value: %s.', this[ prop.private ], value ); + this[ prop.private ] = value; + this.emit( 'change', changeEvent( prop.name ) ); + } +} + + +// EXPORTS // + +module.exports = set; diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/label-overlap/get.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/label-overlap/get.js new file mode 100644 index 000000000000..b2462b141fa2 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/label-overlap/get.js @@ -0,0 +1,43 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable no-invalid-this */ + +'use strict'; + +// MODULES // + +var prop = require( './properties.js' ); + + +// MAIN // + +/** +* Returns the strategy to use for resolving overlapping axis tick labels. +* +* @private +* @returns {(boolean|string)} value +*/ +function get() { + return this[ prop.private ]; +} + + +// EXPORTS // + +module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/label-overlap/properties.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/label-overlap/properties.js new file mode 100644 index 000000000000..59dd92c1c564 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/label-overlap/properties.js @@ -0,0 +1,33 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var property2object = require( '@stdlib/plot/vega/base/property2object' ); + + +// MAIN // + +var obj = property2object( 'labelOverlap' ); + + +// EXPORTS // + +module.exports = obj; diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/label-overlap/set.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/label-overlap/set.js new file mode 100644 index 000000000000..d772e74d0527 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/label-overlap/set.js @@ -0,0 +1,68 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable no-invalid-this */ + +'use strict'; + +// MODULES // + +var logger = require( 'debug' ); +var isBoolean = require( '@stdlib/assert/is-boolean' ).isPrimitive; +var contains = require( '@stdlib/array/base/assert/contains' ).factory; +var join = require( '@stdlib/array/base/join' ); +var format = require( '@stdlib/string/format' ); +var changeEvent = require( './../change_event.js' ); +var prop = require( './properties.js' ); + + +// VARIABLES // + +var debug = logger( 'vega:axis:set:'+prop.name ); +var STRATEGIES = [ + 'parity', + 'greedy' +]; +var isStrategy = contains( STRATEGIES ); + + +// MAIN // + +/** +* Sets the strategy to use for resolving overlapping axis tick labels. +* +* @private +* @param {(boolean|string)} value - input value +* @throws {TypeError} must be a boolean or supported strategy +* @returns {void} +*/ +function set( value ) { + if ( !isBoolean( value ) && !isStrategy( value ) ) { + throw new TypeError( format( 'invalid assignment. `%s` must be a boolean or one of the following: "%s". Value: `%s`.', prop.name, join( STRATEGIES, '", "' ), value ) ); + } + if ( value !== this[ prop.private ] ) { + debug( 'Current value: %s. New value: %s.', this[ prop.private ], value ); + this[ prop.private ] = value; + this.emit( 'change', changeEvent( prop.name ) ); + } +} + + +// EXPORTS // + +module.exports = set; diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/label-padding/get.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/label-padding/get.js new file mode 100644 index 000000000000..f3e27e2d4a7c --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/label-padding/get.js @@ -0,0 +1,43 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable no-invalid-this */ + +'use strict'; + +// MODULES // + +var prop = require( './properties.js' ); + + +// MAIN // + +/** +* Returns the padding (in pixels) between axis ticks and tick labels. +* +* @private +* @returns {(number|void)} padding +*/ +function get() { + return this[ prop.private ]; +} + + +// EXPORTS // + +module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/label-padding/properties.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/label-padding/properties.js new file mode 100644 index 000000000000..9b67110d89e4 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/label-padding/properties.js @@ -0,0 +1,33 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var property2object = require( '@stdlib/plot/vega/base/property2object' ); + + +// MAIN // + +var obj = property2object( 'labelPadding' ); + + +// EXPORTS // + +module.exports = obj; diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/label-padding/set.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/label-padding/set.js new file mode 100644 index 000000000000..b35d48f64ea1 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/label-padding/set.js @@ -0,0 +1,66 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable no-invalid-this */ + +'use strict'; + +// MODULES // + +var logger = require( 'debug' ); +var isNumber = require( '@stdlib/assert/is-number' ).isPrimitive; +var isUndefined = require( '@stdlib/assert/is-undefined' ); +var format = require( '@stdlib/string/format' ); +var changeEvent = require( './../change_event.js' ); +var prop = require( './properties.js' ); + + +// VARIABLES // + +var debug = logger( 'vega:title:set:'+prop.name ); + + +// MAIN // + +/** +* Sets the padding (in pixels) between axis ticks and tick labels. +* +* ## Notes +* +* - Providing `undefined` "unsets" the configured value. +* +* @private +* @param {(number|void)} value - input value +* @throws {TypeError} must be a number +* @returns {void} +*/ +function set( value ) { + if ( !isNumber( value ) && !isUndefined( value ) ) { + throw new TypeError( format( 'invalid assignment. `%s` must be a number. Value: `%s`.', prop.name, value ) ); + } + if ( value !== this[ prop.private ] ) { + debug( 'Current value: %s. New value: %s.', this[ prop.private ], value ); + this[ prop.private ] = value; + this.emit( 'change', changeEvent( prop.name ) ); + } +} + + +// EXPORTS // + +module.exports = set; diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/label-separation/get.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/label-separation/get.js new file mode 100644 index 000000000000..7f2f0041c717 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/label-separation/get.js @@ -0,0 +1,43 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable no-invalid-this */ + +'use strict'; + +// MODULES // + +var prop = require( './properties.js' ); + + +// MAIN // + +/** +* Returns the minimum separation (in pixels) between axis tick label bounding boxes for them to be considered non-overlapping. +* +* @private +* @returns {NonNegativeNumber} minimum separation +*/ +function get() { + return this[ prop.private ]; +} + + +// EXPORTS // + +module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/label-separation/properties.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/label-separation/properties.js new file mode 100644 index 000000000000..38db20094353 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/label-separation/properties.js @@ -0,0 +1,33 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var property2object = require( '@stdlib/plot/vega/base/property2object' ); + + +// MAIN // + +var obj = property2object( 'labelSeparation' ); + + +// EXPORTS // + +module.exports = obj; diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/label-separation/set.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/label-separation/set.js new file mode 100644 index 000000000000..340184ede67d --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/label-separation/set.js @@ -0,0 +1,61 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable no-invalid-this */ + +'use strict'; + +// MODULES // + +var logger = require( 'debug' ); +var isNonNegativeNumber = require( '@stdlib/assert/is-nonnegative-number' ).isPrimitive; +var format = require( '@stdlib/string/format' ); +var changeEvent = require( './../change_event.js' ); +var prop = require( './properties.js' ); + + +// VARIABLES // + +var debug = logger( 'vega:axis:set:'+prop.name ); + + +// MAIN // + +/** +* Sets the minimum separation (in pixels) between axis tick label bounding boxes for them to be considered non-overlapping. +* +* @private +* @param {(NonNegativeNumber|void)} value - input value +* @throws {TypeError} must be a nonnegative number +* @returns {void} +*/ +function set( value ) { + if ( !isNonNegativeNumber( value ) ) { + throw new TypeError( format( 'invalid assignment. `%s` must be a nonnegative number. Value: `%s`.', prop.name, value ) ); + } + if ( value !== this[ prop.private ] ) { + debug( 'Current value: %s. New value: %s.', this[ prop.private ], value ); + this[ prop.private ] = value; + this.emit( 'change', changeEvent( prop.name ) ); + } +} + + +// EXPORTS // + +module.exports = set; diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/labels/get.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/labels/get.js new file mode 100644 index 000000000000..5d227d513a4b --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/labels/get.js @@ -0,0 +1,43 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable no-invalid-this */ + +'use strict'; + +// MODULES // + +var prop = require( './properties.js' ); + + +// MAIN // + +/** +* Returns a boolean indicating whether axis tick labels should be included as part of the axis. +* +* @private +* @returns {boolean} boolean flag +*/ +function get() { + return this[ prop.private ]; +} + + +// EXPORTS // + +module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/labels/properties.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/labels/properties.js new file mode 100644 index 000000000000..9709d425d345 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/labels/properties.js @@ -0,0 +1,33 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var property2object = require( '@stdlib/plot/vega/base/property2object' ); + + +// MAIN // + +var obj = property2object( 'labels' ); + + +// EXPORTS // + +module.exports = obj; diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/labels/set.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/labels/set.js new file mode 100644 index 000000000000..0238f95a364e --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/labels/set.js @@ -0,0 +1,61 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable no-invalid-this */ + +'use strict'; + +// MODULES // + +var logger = require( 'debug' ); +var isBoolean = require( '@stdlib/assert/is-boolean' ).isPrimitive; +var format = require( '@stdlib/string/format' ); +var changeEvent = require( './../change_event.js' ); +var prop = require( './properties.js' ); + + +// VARIABLES // + +var debug = logger( 'vega:axis:set:'+prop.name ); + + +// MAIN // + +/** +* Sets a boolean flag indicating whether axis tick labels should be included as part of the axis. +* +* @private +* @param {boolean} value - input value +* @throws {TypeError} must be a boolean +* @returns {void} +*/ +function set( value ) { + if ( !isBoolean( value ) ) { + throw new TypeError( format( 'invalid assignment. `%s` must be a boolean. Value: `%s`.', prop.name, value ) ); + } + if ( value !== this[ prop.private ] ) { + debug( 'Current value: %s. New value: %s.', this[ prop.private ], value ); + this[ prop.private ] = value; + this.emit( 'change', changeEvent( prop.name ) ); + } +} + + +// EXPORTS // + +module.exports = set; diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/main.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/main.js new file mode 100644 index 000000000000..9253d8c5eee9 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/main.js @@ -0,0 +1,1126 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable no-restricted-syntax, no-invalid-this */ + +'use strict'; + +// MODULES // + +var EventEmitter = require( 'events' ).EventEmitter; +var logger = require( 'debug' ); +var isObject = require( '@stdlib/assert/is-object' ); +var setNonEnumerableReadOnly = require( '@stdlib/utils/define-nonenumerable-read-only-property' ); +var setNonEnumerableReadOnlyAccessor = require( '@stdlib/utils/define-nonenumerable-read-only-accessor' ); // eslint-disable-line id-length +var setReadWriteAccessor = require( '@stdlib/utils/define-read-write-accessor' ); +var hasProp = require( '@stdlib/assert/has-property' ); +var inherit = require( '@stdlib/utils/inherit' ); +var objectKeys = require( '@stdlib/utils/keys' ); +var instance2json = require( '@stdlib/plot/vega/base/to-json' ); +var transformErrorMessage = require( '@stdlib/plot/vega/base/transform-validation-message' ); +var format = require( '@stdlib/string/format' ); +var properties = require( './properties.json' ); +var defaults = require( './defaults.js' ); + +// Note: keep the following in alphabetical order according to the `require` path... +var getARIA = require( './aria/get.js' ); +var setARIA = require( './aria/set.js' ); + +var getBandPosition = require( './band-position/get.js' ); +var setBandPosition = require( './band-position/set.js' ); + +var getDescription = require( './description/get.js' ); +var setDescription = require( './description/set.js' ); + +var getDomain = require( './domain/get.js' ); +var setDomain = require( './domain/set.js' ); +var getDomainCap = require( './domain-cap/get.js' ); +var setDomainCap = require( './domain-cap/set.js' ); +var getDomainColor = require( './domain-color/get.js' ); +var setDomainColor = require( './domain-color/set.js' ); +var getDomainDash = require( './domain-dash/get.js' ); +var setDomainDash = require( './domain-dash/set.js' ); +var getDomainDashOffset = require( './domain-dash-offset/get.js' ); +var setDomainDashOffset = require( './domain-dash-offset/set.js' ); +var getDomainOpacity = require( './domain-opacity/get.js' ); +var setDomainOpacity = require( './domain-opacity/set.js' ); +var getDomainWidth = require( './domain-width/get.js' ); +var setDomainWidth = require( './domain-width/set.js' ); + +var getGrid = require( './grid/get.js' ); +var setGrid = require( './grid/set.js' ); +var getGridCap = require( './grid-cap/get.js' ); +var setGridCap = require( './grid-cap/set.js' ); +var getGridColor = require( './grid-color/get.js' ); +var setGridColor = require( './grid-color/set.js' ); +var getGridDash = require( './grid-dash/get.js' ); +var setGridDash = require( './grid-dash/set.js' ); +var getGridDashOffset = require( './grid-dash-offset/get.js' ); +var setGridDashOffset = require( './grid-dash-offset/set.js' ); +var getGridOpacity = require( './grid-opacity/get.js' ); +var setGridOpacity = require( './grid-opacity/set.js' ); +var getGridScale = require( './grid-scale/get.js' ); +var setGridScale = require( './grid-scale/set.js' ); +var getGridWidth = require( './grid-width/get.js' ); +var setGridWidth = require( './grid-width/set.js' ); + +var getLabelAlign = require( './label-align/get.js' ); +var setLabelAlign = require( './label-align/set.js' ); +var getLabelAngle = require( './label-angle/get.js' ); +var setLabelAngle = require( './label-angle/set.js' ); +var getLabelBaseline = require( './label-baseline/get.js' ); +var setLabelBaseline = require( './label-baseline/set.js' ); +var getLabelBound = require( './label-bound/get.js' ); +var setLabelBound = require( './label-bound/set.js' ); +var getLabelColor = require( './label-color/get.js' ); +var setLabelColor = require( './label-color/set.js' ); +var getLabelFlush = require( './label-flush/get.js' ); +var setLabelFlush = require( './label-flush/set.js' ); +var getLabelFlushOffset = require( './label-flush-offset/get.js' ); +var setLabelFlushOffset = require( './label-flush-offset/set.js' ); +var getLabelFont = require( './label-font/get.js' ); +var setLabelFont = require( './label-font/set.js' ); +var getLabelFontSize = require( './label-font-size/get.js' ); +var setLabelFontSize = require( './label-font-size/set.js' ); +var getLabelFontStyle = require( './label-font-style/get.js' ); +var setLabelFontStyle = require( './label-font-style/set.js' ); +var getLabelFontWeight = require( './label-font-weight/get.js' ); +var setLabelFontWeight = require( './label-font-weight/set.js' ); +var getLabelLimit = require( './label-limit/get.js' ); +var setLabelLimit = require( './label-limit/set.js' ); +var getLabelLineHeight = require( './label-line-height/get.js' ); +var setLabelLineHeight = require( './label-line-height/set.js' ); +var getLabelOffset = require( './label-offset/get.js' ); +var setLabelOffset = require( './label-offset/set.js' ); +var getLabelOpacity = require( './label-opacity/get.js' ); +var setLabelOpacity = require( './label-opacity/set.js' ); +var getLabelOverlap = require( './label-overlap/get.js' ); +var setLabelOverlap = require( './label-overlap/set.js' ); +var getLabelPadding = require( './label-padding/get.js' ); +var setLabelPadding = require( './label-padding/set.js' ); +var getLabelSeparation = require( './label-separation/get.js' ); +var setLabelSeparation = require( './label-separation/set.js' ); +var getLabels = require( './labels/get.js' ); +var setLabels = require( './labels/set.js' ); + +var getOrient = require( './orient/get.js' ); +var setOrient = require( './orient/set.js' ); + +var getProperties = require( './properties/get.js' ); + +var getScale = require( './scale/get.js' ); +var setScale = require( './scale/set.js' ); + +var getTitle = require( './title/get.js' ); +var setTitle = require( './title/set.js' ); + + +// VARIABLES // + +var debug = logger( 'vega:axis:main' ); + + +// MAIN // + +/** +* Axis constructor. +* +* @constructor +* @param {Options} options - constructor options +* @param {string} options.scale - axis scale +* @param {string} options.orient - axis orientation +* @param {boolean} [options.aria=true] - boolean indicating whether ARIA attributes should be included in SVG output +* @param {number} [options.bandPosition] - an interpolation fraction indicating where axis ticks should be positioned when an axis has a band scale +* @param {string} [options.description=''] - axis description +* @param {boolean} [options.domain=true] - boolean indicating whether the axis baseline should be included as part of the axis +* @param {string} [options.domainCap='butt'] - stroke cap for axis domain line +* @param {string} [options.domainColor] - color of axis domain line as a CSS color string (e.g., `'#f304d3'`, `'#ccc'`, `'rgb(253, 12, 134)'`, `'steelblue'`, etc) +* @param {NumericArray} [options.domainDash=[]] - stroke dash for axis domain line, where `[]` corresponds to a solid line +* @param {number} [options.domainDashOffset] - pixel offset at which to start a domain line stroke dash +* @param {number} [options.domainOpacity=1] - opacity of axis domain line +* @param {number} [options.domainWidth] - stroke width of axis domain line +* @param {Object} [options.encode] - optional mark encodings for custom axis styling +* @param {(string|Object)} [options.format] - format specifier for axis tick labels +* @param {string} [options.formatType] - type of format to use for scales which do not have a strict domain data type +* @param {boolean} [options.grid=false] - boolean indicating whether grid lines should be included as part of the axis +* @param {string} [options.gridCap='butt'] - stroke cap for axis grid lines +* @param {string} [options.gridColor] - color of axis grid lines as a CSS color string (e.g., `'#f304d3'`, `'#ccc'`, `'rgb(253, 12, 134)'`, `'steelblue'`, etc) +* @param {NumericArray} [options.gridDash=[]] - stroke dash for axis grid lines, where `[]` corresponds to a solid line +* @param {number} [options.gridDashOffset] - pixel offset at which to start a grid line stroke dash +* @param {number} [options.gridOpacity=1] - opacity of an axis grid line +* @param {string} [options.gridScale] - scale to use for including axis grid lines +* @param {number} [options.gridWidth] - stroke width of an axis grid line +* @param {boolean} [options.labels=true] - boolean indicating whether axis tick labels should be included as part of the axis +* @param {string} [options.labelAlign] - horizontal text alignment of axis tick labels (overrides the default alignment based on the axis orientation) +* @param {number} [options.labelAngle] - angle (in degrees) of axis tick labels +* @param {string} [options.labelBaseline='alphabetic'] - vertical text baseline of axis tick labels (overrides the default baseline based on the axis orientation) +* @param {(boolean|number)} [options.labelBound=false] - specifies how axis tick labels should be hidden when they exceed an axis range +* @param {string} [options.labelColor] - color of axis tick label as a CSS color string (e.g., `'#f304d3'`, `'#ccc'`, `'rgb(253, 12, 134)'`, `'steelblue'`, etc) +* @param {(boolean|number)} [options.labelFlush] - specifies flush alignment of axis tick labels at the beginning or ending of an axis scale range +* @param {number} [options.labelFlushOffset=0] - number of pixels by which to offset flush-adjusted axis tick labels +* @param {string} [options.labelFont] - font name for axis tick labels +* @param {number} [options.labelFontSize] - font size of axis tick labels +* @param {string} [options.labelFontStyle] - font style of axis tick labels (e.g., `'normal'`, `'italic'`, etc) +* @param {(string|number)} [options.labelFontWeight] - font weight of axis tick labels +* @param {number} [options.labelLimit] - maximum allowed length in pixels of axis tick labels +* @param {number} [options.labelLineHeight] - line height (in pixels) for multi-line axis tick label text or axis tick label text with `'line-top'` or `'line-bottom'` baseline +* @param {number} [options.labelOffset] - position offset (in pixels) to apply to axis tick labels (in addition to `tickOffset`) +* @param {number} [options.labelOpacity=1] - axis tick label opacity +* @param {(boolean|string)} [options.labelOverlap=false] - strategy to use for resolving overlapping axis tick labels +* @param {number} [options.labelPadding] - padding (in pixels) between axis tick labels and tick marks +* @param {number} [options.labelSeparation=0] - minimum separation between axis tick label bounding boxes for them to be considered non-overlapping +* @param {(number|Object)} [options.maxExtent] - maximum extent (in pixels) that axis tick marks and tick labels should use +* @param {(number|Object)} [options.minExtent] - minimum extent (in pixels) that axis tick marks and tick labels should use +* @param {(number|Object)} [options.offset] - orthogonal offset (in pixels) by which to displace an axis from its position along the edge of a chart +* @param {(number|Object)} [options.position=0] - anchor position (in pixels) of an axis +* @param {boolean} [options.ticks=true] - boolean indicating whether axis tick marks should be included as part of an axis +* @param {string} [options.tickBand='center'] - type of axis tick style to use for an axis having a band scale +* @param {string} [options.tickCap='butt'] - stroke cap for axis tick marks +* @param {string} [options.tickColor] - color of axis tick marks as a CSS color string (e.g., `'#f304d3'`, `'#ccc'`, `'rgb(253, 12, 134)'`, `'steelblue'`, etc) +* @param {(number|string|Object)} [options.tickCount] - configuration for determining the number of axis tick marks +* @param {NumericArray} [options.tickDash=[]] - stroke dash for axis tick marks, where `[]` corresponds to a solid line +* @param {number} [options.tickDashOffset] - pixel offset at which to start an axis tick mark stroke dash +* @param {number} [options.tickMinStep] - minimum desired step between axis tick marks (in terms of scale domain values) +* @param {boolean} [options.tickExtra] - boolean indicating whether an extra axis tick should be added for the initial position of an axis +* @param {number} [options.tickOffset] - position offset (in pixels) to apply to axis tick marks, labels, and grid lines +* @param {number} [options.tickOpacity=1] - opacity of axis tick marks +* @param {boolean} [options.tickRound] - boolean indicating if pixel position values of axis ticks should be rounded to the nearest integer +* @param {number} [options.tickSize] - length (in pixels) of axis tick marks +* @param {number} [options.tickWidth] - width (in pixels) of axis tick marks +* @param {(string|Array<string>)} [options.title=['']] - axis title +* @param {(string|null)} [options.titleAnchor=null] - axis title anchor position +* @param {string} [options.titleAlign] - axis title horizontal text alignment +* @param {number} [options.titleAngle] - axis title angle (in degrees) +* @param {string} [options.titleBaseline='alphabetic'] - vertical baseline of axis title (overrides the default baseline based on the axis orientation) +* @param {string} [options.titleColor] - color of axis title as a CSS color string (e.g., `'#f304d3'`, `'#ccc'`, `'rgb(253, 12, 134)'`, `'steelblue'`, etc) +* @param {string} [options.titleFont] - axis title font name +* @param {number} [options.titleFontSize] - axis title font size +* @param {string} [options.titleFontStyle] - axis title font style (e.g., `'normal'`, `'italic'`, etc) +* @param {(string|number)} [options.titleFontWeight] - axis title font weight +* @param {number} [options.titleLimit] - maximum allowed length (in pixels) of axis title +* @param {number} [options.titleLineHeight] - line height (in pixels) for multi-line title text or for title text with `'line-top'` or `'line-bottom'` baseline +* @param {number} [options.titleOpacity=1] - axis title opacity +* @param {(number|Object)} [options.titlePadding] - padding (in pixels) between axis tick labels and the axis title +* @param {number} [options.titleX] - custom `x` position of the axis title relative to the axis group (overrides the standard layout) +* @param {number} [options.titleY] - custom `y` position of the axis title relative to the axis group (overrides the standard layout) +* @param {number} [options.translate=0.5] - axis layout coordinate space translation offset +* @param {Collection} [options.values] - explicit set of axis tick mark and label values +* @param {integer} [options.zindex=0] - integer z-index indicating the layering of the axis group relative to other axis, mark, and legend groups +* @throws {TypeError} options argument must be an object +* @throws {Error} must provide valid options +* @returns {Axis} axis instance +* +* @example +* var axis = new Axis({ +* 'scale': 'xScale', +* 'orient': 'bottom' +* }); +* // returns <Axis> +*/ +function Axis( options ) { + var opts; + var keys; + var v; + var k; + var i; + if ( !( this instanceof Axis ) ) { + return new Axis( options ); + } + EventEmitter.call( this ); + if ( !isObject( options ) ) { + throw new TypeError( format( 'invalid argument. Options argument must be an object. Value: `%s`.', options ) ); + } + // Resolve the default configuration: + opts = defaults(); + + // Set internal properties according to the default configuration... + keys = objectKeys( opts ); + for ( i = 0; i < keys.length; i++ ) { + k = keys[ i ]; + this[ '_'+k ] = opts[ k ]; + } + // Check for required properties... + if ( !hasProp( options, 'scale' ) ) { + throw new TypeError( 'invalid argument. Options argument must specify an axis scale.' ); + } + if ( !hasProp( options, 'orient' ) ) { + throw new TypeError( 'invalid argument. Options argument must specify an axis orientation.' ); + } + // Validate provided options by attempting to assign option values to corresponding fields... + for ( i = 0; i < properties.length; i++ ) { + k = properties[ i ]; + if ( !hasProp( options, k ) ) { + continue; + } + v = options[ k ]; + try { + this[ k ] = v; + } catch ( err ) { + debug( 'Encountered an error. Error: %s', err.message ); + + // FIXME: retain thrown error type + throw new Error( transformErrorMessage( err.message ) ); + } + } + return this; +} + +/* +* Inherit from the `EventEmitter` prototype. +*/ +inherit( Axis, EventEmitter ); + +/** +* Constructor name. +* +* @private +* @name name +* @memberof Axis +* @readonly +* @type {string} +*/ +setNonEnumerableReadOnly( Axis, 'name', 'Axis' ); + +/** +* Boolean indicating whether ARIA attributes should be included in SVG output. +* +* @name aria +* @memberof Axis.prototype +* @type {boolean} +* @default true +* +* @example +* var axis = new Axis({ +* 'scale': 'xScale', +* 'orient': 'bottom', +* 'aria': false +* }); +* +* var v = axis.aria; +* // returns false +*/ +setReadWriteAccessor( Axis.prototype, 'aria', getARIA, setARIA ); + +/** +* Interpolation fraction indicating where axis ticks should be positioned when an axis has a band scale. +* +* ## Notes +* +* - A value of `0` places ticks at the left edge of their bands. +* - A value of `0.5` places ticks in the middle of their bands. +* +* @name bandPosition +* @memberof Axis.prototype +* @type {(void|number)} +* @default 0.5 +* +* @example +* var axis = new Axis({ +* 'scale': 'xScale', +* 'orient': 'bottom', +* 'bandPosition': 0.5 +* }); +* +* var v = axis.bandPosition; +* // returns 0.5 +*/ +setReadWriteAccessor( Axis.prototype, 'bandPosition', getBandPosition, setBandPosition ); + +/** +* Axis description. +* +* @name description +* @memberof Axis.prototype +* @type {string} +* @default '' +* +* @example +* var axis = new Axis({ +* 'scale': 'xScale', +* 'orient': 'bottom', +* 'description': 'Foo Bar' +* }); +* +* var v = axis.description; +* // returns 'Foo Bar' +*/ +setReadWriteAccessor( Axis.prototype, 'description', getDescription, setDescription ); + +/** +* Boolean indicating whether the axis baseline should be included as part of an axis. +* +* @name domain +* @memberof Axis.prototype +* @type {boolean} +* @default true +* +* @example +* var axis = new Axis({ +* 'scale': 'xScale', +* 'orient': 'bottom', +* 'domain': false +* }); +* +* var v = axis.domain; +* // returns false +*/ +setReadWriteAccessor( Axis.prototype, 'domain', getDomain, setDomain ); + +/** +* Stroke cap for an axis domain line. +* +* @name domainCap +* @memberof Axis.prototype +* @type {string} +* @default 'butt' +* +* @example +* var axis = new Axis({ +* 'scale': 'xScale', +* 'orient': 'bottom', +* 'domainCap': 'square' +* }); +* +* var v = axis.domainCap; +* // returns 'square' +*/ +setReadWriteAccessor( Axis.prototype, 'domainCap', getDomainCap, setDomainCap ); + +/** +* Color of an axis domain line as a CSS color string. +* +* @name domainColor +* @memberof Axis.prototype +* @type {(void|string)} +* +* @example +* var axis = new Axis({ +* 'scale': 'xScale', +* 'orient': 'bottom', +* 'domainColor': 'steelblue' +* }); +* +* var v = axis.domainColor; +* // returns 'steelblue' +*/ +setReadWriteAccessor( Axis.prototype, 'domainColor', getDomainColor, setDomainColor ); + +/** +* Stroke dash for an axis domain line. +* +* @name domainDash +* @memberof Axis.prototype +* @type {Array} +* @default [] +* +* @example +* var axis = new Axis({ +* 'scale': 'xScale', +* 'orient': 'bottom', +* 'domainDash': [] +* }); +* +* var v = axis.domainDash; +* // returns [] +*/ +setReadWriteAccessor( Axis.prototype, 'domainDash', getDomainDash, setDomainDash ); + +/** +* Pixel offset at which to start an axis domain line dash array. +* +* @name domainDashOffset +* @memberof Axis.prototype +* @type {(void|number)} +* +* @example +* var axis = new Axis({ +* 'scale': 'xScale', +* 'orient': 'bottom', +* 'domainDashOffset': 1 +* }); +* +* var v = axis.domainDashOffset; +* // returns 1 +*/ +setReadWriteAccessor( Axis.prototype, 'domainDashOffset', getDomainDashOffset, setDomainDashOffset ); + +/** +* Opacity of an axis domain line. +* +* @name domainOpacity +* @memberof Axis.prototype +* @type {number} +* +* @example +* var axis = new Axis({ +* 'scale': 'xScale', +* 'orient': 'bottom', +* 'domainOpacity': 0.5 +* }); +* +* var v = axis.domainOpacity; +* // returns 0.5 +*/ +setReadWriteAccessor( Axis.prototype, 'domainOpacity', getDomainOpacity, setDomainOpacity ); + +/** +* Stroke width of an axis domain line. +* +* @name domainWidth +* @memberof Axis.prototype +* @type {(void|NonNegativeNumber)} +* +* @example +* var axis = new Axis({ +* 'scale': 'xScale', +* 'orient': 'bottom', +* 'domainWidth': 1 +* }); +* +* var v = axis.domainWidth; +* // returns 1 +*/ +setReadWriteAccessor( Axis.prototype, 'domainWidth', getDomainWidth, setDomainWidth ); + +/** +* Boolean indicating whether grid lines should be included as part of an axis. +* +* @name grid +* @memberof Axis.prototype +* @type {boolean} +* @default false +* +* @example +* var axis = new Axis({ +* 'scale': 'xScale', +* 'orient': 'bottom', +* 'grid': true +* }); +* +* var v = axis.grid; +* // returns true +*/ +setReadWriteAccessor( Axis.prototype, 'grid', getGrid, setGrid ); + +/** +* Stroke cap for axis grid lines. +* +* @name gridCap +* @memberof Axis.prototype +* @type {string} +* @default 'butt' +* +* @example +* var axis = new Axis({ +* 'scale': 'xScale', +* 'orient': 'bottom', +* 'gridCap': 'square' +* }); +* +* var v = axis.gridCap; +* // returns 'square' +*/ +setReadWriteAccessor( Axis.prototype, 'gridCap', getGridCap, setGridCap ); + +/** +* Color of axis grid lines as a CSS color string. +* +* @name gridColor +* @memberof Axis.prototype +* @type {(void|string)} +* +* @example +* var axis = new Axis({ +* 'scale': 'xScale', +* 'orient': 'bottom', +* 'gridColor': 'steelblue' +* }); +* +* var v = axis.gridColor; +* // returns 'steelblue' +*/ +setReadWriteAccessor( Axis.prototype, 'gridColor', getGridColor, setGridColor ); + +/** +* Stroke dash for axis grid lines. +* +* @name gridDash +* @memberof Axis.prototype +* @type {Array} +* @default [] +* +* @example +* var axis = new Axis({ +* 'scale': 'xScale', +* 'orient': 'bottom', +* 'gridDash': [] +* }); +* +* var v = axis.gridDash; +* // returns [] +*/ +setReadWriteAccessor( Axis.prototype, 'gridDash', getGridDash, setGridDash ); + +/** +* Pixel offset at which to start an axis grid line stroke dash. +* +* @name gridDashOffset +* @memberof Axis.prototype +* @type {(void|number)} +* +* @example +* var axis = new Axis({ +* 'scale': 'xScale', +* 'orient': 'bottom', +* 'gridDashOffset': 1 +* }); +* +* var v = axis.gridDashOffset; +* // returns 1 +*/ +setReadWriteAccessor( Axis.prototype, 'gridDashOffset', getGridDashOffset, setGridDashOffset ); + +/** +* Opacity of axis grid lines. +* +* @name gridOpacity +* @memberof Axis.prototype +* @type {number} +* @default 1 +* +* @example +* var axis = new Axis({ +* 'scale': 'xScale', +* 'orient': 'bottom', +* 'gridOpacity': 0.5 +* }); +* +* var v = axis.gridOpacity; +* // returns 0.5 +*/ +setReadWriteAccessor( Axis.prototype, 'gridOpacity', getGridOpacity, setGridOpacity ); + +/** +* Scale name to use for including axis grid lines. +* +* @name gridScale +* @memberof Axis.prototype +* @type {(void|string)} +* +* @example +* var axis = new Axis({ +* 'scale': 'xScale', +* 'orient': 'bottom', +* 'gridScale': 'xScale' +* }); +* +* var v = axis.gridScale; +* // returns 'xScale' +*/ +setReadWriteAccessor( Axis.prototype, 'gridScale', getGridScale, setGridScale ); + +/** +* Stroke width of axis grid lines. +* +* @name gridWidth +* @memberof Axis.prototype +* @type {(void|NonNegativeNumber)} +* +* @example +* var axis = new Axis({ +* 'scale': 'xScale', +* 'orient': 'bottom', +* 'gridWidth': 1 +* }); +* +* var v = axis.gridWidth; +* // returns 1 +*/ +setReadWriteAccessor( Axis.prototype, 'gridWidth', getGridWidth, setGridWidth ); + +/** +* Horizontal text alignment of axis tick labels. +* +* @name labelAlign +* @memberof Axis.prototype +* @type {(void|string)} +* +* @example +* var axis = new Axis({ +* 'scale': 'xScale', +* 'orient': 'bottom', +* 'labelAlign': 'left' +* }); +* +* var v = axis.labelAlign; +* // returns 'left' +*/ +setReadWriteAccessor( Axis.prototype, 'labelAlign', getLabelAlign, setLabelAlign ); + +/** +* Angle (in degrees) of axis tick labels. +* +* @name labelAngle +* @memberof Axis.prototype +* @type {(void|number)} +* +* @example +* var axis = new Axis({ +* 'scale': 'xScale', +* 'orient': 'bottom', +* 'labelAngle': 45 +* }); +* +* var v = axis.labelAngle; +* // returns 45 +*/ +setReadWriteAccessor( Axis.prototype, 'labelAngle', getLabelAngle, setLabelAngle ); + +/** +* Vertical baseline of axis tick labels. +* +* @name labelBaseline +* @memberof Axis.prototype +* @type {string} +* @default 'alphabetic' +* +* @example +* var axis = new Axis({ +* 'scale': 'xScale', +* 'orient': 'bottom', +* 'labelBaseline': 'middle' +* }); +* +* var v = axis.labelBaseline; +* // returns 'middle' +*/ +setReadWriteAccessor( Axis.prototype, 'labelBaseline', getLabelBaseline, setLabelBaseline ); + +/** +* Setting indicating whether axis tick labels should be hidden if they exceed the axis range. +* +* @name labelBound +* @memberof Axis.prototype +* @type {(boolean|number)} +* @default false +* +* @example +* var axis = new Axis({ +* 'scale': 'xScale', +* 'orient': 'bottom', +* 'labelBound': true +* }); +* +* var v = axis.labelBound; +* // returns true +*/ +setReadWriteAccessor( Axis.prototype, 'labelBound', getLabelBound, setLabelBound ); + +/** +* Color of axis tick labels. +* +* @name labelColor +* @memberof Axis.prototype +* @type {(void|string)} +* +* @example +* var axis = new Axis({ +* 'scale': 'xScale', +* 'orient': 'bottom', +* 'labelColor': 'steelblue' +* }); +* +* var v = axis.labelColor; +* // returns 'steelblue' +*/ +setReadWriteAccessor( Axis.prototype, 'labelColor', getLabelColor, setLabelColor ); + +/** +* Setting indicating whether axis tick labels at the beginning or end of the axis should be aligned flush with the scale range. +* +* @name labelFlush +* @memberof Axis.prototype +* @type {(void|boolean|number)} +* +* @example +* var axis = new Axis({ +* 'scale': 'xScale', +* 'orient': 'bottom', +* 'labelFlush': true +* }); +* +* var v = axis.labelFlush; +* // returns true +*/ +setReadWriteAccessor( Axis.prototype, 'labelFlush', getLabelFlush, setLabelFlush ); + +/** +* Number of pixels by which to offset flush-adjusted labels. +* +* @name labelFlushOffset +* @memberof Axis.prototype +* @type {number} +* @default 0 +* +* @example +* var axis = new Axis({ +* 'scale': 'xScale', +* 'orient': 'bottom', +* 'labelFlushOffset': 10 +* }); +* +* var v = axis.labelFlushOffset; +* // returns 10 +*/ +setReadWriteAccessor( Axis.prototype, 'labelFlushOffset', getLabelFlushOffset, setLabelFlushOffset ); + +/** +* Font name for axis tick labels. +* +* @name labelFont +* @memberof Axis.prototype +* @type {(string|void)} +* +* @example +* var axis = new Axis({ +* 'scale': 'xScale', +* 'orient': 'bottom', +* 'labelFont': 'arial' +* }); +* +* var v = axis.labelFont; +* // returns 'arial' +*/ +setReadWriteAccessor( Axis.prototype, 'labelFont', getLabelFont, setLabelFont ); + +/** +* Font size (in pixels) of axis tick labels. +* +* @name labelFontSize +* @memberof Axis.prototype +* @type {(number|void)} +* +* @example +* var axis = new Axis({ +* 'scale': 'xScale', +* 'orient': 'bottom', +* 'labelFontSize': 16 +* }); +* +* var v = axis.labelFontSize; +* // returns 16 +*/ +setReadWriteAccessor( Axis.prototype, 'labelFontSize', getLabelFontSize, setLabelFontSize ); + +/** +* Font style of axis tick labels. +* +* @name labelFontStyle +* @memberof Axis.prototype +* @type {(string|void)} +* +* @example +* var axis = new Axis({ +* 'scale': 'xScale', +* 'orient': 'bottom', +* 'labelFontStyle': 'italic' +* }); +* +* var v = axis.labelFontStyle; +* // returns 'italic' +*/ +setReadWriteAccessor( Axis.prototype, 'labelFontStyle', getLabelFontStyle, setLabelFontStyle ); + +/** +* Font weight of axis tick labels. +* +* @name labelFontWeight +* @memberof Axis.prototype +* @type {(string|number|void)} +* +* @example +* var axis = new Axis({ +* 'scale': 'xScale', +* 'orient': 'bottom', +* 'labelFontWeight': 'bold' +* }); +* +* var v = axis.labelFontWeight; +* // returns 'bold' +*/ +setReadWriteAccessor( Axis.prototype, 'labelFontWeight', getLabelFontWeight, setLabelFontWeight ); + +/** +* Maximum allowed length (in pixels) of axis tick labels. +* +* @name labelLimit +* @memberof Axis.prototype +* @type {(NonNegativeNumber|void)} +* +* @example +* var axis = new Axis({ +* 'scale': 'xScale', +* 'orient': 'bottom', +* 'labelLimit': 120 +* }); +* +* var v = axis.labelLimit; +* // returns 120 +*/ +setReadWriteAccessor( Axis.prototype, 'labelLimit', getLabelLimit, setLabelLimit ); + +/** +* Line height (in pixels) for multi-line axis tick label text or axis tick label text with "line-top" or "line-bottom" baseline. +* +* @name labelLineHeight +* @memberof Axis.prototype +* @type {(number|void)} +* +* @example +* var axis = new Axis({ +* 'scale': 'xScale', +* 'orient': 'bottom', +* 'labelLineHeight': 24 +* }); +* +* var v = axis.labelLineHeight; +* // returns 24 +*/ +setReadWriteAccessor( Axis.prototype, 'labelLineHeight', getLabelLineHeight, setLabelLineHeight ); + +/** +* Position offset (in pixels) to apply to labels in addition to `tickOffset`. +* +* @name labelOffset +* @memberof Axis.prototype +* @type {(number|void)} +* +* @example +* var axis = new Axis({ +* 'scale': 'xScale', +* 'orient': 'bottom', +* 'labelOffset': 10 +* }); +* +* var v = axis.labelOffset; +* // returns 10 +*/ +setReadWriteAccessor( Axis.prototype, 'labelOffset', getLabelOffset, setLabelOffset ); + +/** +* Opacity of axis tick labels. +* +* @name labelOpacity +* @memberof Axis.prototype +* @type {number} +* @default 1 +* +* @example +* var axis = new Axis({ +* 'scale': 'xScale', +* 'orient': 'bottom', +* 'labelOpacity': 0.5 +* }); +* +* var v = axis.labelOpacity; +* // returns 0.5 +*/ +setReadWriteAccessor( Axis.prototype, 'labelOpacity', getLabelOpacity, setLabelOpacity ); + +/** +* Strategy to use for resolving overlapping axis tick labels. +* +* @name labelOverlap +* @memberof Axis.prototype +* @type {(boolean|string)} +* @default false +* +* @example +* var axis = new Axis({ +* 'scale': 'xScale', +* 'orient': 'bottom', +* 'labelOverlap': true +* }); +* +* var v = axis.labelOverlap; +* // returns true +*/ +setReadWriteAccessor( Axis.prototype, 'labelOverlap', getLabelOverlap, setLabelOverlap ); + +/** +* Padding (in pixels) between axis ticks and tick labels. +* +* @name labelPadding +* @memberof Axis.prototype +* @type {(number|void)} +* +* @example +* var axis = new Axis({ +* 'scale': 'xScale', +* 'orient': 'bottom', +* 'labelPadding': 10 +* }); +* +* var v = axis.labelPadding; +* // returns 10 +*/ +setReadWriteAccessor( Axis.prototype, 'labelPadding', getLabelPadding, setLabelPadding ); + +/** +* Boolean indicating whether axis tick labels should be included as part of the axis. +* +* @name labels +* @memberof Axis.prototype +* @type {boolean} +* @default true +* +* @example +* var axis = new Axis({ +* 'scale': 'xScale', +* 'orient': 'bottom', +* 'labels': false +* }); +* +* var v = axis.labels; +* // returns false +*/ +setReadWriteAccessor( Axis.prototype, 'labels', getLabels, setLabels ); + +/** +* Minimum separation (in pixels) between axis tick label bounding boxes for them to be considered non-overlapping. +* +* @name labelSeparation +* @memberof Axis.prototype +* @type {NonNegativeNumber} +* @default 0 +* +* @example +* var axis = new Axis({ +* 'scale': 'xScale', +* 'orient': 'bottom', +* 'labelSeparation': 5 +* }); +* +* var v = axis.labelSeparation; +* // returns 5 +*/ +setReadWriteAccessor( Axis.prototype, 'labelSeparation', getLabelSeparation, setLabelSeparation ); + +/** +* Axis orientation. +* +* @name orient +* @memberof Axis.prototype +* @type {string} +* +* @example +* var axis = new Axis({ +* 'scale': 'xScale', +* 'orient': 'bottom' +* }); +* +* var v = axis.orient; +* // returns 'bottom' +*/ +setReadWriteAccessor( Axis.prototype, 'orient', getOrient, setOrient ); + +/** +* Axis properties. +* +* @name properties +* @memberof Axis.prototype +* @type {Array<string>} +* +* @example +* var axis = new Axis({ +* 'scale': 'xScale', +* 'orient': 'bottom' +* }); +* +* var v = axis.properties; +* // returns [...] +*/ +setNonEnumerableReadOnlyAccessor( Axis.prototype, 'properties', getProperties ); + +/** +* Name of the scale which maps data values to visual values along an axis. +* +* @name scale +* @memberof Axis.prototype +* @type {string} +* +* @example +* var axis = new Axis({ +* 'scale': 'xScale', +* 'orient': 'bottom' +* }); +* +* var v = axis.scale; +* // returns 'xScale' +*/ +setReadWriteAccessor( Axis.prototype, 'scale', getScale, setScale ); + +/** +* Axis title. +* +* @name title +* @memberof Axis.prototype +* @type {Array<string>} +* @default '' +* +* @example +* var axis = new Axis({ +* 'scale': 'xScale', +* 'orient': 'bottom', +* 'title': 'x' +* }); +* +* var v = axis.title; +* // returns [ 'x' ] +*/ +setReadWriteAccessor( Axis.prototype, 'title', getTitle, setTitle ); + +/** +* Serializes an instance to a JSON object. +* +* ## Notes +* +* - This method is implicitly invoked by `JSON.stringify`. +* +* @name toJSON +* @memberof Axis.prototype +* @type {Function} +* @returns {Object} JSON object +* +* @example +* var axis = new Axis({ +* 'scale': 'xScale', +* 'orient': 'bottom' +* }); +* +* var v = axis.toJSON(); +* // returns {...} +*/ +setNonEnumerableReadOnly( Axis.prototype, 'toJSON', function toJSON() { + return instance2json( this, properties ); +}); + + +// EXPORTS // + +module.exports = Axis; diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/orient/get.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/orient/get.js new file mode 100644 index 000000000000..d00a30fb7804 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/orient/get.js @@ -0,0 +1,43 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable no-invalid-this */ + +'use strict'; + +// MODULES // + +var prop = require( './properties.js' ); + + +// MAIN // + +/** +* Returns the axis orientation. +* +* @private +* @returns {string} orientation +*/ +function get() { + return this[ prop.private ]; +} + + +// EXPORTS // + +module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/orient/properties.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/orient/properties.js new file mode 100644 index 000000000000..bc16e7d16025 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/orient/properties.js @@ -0,0 +1,33 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var property2object = require( '@stdlib/plot/vega/base/property2object' ); + + +// MAIN // + +var obj = property2object( 'orient' ); + + +// EXPORTS // + +module.exports = obj; diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/orient/set.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/orient/set.js new file mode 100644 index 000000000000..9f6b773f05b1 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/orient/set.js @@ -0,0 +1,63 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable no-invalid-this */ + +'use strict'; + +// MODULES // + +var logger = require( 'debug' ); +var isAxisOrientation = require( '@stdlib/plot/vega/base/assert/is-axis-orientation' ); +var join = require( '@stdlib/array/base/join' ); +var axisOrientations = require( '@stdlib/plot/vega/axis/orientations' ); +var format = require( '@stdlib/string/format' ); +var changeEvent = require( './../change_event.js' ); +var prop = require( './properties.js' ); + + +// VARIABLES // + +var debug = logger( 'vega:axis:set:'+prop.name ); + + +// MAIN // + +/** +* Sets an axis orientation. +* +* @private +* @param {string} value - input value +* @throws {TypeError} must be a valid orientation +* @returns {void} +*/ +function set( value ) { + if ( !isAxisOrientation( value ) ) { + throw new TypeError( format( 'invalid assignment. `%s` must be one of the following: "%s". Value: `%s`.', prop.name, join( axisOrientations(), '", "' ), value ) ); + } + if ( value !== this[ prop.private ] ) { + debug( 'Current value: %s. New value: %s.', this[ prop.private ], value ); + this[ prop.private ] = value; + this.emit( 'change', changeEvent( prop.name ) ); + } +} + + +// EXPORTS // + +module.exports = set; diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/properties.json b/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/properties.json new file mode 100644 index 000000000000..24d83aca6f6d --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/properties.json @@ -0,0 +1,81 @@ +[ + "aria", + "bandPosition", + "description", + "domain", + "domainCap", + "domainColor", + "domainDash", + "domainDashOffset", + "domainOpacity", + "domainWidth", + "encode", + "format", + "formatType", + "grid", + "gridCap", + "gridColor", + "gridDash", + "gridDashOffset", + "gridOpacity", + "gridScale", + "gridWidth", + "labelAlign", + "labelAngle", + "labelBaseline", + "labelBound", + "labelColor", + "labelFlush", + "labelFlushOffset", + "labelFont", + "labelFontSize", + "labelFontStyle", + "labelFontWeight", + "labelLimit", + "labelLineHeight", + "labelOffset", + "labelOpacity", + "labelOverlap", + "labelPadding", + "labels", + "labelSeparation", + "maxExtent", + "minExtent", + "offset", + "orient", + "position", + "scale", + "tickBand", + "tickCap", + "tickColor", + "tickCount", + "tickDash", + "tickDashOffset", + "tickExtra", + "tickMinStep", + "tickOffset", + "tickOpacity", + "tickRound", + "ticks", + "tickSize", + "tickWidth", + "title", + "titleAlign", + "titleAnchor", + "titleAngle", + "titleBaseline", + "titleColor", + "titleFont", + "titleFontSize", + "titleFontStyle", + "titleFontWeight", + "titleLimit", + "titleLineHeight", + "titleOpacity", + "titlePadding", + "titleX", + "titleY", + "translate", + "values", + "zindex" +] diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/properties/get.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/properties/get.js new file mode 100644 index 000000000000..8fc57de14e90 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/properties/get.js @@ -0,0 +1,41 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var properties = require( './../properties.json' ); + + +// MAIN // + +/** +* Returns the list of enumerable properties. +* +* @private +* @returns {Array<string>} properties +*/ +function get() { + return properties.slice(); +} + + +// EXPORTS // + +module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/scale/get.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/scale/get.js new file mode 100644 index 000000000000..5d3a9552aaf0 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/scale/get.js @@ -0,0 +1,43 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable no-invalid-this */ + +'use strict'; + +// MODULES // + +var prop = require( './properties.js' ); + + +// MAIN // + +/** +* Returns the scale name which maps data values to visual values along an axis. +* +* @private +* @returns {string} scale name +*/ +function get() { + return this[ prop.private ]; +} + + +// EXPORTS // + +module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/scale/properties.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/scale/properties.js new file mode 100644 index 000000000000..34ff23e53e07 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/scale/properties.js @@ -0,0 +1,33 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var property2object = require( '@stdlib/plot/vega/base/property2object' ); + + +// MAIN // + +var obj = property2object( 'scale' ); + + +// EXPORTS // + +module.exports = obj; diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/scale/set.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/scale/set.js new file mode 100644 index 000000000000..eabdc355a38a --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/scale/set.js @@ -0,0 +1,61 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable no-invalid-this */ + +'use strict'; + +// MODULES // + +var logger = require( 'debug' ); +var isString = require( '@stdlib/assert/is-string' ).isPrimitive; +var format = require( '@stdlib/string/format' ); +var changeEvent = require( './../change_event.js' ); +var prop = require( './properties.js' ); + + +// VARIABLES // + +var debug = logger( 'vega:axis:set:'+prop.name ); + + +// MAIN // + +/** +* Sets the name of the scale which maps data values to visual values along an axis. +* +* @private +* @param {string} value - input value +* @throws {TypeError} must be a string +* @returns {void} +*/ +function set( value ) { + if ( !isString( value ) ) { + throw new TypeError( format( 'invalid assignment. `%s` must be a string. Value: `%s`.', prop.name, value ) ); + } + if ( value !== this[ prop.private ] ) { + debug( 'Current value: %s. New value: %s.', this[ prop.private ], value ); + this[ prop.private ] = value; + this.emit( 'change', changeEvent( prop.name ) ); + } +} + + +// EXPORTS // + +module.exports = set; diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/title/get.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/title/get.js new file mode 100644 index 000000000000..b9863dda48a5 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/title/get.js @@ -0,0 +1,44 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable no-invalid-this */ + +'use strict'; + +// MODULES // + +var copy = require( '@stdlib/array/base/copy-indexed' ); +var prop = require( './properties.js' ); + + +// MAIN // + +/** +* Returns the axis title. +* +* @private +* @returns {Array<string>} axis title +*/ +function get() { + return copy( this[ prop.private ] ); +} + + +// EXPORTS // + +module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/title/properties.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/title/properties.js new file mode 100644 index 000000000000..8b6ce18df555 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/title/properties.js @@ -0,0 +1,33 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var property2object = require( '@stdlib/plot/vega/base/property2object' ); + + +// MAIN // + +var obj = property2object( 'title' ); + + +// EXPORTS // + +module.exports = obj; diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/title/set.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/title/set.js new file mode 100644 index 000000000000..c6eb74f45173 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/title/set.js @@ -0,0 +1,68 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable no-invalid-this */ + +'use strict'; + +// MODULES // + +var logger = require( 'debug' ); +var isString = require( '@stdlib/assert/is-string' ).isPrimitive; +var isStringArray = require( '@stdlib/assert/is-string-array' ).primitives; +var hasEqualValues = require( '@stdlib/array/base/assert/has-equal-values' ); +var copy = require( '@stdlib/array/base/copy' ); +var format = require( '@stdlib/string/format' ); +var changeEvent = require( './../change_event.js' ); +var prop = require( './properties.js' ); + + +// VARIABLES // + +var debug = logger( 'vega:axis:set:'+prop.name ); + + +// MAIN // + +/** +* Sets the axis title. +* +* @private +* @param {(string|StringArray)} value - input value +* @throws {TypeError} must be a string or an array of strings +* @returns {void} +*/ +function set( value ) { + var isStr = isString( value ); + if ( !isStr && !isStringArray( value ) ) { + throw new TypeError( format( 'invalid assignment. `%s` must be a string or an array of strings. Value: `%s`.', prop.name, value ) ); + } + if ( isStr ) { + value = [ value ]; + } + if ( !hasEqualValues( value, this[ prop.private ] ) ) { + debug( 'Current value: %s. New value: %s.', JSON.stringify( this[ prop.private ] ), JSON.stringify( value ) ); + this[ prop.private ] = copy( value ); + this.emit( 'change', changeEvent( prop.name ) ); + } +} + + +// EXPORTS // + +module.exports = set; diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/package.json b/lib/node_modules/@stdlib/plot/vega/axis/ctor/package.json new file mode 100644 index 000000000000..9b0ad181edf9 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/package.json @@ -0,0 +1,60 @@ +{ + "name": "@stdlib/plot/vega/axis/ctor", + "version": "0.0.0", + "description": "Axis constructor.", + "license": "Apache-2.0", + "author": { + "name": "The Stdlib Authors", + "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" + }, + "contributors": [ + { + "name": "The Stdlib Authors", + "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" + } + ], + "main": "./lib", + "directories": { + "benchmark": "./benchmark", + "doc": "./docs", + "example": "./examples", + "lib": "./lib", + "test": "./test" + }, + "types": "./docs/types", + "scripts": {}, + "homepage": "https://github.com/stdlib-js/stdlib", + "repository": { + "type": "git", + "url": "git://github.com/stdlib-js/stdlib.git" + }, + "bugs": { + "url": "https://github.com/stdlib-js/stdlib/issues" + }, + "dependencies": {}, + "devDependencies": {}, + "engines": { + "node": ">=0.10.0", + "npm": ">2.7.0" + }, + "os": [ + "aix", + "darwin", + "freebsd", + "linux", + "macos", + "openbsd", + "sunos", + "win32", + "windows" + ], + "keywords": [ + "stdlib", + "plot", + "vega", + "axis", + "constructor", + "ctor" + ], + "__stdlib__": {} +} diff --git a/lib/node_modules/@stdlib/plot/vega/axis/orientations/README.md b/lib/node_modules/@stdlib/plot/vega/axis/orientations/README.md new file mode 100644 index 000000000000..9ff41e01c60d --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/axis/orientations/README.md @@ -0,0 +1,117 @@ +<!-- + +@license Apache-2.0 + +Copyright (c) 2025 The Stdlib Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + +--> + +# axisOrientations + +> List of supported Vega axis orientations. + +<!-- Section to include introductory text. Make sure to keep an empty line after the intro `section` element and another before the `/section` close. --> + +<section class="intro"> + +</section> + +<!-- /.intro --> + +<!-- Package usage documentation. --> + +<section class="usage"> + +## Usage + +```javascript +var axisOrientations = require( '@stdlib/plot/vega/axis/orientations' ); +``` + +#### axisOrientations() + +Returns a list of axis orientations. + +```javascript +var out = axisOrientations(); +// returns [ 'left', 'right', 'top', 'bottom' ] +``` + +</section> + +<!-- /.usage --> + +<!-- Package usage notes. Make sure to keep an empty line after the `section` element and another before the `/section` close. --> + +<section class="notes"> + +</section> + +<!-- /.notes --> + +<!-- Package usage examples. --> + +<section class="examples"> + +## Examples + +<!-- eslint no-undef: "error" --> + +```javascript +var contains = require( '@stdlib/array/base/assert/contains' ).factory; +var axisOrientations = require( '@stdlib/plot/vega/axis/orientations' ); + +var isAxisOrientation = contains( axisOrientations() ); + +var bool = isAxisOrientation( 'right' ); +// returns true + +bool = isAxisOrientation( 'top' ); +// returns true + +bool = isAxisOrientation( 'beep' ); +// returns false + +bool = isAxisOrientation( 'boop' ); +// returns false +``` + +</section> + +<!-- /.examples --> + +<!-- Section to include cited references. If references are included, add a horizontal rule *before* the section. Make sure to keep an empty line after the `section` element and another before the `/section` close. --> + +<section class="references"> + +</section> + +<!-- /.references --> + +<!-- Section for related `stdlib` packages. Do not manually edit this section, as it is automatically populated. --> + +<section class="related"> + +</section> + +<!-- /.related --> + +<!-- Section for all links. Make sure to keep an empty line after the `section` element and another before the `/section` close. --> + +<section class="links"> + +</section> + +<!-- /.links --> diff --git a/lib/node_modules/@stdlib/plot/vega/axis/orientations/benchmark/benchmark.js b/lib/node_modules/@stdlib/plot/vega/axis/orientations/benchmark/benchmark.js new file mode 100644 index 000000000000..45b4194a211a --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/axis/orientations/benchmark/benchmark.js @@ -0,0 +1,48 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var bench = require( '@stdlib/bench' ); +var isStringArray = require( '@stdlib/assert/is-string-array' ).primitives; +var pkg = require( './../package.json' ).name; +var axisOrientations = require( './../lib' ); + + +// MAIN // + +bench( pkg, function benchmark( b ) { + var out; + var i; + + b.tic(); + for ( i = 0; i < b.iterations; i++ ) { + out = axisOrientations(); + if ( out.length < 2 ) { + b.fail( 'should return an array' ); + } + } + b.toc(); + if ( !isStringArray( out ) ) { + b.fail( 'should return an array of strings' ); + } + b.pass( 'benchmark finished' ); + b.end(); +}); diff --git a/lib/node_modules/@stdlib/plot/vega/axis/orientations/docs/repl.txt b/lib/node_modules/@stdlib/plot/vega/axis/orientations/docs/repl.txt new file mode 100644 index 000000000000..8e2b3efc35cd --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/axis/orientations/docs/repl.txt @@ -0,0 +1,17 @@ + +{{alias}}() + Returns a list of axis orientations. + + Returns + ------- + out: Array<string> + List of axis orientations. + + Examples + -------- + > var out = {{alias}}() + [ 'left', 'right', 'top', 'bottom' ] + + See Also + -------- + diff --git a/lib/node_modules/@stdlib/plot/vega/axis/orientations/docs/types/index.d.ts b/lib/node_modules/@stdlib/plot/vega/axis/orientations/docs/types/index.d.ts new file mode 100644 index 000000000000..1424804d3b2f --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/axis/orientations/docs/types/index.d.ts @@ -0,0 +1,35 @@ +/* +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +// TypeScript Version: 4.1 + +/** +* Returns a list of axis orientations. +* +* @returns list of axis orientations +* +* @example +* var list = axisOrientations(); +* // returns [ 'left', 'right', 'top', 'bottom' ] +*/ +declare function axisOrientations(): Array<string>; + + +// EXPORTS // + +export = axisOrientations; diff --git a/lib/node_modules/@stdlib/plot/vega/axis/orientations/docs/types/test.ts b/lib/node_modules/@stdlib/plot/vega/axis/orientations/docs/types/test.ts new file mode 100644 index 000000000000..00e84247d967 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/axis/orientations/docs/types/test.ts @@ -0,0 +1,32 @@ +/* +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +import axisOrientations = require( './index' ); + + +// TESTS // + +// The function returns an array of strings... +{ + axisOrientations(); // $ExpectType string[] +} + +// The compiler throws an error if the function is provided any arguments... +{ + axisOrientations( 9 ); // $ExpectError +} diff --git a/lib/node_modules/@stdlib/plot/vega/axis/orientations/examples/index.js b/lib/node_modules/@stdlib/plot/vega/axis/orientations/examples/index.js new file mode 100644 index 000000000000..bd6b9d3614ed --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/axis/orientations/examples/index.js @@ -0,0 +1,40 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +var contains = require( '@stdlib/array/base/assert/contains' ).factory; +var axisOrientations = require( './../lib' ); + +var isAxisOrientation = contains( axisOrientations() ); + +var bool = isAxisOrientation( 'right' ); +console.log( bool ); +// => true + +bool = isAxisOrientation( 'top' ); +console.log( bool ); +// => true + +bool = isAxisOrientation( 'beep' ); +console.log( bool ); +// => false + +bool = isAxisOrientation( 'boop' ); +console.log( bool ); +// => false diff --git a/lib/node_modules/@stdlib/plot/vega/axis/orientations/lib/data.json b/lib/node_modules/@stdlib/plot/vega/axis/orientations/lib/data.json new file mode 100644 index 000000000000..d4d3e778b2ba --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/axis/orientations/lib/data.json @@ -0,0 +1,6 @@ +[ + "left", + "right", + "top", + "bottom" +] diff --git a/lib/node_modules/@stdlib/plot/vega/axis/orientations/lib/index.js b/lib/node_modules/@stdlib/plot/vega/axis/orientations/lib/index.js new file mode 100644 index 000000000000..715bdc6402a6 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/axis/orientations/lib/index.js @@ -0,0 +1,40 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +/** +* Return a list of axis orientations. +* +* @module @stdlib/plot/vega/axis/orientations +* +* @example +* var axisOrientations = require( '@stdlib/plot/vega/axis/orientations' ); +* +* var out = axisOrientations(); +* // returns [ 'left', 'right', 'top', 'bottom' ] +*/ + +// MODULES // + +var main = require( './main.js' ); + + +// EXPORTS // + +module.exports = main; diff --git a/lib/node_modules/@stdlib/plot/vega/axis/orientations/lib/main.js b/lib/node_modules/@stdlib/plot/vega/axis/orientations/lib/main.js new file mode 100644 index 000000000000..61ec64ab3a70 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/axis/orientations/lib/main.js @@ -0,0 +1,44 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var DATA = require( './data.json' ); + + +// MAIN // + +/** +* Returns a list of axis orientations. +* +* @returns {StringArray} list of axis orientations +* +* @example +* var out = orientations(); +* // returns [ 'left', 'right', 'top', 'bottom' ] +*/ +function orientations() { + return DATA.slice(); +} + + +// EXPORTS // + +module.exports = orientations; diff --git a/lib/node_modules/@stdlib/plot/vega/axis/orientations/package.json b/lib/node_modules/@stdlib/plot/vega/axis/orientations/package.json new file mode 100644 index 000000000000..5f357f7b5538 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/axis/orientations/package.json @@ -0,0 +1,64 @@ +{ + "name": "@stdlib/plot/vega/axis/orientations", + "version": "0.0.0", + "description": "List of supported Vega axis orientations.", + "license": "Apache-2.0", + "author": { + "name": "The Stdlib Authors", + "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" + }, + "contributors": [ + { + "name": "The Stdlib Authors", + "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" + } + ], + "main": "./lib", + "directories": { + "benchmark": "./benchmark", + "doc": "./docs", + "example": "./examples", + "lib": "./lib", + "test": "./test" + }, + "types": "./docs/types", + "scripts": {}, + "homepage": "https://github.com/stdlib-js/stdlib", + "repository": { + "type": "git", + "url": "git://github.com/stdlib-js/stdlib.git" + }, + "bugs": { + "url": "https://github.com/stdlib-js/stdlib/issues" + }, + "dependencies": {}, + "devDependencies": {}, + "engines": { + "node": ">=0.10.0", + "npm": ">2.7.0" + }, + "os": [ + "aix", + "darwin", + "freebsd", + "linux", + "macos", + "openbsd", + "sunos", + "win32", + "windows" + ], + "keywords": [ + "stdlib", + "plot", + "vega", + "axis", + "orient", + "orientations", + "utilities", + "utility", + "utils", + "util" + ], + "__stdlib__": {} +} diff --git a/lib/node_modules/@stdlib/plot/vega/axis/orientations/test/test.js b/lib/node_modules/@stdlib/plot/vega/axis/orientations/test/test.js new file mode 100644 index 000000000000..c25e43353d94 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/axis/orientations/test/test.js @@ -0,0 +1,49 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var tape = require( 'tape' ); +var axisOrientations = require( './../lib' ); + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof axisOrientations, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'the function returns a list of axis orientations', function test( t ) { + var expected; + var actual; + + expected = [ + 'left', + 'right', + 'top', + 'bottom' + ]; + actual = axisOrientations(); + + t.deepEqual( actual, expected, 'returns expected value' ); + t.end(); +}); diff --git a/lib/node_modules/@stdlib/plot/vega/axis/x-orientations/README.md b/lib/node_modules/@stdlib/plot/vega/axis/x-orientations/README.md new file mode 100644 index 000000000000..70ad70d79251 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/axis/x-orientations/README.md @@ -0,0 +1,117 @@ +<!-- + +@license Apache-2.0 + +Copyright (c) 2025 The Stdlib Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + +--> + +# xAxisOrientations + +> List of supported Vega x-axis orientations. + +<!-- Section to include introductory text. Make sure to keep an empty line after the intro `section` element and another before the `/section` close. --> + +<section class="intro"> + +</section> + +<!-- /.intro --> + +<!-- Package usage documentation. --> + +<section class="usage"> + +## Usage + +```javascript +var xAxisOrientations = require( '@stdlib/plot/vega/axis/x-orientations' ); +``` + +#### xAxisOrientations() + +Returns a list of x-axis orientations. + +```javascript +var out = xAxisOrientations(); +// returns [ 'top', 'bottom' ] +``` + +</section> + +<!-- /.usage --> + +<!-- Package usage notes. Make sure to keep an empty line after the `section` element and another before the `/section` close. --> + +<section class="notes"> + +</section> + +<!-- /.notes --> + +<!-- Package usage examples. --> + +<section class="examples"> + +## Examples + +<!-- eslint no-undef: "error" --> + +```javascript +var contains = require( '@stdlib/array/base/assert/contains' ).factory; +var xAxisOrientations = require( '@stdlib/plot/vega/axis/x-orientations' ); + +var isXAxisOrientation = contains( xAxisOrientations() ); + +var bool = isXAxisOrientation( 'bottom' ); +// returns true + +bool = isXAxisOrientation( 'top' ); +// returns true + +bool = isXAxisOrientation( 'beep' ); +// returns false + +bool = isXAxisOrientation( 'boop' ); +// returns false +``` + +</section> + +<!-- /.examples --> + +<!-- Section to include cited references. If references are included, add a horizontal rule *before* the section. Make sure to keep an empty line after the `section` element and another before the `/section` close. --> + +<section class="references"> + +</section> + +<!-- /.references --> + +<!-- Section for related `stdlib` packages. Do not manually edit this section, as it is automatically populated. --> + +<section class="related"> + +</section> + +<!-- /.related --> + +<!-- Section for all links. Make sure to keep an empty line after the `section` element and another before the `/section` close. --> + +<section class="links"> + +</section> + +<!-- /.links --> diff --git a/lib/node_modules/@stdlib/plot/vega/axis/x-orientations/benchmark/benchmark.js b/lib/node_modules/@stdlib/plot/vega/axis/x-orientations/benchmark/benchmark.js new file mode 100644 index 000000000000..eef319ebcf63 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/axis/x-orientations/benchmark/benchmark.js @@ -0,0 +1,48 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var bench = require( '@stdlib/bench' ); +var isStringArray = require( '@stdlib/assert/is-string-array' ).primitives; +var pkg = require( './../package.json' ).name; +var xAxisOrientations = require( './../lib' ); + + +// MAIN // + +bench( pkg, function benchmark( b ) { + var out; + var i; + + b.tic(); + for ( i = 0; i < b.iterations; i++ ) { + out = xAxisOrientations(); + if ( out.length < 2 ) { + b.fail( 'should return an array' ); + } + } + b.toc(); + if ( !isStringArray( out ) ) { + b.fail( 'should return an array of strings' ); + } + b.pass( 'benchmark finished' ); + b.end(); +}); diff --git a/lib/node_modules/@stdlib/plot/vega/axis/x-orientations/docs/repl.txt b/lib/node_modules/@stdlib/plot/vega/axis/x-orientations/docs/repl.txt new file mode 100644 index 000000000000..162aa9582f48 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/axis/x-orientations/docs/repl.txt @@ -0,0 +1,17 @@ + +{{alias}}() + Returns a list of x-axis orientations. + + Returns + ------- + out: Array<string> + List of axis orientations. + + Examples + -------- + > var out = {{alias}}() + [ 'top', 'bottom' ] + + See Also + -------- + diff --git a/lib/node_modules/@stdlib/plot/vega/axis/x-orientations/docs/types/index.d.ts b/lib/node_modules/@stdlib/plot/vega/axis/x-orientations/docs/types/index.d.ts new file mode 100644 index 000000000000..4bac1e44452b --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/axis/x-orientations/docs/types/index.d.ts @@ -0,0 +1,35 @@ +/* +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +// TypeScript Version: 4.1 + +/** +* Returns a list of x-axis orientations. +* +* @returns list of axis orientations +* +* @example +* var list = xAxisOrientations(); +* // returns [ 'top', 'bottom' ] +*/ +declare function xAxisOrientations(): Array<string>; + + +// EXPORTS // + +export = xAxisOrientations; diff --git a/lib/node_modules/@stdlib/plot/vega/axis/x-orientations/docs/types/test.ts b/lib/node_modules/@stdlib/plot/vega/axis/x-orientations/docs/types/test.ts new file mode 100644 index 000000000000..5119c8729210 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/axis/x-orientations/docs/types/test.ts @@ -0,0 +1,32 @@ +/* +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +import xAxisOrientations = require( './index' ); + + +// TESTS // + +// The function returns an array of strings... +{ + xAxisOrientations(); // $ExpectType string[] +} + +// The compiler throws an error if the function is provided any arguments... +{ + xAxisOrientations( 9 ); // $ExpectError +} diff --git a/lib/node_modules/@stdlib/plot/vega/axis/x-orientations/examples/index.js b/lib/node_modules/@stdlib/plot/vega/axis/x-orientations/examples/index.js new file mode 100644 index 000000000000..7cc0e7409ac4 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/axis/x-orientations/examples/index.js @@ -0,0 +1,40 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +var contains = require( '@stdlib/array/base/assert/contains' ).factory; +var xAxisOrientations = require( './../lib' ); + +var isXAxisOrientation = contains( xAxisOrientations() ); + +var bool = isXAxisOrientation( 'bottom' ); +console.log( bool ); +// => true + +bool = isXAxisOrientation( 'top' ); +console.log( bool ); +// => true + +bool = isXAxisOrientation( 'beep' ); +console.log( bool ); +// => false + +bool = isXAxisOrientation( 'boop' ); +console.log( bool ); +// => false diff --git a/lib/node_modules/@stdlib/plot/vega/axis/x-orientations/lib/data.json b/lib/node_modules/@stdlib/plot/vega/axis/x-orientations/lib/data.json new file mode 100644 index 000000000000..7ca0c647337b --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/axis/x-orientations/lib/data.json @@ -0,0 +1,4 @@ +[ + "top", + "bottom" +] diff --git a/lib/node_modules/@stdlib/plot/vega/axis/x-orientations/lib/index.js b/lib/node_modules/@stdlib/plot/vega/axis/x-orientations/lib/index.js new file mode 100644 index 000000000000..f3e05e55a367 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/axis/x-orientations/lib/index.js @@ -0,0 +1,40 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +/** +* Return a list of x-axis orientations. +* +* @module @stdlib/plot/vega/axis/x-orientations +* +* @example +* var xAxisOrientations = require( '@stdlib/plot/vega/axis/x-orientations' ); +* +* var out = xAxisOrientations(); +* // returns [ 'top', 'bottom' ] +*/ + +// MODULES // + +var main = require( './main.js' ); + + +// EXPORTS // + +module.exports = main; diff --git a/lib/node_modules/@stdlib/plot/vega/axis/x-orientations/lib/main.js b/lib/node_modules/@stdlib/plot/vega/axis/x-orientations/lib/main.js new file mode 100644 index 000000000000..0bee0085b65f --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/axis/x-orientations/lib/main.js @@ -0,0 +1,44 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var DATA = require( './data.json' ); + + +// MAIN // + +/** +* Returns a list of x-axis orientations. +* +* @returns {StringArray} list of axis orientations +* +* @example +* var out = orientations(); +* // returns [ 'top', 'bottom' ] +*/ +function orientations() { + return DATA.slice(); +} + + +// EXPORTS // + +module.exports = orientations; diff --git a/lib/node_modules/@stdlib/plot/vega/axis/x-orientations/package.json b/lib/node_modules/@stdlib/plot/vega/axis/x-orientations/package.json new file mode 100644 index 000000000000..c3ec151e8b37 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/axis/x-orientations/package.json @@ -0,0 +1,64 @@ +{ + "name": "@stdlib/plot/vega/axis/x-orientations", + "version": "0.0.0", + "description": "List of supported Vega x-axis orientations.", + "license": "Apache-2.0", + "author": { + "name": "The Stdlib Authors", + "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" + }, + "contributors": [ + { + "name": "The Stdlib Authors", + "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" + } + ], + "main": "./lib", + "directories": { + "benchmark": "./benchmark", + "doc": "./docs", + "example": "./examples", + "lib": "./lib", + "test": "./test" + }, + "types": "./docs/types", + "scripts": {}, + "homepage": "https://github.com/stdlib-js/stdlib", + "repository": { + "type": "git", + "url": "git://github.com/stdlib-js/stdlib.git" + }, + "bugs": { + "url": "https://github.com/stdlib-js/stdlib/issues" + }, + "dependencies": {}, + "devDependencies": {}, + "engines": { + "node": ">=0.10.0", + "npm": ">2.7.0" + }, + "os": [ + "aix", + "darwin", + "freebsd", + "linux", + "macos", + "openbsd", + "sunos", + "win32", + "windows" + ], + "keywords": [ + "stdlib", + "plot", + "vega", + "axis", + "orient", + "orientations", + "utilities", + "utility", + "utils", + "util" + ], + "__stdlib__": {} +} diff --git a/lib/node_modules/@stdlib/plot/vega/axis/x-orientations/test/test.js b/lib/node_modules/@stdlib/plot/vega/axis/x-orientations/test/test.js new file mode 100644 index 000000000000..a97c91daf4a6 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/axis/x-orientations/test/test.js @@ -0,0 +1,47 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var tape = require( 'tape' ); +var xAxisOrientations = require( './../lib' ); + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof xAxisOrientations, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'the function returns a list of axis orientations', function test( t ) { + var expected; + var actual; + + expected = [ + 'top', + 'bottom' + ]; + actual = xAxisOrientations(); + + t.deepEqual( actual, expected, 'returns expected value' ); + t.end(); +}); diff --git a/lib/node_modules/@stdlib/plot/vega/axis/y-orientations/README.md b/lib/node_modules/@stdlib/plot/vega/axis/y-orientations/README.md new file mode 100644 index 000000000000..efdb09533b70 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/axis/y-orientations/README.md @@ -0,0 +1,117 @@ +<!-- + +@license Apache-2.0 + +Copyright (c) 2025 The Stdlib Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + +--> + +# yAxisOrientations + +> List of supported Vega y-axis orientations. + +<!-- Section to include introductory text. Make sure to keep an empty line after the intro `section` element and another before the `/section` close. --> + +<section class="intro"> + +</section> + +<!-- /.intro --> + +<!-- Package usage documentation. --> + +<section class="usage"> + +## Usage + +```javascript +var yAxisOrientations = require( '@stdlib/plot/vega/axis/y-orientations' ); +``` + +#### yAxisOrientations() + +Returns a list of y-axis orientations. + +```javascript +var out = yAxisOrientations(); +// returns [ 'left', 'right' ] +``` + +</section> + +<!-- /.usage --> + +<!-- Package usage notes. Make sure to keep an empty line after the `section` element and another before the `/section` close. --> + +<section class="notes"> + +</section> + +<!-- /.notes --> + +<!-- Package usage examples. --> + +<section class="examples"> + +## Examples + +<!-- eslint no-undef: "error" --> + +```javascript +var contains = require( '@stdlib/array/base/assert/contains' ).factory; +var yAxisOrientations = require( '@stdlib/plot/vega/axis/y-orientations' ); + +var isYAxisOrientation = contains( yAxisOrientations() ); + +var bool = isYAxisOrientation( 'right' ); +// returns true + +bool = isYAxisOrientation( 'left' ); +// returns true + +bool = isYAxisOrientation( 'beep' ); +// returns false + +bool = isYAxisOrientation( 'boop' ); +// returns false +``` + +</section> + +<!-- /.examples --> + +<!-- Section to include cited references. If references are included, add a horizontal rule *before* the section. Make sure to keep an empty line after the `section` element and another before the `/section` close. --> + +<section class="references"> + +</section> + +<!-- /.references --> + +<!-- Section for related `stdlib` packages. Do not manually edit this section, as it is automatically populated. --> + +<section class="related"> + +</section> + +<!-- /.related --> + +<!-- Section for all links. Make sure to keep an empty line after the `section` element and another before the `/section` close. --> + +<section class="links"> + +</section> + +<!-- /.links --> diff --git a/lib/node_modules/@stdlib/plot/vega/axis/y-orientations/benchmark/benchmark.js b/lib/node_modules/@stdlib/plot/vega/axis/y-orientations/benchmark/benchmark.js new file mode 100644 index 000000000000..1590a1a0c6bf --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/axis/y-orientations/benchmark/benchmark.js @@ -0,0 +1,48 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var bench = require( '@stdlib/bench' ); +var isStringArray = require( '@stdlib/assert/is-string-array' ).primitives; +var pkg = require( './../package.json' ).name; +var yAxisOrientations = require( './../lib' ); + + +// MAIN // + +bench( pkg, function benchmark( b ) { + var out; + var i; + + b.tic(); + for ( i = 0; i < b.iterations; i++ ) { + out = yAxisOrientations(); + if ( out.length < 2 ) { + b.fail( 'should return an array' ); + } + } + b.toc(); + if ( !isStringArray( out ) ) { + b.fail( 'should return an array of strings' ); + } + b.pass( 'benchmark finished' ); + b.end(); +}); diff --git a/lib/node_modules/@stdlib/plot/vega/axis/y-orientations/docs/repl.txt b/lib/node_modules/@stdlib/plot/vega/axis/y-orientations/docs/repl.txt new file mode 100644 index 000000000000..3458dce49f6d --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/axis/y-orientations/docs/repl.txt @@ -0,0 +1,17 @@ + +{{alias}}() + Returns a list of y-axis orientations. + + Returns + ------- + out: Array<string> + List of axis orientations. + + Examples + -------- + > var out = {{alias}}() + [ 'left', 'right' ] + + See Also + -------- + diff --git a/lib/node_modules/@stdlib/plot/vega/axis/y-orientations/docs/types/index.d.ts b/lib/node_modules/@stdlib/plot/vega/axis/y-orientations/docs/types/index.d.ts new file mode 100644 index 000000000000..7f6048f2cd7c --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/axis/y-orientations/docs/types/index.d.ts @@ -0,0 +1,35 @@ +/* +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +// TypeScript Version: 4.1 + +/** +* Returns a list of y-axis orientations. +* +* @returns list of axis orientations +* +* @example +* var list = yAxisOrientations(); +* // returns [ 'left', 'right' ] +*/ +declare function yAxisOrientations(): Array<string>; + + +// EXPORTS // + +export = yAxisOrientations; diff --git a/lib/node_modules/@stdlib/plot/vega/axis/y-orientations/docs/types/test.ts b/lib/node_modules/@stdlib/plot/vega/axis/y-orientations/docs/types/test.ts new file mode 100644 index 000000000000..b2c6049c85a9 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/axis/y-orientations/docs/types/test.ts @@ -0,0 +1,32 @@ +/* +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +import yAxisOrientations = require( './index' ); + + +// TESTS // + +// The function returns an array of strings... +{ + yAxisOrientations(); // $ExpectType string[] +} + +// The compiler throws an error if the function is provided any arguments... +{ + yAxisOrientations( 9 ); // $ExpectError +} diff --git a/lib/node_modules/@stdlib/plot/vega/axis/y-orientations/examples/index.js b/lib/node_modules/@stdlib/plot/vega/axis/y-orientations/examples/index.js new file mode 100644 index 000000000000..cfa58e9791fc --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/axis/y-orientations/examples/index.js @@ -0,0 +1,40 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +var contains = require( '@stdlib/array/base/assert/contains' ).factory; +var yAxisOrientations = require( './../lib' ); + +var isYAxisOrientation = contains( yAxisOrientations() ); + +var bool = isYAxisOrientation( 'right' ); +console.log( bool ); +// => true + +bool = isYAxisOrientation( 'left' ); +console.log( bool ); +// => true + +bool = isYAxisOrientation( 'beep' ); +console.log( bool ); +// => false + +bool = isYAxisOrientation( 'boop' ); +console.log( bool ); +// => false diff --git a/lib/node_modules/@stdlib/plot/vega/axis/y-orientations/lib/data.json b/lib/node_modules/@stdlib/plot/vega/axis/y-orientations/lib/data.json new file mode 100644 index 000000000000..c21c56e4bd4d --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/axis/y-orientations/lib/data.json @@ -0,0 +1,4 @@ +[ + "left", + "right" +] diff --git a/lib/node_modules/@stdlib/plot/vega/axis/y-orientations/lib/index.js b/lib/node_modules/@stdlib/plot/vega/axis/y-orientations/lib/index.js new file mode 100644 index 000000000000..fd093de6720e --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/axis/y-orientations/lib/index.js @@ -0,0 +1,40 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +/** +* Return a list of y-axis orientations. +* +* @module @stdlib/plot/vega/axis/y-orientations +* +* @example +* var yAxisOrientations = require( '@stdlib/plot/vega/axis/y-orientations' ); +* +* var out = yAxisOrientations(); +* // returns [ 'left', 'right' ] +*/ + +// MODULES // + +var main = require( './main.js' ); + + +// EXPORTS // + +module.exports = main; diff --git a/lib/node_modules/@stdlib/plot/vega/axis/y-orientations/lib/main.js b/lib/node_modules/@stdlib/plot/vega/axis/y-orientations/lib/main.js new file mode 100644 index 000000000000..4be65b49fb43 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/axis/y-orientations/lib/main.js @@ -0,0 +1,44 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var DATA = require( './data.json' ); + + +// MAIN // + +/** +* Returns a list of y-axis orientations. +* +* @returns {StringArray} list of axis orientations +* +* @example +* var out = orientations(); +* // returns [ 'left', 'right' ] +*/ +function orientations() { + return DATA.slice(); +} + + +// EXPORTS // + +module.exports = orientations; diff --git a/lib/node_modules/@stdlib/plot/vega/axis/y-orientations/package.json b/lib/node_modules/@stdlib/plot/vega/axis/y-orientations/package.json new file mode 100644 index 000000000000..73a5c975af1e --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/axis/y-orientations/package.json @@ -0,0 +1,64 @@ +{ + "name": "@stdlib/plot/vega/axis/y-orientations", + "version": "0.0.0", + "description": "List of supported Vega y-axis orientations.", + "license": "Apache-2.0", + "author": { + "name": "The Stdlib Authors", + "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" + }, + "contributors": [ + { + "name": "The Stdlib Authors", + "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" + } + ], + "main": "./lib", + "directories": { + "benchmark": "./benchmark", + "doc": "./docs", + "example": "./examples", + "lib": "./lib", + "test": "./test" + }, + "types": "./docs/types", + "scripts": {}, + "homepage": "https://github.com/stdlib-js/stdlib", + "repository": { + "type": "git", + "url": "git://github.com/stdlib-js/stdlib.git" + }, + "bugs": { + "url": "https://github.com/stdlib-js/stdlib/issues" + }, + "dependencies": {}, + "devDependencies": {}, + "engines": { + "node": ">=0.10.0", + "npm": ">2.7.0" + }, + "os": [ + "aix", + "darwin", + "freebsd", + "linux", + "macos", + "openbsd", + "sunos", + "win32", + "windows" + ], + "keywords": [ + "stdlib", + "plot", + "vega", + "axis", + "orient", + "orientations", + "utilities", + "utility", + "utils", + "util" + ], + "__stdlib__": {} +} diff --git a/lib/node_modules/@stdlib/plot/vega/axis/y-orientations/test/test.js b/lib/node_modules/@stdlib/plot/vega/axis/y-orientations/test/test.js new file mode 100644 index 000000000000..fac658370492 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/axis/y-orientations/test/test.js @@ -0,0 +1,47 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var tape = require( 'tape' ); +var yAxisOrientations = require( './../lib' ); + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof yAxisOrientations, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'the function returns a list of axis orientations', function test( t ) { + var expected; + var actual; + + expected = [ + 'left', + 'right' + ]; + actual = yAxisOrientations(); + + t.deepEqual( actual, expected, 'returns expected value' ); + t.end(); +}); diff --git a/lib/node_modules/@stdlib/plot/vega/base/anchor-positions/README.md b/lib/node_modules/@stdlib/plot/vega/base/anchor-positions/README.md new file mode 100644 index 000000000000..031b0f5393a0 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/anchor-positions/README.md @@ -0,0 +1,117 @@ +<!-- + +@license Apache-2.0 + +Copyright (c) 2025 The Stdlib Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + +--> + +# anchorPositions + +> List of supported Vega anchor positions. + +<!-- Section to include introductory text. Make sure to keep an empty line after the intro `section` element and another before the `/section` close. --> + +<section class="intro"> + +</section> + +<!-- /.intro --> + +<!-- Package usage documentation. --> + +<section class="usage"> + +## Usage + +```javascript +var anchorPositions = require( '@stdlib/plot/vega/base/anchor-positions' ); +``` + +#### anchorPositions() + +Returns a list of anchor positions. + +```javascript +var out = anchorPositions(); +// returns [ 'start', 'middle', 'end' ] +``` + +</section> + +<!-- /.usage --> + +<!-- Package usage notes. Make sure to keep an empty line after the `section` element and another before the `/section` close. --> + +<section class="notes"> + +</section> + +<!-- /.notes --> + +<!-- Package usage examples. --> + +<section class="examples"> + +## Examples + +<!-- eslint no-undef: "error" --> + +```javascript +var contains = require( '@stdlib/array/base/assert/contains' ).factory; +var anchorPositions = require( '@stdlib/plot/vega/base/anchor-positions' ); + +var isAnchorPosition = contains( anchorPositions() ); + +var bool = isAnchorPosition( 'start' ); +// returns true + +bool = isAnchorPosition( 'middle' ); +// returns true + +bool = isAnchorPosition( 'beep' ); +// returns false + +bool = isAnchorPosition( 'boop' ); +// returns false +``` + +</section> + +<!-- /.examples --> + +<!-- Section to include cited references. If references are included, add a horizontal rule *before* the section. Make sure to keep an empty line after the `section` element and another before the `/section` close. --> + +<section class="references"> + +</section> + +<!-- /.references --> + +<!-- Section for related `stdlib` packages. Do not manually edit this section, as it is automatically populated. --> + +<section class="related"> + +</section> + +<!-- /.related --> + +<!-- Section for all links. Make sure to keep an empty line after the `section` element and another before the `/section` close. --> + +<section class="links"> + +</section> + +<!-- /.links --> diff --git a/lib/node_modules/@stdlib/plot/vega/base/anchor-positions/benchmark/benchmark.js b/lib/node_modules/@stdlib/plot/vega/base/anchor-positions/benchmark/benchmark.js new file mode 100644 index 000000000000..205433b4902a --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/anchor-positions/benchmark/benchmark.js @@ -0,0 +1,48 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var bench = require( '@stdlib/bench' ); +var isStringArray = require( '@stdlib/assert/is-string-array' ).primitives; +var pkg = require( './../package.json' ).name; +var anchorPositions = require( './../lib' ); + + +// MAIN // + +bench( pkg, function benchmark( b ) { + var out; + var i; + + b.tic(); + for ( i = 0; i < b.iterations; i++ ) { + out = anchorPositions(); + if ( out.length < 2 ) { + b.fail( 'should return an array' ); + } + } + b.toc(); + if ( !isStringArray( out ) ) { + b.fail( 'should return an array of strings' ); + } + b.pass( 'benchmark finished' ); + b.end(); +}); diff --git a/lib/node_modules/@stdlib/plot/vega/base/anchor-positions/docs/repl.txt b/lib/node_modules/@stdlib/plot/vega/base/anchor-positions/docs/repl.txt new file mode 100644 index 000000000000..10552d9337e8 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/anchor-positions/docs/repl.txt @@ -0,0 +1,17 @@ + +{{alias}}() + Returns a list of anchor positions. + + Returns + ------- + out: Array<string> + List of anchor positions. + + Examples + -------- + > var out = {{alias}}() + [ 'start', 'middle', 'end' ] + + See Also + -------- + diff --git a/lib/node_modules/@stdlib/plot/vega/base/anchor-positions/docs/types/index.d.ts b/lib/node_modules/@stdlib/plot/vega/base/anchor-positions/docs/types/index.d.ts new file mode 100644 index 000000000000..f01f7fcadb14 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/anchor-positions/docs/types/index.d.ts @@ -0,0 +1,35 @@ +/* +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +// TypeScript Version: 4.1 + +/** +* Returns a list of anchor positions. +* +* @returns list of anchor positions +* +* @example +* var list = anchorPositions(); +* // returns [ 'start', 'middle', 'end' ] +*/ +declare function anchorPositions(): Array<string>; + + +// EXPORTS // + +export = anchorPositions; diff --git a/lib/node_modules/@stdlib/plot/vega/base/anchor-positions/docs/types/test.ts b/lib/node_modules/@stdlib/plot/vega/base/anchor-positions/docs/types/test.ts new file mode 100644 index 000000000000..0f251a5d6ee6 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/anchor-positions/docs/types/test.ts @@ -0,0 +1,32 @@ +/* +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +import anchorPositions = require( './index' ); + + +// TESTS // + +// The function returns an array of strings... +{ + anchorPositions(); // $ExpectType string[] +} + +// The compiler throws an error if the function is provided any arguments... +{ + anchorPositions( 9 ); // $ExpectError +} diff --git a/lib/node_modules/@stdlib/plot/vega/base/anchor-positions/examples/index.js b/lib/node_modules/@stdlib/plot/vega/base/anchor-positions/examples/index.js new file mode 100644 index 000000000000..a0ca46fd4ba8 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/anchor-positions/examples/index.js @@ -0,0 +1,40 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +var contains = require( '@stdlib/array/base/assert/contains' ).factory; +var anchorPositions = require( './../lib' ); + +var isAnchorPosition = contains( anchorPositions() ); + +var bool = isAnchorPosition( 'start' ); +console.log( bool ); +// => true + +bool = isAnchorPosition( 'middle' ); +console.log( bool ); +// => true + +bool = isAnchorPosition( 'beep' ); +console.log( bool ); +// => false + +bool = isAnchorPosition( 'boop' ); +console.log( bool ); +// => false diff --git a/lib/node_modules/@stdlib/plot/vega/base/anchor-positions/lib/data.json b/lib/node_modules/@stdlib/plot/vega/base/anchor-positions/lib/data.json new file mode 100644 index 000000000000..15380ad610fd --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/anchor-positions/lib/data.json @@ -0,0 +1,5 @@ +[ + "start", + "middle", + "end" +] diff --git a/lib/node_modules/@stdlib/plot/vega/base/anchor-positions/lib/index.js b/lib/node_modules/@stdlib/plot/vega/base/anchor-positions/lib/index.js new file mode 100644 index 000000000000..f1faa634eff8 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/anchor-positions/lib/index.js @@ -0,0 +1,40 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +/** +* Return a list of anchor positions. +* +* @module @stdlib/plot/vega/base/anchor-positions +* +* @example +* var anchorPositions = require( '@stdlib/plot/vega/base/anchor-positions' ); +* +* var out = anchorPositions(); +* // returns [ 'start', 'middle', 'end' ] +*/ + +// MODULES // + +var main = require( './main.js' ); + + +// EXPORTS // + +module.exports = main; diff --git a/lib/node_modules/@stdlib/plot/vega/base/anchor-positions/lib/main.js b/lib/node_modules/@stdlib/plot/vega/base/anchor-positions/lib/main.js new file mode 100644 index 000000000000..0ff43020dbe4 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/anchor-positions/lib/main.js @@ -0,0 +1,44 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var DATA = require( './data.json' ); + + +// MAIN // + +/** +* Returns a list of anchor positions. +* +* @returns {StringArray} list of anchor positions +* +* @example +* var out = orientations(); +* // returns [ 'start', 'middle', 'end' ] +*/ +function orientations() { + return DATA.slice(); +} + + +// EXPORTS // + +module.exports = orientations; diff --git a/lib/node_modules/@stdlib/plot/vega/base/anchor-positions/package.json b/lib/node_modules/@stdlib/plot/vega/base/anchor-positions/package.json new file mode 100644 index 000000000000..a2064b7e9f92 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/anchor-positions/package.json @@ -0,0 +1,63 @@ +{ + "name": "@stdlib/plot/vega/base/anchor-positions", + "version": "0.0.0", + "description": "List of supported Vega anchor positions.", + "license": "Apache-2.0", + "author": { + "name": "The Stdlib Authors", + "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" + }, + "contributors": [ + { + "name": "The Stdlib Authors", + "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" + } + ], + "main": "./lib", + "directories": { + "benchmark": "./benchmark", + "doc": "./docs", + "example": "./examples", + "lib": "./lib", + "test": "./test" + }, + "types": "./docs/types", + "scripts": {}, + "homepage": "https://github.com/stdlib-js/stdlib", + "repository": { + "type": "git", + "url": "git://github.com/stdlib-js/stdlib.git" + }, + "bugs": { + "url": "https://github.com/stdlib-js/stdlib/issues" + }, + "dependencies": {}, + "devDependencies": {}, + "engines": { + "node": ">=0.10.0", + "npm": ">2.7.0" + }, + "os": [ + "aix", + "darwin", + "freebsd", + "linux", + "macos", + "openbsd", + "sunos", + "win32", + "windows" + ], + "keywords": [ + "stdlib", + "plot", + "vega", + "anchor", + "position", + "utilities", + "utility", + "utils", + "util" + ], + "__stdlib__": {} +} diff --git a/lib/node_modules/@stdlib/plot/vega/base/anchor-positions/test/test.js b/lib/node_modules/@stdlib/plot/vega/base/anchor-positions/test/test.js new file mode 100644 index 000000000000..7f498bf3ada5 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/anchor-positions/test/test.js @@ -0,0 +1,48 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var tape = require( 'tape' ); +var anchorPositions = require( './../lib' ); + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof anchorPositions, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'the function returns a list of anchor positions', function test( t ) { + var expected; + var actual; + + expected = [ + 'start', + 'middle', + 'end' + ]; + actual = anchorPositions(); + + t.deepEqual( actual, expected, 'returns expected value' ); + t.end(); +}); diff --git a/lib/node_modules/@stdlib/plot/vega/base/anchor-reference-frames/README.md b/lib/node_modules/@stdlib/plot/vega/base/anchor-reference-frames/README.md new file mode 100644 index 000000000000..777707e17578 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/anchor-reference-frames/README.md @@ -0,0 +1,117 @@ +<!-- + +@license Apache-2.0 + +Copyright (c) 2025 The Stdlib Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + +--> + +# anchorReferenceFrames + +> List of supported Vega anchor reference frames. + +<!-- Section to include introductory text. Make sure to keep an empty line after the intro `section` element and another before the `/section` close. --> + +<section class="intro"> + +</section> + +<!-- /.intro --> + +<!-- Package usage documentation. --> + +<section class="usage"> + +## Usage + +```javascript +var anchorReferenceFrames = require( '@stdlib/plot/vega/base/anchor-reference-frames' ); +``` + +#### anchorReferenceFrames() + +Returns a list of anchor reference frames. + +```javascript +var out = anchorReferenceFrames(); +// returns [ 'bounds', 'group' ] +``` + +</section> + +<!-- /.usage --> + +<!-- Package usage notes. Make sure to keep an empty line after the `section` element and another before the `/section` close. --> + +<section class="notes"> + +</section> + +<!-- /.notes --> + +<!-- Package usage examples. --> + +<section class="examples"> + +## Examples + +<!-- eslint no-undef: "error" --> + +```javascript +var contains = require( '@stdlib/array/base/assert/contains' ).factory; +var anchorReferenceFrames = require( '@stdlib/plot/vega/base/anchor-reference-frames' ); + +var isAnchorReferenceFrame = contains( anchorReferenceFrames() ); + +var bool = isAnchorReferenceFrame( 'bounds' ); +// returns true + +bool = isAnchorReferenceFrame( 'group' ); +// returns true + +bool = isAnchorReferenceFrame( 'beep' ); +// returns false + +bool = isAnchorReferenceFrame( 'boop' ); +// returns false +``` + +</section> + +<!-- /.examples --> + +<!-- Section to include cited references. If references are included, add a horizontal rule *before* the section. Make sure to keep an empty line after the `section` element and another before the `/section` close. --> + +<section class="references"> + +</section> + +<!-- /.references --> + +<!-- Section for related `stdlib` packages. Do not manually edit this section, as it is automatically populated. --> + +<section class="related"> + +</section> + +<!-- /.related --> + +<!-- Section for all links. Make sure to keep an empty line after the `section` element and another before the `/section` close. --> + +<section class="links"> + +</section> + +<!-- /.links --> diff --git a/lib/node_modules/@stdlib/plot/vega/base/anchor-reference-frames/benchmark/benchmark.js b/lib/node_modules/@stdlib/plot/vega/base/anchor-reference-frames/benchmark/benchmark.js new file mode 100644 index 000000000000..0bc3cb6ed32d --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/anchor-reference-frames/benchmark/benchmark.js @@ -0,0 +1,48 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var bench = require( '@stdlib/bench' ); +var isStringArray = require( '@stdlib/assert/is-string-array' ).primitives; +var pkg = require( './../package.json' ).name; +var anchorReferenceFrames = require( './../lib' ); + + +// MAIN // + +bench( pkg, function benchmark( b ) { + var out; + var i; + + b.tic(); + for ( i = 0; i < b.iterations; i++ ) { + out = anchorReferenceFrames(); + if ( out.length < 2 ) { + b.fail( 'should return an array' ); + } + } + b.toc(); + if ( !isStringArray( out ) ) { + b.fail( 'should return an array of strings' ); + } + b.pass( 'benchmark finished' ); + b.end(); +}); diff --git a/lib/node_modules/@stdlib/plot/vega/base/anchor-reference-frames/docs/repl.txt b/lib/node_modules/@stdlib/plot/vega/base/anchor-reference-frames/docs/repl.txt new file mode 100644 index 000000000000..35c97e217c32 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/anchor-reference-frames/docs/repl.txt @@ -0,0 +1,17 @@ + +{{alias}}() + Returns a list of anchor reference frames. + + Returns + ------- + out: Array<string> + List of anchor reference frames. + + Examples + -------- + > var out = {{alias}}() + [ 'bounds', 'group' ] + + See Also + -------- + diff --git a/lib/node_modules/@stdlib/plot/vega/base/anchor-reference-frames/docs/types/index.d.ts b/lib/node_modules/@stdlib/plot/vega/base/anchor-reference-frames/docs/types/index.d.ts new file mode 100644 index 000000000000..ceac0687cd3d --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/anchor-reference-frames/docs/types/index.d.ts @@ -0,0 +1,35 @@ +/* +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +// TypeScript Version: 4.1 + +/** +* Returns a list of anchor reference frames. +* +* @returns list of anchor reference frames +* +* @example +* var list = anchorReferenceFrames(); +* // returns [ 'bounds', 'group' ] +*/ +declare function anchorReferenceFrames(): Array<string>; + + +// EXPORTS // + +export = anchorReferenceFrames; diff --git a/lib/node_modules/@stdlib/plot/vega/base/anchor-reference-frames/docs/types/test.ts b/lib/node_modules/@stdlib/plot/vega/base/anchor-reference-frames/docs/types/test.ts new file mode 100644 index 000000000000..c3a095e0dba5 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/anchor-reference-frames/docs/types/test.ts @@ -0,0 +1,32 @@ +/* +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +import anchorReferenceFrames = require( './index' ); + + +// TESTS // + +// The function returns an array of strings... +{ + anchorReferenceFrames(); // $ExpectType string[] +} + +// The compiler throws an error if the function is provided any arguments... +{ + anchorReferenceFrames( 9 ); // $ExpectError +} diff --git a/lib/node_modules/@stdlib/plot/vega/base/anchor-reference-frames/examples/index.js b/lib/node_modules/@stdlib/plot/vega/base/anchor-reference-frames/examples/index.js new file mode 100644 index 000000000000..85e16dc50e5f --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/anchor-reference-frames/examples/index.js @@ -0,0 +1,40 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +var contains = require( '@stdlib/array/base/assert/contains' ).factory; +var anchorReferenceFrames = require( './../lib' ); + +var isAnchorReferenceFrame = contains( anchorReferenceFrames() ); + +var bool = isAnchorReferenceFrame( 'bounds' ); +console.log( bool ); +// => true + +bool = isAnchorReferenceFrame( 'group' ); +console.log( bool ); +// => true + +bool = isAnchorReferenceFrame( 'beep' ); +console.log( bool ); +// => false + +bool = isAnchorReferenceFrame( 'boop' ); +console.log( bool ); +// => false diff --git a/lib/node_modules/@stdlib/plot/vega/base/anchor-reference-frames/lib/data.json b/lib/node_modules/@stdlib/plot/vega/base/anchor-reference-frames/lib/data.json new file mode 100644 index 000000000000..c95e95b3ccc3 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/anchor-reference-frames/lib/data.json @@ -0,0 +1,4 @@ +[ + "bounds", + "group" +] diff --git a/lib/node_modules/@stdlib/plot/vega/base/anchor-reference-frames/lib/index.js b/lib/node_modules/@stdlib/plot/vega/base/anchor-reference-frames/lib/index.js new file mode 100644 index 000000000000..6593eac924b7 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/anchor-reference-frames/lib/index.js @@ -0,0 +1,40 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +/** +* Return a list of anchor reference frames. +* +* @module @stdlib/plot/vega/base/anchor-reference-frames +* +* @example +* var anchorReferenceFrames = require( '@stdlib/plot/vega/base/anchor-reference-frames' ); +* +* var out = anchorReferenceFrames(); +* // returns [ 'bounds', 'group' ] +*/ + +// MODULES // + +var main = require( './main.js' ); + + +// EXPORTS // + +module.exports = main; diff --git a/lib/node_modules/@stdlib/plot/vega/base/anchor-reference-frames/lib/main.js b/lib/node_modules/@stdlib/plot/vega/base/anchor-reference-frames/lib/main.js new file mode 100644 index 000000000000..5a63cfbfed89 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/anchor-reference-frames/lib/main.js @@ -0,0 +1,44 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var DATA = require( './data.json' ); + + +// MAIN // + +/** +* Returns a list of anchor reference frames. +* +* @returns {StringArray} list of anchor reference frames +* +* @example +* var out = orientations(); +* // returns [ 'bounds', 'group' ] +*/ +function orientations() { + return DATA.slice(); +} + + +// EXPORTS // + +module.exports = orientations; diff --git a/lib/node_modules/@stdlib/plot/vega/base/anchor-reference-frames/package.json b/lib/node_modules/@stdlib/plot/vega/base/anchor-reference-frames/package.json new file mode 100644 index 000000000000..e3f12e21bfae --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/anchor-reference-frames/package.json @@ -0,0 +1,63 @@ +{ + "name": "@stdlib/plot/vega/base/anchor-reference-frames", + "version": "0.0.0", + "description": "List of supported Vega anchor reference frames.", + "license": "Apache-2.0", + "author": { + "name": "The Stdlib Authors", + "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" + }, + "contributors": [ + { + "name": "The Stdlib Authors", + "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" + } + ], + "main": "./lib", + "directories": { + "benchmark": "./benchmark", + "doc": "./docs", + "example": "./examples", + "lib": "./lib", + "test": "./test" + }, + "types": "./docs/types", + "scripts": {}, + "homepage": "https://github.com/stdlib-js/stdlib", + "repository": { + "type": "git", + "url": "git://github.com/stdlib-js/stdlib.git" + }, + "bugs": { + "url": "https://github.com/stdlib-js/stdlib/issues" + }, + "dependencies": {}, + "devDependencies": {}, + "engines": { + "node": ">=0.10.0", + "npm": ">2.7.0" + }, + "os": [ + "aix", + "darwin", + "freebsd", + "linux", + "macos", + "openbsd", + "sunos", + "win32", + "windows" + ], + "keywords": [ + "stdlib", + "plot", + "vega", + "anchor", + "frame", + "utilities", + "utility", + "utils", + "util" + ], + "__stdlib__": {} +} diff --git a/lib/node_modules/@stdlib/plot/vega/base/anchor-reference-frames/test/test.js b/lib/node_modules/@stdlib/plot/vega/base/anchor-reference-frames/test/test.js new file mode 100644 index 000000000000..bf125d01a185 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/anchor-reference-frames/test/test.js @@ -0,0 +1,47 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var tape = require( 'tape' ); +var anchorReferenceFrames = require( './../lib' ); + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof anchorReferenceFrames, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'the function returns a list of anchor reference frames', function test( t ) { + var expected; + var actual; + + expected = [ + 'bounds', + 'group' + ]; + actual = anchorReferenceFrames(); + + t.deepEqual( actual, expected, 'returns expected value' ); + t.end(); +}); diff --git a/lib/node_modules/@stdlib/plot/vega/base/assert/is-anchor-position/README.md b/lib/node_modules/@stdlib/plot/vega/base/assert/is-anchor-position/README.md new file mode 100644 index 000000000000..38b3bf26d620 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/assert/is-anchor-position/README.md @@ -0,0 +1,119 @@ +<!-- + +@license Apache-2.0 + +Copyright (c) 2025 The Stdlib Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + +--> + +# isAnchorPosition + +> Test if an input value is a supported [anchor position][@stdlib/plot/vega/base/anchor-positions]. + +<!-- Section to include introductory text. Make sure to keep an empty line after the intro `section` element and another before the `/section` close. --> + +<section class="intro"> + +</section> + +<!-- /.intro --> + +<!-- Package usage documentation. --> + +<section class="usage"> + +## Usage + +```javascript +var isAnchorPosition = require( '@stdlib/plot/vega/base/assert/is-anchor-position' ); +``` + +#### isAnchorPosition( value ) + +Tests if an input value is a supported [anchor position][@stdlib/plot/vega/base/anchor-positions]. + +```javascript +var bool = isAnchorPosition( 'start' ); +// returns true + +bool = isAnchorPosition( 'foo' ); +// returns false +``` + +</section> + +<!-- /.usage --> + +<!-- Package usage notes. Make sure to keep an empty line after the `section` element and another before the `/section` close. --> + +<section class="notes"> + +</section> + +<!-- /.notes --> + +<!-- Package usage examples. --> + +<section class="examples"> + +## Examples + +<!-- eslint no-undef: "error" --> + +```javascript +var isAnchorPosition = require( '@stdlib/plot/vega/base/assert/is-anchor-position' ); + +var bool = isAnchorPosition( 'start' ); +// returns true + +bool = isAnchorPosition( 'middle' ); +// returns true + +bool = isAnchorPosition( '' ); +// returns false + +bool = isAnchorPosition( 'foo' ); +// returns false +``` + +</section> + +<!-- /.examples --> + +<!-- Section to include cited references. If references are included, add a horizontal rule *before* the section. Make sure to keep an empty line after the `section` element and another before the `/section` close. --> + +<section class="references"> + +</section> + +<!-- /.references --> + +<!-- Section for related `stdlib` packages. Do not manually edit this section, as it is automatically populated. --> + +<section class="related"> + +</section> + +<!-- /.related --> + +<!-- Section for all links. Make sure to keep an empty line after the `section` element and another before the `/section` close. --> + +<section class="links"> + +[@stdlib/plot/vega/base/anchor-positions]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/plot/vega/base/anchor-positions + +</section> + +<!-- /.links --> diff --git a/lib/node_modules/@stdlib/plot/vega/base/assert/is-anchor-position/benchmark/benchmark.js b/lib/node_modules/@stdlib/plot/vega/base/assert/is-anchor-position/benchmark/benchmark.js new file mode 100644 index 000000000000..159e07019555 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/assert/is-anchor-position/benchmark/benchmark.js @@ -0,0 +1,62 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var bench = require( '@stdlib/bench' ); +var isBoolean = require( '@stdlib/assert/is-boolean' ).isPrimitive; +var pkg = require( './../package.json' ).name; +var isAnchorPosition = require( './../lib' ); + + +// MAIN // + +bench( pkg, function benchmark( b ) { + var values; + var out; + var v; + var i; + + values = [ + 'middle', + 'start', + + 'foo', + 'bar', + '', + 'beep', + 'boop' + ]; + + b.tic(); + for ( i = 0; i < b.iterations; i++ ) { + v = values[ i%values.length ]; + out = isAnchorPosition( v ); + if ( typeof out !== 'boolean' ) { + b.fail( 'should return a boolean' ); + } + } + b.toc(); + if ( !isBoolean( out ) ) { + b.fail( 'should return a boolean' ); + } + b.pass( 'benchmark finished' ); + b.end(); +}); diff --git a/lib/node_modules/@stdlib/plot/vega/base/assert/is-anchor-position/docs/repl.txt b/lib/node_modules/@stdlib/plot/vega/base/assert/is-anchor-position/docs/repl.txt new file mode 100644 index 000000000000..192a96c1c01b --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/assert/is-anchor-position/docs/repl.txt @@ -0,0 +1,28 @@ + +{{alias}}( value ) + Tests if an input value is a supported anchor position. + + Parameters + ---------- + value: any + Value to test. + + Returns + ------- + bool: boolean + Boolean indicating if an input value is a supported anchor position. + + Examples + -------- + > var bool = {{alias}}( 'start' ) + true + > bool = {{alias}}( 'middle' ) + true + > bool = {{alias}}( '' ) + false + > bool = {{alias}}( 'beep' ) + false + + See Also + -------- + diff --git a/lib/node_modules/@stdlib/plot/vega/base/assert/is-anchor-position/docs/types/index.d.ts b/lib/node_modules/@stdlib/plot/vega/base/assert/is-anchor-position/docs/types/index.d.ts new file mode 100644 index 000000000000..7aed7196dc02 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/assert/is-anchor-position/docs/types/index.d.ts @@ -0,0 +1,45 @@ +/* +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +// TypeScript Version: 4.1 + +/** +* Tests whether an input value is a supported anchor position. +* +* @param v - value to test +* @returns boolean indicating whether an input value is a supported anchor position +* +* @example +* var bool = isAnchorPosition( 'start' ); +* // returns true +* +* bool = isAnchorPosition( 'middle' ); +* // returns true +* +* bool = isAnchorPosition( 'bar' ); +* // returns false +* +* bool = isAnchorPosition( 'foo' ); +* // returns false +*/ +declare function isAnchorPosition( v: any ): boolean; + + +// EXPORTS // + +export = isAnchorPosition; diff --git a/lib/node_modules/@stdlib/plot/vega/base/assert/is-anchor-position/docs/types/test.ts b/lib/node_modules/@stdlib/plot/vega/base/assert/is-anchor-position/docs/types/test.ts new file mode 100644 index 000000000000..5ebfc7a2b5e3 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/assert/is-anchor-position/docs/types/test.ts @@ -0,0 +1,34 @@ +/* +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +import isAnchorPosition = require( './index' ); + + +// TESTS // + +// The function returns a boolean... +{ + isAnchorPosition( 'middle' ); // $ExpectType boolean + isAnchorPosition( 'foo' ); // $ExpectType boolean +} + +// The compiler throws an error if the function is provided an unsupported number of arguments... +{ + isAnchorPosition(); // $ExpectError + isAnchorPosition( undefined, 123 ); // $ExpectError +} diff --git a/lib/node_modules/@stdlib/plot/vega/base/assert/is-anchor-position/examples/index.js b/lib/node_modules/@stdlib/plot/vega/base/assert/is-anchor-position/examples/index.js new file mode 100644 index 000000000000..b9ed0056bfd9 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/assert/is-anchor-position/examples/index.js @@ -0,0 +1,37 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +var isAnchorPosition = require( './../lib' ); + +var bool = isAnchorPosition( 'start' ); +console.log( bool ); +// => true + +bool = isAnchorPosition( 'middle' ); +console.log( bool ); +// => true + +bool = isAnchorPosition( '' ); +console.log( bool ); +// => false + +bool = isAnchorPosition( 'foo' ); +console.log( bool ); +// => false diff --git a/lib/node_modules/@stdlib/plot/vega/base/assert/is-anchor-position/lib/index.js b/lib/node_modules/@stdlib/plot/vega/base/assert/is-anchor-position/lib/index.js new file mode 100644 index 000000000000..1bee1c85f2ea --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/assert/is-anchor-position/lib/index.js @@ -0,0 +1,49 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +/** +* Test whether an input value is a supported anchor position. +* +* @module @stdlib/plot/vega/base/assert/is-anchor-position +* +* @example +* var isAnchorPosition = require( '@stdlib/plot/vega/base/assert/is-anchor-position' ); +* +* var bool = isAnchorPosition( 'start' ); +* // returns true +* +* bool = isAnchorPosition( 'middle' ); +* // returns true +* +* bool = isAnchorPosition( 'bar' ); +* // returns false +* +* bool = isAnchorPosition( 'foo' ); +* // returns false +*/ + +// MODULES // + +var main = require( './main.js' ); + + +// EXPORTS // + +module.exports = main; diff --git a/lib/node_modules/@stdlib/plot/vega/base/assert/is-anchor-position/lib/main.js b/lib/node_modules/@stdlib/plot/vega/base/assert/is-anchor-position/lib/main.js new file mode 100644 index 000000000000..aa6589851931 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/assert/is-anchor-position/lib/main.js @@ -0,0 +1,55 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var contains = require( '@stdlib/array/base/assert/contains' ).factory; +var anchorPositions = require( '@stdlib/plot/vega/base/anchor-positions' ); + + +// MAIN // + +/** +* Tests whether an input value is a supported anchor position. +* +* @name isAnchorPosition +* @type {Function} +* @param {*} v - value to test +* @returns {boolean} boolean indicating whether an input value is a supported anchor position +* +* @example +* var bool = isAnchorPosition( 'start' ); +* // returns true +* +* bool = isAnchorPosition( 'middle' ); +* // returns true +* +* bool = isAnchorPosition( 'bar' ); +* // returns false +* +* bool = isAnchorPosition( 'foo' ); +* // returns false +*/ +var isAnchorPosition = contains( anchorPositions() ); + + +// EXPORTS // + +module.exports = isAnchorPosition; diff --git a/lib/node_modules/@stdlib/plot/vega/base/assert/is-anchor-position/package.json b/lib/node_modules/@stdlib/plot/vega/base/assert/is-anchor-position/package.json new file mode 100644 index 000000000000..5fd095616266 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/assert/is-anchor-position/package.json @@ -0,0 +1,70 @@ +{ + "name": "@stdlib/plot/vega/base/assert/is-anchor-position", + "version": "0.0.0", + "description": "Test if an input value is a supported anchor position.", + "license": "Apache-2.0", + "author": { + "name": "The Stdlib Authors", + "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" + }, + "contributors": [ + { + "name": "The Stdlib Authors", + "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" + } + ], + "main": "./lib", + "directories": { + "benchmark": "./benchmark", + "doc": "./docs", + "example": "./examples", + "lib": "./lib", + "test": "./test" + }, + "types": "./docs/types", + "scripts": {}, + "homepage": "https://github.com/stdlib-js/stdlib", + "repository": { + "type": "git", + "url": "git://github.com/stdlib-js/stdlib.git" + }, + "bugs": { + "url": "https://github.com/stdlib-js/stdlib/issues" + }, + "dependencies": {}, + "devDependencies": {}, + "engines": { + "node": ">=0.10.0", + "npm": ">2.7.0" + }, + "os": [ + "aix", + "darwin", + "freebsd", + "linux", + "macos", + "openbsd", + "sunos", + "win32", + "windows" + ], + "keywords": [ + "stdlib", + "plot", + "base", + "vega", + "utilities", + "utility", + "utils", + "util", + "assert", + "test", + "check", + "is", + "valid", + "validate", + "validation", + "isvalid" + ], + "__stdlib__": {} +} diff --git a/lib/node_modules/@stdlib/plot/vega/base/assert/is-anchor-position/test/test.js b/lib/node_modules/@stdlib/plot/vega/base/assert/is-anchor-position/test/test.js new file mode 100644 index 000000000000..754da8024d80 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/assert/is-anchor-position/test/test.js @@ -0,0 +1,78 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var tape = require( 'tape' ); +var isAnchorPosition = require( './../lib' ); + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof isAnchorPosition, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'the function returns `true` if provided a supported anchor position', function test( t ) { + var values; + var bool; + var i; + + values = [ + 'start', + 'middle', + 'end' + ]; + for ( i = 0; i < values.length; i++ ) { + bool = isAnchorPosition( values[ i ] ); + t.strictEqual( bool, true, 'returns expected value when provided '+values[ i ] ); + } + t.end(); +}); + +tape( 'the function returns `false` if not provided a supported anchor position', function test( t ) { + var values; + var bool; + var i; + + values = [ + '', + 'beep', + 'boop', + 'foo', + 'bar', + 5, + NaN, + true, + false, + null, + void 0, + [], + {}, + function noop() {} + ]; + for ( i = 0; i < values.length; i++ ) { + bool = isAnchorPosition( values[ i ] ); + t.strictEqual( bool, false, 'returns expected value when provided '+values[ i ] ); + } + t.end(); +}); diff --git a/lib/node_modules/@stdlib/plot/vega/base/assert/is-anchor-reference-frame/README.md b/lib/node_modules/@stdlib/plot/vega/base/assert/is-anchor-reference-frame/README.md new file mode 100644 index 000000000000..97d03cd2521a --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/assert/is-anchor-reference-frame/README.md @@ -0,0 +1,119 @@ +<!-- + +@license Apache-2.0 + +Copyright (c) 2025 The Stdlib Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + +--> + +# isAnchorReferenceFrame + +> Test if an input value is a supported [anchor reference frame][@stdlib/plot/vega/base/anchor-reference-frames]. + +<!-- Section to include introductory text. Make sure to keep an empty line after the intro `section` element and another before the `/section` close. --> + +<section class="intro"> + +</section> + +<!-- /.intro --> + +<!-- Package usage documentation. --> + +<section class="usage"> + +## Usage + +```javascript +var isAnchorReferenceFrame = require( '@stdlib/plot/vega/base/assert/is-anchor-reference-frame' ); +``` + +#### isAnchorReferenceFrame( value ) + +Tests if an input value is a supported [anchor reference frame][@stdlib/plot/vega/base/anchor-reference-frames]. + +```javascript +var bool = isAnchorReferenceFrame( 'bounds' ); +// returns true + +bool = isAnchorReferenceFrame( 'foo' ); +// returns false +``` + +</section> + +<!-- /.usage --> + +<!-- Package usage notes. Make sure to keep an empty line after the `section` element and another before the `/section` close. --> + +<section class="notes"> + +</section> + +<!-- /.notes --> + +<!-- Package usage examples. --> + +<section class="examples"> + +## Examples + +<!-- eslint no-undef: "error" --> + +```javascript +var isAnchorReferenceFrame = require( '@stdlib/plot/vega/base/assert/is-anchor-reference-frame' ); + +var bool = isAnchorReferenceFrame( 'bounds' ); +// returns true + +bool = isAnchorReferenceFrame( 'group' ); +// returns true + +bool = isAnchorReferenceFrame( '' ); +// returns false + +bool = isAnchorReferenceFrame( 'foo' ); +// returns false +``` + +</section> + +<!-- /.examples --> + +<!-- Section to include cited references. If references are included, add a horizontal rule *before* the section. Make sure to keep an empty line after the `section` element and another before the `/section` close. --> + +<section class="references"> + +</section> + +<!-- /.references --> + +<!-- Section for related `stdlib` packages. Do not manually edit this section, as it is automatically populated. --> + +<section class="related"> + +</section> + +<!-- /.related --> + +<!-- Section for all links. Make sure to keep an empty line after the `section` element and another before the `/section` close. --> + +<section class="links"> + +[@stdlib/plot/vega/base/anchor-reference-frames]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/plot/vega/base/anchor-reference-frames + +</section> + +<!-- /.links --> diff --git a/lib/node_modules/@stdlib/plot/vega/base/assert/is-anchor-reference-frame/benchmark/benchmark.js b/lib/node_modules/@stdlib/plot/vega/base/assert/is-anchor-reference-frame/benchmark/benchmark.js new file mode 100644 index 000000000000..7164bd3b958d --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/assert/is-anchor-reference-frame/benchmark/benchmark.js @@ -0,0 +1,62 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var bench = require( '@stdlib/bench' ); +var isBoolean = require( '@stdlib/assert/is-boolean' ).isPrimitive; +var pkg = require( './../package.json' ).name; +var isAnchorReferenceFrame = require( './../lib' ); + + +// MAIN // + +bench( pkg, function benchmark( b ) { + var values; + var out; + var v; + var i; + + values = [ + 'group', + 'bounds', + + 'foo', + 'bar', + '', + 'beep', + 'boop' + ]; + + b.tic(); + for ( i = 0; i < b.iterations; i++ ) { + v = values[ i%values.length ]; + out = isAnchorReferenceFrame( v ); + if ( typeof out !== 'boolean' ) { + b.fail( 'should return a boolean' ); + } + } + b.toc(); + if ( !isBoolean( out ) ) { + b.fail( 'should return a boolean' ); + } + b.pass( 'benchmark finished' ); + b.end(); +}); diff --git a/lib/node_modules/@stdlib/plot/vega/base/assert/is-anchor-reference-frame/docs/repl.txt b/lib/node_modules/@stdlib/plot/vega/base/assert/is-anchor-reference-frame/docs/repl.txt new file mode 100644 index 000000000000..c20975575375 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/assert/is-anchor-reference-frame/docs/repl.txt @@ -0,0 +1,29 @@ + +{{alias}}( value ) + Tests if an input value is a supported anchor reference frame. + + Parameters + ---------- + value: any + Value to test. + + Returns + ------- + bool: boolean + Boolean indicating if an input value is a supported anchor reference + frame. + + Examples + -------- + > var bool = {{alias}}( 'bounds' ) + true + > bool = {{alias}}( 'group' ) + true + > bool = {{alias}}( '' ) + false + > bool = {{alias}}( 'beep' ) + false + + See Also + -------- + diff --git a/lib/node_modules/@stdlib/plot/vega/base/assert/is-anchor-reference-frame/docs/types/index.d.ts b/lib/node_modules/@stdlib/plot/vega/base/assert/is-anchor-reference-frame/docs/types/index.d.ts new file mode 100644 index 000000000000..a658c0852302 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/assert/is-anchor-reference-frame/docs/types/index.d.ts @@ -0,0 +1,45 @@ +/* +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +// TypeScript Version: 4.1 + +/** +* Tests whether an input value is a supported anchor reference frame. +* +* @param v - value to test +* @returns boolean indicating whether an input value is a supported anchor reference frame +* +* @example +* var bool = isAnchorReferenceFrame( 'bounds' ); +* // returns true +* +* bool = isAnchorReferenceFrame( 'group' ); +* // returns true +* +* bool = isAnchorReferenceFrame( 'bar' ); +* // returns false +* +* bool = isAnchorReferenceFrame( 'foo' ); +* // returns false +*/ +declare function isAnchorReferenceFrame( v: any ): boolean; + + +// EXPORTS // + +export = isAnchorReferenceFrame; diff --git a/lib/node_modules/@stdlib/plot/vega/base/assert/is-anchor-reference-frame/docs/types/test.ts b/lib/node_modules/@stdlib/plot/vega/base/assert/is-anchor-reference-frame/docs/types/test.ts new file mode 100644 index 000000000000..a7198fd2fb09 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/assert/is-anchor-reference-frame/docs/types/test.ts @@ -0,0 +1,34 @@ +/* +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +import isAnchorReferenceFrame = require( './index' ); + + +// TESTS // + +// The function returns a boolean... +{ + isAnchorReferenceFrame( 'group' ); // $ExpectType boolean + isAnchorReferenceFrame( 'foo' ); // $ExpectType boolean +} + +// The compiler throws an error if the function is provided an unsupported number of arguments... +{ + isAnchorReferenceFrame(); // $ExpectError + isAnchorReferenceFrame( undefined, 123 ); // $ExpectError +} diff --git a/lib/node_modules/@stdlib/plot/vega/base/assert/is-anchor-reference-frame/examples/index.js b/lib/node_modules/@stdlib/plot/vega/base/assert/is-anchor-reference-frame/examples/index.js new file mode 100644 index 000000000000..90343c8aba0c --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/assert/is-anchor-reference-frame/examples/index.js @@ -0,0 +1,37 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +var isAnchorReferenceFrame = require( './../lib' ); + +var bool = isAnchorReferenceFrame( 'bounds' ); +console.log( bool ); +// => true + +bool = isAnchorReferenceFrame( 'group' ); +console.log( bool ); +// => true + +bool = isAnchorReferenceFrame( '' ); +console.log( bool ); +// => false + +bool = isAnchorReferenceFrame( 'foo' ); +console.log( bool ); +// => false diff --git a/lib/node_modules/@stdlib/plot/vega/base/assert/is-anchor-reference-frame/lib/index.js b/lib/node_modules/@stdlib/plot/vega/base/assert/is-anchor-reference-frame/lib/index.js new file mode 100644 index 000000000000..caba81a874eb --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/assert/is-anchor-reference-frame/lib/index.js @@ -0,0 +1,49 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +/** +* Test whether an input value is a supported anchor reference frame. +* +* @module @stdlib/plot/vega/base/assert/is-anchor-reference-frame +* +* @example +* var isAnchorReferenceFrame = require( '@stdlib/plot/vega/base/assert/is-anchor-reference-frame' ); +* +* var bool = isAnchorReferenceFrame( 'bounds' ); +* // returns true +* +* bool = isAnchorReferenceFrame( 'group' ); +* // returns true +* +* bool = isAnchorReferenceFrame( 'bar' ); +* // returns false +* +* bool = isAnchorReferenceFrame( 'foo' ); +* // returns false +*/ + +// MODULES // + +var main = require( './main.js' ); + + +// EXPORTS // + +module.exports = main; diff --git a/lib/node_modules/@stdlib/plot/vega/base/assert/is-anchor-reference-frame/lib/main.js b/lib/node_modules/@stdlib/plot/vega/base/assert/is-anchor-reference-frame/lib/main.js new file mode 100644 index 000000000000..6ba781ce691d --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/assert/is-anchor-reference-frame/lib/main.js @@ -0,0 +1,55 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var contains = require( '@stdlib/array/base/assert/contains' ).factory; +var anchorReferenceFrames = require( '@stdlib/plot/vega/base/anchor-reference-frames' ); + + +// MAIN // + +/** +* Tests whether an input value is a supported anchor reference frame. +* +* @name isAnchorReferenceFrame +* @type {Function} +* @param {*} v - value to test +* @returns {boolean} boolean indicating whether an input value is a supported anchor reference frame +* +* @example +* var bool = isAnchorReferenceFrame( 'bounds' ); +* // returns true +* +* bool = isAnchorReferenceFrame( 'group' ); +* // returns true +* +* bool = isAnchorReferenceFrame( 'bar' ); +* // returns false +* +* bool = isAnchorReferenceFrame( 'foo' ); +* // returns false +*/ +var isAnchorReferenceFrame = contains( anchorReferenceFrames() ); + + +// EXPORTS // + +module.exports = isAnchorReferenceFrame; diff --git a/lib/node_modules/@stdlib/plot/vega/base/assert/is-anchor-reference-frame/package.json b/lib/node_modules/@stdlib/plot/vega/base/assert/is-anchor-reference-frame/package.json new file mode 100644 index 000000000000..57655dde3ac8 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/assert/is-anchor-reference-frame/package.json @@ -0,0 +1,70 @@ +{ + "name": "@stdlib/plot/vega/base/assert/is-anchor-reference-frame", + "version": "0.0.0", + "description": "Test if an input value is a supported anchor reference frame.", + "license": "Apache-2.0", + "author": { + "name": "The Stdlib Authors", + "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" + }, + "contributors": [ + { + "name": "The Stdlib Authors", + "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" + } + ], + "main": "./lib", + "directories": { + "benchmark": "./benchmark", + "doc": "./docs", + "example": "./examples", + "lib": "./lib", + "test": "./test" + }, + "types": "./docs/types", + "scripts": {}, + "homepage": "https://github.com/stdlib-js/stdlib", + "repository": { + "type": "git", + "url": "git://github.com/stdlib-js/stdlib.git" + }, + "bugs": { + "url": "https://github.com/stdlib-js/stdlib/issues" + }, + "dependencies": {}, + "devDependencies": {}, + "engines": { + "node": ">=0.10.0", + "npm": ">2.7.0" + }, + "os": [ + "aix", + "darwin", + "freebsd", + "linux", + "macos", + "openbsd", + "sunos", + "win32", + "windows" + ], + "keywords": [ + "stdlib", + "plot", + "base", + "vega", + "utilities", + "utility", + "utils", + "util", + "assert", + "test", + "check", + "is", + "valid", + "validate", + "validation", + "isvalid" + ], + "__stdlib__": {} +} diff --git a/lib/node_modules/@stdlib/plot/vega/base/assert/is-anchor-reference-frame/test/test.js b/lib/node_modules/@stdlib/plot/vega/base/assert/is-anchor-reference-frame/test/test.js new file mode 100644 index 000000000000..ad818b78838a --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/assert/is-anchor-reference-frame/test/test.js @@ -0,0 +1,77 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var tape = require( 'tape' ); +var isAnchorReferenceFrame = require( './../lib' ); + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof isAnchorReferenceFrame, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'the function returns `true` if provided a supported anchor reference frame', function test( t ) { + var values; + var bool; + var i; + + values = [ + 'bounds', + 'group' + ]; + for ( i = 0; i < values.length; i++ ) { + bool = isAnchorReferenceFrame( values[ i ] ); + t.strictEqual( bool, true, 'returns expected value when provided '+values[ i ] ); + } + t.end(); +}); + +tape( 'the function returns `false` if not provided a supported anchor reference frame', function test( t ) { + var values; + var bool; + var i; + + values = [ + '', + 'beep', + 'boop', + 'foo', + 'bar', + 5, + NaN, + true, + false, + null, + void 0, + [], + {}, + function noop() {} + ]; + for ( i = 0; i < values.length; i++ ) { + bool = isAnchorReferenceFrame( values[ i ] ); + t.strictEqual( bool, false, 'returns expected value when provided '+values[ i ] ); + } + t.end(); +}); diff --git a/lib/node_modules/@stdlib/plot/vega/base/assert/is-autosize-method/README.md b/lib/node_modules/@stdlib/plot/vega/base/assert/is-autosize-method/README.md new file mode 100644 index 000000000000..eb3e6126506f --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/assert/is-autosize-method/README.md @@ -0,0 +1,119 @@ +<!-- + +@license Apache-2.0 + +Copyright (c) 2025 The Stdlib Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + +--> + +# isAutosizeMethod + +> Test if an input value is a supported [autosize method][@stdlib/plot/vega/autosize/methods]. + +<!-- Section to include introductory text. Make sure to keep an empty line after the intro `section` element and another before the `/section` close. --> + +<section class="intro"> + +</section> + +<!-- /.intro --> + +<!-- Package usage documentation. --> + +<section class="usage"> + +## Usage + +```javascript +var isAutosizeMethod = require( '@stdlib/plot/vega/base/assert/is-autosize-method' ); +``` + +#### isAutosizeMethod( value ) + +Tests if an input value is a supported [autosize method][@stdlib/plot/vega/autosize/methods]. + +```javascript +var bool = isAutosizeMethod( 'pad' ); +// returns true + +bool = isAutosizeMethod( 'foo' ); +// returns false +``` + +</section> + +<!-- /.usage --> + +<!-- Package usage notes. Make sure to keep an empty line after the `section` element and another before the `/section` close. --> + +<section class="notes"> + +</section> + +<!-- /.notes --> + +<!-- Package usage examples. --> + +<section class="examples"> + +## Examples + +<!-- eslint no-undef: "error" --> + +```javascript +var isAutosizeMethod = require( '@stdlib/plot/vega/base/assert/is-autosize-method' ); + +var bool = isAutosizeMethod( 'pad' ); +// returns true + +bool = isAutosizeMethod( 'none' ); +// returns true + +bool = isAutosizeMethod( '' ); +// returns false + +bool = isAutosizeMethod( 'foo' ); +// returns false +``` + +</section> + +<!-- /.examples --> + +<!-- Section to include cited references. If references are included, add a horizontal rule *before* the section. Make sure to keep an empty line after the `section` element and another before the `/section` close. --> + +<section class="references"> + +</section> + +<!-- /.references --> + +<!-- Section for related `stdlib` packages. Do not manually edit this section, as it is automatically populated. --> + +<section class="related"> + +</section> + +<!-- /.related --> + +<!-- Section for all links. Make sure to keep an empty line after the `section` element and another before the `/section` close. --> + +<section class="links"> + +[@stdlib/plot/vega/autosize/methods]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/plot/vega/autosize/methods + +</section> + +<!-- /.links --> diff --git a/lib/node_modules/@stdlib/plot/vega/base/assert/is-autosize-method/benchmark/benchmark.js b/lib/node_modules/@stdlib/plot/vega/base/assert/is-autosize-method/benchmark/benchmark.js new file mode 100644 index 000000000000..32e1bdc9be64 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/assert/is-autosize-method/benchmark/benchmark.js @@ -0,0 +1,62 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var bench = require( '@stdlib/bench' ); +var isBoolean = require( '@stdlib/assert/is-boolean' ).isPrimitive; +var pkg = require( './../package.json' ).name; +var isAutosizeMethod = require( './../lib' ); + + +// MAIN // + +bench( pkg, function benchmark( b ) { + var values; + var out; + var v; + var i; + + values = [ + 'none', + 'pad', + + 'foo', + 'bar', + '', + 'beep', + 'boop' + ]; + + b.tic(); + for ( i = 0; i < b.iterations; i++ ) { + v = values[ i%values.length ]; + out = isAutosizeMethod( v ); + if ( typeof out !== 'boolean' ) { + b.fail( 'should return a boolean' ); + } + } + b.toc(); + if ( !isBoolean( out ) ) { + b.fail( 'should return a boolean' ); + } + b.pass( 'benchmark finished' ); + b.end(); +}); diff --git a/lib/node_modules/@stdlib/plot/vega/base/assert/is-autosize-method/docs/repl.txt b/lib/node_modules/@stdlib/plot/vega/base/assert/is-autosize-method/docs/repl.txt new file mode 100644 index 000000000000..a4ade8bba9ca --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/assert/is-autosize-method/docs/repl.txt @@ -0,0 +1,28 @@ + +{{alias}}( value ) + Tests if an input value is a supported autosize method. + + Parameters + ---------- + value: any + Value to test. + + Returns + ------- + bool: boolean + Boolean indicating if an input value is a supported autosize method. + + Examples + -------- + > var bool = {{alias}}( 'pad' ) + true + > bool = {{alias}}( 'none' ) + true + > bool = {{alias}}( '' ) + false + > bool = {{alias}}( 'beep' ) + false + + See Also + -------- + diff --git a/lib/node_modules/@stdlib/plot/vega/base/assert/is-autosize-method/docs/types/index.d.ts b/lib/node_modules/@stdlib/plot/vega/base/assert/is-autosize-method/docs/types/index.d.ts new file mode 100644 index 000000000000..cf91b10a7491 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/assert/is-autosize-method/docs/types/index.d.ts @@ -0,0 +1,45 @@ +/* +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +// TypeScript Version: 4.1 + +/** +* Tests whether an input value is a supported autosize method. +* +* @param v - value to test +* @returns boolean indicating whether an input value is a supported autosize method +* +* @example +* var bool = isAutosizeMethod( 'pad' ); +* // returns true +* +* bool = isAutosizeMethod( 'none' ); +* // returns true +* +* bool = isAutosizeMethod( 'bar' ); +* // returns false +* +* bool = isAutosizeMethod( 'foo' ); +* // returns false +*/ +declare function isAutosizeMethod( v: any ): boolean; + + +// EXPORTS // + +export = isAutosizeMethod; diff --git a/lib/node_modules/@stdlib/plot/vega/base/assert/is-autosize-method/docs/types/test.ts b/lib/node_modules/@stdlib/plot/vega/base/assert/is-autosize-method/docs/types/test.ts new file mode 100644 index 000000000000..c1baa809bec5 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/assert/is-autosize-method/docs/types/test.ts @@ -0,0 +1,34 @@ +/* +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +import isAutosizeMethod = require( './index' ); + + +// TESTS // + +// The function returns a boolean... +{ + isAutosizeMethod( 'none' ); // $ExpectType boolean + isAutosizeMethod( 'foo' ); // $ExpectType boolean +} + +// The compiler throws an error if the function is provided an unsupported number of arguments... +{ + isAutosizeMethod(); // $ExpectError + isAutosizeMethod( undefined, 123 ); // $ExpectError +} diff --git a/lib/node_modules/@stdlib/plot/vega/base/assert/is-autosize-method/examples/index.js b/lib/node_modules/@stdlib/plot/vega/base/assert/is-autosize-method/examples/index.js new file mode 100644 index 000000000000..be5c1f0683cd --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/assert/is-autosize-method/examples/index.js @@ -0,0 +1,37 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +var isAutosizeMethod = require( './../lib' ); + +var bool = isAutosizeMethod( 'pad' ); +console.log( bool ); +// => true + +bool = isAutosizeMethod( 'none' ); +console.log( bool ); +// => true + +bool = isAutosizeMethod( '' ); +console.log( bool ); +// => false + +bool = isAutosizeMethod( 'foo' ); +console.log( bool ); +// => false diff --git a/lib/node_modules/@stdlib/plot/vega/base/assert/is-autosize-method/lib/index.js b/lib/node_modules/@stdlib/plot/vega/base/assert/is-autosize-method/lib/index.js new file mode 100644 index 000000000000..27a8463925f4 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/assert/is-autosize-method/lib/index.js @@ -0,0 +1,49 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +/** +* Test whether an input value is a supported autosize method. +* +* @module @stdlib/plot/vega/base/assert/is-autosize-method +* +* @example +* var isAutosizeMethod = require( '@stdlib/plot/vega/base/assert/is-autosize-method' ); +* +* var bool = isAutosizeMethod( 'pad' ); +* // returns true +* +* bool = isAutosizeMethod( 'none' ); +* // returns true +* +* bool = isAutosizeMethod( 'bar' ); +* // returns false +* +* bool = isAutosizeMethod( 'foo' ); +* // returns false +*/ + +// MODULES // + +var main = require( './main.js' ); + + +// EXPORTS // + +module.exports = main; diff --git a/lib/node_modules/@stdlib/plot/vega/base/assert/is-autosize-method/lib/main.js b/lib/node_modules/@stdlib/plot/vega/base/assert/is-autosize-method/lib/main.js new file mode 100644 index 000000000000..4f72c6458ac4 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/assert/is-autosize-method/lib/main.js @@ -0,0 +1,55 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var contains = require( '@stdlib/array/base/assert/contains' ).factory; +var values = require( '@stdlib/plot/vega/autosize/methods' ); + + +// MAIN // + +/** +* Tests whether an input value is a supported autosize method. +* +* @name isAutosizeMethod +* @type {Function} +* @param {*} v - value to test +* @returns {boolean} boolean indicating whether an input value is a supported autosize method +* +* @example +* var bool = isAutosizeMethod( 'pad' ); +* // returns true +* +* bool = isAutosizeMethod( 'none' ); +* // returns true +* +* bool = isAutosizeMethod( 'bar' ); +* // returns false +* +* bool = isAutosizeMethod( 'foo' ); +* // returns false +*/ +var isAutosizeMethod = contains( values() ); + + +// EXPORTS // + +module.exports = isAutosizeMethod; diff --git a/lib/node_modules/@stdlib/plot/vega/base/assert/is-autosize-method/package.json b/lib/node_modules/@stdlib/plot/vega/base/assert/is-autosize-method/package.json new file mode 100644 index 000000000000..cbe9fb911a6d --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/assert/is-autosize-method/package.json @@ -0,0 +1,70 @@ +{ + "name": "@stdlib/plot/vega/base/assert/is-autosize-method", + "version": "0.0.0", + "description": "Test if an input value is a supported autosize method.", + "license": "Apache-2.0", + "author": { + "name": "The Stdlib Authors", + "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" + }, + "contributors": [ + { + "name": "The Stdlib Authors", + "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" + } + ], + "main": "./lib", + "directories": { + "benchmark": "./benchmark", + "doc": "./docs", + "example": "./examples", + "lib": "./lib", + "test": "./test" + }, + "types": "./docs/types", + "scripts": {}, + "homepage": "https://github.com/stdlib-js/stdlib", + "repository": { + "type": "git", + "url": "git://github.com/stdlib-js/stdlib.git" + }, + "bugs": { + "url": "https://github.com/stdlib-js/stdlib/issues" + }, + "dependencies": {}, + "devDependencies": {}, + "engines": { + "node": ">=0.10.0", + "npm": ">2.7.0" + }, + "os": [ + "aix", + "darwin", + "freebsd", + "linux", + "macos", + "openbsd", + "sunos", + "win32", + "windows" + ], + "keywords": [ + "stdlib", + "plot", + "base", + "vega", + "utilities", + "utility", + "utils", + "util", + "assert", + "test", + "check", + "is", + "valid", + "validate", + "validation", + "isvalid" + ], + "__stdlib__": {} +} diff --git a/lib/node_modules/@stdlib/plot/vega/base/assert/is-autosize-method/test/test.js b/lib/node_modules/@stdlib/plot/vega/base/assert/is-autosize-method/test/test.js new file mode 100644 index 000000000000..47c062185592 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/assert/is-autosize-method/test/test.js @@ -0,0 +1,80 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var tape = require( 'tape' ); +var isAutosizeMethod = require( './../lib' ); + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof isAutosizeMethod, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'the function returns `true` if provided a supported autosize method', function test( t ) { + var values; + var bool; + var i; + + values = [ + 'pad', + 'none', + 'fit', + 'fit-x', + 'fit-y' + ]; + for ( i = 0; i < values.length; i++ ) { + bool = isAutosizeMethod( values[ i ] ); + t.strictEqual( bool, true, 'returns expected value when provided '+values[ i ] ); + } + t.end(); +}); + +tape( 'the function returns `false` if not provided a supported autosize method', function test( t ) { + var values; + var bool; + var i; + + values = [ + '', + 'beep', + 'boop', + 'foo', + 'bar', + 5, + NaN, + true, + false, + null, + void 0, + [], + {}, + function noop() {} + ]; + for ( i = 0; i < values.length; i++ ) { + bool = isAutosizeMethod( values[ i ] ); + t.strictEqual( bool, false, 'returns expected value when provided '+values[ i ] ); + } + t.end(); +}); diff --git a/lib/node_modules/@stdlib/plot/vega/base/assert/is-autosize/README.md b/lib/node_modules/@stdlib/plot/vega/base/assert/is-autosize/README.md new file mode 100644 index 000000000000..552b6047dec7 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/assert/is-autosize/README.md @@ -0,0 +1,121 @@ +<!-- + +@license Apache-2.0 + +Copyright (c) 2025 The Stdlib Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + +--> + +# isAutosize + +> Test if an input value is an [autosize][@stdlib/plot/vega/autosize/ctor] instance. + +<!-- Section to include introductory text. Make sure to keep an empty line after the intro `section` element and another before the `/section` close. --> + +<section class="intro"> + +</section> + +<!-- /.intro --> + +<!-- Package usage documentation. --> + +<section class="usage"> + +## Usage + +```javascript +var isAutosize = require( '@stdlib/plot/vega/base/assert/is-autosize' ); +``` + +#### isAutosize( value ) + +Tests if an input value is an [autosize][@stdlib/plot/vega/autosize/ctor] instance. + +```javascript +var Autosize = require( '@stdlib/plot/vega/autosize/ctor' ); + +var v = new Autosize(); +var bool = isAutosize( v ); +// returns true + +bool = isAutosize( 'foo' ); +// returns false +``` + +</section> + +<!-- /.usage --> + +<!-- Package usage notes. Make sure to keep an empty line after the `section` element and another before the `/section` close. --> + +<section class="notes"> + +</section> + +<!-- /.notes --> + +<!-- Package usage examples. --> + +<section class="examples"> + +## Examples + +<!-- eslint no-undef: "error" --> + +```javascript +var Autosize = require( '@stdlib/plot/vega/autosize/ctor' ); +var isAutosize = require( '@stdlib/plot/vega/base/assert/is-autosize' ); + +var v = new Autosize(); +var bool = isAutosize( v ); +// returns true + +bool = isAutosize( {} ); +// returns false + +bool = isAutosize( 'foo' ); +// returns false +``` + +</section> + +<!-- /.examples --> + +<!-- Section to include cited references. If references are included, add a horizontal rule *before* the section. Make sure to keep an empty line after the `section` element and another before the `/section` close. --> + +<section class="references"> + +</section> + +<!-- /.references --> + +<!-- Section for related `stdlib` packages. Do not manually edit this section, as it is automatically populated. --> + +<section class="related"> + +</section> + +<!-- /.related --> + +<!-- Section for all links. Make sure to keep an empty line after the `section` element and another before the `/section` close. --> + +<section class="links"> + +[@stdlib/plot/vega/autosize/ctor]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/plot/vega/autosize/ctor + +</section> + +<!-- /.links --> diff --git a/lib/node_modules/@stdlib/plot/vega/base/assert/is-autosize/benchmark/benchmark.js b/lib/node_modules/@stdlib/plot/vega/base/assert/is-autosize/benchmark/benchmark.js new file mode 100644 index 000000000000..4f3a50e62e1b --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/assert/is-autosize/benchmark/benchmark.js @@ -0,0 +1,93 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var bench = require( '@stdlib/bench' ); +var isBoolean = require( '@stdlib/assert/is-boolean' ).isPrimitive; +var Autosize = require( '@stdlib/plot/vega/autosize/ctor' ); +var pkg = require( './../package.json' ).name; +var isAutosize = require( './../lib' ); + + +// MAIN // + +bench( pkg+'::true', function benchmark( b ) { + var values; + var out; + var v; + var i; + + values = [ + new Autosize({ + 'type': 'pad' + }), + new Autosize({ + 'type': 'none' + }) + ]; + + b.tic(); + for ( i = 0; i < b.iterations; i++ ) { + v = values[ i%values.length ]; + out = isAutosize( v ); + if ( typeof out !== 'boolean' ) { + b.fail( 'should return a boolean' ); + } + } + b.toc(); + if ( !isBoolean( out ) ) { + b.fail( 'should return a boolean' ); + } + b.pass( 'benchmark finished' ); + b.end(); +}); + +bench( pkg+'::false', function benchmark( b ) { + var values; + var out; + var v; + var i; + + values = [ + 'foo', + 'bar', + '', + 'beep', + 'boop', + [], + {} + ]; + + b.tic(); + for ( i = 0; i < b.iterations; i++ ) { + v = values[ i%values.length ]; + out = isAutosize( v ); + if ( typeof out !== 'boolean' ) { + b.fail( 'should return a boolean' ); + } + } + b.toc(); + if ( !isBoolean( out ) ) { + b.fail( 'should return a boolean' ); + } + b.pass( 'benchmark finished' ); + b.end(); +}); diff --git a/lib/node_modules/@stdlib/plot/vega/base/assert/is-autosize/docs/repl.txt b/lib/node_modules/@stdlib/plot/vega/base/assert/is-autosize/docs/repl.txt new file mode 100644 index 000000000000..7116223b5783 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/assert/is-autosize/docs/repl.txt @@ -0,0 +1,25 @@ + +{{alias}}( value ) + Tests if an input value is an autosize instance. + + Parameters + ---------- + value: any + Value to test. + + Returns + ------- + bool: boolean + Boolean indicating if an input value is an autosize instance. + + Examples + -------- + > var v = new {{alias:@stdlib/plot/vega/autosize/ctor}}(); + > var bool = {{alias}}( v ) + true + > bool = {{alias}}( {} ) + false + + See Also + -------- + diff --git a/lib/node_modules/@stdlib/plot/vega/base/assert/is-autosize/docs/types/index.d.ts b/lib/node_modules/@stdlib/plot/vega/base/assert/is-autosize/docs/types/index.d.ts new file mode 100644 index 000000000000..c30f2eba146a --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/assert/is-autosize/docs/types/index.d.ts @@ -0,0 +1,45 @@ +/* +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +// TypeScript Version: 4.1 + +/** +* Tests whether an input value is an autosize instance. +* +* @param v - value to test +* @returns boolean indicating whether an input value is an autosize instance +* +* @example +* var Autosize = require( '@stdlib/plot/vega/autosize/ctor' ); +* +* var v = new Autosize(); +* var bool = isAutosize( v ); +* // returns true +* +* bool = isAutosize( {} ); +* // returns false +* +* bool = isAutosize( 'foo' ); +* // returns false +*/ +declare function isAutosize( v: any ): boolean; + + +// EXPORTS // + +export = isAutosize; diff --git a/lib/node_modules/@stdlib/plot/vega/base/assert/is-autosize/docs/types/test.ts b/lib/node_modules/@stdlib/plot/vega/base/assert/is-autosize/docs/types/test.ts new file mode 100644 index 000000000000..bceef7c3b87f --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/assert/is-autosize/docs/types/test.ts @@ -0,0 +1,34 @@ +/* +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +import isAutosize = require( './index' ); + + +// TESTS // + +// The function returns a boolean... +{ + isAutosize( {} ); // $ExpectType boolean + isAutosize( 'foo' ); // $ExpectType boolean +} + +// The compiler throws an error if the function is provided an unsupported number of arguments... +{ + isAutosize(); // $ExpectError + isAutosize( undefined, 123 ); // $ExpectError +} diff --git a/lib/node_modules/@stdlib/plot/vega/base/assert/is-autosize/examples/index.js b/lib/node_modules/@stdlib/plot/vega/base/assert/is-autosize/examples/index.js new file mode 100644 index 000000000000..78108ae61366 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/assert/is-autosize/examples/index.js @@ -0,0 +1,35 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +var Autosize = require( '@stdlib/plot/vega/autosize/ctor' ); +var isAutosize = require( './../lib' ); + +var v = new Autosize(); +var bool = isAutosize( v ); +console.log( bool ); +// => true + +bool = isAutosize( {} ); +console.log( bool ); +// => false + +bool = isAutosize( 'foo' ); +console.log( bool ); +// => false diff --git a/lib/node_modules/@stdlib/plot/vega/base/assert/is-autosize/lib/index.js b/lib/node_modules/@stdlib/plot/vega/base/assert/is-autosize/lib/index.js new file mode 100644 index 000000000000..53e70a9d59ad --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/assert/is-autosize/lib/index.js @@ -0,0 +1,48 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +/** +* Test whether an input value is an autosize instance. +* +* @module @stdlib/plot/vega/base/assert/is-autosize +* +* @example +* var Autosize = require( '@stdlib/plot/vega/autosize/ctor' ); +* var isAutosize = require( '@stdlib/plot/vega/base/assert/is-autosize' ); +* +* var v = new Autosize(); +* var bool = isAutosize( v ); +* // returns true +* +* bool = isAutosize( {} ); +* // returns false +* +* bool = isAutosize( 'foo' ); +* // returns false +*/ + +// MODULES // + +var main = require( './main.js' ); + + +// EXPORTS // + +module.exports = main; diff --git a/lib/node_modules/@stdlib/plot/vega/base/assert/is-autosize/lib/main.js b/lib/node_modules/@stdlib/plot/vega/base/assert/is-autosize/lib/main.js new file mode 100644 index 000000000000..fb7e6399df08 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/assert/is-autosize/lib/main.js @@ -0,0 +1,67 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var isObject = require( '@stdlib/assert/is-object' ); +var isString = require( '@stdlib/assert/is-string' ).isPrimitive; +var isBoolean = require( '@stdlib/assert/is-boolean' ).isPrimitive; +var Autosize = require( '@stdlib/plot/vega/autosize/ctor' ); + + +// MAIN // + +/** +* Tests whether an input value is an autosize instance. +* +* @param {*} value - value to test +* @returns {boolean} boolean indicating whether an input value is an autosize instance +* +* @example +* var Autosize = require( '@stdlib/plot/vega/autosize/ctor' ); +* +* var v = new Autosize(); +* var bool = isAutosize( v ); +* // returns true +* +* bool = isAutosize( {} ); +* // returns false +* +* bool = isAutosize( 'foo' ); +* // returns false +*/ +function isAutosize( value ) { + return ( + value instanceof Autosize || + + // The following is a set of rather imperfect heuristics for handling instances originating in a different realm... + ( + isObject( value ) && + isString( value.type ) && + isBoolean( value.resize ) && + isString( value.contains ) + ) + ); +} + + +// EXPORTS // + +module.exports = isAutosize; diff --git a/lib/node_modules/@stdlib/plot/vega/base/assert/is-autosize/package.json b/lib/node_modules/@stdlib/plot/vega/base/assert/is-autosize/package.json new file mode 100644 index 000000000000..161ce40ccbbe --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/assert/is-autosize/package.json @@ -0,0 +1,70 @@ +{ + "name": "@stdlib/plot/vega/base/assert/is-autosize", + "version": "0.0.0", + "description": "Test if an input value is an autosize instance.", + "license": "Apache-2.0", + "author": { + "name": "The Stdlib Authors", + "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" + }, + "contributors": [ + { + "name": "The Stdlib Authors", + "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" + } + ], + "main": "./lib", + "directories": { + "benchmark": "./benchmark", + "doc": "./docs", + "example": "./examples", + "lib": "./lib", + "test": "./test" + }, + "types": "./docs/types", + "scripts": {}, + "homepage": "https://github.com/stdlib-js/stdlib", + "repository": { + "type": "git", + "url": "git://github.com/stdlib-js/stdlib.git" + }, + "bugs": { + "url": "https://github.com/stdlib-js/stdlib/issues" + }, + "dependencies": {}, + "devDependencies": {}, + "engines": { + "node": ">=0.10.0", + "npm": ">2.7.0" + }, + "os": [ + "aix", + "darwin", + "freebsd", + "linux", + "macos", + "openbsd", + "sunos", + "win32", + "windows" + ], + "keywords": [ + "stdlib", + "plot", + "base", + "vega", + "utilities", + "utility", + "utils", + "util", + "assert", + "test", + "check", + "is", + "valid", + "validate", + "validation", + "isvalid" + ], + "__stdlib__": {} +} diff --git a/lib/node_modules/@stdlib/plot/vega/base/assert/is-autosize/test/test.js b/lib/node_modules/@stdlib/plot/vega/base/assert/is-autosize/test/test.js new file mode 100644 index 000000000000..d820a997df6f --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/assert/is-autosize/test/test.js @@ -0,0 +1,82 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var tape = require( 'tape' ); +var Autosize = require( '@stdlib/plot/vega/autosize/ctor' ); +var isAutosize = require( './../lib' ); + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof isAutosize, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'the function returns `true` if provided an autosize instance', function test( t ) { + var values; + var bool; + var i; + + values = [ + new Autosize({ + 'type': 'pad' + }), + new Autosize({ + 'type': 'none' + }) + ]; + for ( i = 0; i < values.length; i++ ) { + bool = isAutosize( values[ i ] ); + t.strictEqual( bool, true, 'returns expected value when provided '+values[ i ] ); + } + t.end(); +}); + +tape( 'the function returns `false` if not provided an autosize instance', function test( t ) { + var values; + var bool; + var i; + + values = [ + '', + 'beep', + 'boop', + 'foo', + 'bar', + 5, + NaN, + true, + false, + null, + void 0, + [], + {}, + function noop() {} + ]; + for ( i = 0; i < values.length; i++ ) { + bool = isAutosize( values[ i ] ); + t.strictEqual( bool, false, 'returns expected value when provided '+values[ i ] ); + } + t.end(); +}); diff --git a/lib/node_modules/@stdlib/plot/vega/base/assert/is-axis-array/README.md b/lib/node_modules/@stdlib/plot/vega/base/assert/is-axis-array/README.md new file mode 100644 index 000000000000..b893cbcf5ab3 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/assert/is-axis-array/README.md @@ -0,0 +1,131 @@ +<!-- + +@license Apache-2.0 + +Copyright (c) 2025 The Stdlib Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + +--> + +# isAxisArray + +> Test if an input value is an array of [axes][@stdlib/plot/vega/axis/ctor]. + +<!-- Section to include introductory text. Make sure to keep an empty line after the intro `section` element and another before the `/section` close. --> + +<section class="intro"> + +</section> + +<!-- /.intro --> + +<!-- Package usage documentation. --> + +<section class="usage"> + +## Usage + +```javascript +var isAxisArray = require( '@stdlib/plot/vega/base/assert/is-axis-array' ); +``` + +#### isAxisArray( value ) + +Tests if an input value is an array of [axes][@stdlib/plot/vega/axis/ctor]. + +```javascript +var Axis = require( '@stdlib/plot/vega/axis/ctor' ); + +var v = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' +}); +var bool = isAxisArray( [ v ] ); +// returns true +``` + +If provided an empty array, the function returns `false`. + +```javascript +var bool = isAxisArray( [] ); +// returns false +``` + +</section> + +<!-- /.usage --> + +<!-- Package usage notes. Make sure to keep an empty line after the `section` element and another before the `/section` close. --> + +<section class="notes"> + +</section> + +<!-- /.notes --> + +<!-- Package usage examples. --> + +<section class="examples"> + +## Examples + +<!-- eslint no-undef: "error" --> + +```javascript +var Axis = require( '@stdlib/plot/vega/axis/ctor' ); +var isAxisArray = require( '@stdlib/plot/vega/base/assert/is-axis-array' ); + +var v = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' +}); +var bool = isAxisArray( [ v ] ); +// returns true + +bool = isAxisArray( {} ); +// returns false + +bool = isAxisArray( 'foo' ); +// returns false +``` + +</section> + +<!-- /.examples --> + +<!-- Section to include cited references. If references are included, add a horizontal rule *before* the section. Make sure to keep an empty line after the `section` element and another before the `/section` close. --> + +<section class="references"> + +</section> + +<!-- /.references --> + +<!-- Section for related `stdlib` packages. Do not manually edit this section, as it is automatically populated. --> + +<section class="related"> + +</section> + +<!-- /.related --> + +<!-- Section for all links. Make sure to keep an empty line after the `section` element and another before the `/section` close. --> + +<section class="links"> + +[@stdlib/plot/vega/axis/ctor]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/plot/vega/axis/ctor + +</section> + +<!-- /.links --> diff --git a/lib/node_modules/@stdlib/plot/vega/base/assert/is-axis-array/benchmark/benchmark.js b/lib/node_modules/@stdlib/plot/vega/base/assert/is-axis-array/benchmark/benchmark.js new file mode 100644 index 000000000000..44964d022de0 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/assert/is-axis-array/benchmark/benchmark.js @@ -0,0 +1,93 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var bench = require( '@stdlib/bench' ); +var isBoolean = require( '@stdlib/assert/is-boolean' ).isPrimitive; +var Axis = require( '@stdlib/plot/vega/axis/ctor' ); +var pkg = require( './../package.json' ).name; +var isAxisArray = require( './../lib' ); + + +// MAIN // + +bench( pkg+'::true', function benchmark( b ) { + var values; + var out; + var i; + + values = [ + new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }), + new Axis({ + 'scale': 'yScale', + 'orient': 'bottom' + }) + ]; + + b.tic(); + for ( i = 0; i < b.iterations; i++ ) { + out = isAxisArray( [ values[ i%values.length ] ] ); + if ( typeof out !== 'boolean' ) { + b.fail( 'should return a boolean' ); + } + } + b.toc(); + if ( !isBoolean( out ) ) { + b.fail( 'should return a boolean' ); + } + b.pass( 'benchmark finished' ); + b.end(); +}); + +bench( pkg+'::false', function benchmark( b ) { + var values; + var out; + var v; + var i; + + values = [ + 'foo', + 'bar', + '', + 'beep', + 'boop', + [], + {} + ]; + + b.tic(); + for ( i = 0; i < b.iterations; i++ ) { + v = values[ i%values.length ]; + out = isAxisArray( v ); + if ( typeof out !== 'boolean' ) { + b.fail( 'should return a boolean' ); + } + } + b.toc(); + if ( !isBoolean( out ) ) { + b.fail( 'should return a boolean' ); + } + b.pass( 'benchmark finished' ); + b.end(); +}); diff --git a/lib/node_modules/@stdlib/plot/vega/base/assert/is-axis-array/docs/repl.txt b/lib/node_modules/@stdlib/plot/vega/base/assert/is-axis-array/docs/repl.txt new file mode 100644 index 000000000000..735115181f9e --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/assert/is-axis-array/docs/repl.txt @@ -0,0 +1,26 @@ + +{{alias}}( value ) + Tests if an input value is an array of axis instances. + + Parameters + ---------- + value: any + Value to test. + + Returns + ------- + bool: boolean + Boolean indicating if an input value is an array of axis instances. + + Examples + -------- + > var opts = { 'scale': 'xScale', 'orient': 'bottom' }; + > var v = new {{alias:@stdlib/plot/vega/axis/ctor}}( opts ); + > var bool = {{alias}}( [ v ] ) + true + > bool = {{alias}}( {} ) + false + + See Also + -------- + diff --git a/lib/node_modules/@stdlib/plot/vega/base/assert/is-axis-array/docs/types/index.d.ts b/lib/node_modules/@stdlib/plot/vega/base/assert/is-axis-array/docs/types/index.d.ts new file mode 100644 index 000000000000..9ce5137b1581 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/assert/is-axis-array/docs/types/index.d.ts @@ -0,0 +1,48 @@ +/* +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +// TypeScript Version: 4.1 + +/** +* Tests whether an input value is an array of axis instances. +* +* @param v - value to test +* @returns boolean indicating whether an input value is an array of axis instances +* +* @example +* var Axis = require( '@stdlib/plot/vega/axis/ctor' ); +* +* var v = new Axis({ +* 'scale': 'xScale', +* 'orient': 'bottom' +* }); +* var bool = isAxisArray( [ v ] ); +* // returns true +* +* bool = isAxisArray( {} ); +* // returns false +* +* bool = isAxisArray( 'foo' ); +* // returns false +*/ +declare function isAxisArray( v: any ): boolean; + + +// EXPORTS // + +export = isAxisArray; diff --git a/lib/node_modules/@stdlib/plot/vega/base/assert/is-axis-array/docs/types/test.ts b/lib/node_modules/@stdlib/plot/vega/base/assert/is-axis-array/docs/types/test.ts new file mode 100644 index 000000000000..fecd10cac49d --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/assert/is-axis-array/docs/types/test.ts @@ -0,0 +1,34 @@ +/* +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +import isAxisArray = require( './index' ); + + +// TESTS // + +// The function returns a boolean... +{ + isAxisArray( {} ); // $ExpectType boolean + isAxisArray( 'foo' ); // $ExpectType boolean +} + +// The compiler throws an error if the function is provided an unsupported number of arguments... +{ + isAxisArray(); // $ExpectError + isAxisArray( undefined, 123 ); // $ExpectError +} diff --git a/lib/node_modules/@stdlib/plot/vega/base/assert/is-axis-array/examples/index.js b/lib/node_modules/@stdlib/plot/vega/base/assert/is-axis-array/examples/index.js new file mode 100644 index 000000000000..4bd3607fbb65 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/assert/is-axis-array/examples/index.js @@ -0,0 +1,38 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +var Axis = require( '@stdlib/plot/vega/axis/ctor' ); +var isAxisArray = require( './../lib' ); + +var v = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' +}); +var bool = isAxisArray( [ v ] ); +console.log( bool ); +// => true + +bool = isAxisArray( {} ); +console.log( bool ); +// => false + +bool = isAxisArray( 'foo' ); +console.log( bool ); +// => false diff --git a/lib/node_modules/@stdlib/plot/vega/base/assert/is-axis-array/lib/index.js b/lib/node_modules/@stdlib/plot/vega/base/assert/is-axis-array/lib/index.js new file mode 100644 index 000000000000..d439db1ecb14 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/assert/is-axis-array/lib/index.js @@ -0,0 +1,51 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +/** +* Test whether an input value is an array of axis instances. +* +* @module @stdlib/plot/vega/base/assert/is-axis-array +* +* @example +* var Axis = require( '@stdlib/plot/vega/axis/ctor' ); +* var isAxisArray = require( '@stdlib/plot/vega/base/assert/is-axis-array' ); +* +* var v = new Axis({ +* 'scale': 'xScale', +* 'orient': 'bottom' +* }); +* var bool = isAxisArray( [ v ] ); +* // returns true +* +* bool = isAxisArray( {} ); +* // returns false +* +* bool = isAxisArray( 'foo' ); +* // returns false +*/ + +// MODULES // + +var main = require( './main.js' ); + + +// EXPORTS // + +module.exports = main; diff --git a/lib/node_modules/@stdlib/plot/vega/base/assert/is-axis-array/lib/main.js b/lib/node_modules/@stdlib/plot/vega/base/assert/is-axis-array/lib/main.js new file mode 100644 index 000000000000..73db92bd98e0 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/assert/is-axis-array/lib/main.js @@ -0,0 +1,58 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var arraylikefcn = require( '@stdlib/assert/tools/array-like-function' ); +var isAxis = require( '@stdlib/plot/vega/base/assert/is-axis' ); + + +// MAIN // + +/** +* Tests whether an input value is an array of axis instances. +* +* @name isAxisArray +* @type {Function} +* @param {*} value - value to test +* @returns {boolean} boolean indicating whether an input value is an array of axis instances +* +* @example +* var Axis = require( '@stdlib/plot/vega/axis/ctor' ); +* +* var v = new Axis({ +* 'scale': 'xScale', +* 'orient': 'bottom' +* }); +* var bool = isAxisArray( [ v ] ); +* // returns true +* +* bool = isAxisArray( {} ); +* // returns false +* +* bool = isAxisArray( 'foo' ); +* // returns false +*/ +var isAxisArray = arraylikefcn( isAxis ); + + +// EXPORTS // + +module.exports = isAxisArray; diff --git a/lib/node_modules/@stdlib/plot/vega/base/assert/is-axis-array/package.json b/lib/node_modules/@stdlib/plot/vega/base/assert/is-axis-array/package.json new file mode 100644 index 000000000000..aaddda96de20 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/assert/is-axis-array/package.json @@ -0,0 +1,70 @@ +{ + "name": "@stdlib/plot/vega/base/assert/is-axis-array", + "version": "0.0.0", + "description": "Test if an input value is an array of axis instances.", + "license": "Apache-2.0", + "author": { + "name": "The Stdlib Authors", + "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" + }, + "contributors": [ + { + "name": "The Stdlib Authors", + "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" + } + ], + "main": "./lib", + "directories": { + "benchmark": "./benchmark", + "doc": "./docs", + "example": "./examples", + "lib": "./lib", + "test": "./test" + }, + "types": "./docs/types", + "scripts": {}, + "homepage": "https://github.com/stdlib-js/stdlib", + "repository": { + "type": "git", + "url": "git://github.com/stdlib-js/stdlib.git" + }, + "bugs": { + "url": "https://github.com/stdlib-js/stdlib/issues" + }, + "dependencies": {}, + "devDependencies": {}, + "engines": { + "node": ">=0.10.0", + "npm": ">2.7.0" + }, + "os": [ + "aix", + "darwin", + "freebsd", + "linux", + "macos", + "openbsd", + "sunos", + "win32", + "windows" + ], + "keywords": [ + "stdlib", + "plot", + "base", + "vega", + "utilities", + "utility", + "utils", + "util", + "assert", + "test", + "check", + "is", + "valid", + "validate", + "validation", + "isvalid" + ], + "__stdlib__": {} +} diff --git a/lib/node_modules/@stdlib/plot/vega/base/assert/is-axis-array/test/test.js b/lib/node_modules/@stdlib/plot/vega/base/assert/is-axis-array/test/test.js new file mode 100644 index 000000000000..a13ea7b572cc --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/assert/is-axis-array/test/test.js @@ -0,0 +1,86 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var tape = require( 'tape' ); +var Axis = require( '@stdlib/plot/vega/axis/ctor' ); +var isAxisArray = require( './../lib' ); + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof isAxisArray, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'the function returns `true` if provided an array of axis instances', function test( t ) { + var values; + var actual; + + values = [ + new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }), + new Axis({ + 'scale': 'yScale', + 'orient': 'top' + }), + new Axis({ + 'scale': 'zScale', + 'orient': 'left' + }) + ]; + actual = isAxisArray( values ); + t.strictEqual( actual, true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function returns `false` if not provided an array of axis instances', function test( t ) { + var values; + var bool; + var i; + + values = [ + '', + 'beep', + 'boop', + 'foo', + 'bar', + 5, + NaN, + true, + false, + null, + void 0, + [], + {}, + function noop() {} + ]; + for ( i = 0; i < values.length; i++ ) { + bool = isAxisArray( values[ i ] ); + t.strictEqual( bool, false, 'returns expected value when provided '+values[ i ] ); + } + t.end(); +}); diff --git a/lib/node_modules/@stdlib/plot/vega/base/assert/is-axis-orientation/README.md b/lib/node_modules/@stdlib/plot/vega/base/assert/is-axis-orientation/README.md new file mode 100644 index 000000000000..20567e120c25 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/assert/is-axis-orientation/README.md @@ -0,0 +1,119 @@ +<!-- + +@license Apache-2.0 + +Copyright (c) 2025 The Stdlib Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + +--> + +# isAxisOrientation + +> Test if an input value is a supported [axis orientation][@stdlib/plot/vega/axis/orientations]. + +<!-- Section to include introductory text. Make sure to keep an empty line after the intro `section` element and another before the `/section` close. --> + +<section class="intro"> + +</section> + +<!-- /.intro --> + +<!-- Package usage documentation. --> + +<section class="usage"> + +## Usage + +```javascript +var isAxisOrientation = require( '@stdlib/plot/vega/base/assert/is-axis-orientation' ); +``` + +#### isAxisOrientation( value ) + +Tests if an input value is a supported [axis orientation][@stdlib/plot/vega/axis/orientations]. + +```javascript +var bool = isAxisOrientation( 'bottom' ); +// returns true + +bool = isAxisOrientation( 'foo' ); +// returns false +``` + +</section> + +<!-- /.usage --> + +<!-- Package usage notes. Make sure to keep an empty line after the `section` element and another before the `/section` close. --> + +<section class="notes"> + +</section> + +<!-- /.notes --> + +<!-- Package usage examples. --> + +<section class="examples"> + +## Examples + +<!-- eslint no-undef: "error" --> + +```javascript +var isAxisOrientation = require( '@stdlib/plot/vega/base/assert/is-axis-orientation' ); + +var bool = isAxisOrientation( 'bottom' ); +// returns true + +bool = isAxisOrientation( 'left' ); +// returns true + +bool = isAxisOrientation( '' ); +// returns false + +bool = isAxisOrientation( 'foo' ); +// returns false +``` + +</section> + +<!-- /.examples --> + +<!-- Section to include cited references. If references are included, add a horizontal rule *before* the section. Make sure to keep an empty line after the `section` element and another before the `/section` close. --> + +<section class="references"> + +</section> + +<!-- /.references --> + +<!-- Section for related `stdlib` packages. Do not manually edit this section, as it is automatically populated. --> + +<section class="related"> + +</section> + +<!-- /.related --> + +<!-- Section for all links. Make sure to keep an empty line after the `section` element and another before the `/section` close. --> + +<section class="links"> + +[@stdlib/plot/vega/axis/orientations]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/plot/vega/axis/orientations + +</section> + +<!-- /.links --> diff --git a/lib/node_modules/@stdlib/plot/vega/base/assert/is-axis-orientation/benchmark/benchmark.js b/lib/node_modules/@stdlib/plot/vega/base/assert/is-axis-orientation/benchmark/benchmark.js new file mode 100644 index 000000000000..d4778f4aafcd --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/assert/is-axis-orientation/benchmark/benchmark.js @@ -0,0 +1,62 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var bench = require( '@stdlib/bench' ); +var isBoolean = require( '@stdlib/assert/is-boolean' ).isPrimitive; +var pkg = require( './../package.json' ).name; +var isAxisOrientation = require( './../lib' ); + + +// MAIN // + +bench( pkg, function benchmark( b ) { + var values; + var out; + var v; + var i; + + values = [ + 'left', + 'bottom', + + 'foo', + 'bar', + '', + 'beep', + 'boop' + ]; + + b.tic(); + for ( i = 0; i < b.iterations; i++ ) { + v = values[ i%values.length ]; + out = isAxisOrientation( v ); + if ( typeof out !== 'boolean' ) { + b.fail( 'should return a boolean' ); + } + } + b.toc(); + if ( !isBoolean( out ) ) { + b.fail( 'should return a boolean' ); + } + b.pass( 'benchmark finished' ); + b.end(); +}); diff --git a/lib/node_modules/@stdlib/plot/vega/base/assert/is-axis-orientation/docs/repl.txt b/lib/node_modules/@stdlib/plot/vega/base/assert/is-axis-orientation/docs/repl.txt new file mode 100644 index 000000000000..0005935cef82 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/assert/is-axis-orientation/docs/repl.txt @@ -0,0 +1,28 @@ + +{{alias}}( value ) + Tests if an input value is a supported axis orientation. + + Parameters + ---------- + value: any + Value to test. + + Returns + ------- + bool: boolean + Boolean indicating if an input value is a supported axis orientation. + + Examples + -------- + > var bool = {{alias}}( 'bottom' ) + true + > bool = {{alias}}( 'left' ) + true + > bool = {{alias}}( '' ) + false + > bool = {{alias}}( 'beep' ) + false + + See Also + -------- + diff --git a/lib/node_modules/@stdlib/plot/vega/base/assert/is-axis-orientation/docs/types/index.d.ts b/lib/node_modules/@stdlib/plot/vega/base/assert/is-axis-orientation/docs/types/index.d.ts new file mode 100644 index 000000000000..6a8c26973987 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/assert/is-axis-orientation/docs/types/index.d.ts @@ -0,0 +1,45 @@ +/* +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +// TypeScript Version: 4.1 + +/** +* Tests whether an input value is a supported axis orientation. +* +* @param v - value to test +* @returns boolean indicating whether an input value is a supported axis orientation +* +* @example +* var bool = isAxisOrientation( 'bottom' ); +* // returns true +* +* bool = isAxisOrientation( 'left' ); +* // returns true +* +* bool = isAxisOrientation( 'bar' ); +* // returns false +* +* bool = isAxisOrientation( 'foo' ); +* // returns false +*/ +declare function isAxisOrientation( v: any ): boolean; + + +// EXPORTS // + +export = isAxisOrientation; diff --git a/lib/node_modules/@stdlib/plot/vega/base/assert/is-axis-orientation/docs/types/test.ts b/lib/node_modules/@stdlib/plot/vega/base/assert/is-axis-orientation/docs/types/test.ts new file mode 100644 index 000000000000..687f69ea6666 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/assert/is-axis-orientation/docs/types/test.ts @@ -0,0 +1,34 @@ +/* +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +import isAxisOrientation = require( './index' ); + + +// TESTS // + +// The function returns a boolean... +{ + isAxisOrientation( 'left' ); // $ExpectType boolean + isAxisOrientation( 'foo' ); // $ExpectType boolean +} + +// The compiler throws an error if the function is provided an unsupported number of arguments... +{ + isAxisOrientation(); // $ExpectError + isAxisOrientation( undefined, 123 ); // $ExpectError +} diff --git a/lib/node_modules/@stdlib/plot/vega/base/assert/is-axis-orientation/examples/index.js b/lib/node_modules/@stdlib/plot/vega/base/assert/is-axis-orientation/examples/index.js new file mode 100644 index 000000000000..8a662867781d --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/assert/is-axis-orientation/examples/index.js @@ -0,0 +1,37 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +var isAxisOrientation = require( './../lib' ); + +var bool = isAxisOrientation( 'bottom' ); +console.log( bool ); +// => true + +bool = isAxisOrientation( 'left' ); +console.log( bool ); +// => true + +bool = isAxisOrientation( '' ); +console.log( bool ); +// => false + +bool = isAxisOrientation( 'foo' ); +console.log( bool ); +// => false diff --git a/lib/node_modules/@stdlib/plot/vega/base/assert/is-axis-orientation/lib/index.js b/lib/node_modules/@stdlib/plot/vega/base/assert/is-axis-orientation/lib/index.js new file mode 100644 index 000000000000..f4f2f2c5c632 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/assert/is-axis-orientation/lib/index.js @@ -0,0 +1,49 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +/** +* Test whether an input value is a supported axis orientation. +* +* @module @stdlib/plot/vega/base/assert/is-axis-orientation +* +* @example +* var isAxisOrientation = require( '@stdlib/plot/vega/base/assert/is-axis-orientation' ); +* +* var bool = isAxisOrientation( 'bottom' ); +* // returns true +* +* bool = isAxisOrientation( 'left' ); +* // returns true +* +* bool = isAxisOrientation( 'bar' ); +* // returns false +* +* bool = isAxisOrientation( 'foo' ); +* // returns false +*/ + +// MODULES // + +var main = require( './main.js' ); + + +// EXPORTS // + +module.exports = main; diff --git a/lib/node_modules/@stdlib/plot/vega/base/assert/is-axis-orientation/lib/main.js b/lib/node_modules/@stdlib/plot/vega/base/assert/is-axis-orientation/lib/main.js new file mode 100644 index 000000000000..840863d29899 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/assert/is-axis-orientation/lib/main.js @@ -0,0 +1,55 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var contains = require( '@stdlib/array/base/assert/contains' ).factory; +var axisOrientations = require( '@stdlib/plot/vega/axis/orientations' ); + + +// MAIN // + +/** +* Tests whether an input value is a supported axis orientation. +* +* @name isAxisOrientation +* @type {Function} +* @param {*} v - value to test +* @returns {boolean} boolean indicating whether an input value is a supported axis orientation +* +* @example +* var bool = isAxisOrientation( 'bottom' ); +* // returns true +* +* bool = isAxisOrientation( 'left' ); +* // returns true +* +* bool = isAxisOrientation( 'bar' ); +* // returns false +* +* bool = isAxisOrientation( 'foo' ); +* // returns false +*/ +var isAxisOrientation = contains( axisOrientations() ); + + +// EXPORTS // + +module.exports = isAxisOrientation; diff --git a/lib/node_modules/@stdlib/plot/vega/base/assert/is-axis-orientation/package.json b/lib/node_modules/@stdlib/plot/vega/base/assert/is-axis-orientation/package.json new file mode 100644 index 000000000000..e0f4d192433b --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/assert/is-axis-orientation/package.json @@ -0,0 +1,70 @@ +{ + "name": "@stdlib/plot/vega/base/assert/is-axis-orientation", + "version": "0.0.0", + "description": "Test if an input value is a supported axis orientation.", + "license": "Apache-2.0", + "author": { + "name": "The Stdlib Authors", + "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" + }, + "contributors": [ + { + "name": "The Stdlib Authors", + "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" + } + ], + "main": "./lib", + "directories": { + "benchmark": "./benchmark", + "doc": "./docs", + "example": "./examples", + "lib": "./lib", + "test": "./test" + }, + "types": "./docs/types", + "scripts": {}, + "homepage": "https://github.com/stdlib-js/stdlib", + "repository": { + "type": "git", + "url": "git://github.com/stdlib-js/stdlib.git" + }, + "bugs": { + "url": "https://github.com/stdlib-js/stdlib/issues" + }, + "dependencies": {}, + "devDependencies": {}, + "engines": { + "node": ">=0.10.0", + "npm": ">2.7.0" + }, + "os": [ + "aix", + "darwin", + "freebsd", + "linux", + "macos", + "openbsd", + "sunos", + "win32", + "windows" + ], + "keywords": [ + "stdlib", + "plot", + "base", + "vega", + "utilities", + "utility", + "utils", + "util", + "assert", + "test", + "check", + "is", + "valid", + "validate", + "validation", + "isvalid" + ], + "__stdlib__": {} +} diff --git a/lib/node_modules/@stdlib/plot/vega/base/assert/is-axis-orientation/test/test.js b/lib/node_modules/@stdlib/plot/vega/base/assert/is-axis-orientation/test/test.js new file mode 100644 index 000000000000..ec5fedfaf1c0 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/assert/is-axis-orientation/test/test.js @@ -0,0 +1,79 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var tape = require( 'tape' ); +var isAxisOrientation = require( './../lib' ); + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof isAxisOrientation, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'the function returns `true` if provided a supported axis orientation', function test( t ) { + var values; + var bool; + var i; + + values = [ + 'bottom', + 'left', + 'top', + 'right' + ]; + for ( i = 0; i < values.length; i++ ) { + bool = isAxisOrientation( values[ i ] ); + t.strictEqual( bool, true, 'returns expected value when provided '+values[ i ] ); + } + t.end(); +}); + +tape( 'the function returns `false` if not provided a supported axis orientation', function test( t ) { + var values; + var bool; + var i; + + values = [ + '', + 'beep', + 'boop', + 'foo', + 'bar', + 5, + NaN, + true, + false, + null, + void 0, + [], + {}, + function noop() {} + ]; + for ( i = 0; i < values.length; i++ ) { + bool = isAxisOrientation( values[ i ] ); + t.strictEqual( bool, false, 'returns expected value when provided '+values[ i ] ); + } + t.end(); +}); diff --git a/lib/node_modules/@stdlib/plot/vega/base/assert/is-axis/README.md b/lib/node_modules/@stdlib/plot/vega/base/assert/is-axis/README.md new file mode 100644 index 000000000000..e962a4c4f784 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/assert/is-axis/README.md @@ -0,0 +1,127 @@ +<!-- + +@license Apache-2.0 + +Copyright (c) 2025 The Stdlib Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + +--> + +# isAxis + +> Test if an input value is an [axis][@stdlib/plot/vega/axis/ctor]. + +<!-- Section to include introductory text. Make sure to keep an empty line after the intro `section` element and another before the `/section` close. --> + +<section class="intro"> + +</section> + +<!-- /.intro --> + +<!-- Package usage documentation. --> + +<section class="usage"> + +## Usage + +```javascript +var isAxis = require( '@stdlib/plot/vega/base/assert/is-axis' ); +``` + +#### isAxis( value ) + +Tests if an input value is an [axis][@stdlib/plot/vega/axis/ctor]. + +```javascript +var Axis = require( '@stdlib/plot/vega/axis/ctor' ); + +var v = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' +}); +var bool = isAxis( v ); +// returns true + +bool = isAxis( 'foo' ); +// returns false +``` + +</section> + +<!-- /.usage --> + +<!-- Package usage notes. Make sure to keep an empty line after the `section` element and another before the `/section` close. --> + +<section class="notes"> + +</section> + +<!-- /.notes --> + +<!-- Package usage examples. --> + +<section class="examples"> + +## Examples + +<!-- eslint no-undef: "error" --> + +```javascript +var Axis = require( '@stdlib/plot/vega/axis/ctor' ); +var isAxis = require( '@stdlib/plot/vega/base/assert/is-axis' ); + +var v = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' +}); +var bool = isAxis( v ); +// returns true + +bool = isAxis( {} ); +// returns false + +bool = isAxis( 'foo' ); +// returns false +``` + +</section> + +<!-- /.examples --> + +<!-- Section to include cited references. If references are included, add a horizontal rule *before* the section. Make sure to keep an empty line after the `section` element and another before the `/section` close. --> + +<section class="references"> + +</section> + +<!-- /.references --> + +<!-- Section for related `stdlib` packages. Do not manually edit this section, as it is automatically populated. --> + +<section class="related"> + +</section> + +<!-- /.related --> + +<!-- Section for all links. Make sure to keep an empty line after the `section` element and another before the `/section` close. --> + +<section class="links"> + +[@stdlib/plot/vega/axis/ctor]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/plot/vega/axis/ctor + +</section> + +<!-- /.links --> diff --git a/lib/node_modules/@stdlib/plot/vega/base/assert/is-axis/benchmark/benchmark.js b/lib/node_modules/@stdlib/plot/vega/base/assert/is-axis/benchmark/benchmark.js new file mode 100644 index 000000000000..8b4023753f0a --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/assert/is-axis/benchmark/benchmark.js @@ -0,0 +1,95 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var bench = require( '@stdlib/bench' ); +var isBoolean = require( '@stdlib/assert/is-boolean' ).isPrimitive; +var Axis = require( '@stdlib/plot/vega/axis/ctor' ); +var pkg = require( './../package.json' ).name; +var isAxis = require( './../lib' ); + + +// MAIN // + +bench( pkg+'::true', function benchmark( b ) { + var values; + var out; + var v; + var i; + + values = [ + new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }), + new Axis({ + 'scale': 'yScale', + 'orient': 'bottom' + }) + ]; + + b.tic(); + for ( i = 0; i < b.iterations; i++ ) { + v = values[ i%values.length ]; + out = isAxis( v ); + if ( typeof out !== 'boolean' ) { + b.fail( 'should return a boolean' ); + } + } + b.toc(); + if ( !isBoolean( out ) ) { + b.fail( 'should return a boolean' ); + } + b.pass( 'benchmark finished' ); + b.end(); +}); + +bench( pkg+'::false', function benchmark( b ) { + var values; + var out; + var v; + var i; + + values = [ + 'foo', + 'bar', + '', + 'beep', + 'boop', + [], + {} + ]; + + b.tic(); + for ( i = 0; i < b.iterations; i++ ) { + v = values[ i%values.length ]; + out = isAxis( v ); + if ( typeof out !== 'boolean' ) { + b.fail( 'should return a boolean' ); + } + } + b.toc(); + if ( !isBoolean( out ) ) { + b.fail( 'should return a boolean' ); + } + b.pass( 'benchmark finished' ); + b.end(); +}); diff --git a/lib/node_modules/@stdlib/plot/vega/base/assert/is-axis/docs/repl.txt b/lib/node_modules/@stdlib/plot/vega/base/assert/is-axis/docs/repl.txt new file mode 100644 index 000000000000..f925189c3eab --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/assert/is-axis/docs/repl.txt @@ -0,0 +1,26 @@ + +{{alias}}( value ) + Tests if an input value is an axis instance. + + Parameters + ---------- + value: any + Value to test. + + Returns + ------- + bool: boolean + Boolean indicating if an input value is an axis instance. + + Examples + -------- + > var opts = { 'scale': 'xScale', 'orient': 'bottom' }; + > var v = new {{alias:@stdlib/plot/vega/axis/ctor}}( opts ); + > var bool = {{alias}}( v ) + true + > bool = {{alias}}( {} ) + false + + See Also + -------- + diff --git a/lib/node_modules/@stdlib/plot/vega/base/assert/is-axis/docs/types/index.d.ts b/lib/node_modules/@stdlib/plot/vega/base/assert/is-axis/docs/types/index.d.ts new file mode 100644 index 000000000000..e735c3ffbeed --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/assert/is-axis/docs/types/index.d.ts @@ -0,0 +1,48 @@ +/* +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +// TypeScript Version: 4.1 + +/** +* Tests whether an input value is an axis instance. +* +* @param v - value to test +* @returns boolean indicating whether an input value is an axis instance +* +* @example +* var Axis = require( '@stdlib/plot/vega/axis/ctor' ); +* +* var v = new Axis({ +* 'scale': 'xScale', +* 'orient': 'bottom' +* }); +* var bool = isAxis( v ); +* // returns true +* +* bool = isAxis( {} ); +* // returns false +* +* bool = isAxis( 'foo' ); +* // returns false +*/ +declare function isAxis( v: any ): boolean; + + +// EXPORTS // + +export = isAxis; diff --git a/lib/node_modules/@stdlib/plot/vega/base/assert/is-axis/docs/types/test.ts b/lib/node_modules/@stdlib/plot/vega/base/assert/is-axis/docs/types/test.ts new file mode 100644 index 000000000000..68b3ccd4f472 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/assert/is-axis/docs/types/test.ts @@ -0,0 +1,34 @@ +/* +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +import isAxis = require( './index' ); + + +// TESTS // + +// The function returns a boolean... +{ + isAxis( {} ); // $ExpectType boolean + isAxis( 'foo' ); // $ExpectType boolean +} + +// The compiler throws an error if the function is provided an unsupported number of arguments... +{ + isAxis(); // $ExpectError + isAxis( undefined, 123 ); // $ExpectError +} diff --git a/lib/node_modules/@stdlib/plot/vega/base/assert/is-axis/examples/index.js b/lib/node_modules/@stdlib/plot/vega/base/assert/is-axis/examples/index.js new file mode 100644 index 000000000000..128e58e1a219 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/assert/is-axis/examples/index.js @@ -0,0 +1,38 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +var Axis = require( '@stdlib/plot/vega/axis/ctor' ); +var isAxis = require( './../lib' ); + +var v = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' +}); +var bool = isAxis( v ); +console.log( bool ); +// => true + +bool = isAxis( {} ); +console.log( bool ); +// => false + +bool = isAxis( 'foo' ); +console.log( bool ); +// => false diff --git a/lib/node_modules/@stdlib/plot/vega/base/assert/is-axis/lib/index.js b/lib/node_modules/@stdlib/plot/vega/base/assert/is-axis/lib/index.js new file mode 100644 index 000000000000..de50fa824939 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/assert/is-axis/lib/index.js @@ -0,0 +1,51 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +/** +* Test whether an input value is an axis instance. +* +* @module @stdlib/plot/vega/base/assert/is-axis +* +* @example +* var Axis = require( '@stdlib/plot/vega/axis/ctor' ); +* var isAxis = require( '@stdlib/plot/vega/base/assert/is-axis' ); +* +* var v = new Axis({ +* 'scale': 'xScale', +* 'orient': 'bottom' +* }); +* var bool = isAxis( v ); +* // returns true +* +* bool = isAxis( {} ); +* // returns false +* +* bool = isAxis( 'foo' ); +* // returns false +*/ + +// MODULES // + +var main = require( './main.js' ); + + +// EXPORTS // + +module.exports = main; diff --git a/lib/node_modules/@stdlib/plot/vega/base/assert/is-axis/lib/main.js b/lib/node_modules/@stdlib/plot/vega/base/assert/is-axis/lib/main.js new file mode 100644 index 000000000000..77ecc84c44e4 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/assert/is-axis/lib/main.js @@ -0,0 +1,70 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var isObject = require( '@stdlib/assert/is-object' ); +var isString = require( '@stdlib/assert/is-string' ).isPrimitive; +var hasProp = require( '@stdlib/assert/has-property' ); +var Axis = require( '@stdlib/plot/vega/axis/ctor' ); + + +// MAIN // + +/** +* Tests whether an input value is an axis instance. +* +* @param {*} value - value to test +* @returns {boolean} boolean indicating whether an input value is an axis instance +* +* @example +* var Axis = require( '@stdlib/plot/vega/axis/ctor' ); +* +* var v = new Axis({ +* 'scale': 'xScale', +* 'orient': 'bottom' +* }); +* var bool = isAxis( v ); +* // returns true +* +* bool = isAxis( {} ); +* // returns false +* +* bool = isAxis( 'foo' ); +* // returns false +*/ +function isAxis( value ) { + return ( + value instanceof Axis || + + // The following is a set of rather imperfect heuristics for handling instances originating in a different realm... + ( + isObject( value ) && + isString( value.scale ) && + isString( value.orient ) && + hasProp( value, 'title' ) + ) + ); +} + + +// EXPORTS // + +module.exports = isAxis; diff --git a/lib/node_modules/@stdlib/plot/vega/base/assert/is-axis/package.json b/lib/node_modules/@stdlib/plot/vega/base/assert/is-axis/package.json new file mode 100644 index 000000000000..944a2610bf44 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/assert/is-axis/package.json @@ -0,0 +1,70 @@ +{ + "name": "@stdlib/plot/vega/base/assert/is-axis", + "version": "0.0.0", + "description": "Test if an input value is an axis instance.", + "license": "Apache-2.0", + "author": { + "name": "The Stdlib Authors", + "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" + }, + "contributors": [ + { + "name": "The Stdlib Authors", + "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" + } + ], + "main": "./lib", + "directories": { + "benchmark": "./benchmark", + "doc": "./docs", + "example": "./examples", + "lib": "./lib", + "test": "./test" + }, + "types": "./docs/types", + "scripts": {}, + "homepage": "https://github.com/stdlib-js/stdlib", + "repository": { + "type": "git", + "url": "git://github.com/stdlib-js/stdlib.git" + }, + "bugs": { + "url": "https://github.com/stdlib-js/stdlib/issues" + }, + "dependencies": {}, + "devDependencies": {}, + "engines": { + "node": ">=0.10.0", + "npm": ">2.7.0" + }, + "os": [ + "aix", + "darwin", + "freebsd", + "linux", + "macos", + "openbsd", + "sunos", + "win32", + "windows" + ], + "keywords": [ + "stdlib", + "plot", + "base", + "vega", + "utilities", + "utility", + "utils", + "util", + "assert", + "test", + "check", + "is", + "valid", + "validate", + "validation", + "isvalid" + ], + "__stdlib__": {} +} diff --git a/lib/node_modules/@stdlib/plot/vega/base/assert/is-axis/test/test.js b/lib/node_modules/@stdlib/plot/vega/base/assert/is-axis/test/test.js new file mode 100644 index 000000000000..117a9f573da9 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/assert/is-axis/test/test.js @@ -0,0 +1,84 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var tape = require( 'tape' ); +var Axis = require( '@stdlib/plot/vega/axis/ctor' ); +var isAxis = require( './../lib' ); + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof isAxis, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'the function returns `true` if provided an axis instance', function test( t ) { + var values; + var bool; + var i; + + values = [ + new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }), + new Axis({ + 'scale': 'yScale', + 'orient': 'bottom' + }) + ]; + for ( i = 0; i < values.length; i++ ) { + bool = isAxis( values[ i ] ); + t.strictEqual( bool, true, 'returns expected value when provided '+values[ i ] ); + } + t.end(); +}); + +tape( 'the function returns `false` if not provided an axis instance', function test( t ) { + var values; + var bool; + var i; + + values = [ + '', + 'beep', + 'boop', + 'foo', + 'bar', + 5, + NaN, + true, + false, + null, + void 0, + [], + {}, + function noop() {} + ]; + for ( i = 0; i < values.length; i++ ) { + bool = isAxis( values[ i ] ); + t.strictEqual( bool, false, 'returns expected value when provided '+values[ i ] ); + } + t.end(); +}); diff --git a/lib/node_modules/@stdlib/plot/vega/base/assert/is-dataset-array/README.md b/lib/node_modules/@stdlib/plot/vega/base/assert/is-dataset-array/README.md new file mode 100644 index 000000000000..82d7d71aff03 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/assert/is-dataset-array/README.md @@ -0,0 +1,129 @@ +<!-- + +@license Apache-2.0 + +Copyright (c) 2025 The Stdlib Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + +--> + +# isDataSetArray + +> Test if an input value is an array of [datasets][@stdlib/plot/vega/data/base/ctor]. + +<!-- Section to include introductory text. Make sure to keep an empty line after the intro `section` element and another before the `/section` close. --> + +<section class="intro"> + +</section> + +<!-- /.intro --> + +<!-- Package usage documentation. --> + +<section class="usage"> + +## Usage + +```javascript +var isDataSetArray = require( '@stdlib/plot/vega/base/assert/is-dataset-array' ); +``` + +#### isDataSetArray( value ) + +Tests if an input value is an array of [datasets][@stdlib/plot/vega/data/base/ctor]. + +```javascript +var DataSet = require( '@stdlib/plot/vega/data/base/ctor' ); + +var v = new DataSet({ + 'name': 'foo' +}); +var bool = isDataSetArray( [ v ] ); +// returns true +``` + +If provided an empty array, the function returns `false`. + +```javascript +var bool = isDataSetArray( [] ); +// returns false +``` + +</section> + +<!-- /.usage --> + +<!-- Package usage notes. Make sure to keep an empty line after the `section` element and another before the `/section` close. --> + +<section class="notes"> + +</section> + +<!-- /.notes --> + +<!-- Package usage examples. --> + +<section class="examples"> + +## Examples + +<!-- eslint no-undef: "error" --> + +```javascript +var DataSet = require( '@stdlib/plot/vega/data/base/ctor' ); +var isDataSetArray = require( '@stdlib/plot/vega/base/assert/is-dataset-array' ); + +var v = new DataSet({ + 'name': 'foo' +}); +var bool = isDataSetArray( [ v ] ); +// returns true + +bool = isDataSetArray( {} ); +// returns false + +bool = isDataSetArray( 'foo' ); +// returns false +``` + +</section> + +<!-- /.examples --> + +<!-- Section to include cited references. If references are included, add a horizontal rule *before* the section. Make sure to keep an empty line after the `section` element and another before the `/section` close. --> + +<section class="references"> + +</section> + +<!-- /.references --> + +<!-- Section for related `stdlib` packages. Do not manually edit this section, as it is automatically populated. --> + +<section class="related"> + +</section> + +<!-- /.related --> + +<!-- Section for all links. Make sure to keep an empty line after the `section` element and another before the `/section` close. --> + +<section class="links"> + +[@stdlib/plot/vega/data/base/ctor]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/plot/vega/data/base/ctor + +</section> + +<!-- /.links --> diff --git a/lib/node_modules/@stdlib/plot/vega/base/assert/is-dataset-array/benchmark/benchmark.js b/lib/node_modules/@stdlib/plot/vega/base/assert/is-dataset-array/benchmark/benchmark.js new file mode 100644 index 000000000000..b7d3abe8a6a7 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/assert/is-dataset-array/benchmark/benchmark.js @@ -0,0 +1,91 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var bench = require( '@stdlib/bench' ); +var isBoolean = require( '@stdlib/assert/is-boolean' ).isPrimitive; +var DataSet = require( '@stdlib/plot/vega/data/base/ctor' ); +var pkg = require( './../package.json' ).name; +var isDataSetArray = require( './../lib' ); + + +// MAIN // + +bench( pkg+'::true', function benchmark( b ) { + var values; + var out; + var i; + + values = [ + new DataSet({ + 'name': 'foo' + }), + new DataSet({ + 'name': 'bar' + }) + ]; + + b.tic(); + for ( i = 0; i < b.iterations; i++ ) { + out = isDataSetArray( [ values[ i%values.length ] ] ); + if ( typeof out !== 'boolean' ) { + b.fail( 'should return a boolean' ); + } + } + b.toc(); + if ( !isBoolean( out ) ) { + b.fail( 'should return a boolean' ); + } + b.pass( 'benchmark finished' ); + b.end(); +}); + +bench( pkg+'::false', function benchmark( b ) { + var values; + var out; + var v; + var i; + + values = [ + 'foo', + 'bar', + '', + 'beep', + 'boop', + [], + {} + ]; + + b.tic(); + for ( i = 0; i < b.iterations; i++ ) { + v = values[ i%values.length ]; + out = isDataSetArray( v ); + if ( typeof out !== 'boolean' ) { + b.fail( 'should return a boolean' ); + } + } + b.toc(); + if ( !isBoolean( out ) ) { + b.fail( 'should return a boolean' ); + } + b.pass( 'benchmark finished' ); + b.end(); +}); diff --git a/lib/node_modules/@stdlib/plot/vega/base/assert/is-dataset-array/docs/repl.txt b/lib/node_modules/@stdlib/plot/vega/base/assert/is-dataset-array/docs/repl.txt new file mode 100644 index 000000000000..fb730f893093 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/assert/is-dataset-array/docs/repl.txt @@ -0,0 +1,26 @@ + +{{alias}}( value ) + Tests if an input value is an array of dataset instances. + + Parameters + ---------- + value: any + Value to test. + + Returns + ------- + bool: boolean + Boolean indicating if an input value is an array of dataset instances. + + Examples + -------- + > var opts = { 'name': 'foo' }; + > var v = new {{alias:@stdlib/plot/vega/data/base/ctor}}( opts ); + > var bool = {{alias}}( [ v ] ) + true + > bool = {{alias}}( {} ) + false + + See Also + -------- + diff --git a/lib/node_modules/@stdlib/plot/vega/base/assert/is-dataset-array/docs/types/index.d.ts b/lib/node_modules/@stdlib/plot/vega/base/assert/is-dataset-array/docs/types/index.d.ts new file mode 100644 index 000000000000..78891a6dd568 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/assert/is-dataset-array/docs/types/index.d.ts @@ -0,0 +1,47 @@ +/* +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +// TypeScript Version: 4.1 + +/** +* Tests whether an input value is an array of dataset instances. +* +* @param v - value to test +* @returns boolean indicating whether an input value is an array of dataset instances +* +* @example +* var DataSet = require( '@stdlib/plot/vega/data/base/ctor' ); +* +* var v = new DataSet({ +* 'name': 'foo' +* }); +* var bool = isDataSetArray( [ v ] ); +* // returns true +* +* bool = isDataSetArray( {} ); +* // returns false +* +* bool = isDataSetArray( 'foo' ); +* // returns false +*/ +declare function isDataSetArray( v: any ): boolean; + + +// EXPORTS // + +export = isDataSetArray; diff --git a/lib/node_modules/@stdlib/plot/vega/base/assert/is-dataset-array/docs/types/test.ts b/lib/node_modules/@stdlib/plot/vega/base/assert/is-dataset-array/docs/types/test.ts new file mode 100644 index 000000000000..c3ed322e0939 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/assert/is-dataset-array/docs/types/test.ts @@ -0,0 +1,34 @@ +/* +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +import isDataSetArray = require( './index' ); + + +// TESTS // + +// The function returns a boolean... +{ + isDataSetArray( {} ); // $ExpectType boolean + isDataSetArray( 'foo' ); // $ExpectType boolean +} + +// The compiler throws an error if the function is provided an unsupported number of arguments... +{ + isDataSetArray(); // $ExpectError + isDataSetArray( undefined, 123 ); // $ExpectError +} diff --git a/lib/node_modules/@stdlib/plot/vega/base/assert/is-dataset-array/examples/index.js b/lib/node_modules/@stdlib/plot/vega/base/assert/is-dataset-array/examples/index.js new file mode 100644 index 000000000000..7ac40780dd4d --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/assert/is-dataset-array/examples/index.js @@ -0,0 +1,37 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +var DataSet = require( '@stdlib/plot/vega/data/base/ctor' ); +var isDataSetArray = require( './../lib' ); + +var v = new DataSet({ + 'name': 'foo' +}); +var bool = isDataSetArray( [ v ] ); +console.log( bool ); +// => true + +bool = isDataSetArray( {} ); +console.log( bool ); +// => false + +bool = isDataSetArray( 'foo' ); +console.log( bool ); +// => false diff --git a/lib/node_modules/@stdlib/plot/vega/base/assert/is-dataset-array/lib/index.js b/lib/node_modules/@stdlib/plot/vega/base/assert/is-dataset-array/lib/index.js new file mode 100644 index 000000000000..f695d1f5046f --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/assert/is-dataset-array/lib/index.js @@ -0,0 +1,50 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +/** +* Test whether an input value is an array of dataset instances. +* +* @module @stdlib/plot/vega/base/assert/is-dataset-array +* +* @example +* var DataSet = require( '@stdlib/plot/vega/data/base/ctor' ); +* var isDataSetArray = require( '@stdlib/plot/vega/base/assert/is-dataset-array' ); +* +* var v = new DataSet({ +* 'name': 'foo' +* }); +* var bool = isDataSetArray( [ v ] ); +* // returns true +* +* bool = isDataSetArray( {} ); +* // returns false +* +* bool = isDataSetArray( 'foo' ); +* // returns false +*/ + +// MODULES // + +var main = require( './main.js' ); + + +// EXPORTS // + +module.exports = main; diff --git a/lib/node_modules/@stdlib/plot/vega/base/assert/is-dataset-array/lib/main.js b/lib/node_modules/@stdlib/plot/vega/base/assert/is-dataset-array/lib/main.js new file mode 100644 index 000000000000..4b32898f91fc --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/assert/is-dataset-array/lib/main.js @@ -0,0 +1,57 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var arraylikefcn = require( '@stdlib/assert/tools/array-like-function' ); +var isDataSet = require( '@stdlib/plot/vega/base/assert/is-dataset' ); + + +// MAIN // + +/** +* Tests whether an input value is an array of dataset instances. +* +* @name isDataSetArray +* @type {Function} +* @param {*} value - value to test +* @returns {boolean} boolean indicating whether an input value is an array of dataset instances +* +* @example +* var DataSet = require( '@stdlib/plot/vega/data/base/ctor' ); +* +* var v = new DataSet({ +* 'name': 'foo' +* }); +* var bool = isDataSetArray( [ v ] ); +* // returns true +* +* bool = isDataSetArray( {} ); +* // returns false +* +* bool = isDataSetArray( 'foo' ); +* // returns false +*/ +var isDataSetArray = arraylikefcn( isDataSet ); + + +// EXPORTS // + +module.exports = isDataSetArray; diff --git a/lib/node_modules/@stdlib/plot/vega/base/assert/is-dataset-array/package.json b/lib/node_modules/@stdlib/plot/vega/base/assert/is-dataset-array/package.json new file mode 100644 index 000000000000..fe7a05c11193 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/assert/is-dataset-array/package.json @@ -0,0 +1,70 @@ +{ + "name": "@stdlib/plot/vega/base/assert/is-dataset-array", + "version": "0.0.0", + "description": "Test if an input value is an array of dataset instances.", + "license": "Apache-2.0", + "author": { + "name": "The Stdlib Authors", + "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" + }, + "contributors": [ + { + "name": "The Stdlib Authors", + "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" + } + ], + "main": "./lib", + "directories": { + "benchmark": "./benchmark", + "doc": "./docs", + "example": "./examples", + "lib": "./lib", + "test": "./test" + }, + "types": "./docs/types", + "scripts": {}, + "homepage": "https://github.com/stdlib-js/stdlib", + "repository": { + "type": "git", + "url": "git://github.com/stdlib-js/stdlib.git" + }, + "bugs": { + "url": "https://github.com/stdlib-js/stdlib/issues" + }, + "dependencies": {}, + "devDependencies": {}, + "engines": { + "node": ">=0.10.0", + "npm": ">2.7.0" + }, + "os": [ + "aix", + "darwin", + "freebsd", + "linux", + "macos", + "openbsd", + "sunos", + "win32", + "windows" + ], + "keywords": [ + "stdlib", + "plot", + "base", + "vega", + "utilities", + "utility", + "utils", + "util", + "assert", + "test", + "check", + "is", + "valid", + "validate", + "validation", + "isvalid" + ], + "__stdlib__": {} +} diff --git a/lib/node_modules/@stdlib/plot/vega/base/assert/is-dataset-array/test/test.js b/lib/node_modules/@stdlib/plot/vega/base/assert/is-dataset-array/test/test.js new file mode 100644 index 000000000000..fe21fa57240d --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/assert/is-dataset-array/test/test.js @@ -0,0 +1,83 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var tape = require( 'tape' ); +var DataSet = require( '@stdlib/plot/vega/data/base/ctor' ); +var isDataSetArray = require( './../lib' ); + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof isDataSetArray, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'the function returns `true` if provided an array of dataset instances', function test( t ) { + var values; + var actual; + + values = [ + new DataSet({ + 'name': 'foo' + }), + new DataSet({ + 'name': 'bar' + }), + new DataSet({ + 'name': 'biz' + }) + ]; + actual = isDataSetArray( values ); + t.strictEqual( actual, true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function returns `false` if not provided an array of dataset instances', function test( t ) { + var values; + var bool; + var i; + + values = [ + '', + 'beep', + 'boop', + 'foo', + 'bar', + 5, + NaN, + true, + false, + null, + void 0, + [], + {}, + function noop() {} + ]; + for ( i = 0; i < values.length; i++ ) { + bool = isDataSetArray( values[ i ] ); + t.strictEqual( bool, false, 'returns expected value when provided '+values[ i ] ); + } + t.end(); +}); diff --git a/lib/node_modules/@stdlib/plot/vega/base/assert/is-dataset/README.md b/lib/node_modules/@stdlib/plot/vega/base/assert/is-dataset/README.md new file mode 100644 index 000000000000..3f614d3a01f7 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/assert/is-dataset/README.md @@ -0,0 +1,125 @@ +<!-- + +@license Apache-2.0 + +Copyright (c) 2025 The Stdlib Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + +--> + +# isDataSet + +> Test if an input value is a [dataset][@stdlib/plot/vega/data/base/ctor]. + +<!-- Section to include introductory text. Make sure to keep an empty line after the intro `section` element and another before the `/section` close. --> + +<section class="intro"> + +</section> + +<!-- /.intro --> + +<!-- Package usage documentation. --> + +<section class="usage"> + +## Usage + +```javascript +var isDataSet = require( '@stdlib/plot/vega/base/assert/is-dataset' ); +``` + +#### isDataSet( value ) + +Tests if an input value is a [dataset][@stdlib/plot/vega/data/base/ctor]. + +```javascript +var DataSet = require( '@stdlib/plot/vega/data/base/ctor' ); + +var v = new DataSet({ + 'name': 'Beep' +}); +var bool = isDataSet( v ); +// returns true + +bool = isDataSet( 'foo' ); +// returns false +``` + +</section> + +<!-- /.usage --> + +<!-- Package usage notes. Make sure to keep an empty line after the `section` element and another before the `/section` close. --> + +<section class="notes"> + +</section> + +<!-- /.notes --> + +<!-- Package usage examples. --> + +<section class="examples"> + +## Examples + +<!-- eslint no-undef: "error" --> + +```javascript +var DataSet = require( '@stdlib/plot/vega/data/base/ctor' ); +var isDataSet = require( '@stdlib/plot/vega/base/assert/is-dataset' ); + +var v = new DataSet({ + 'name': 'foo' +}); +var bool = isDataSet( v ); +// returns true + +bool = isDataSet( {} ); +// returns false + +bool = isDataSet( 'foo' ); +// returns false +``` + +</section> + +<!-- /.examples --> + +<!-- Section to include cited references. If references are included, add a horizontal rule *before* the section. Make sure to keep an empty line after the `section` element and another before the `/section` close. --> + +<section class="references"> + +</section> + +<!-- /.references --> + +<!-- Section for related `stdlib` packages. Do not manually edit this section, as it is automatically populated. --> + +<section class="related"> + +</section> + +<!-- /.related --> + +<!-- Section for all links. Make sure to keep an empty line after the `section` element and another before the `/section` close. --> + +<section class="links"> + +[@stdlib/plot/vega/data/base/ctor]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/plot/vega/data/base/ctor + +</section> + +<!-- /.links --> diff --git a/lib/node_modules/@stdlib/plot/vega/base/assert/is-dataset/benchmark/benchmark.js b/lib/node_modules/@stdlib/plot/vega/base/assert/is-dataset/benchmark/benchmark.js new file mode 100644 index 000000000000..7fb409e52348 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/assert/is-dataset/benchmark/benchmark.js @@ -0,0 +1,93 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var bench = require( '@stdlib/bench' ); +var isBoolean = require( '@stdlib/assert/is-boolean' ).isPrimitive; +var DataSet = require( '@stdlib/plot/vega/data/base/ctor' ); +var pkg = require( './../package.json' ).name; +var isDataSet = require( './../lib' ); + + +// MAIN // + +bench( pkg+'::true', function benchmark( b ) { + var values; + var out; + var v; + var i; + + values = [ + new DataSet({ + 'name': 'foo' + }), + new DataSet({ + 'name': 'bar' + }) + ]; + + b.tic(); + for ( i = 0; i < b.iterations; i++ ) { + v = values[ i%values.length ]; + out = isDataSet( v ); + if ( typeof out !== 'boolean' ) { + b.fail( 'should return a boolean' ); + } + } + b.toc(); + if ( !isBoolean( out ) ) { + b.fail( 'should return a boolean' ); + } + b.pass( 'benchmark finished' ); + b.end(); +}); + +bench( pkg+'::false', function benchmark( b ) { + var values; + var out; + var v; + var i; + + values = [ + 'foo', + 'bar', + '', + 'beep', + 'boop', + [], + {} + ]; + + b.tic(); + for ( i = 0; i < b.iterations; i++ ) { + v = values[ i%values.length ]; + out = isDataSet( v ); + if ( typeof out !== 'boolean' ) { + b.fail( 'should return a boolean' ); + } + } + b.toc(); + if ( !isBoolean( out ) ) { + b.fail( 'should return a boolean' ); + } + b.pass( 'benchmark finished' ); + b.end(); +}); diff --git a/lib/node_modules/@stdlib/plot/vega/base/assert/is-dataset/docs/repl.txt b/lib/node_modules/@stdlib/plot/vega/base/assert/is-dataset/docs/repl.txt new file mode 100644 index 000000000000..05c354a98989 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/assert/is-dataset/docs/repl.txt @@ -0,0 +1,26 @@ + +{{alias}}( value ) + Tests if an input value is a dataset instance. + + Parameters + ---------- + value: any + Value to test. + + Returns + ------- + bool: boolean + Boolean indicating if an input value is a dataset instance. + + Examples + -------- + > var opts = { 'name': 'foo' }; + > var v = new {{alias:@stdlib/plot/vega/data/base/ctor}}( opts ); + > var bool = {{alias}}( v ) + true + > bool = {{alias}}( {} ) + false + + See Also + -------- + diff --git a/lib/node_modules/@stdlib/plot/vega/base/assert/is-dataset/docs/types/index.d.ts b/lib/node_modules/@stdlib/plot/vega/base/assert/is-dataset/docs/types/index.d.ts new file mode 100644 index 000000000000..b3ad3a855d41 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/assert/is-dataset/docs/types/index.d.ts @@ -0,0 +1,47 @@ +/* +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +// TypeScript Version: 4.1 + +/** +* Tests whether an input value is a dataset instance. +* +* @param v - value to test +* @returns boolean indicating whether an input value is a dataset instance +* +* @example +* var DataSet = require( '@stdlib/plot/vega/data/base/ctor' ); +* +* var v = new DataSet({ +* 'name': 'foo' +* }); +* var bool = isDataSet( v ); +* // returns true +* +* bool = isDataSet( {} ); +* // returns false +* +* bool = isDataSet( 'foo' ); +* // returns false +*/ +declare function isDataSet( v: any ): boolean; + + +// EXPORTS // + +export = isDataSet; diff --git a/lib/node_modules/@stdlib/plot/vega/base/assert/is-dataset/docs/types/test.ts b/lib/node_modules/@stdlib/plot/vega/base/assert/is-dataset/docs/types/test.ts new file mode 100644 index 000000000000..d5a0a607dd48 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/assert/is-dataset/docs/types/test.ts @@ -0,0 +1,34 @@ +/* +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +import isDataSet = require( './index' ); + + +// TESTS // + +// The function returns a boolean... +{ + isDataSet( {} ); // $ExpectType boolean + isDataSet( 'foo' ); // $ExpectType boolean +} + +// The compiler throws an error if the function is provided an unsupported number of arguments... +{ + isDataSet(); // $ExpectError + isDataSet( undefined, 123 ); // $ExpectError +} diff --git a/lib/node_modules/@stdlib/plot/vega/base/assert/is-dataset/examples/index.js b/lib/node_modules/@stdlib/plot/vega/base/assert/is-dataset/examples/index.js new file mode 100644 index 000000000000..ba1fe680bfdf --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/assert/is-dataset/examples/index.js @@ -0,0 +1,37 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +var DataSet = require( '@stdlib/plot/vega/data/base/ctor' ); +var isDataSet = require( './../lib' ); + +var v = new DataSet({ + 'name': 'foo' +}); +var bool = isDataSet( v ); +console.log( bool ); +// => true + +bool = isDataSet( {} ); +console.log( bool ); +// => false + +bool = isDataSet( 'foo' ); +console.log( bool ); +// => false diff --git a/lib/node_modules/@stdlib/plot/vega/base/assert/is-dataset/lib/index.js b/lib/node_modules/@stdlib/plot/vega/base/assert/is-dataset/lib/index.js new file mode 100644 index 000000000000..1d2faddda032 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/assert/is-dataset/lib/index.js @@ -0,0 +1,50 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +/** +* Test whether an input value is a dataset instance. +* +* @module @stdlib/plot/vega/base/assert/is-dataset +* +* @example +* var DataSet = require( '@stdlib/plot/vega/data/base/ctor' ); +* var isDataSet = require( '@stdlib/plot/vega/base/assert/is-dataset' ); +* +* var v = new DataSet({ +* 'name': 'foo' +* }); +* var bool = isDataSet( v ); +* // returns true +* +* bool = isDataSet( {} ); +* // returns false +* +* bool = isDataSet( 'foo' ); +* // returns false +*/ + +// MODULES // + +var main = require( './main.js' ); + + +// EXPORTS // + +module.exports = main; diff --git a/lib/node_modules/@stdlib/plot/vega/base/assert/is-dataset/lib/main.js b/lib/node_modules/@stdlib/plot/vega/base/assert/is-dataset/lib/main.js new file mode 100644 index 000000000000..308e957d370a --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/assert/is-dataset/lib/main.js @@ -0,0 +1,72 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var isObject = require( '@stdlib/assert/is-object' ); +var isString = require( '@stdlib/assert/is-string' ).isPrimitive; +var hasProp = require( '@stdlib/assert/has-property' ); +var DataSet = require( '@stdlib/plot/vega/data/base/ctor' ); + + +// MAIN // + +/** +* Tests whether an input value is a dataset instance. +* +* @param {*} value - value to test +* @returns {boolean} boolean indicating whether an input value is a dataset instance +* +* @example +* var DataSet = require( '@stdlib/plot/vega/data/base/ctor' ); +* +* var v = new DataSet({ +* 'name': 'foo' +* }); +* var bool = isDataSet( v ); +* // returns true +* +* bool = isDataSet( {} ); +* // returns false +* +* bool = isDataSet( 'foo' ); +* // returns false +*/ +function isDataSet( value ) { + return ( + value instanceof DataSet || + + // The following is a set of rather imperfect heuristics for handling instances originating in a different realm... + ( + isObject( value ) && + isString( value.name ) && + ( + hasProp( value, 'values' ) || + hasProp( value, 'source' ) || + hasProp( value, 'url' ) + ) + ) + ); +} + + +// EXPORTS // + +module.exports = isDataSet; diff --git a/lib/node_modules/@stdlib/plot/vega/base/assert/is-dataset/package.json b/lib/node_modules/@stdlib/plot/vega/base/assert/is-dataset/package.json new file mode 100644 index 000000000000..8d135f7ae49f --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/assert/is-dataset/package.json @@ -0,0 +1,70 @@ +{ + "name": "@stdlib/plot/vega/base/assert/is-dataset", + "version": "0.0.0", + "description": "Test if an input value is a dataset instance.", + "license": "Apache-2.0", + "author": { + "name": "The Stdlib Authors", + "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" + }, + "contributors": [ + { + "name": "The Stdlib Authors", + "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" + } + ], + "main": "./lib", + "directories": { + "benchmark": "./benchmark", + "doc": "./docs", + "example": "./examples", + "lib": "./lib", + "test": "./test" + }, + "types": "./docs/types", + "scripts": {}, + "homepage": "https://github.com/stdlib-js/stdlib", + "repository": { + "type": "git", + "url": "git://github.com/stdlib-js/stdlib.git" + }, + "bugs": { + "url": "https://github.com/stdlib-js/stdlib/issues" + }, + "dependencies": {}, + "devDependencies": {}, + "engines": { + "node": ">=0.10.0", + "npm": ">2.7.0" + }, + "os": [ + "aix", + "darwin", + "freebsd", + "linux", + "macos", + "openbsd", + "sunos", + "win32", + "windows" + ], + "keywords": [ + "stdlib", + "plot", + "base", + "vega", + "utilities", + "utility", + "utils", + "util", + "assert", + "test", + "check", + "is", + "valid", + "validate", + "validation", + "isvalid" + ], + "__stdlib__": {} +} diff --git a/lib/node_modules/@stdlib/plot/vega/base/assert/is-dataset/test/test.js b/lib/node_modules/@stdlib/plot/vega/base/assert/is-dataset/test/test.js new file mode 100644 index 000000000000..e799e43cd0d4 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/assert/is-dataset/test/test.js @@ -0,0 +1,82 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var tape = require( 'tape' ); +var DataSet = require( '@stdlib/plot/vega/data/base/ctor' ); +var isDataSet = require( './../lib' ); + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof isDataSet, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'the function returns `true` if provided a dataset instance', function test( t ) { + var values; + var bool; + var i; + + values = [ + new DataSet({ + 'name': 'foo' + }), + new DataSet({ + 'name': 'bar' + }) + ]; + for ( i = 0; i < values.length; i++ ) { + bool = isDataSet( values[ i ] ); + t.strictEqual( bool, true, 'returns expected value when provided '+values[ i ] ); + } + t.end(); +}); + +tape( 'the function returns `false` if not provided a dataset instance', function test( t ) { + var values; + var bool; + var i; + + values = [ + '', + 'beep', + 'boop', + 'foo', + 'bar', + 5, + NaN, + true, + false, + null, + void 0, + [], + {}, + function noop() {} + ]; + for ( i = 0; i < values.length; i++ ) { + bool = isDataSet( values[ i ] ); + t.strictEqual( bool, false, 'returns expected value when provided '+values[ i ] ); + } + t.end(); +}); diff --git a/lib/node_modules/@stdlib/plot/vega/base/assert/is-mark-array/README.md b/lib/node_modules/@stdlib/plot/vega/base/assert/is-mark-array/README.md new file mode 100644 index 000000000000..51096c048ec9 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/assert/is-mark-array/README.md @@ -0,0 +1,129 @@ +<!-- + +@license Apache-2.0 + +Copyright (c) 2025 The Stdlib Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + +--> + +# isMarkArray + +> Test if an input value is an array of [marks][@stdlib/plot/vega/mark/base/ctor]. + +<!-- Section to include introductory text. Make sure to keep an empty line after the intro `section` element and another before the `/section` close. --> + +<section class="intro"> + +</section> + +<!-- /.intro --> + +<!-- Package usage documentation. --> + +<section class="usage"> + +## Usage + +```javascript +var isMarkArray = require( '@stdlib/plot/vega/base/assert/is-mark-array' ); +``` + +#### isMarkArray( value ) + +Tests if an input value is an array of [marks][@stdlib/plot/vega/mark/base/ctor]. + +```javascript +var Mark = require( '@stdlib/plot/vega/mark/base/ctor' ); + +var v = new Mark({ + 'type': 'line' +}); +var bool = isMarkArray( [ v ] ); +// returns true +``` + +If provided an empty array, the function returns `false`. + +```javascript +var bool = isMarkArray( [] ); +// returns false +``` + +</section> + +<!-- /.usage --> + +<!-- Package usage notes. Make sure to keep an empty line after the `section` element and another before the `/section` close. --> + +<section class="notes"> + +</section> + +<!-- /.notes --> + +<!-- Package usage examples. --> + +<section class="examples"> + +## Examples + +<!-- eslint no-undef: "error" --> + +```javascript +var Mark = require( '@stdlib/plot/vega/mark/base/ctor' ); +var isMarkArray = require( '@stdlib/plot/vega/base/assert/is-mark-array' ); + +var v = new Mark({ + 'type': 'line' +}); +var bool = isMarkArray( [ v ] ); +// returns true + +bool = isMarkArray( {} ); +// returns false + +bool = isMarkArray( 'foo' ); +// returns false +``` + +</section> + +<!-- /.examples --> + +<!-- Section to include cited references. If references are included, add a horizontal rule *before* the section. Make sure to keep an empty line after the `section` element and another before the `/section` close. --> + +<section class="references"> + +</section> + +<!-- /.references --> + +<!-- Section for related `stdlib` packages. Do not manually edit this section, as it is automatically populated. --> + +<section class="related"> + +</section> + +<!-- /.related --> + +<!-- Section for all links. Make sure to keep an empty line after the `section` element and another before the `/section` close. --> + +<section class="links"> + +[@stdlib/plot/vega/mark/base/ctor]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/plot/vega/mark/base/ctor + +</section> + +<!-- /.links --> diff --git a/lib/node_modules/@stdlib/plot/vega/base/assert/is-mark-array/benchmark/benchmark.js b/lib/node_modules/@stdlib/plot/vega/base/assert/is-mark-array/benchmark/benchmark.js new file mode 100644 index 000000000000..eb40a2eaf65d --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/assert/is-mark-array/benchmark/benchmark.js @@ -0,0 +1,91 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var bench = require( '@stdlib/bench' ); +var isBoolean = require( '@stdlib/assert/is-boolean' ).isPrimitive; +var Mark = require( '@stdlib/plot/vega/mark/base/ctor' ); +var pkg = require( './../package.json' ).name; +var isMarkArray = require( './../lib' ); + + +// MAIN // + +bench( pkg+'::true', function benchmark( b ) { + var values; + var out; + var i; + + values = [ + new Mark({ + 'type': 'line' + }), + new Mark({ + 'type': 'rect' + }) + ]; + + b.tic(); + for ( i = 0; i < b.iterations; i++ ) { + out = isMarkArray( [ values[ i%values.length ] ] ); + if ( typeof out !== 'boolean' ) { + b.fail( 'should return a boolean' ); + } + } + b.toc(); + if ( !isBoolean( out ) ) { + b.fail( 'should return a boolean' ); + } + b.pass( 'benchmark finished' ); + b.end(); +}); + +bench( pkg+'::false', function benchmark( b ) { + var values; + var out; + var v; + var i; + + values = [ + 'foo', + 'bar', + '', + 'beep', + 'boop', + [], + {} + ]; + + b.tic(); + for ( i = 0; i < b.iterations; i++ ) { + v = values[ i%values.length ]; + out = isMarkArray( v ); + if ( typeof out !== 'boolean' ) { + b.fail( 'should return a boolean' ); + } + } + b.toc(); + if ( !isBoolean( out ) ) { + b.fail( 'should return a boolean' ); + } + b.pass( 'benchmark finished' ); + b.end(); +}); diff --git a/lib/node_modules/@stdlib/plot/vega/base/assert/is-mark-array/docs/repl.txt b/lib/node_modules/@stdlib/plot/vega/base/assert/is-mark-array/docs/repl.txt new file mode 100644 index 000000000000..24bb9b98e644 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/assert/is-mark-array/docs/repl.txt @@ -0,0 +1,26 @@ + +{{alias}}( value ) + Tests if an input value is an array of mark instances. + + Parameters + ---------- + value: any + Value to test. + + Returns + ------- + bool: boolean + Boolean indicating if an input value is an array of mark instances. + + Examples + -------- + > var opts = { 'type': 'line' }; + > var v = new {{alias:@stdlib/plot/vega/mark/base/ctor}}( opts ); + > var bool = {{alias}}( [ v ] ) + true + > bool = {{alias}}( {} ) + false + + See Also + -------- + diff --git a/lib/node_modules/@stdlib/plot/vega/base/assert/is-mark-array/docs/types/index.d.ts b/lib/node_modules/@stdlib/plot/vega/base/assert/is-mark-array/docs/types/index.d.ts new file mode 100644 index 000000000000..3c5b3388aa7c --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/assert/is-mark-array/docs/types/index.d.ts @@ -0,0 +1,47 @@ +/* +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +// TypeScript Version: 4.1 + +/** +* Tests whether an input value is an array of mark instances. +* +* @param v - value to test +* @returns boolean indicating whether an input value is an array of mark instances +* +* @example +* var Mark = require( '@stdlib/plot/vega/mark/base/ctor' ); +* +* var v = new Mark({ +* 'type': 'line' +* }); +* var bool = isMarkArray( [ v ] ); +* // returns true +* +* bool = isMarkArray( {} ); +* // returns false +* +* bool = isMarkArray( 'foo' ); +* // returns false +*/ +declare function isMarkArray( v: any ): boolean; + + +// EXPORTS // + +export = isMarkArray; diff --git a/lib/node_modules/@stdlib/plot/vega/base/assert/is-mark-array/docs/types/test.ts b/lib/node_modules/@stdlib/plot/vega/base/assert/is-mark-array/docs/types/test.ts new file mode 100644 index 000000000000..1fbb36aa5f17 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/assert/is-mark-array/docs/types/test.ts @@ -0,0 +1,34 @@ +/* +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +import isMarkArray = require( './index' ); + + +// TESTS // + +// The function returns a boolean... +{ + isMarkArray( {} ); // $ExpectType boolean + isMarkArray( 'foo' ); // $ExpectType boolean +} + +// The compiler throws an error if the function is provided an unsupported number of arguments... +{ + isMarkArray(); // $ExpectError + isMarkArray( undefined, 123 ); // $ExpectError +} diff --git a/lib/node_modules/@stdlib/plot/vega/base/assert/is-mark-array/examples/index.js b/lib/node_modules/@stdlib/plot/vega/base/assert/is-mark-array/examples/index.js new file mode 100644 index 000000000000..3dc39eb6f6c1 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/assert/is-mark-array/examples/index.js @@ -0,0 +1,37 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +var Mark = require( '@stdlib/plot/vega/mark/base/ctor' ); +var isMarkArray = require( './../lib' ); + +var v = new Mark({ + 'type': 'line' +}); +var bool = isMarkArray( [ v ] ); +console.log( bool ); +// => true + +bool = isMarkArray( {} ); +console.log( bool ); +// => false + +bool = isMarkArray( 'foo' ); +console.log( bool ); +// => false diff --git a/lib/node_modules/@stdlib/plot/vega/base/assert/is-mark-array/lib/index.js b/lib/node_modules/@stdlib/plot/vega/base/assert/is-mark-array/lib/index.js new file mode 100644 index 000000000000..95dc14000df5 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/assert/is-mark-array/lib/index.js @@ -0,0 +1,50 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +/** +* Test whether an input value is an array of mark instances. +* +* @module @stdlib/plot/vega/base/assert/is-mark-array +* +* @example +* var Mark = require( '@stdlib/plot/vega/mark/base/ctor' ); +* var isMarkArray = require( '@stdlib/plot/vega/base/assert/is-mark-array' ); +* +* var v = new Mark({ +* 'type': 'line' +* }); +* var bool = isMarkArray( [ v ] ); +* // returns true +* +* bool = isMarkArray( {} ); +* // returns false +* +* bool = isMarkArray( 'foo' ); +* // returns false +*/ + +// MODULES // + +var main = require( './main.js' ); + + +// EXPORTS // + +module.exports = main; diff --git a/lib/node_modules/@stdlib/plot/vega/base/assert/is-mark-array/lib/main.js b/lib/node_modules/@stdlib/plot/vega/base/assert/is-mark-array/lib/main.js new file mode 100644 index 000000000000..82a99e5c728e --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/assert/is-mark-array/lib/main.js @@ -0,0 +1,57 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var arraylikefcn = require( '@stdlib/assert/tools/array-like-function' ); +var isMark = require( '@stdlib/plot/vega/base/assert/is-mark' ); + + +// MAIN // + +/** +* Tests whether an input value is an array of mark instances. +* +* @name isMarkArray +* @type {Function} +* @param {*} value - value to test +* @returns {boolean} boolean indicating whether an input value is an array of mark instances +* +* @example +* var Mark = require( '@stdlib/plot/vega/mark/base/ctor' ); +* +* var v = new Mark({ +* 'type': 'line' +* }); +* var bool = isMarkArray( [ v ] ); +* // returns true +* +* bool = isMarkArray( {} ); +* // returns false +* +* bool = isMarkArray( 'foo' ); +* // returns false +*/ +var isMarkArray = arraylikefcn( isMark ); + + +// EXPORTS // + +module.exports = isMarkArray; diff --git a/lib/node_modules/@stdlib/plot/vega/base/assert/is-mark-array/package.json b/lib/node_modules/@stdlib/plot/vega/base/assert/is-mark-array/package.json new file mode 100644 index 000000000000..5de9153ceecb --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/assert/is-mark-array/package.json @@ -0,0 +1,70 @@ +{ + "name": "@stdlib/plot/vega/base/assert/is-mark-array", + "version": "0.0.0", + "description": "Test if an input value is an array of mark instances.", + "license": "Apache-2.0", + "author": { + "name": "The Stdlib Authors", + "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" + }, + "contributors": [ + { + "name": "The Stdlib Authors", + "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" + } + ], + "main": "./lib", + "directories": { + "benchmark": "./benchmark", + "doc": "./docs", + "example": "./examples", + "lib": "./lib", + "test": "./test" + }, + "types": "./docs/types", + "scripts": {}, + "homepage": "https://github.com/stdlib-js/stdlib", + "repository": { + "type": "git", + "url": "git://github.com/stdlib-js/stdlib.git" + }, + "bugs": { + "url": "https://github.com/stdlib-js/stdlib/issues" + }, + "dependencies": {}, + "devDependencies": {}, + "engines": { + "node": ">=0.10.0", + "npm": ">2.7.0" + }, + "os": [ + "aix", + "darwin", + "freebsd", + "linux", + "macos", + "openbsd", + "sunos", + "win32", + "windows" + ], + "keywords": [ + "stdlib", + "plot", + "base", + "vega", + "utilities", + "utility", + "utils", + "util", + "assert", + "test", + "check", + "is", + "valid", + "validate", + "validation", + "isvalid" + ], + "__stdlib__": {} +} diff --git a/lib/node_modules/@stdlib/plot/vega/base/assert/is-mark-array/test/test.js b/lib/node_modules/@stdlib/plot/vega/base/assert/is-mark-array/test/test.js new file mode 100644 index 000000000000..67129819078a --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/assert/is-mark-array/test/test.js @@ -0,0 +1,80 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var tape = require( 'tape' ); +var Mark = require( '@stdlib/plot/vega/mark/base/ctor' ); +var isMarkArray = require( './../lib' ); + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof isMarkArray, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'the function returns `true` if provided an array of mark instances', function test( t ) { + var values; + var actual; + + values = [ + new Mark({ + 'type': 'line' + }), + new Mark({ + 'type': 'rect' + }) + ]; + actual = isMarkArray( values ); + t.strictEqual( actual, true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function returns `false` if not provided an array of mark instances', function test( t ) { + var values; + var bool; + var i; + + values = [ + '', + 'beep', + 'boop', + 'foo', + 'bar', + 5, + NaN, + true, + false, + null, + void 0, + [], + {}, + function noop() {} + ]; + for ( i = 0; i < values.length; i++ ) { + bool = isMarkArray( values[ i ] ); + t.strictEqual( bool, false, 'returns expected value when provided '+values[ i ] ); + } + t.end(); +}); diff --git a/lib/node_modules/@stdlib/plot/vega/base/assert/is-mark-name/README.md b/lib/node_modules/@stdlib/plot/vega/base/assert/is-mark-name/README.md new file mode 100644 index 000000000000..251b10710fde --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/assert/is-mark-name/README.md @@ -0,0 +1,122 @@ +<!-- + +@license Apache-2.0 + +Copyright (c) 2025 The Stdlib Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + +--> + +# isMarkName + +> Test if an input value is a supported [mark name][@stdlib/plot/vega/mark/names]. + +<!-- Section to include introductory text. Make sure to keep an empty line after the intro `section` element and another before the `/section` close. --> + +<section class="intro"> + +</section> + +<!-- /.intro --> + +<!-- Package usage documentation. --> + +<section class="usage"> + +## Usage + +```javascript +var isMarkName = require( '@stdlib/plot/vega/base/assert/is-mark-name' ); +``` + +#### isMarkName( value ) + +Tests if an input value is a supported [mark name][@stdlib/plot/vega/mark/names]. + +```javascript +var bool = isMarkName( 'line' ); +// returns true + +bool = isMarkName( 'foo' ); +// returns false +``` + +</section> + +<!-- /.usage --> + +<!-- Package usage notes. Make sure to keep an empty line after the `section` element and another before the `/section` close. --> + +<section class="notes"> + +</section> + +<!-- /.notes --> + +<!-- Package usage examples. --> + +<section class="examples"> + +## Examples + +<!-- eslint no-undef: "error" --> + +```javascript +var isMarkName = require( '@stdlib/plot/vega/base/assert/is-mark-name' ); + +var bool = isMarkName( 'line' ); +// returns true + +bool = isMarkName( 'rect' ); +// returns true + +bool = isMarkName( 'area' ); +// returns true + +bool = isMarkName( '' ); +// returns false + +bool = isMarkName( 'foo' ); +// returns false +``` + +</section> + +<!-- /.examples --> + +<!-- Section to include cited references. If references are included, add a horizontal rule *before* the section. Make sure to keep an empty line after the `section` element and another before the `/section` close. --> + +<section class="references"> + +</section> + +<!-- /.references --> + +<!-- Section for related `stdlib` packages. Do not manually edit this section, as it is automatically populated. --> + +<section class="related"> + +</section> + +<!-- /.related --> + +<!-- Section for all links. Make sure to keep an empty line after the `section` element and another before the `/section` close. --> + +<section class="links"> + +[@stdlib/plot/vega/mark/names]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/plot/vega/mark/names + +</section> + +<!-- /.links --> diff --git a/lib/node_modules/@stdlib/plot/vega/base/assert/is-mark-name/benchmark/benchmark.js b/lib/node_modules/@stdlib/plot/vega/base/assert/is-mark-name/benchmark/benchmark.js new file mode 100644 index 000000000000..a1ebdc68890e --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/assert/is-mark-name/benchmark/benchmark.js @@ -0,0 +1,62 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var bench = require( '@stdlib/bench' ); +var isBoolean = require( '@stdlib/assert/is-boolean' ).isPrimitive; +var pkg = require( './../package.json' ).name; +var isMarkName = require( './../lib' ); + + +// MAIN // + +bench( pkg, function benchmark( b ) { + var values; + var out; + var v; + var i; + + values = [ + 'line', + 'rect', + 'area', + 'foo', + 'bar', + '', + 'beep', + 'boop' + ]; + + b.tic(); + for ( i = 0; i < b.iterations; i++ ) { + v = values[ i%values.length ]; + out = isMarkName( v ); + if ( typeof out !== 'boolean' ) { + b.fail( 'should return a boolean' ); + } + } + b.toc(); + if ( !isBoolean( out ) ) { + b.fail( 'should return a boolean' ); + } + b.pass( 'benchmark finished' ); + b.end(); +}); diff --git a/lib/node_modules/@stdlib/plot/vega/base/assert/is-mark-name/docs/repl.txt b/lib/node_modules/@stdlib/plot/vega/base/assert/is-mark-name/docs/repl.txt new file mode 100644 index 000000000000..0f8bee183014 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/assert/is-mark-name/docs/repl.txt @@ -0,0 +1,30 @@ + +{{alias}}( value ) + Tests if an input value is a supported mark name. + + Parameters + ---------- + value: any + Value to test. + + Returns + ------- + bool: boolean + Boolean indicating if an input value is a supported mark name. + + Examples + -------- + > var bool = {{alias}}( 'line' ) + true + > bool = {{alias}}( 'rect' ) + true + > bool = {{alias}}( 'area' ) + true + > bool = {{alias}}( '' ) + false + > bool = {{alias}}( 'beep' ) + false + + See Also + -------- + diff --git a/lib/node_modules/@stdlib/plot/vega/base/assert/is-mark-name/docs/types/index.d.ts b/lib/node_modules/@stdlib/plot/vega/base/assert/is-mark-name/docs/types/index.d.ts new file mode 100644 index 000000000000..04f33962c748 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/assert/is-mark-name/docs/types/index.d.ts @@ -0,0 +1,45 @@ +/* +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +// TypeScript Version: 4.1 + +/** +* Tests whether an input value is a supported mark name. +* +* @param v - value to test +* @returns boolean indicating whether an input value is a supported mark name +* +* @example +* var bool = isMarkName( 'line' ); +* // returns true +* +* bool = isMarkName( 'rect' ); +* // returns true +* +* bool = isMarkName( 'area' ); +* // returns true +* +* bool = isMarkName( 'foo' ); +* // returns false +*/ +declare function isMarkName( v: any ): boolean; + + +// EXPORTS // + +export = isMarkName; diff --git a/lib/node_modules/@stdlib/plot/vega/base/assert/is-mark-name/docs/types/test.ts b/lib/node_modules/@stdlib/plot/vega/base/assert/is-mark-name/docs/types/test.ts new file mode 100644 index 000000000000..27628457bc66 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/assert/is-mark-name/docs/types/test.ts @@ -0,0 +1,34 @@ +/* +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +import isMarkName = require( './index' ); + + +// TESTS // + +// The function returns a boolean... +{ + isMarkName( 'real' ); // $ExpectType boolean + isMarkName( 'foo' ); // $ExpectType boolean +} + +// The compiler throws an error if the function is provided an unsupported number of arguments... +{ + isMarkName(); // $ExpectError + isMarkName( undefined, 123 ); // $ExpectError +} diff --git a/lib/node_modules/@stdlib/plot/vega/base/assert/is-mark-name/examples/index.js b/lib/node_modules/@stdlib/plot/vega/base/assert/is-mark-name/examples/index.js new file mode 100644 index 000000000000..f62ea2665966 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/assert/is-mark-name/examples/index.js @@ -0,0 +1,41 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +var isMarkName = require( './../lib' ); + +var bool = isMarkName( 'line' ); +console.log( bool ); +// => true + +bool = isMarkName( 'rect' ); +console.log( bool ); +// => true + +bool = isMarkName( 'area' ); +console.log( bool ); +// => true + +bool = isMarkName( '' ); +console.log( bool ); +// => false + +bool = isMarkName( 'foo' ); +console.log( bool ); +// => false diff --git a/lib/node_modules/@stdlib/plot/vega/base/assert/is-mark-name/lib/index.js b/lib/node_modules/@stdlib/plot/vega/base/assert/is-mark-name/lib/index.js new file mode 100644 index 000000000000..11d67f1f1f13 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/assert/is-mark-name/lib/index.js @@ -0,0 +1,49 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +/** +* Test whether an input value is a supported mark name. +* +* @module @stdlib/plot/vega/base/assert/is-mark-name +* +* @example +* var isMarkName = require( '@stdlib/plot/vega/base/assert/is-mark-name' ); +* +* var bool = isMarkName( 'line' ); +* // returns true +* +* bool = isMarkName( 'rect' ); +* // returns true +* +* bool = isMarkName( 'area' ); +* // returns true +* +* bool = isMarkName( 'foo' ); +* // returns false +*/ + +// MODULES // + +var main = require( './main.js' ); + + +// EXPORTS // + +module.exports = main; diff --git a/lib/node_modules/@stdlib/plot/vega/base/assert/is-mark-name/lib/main.js b/lib/node_modules/@stdlib/plot/vega/base/assert/is-mark-name/lib/main.js new file mode 100644 index 000000000000..3791f53df02d --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/assert/is-mark-name/lib/main.js @@ -0,0 +1,55 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var contains = require( '@stdlib/array/base/assert/contains' ).factory; +var marks = require( '@stdlib/plot/vega/mark/names' ); + + +// MAIN // + +/** +* Tests whether an input value is a supported mark name. +* +* @name isMarkName +* @type {Function} +* @param {*} v - value to test +* @returns {boolean} boolean indicating whether an input value is a supported mark name +* +* @example +* var bool = isMarkName( 'line' ); +* // returns true +* +* bool = isMarkName( 'rect' ); +* // returns true +* +* bool = isMarkName( 'area' ); +* // returns true +* +* bool = isMarkName( 'foo' ); +* // returns false +*/ +var isMarkName = contains( marks() ); + + +// EXPORTS // + +module.exports = isMarkName; diff --git a/lib/node_modules/@stdlib/plot/vega/base/assert/is-mark-name/package.json b/lib/node_modules/@stdlib/plot/vega/base/assert/is-mark-name/package.json new file mode 100644 index 000000000000..94a5e783ac9f --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/assert/is-mark-name/package.json @@ -0,0 +1,70 @@ +{ + "name": "@stdlib/plot/vega/base/assert/is-mark-name", + "version": "0.0.0", + "description": "Test if an input value is a supported mark name.", + "license": "Apache-2.0", + "author": { + "name": "The Stdlib Authors", + "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" + }, + "contributors": [ + { + "name": "The Stdlib Authors", + "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" + } + ], + "main": "./lib", + "directories": { + "benchmark": "./benchmark", + "doc": "./docs", + "example": "./examples", + "lib": "./lib", + "test": "./test" + }, + "types": "./docs/types", + "scripts": {}, + "homepage": "https://github.com/stdlib-js/stdlib", + "repository": { + "type": "git", + "url": "git://github.com/stdlib-js/stdlib.git" + }, + "bugs": { + "url": "https://github.com/stdlib-js/stdlib/issues" + }, + "dependencies": {}, + "devDependencies": {}, + "engines": { + "node": ">=0.10.0", + "npm": ">2.7.0" + }, + "os": [ + "aix", + "darwin", + "freebsd", + "linux", + "macos", + "openbsd", + "sunos", + "win32", + "windows" + ], + "keywords": [ + "stdlib", + "plot", + "base", + "vega", + "utilities", + "utility", + "utils", + "util", + "assert", + "test", + "check", + "is", + "valid", + "validate", + "validation", + "isvalid" + ], + "__stdlib__": {} +} diff --git a/lib/node_modules/@stdlib/plot/vega/base/assert/is-mark-name/test/test.js b/lib/node_modules/@stdlib/plot/vega/base/assert/is-mark-name/test/test.js new file mode 100644 index 000000000000..75a69e86c41a --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/assert/is-mark-name/test/test.js @@ -0,0 +1,78 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var tape = require( 'tape' ); +var isMarkName = require( './../lib' ); + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof isMarkName, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'the function returns `true` if provided a supported mark name', function test( t ) { + var values; + var bool; + var i; + + values = [ + 'line', + 'rect', + 'area' + ]; + for ( i = 0; i < values.length; i++ ) { + bool = isMarkName( values[ i ] ); + t.strictEqual( bool, true, 'returns expected value when provided '+values[ i ] ); + } + t.end(); +}); + +tape( 'the function returns `false` if not provided a supported mark name', function test( t ) { + var values; + var bool; + var i; + + values = [ + '', + 'beep', + 'boop', + 'foo', + 'bar', + 5, + NaN, + true, + false, + null, + void 0, + [], + {}, + function noop() {} + ]; + for ( i = 0; i < values.length; i++ ) { + bool = isMarkName( values[ i ] ); + t.strictEqual( bool, false, 'returns expected value when provided '+values[ i ] ); + } + t.end(); +}); diff --git a/lib/node_modules/@stdlib/plot/vega/base/assert/is-mark/README.md b/lib/node_modules/@stdlib/plot/vega/base/assert/is-mark/README.md new file mode 100644 index 000000000000..d4a17ab68a56 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/assert/is-mark/README.md @@ -0,0 +1,125 @@ +<!-- + +@license Apache-2.0 + +Copyright (c) 2025 The Stdlib Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + +--> + +# isMark + +> Test if an input value is a [mark][@stdlib/plot/vega/mark/base/ctor]. + +<!-- Section to include introductory text. Make sure to keep an empty line after the intro `section` element and another before the `/section` close. --> + +<section class="intro"> + +</section> + +<!-- /.intro --> + +<!-- Package usage documentation. --> + +<section class="usage"> + +## Usage + +```javascript +var isMark = require( '@stdlib/plot/vega/base/assert/is-mark' ); +``` + +#### isMark( value ) + +Tests if an input value is a [mark][@stdlib/plot/vega/mark/base/ctor]. + +```javascript +var Mark = require( '@stdlib/plot/vega/mark/base/ctor' ); + +var v = new Mark({ + 'type': 'line' +}); +var bool = isMark( v ); +// returns true + +bool = isMark( 'foo' ); +// returns false +``` + +</section> + +<!-- /.usage --> + +<!-- Package usage notes. Make sure to keep an empty line after the `section` element and another before the `/section` close. --> + +<section class="notes"> + +</section> + +<!-- /.notes --> + +<!-- Package usage examples. --> + +<section class="examples"> + +## Examples + +<!-- eslint no-undef: "error" --> + +```javascript +var Mark = require( '@stdlib/plot/vega/mark/base/ctor' ); +var isMark = require( '@stdlib/plot/vega/base/assert/is-mark' ); + +var v = new Mark({ + 'type': 'rect' +}); +var bool = isMark( v ); +// returns true + +bool = isMark( {} ); +// returns false + +bool = isMark( 'foo' ); +// returns false +``` + +</section> + +<!-- /.examples --> + +<!-- Section to include cited references. If references are included, add a horizontal rule *before* the section. Make sure to keep an empty line after the `section` element and another before the `/section` close. --> + +<section class="references"> + +</section> + +<!-- /.references --> + +<!-- Section for related `stdlib` packages. Do not manually edit this section, as it is automatically populated. --> + +<section class="related"> + +</section> + +<!-- /.related --> + +<!-- Section for all links. Make sure to keep an empty line after the `section` element and another before the `/section` close. --> + +<section class="links"> + +[@stdlib/plot/vega/mark/base/ctor]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/plot/vega/mark/base/ctor + +</section> + +<!-- /.links --> diff --git a/lib/node_modules/@stdlib/plot/vega/base/assert/is-mark/benchmark/benchmark.js b/lib/node_modules/@stdlib/plot/vega/base/assert/is-mark/benchmark/benchmark.js new file mode 100644 index 000000000000..5425c50fcb02 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/assert/is-mark/benchmark/benchmark.js @@ -0,0 +1,93 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var bench = require( '@stdlib/bench' ); +var isBoolean = require( '@stdlib/assert/is-boolean' ).isPrimitive; +var Mark = require( '@stdlib/plot/vega/mark/base/ctor' ); +var pkg = require( './../package.json' ).name; +var isMark = require( './../lib' ); + + +// MAIN // + +bench( pkg+'::true', function benchmark( b ) { + var values; + var out; + var v; + var i; + + values = [ + new Mark({ + 'type': 'line' + }), + new Mark({ + 'type': 'rect' + }) + ]; + + b.tic(); + for ( i = 0; i < b.iterations; i++ ) { + v = values[ i%values.length ]; + out = isMark( v ); + if ( typeof out !== 'boolean' ) { + b.fail( 'should return a boolean' ); + } + } + b.toc(); + if ( !isBoolean( out ) ) { + b.fail( 'should return a boolean' ); + } + b.pass( 'benchmark finished' ); + b.end(); +}); + +bench( pkg+'::false', function benchmark( b ) { + var values; + var out; + var v; + var i; + + values = [ + 'foo', + 'bar', + '', + 'beep', + 'boop', + [], + {} + ]; + + b.tic(); + for ( i = 0; i < b.iterations; i++ ) { + v = values[ i%values.length ]; + out = isMark( v ); + if ( typeof out !== 'boolean' ) { + b.fail( 'should return a boolean' ); + } + } + b.toc(); + if ( !isBoolean( out ) ) { + b.fail( 'should return a boolean' ); + } + b.pass( 'benchmark finished' ); + b.end(); +}); diff --git a/lib/node_modules/@stdlib/plot/vega/base/assert/is-mark/docs/repl.txt b/lib/node_modules/@stdlib/plot/vega/base/assert/is-mark/docs/repl.txt new file mode 100644 index 000000000000..2f20977bd221 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/assert/is-mark/docs/repl.txt @@ -0,0 +1,26 @@ + +{{alias}}( value ) + Tests if an input value is a mark instance. + + Parameters + ---------- + value: any + Value to test. + + Returns + ------- + bool: boolean + Boolean indicating if an input value is a mark instance. + + Examples + -------- + > var opts = { 'type': 'line' }; + > var v = new {{alias:@stdlib/plot/vega/mark/base/ctor}}( opts ); + > var bool = {{alias}}( v ) + true + > bool = {{alias}}( {} ) + false + + See Also + -------- + diff --git a/lib/node_modules/@stdlib/plot/vega/base/assert/is-mark/docs/types/index.d.ts b/lib/node_modules/@stdlib/plot/vega/base/assert/is-mark/docs/types/index.d.ts new file mode 100644 index 000000000000..53bb8beec993 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/assert/is-mark/docs/types/index.d.ts @@ -0,0 +1,47 @@ +/* +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +// TypeScript Version: 4.1 + +/** +* Tests whether an input value is a mark instance. +* +* @param v - value to test +* @returns boolean indicating whether an input value is a mark instance +* +* @example +* var Mark = require( '@stdlib/plot/vega/mark/base/ctor' ); +* +* var v = new Mark({ +* 'type': 'line' +* }); +* var bool = isMark( v ); +* // returns true +* +* bool = isMark( {} ); +* // returns false +* +* bool = isMark( 'foo' ); +* // returns false +*/ +declare function isMark( v: any ): boolean; + + +// EXPORTS // + +export = isMark; diff --git a/lib/node_modules/@stdlib/plot/vega/base/assert/is-mark/docs/types/test.ts b/lib/node_modules/@stdlib/plot/vega/base/assert/is-mark/docs/types/test.ts new file mode 100644 index 000000000000..0aaf3ccb5b93 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/assert/is-mark/docs/types/test.ts @@ -0,0 +1,34 @@ +/* +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +import isMark = require( './index' ); + + +// TESTS // + +// The function returns a boolean... +{ + isMark( {} ); // $ExpectType boolean + isMark( 'foo' ); // $ExpectType boolean +} + +// The compiler throws an error if the function is provided an unsupported number of arguments... +{ + isMark(); // $ExpectError + isMark( undefined, 123 ); // $ExpectError +} diff --git a/lib/node_modules/@stdlib/plot/vega/base/assert/is-mark/examples/index.js b/lib/node_modules/@stdlib/plot/vega/base/assert/is-mark/examples/index.js new file mode 100644 index 000000000000..cdc3db859cf8 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/assert/is-mark/examples/index.js @@ -0,0 +1,37 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +var Mark = require( '@stdlib/plot/vega/mark/base/ctor' ); +var isMark = require( './../lib' ); + +var v = new Mark({ + 'type': 'rect' +}); +var bool = isMark( v ); +console.log( bool ); +// => true + +bool = isMark( {} ); +console.log( bool ); +// => false + +bool = isMark( 'foo' ); +console.log( bool ); +// => false diff --git a/lib/node_modules/@stdlib/plot/vega/base/assert/is-mark/lib/index.js b/lib/node_modules/@stdlib/plot/vega/base/assert/is-mark/lib/index.js new file mode 100644 index 000000000000..2ecb7948fc0b --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/assert/is-mark/lib/index.js @@ -0,0 +1,50 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +/** +* Test whether an input value is a mark instance. +* +* @module @stdlib/plot/vega/base/assert/is-mark +* +* @example +* var Mark = require( '@stdlib/plot/vega/mark/base/ctor' ); +* var isMark = require( '@stdlib/plot/vega/base/assert/is-mark' ); +* +* var v = new Mark({ +* 'type': 'line' +* }); +* var bool = isMark( v ); +* // returns true +* +* bool = isMark( {} ); +* // returns false +* +* bool = isMark( 'foo' ); +* // returns false +*/ + +// MODULES // + +var main = require( './main.js' ); + + +// EXPORTS // + +module.exports = main; diff --git a/lib/node_modules/@stdlib/plot/vega/base/assert/is-mark/lib/main.js b/lib/node_modules/@stdlib/plot/vega/base/assert/is-mark/lib/main.js new file mode 100644 index 000000000000..841456b280d4 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/assert/is-mark/lib/main.js @@ -0,0 +1,68 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var isObject = require( '@stdlib/assert/is-object' ); +var hasProp = require( '@stdlib/assert/has-property' ); +var isMarkName = require( '@stdlib/plot/vega/base/assert/is-mark-name' ); +var Mark = require( '@stdlib/plot/vega/mark/base/ctor' ); + + +// MAIN // + +/** +* Tests whether an input value is a mark instance. +* +* @param {*} value - value to test +* @returns {boolean} boolean indicating whether an input value is a mark instance +* +* @example +* var Mark = require( '@stdlib/plot/vega/mark/base/ctor' ); +* +* var v = new Mark({ +* 'type': 'line' +* }); +* var bool = isMark( v ); +* // returns true +* +* bool = isMark( {} ); +* // returns false +* +* bool = isMark( 'foo' ); +* // returns false +*/ +function isMark( value ) { + return ( + value instanceof Mark || + + // The following is a set of rather imperfect heuristics for handling instances originating in a different realm... + ( + isObject( value ) && + isMarkName( value.type ) && + hasProp( value, 'encode' ) + ) + ); +} + + +// EXPORTS // + +module.exports = isMark; diff --git a/lib/node_modules/@stdlib/plot/vega/base/assert/is-mark/package.json b/lib/node_modules/@stdlib/plot/vega/base/assert/is-mark/package.json new file mode 100644 index 000000000000..f1441e2ae51d --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/assert/is-mark/package.json @@ -0,0 +1,70 @@ +{ + "name": "@stdlib/plot/vega/base/assert/is-mark", + "version": "0.0.0", + "description": "Test if an input value is a mark instance.", + "license": "Apache-2.0", + "author": { + "name": "The Stdlib Authors", + "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" + }, + "contributors": [ + { + "name": "The Stdlib Authors", + "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" + } + ], + "main": "./lib", + "directories": { + "benchmark": "./benchmark", + "doc": "./docs", + "example": "./examples", + "lib": "./lib", + "test": "./test" + }, + "types": "./docs/types", + "scripts": {}, + "homepage": "https://github.com/stdlib-js/stdlib", + "repository": { + "type": "git", + "url": "git://github.com/stdlib-js/stdlib.git" + }, + "bugs": { + "url": "https://github.com/stdlib-js/stdlib/issues" + }, + "dependencies": {}, + "devDependencies": {}, + "engines": { + "node": ">=0.10.0", + "npm": ">2.7.0" + }, + "os": [ + "aix", + "darwin", + "freebsd", + "linux", + "macos", + "openbsd", + "sunos", + "win32", + "windows" + ], + "keywords": [ + "stdlib", + "plot", + "base", + "vega", + "utilities", + "utility", + "utils", + "util", + "assert", + "test", + "check", + "is", + "valid", + "validate", + "validation", + "isvalid" + ], + "__stdlib__": {} +} diff --git a/lib/node_modules/@stdlib/plot/vega/base/assert/is-mark/test/test.js b/lib/node_modules/@stdlib/plot/vega/base/assert/is-mark/test/test.js new file mode 100644 index 000000000000..835c9c1e95c3 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/assert/is-mark/test/test.js @@ -0,0 +1,82 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var tape = require( 'tape' ); +var Mark = require( '@stdlib/plot/vega/mark/base/ctor' ); +var isMark = require( './../lib' ); + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof isMark, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'the function returns `true` if provided a mark instance', function test( t ) { + var values; + var bool; + var i; + + values = [ + new Mark({ + 'type': 'line' + }), + new Mark({ + 'type': 'rect' + }) + ]; + for ( i = 0; i < values.length; i++ ) { + bool = isMark( values[ i ] ); + t.strictEqual( bool, true, 'returns expected value when provided '+values[ i ] ); + } + t.end(); +}); + +tape( 'the function returns `false` if not provided a mark instance', function test( t ) { + var values; + var bool; + var i; + + values = [ + '', + 'beep', + 'boop', + 'foo', + 'bar', + 5, + NaN, + true, + false, + null, + void 0, + [], + {}, + function noop() {} + ]; + for ( i = 0; i < values.length; i++ ) { + bool = isMark( values[ i ] ); + t.strictEqual( bool, false, 'returns expected value when provided '+values[ i ] ); + } + t.end(); +}); diff --git a/lib/node_modules/@stdlib/plot/vega/base/assert/is-padding/README.md b/lib/node_modules/@stdlib/plot/vega/base/assert/is-padding/README.md new file mode 100644 index 000000000000..0a5b356b6672 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/assert/is-padding/README.md @@ -0,0 +1,121 @@ +<!-- + +@license Apache-2.0 + +Copyright (c) 2025 The Stdlib Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + +--> + +# isPadding + +> Test if an input value is a [padding][@stdlib/plot/vega/padding/ctor] instance. + +<!-- Section to include introductory text. Make sure to keep an empty line after the intro `section` element and another before the `/section` close. --> + +<section class="intro"> + +</section> + +<!-- /.intro --> + +<!-- Package usage documentation. --> + +<section class="usage"> + +## Usage + +```javascript +var isPadding = require( '@stdlib/plot/vega/base/assert/is-padding' ); +``` + +#### isPadding( value ) + +Tests if an input value is a [padding][@stdlib/plot/vega/padding/ctor] instance. + +```javascript +var Padding = require( '@stdlib/plot/vega/padding/ctor' ); + +var v = new Padding(); +var bool = isPadding( v ); +// returns true + +bool = isPadding( 'foo' ); +// returns false +``` + +</section> + +<!-- /.usage --> + +<!-- Package usage notes. Make sure to keep an empty line after the `section` element and another before the `/section` close. --> + +<section class="notes"> + +</section> + +<!-- /.notes --> + +<!-- Package usage examples. --> + +<section class="examples"> + +## Examples + +<!-- eslint no-undef: "error" --> + +```javascript +var Padding = require( '@stdlib/plot/vega/padding/ctor' ); +var isPadding = require( '@stdlib/plot/vega/base/assert/is-padding' ); + +var v = new Padding(); +var bool = isPadding( v ); +// returns true + +bool = isPadding( {} ); +// returns false + +bool = isPadding( 'foo' ); +// returns false +``` + +</section> + +<!-- /.examples --> + +<!-- Section to include cited references. If references are included, add a horizontal rule *before* the section. Make sure to keep an empty line after the `section` element and another before the `/section` close. --> + +<section class="references"> + +</section> + +<!-- /.references --> + +<!-- Section for related `stdlib` packages. Do not manually edit this section, as it is automatically populated. --> + +<section class="related"> + +</section> + +<!-- /.related --> + +<!-- Section for all links. Make sure to keep an empty line after the `section` element and another before the `/section` close. --> + +<section class="links"> + +[@stdlib/plot/vega/padding/ctor]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/plot/vega/padding/ctor + +</section> + +<!-- /.links --> diff --git a/lib/node_modules/@stdlib/plot/vega/base/assert/is-padding/benchmark/benchmark.js b/lib/node_modules/@stdlib/plot/vega/base/assert/is-padding/benchmark/benchmark.js new file mode 100644 index 000000000000..24252eca4a78 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/assert/is-padding/benchmark/benchmark.js @@ -0,0 +1,93 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var bench = require( '@stdlib/bench' ); +var isBoolean = require( '@stdlib/assert/is-boolean' ).isPrimitive; +var Padding = require( '@stdlib/plot/vega/padding/ctor' ); +var pkg = require( './../package.json' ).name; +var isPadding = require( './../lib' ); + + +// MAIN // + +bench( pkg+'::true', function benchmark( b ) { + var values; + var out; + var v; + var i; + + values = [ + new Padding({ + 'left': 10 + }), + new Padding({ + 'right': 10 + }) + ]; + + b.tic(); + for ( i = 0; i < b.iterations; i++ ) { + v = values[ i%values.length ]; + out = isPadding( v ); + if ( typeof out !== 'boolean' ) { + b.fail( 'should return a boolean' ); + } + } + b.toc(); + if ( !isBoolean( out ) ) { + b.fail( 'should return a boolean' ); + } + b.pass( 'benchmark finished' ); + b.end(); +}); + +bench( pkg+'::false', function benchmark( b ) { + var values; + var out; + var v; + var i; + + values = [ + 'foo', + 'bar', + '', + 'beep', + 'boop', + [], + {} + ]; + + b.tic(); + for ( i = 0; i < b.iterations; i++ ) { + v = values[ i%values.length ]; + out = isPadding( v ); + if ( typeof out !== 'boolean' ) { + b.fail( 'should return a boolean' ); + } + } + b.toc(); + if ( !isBoolean( out ) ) { + b.fail( 'should return a boolean' ); + } + b.pass( 'benchmark finished' ); + b.end(); +}); diff --git a/lib/node_modules/@stdlib/plot/vega/base/assert/is-padding/docs/repl.txt b/lib/node_modules/@stdlib/plot/vega/base/assert/is-padding/docs/repl.txt new file mode 100644 index 000000000000..36a2976b3b34 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/assert/is-padding/docs/repl.txt @@ -0,0 +1,25 @@ + +{{alias}}( value ) + Tests if an input value is a padding instance. + + Parameters + ---------- + value: any + Value to test. + + Returns + ------- + bool: boolean + Boolean indicating if an input value is a padding instance. + + Examples + -------- + > var v = new {{alias:@stdlib/plot/vega/padding/ctor}}(); + > var bool = {{alias}}( v ) + true + > bool = {{alias}}( {} ) + false + + See Also + -------- + diff --git a/lib/node_modules/@stdlib/plot/vega/base/assert/is-padding/docs/types/index.d.ts b/lib/node_modules/@stdlib/plot/vega/base/assert/is-padding/docs/types/index.d.ts new file mode 100644 index 000000000000..7c79d4555a88 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/assert/is-padding/docs/types/index.d.ts @@ -0,0 +1,45 @@ +/* +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +// TypeScript Version: 4.1 + +/** +* Tests whether an input value is a padding instance. +* +* @param v - value to test +* @returns boolean indicating whether an input value is a padding instance +* +* @example +* var Padding = require( '@stdlib/plot/vega/padding/ctor' ); +* +* var v = new Padding(); +* var bool = isPadding( v ); +* // returns true +* +* bool = isPadding( {} ); +* // returns false +* +* bool = isPadding( 'foo' ); +* // returns false +*/ +declare function isPadding( v: any ): boolean; + + +// EXPORTS // + +export = isPadding; diff --git a/lib/node_modules/@stdlib/plot/vega/base/assert/is-padding/docs/types/test.ts b/lib/node_modules/@stdlib/plot/vega/base/assert/is-padding/docs/types/test.ts new file mode 100644 index 000000000000..c5e36f981925 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/assert/is-padding/docs/types/test.ts @@ -0,0 +1,34 @@ +/* +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +import isPadding = require( './index' ); + + +// TESTS // + +// The function returns a boolean... +{ + isPadding( {} ); // $ExpectType boolean + isPadding( 'foo' ); // $ExpectType boolean +} + +// The compiler throws an error if the function is provided an unsupported number of arguments... +{ + isPadding(); // $ExpectError + isPadding( undefined, 123 ); // $ExpectError +} diff --git a/lib/node_modules/@stdlib/plot/vega/base/assert/is-padding/examples/index.js b/lib/node_modules/@stdlib/plot/vega/base/assert/is-padding/examples/index.js new file mode 100644 index 000000000000..30417dd0a0f0 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/assert/is-padding/examples/index.js @@ -0,0 +1,35 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +var Padding = require( '@stdlib/plot/vega/padding/ctor' ); +var isPadding = require( './../lib' ); + +var v = new Padding(); +var bool = isPadding( v ); +console.log( bool ); +// => true + +bool = isPadding( {} ); +console.log( bool ); +// => false + +bool = isPadding( 'foo' ); +console.log( bool ); +// => false diff --git a/lib/node_modules/@stdlib/plot/vega/base/assert/is-padding/lib/index.js b/lib/node_modules/@stdlib/plot/vega/base/assert/is-padding/lib/index.js new file mode 100644 index 000000000000..c1d19e60019b --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/assert/is-padding/lib/index.js @@ -0,0 +1,48 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +/** +* Test whether an input value is a padding instance. +* +* @module @stdlib/plot/vega/base/assert/is-padding +* +* @example +* var Padding = require( '@stdlib/plot/vega/padding/ctor' ); +* var isPadding = require( '@stdlib/plot/vega/base/assert/is-padding' ); +* +* var v = new Padding(); +* var bool = isPadding( v ); +* // returns true +* +* bool = isPadding( {} ); +* // returns false +* +* bool = isPadding( 'foo' ); +* // returns false +*/ + +// MODULES // + +var main = require( './main.js' ); + + +// EXPORTS // + +module.exports = main; diff --git a/lib/node_modules/@stdlib/plot/vega/base/assert/is-padding/lib/main.js b/lib/node_modules/@stdlib/plot/vega/base/assert/is-padding/lib/main.js new file mode 100644 index 000000000000..294dbea0fdd9 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/assert/is-padding/lib/main.js @@ -0,0 +1,67 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var isObject = require( '@stdlib/assert/is-object' ); +var isNumber = require( '@stdlib/assert/is-number' ).isPrimitive; +var Padding = require( '@stdlib/plot/vega/padding/ctor' ); + + +// MAIN // + +/** +* Tests whether an input value is a padding instance. +* +* @param {*} value - value to test +* @returns {boolean} boolean indicating whether an input value is a padding instance +* +* @example +* var Padding = require( '@stdlib/plot/vega/padding/ctor' ); +* +* var v = new Padding(); +* var bool = isPadding( v ); +* // returns true +* +* bool = isPadding( {} ); +* // returns false +* +* bool = isPadding( 'foo' ); +* // returns false +*/ +function isPadding( value ) { + return ( + value instanceof Padding || + + // The following is a set of rather imperfect heuristics for handling instances originating in a different realm... + ( + isObject( value ) && + isNumber( value.bottom ) && + isNumber( value.left ) && + isNumber( value.right ) && + isNumber( value.top ) + ) + ); +} + + +// EXPORTS // + +module.exports = isPadding; diff --git a/lib/node_modules/@stdlib/plot/vega/base/assert/is-padding/package.json b/lib/node_modules/@stdlib/plot/vega/base/assert/is-padding/package.json new file mode 100644 index 000000000000..15acaadc006b --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/assert/is-padding/package.json @@ -0,0 +1,70 @@ +{ + "name": "@stdlib/plot/vega/base/assert/is-padding", + "version": "0.0.0", + "description": "Test if an input value is a padding instance.", + "license": "Apache-2.0", + "author": { + "name": "The Stdlib Authors", + "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" + }, + "contributors": [ + { + "name": "The Stdlib Authors", + "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" + } + ], + "main": "./lib", + "directories": { + "benchmark": "./benchmark", + "doc": "./docs", + "example": "./examples", + "lib": "./lib", + "test": "./test" + }, + "types": "./docs/types", + "scripts": {}, + "homepage": "https://github.com/stdlib-js/stdlib", + "repository": { + "type": "git", + "url": "git://github.com/stdlib-js/stdlib.git" + }, + "bugs": { + "url": "https://github.com/stdlib-js/stdlib/issues" + }, + "dependencies": {}, + "devDependencies": {}, + "engines": { + "node": ">=0.10.0", + "npm": ">2.7.0" + }, + "os": [ + "aix", + "darwin", + "freebsd", + "linux", + "macos", + "openbsd", + "sunos", + "win32", + "windows" + ], + "keywords": [ + "stdlib", + "plot", + "base", + "vega", + "utilities", + "utility", + "utils", + "util", + "assert", + "test", + "check", + "is", + "valid", + "validate", + "validation", + "isvalid" + ], + "__stdlib__": {} +} diff --git a/lib/node_modules/@stdlib/plot/vega/base/assert/is-padding/test/test.js b/lib/node_modules/@stdlib/plot/vega/base/assert/is-padding/test/test.js new file mode 100644 index 000000000000..a18d490b3e1b --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/assert/is-padding/test/test.js @@ -0,0 +1,82 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var tape = require( 'tape' ); +var Padding = require( '@stdlib/plot/vega/padding/ctor' ); +var isPadding = require( './../lib' ); + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof isPadding, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'the function returns `true` if provided a padding instance', function test( t ) { + var values; + var bool; + var i; + + values = [ + new Padding({ + 'left': 10 + }), + new Padding({ + 'right': 10 + }) + ]; + for ( i = 0; i < values.length; i++ ) { + bool = isPadding( values[ i ] ); + t.strictEqual( bool, true, 'returns expected value when provided '+values[ i ] ); + } + t.end(); +}); + +tape( 'the function returns `false` if not provided a padding instance', function test( t ) { + var values; + var bool; + var i; + + values = [ + '', + 'beep', + 'boop', + 'foo', + 'bar', + 5, + NaN, + true, + false, + null, + void 0, + [], + {}, + function noop() {} + ]; + for ( i = 0; i < values.length; i++ ) { + bool = isPadding( values[ i ] ); + t.strictEqual( bool, false, 'returns expected value when provided '+values[ i ] ); + } + t.end(); +}); diff --git a/lib/node_modules/@stdlib/plot/vega/base/assert/is-quantitative-scale-name/README.md b/lib/node_modules/@stdlib/plot/vega/base/assert/is-quantitative-scale-name/README.md new file mode 100644 index 000000000000..7c65deeef6e7 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/assert/is-quantitative-scale-name/README.md @@ -0,0 +1,119 @@ +<!-- + +@license Apache-2.0 + +Copyright (c) 2025 The Stdlib Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + +--> + +# isQuantitativeScaleName + +> Test if an input value is a supported quantitative [scale name][@stdlib/plot/vega/scale/names]. + +<!-- Section to include introductory text. Make sure to keep an empty line after the intro `section` element and another before the `/section` close. --> + +<section class="intro"> + +</section> + +<!-- /.intro --> + +<!-- Package usage documentation. --> + +<section class="usage"> + +## Usage + +```javascript +var isQuantitativeScaleName = require( '@stdlib/plot/vega/base/assert/is-quantitative-scale-name' ); +``` + +#### isQuantitativeScaleName( value ) + +Tests if an input value is a supported quantitative [scale name][@stdlib/plot/vega/scale/names]. + +```javascript +var bool = isQuantitativeScaleName( 'linear' ); +// returns true + +bool = isQuantitativeScaleName( 'foo' ); +// returns false +``` + +</section> + +<!-- /.usage --> + +<!-- Package usage notes. Make sure to keep an empty line after the `section` element and another before the `/section` close. --> + +<section class="notes"> + +</section> + +<!-- /.notes --> + +<!-- Package usage examples. --> + +<section class="examples"> + +## Examples + +<!-- eslint no-undef: "error" --> + +```javascript +var isQuantitativeScaleName = require( '@stdlib/plot/vega/base/assert/is-quantitative-scale-name' ); + +var bool = isQuantitativeScaleName( 'linear' ); +// returns true + +bool = isQuantitativeScaleName( 'log' ); +// returns true + +bool = isQuantitativeScaleName( '' ); +// returns false + +bool = isQuantitativeScaleName( 'foo' ); +// returns false +``` + +</section> + +<!-- /.examples --> + +<!-- Section to include cited references. If references are included, add a horizontal rule *before* the section. Make sure to keep an empty line after the `section` element and another before the `/section` close. --> + +<section class="references"> + +</section> + +<!-- /.references --> + +<!-- Section for related `stdlib` packages. Do not manually edit this section, as it is automatically populated. --> + +<section class="related"> + +</section> + +<!-- /.related --> + +<!-- Section for all links. Make sure to keep an empty line after the `section` element and another before the `/section` close. --> + +<section class="links"> + +[@stdlib/plot/vega/scale/names]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/plot/vega/scale/names + +</section> + +<!-- /.links --> diff --git a/lib/node_modules/@stdlib/plot/vega/base/assert/is-quantitative-scale-name/benchmark/benchmark.js b/lib/node_modules/@stdlib/plot/vega/base/assert/is-quantitative-scale-name/benchmark/benchmark.js new file mode 100644 index 000000000000..73953e621094 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/assert/is-quantitative-scale-name/benchmark/benchmark.js @@ -0,0 +1,62 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var bench = require( '@stdlib/bench' ); +var isBoolean = require( '@stdlib/assert/is-boolean' ).isPrimitive; +var pkg = require( './../package.json' ).name; +var isQuantitativeScaleName = require( './../lib' ); + + +// MAIN // + +bench( pkg, function benchmark( b ) { + var values; + var out; + var v; + var i; + + values = [ + 'linear', + 'log', + 'pow', + 'foo', + 'bar', + '', + 'beep', + 'boop' + ]; + + b.tic(); + for ( i = 0; i < b.iterations; i++ ) { + v = values[ i%values.length ]; + out = isQuantitativeScaleName( v ); + if ( typeof out !== 'boolean' ) { + b.fail( 'should return a boolean' ); + } + } + b.toc(); + if ( !isBoolean( out ) ) { + b.fail( 'should return a boolean' ); + } + b.pass( 'benchmark finished' ); + b.end(); +}); diff --git a/lib/node_modules/@stdlib/plot/vega/base/assert/is-quantitative-scale-name/docs/repl.txt b/lib/node_modules/@stdlib/plot/vega/base/assert/is-quantitative-scale-name/docs/repl.txt new file mode 100644 index 000000000000..2b0835f95fb7 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/assert/is-quantitative-scale-name/docs/repl.txt @@ -0,0 +1,29 @@ + +{{alias}}( value ) + Tests if an input value is a supported quantitative scale name. + + Parameters + ---------- + value: any + Value to test. + + Returns + ------- + bool: boolean + Boolean indicating if an input value is a supported quantitative scale + name. + + Examples + -------- + > var bool = {{alias}}( 'linear' ) + true + > bool = {{alias}}( 'log' ) + true + > bool = {{alias}}( '' ) + false + > bool = {{alias}}( 'beep' ) + false + + See Also + -------- + diff --git a/lib/node_modules/@stdlib/plot/vega/base/assert/is-quantitative-scale-name/docs/types/index.d.ts b/lib/node_modules/@stdlib/plot/vega/base/assert/is-quantitative-scale-name/docs/types/index.d.ts new file mode 100644 index 000000000000..7bb50522afd8 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/assert/is-quantitative-scale-name/docs/types/index.d.ts @@ -0,0 +1,42 @@ +/* +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +// TypeScript Version: 4.1 + +/** +* Tests whether an input value is a supported quantitative scale name. +* +* @param v - value to test +* @returns boolean indicating whether an input value is a supported quantitative scale name +* +* @example +* var bool = isQuantitativeScaleName( 'linear' ); +* // returns true +* +* bool = isQuantitativeScaleName( 'log' ); +* // returns true +* +* bool = isQuantitativeScaleName( 'foo' ); +* // returns false +*/ +declare function isQuantitativeScaleName( v: any ): boolean; + + +// EXPORTS // + +export = isQuantitativeScaleName; diff --git a/lib/node_modules/@stdlib/plot/vega/base/assert/is-quantitative-scale-name/docs/types/test.ts b/lib/node_modules/@stdlib/plot/vega/base/assert/is-quantitative-scale-name/docs/types/test.ts new file mode 100644 index 000000000000..574542fd29ae --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/assert/is-quantitative-scale-name/docs/types/test.ts @@ -0,0 +1,34 @@ +/* +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +import isQuantitativeScaleName = require( './index' ); + + +// TESTS // + +// The function returns a boolean... +{ + isQuantitativeScaleName( 'real' ); // $ExpectType boolean + isQuantitativeScaleName( 'foo' ); // $ExpectType boolean +} + +// The compiler throws an error if the function is provided an unsupported number of arguments... +{ + isQuantitativeScaleName(); // $ExpectError + isQuantitativeScaleName( undefined, 123 ); // $ExpectError +} diff --git a/lib/node_modules/@stdlib/plot/vega/base/assert/is-quantitative-scale-name/examples/index.js b/lib/node_modules/@stdlib/plot/vega/base/assert/is-quantitative-scale-name/examples/index.js new file mode 100644 index 000000000000..27c8a0a1aa9c --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/assert/is-quantitative-scale-name/examples/index.js @@ -0,0 +1,37 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +var isQuantitativeScaleName = require( './../lib' ); + +var bool = isQuantitativeScaleName( 'linear' ); +console.log( bool ); +// => true + +bool = isQuantitativeScaleName( 'log' ); +console.log( bool ); +// => true + +bool = isQuantitativeScaleName( '' ); +console.log( bool ); +// => false + +bool = isQuantitativeScaleName( 'foo' ); +console.log( bool ); +// => false diff --git a/lib/node_modules/@stdlib/plot/vega/base/assert/is-quantitative-scale-name/lib/index.js b/lib/node_modules/@stdlib/plot/vega/base/assert/is-quantitative-scale-name/lib/index.js new file mode 100644 index 000000000000..e9bd2e79d0c1 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/assert/is-quantitative-scale-name/lib/index.js @@ -0,0 +1,46 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +/** +* Test whether an input value is a supported quantitative scale name. +* +* @module @stdlib/plot/vega/base/assert/is-quantitative-scale-name +* +* @example +* var isQuantitativeScaleName = require( '@stdlib/plot/vega/base/assert/is-quantitative-scale-name' ); +* +* var bool = isQuantitativeScaleName( 'linear' ); +* // returns true +* +* bool = isQuantitativeScaleName( 'log' ); +* // returns true +* +* bool = isQuantitativeScaleName( 'foo' ); +* // returns false +*/ + +// MODULES // + +var main = require( './main.js' ); + + +// EXPORTS // + +module.exports = main; diff --git a/lib/node_modules/@stdlib/plot/vega/base/assert/is-quantitative-scale-name/lib/main.js b/lib/node_modules/@stdlib/plot/vega/base/assert/is-quantitative-scale-name/lib/main.js new file mode 100644 index 000000000000..1c4d9333924e --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/assert/is-quantitative-scale-name/lib/main.js @@ -0,0 +1,52 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var contains = require( '@stdlib/array/base/assert/contains' ).factory; +var scales = require( '@stdlib/plot/vega/scale/names' ); + + +// MAIN // + +/** +* Tests whether an input value is a supported quantitative scale name. +* +* @name isQuantitativeScaleName +* @type {Function} +* @param {*} v - value to test +* @returns {boolean} boolean indicating whether an input value is a supported quantitative scale name +* +* @example +* var bool = isQuantitativeScaleName( 'linear' ); +* // returns true +* +* bool = isQuantitativeScaleName( 'log' ); +* // returns true +* +* bool = isQuantitativeScaleName( 'foo' ); +* // returns false +*/ +var isQuantitativeScaleName = contains( scales( 'quantitative' ) ); + + +// EXPORTS // + +module.exports = isQuantitativeScaleName; diff --git a/lib/node_modules/@stdlib/plot/vega/base/assert/is-quantitative-scale-name/package.json b/lib/node_modules/@stdlib/plot/vega/base/assert/is-quantitative-scale-name/package.json new file mode 100644 index 000000000000..d9787f657f8a --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/assert/is-quantitative-scale-name/package.json @@ -0,0 +1,70 @@ +{ + "name": "@stdlib/plot/vega/base/assert/is-quantitative-scale-name", + "version": "0.0.0", + "description": "Test if an input value is a supported quantitative scale name.", + "license": "Apache-2.0", + "author": { + "name": "The Stdlib Authors", + "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" + }, + "contributors": [ + { + "name": "The Stdlib Authors", + "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" + } + ], + "main": "./lib", + "directories": { + "benchmark": "./benchmark", + "doc": "./docs", + "example": "./examples", + "lib": "./lib", + "test": "./test" + }, + "types": "./docs/types", + "scripts": {}, + "homepage": "https://github.com/stdlib-js/stdlib", + "repository": { + "type": "git", + "url": "git://github.com/stdlib-js/stdlib.git" + }, + "bugs": { + "url": "https://github.com/stdlib-js/stdlib/issues" + }, + "dependencies": {}, + "devDependencies": {}, + "engines": { + "node": ">=0.10.0", + "npm": ">2.7.0" + }, + "os": [ + "aix", + "darwin", + "freebsd", + "linux", + "macos", + "openbsd", + "sunos", + "win32", + "windows" + ], + "keywords": [ + "stdlib", + "plot", + "base", + "vega", + "utilities", + "utility", + "utils", + "util", + "assert", + "test", + "check", + "is", + "valid", + "validate", + "validation", + "isvalid" + ], + "__stdlib__": {} +} diff --git a/lib/node_modules/@stdlib/plot/vega/base/assert/is-quantitative-scale-name/test/test.js b/lib/node_modules/@stdlib/plot/vega/base/assert/is-quantitative-scale-name/test/test.js new file mode 100644 index 000000000000..717bde1b6449 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/assert/is-quantitative-scale-name/test/test.js @@ -0,0 +1,75 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var tape = require( 'tape' ); +var scales = require( '@stdlib/plot/vega/scale/names' ); +var isQuantitativeScaleName = require( './../lib' ); + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof isQuantitativeScaleName, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'the function returns `true` if provided a supported quantitative scale name', function test( t ) { + var values; + var bool; + var i; + + values = scales( 'quantitative' ); + for ( i = 0; i < values.length; i++ ) { + bool = isQuantitativeScaleName( values[ i ] ); + t.strictEqual( bool, true, 'returns expected value when provided '+values[ i ] ); + } + t.end(); +}); + +tape( 'the function returns `false` if not provided a supported quantitative scale name', function test( t ) { + var values; + var bool; + var i; + + values = [ + '', + 'beep', + 'boop', + 'foo', + 'bar', + 5, + NaN, + true, + false, + null, + void 0, + [], + {}, + function noop() {} + ]; + for ( i = 0; i < values.length; i++ ) { + bool = isQuantitativeScaleName( values[ i ] ); + t.strictEqual( bool, false, 'returns expected value when provided '+values[ i ] ); + } + t.end(); +}); diff --git a/lib/node_modules/@stdlib/plot/vega/base/assert/is-quantitative-scale/README.md b/lib/node_modules/@stdlib/plot/vega/base/assert/is-quantitative-scale/README.md new file mode 100644 index 000000000000..0045bb73d4b5 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/assert/is-quantitative-scale/README.md @@ -0,0 +1,125 @@ +<!-- + +@license Apache-2.0 + +Copyright (c) 2025 The Stdlib Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + +--> + +# isQuantitativeScale + +> Test if an input value is a [quantitative scale][@stdlib/plot/vega/scale/quantitative]. + +<!-- Section to include introductory text. Make sure to keep an empty line after the intro `section` element and another before the `/section` close. --> + +<section class="intro"> + +</section> + +<!-- /.intro --> + +<!-- Package usage documentation. --> + +<section class="usage"> + +## Usage + +```javascript +var isQuantitativeScale = require( '@stdlib/plot/vega/base/assert/is-quantitative-scale' ); +``` + +#### isQuantitativeScale( value ) + +Tests if an input value is a [quantitative scale][@stdlib/plot/vega/scale/quantitative]. + +```javascript +var QuantitativeScale = require( '@stdlib/plot/vega/scale/quantitative' ); + +var v = new QuantitativeScale({ + 'name': 'xScale' +}); +var bool = isQuantitativeScale( v ); +// returns true + +bool = isQuantitativeScale( {} ); +// returns false +``` + +</section> + +<!-- /.usage --> + +<!-- Package usage notes. Make sure to keep an empty line after the `section` element and another before the `/section` close. --> + +<section class="notes"> + +</section> + +<!-- /.notes --> + +<!-- Package usage examples. --> + +<section class="examples"> + +## Examples + +<!-- eslint no-undef: "error" --> + +```javascript +var QuantitativeScale = require( '@stdlib/plot/vega/scale/quantitative' ); +var isQuantitativeScale = require( '@stdlib/plot/vega/base/assert/is-quantitative-scale' ); + +var v = new QuantitativeScale({ + 'name': 'xScale' +}); +var bool = isQuantitativeScale( v ); +// returns true + +bool = isQuantitativeScale( {} ); +// returns false + +bool = isQuantitativeScale( 'foo' ); +// returns false +``` + +</section> + +<!-- /.examples --> + +<!-- Section to include cited references. If references are included, add a horizontal rule *before* the section. Make sure to keep an empty line after the `section` element and another before the `/section` close. --> + +<section class="references"> + +</section> + +<!-- /.references --> + +<!-- Section for related `stdlib` packages. Do not manually edit this section, as it is automatically populated. --> + +<section class="related"> + +</section> + +<!-- /.related --> + +<!-- Section for all links. Make sure to keep an empty line after the `section` element and another before the `/section` close. --> + +<section class="links"> + +[@stdlib/plot/vega/scale/quantitative]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/plot/vega/scale/quantitative + +</section> + +<!-- /.links --> diff --git a/lib/node_modules/@stdlib/plot/vega/base/assert/is-quantitative-scale/benchmark/benchmark.js b/lib/node_modules/@stdlib/plot/vega/base/assert/is-quantitative-scale/benchmark/benchmark.js new file mode 100644 index 000000000000..2dee022a62c4 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/assert/is-quantitative-scale/benchmark/benchmark.js @@ -0,0 +1,93 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var bench = require( '@stdlib/bench' ); +var isBoolean = require( '@stdlib/assert/is-boolean' ).isPrimitive; +var QuantitativeScale = require( '@stdlib/plot/vega/scale/quantitative' ); +var pkg = require( './../package.json' ).name; +var isQuantitativeScale = require( './../lib' ); + + +// MAIN // + +bench( pkg+'::true', function benchmark( b ) { + var values; + var out; + var v; + var i; + + values = [ + new QuantitativeScale({ + 'name': 'xScale' + }), + new QuantitativeScale({ + 'name': 'yScale' + }) + ]; + + b.tic(); + for ( i = 0; i < b.iterations; i++ ) { + v = values[ i%values.length ]; + out = isQuantitativeScale( v ); + if ( typeof out !== 'boolean' ) { + b.fail( 'should return a boolean' ); + } + } + b.toc(); + if ( !isBoolean( out ) ) { + b.fail( 'should return a boolean' ); + } + b.pass( 'benchmark finished' ); + b.end(); +}); + +bench( pkg+'::false', function benchmark( b ) { + var values; + var out; + var v; + var i; + + values = [ + 'foo', + 'bar', + '', + 'beep', + 'boop', + [], + {} + ]; + + b.tic(); + for ( i = 0; i < b.iterations; i++ ) { + v = values[ i%values.length ]; + out = isQuantitativeScale( v ); + if ( typeof out !== 'boolean' ) { + b.fail( 'should return a boolean' ); + } + } + b.toc(); + if ( !isBoolean( out ) ) { + b.fail( 'should return a boolean' ); + } + b.pass( 'benchmark finished' ); + b.end(); +}); diff --git a/lib/node_modules/@stdlib/plot/vega/base/assert/is-quantitative-scale/docs/repl.txt b/lib/node_modules/@stdlib/plot/vega/base/assert/is-quantitative-scale/docs/repl.txt new file mode 100644 index 000000000000..21043149674e --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/assert/is-quantitative-scale/docs/repl.txt @@ -0,0 +1,26 @@ + +{{alias}}( value ) + Tests if an input value is a quantitative scale instance. + + Parameters + ---------- + value: any + Value to test. + + Returns + ------- + bool: boolean + Boolean indicating if an input value is a quantitative scale instance. + + Examples + -------- + > var opts = { 'name': 'xScale' }; + > var v = new {{alias:@stdlib/plot/vega/scale/quantitative}}( opts ); + > var bool = {{alias}}( v ) + true + > bool = {{alias}}( {} ) + false + + See Also + -------- + diff --git a/lib/node_modules/@stdlib/plot/vega/base/assert/is-quantitative-scale/docs/types/index.d.ts b/lib/node_modules/@stdlib/plot/vega/base/assert/is-quantitative-scale/docs/types/index.d.ts new file mode 100644 index 000000000000..83e06d67fc90 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/assert/is-quantitative-scale/docs/types/index.d.ts @@ -0,0 +1,47 @@ +/* +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +// TypeScript Version: 4.1 + +/** +* Tests whether an input value is a quantitative scale instance. +* +* @param v - value to test +* @returns boolean indicating whether an input value is a quantitative scale instance +* +* @example +* var QuantitativeScale = require( '@stdlib/plot/vega/scale/quantitative' ); +* +* var v = new QuantitativeScale({ +* 'name': 'xScale' +* }); +* var bool = isQuantitativeScale( v ); +* // returns true +* +* bool = isQuantitativeScale( {} ); +* // returns false +* +* bool = isQuantitativeScale( 'foo' ); +* // returns false +*/ +declare function isQuantitativeScale( v: any ): boolean; + + +// EXPORTS // + +export = isQuantitativeScale; diff --git a/lib/node_modules/@stdlib/plot/vega/base/assert/is-quantitative-scale/docs/types/test.ts b/lib/node_modules/@stdlib/plot/vega/base/assert/is-quantitative-scale/docs/types/test.ts new file mode 100644 index 000000000000..80cb7233f14e --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/assert/is-quantitative-scale/docs/types/test.ts @@ -0,0 +1,34 @@ +/* +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +import isQuantitativeScale = require( './index' ); + + +// TESTS // + +// The function returns a boolean... +{ + isQuantitativeScale( {} ); // $ExpectType boolean + isQuantitativeScale( 'foo' ); // $ExpectType boolean +} + +// The compiler throws an error if the function is provided an unsupported number of arguments... +{ + isQuantitativeScale(); // $ExpectError + isQuantitativeScale( undefined, 123 ); // $ExpectError +} diff --git a/lib/node_modules/@stdlib/plot/vega/base/assert/is-quantitative-scale/examples/index.js b/lib/node_modules/@stdlib/plot/vega/base/assert/is-quantitative-scale/examples/index.js new file mode 100644 index 000000000000..688ce8c1a579 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/assert/is-quantitative-scale/examples/index.js @@ -0,0 +1,37 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +var QuantitativeScale = require( '@stdlib/plot/vega/scale/quantitative' ); +var isQuantitativeScale = require( './../lib' ); + +var v = new QuantitativeScale({ + 'name': 'xScale' +}); +var bool = isQuantitativeScale( v ); +console.log( bool ); +// => true + +bool = isQuantitativeScale( {} ); +console.log( bool ); +// => false + +bool = isQuantitativeScale( 'foo' ); +console.log( bool ); +// => false diff --git a/lib/node_modules/@stdlib/plot/vega/base/assert/is-quantitative-scale/lib/index.js b/lib/node_modules/@stdlib/plot/vega/base/assert/is-quantitative-scale/lib/index.js new file mode 100644 index 000000000000..c2ded89b99c5 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/assert/is-quantitative-scale/lib/index.js @@ -0,0 +1,50 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +/** +* Test whether an input value is a quantitative scale instance. +* +* @module @stdlib/plot/vega/base/assert/is-quantitative-scale +* +* @example +* var QuantitativeScale = require( '@stdlib/plot/vega/scale/quantitative' ); +* var isQuantitativeScale = require( '@stdlib/plot/vega/base/assert/is-quantitative-scale' ); +* +* var v = new QuantitativeScale({ +* 'name': 'xScale' +* }); +* var bool = isQuantitativeScale( v ); +* // returns true +* +* bool = isQuantitativeScale( {} ); +* // returns false +* +* bool = isQuantitativeScale( 'foo' ); +* // returns false +*/ + +// MODULES // + +var main = require( './main.js' ); + + +// EXPORTS // + +module.exports = main; diff --git a/lib/node_modules/@stdlib/plot/vega/base/assert/is-quantitative-scale/lib/main.js b/lib/node_modules/@stdlib/plot/vega/base/assert/is-quantitative-scale/lib/main.js new file mode 100644 index 000000000000..0526a515ab62 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/assert/is-quantitative-scale/lib/main.js @@ -0,0 +1,70 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var isQuantitativeScaleName = require( '@stdlib/plot/vega/base/assert/is-quantitative-scale-name' ); +var isObject = require( '@stdlib/assert/is-object' ); +var hasProp = require( '@stdlib/assert/has-property' ); +var QuantitativeScale = require( '@stdlib/plot/vega/scale/quantitative' ); + + +// MAIN // + +/** +* Tests whether an input value is a quantitative scale instance. +* +* @param {*} value - value to test +* @returns {boolean} boolean indicating whether an input value is a quantitative scale instance +* +* @example +* var QuantitativeScale = require( '@stdlib/plot/vega/scale/quantitative' ); +* +* var v = new QuantitativeScale({ +* 'name': 'xScale' +* }); +* var bool = isQuantitativeScale( v ); +* // returns true +* +* bool = isQuantitativeScale( {} ); +* // returns false +* +* bool = isQuantitativeScale( 'foo' ); +* // returns false +*/ +function isQuantitativeScale( value ) { + return ( + value instanceof QuantitativeScale || + + // The following is a set of rather imperfect heuristics for handling instances originating in a different realm... + ( + isObject( value ) && + isQuantitativeScaleName( value.type ) && + hasProp( value, 'name' ) && + hasProp( value, 'domain' ) && + hasProp( value, 'range' ) + ) + ); +} + + +// EXPORTS // + +module.exports = isQuantitativeScale; diff --git a/lib/node_modules/@stdlib/plot/vega/base/assert/is-quantitative-scale/package.json b/lib/node_modules/@stdlib/plot/vega/base/assert/is-quantitative-scale/package.json new file mode 100644 index 000000000000..fda7c21fc449 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/assert/is-quantitative-scale/package.json @@ -0,0 +1,70 @@ +{ + "name": "@stdlib/plot/vega/base/assert/is-quantitative-scale", + "version": "0.0.0", + "description": "Test if an input value is a quantitative scale instance.", + "license": "Apache-2.0", + "author": { + "name": "The Stdlib Authors", + "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" + }, + "contributors": [ + { + "name": "The Stdlib Authors", + "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" + } + ], + "main": "./lib", + "directories": { + "benchmark": "./benchmark", + "doc": "./docs", + "example": "./examples", + "lib": "./lib", + "test": "./test" + }, + "types": "./docs/types", + "scripts": {}, + "homepage": "https://github.com/stdlib-js/stdlib", + "repository": { + "type": "git", + "url": "git://github.com/stdlib-js/stdlib.git" + }, + "bugs": { + "url": "https://github.com/stdlib-js/stdlib/issues" + }, + "dependencies": {}, + "devDependencies": {}, + "engines": { + "node": ">=0.10.0", + "npm": ">2.7.0" + }, + "os": [ + "aix", + "darwin", + "freebsd", + "linux", + "macos", + "openbsd", + "sunos", + "win32", + "windows" + ], + "keywords": [ + "stdlib", + "plot", + "base", + "vega", + "utilities", + "utility", + "utils", + "util", + "assert", + "test", + "check", + "is", + "valid", + "validate", + "validation", + "isvalid" + ], + "__stdlib__": {} +} diff --git a/lib/node_modules/@stdlib/plot/vega/base/assert/is-quantitative-scale/test/test.js b/lib/node_modules/@stdlib/plot/vega/base/assert/is-quantitative-scale/test/test.js new file mode 100644 index 000000000000..323c29918ec4 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/assert/is-quantitative-scale/test/test.js @@ -0,0 +1,88 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var tape = require( 'tape' ); +var LinearScale = require( '@stdlib/plot/vega/scale/linear' ); +var QuantitativeScale = require( '@stdlib/plot/vega/scale/quantitative' ); +var Scale = require( '@stdlib/plot/vega/scale/base/ctor' ); +var isQuantitativeScale = require( './../lib' ); + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof isQuantitativeScale, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'the function returns `true` if provided a quantitative scale instance', function test( t ) { + var values; + var bool; + var i; + + values = [ + new LinearScale({ + 'name': 'yScale' + }), + new QuantitativeScale({ + 'name': 'zScale' + }) + ]; + for ( i = 0; i < values.length; i++ ) { + bool = isQuantitativeScale( values[ i ] ); + t.strictEqual( bool, true, 'returns expected value when provided '+values[ i ] ); + } + t.end(); +}); + +tape( 'the function returns `false` if not provided a quantitative scale instance', function test( t ) { + var values; + var bool; + var i; + + values = [ + new Scale({ + 'name': 'xScale', + 'type': 'ordinal' + }), + '', + 'beep', + 'boop', + 'foo', + 'bar', + 5, + NaN, + true, + false, + null, + void 0, + [], + {}, + function noop() {} + ]; + for ( i = 0; i < values.length; i++ ) { + bool = isQuantitativeScale( values[ i ] ); + t.strictEqual( bool, false, 'returns expected value when provided '+values[ i ] ); + } + t.end(); +}); diff --git a/lib/node_modules/@stdlib/plot/vega/base/assert/is-scale-array/README.md b/lib/node_modules/@stdlib/plot/vega/base/assert/is-scale-array/README.md new file mode 100644 index 000000000000..0a999886f0d7 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/assert/is-scale-array/README.md @@ -0,0 +1,129 @@ +<!-- + +@license Apache-2.0 + +Copyright (c) 2025 The Stdlib Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + +--> + +# isScaleArray + +> Test if an input value is an array of [scales][@stdlib/plot/vega/scale/base/ctor]. + +<!-- Section to include introductory text. Make sure to keep an empty line after the intro `section` element and another before the `/section` close. --> + +<section class="intro"> + +</section> + +<!-- /.intro --> + +<!-- Package usage documentation. --> + +<section class="usage"> + +## Usage + +```javascript +var isScaleArray = require( '@stdlib/plot/vega/base/assert/is-scale-array' ); +``` + +#### isScaleArray( value ) + +Tests if an input value is an array of [scales][@stdlib/plot/vega/scale/base/ctor]. + +```javascript +var Scale = require( '@stdlib/plot/vega/scale/base/ctor' ); + +var v = new Scale({ + 'name': 'xScale' +}); +var bool = isScaleArray( [ v ] ); +// returns true +``` + +If provided an empty array, the function returns `false`. + +```javascript +var bool = isScaleArray( [] ); +// returns false +``` + +</section> + +<!-- /.usage --> + +<!-- Package usage notes. Make sure to keep an empty line after the `section` element and another before the `/section` close. --> + +<section class="notes"> + +</section> + +<!-- /.notes --> + +<!-- Package usage examples. --> + +<section class="examples"> + +## Examples + +<!-- eslint no-undef: "error" --> + +```javascript +var Scale = require( '@stdlib/plot/vega/scale/base/ctor' ); +var isScaleArray = require( '@stdlib/plot/vega/base/assert/is-scale-array' ); + +var v = new Scale({ + 'name': 'xScale' +}); +var bool = isScaleArray( [ v ] ); +// returns true + +bool = isScaleArray( {} ); +// returns false + +bool = isScaleArray( 'foo' ); +// returns false +``` + +</section> + +<!-- /.examples --> + +<!-- Section to include cited references. If references are included, add a horizontal rule *before* the section. Make sure to keep an empty line after the `section` element and another before the `/section` close. --> + +<section class="references"> + +</section> + +<!-- /.references --> + +<!-- Section for related `stdlib` packages. Do not manually edit this section, as it is automatically populated. --> + +<section class="related"> + +</section> + +<!-- /.related --> + +<!-- Section for all links. Make sure to keep an empty line after the `section` element and another before the `/section` close. --> + +<section class="links"> + +[@stdlib/plot/vega/scale/base/ctor]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/plot/vega/scale/base/ctor + +</section> + +<!-- /.links --> diff --git a/lib/node_modules/@stdlib/plot/vega/base/assert/is-scale-array/benchmark/benchmark.js b/lib/node_modules/@stdlib/plot/vega/base/assert/is-scale-array/benchmark/benchmark.js new file mode 100644 index 000000000000..a80feeaf77b0 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/assert/is-scale-array/benchmark/benchmark.js @@ -0,0 +1,91 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var bench = require( '@stdlib/bench' ); +var isBoolean = require( '@stdlib/assert/is-boolean' ).isPrimitive; +var Scale = require( '@stdlib/plot/vega/scale/base/ctor' ); +var pkg = require( './../package.json' ).name; +var isScaleArray = require( './../lib' ); + + +// MAIN // + +bench( pkg+'::true', function benchmark( b ) { + var values; + var out; + var i; + + values = [ + new Scale({ + 'name': 'xScale' + }), + new Scale({ + 'name': 'yScale' + }) + ]; + + b.tic(); + for ( i = 0; i < b.iterations; i++ ) { + out = isScaleArray( [ values[ i%values.length ] ] ); + if ( typeof out !== 'boolean' ) { + b.fail( 'should return a boolean' ); + } + } + b.toc(); + if ( !isBoolean( out ) ) { + b.fail( 'should return a boolean' ); + } + b.pass( 'benchmark finished' ); + b.end(); +}); + +bench( pkg+'::false', function benchmark( b ) { + var values; + var out; + var v; + var i; + + values = [ + 'foo', + 'bar', + '', + 'beep', + 'boop', + [], + {} + ]; + + b.tic(); + for ( i = 0; i < b.iterations; i++ ) { + v = values[ i%values.length ]; + out = isScaleArray( v ); + if ( typeof out !== 'boolean' ) { + b.fail( 'should return a boolean' ); + } + } + b.toc(); + if ( !isBoolean( out ) ) { + b.fail( 'should return a boolean' ); + } + b.pass( 'benchmark finished' ); + b.end(); +}); diff --git a/lib/node_modules/@stdlib/plot/vega/base/assert/is-scale-array/docs/repl.txt b/lib/node_modules/@stdlib/plot/vega/base/assert/is-scale-array/docs/repl.txt new file mode 100644 index 000000000000..c3dbe0217039 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/assert/is-scale-array/docs/repl.txt @@ -0,0 +1,26 @@ + +{{alias}}( value ) + Tests if an input value is an array of scale instances. + + Parameters + ---------- + value: any + Value to test. + + Returns + ------- + bool: boolean + Boolean indicating if an input value is an array of scale instances. + + Examples + -------- + > var opts = { 'name': 'xScale' }; + > var v = new {{alias:@stdlib/plot/vega/scale/base/ctor}}( opts ); + > var bool = {{alias}}( [ v ] ) + true + > bool = {{alias}}( {} ) + false + + See Also + -------- + diff --git a/lib/node_modules/@stdlib/plot/vega/base/assert/is-scale-array/docs/types/index.d.ts b/lib/node_modules/@stdlib/plot/vega/base/assert/is-scale-array/docs/types/index.d.ts new file mode 100644 index 000000000000..59d1aa3871cc --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/assert/is-scale-array/docs/types/index.d.ts @@ -0,0 +1,47 @@ +/* +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +// TypeScript Version: 4.1 + +/** +* Tests whether an input value is an array of scale instances. +* +* @param v - value to test +* @returns boolean indicating whether an input value is an array of scale instances +* +* @example +* var Scale = require( '@stdlib/plot/vega/scale/base/ctor' ); +* +* var v = new Scale({ +* 'name': 'xScale' +* }); +* var bool = isScaleArray( [ v ] ); +* // returns true +* +* bool = isScaleArray( {} ); +* // returns false +* +* bool = isScaleArray( 'foo' ); +* // returns false +*/ +declare function isScaleArray( v: any ): boolean; + + +// EXPORTS // + +export = isScaleArray; diff --git a/lib/node_modules/@stdlib/plot/vega/base/assert/is-scale-array/docs/types/test.ts b/lib/node_modules/@stdlib/plot/vega/base/assert/is-scale-array/docs/types/test.ts new file mode 100644 index 000000000000..bddf9090725f --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/assert/is-scale-array/docs/types/test.ts @@ -0,0 +1,34 @@ +/* +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +import isScaleArray = require( './index' ); + + +// TESTS // + +// The function returns a boolean... +{ + isScaleArray( {} ); // $ExpectType boolean + isScaleArray( 'foo' ); // $ExpectType boolean +} + +// The compiler throws an error if the function is provided an unsupported number of arguments... +{ + isScaleArray(); // $ExpectError + isScaleArray( undefined, 123 ); // $ExpectError +} diff --git a/lib/node_modules/@stdlib/plot/vega/base/assert/is-scale-array/examples/index.js b/lib/node_modules/@stdlib/plot/vega/base/assert/is-scale-array/examples/index.js new file mode 100644 index 000000000000..4f60997ddb5e --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/assert/is-scale-array/examples/index.js @@ -0,0 +1,37 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +var Scale = require( '@stdlib/plot/vega/scale/base/ctor' ); +var isScaleArray = require( './../lib' ); + +var v = new Scale({ + 'name': 'xScale' +}); +var bool = isScaleArray( [ v ] ); +console.log( bool ); +// => true + +bool = isScaleArray( {} ); +console.log( bool ); +// => false + +bool = isScaleArray( 'foo' ); +console.log( bool ); +// => false diff --git a/lib/node_modules/@stdlib/plot/vega/base/assert/is-scale-array/lib/index.js b/lib/node_modules/@stdlib/plot/vega/base/assert/is-scale-array/lib/index.js new file mode 100644 index 000000000000..5f5ea52774c6 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/assert/is-scale-array/lib/index.js @@ -0,0 +1,50 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +/** +* Test whether an input value is an array of scale instances. +* +* @module @stdlib/plot/vega/base/assert/is-scale-array +* +* @example +* var Scale = require( '@stdlib/plot/vega/scale/base/ctor' ); +* var isScaleArray = require( '@stdlib/plot/vega/base/assert/is-scale-array' ); +* +* var v = new Scale({ +* 'name': 'xScale' +* }); +* var bool = isScaleArray( [ v ] ); +* // returns true +* +* bool = isScaleArray( {} ); +* // returns false +* +* bool = isScaleArray( 'foo' ); +* // returns false +*/ + +// MODULES // + +var main = require( './main.js' ); + + +// EXPORTS // + +module.exports = main; diff --git a/lib/node_modules/@stdlib/plot/vega/base/assert/is-scale-array/lib/main.js b/lib/node_modules/@stdlib/plot/vega/base/assert/is-scale-array/lib/main.js new file mode 100644 index 000000000000..aaa33777ab6f --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/assert/is-scale-array/lib/main.js @@ -0,0 +1,57 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var arraylikefcn = require( '@stdlib/assert/tools/array-like-function' ); +var isScale = require( '@stdlib/plot/vega/base/assert/is-scale' ); + + +// MAIN // + +/** +* Tests whether an input value is an array of scale instances. +* +* @name isScaleArray +* @type {Function} +* @param {*} value - value to test +* @returns {boolean} boolean indicating whether an input value is an array of scale instances +* +* @example +* var Scale = require( '@stdlib/plot/vega/scale/base/ctor' ); +* +* var v = new Scale({ +* 'name': 'xScale' +* }); +* var bool = isScaleArray( [ v ] ); +* // returns true +* +* bool = isScaleArray( {} ); +* // returns false +* +* bool = isScaleArray( 'foo' ); +* // returns false +*/ +var isScaleArray = arraylikefcn( isScale ); + + +// EXPORTS // + +module.exports = isScaleArray; diff --git a/lib/node_modules/@stdlib/plot/vega/base/assert/is-scale-array/package.json b/lib/node_modules/@stdlib/plot/vega/base/assert/is-scale-array/package.json new file mode 100644 index 000000000000..5d5bb2c15d33 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/assert/is-scale-array/package.json @@ -0,0 +1,70 @@ +{ + "name": "@stdlib/plot/vega/base/assert/is-scale-array", + "version": "0.0.0", + "description": "Test if an input value is an array of scale instances.", + "license": "Apache-2.0", + "author": { + "name": "The Stdlib Authors", + "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" + }, + "contributors": [ + { + "name": "The Stdlib Authors", + "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" + } + ], + "main": "./lib", + "directories": { + "benchmark": "./benchmark", + "doc": "./docs", + "example": "./examples", + "lib": "./lib", + "test": "./test" + }, + "types": "./docs/types", + "scripts": {}, + "homepage": "https://github.com/stdlib-js/stdlib", + "repository": { + "type": "git", + "url": "git://github.com/stdlib-js/stdlib.git" + }, + "bugs": { + "url": "https://github.com/stdlib-js/stdlib/issues" + }, + "dependencies": {}, + "devDependencies": {}, + "engines": { + "node": ">=0.10.0", + "npm": ">2.7.0" + }, + "os": [ + "aix", + "darwin", + "freebsd", + "linux", + "macos", + "openbsd", + "sunos", + "win32", + "windows" + ], + "keywords": [ + "stdlib", + "plot", + "base", + "vega", + "utilities", + "utility", + "utils", + "util", + "assert", + "test", + "check", + "is", + "valid", + "validate", + "validation", + "isvalid" + ], + "__stdlib__": {} +} diff --git a/lib/node_modules/@stdlib/plot/vega/base/assert/is-scale-array/test/test.js b/lib/node_modules/@stdlib/plot/vega/base/assert/is-scale-array/test/test.js new file mode 100644 index 000000000000..313dd3305476 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/assert/is-scale-array/test/test.js @@ -0,0 +1,85 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var tape = require( 'tape' ); +var LinearScale = require( '@stdlib/plot/vega/scale/linear' ); +var QuantitativeScale = require( '@stdlib/plot/vega/scale/quantitative' ); +var Scale = require( '@stdlib/plot/vega/scale/base/ctor' ); +var isScaleArray = require( './../lib' ); + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof isScaleArray, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'the function returns `true` if provided an array of scale instances', function test( t ) { + var values; + var actual; + + values = [ + new Scale({ + 'name': 'xScale' + }), + new LinearScale({ + 'name': 'yScale' + }), + new QuantitativeScale({ + 'name': 'zScale' + }) + ]; + actual = isScaleArray( values ); + t.strictEqual( actual, true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function returns `false` if not provided an array of scale instances', function test( t ) { + var values; + var bool; + var i; + + values = [ + '', + 'beep', + 'boop', + 'foo', + 'bar', + 5, + NaN, + true, + false, + null, + void 0, + [], + {}, + function noop() {} + ]; + for ( i = 0; i < values.length; i++ ) { + bool = isScaleArray( values[ i ] ); + t.strictEqual( bool, false, 'returns expected value when provided '+values[ i ] ); + } + t.end(); +}); diff --git a/lib/node_modules/@stdlib/plot/vega/base/assert/is-scale-name-array/README.md b/lib/node_modules/@stdlib/plot/vega/base/assert/is-scale-name-array/README.md new file mode 100644 index 000000000000..d0fe3d071821 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/assert/is-scale-name-array/README.md @@ -0,0 +1,120 @@ +<!-- + +@license Apache-2.0 + +Copyright (c) 2025 The Stdlib Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + +--> + +# isScaleNameArray + +> Test if an input value is an array of [scale names][@stdlib/plot/vega/scale/names]. + +<!-- Section to include introductory text. Make sure to keep an empty line after the intro `section` element and another before the `/section` close. --> + +<section class="intro"> + +</section> + +<!-- /.intro --> + +<!-- Package usage documentation. --> + +<section class="usage"> + +## Usage + +```javascript +var isScaleNameArray = require( '@stdlib/plot/vega/base/assert/is-scale-name-array' ); +``` + +#### isScaleNameArray( value ) + +Tests if an input value is an array of [scale names][@stdlib/plot/vega/scale/names]. + +```javascript +var bool = isScaleNameArray( [ 'linear' ] ); +// returns true +``` + +If provided an empty array, the function returns `false`. + +```javascript +var bool = isScaleNameArray( [] ); +// returns false +``` + +</section> + +<!-- /.usage --> + +<!-- Package usage notes. Make sure to keep an empty line after the `section` element and another before the `/section` close. --> + +<section class="notes"> + +</section> + +<!-- /.notes --> + +<!-- Package usage examples. --> + +<section class="examples"> + +## Examples + +<!-- eslint no-undef: "error" --> + +```javascript +var isScaleNameArray = require( '@stdlib/plot/vega/base/assert/is-scale-name-array' ); + +var bool = isScaleNameArray( [ 'linear', 'log' ] ); +// returns true + +bool = isScaleNameArray( {} ); +// returns false + +bool = isScaleNameArray( 'foo' ); +// returns false +``` + +</section> + +<!-- /.examples --> + +<!-- Section to include cited references. If references are included, add a horizontal rule *before* the section. Make sure to keep an empty line after the `section` element and another before the `/section` close. --> + +<section class="references"> + +</section> + +<!-- /.references --> + +<!-- Section for related `stdlib` packages. Do not manually edit this section, as it is automatically populated. --> + +<section class="related"> + +</section> + +<!-- /.related --> + +<!-- Section for all links. Make sure to keep an empty line after the `section` element and another before the `/section` close. --> + +<section class="links"> + +[@stdlib/plot/vega/scale/names]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/plot/vega/base/scale-names + +</section> + +<!-- /.links --> diff --git a/lib/node_modules/@stdlib/plot/vega/base/assert/is-scale-name-array/benchmark/benchmark.js b/lib/node_modules/@stdlib/plot/vega/base/assert/is-scale-name-array/benchmark/benchmark.js new file mode 100644 index 000000000000..20ee3d353553 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/assert/is-scale-name-array/benchmark/benchmark.js @@ -0,0 +1,86 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var bench = require( '@stdlib/bench' ); +var isBoolean = require( '@stdlib/assert/is-boolean' ).isPrimitive; +var pkg = require( './../package.json' ).name; +var isScaleNameArray = require( './../lib' ); + + +// MAIN // + +bench( pkg+'::true', function benchmark( b ) { + var values; + var out; + var i; + + values = [ + 'linear', + 'log' + ]; + + b.tic(); + for ( i = 0; i < b.iterations; i++ ) { + out = isScaleNameArray( [ values[ i%values.length ] ] ); + if ( typeof out !== 'boolean' ) { + b.fail( 'should return a boolean' ); + } + } + b.toc(); + if ( !isBoolean( out ) ) { + b.fail( 'should return a boolean' ); + } + b.pass( 'benchmark finished' ); + b.end(); +}); + +bench( pkg+'::false', function benchmark( b ) { + var values; + var out; + var v; + var i; + + values = [ + 'foo', + 'bar', + '', + 'beep', + 'boop', + [], + {} + ]; + + b.tic(); + for ( i = 0; i < b.iterations; i++ ) { + v = values[ i%values.length ]; + out = isScaleNameArray( v ); + if ( typeof out !== 'boolean' ) { + b.fail( 'should return a boolean' ); + } + } + b.toc(); + if ( !isBoolean( out ) ) { + b.fail( 'should return a boolean' ); + } + b.pass( 'benchmark finished' ); + b.end(); +}); diff --git a/lib/node_modules/@stdlib/plot/vega/base/assert/is-scale-name-array/docs/repl.txt b/lib/node_modules/@stdlib/plot/vega/base/assert/is-scale-name-array/docs/repl.txt new file mode 100644 index 000000000000..31f8ae99ff8c --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/assert/is-scale-name-array/docs/repl.txt @@ -0,0 +1,24 @@ + +{{alias}}( value ) + Tests if an input value is an array of scale names. + + Parameters + ---------- + value: any + Value to test. + + Returns + ------- + bool: boolean + Boolean indicating if an input value is an array of scale names. + + Examples + -------- + > var bool = {{alias}}( [ 'linear' ] ) + true + > bool = {{alias}}( {} ) + false + + See Also + -------- + diff --git a/lib/node_modules/@stdlib/plot/vega/base/assert/is-scale-name-array/docs/types/index.d.ts b/lib/node_modules/@stdlib/plot/vega/base/assert/is-scale-name-array/docs/types/index.d.ts new file mode 100644 index 000000000000..c7f793484991 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/assert/is-scale-name-array/docs/types/index.d.ts @@ -0,0 +1,42 @@ +/* +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +// TypeScript Version: 4.1 + +/** +* Tests whether an input value is an array of scale names. +* +* @param v - value to test +* @returns boolean indicating whether an input value is an array of scale names +* +* @example +* var bool = isScaleNameArray( [ 'linear' ] ); +* // returns true +* +* bool = isScaleNameArray( {} ); +* // returns false +* +* bool = isScaleNameArray( 'foo' ); +* // returns false +*/ +declare function isScaleNameArray( v: any ): boolean; + + +// EXPORTS // + +export = isScaleNameArray; diff --git a/lib/node_modules/@stdlib/plot/vega/base/assert/is-scale-name-array/docs/types/test.ts b/lib/node_modules/@stdlib/plot/vega/base/assert/is-scale-name-array/docs/types/test.ts new file mode 100644 index 000000000000..ba97322784e8 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/assert/is-scale-name-array/docs/types/test.ts @@ -0,0 +1,34 @@ +/* +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +import isScaleNameArray = require( './index' ); + + +// TESTS // + +// The function returns a boolean... +{ + isScaleNameArray( {} ); // $ExpectType boolean + isScaleNameArray( 'foo' ); // $ExpectType boolean +} + +// The compiler throws an error if the function is provided an unsupported number of arguments... +{ + isScaleNameArray(); // $ExpectError + isScaleNameArray( undefined, 123 ); // $ExpectError +} diff --git a/lib/node_modules/@stdlib/plot/vega/base/assert/is-scale-name-array/examples/index.js b/lib/node_modules/@stdlib/plot/vega/base/assert/is-scale-name-array/examples/index.js new file mode 100644 index 000000000000..b9c148d02a45 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/assert/is-scale-name-array/examples/index.js @@ -0,0 +1,33 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +var isScaleNameArray = require( './../lib' ); + +var bool = isScaleNameArray( [ 'linear', 'log' ] ); +console.log( bool ); +// => true + +bool = isScaleNameArray( {} ); +console.log( bool ); +// => false + +bool = isScaleNameArray( 'foo' ); +console.log( bool ); +// => false diff --git a/lib/node_modules/@stdlib/plot/vega/base/assert/is-scale-name-array/lib/index.js b/lib/node_modules/@stdlib/plot/vega/base/assert/is-scale-name-array/lib/index.js new file mode 100644 index 000000000000..9a12e98924a7 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/assert/is-scale-name-array/lib/index.js @@ -0,0 +1,46 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +/** +* Test whether an input value is an array of scale names. +* +* @module @stdlib/plot/vega/base/assert/is-scale-name-array +* +* @example +* var isScaleNameArray = require( '@stdlib/plot/vega/base/assert/is-scale-name-array' ); +* +* var bool = isScaleNameArray( [ 'linear' ] ); +* // returns true +* +* bool = isScaleNameArray( {} ); +* // returns false +* +* bool = isScaleNameArray( 'foo' ); +* // returns false +*/ + +// MODULES // + +var main = require( './main.js' ); + + +// EXPORTS // + +module.exports = main; diff --git a/lib/node_modules/@stdlib/plot/vega/base/assert/is-scale-name-array/lib/main.js b/lib/node_modules/@stdlib/plot/vega/base/assert/is-scale-name-array/lib/main.js new file mode 100644 index 000000000000..e9bc69c710e8 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/assert/is-scale-name-array/lib/main.js @@ -0,0 +1,52 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var arraylikefcn = require( '@stdlib/assert/tools/array-like-function' ); +var isScaleName = require( '@stdlib/plot/vega/base/assert/is-scale-name' ); + + +// MAIN // + +/** +* Tests whether an input value is an array of scale names. +* +* @name isScaleNameArray +* @type {Function} +* @param {*} value - value to test +* @returns {boolean} boolean indicating whether an input value is an array of scale names +* +* @example +* var bool = isScaleNameArray( [ 'linear' ] ); +* // returns true +* +* bool = isScaleNameArray( {} ); +* // returns false +* +* bool = isScaleNameArray( 'foo' ); +* // returns false +*/ +var isScaleNameArray = arraylikefcn( isScaleName ); + + +// EXPORTS // + +module.exports = isScaleNameArray; diff --git a/lib/node_modules/@stdlib/plot/vega/base/assert/is-scale-name-array/package.json b/lib/node_modules/@stdlib/plot/vega/base/assert/is-scale-name-array/package.json new file mode 100644 index 000000000000..3510e4090b56 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/assert/is-scale-name-array/package.json @@ -0,0 +1,70 @@ +{ + "name": "@stdlib/plot/vega/base/assert/is-scale-name-array", + "version": "0.0.0", + "description": "Test if an input value is an array of scale names.", + "license": "Apache-2.0", + "author": { + "name": "The Stdlib Authors", + "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" + }, + "contributors": [ + { + "name": "The Stdlib Authors", + "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" + } + ], + "main": "./lib", + "directories": { + "benchmark": "./benchmark", + "doc": "./docs", + "example": "./examples", + "lib": "./lib", + "test": "./test" + }, + "types": "./docs/types", + "scripts": {}, + "homepage": "https://github.com/stdlib-js/stdlib", + "repository": { + "type": "git", + "url": "git://github.com/stdlib-js/stdlib.git" + }, + "bugs": { + "url": "https://github.com/stdlib-js/stdlib/issues" + }, + "dependencies": {}, + "devDependencies": {}, + "engines": { + "node": ">=0.10.0", + "npm": ">2.7.0" + }, + "os": [ + "aix", + "darwin", + "freebsd", + "linux", + "macos", + "openbsd", + "sunos", + "win32", + "windows" + ], + "keywords": [ + "stdlib", + "plot", + "base", + "vega", + "utilities", + "utility", + "utils", + "util", + "assert", + "test", + "check", + "is", + "valid", + "validate", + "validation", + "isvalid" + ], + "__stdlib__": {} +} diff --git a/lib/node_modules/@stdlib/plot/vega/base/assert/is-scale-name-array/test/test.js b/lib/node_modules/@stdlib/plot/vega/base/assert/is-scale-name-array/test/test.js new file mode 100644 index 000000000000..30a2083aac52 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/assert/is-scale-name-array/test/test.js @@ -0,0 +1,76 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var tape = require( 'tape' ); +var isScaleNameArray = require( './../lib' ); + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof isScaleNameArray, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'the function returns `true` if provided an array of scale names', function test( t ) { + var values; + var actual; + + values = [ + 'linear', + 'log', + 'ordinal' + ]; + actual = isScaleNameArray( values ); + t.strictEqual( actual, true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function returns `false` if not provided an array of scale names', function test( t ) { + var values; + var bool; + var i; + + values = [ + '', + 'beep', + 'boop', + 'foo', + 'bar', + 5, + NaN, + true, + false, + null, + void 0, + [], + {}, + function noop() {} + ]; + for ( i = 0; i < values.length; i++ ) { + bool = isScaleNameArray( values[ i ] ); + t.strictEqual( bool, false, 'returns expected value when provided '+values[ i ] ); + } + t.end(); +}); diff --git a/lib/node_modules/@stdlib/plot/vega/base/assert/is-scale-name/README.md b/lib/node_modules/@stdlib/plot/vega/base/assert/is-scale-name/README.md new file mode 100644 index 000000000000..2eaccf7ff1e8 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/assert/is-scale-name/README.md @@ -0,0 +1,122 @@ +<!-- + +@license Apache-2.0 + +Copyright (c) 2025 The Stdlib Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + +--> + +# isScaleName + +> Test if an input value is a supported [scale name][@stdlib/plot/vega/scale/names]. + +<!-- Section to include introductory text. Make sure to keep an empty line after the intro `section` element and another before the `/section` close. --> + +<section class="intro"> + +</section> + +<!-- /.intro --> + +<!-- Package usage documentation. --> + +<section class="usage"> + +## Usage + +```javascript +var isScaleName = require( '@stdlib/plot/vega/base/assert/is-scale-name' ); +``` + +#### isScaleName( value ) + +Tests if an input value is a supported [scale name][@stdlib/plot/vega/scale/names]. + +```javascript +var bool = isScaleName( 'linear' ); +// returns true + +bool = isScaleName( 'foo' ); +// returns false +``` + +</section> + +<!-- /.usage --> + +<!-- Package usage notes. Make sure to keep an empty line after the `section` element and another before the `/section` close. --> + +<section class="notes"> + +</section> + +<!-- /.notes --> + +<!-- Package usage examples. --> + +<section class="examples"> + +## Examples + +<!-- eslint no-undef: "error" --> + +```javascript +var isScaleName = require( '@stdlib/plot/vega/base/assert/is-scale-name' ); + +var bool = isScaleName( 'linear' ); +// returns true + +bool = isScaleName( 'log' ); +// returns true + +bool = isScaleName( 'ordinal' ); +// returns true + +bool = isScaleName( '' ); +// returns false + +bool = isScaleName( 'foo' ); +// returns false +``` + +</section> + +<!-- /.examples --> + +<!-- Section to include cited references. If references are included, add a horizontal rule *before* the section. Make sure to keep an empty line after the `section` element and another before the `/section` close. --> + +<section class="references"> + +</section> + +<!-- /.references --> + +<!-- Section for related `stdlib` packages. Do not manually edit this section, as it is automatically populated. --> + +<section class="related"> + +</section> + +<!-- /.related --> + +<!-- Section for all links. Make sure to keep an empty line after the `section` element and another before the `/section` close. --> + +<section class="links"> + +[@stdlib/plot/vega/scale/names]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/plot/vega/scale/names + +</section> + +<!-- /.links --> diff --git a/lib/node_modules/@stdlib/plot/vega/base/assert/is-scale-name/benchmark/benchmark.js b/lib/node_modules/@stdlib/plot/vega/base/assert/is-scale-name/benchmark/benchmark.js new file mode 100644 index 000000000000..c6ee7a81aa24 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/assert/is-scale-name/benchmark/benchmark.js @@ -0,0 +1,62 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var bench = require( '@stdlib/bench' ); +var isBoolean = require( '@stdlib/assert/is-boolean' ).isPrimitive; +var pkg = require( './../package.json' ).name; +var isScaleName = require( './../lib' ); + + +// MAIN // + +bench( pkg, function benchmark( b ) { + var values; + var out; + var v; + var i; + + values = [ + 'linear', + 'log', + 'pow', + 'foo', + 'bar', + '', + 'beep', + 'boop' + ]; + + b.tic(); + for ( i = 0; i < b.iterations; i++ ) { + v = values[ i%values.length ]; + out = isScaleName( v ); + if ( typeof out !== 'boolean' ) { + b.fail( 'should return a boolean' ); + } + } + b.toc(); + if ( !isBoolean( out ) ) { + b.fail( 'should return a boolean' ); + } + b.pass( 'benchmark finished' ); + b.end(); +}); diff --git a/lib/node_modules/@stdlib/plot/vega/base/assert/is-scale-name/docs/repl.txt b/lib/node_modules/@stdlib/plot/vega/base/assert/is-scale-name/docs/repl.txt new file mode 100644 index 000000000000..906303f65dfc --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/assert/is-scale-name/docs/repl.txt @@ -0,0 +1,30 @@ + +{{alias}}( value ) + Tests if an input value is a supported scale name. + + Parameters + ---------- + value: any + Value to test. + + Returns + ------- + bool: boolean + Boolean indicating if an input value is a supported scale name. + + Examples + -------- + > var bool = {{alias}}( 'linear' ) + true + > bool = {{alias}}( 'log' ) + true + > bool = {{alias}}( 'ordinal' ) + true + > bool = {{alias}}( '' ) + false + > bool = {{alias}}( 'beep' ) + false + + See Also + -------- + diff --git a/lib/node_modules/@stdlib/plot/vega/base/assert/is-scale-name/docs/types/index.d.ts b/lib/node_modules/@stdlib/plot/vega/base/assert/is-scale-name/docs/types/index.d.ts new file mode 100644 index 000000000000..162eaa0de4d1 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/assert/is-scale-name/docs/types/index.d.ts @@ -0,0 +1,45 @@ +/* +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +// TypeScript Version: 4.1 + +/** +* Tests whether an input value is a supported scale name. +* +* @param v - value to test +* @returns boolean indicating whether an input value is a supported scale name +* +* @example +* var bool = isScaleName( 'linear' ); +* // returns true +* +* bool = isScaleName( 'log' ); +* // returns true +* +* bool = isScaleName( 'ordinal' ); +* // returns true +* +* bool = isScaleName( 'foo' ); +* // returns false +*/ +declare function isScaleName( v: any ): boolean; + + +// EXPORTS // + +export = isScaleName; diff --git a/lib/node_modules/@stdlib/plot/vega/base/assert/is-scale-name/docs/types/test.ts b/lib/node_modules/@stdlib/plot/vega/base/assert/is-scale-name/docs/types/test.ts new file mode 100644 index 000000000000..b16a9c16bf11 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/assert/is-scale-name/docs/types/test.ts @@ -0,0 +1,34 @@ +/* +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +import isScaleName = require( './index' ); + + +// TESTS // + +// The function returns a boolean... +{ + isScaleName( 'real' ); // $ExpectType boolean + isScaleName( 'foo' ); // $ExpectType boolean +} + +// The compiler throws an error if the function is provided an unsupported number of arguments... +{ + isScaleName(); // $ExpectError + isScaleName( undefined, 123 ); // $ExpectError +} diff --git a/lib/node_modules/@stdlib/plot/vega/base/assert/is-scale-name/examples/index.js b/lib/node_modules/@stdlib/plot/vega/base/assert/is-scale-name/examples/index.js new file mode 100644 index 000000000000..c17cb142742a --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/assert/is-scale-name/examples/index.js @@ -0,0 +1,41 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +var isScaleName = require( './../lib' ); + +var bool = isScaleName( 'linear' ); +console.log( bool ); +// => true + +bool = isScaleName( 'log' ); +console.log( bool ); +// => true + +bool = isScaleName( 'ordinal' ); +console.log( bool ); +// => true + +bool = isScaleName( '' ); +console.log( bool ); +// => false + +bool = isScaleName( 'foo' ); +console.log( bool ); +// => false diff --git a/lib/node_modules/@stdlib/plot/vega/base/assert/is-scale-name/lib/index.js b/lib/node_modules/@stdlib/plot/vega/base/assert/is-scale-name/lib/index.js new file mode 100644 index 000000000000..d3821f5f32e8 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/assert/is-scale-name/lib/index.js @@ -0,0 +1,49 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +/** +* Test whether an input value is a supported scale name. +* +* @module @stdlib/plot/vega/base/assert/is-scale-name +* +* @example +* var isScaleName = require( '@stdlib/plot/vega/base/assert/is-scale-name' ); +* +* var bool = isScaleName( 'linear' ); +* // returns true +* +* bool = isScaleName( 'log' ); +* // returns true +* +* bool = isScaleName( 'ordinal' ); +* // returns true +* +* bool = isScaleName( 'foo' ); +* // returns false +*/ + +// MODULES // + +var main = require( './main.js' ); + + +// EXPORTS // + +module.exports = main; diff --git a/lib/node_modules/@stdlib/plot/vega/base/assert/is-scale-name/lib/main.js b/lib/node_modules/@stdlib/plot/vega/base/assert/is-scale-name/lib/main.js new file mode 100644 index 000000000000..f5fdfb8ebb59 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/assert/is-scale-name/lib/main.js @@ -0,0 +1,55 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var contains = require( '@stdlib/array/base/assert/contains' ).factory; +var scales = require( '@stdlib/plot/vega/scale/names' ); + + +// MAIN // + +/** +* Tests whether an input value is a supported scale name. +* +* @name isScaleName +* @type {Function} +* @param {*} v - value to test +* @returns {boolean} boolean indicating whether an input value is a supported scale name +* +* @example +* var bool = isScaleName( 'linear' ); +* // returns true +* +* bool = isScaleName( 'log' ); +* // returns true +* +* bool = isScaleName( 'ordinal' ); +* // returns true +* +* bool = isScaleName( 'foo' ); +* // returns false +*/ +var isScaleName = contains( scales() ); + + +// EXPORTS // + +module.exports = isScaleName; diff --git a/lib/node_modules/@stdlib/plot/vega/base/assert/is-scale-name/package.json b/lib/node_modules/@stdlib/plot/vega/base/assert/is-scale-name/package.json new file mode 100644 index 000000000000..5c0c35ce9bef --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/assert/is-scale-name/package.json @@ -0,0 +1,70 @@ +{ + "name": "@stdlib/plot/vega/base/assert/is-scale-name", + "version": "0.0.0", + "description": "Test if an input value is a supported scale name.", + "license": "Apache-2.0", + "author": { + "name": "The Stdlib Authors", + "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" + }, + "contributors": [ + { + "name": "The Stdlib Authors", + "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" + } + ], + "main": "./lib", + "directories": { + "benchmark": "./benchmark", + "doc": "./docs", + "example": "./examples", + "lib": "./lib", + "test": "./test" + }, + "types": "./docs/types", + "scripts": {}, + "homepage": "https://github.com/stdlib-js/stdlib", + "repository": { + "type": "git", + "url": "git://github.com/stdlib-js/stdlib.git" + }, + "bugs": { + "url": "https://github.com/stdlib-js/stdlib/issues" + }, + "dependencies": {}, + "devDependencies": {}, + "engines": { + "node": ">=0.10.0", + "npm": ">2.7.0" + }, + "os": [ + "aix", + "darwin", + "freebsd", + "linux", + "macos", + "openbsd", + "sunos", + "win32", + "windows" + ], + "keywords": [ + "stdlib", + "plot", + "base", + "vega", + "utilities", + "utility", + "utils", + "util", + "assert", + "test", + "check", + "is", + "valid", + "validate", + "validation", + "isvalid" + ], + "__stdlib__": {} +} diff --git a/lib/node_modules/@stdlib/plot/vega/base/assert/is-scale-name/test/test.js b/lib/node_modules/@stdlib/plot/vega/base/assert/is-scale-name/test/test.js new file mode 100644 index 000000000000..7c53590d3808 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/assert/is-scale-name/test/test.js @@ -0,0 +1,78 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var tape = require( 'tape' ); +var isScaleName = require( './../lib' ); + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof isScaleName, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'the function returns `true` if provided a supported scale name', function test( t ) { + var values; + var bool; + var i; + + values = [ + 'linear', + 'log', + 'ordinal' + ]; + for ( i = 0; i < values.length; i++ ) { + bool = isScaleName( values[ i ] ); + t.strictEqual( bool, true, 'returns expected value when provided '+values[ i ] ); + } + t.end(); +}); + +tape( 'the function returns `false` if not provided a supported scale name', function test( t ) { + var values; + var bool; + var i; + + values = [ + '', + 'beep', + 'boop', + 'foo', + 'bar', + 5, + NaN, + true, + false, + null, + void 0, + [], + {}, + function noop() {} + ]; + for ( i = 0; i < values.length; i++ ) { + bool = isScaleName( values[ i ] ); + t.strictEqual( bool, false, 'returns expected value when provided '+values[ i ] ); + } + t.end(); +}); diff --git a/lib/node_modules/@stdlib/plot/vega/base/assert/is-scale-range-default/README.md b/lib/node_modules/@stdlib/plot/vega/base/assert/is-scale-range-default/README.md new file mode 100644 index 000000000000..9ba7c91ee8b0 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/assert/is-scale-range-default/README.md @@ -0,0 +1,122 @@ +<!-- + +@license Apache-2.0 + +Copyright (c) 2025 The Stdlib Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + +--> + +# isScaleRangeDefault + +> Test if an input value is a supported [scale range default][@stdlib/plot/vega/scale/base/range-defaults]. + +<!-- Section to include introductory text. Make sure to keep an empty line after the intro `section` element and another before the `/section` close. --> + +<section class="intro"> + +</section> + +<!-- /.intro --> + +<!-- Package usage documentation. --> + +<section class="usage"> + +## Usage + +```javascript +var isScaleRangeDefault = require( '@stdlib/plot/vega/base/assert/is-scale-range-default' ); +``` + +#### isScaleRangeDefault( value ) + +Tests if an input value is a supported [scale range default][@stdlib/plot/vega/scale/base/range-defaults]. + +```javascript +var bool = isScaleRangeDefault( 'width' ); +// returns true + +bool = isScaleRangeDefault( 'foo' ); +// returns false +``` + +</section> + +<!-- /.usage --> + +<!-- Package usage notes. Make sure to keep an empty line after the `section` element and another before the `/section` close. --> + +<section class="notes"> + +</section> + +<!-- /.notes --> + +<!-- Package usage examples. --> + +<section class="examples"> + +## Examples + +<!-- eslint no-undef: "error" --> + +```javascript +var isScaleRangeDefault = require( '@stdlib/plot/vega/base/assert/is-scale-range-default' ); + +var bool = isScaleRangeDefault( 'width' ); +// returns true + +bool = isScaleRangeDefault( 'height' ); +// returns true + +bool = isScaleRangeDefault( 'ordinal' ); +// returns true + +bool = isScaleRangeDefault( '' ); +// returns false + +bool = isScaleRangeDefault( 'foo' ); +// returns false +``` + +</section> + +<!-- /.examples --> + +<!-- Section to include cited references. If references are included, add a horizontal rule *before* the section. Make sure to keep an empty line after the `section` element and another before the `/section` close. --> + +<section class="references"> + +</section> + +<!-- /.references --> + +<!-- Section for related `stdlib` packages. Do not manually edit this section, as it is automatically populated. --> + +<section class="related"> + +</section> + +<!-- /.related --> + +<!-- Section for all links. Make sure to keep an empty line after the `section` element and another before the `/section` close. --> + +<section class="links"> + +[@stdlib/plot/vega/scale/base/range-defaults]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/plot/vega/scale/base/range-defaults + +</section> + +<!-- /.links --> diff --git a/lib/node_modules/@stdlib/plot/vega/base/assert/is-scale-range-default/benchmark/benchmark.js b/lib/node_modules/@stdlib/plot/vega/base/assert/is-scale-range-default/benchmark/benchmark.js new file mode 100644 index 000000000000..c3ea6841306e --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/assert/is-scale-range-default/benchmark/benchmark.js @@ -0,0 +1,61 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var bench = require( '@stdlib/bench' ); +var isBoolean = require( '@stdlib/assert/is-boolean' ).isPrimitive; +var pkg = require( './../package.json' ).name; +var isScaleRangeDefault = require( './../lib' ); + + +// MAIN // + +bench( pkg, function benchmark( b ) { + var values; + var out; + var v; + var i; + + values = [ + 'height', + 'width', + 'foo', + 'bar', + '', + 'beep', + 'boop' + ]; + + b.tic(); + for ( i = 0; i < b.iterations; i++ ) { + v = values[ i%values.length ]; + out = isScaleRangeDefault( v ); + if ( typeof out !== 'boolean' ) { + b.fail( 'should return a boolean' ); + } + } + b.toc(); + if ( !isBoolean( out ) ) { + b.fail( 'should return a boolean' ); + } + b.pass( 'benchmark finished' ); + b.end(); +}); diff --git a/lib/node_modules/@stdlib/plot/vega/base/assert/is-scale-range-default/docs/repl.txt b/lib/node_modules/@stdlib/plot/vega/base/assert/is-scale-range-default/docs/repl.txt new file mode 100644 index 000000000000..7a8c4ddc2d25 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/assert/is-scale-range-default/docs/repl.txt @@ -0,0 +1,30 @@ + +{{alias}}( value ) + Tests if an input value is a supported scale range default. + + Parameters + ---------- + value: any + Value to test. + + Returns + ------- + bool: boolean + Boolean indicating if an input value is a supported scale range default. + + Examples + -------- + > var bool = {{alias}}( 'width' ) + true + > bool = {{alias}}( 'height' ) + true + > bool = {{alias}}( 'ordinal' ) + true + > bool = {{alias}}( '' ) + false + > bool = {{alias}}( 'beep' ) + false + + See Also + -------- + diff --git a/lib/node_modules/@stdlib/plot/vega/base/assert/is-scale-range-default/docs/types/index.d.ts b/lib/node_modules/@stdlib/plot/vega/base/assert/is-scale-range-default/docs/types/index.d.ts new file mode 100644 index 000000000000..225cb8d0a061 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/assert/is-scale-range-default/docs/types/index.d.ts @@ -0,0 +1,45 @@ +/* +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +// TypeScript Version: 4.1 + +/** +* Tests whether an input value is a supported scale range default. +* +* @param v - value to test +* @returns boolean indicating whether an input value is a supported scale range default +* +* @example +* var bool = isScaleRangeDefault( 'width' ); +* // returns true +* +* bool = isScaleRangeDefault( 'height' ); +* // returns true +* +* bool = isScaleRangeDefault( 'ordinal' ); +* // returns true +* +* bool = isScaleRangeDefault( 'foo' ); +* // returns false +*/ +declare function isScaleRangeDefault( v: any ): boolean; + + +// EXPORTS // + +export = isScaleRangeDefault; diff --git a/lib/node_modules/@stdlib/plot/vega/base/assert/is-scale-range-default/docs/types/test.ts b/lib/node_modules/@stdlib/plot/vega/base/assert/is-scale-range-default/docs/types/test.ts new file mode 100644 index 000000000000..662875a65d0d --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/assert/is-scale-range-default/docs/types/test.ts @@ -0,0 +1,34 @@ +/* +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +import isScaleRangeDefault = require( './index' ); + + +// TESTS // + +// The function returns a boolean... +{ + isScaleRangeDefault( 'real' ); // $ExpectType boolean + isScaleRangeDefault( 'foo' ); // $ExpectType boolean +} + +// The compiler throws an error if the function is provided an unsupported number of arguments... +{ + isScaleRangeDefault(); // $ExpectError + isScaleRangeDefault( undefined, 123 ); // $ExpectError +} diff --git a/lib/node_modules/@stdlib/plot/vega/base/assert/is-scale-range-default/examples/index.js b/lib/node_modules/@stdlib/plot/vega/base/assert/is-scale-range-default/examples/index.js new file mode 100644 index 000000000000..d090e44623a8 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/assert/is-scale-range-default/examples/index.js @@ -0,0 +1,41 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +var isScaleRangeDefault = require( './../lib' ); + +var bool = isScaleRangeDefault( 'width' ); +console.log( bool ); +// => true + +bool = isScaleRangeDefault( 'height' ); +console.log( bool ); +// => true + +bool = isScaleRangeDefault( 'ordinal' ); +console.log( bool ); +// => true + +bool = isScaleRangeDefault( '' ); +console.log( bool ); +// => false + +bool = isScaleRangeDefault( 'foo' ); +console.log( bool ); +// => false diff --git a/lib/node_modules/@stdlib/plot/vega/base/assert/is-scale-range-default/lib/index.js b/lib/node_modules/@stdlib/plot/vega/base/assert/is-scale-range-default/lib/index.js new file mode 100644 index 000000000000..1f1b16468cb7 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/assert/is-scale-range-default/lib/index.js @@ -0,0 +1,49 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +/** +* Test whether an input value is a supported scale range default. +* +* @module @stdlib/plot/vega/base/assert/is-scale-range-default +* +* @example +* var isScaleRangeDefault = require( '@stdlib/plot/vega/base/assert/is-scale-range-default' ); +* +* var bool = isScaleRangeDefault( 'width' ); +* // returns true +* +* bool = isScaleRangeDefault( 'height' ); +* // returns true +* +* bool = isScaleRangeDefault( 'ordinal' ); +* // returns true +* +* bool = isScaleRangeDefault( 'foo' ); +* // returns false +*/ + +// MODULES // + +var main = require( './main.js' ); + + +// EXPORTS // + +module.exports = main; diff --git a/lib/node_modules/@stdlib/plot/vega/base/assert/is-scale-range-default/lib/main.js b/lib/node_modules/@stdlib/plot/vega/base/assert/is-scale-range-default/lib/main.js new file mode 100644 index 000000000000..d7dba97e92a8 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/assert/is-scale-range-default/lib/main.js @@ -0,0 +1,55 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var contains = require( '@stdlib/array/base/assert/contains' ).factory; +var scaleRangeDefaults = require( '@stdlib/plot/vega/scale/base/range-defaults' ); + + +// MAIN // + +/** +* Tests whether an input value is a supported scale range default. +* +* @name isScaleRangeDefault +* @type {Function} +* @param {*} v - value to test +* @returns {boolean} boolean indicating whether an input value is a supported scale range default +* +* @example +* var bool = isScaleRangeDefault( 'width' ); +* // returns true +* +* bool = isScaleRangeDefault( 'height' ); +* // returns true +* +* bool = isScaleRangeDefault( 'ordinal' ); +* // returns true +* +* bool = isScaleRangeDefault( 'foo' ); +* // returns false +*/ +var isScaleRangeDefault = contains( scaleRangeDefaults() ); + + +// EXPORTS // + +module.exports = isScaleRangeDefault; diff --git a/lib/node_modules/@stdlib/plot/vega/base/assert/is-scale-range-default/package.json b/lib/node_modules/@stdlib/plot/vega/base/assert/is-scale-range-default/package.json new file mode 100644 index 000000000000..22a1e74aa6ba --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/assert/is-scale-range-default/package.json @@ -0,0 +1,70 @@ +{ + "name": "@stdlib/plot/vega/base/assert/is-scale-range-default", + "version": "0.0.0", + "description": "Test if an input value is a supported scale range default.", + "license": "Apache-2.0", + "author": { + "name": "The Stdlib Authors", + "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" + }, + "contributors": [ + { + "name": "The Stdlib Authors", + "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" + } + ], + "main": "./lib", + "directories": { + "benchmark": "./benchmark", + "doc": "./docs", + "example": "./examples", + "lib": "./lib", + "test": "./test" + }, + "types": "./docs/types", + "scripts": {}, + "homepage": "https://github.com/stdlib-js/stdlib", + "repository": { + "type": "git", + "url": "git://github.com/stdlib-js/stdlib.git" + }, + "bugs": { + "url": "https://github.com/stdlib-js/stdlib/issues" + }, + "dependencies": {}, + "devDependencies": {}, + "engines": { + "node": ">=0.10.0", + "npm": ">2.7.0" + }, + "os": [ + "aix", + "darwin", + "freebsd", + "linux", + "macos", + "openbsd", + "sunos", + "win32", + "windows" + ], + "keywords": [ + "stdlib", + "plot", + "base", + "vega", + "utilities", + "utility", + "utils", + "util", + "assert", + "test", + "check", + "is", + "valid", + "validate", + "validation", + "isvalid" + ], + "__stdlib__": {} +} diff --git a/lib/node_modules/@stdlib/plot/vega/base/assert/is-scale-range-default/test/test.js b/lib/node_modules/@stdlib/plot/vega/base/assert/is-scale-range-default/test/test.js new file mode 100644 index 000000000000..b1b557062a97 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/assert/is-scale-range-default/test/test.js @@ -0,0 +1,78 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var tape = require( 'tape' ); +var isScaleRangeDefault = require( './../lib' ); + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof isScaleRangeDefault, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'the function returns `true` if provided a supported scale range default', function test( t ) { + var values; + var bool; + var i; + + values = [ + 'width', + 'height', + 'ordinal' + ]; + for ( i = 0; i < values.length; i++ ) { + bool = isScaleRangeDefault( values[ i ] ); + t.strictEqual( bool, true, 'returns expected value when provided '+values[ i ] ); + } + t.end(); +}); + +tape( 'the function returns `false` if not provided a supported scale range default', function test( t ) { + var values; + var bool; + var i; + + values = [ + '', + 'beep', + 'boop', + 'foo', + 'bar', + 5, + NaN, + true, + false, + null, + void 0, + [], + {}, + function noop() {} + ]; + for ( i = 0; i < values.length; i++ ) { + bool = isScaleRangeDefault( values[ i ] ); + t.strictEqual( bool, false, 'returns expected value when provided '+values[ i ] ); + } + t.end(); +}); diff --git a/lib/node_modules/@stdlib/plot/vega/base/assert/is-scale-range-interpolation-method/README.md b/lib/node_modules/@stdlib/plot/vega/base/assert/is-scale-range-interpolation-method/README.md new file mode 100644 index 000000000000..9bc30248407f --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/assert/is-scale-range-interpolation-method/README.md @@ -0,0 +1,125 @@ +<!-- + +@license Apache-2.0 + +Copyright (c) 2025 The Stdlib Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + +--> + +# isScaleRangeInterpolationMethod + +> Test if an input value is a supported [scale range interpolation method][@stdlib/plot/vega/scale/base/range-interpolation-methods]. + +<!-- Section to include introductory text. Make sure to keep an empty line after the intro `section` element and another before the `/section` close. --> + +<section class="intro"> + +</section> + +<!-- /.intro --> + +<!-- Package usage documentation. --> + +<section class="usage"> + +## Usage + +<!-- eslint-disable id-length --> + +```javascript +var isScaleRangeInterpolationMethod = require( '@stdlib/plot/vega/base/assert/is-scale-range-interpolation-method' ); +``` + +#### isScaleRangeInterpolationMethod( value ) + +Tests if an input value is a supported [scale range interpolation method][@stdlib/plot/vega/scale/base/range-interpolation-methods]. + +<!-- eslint-disable id-length --> + +```javascript +var bool = isScaleRangeInterpolationMethod( 'rgb' ); +// returns true + +bool = isScaleRangeInterpolationMethod( 'foo' ); +// returns false +``` + +</section> + +<!-- /.usage --> + +<!-- Package usage notes. Make sure to keep an empty line after the `section` element and another before the `/section` close. --> + +<section class="notes"> + +</section> + +<!-- /.notes --> + +<!-- Package usage examples. --> + +<section class="examples"> + +## Examples + +<!-- eslint-disable id-length --> + +<!-- eslint no-undef: "error" --> + +```javascript +var isScaleRangeInterpolationMethod = require( '@stdlib/plot/vega/base/assert/is-scale-range-interpolation-method' ); + +var bool = isScaleRangeInterpolationMethod( 'rgb' ); +// returns true + +bool = isScaleRangeInterpolationMethod( 'hsl' ); +// returns true + +bool = isScaleRangeInterpolationMethod( '' ); +// returns false + +bool = isScaleRangeInterpolationMethod( 'foo' ); +// returns false +``` + +</section> + +<!-- /.examples --> + +<!-- Section to include cited references. If references are included, add a horizontal rule *before* the section. Make sure to keep an empty line after the `section` element and another before the `/section` close. --> + +<section class="references"> + +</section> + +<!-- /.references --> + +<!-- Section for related `stdlib` packages. Do not manually edit this section, as it is automatically populated. --> + +<section class="related"> + +</section> + +<!-- /.related --> + +<!-- Section for all links. Make sure to keep an empty line after the `section` element and another before the `/section` close. --> + +<section class="links"> + +[@stdlib/plot/vega/scale/base/range-interpolation-methods]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/plot/vega/scale/base/range-interpolation-methods + +</section> + +<!-- /.links --> diff --git a/lib/node_modules/@stdlib/plot/vega/base/assert/is-scale-range-interpolation-method/benchmark/benchmark.js b/lib/node_modules/@stdlib/plot/vega/base/assert/is-scale-range-interpolation-method/benchmark/benchmark.js new file mode 100644 index 000000000000..33fce3076f17 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/assert/is-scale-range-interpolation-method/benchmark/benchmark.js @@ -0,0 +1,61 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var bench = require( '@stdlib/bench' ); +var isBoolean = require( '@stdlib/assert/is-boolean' ).isPrimitive; +var pkg = require( './../package.json' ).name; +var isScaleRangeInterpolationMethod = require( './../lib' ); // eslint-disable-line id-length + + +// MAIN // + +bench( pkg, function benchmark( b ) { + var values; + var out; + var v; + var i; + + values = [ + 'hsl', + 'rgb', + 'foo', + 'bar', + '', + 'beep', + 'boop' + ]; + + b.tic(); + for ( i = 0; i < b.iterations; i++ ) { + v = values[ i%values.length ]; + out = isScaleRangeInterpolationMethod( v ); + if ( typeof out !== 'boolean' ) { + b.fail( 'should return a boolean' ); + } + } + b.toc(); + if ( !isBoolean( out ) ) { + b.fail( 'should return a boolean' ); + } + b.pass( 'benchmark finished' ); + b.end(); +}); diff --git a/lib/node_modules/@stdlib/plot/vega/base/assert/is-scale-range-interpolation-method/docs/repl.txt b/lib/node_modules/@stdlib/plot/vega/base/assert/is-scale-range-interpolation-method/docs/repl.txt new file mode 100644 index 000000000000..a459e05ecaaf --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/assert/is-scale-range-interpolation-method/docs/repl.txt @@ -0,0 +1,29 @@ + +{{alias}}( value ) + Tests if an input value is a supported scale range interpolation method. + + Parameters + ---------- + value: any + Value to test. + + Returns + ------- + bool: boolean + Boolean indicating if an input value is a supported scale range + interpolation method. + + Examples + -------- + > var bool = {{alias}}( 'rgb' ) + true + > bool = {{alias}}( 'hsl' ) + true + > bool = {{alias}}( '' ) + false + > bool = {{alias}}( 'beep' ) + false + + See Also + -------- + diff --git a/lib/node_modules/@stdlib/plot/vega/base/assert/is-scale-range-interpolation-method/docs/types/index.d.ts b/lib/node_modules/@stdlib/plot/vega/base/assert/is-scale-range-interpolation-method/docs/types/index.d.ts new file mode 100644 index 000000000000..d1d1c80e7ff8 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/assert/is-scale-range-interpolation-method/docs/types/index.d.ts @@ -0,0 +1,42 @@ +/* +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +// TypeScript Version: 4.1 + +/** +* Tests whether an input value is a supported scale range interpolation method. +* +* @param v - value to test +* @returns boolean indicating whether an input value is a supported scale range interpolation method +* +* @example +* var bool = isScaleRangeInterpolationMethod( 'rgb' ); +* // returns true +* +* bool = isScaleRangeInterpolationMethod( 'hsl' ); +* // returns true +* +* bool = isScaleRangeInterpolationMethod( 'foo' ); +* // returns false +*/ +declare function isScaleRangeInterpolationMethod( v: any ): boolean; + + +// EXPORTS // + +export = isScaleRangeInterpolationMethod; diff --git a/lib/node_modules/@stdlib/plot/vega/base/assert/is-scale-range-interpolation-method/docs/types/test.ts b/lib/node_modules/@stdlib/plot/vega/base/assert/is-scale-range-interpolation-method/docs/types/test.ts new file mode 100644 index 000000000000..54f0880b9f18 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/assert/is-scale-range-interpolation-method/docs/types/test.ts @@ -0,0 +1,34 @@ +/* +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +import isScaleRangeInterpolationMethod = require( './index' ); + + +// TESTS // + +// The function returns a boolean... +{ + isScaleRangeInterpolationMethod( 'real' ); // $ExpectType boolean + isScaleRangeInterpolationMethod( 'foo' ); // $ExpectType boolean +} + +// The compiler throws an error if the function is provided an unsupported number of arguments... +{ + isScaleRangeInterpolationMethod(); // $ExpectError + isScaleRangeInterpolationMethod( undefined, 123 ); // $ExpectError +} diff --git a/lib/node_modules/@stdlib/plot/vega/base/assert/is-scale-range-interpolation-method/examples/index.js b/lib/node_modules/@stdlib/plot/vega/base/assert/is-scale-range-interpolation-method/examples/index.js new file mode 100644 index 000000000000..91de59f224ad --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/assert/is-scale-range-interpolation-method/examples/index.js @@ -0,0 +1,37 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +var isScaleRangeInterpolationMethod = require( './../lib' ); // eslint-disable-line id-length + +var bool = isScaleRangeInterpolationMethod( 'rgb' ); +console.log( bool ); +// => true + +bool = isScaleRangeInterpolationMethod( 'hsl' ); +console.log( bool ); +// => true + +bool = isScaleRangeInterpolationMethod( '' ); +console.log( bool ); +// => false + +bool = isScaleRangeInterpolationMethod( 'foo' ); +console.log( bool ); +// => false diff --git a/lib/node_modules/@stdlib/plot/vega/base/assert/is-scale-range-interpolation-method/lib/index.js b/lib/node_modules/@stdlib/plot/vega/base/assert/is-scale-range-interpolation-method/lib/index.js new file mode 100644 index 000000000000..6b5ad63b8daf --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/assert/is-scale-range-interpolation-method/lib/index.js @@ -0,0 +1,46 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +/** +* Test whether an input value is a supported scale range interpolation method. +* +* @module @stdlib/plot/vega/base/assert/is-scale-range-interpolation-method +* +* @example +* var isScaleRangeInterpolationMethod = require( '@stdlib/plot/vega/base/assert/is-scale-range-interpolation-method' ); +* +* var bool = isScaleRangeInterpolationMethod( 'rgb' ); +* // returns true +* +* bool = isScaleRangeInterpolationMethod( 'hsl' ); +* // returns true +* +* bool = isScaleRangeInterpolationMethod( 'foo' ); +* // returns false +*/ + +// MODULES // + +var main = require( './main.js' ); + + +// EXPORTS // + +module.exports = main; diff --git a/lib/node_modules/@stdlib/plot/vega/base/assert/is-scale-range-interpolation-method/lib/main.js b/lib/node_modules/@stdlib/plot/vega/base/assert/is-scale-range-interpolation-method/lib/main.js new file mode 100644 index 000000000000..d3c577d1a15b --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/assert/is-scale-range-interpolation-method/lib/main.js @@ -0,0 +1,52 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var contains = require( '@stdlib/array/base/assert/contains' ).factory; +var values = require( '@stdlib/plot/vega/scale/base/range-interpolation-methods' ); + + +// MAIN // + +/** +* Tests whether an input value is a supported scale range interpolation method. +* +* @name isScaleRangeInterpolationMethod +* @type {Function} +* @param {*} v - value to test +* @returns {boolean} boolean indicating whether an input value is a supported scale range interpolation method +* +* @example +* var bool = isScaleRangeInterpolationMethod( 'rgb' ); +* // returns true +* +* bool = isScaleRangeInterpolationMethod( 'hsl' ); +* // returns true +* +* bool = isScaleRangeInterpolationMethod( 'foo' ); +* // returns false +*/ +var isScaleRangeInterpolationMethod = contains( values() ); // eslint-disable-line id-length + + +// EXPORTS // + +module.exports = isScaleRangeInterpolationMethod; diff --git a/lib/node_modules/@stdlib/plot/vega/base/assert/is-scale-range-interpolation-method/package.json b/lib/node_modules/@stdlib/plot/vega/base/assert/is-scale-range-interpolation-method/package.json new file mode 100644 index 000000000000..2bea23c4df8e --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/assert/is-scale-range-interpolation-method/package.json @@ -0,0 +1,70 @@ +{ + "name": "@stdlib/plot/vega/base/assert/is-scale-range-interpolation-method", + "version": "0.0.0", + "description": "Test if an input value is a supported scale range interpolation method.", + "license": "Apache-2.0", + "author": { + "name": "The Stdlib Authors", + "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" + }, + "contributors": [ + { + "name": "The Stdlib Authors", + "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" + } + ], + "main": "./lib", + "directories": { + "benchmark": "./benchmark", + "doc": "./docs", + "example": "./examples", + "lib": "./lib", + "test": "./test" + }, + "types": "./docs/types", + "scripts": {}, + "homepage": "https://github.com/stdlib-js/stdlib", + "repository": { + "type": "git", + "url": "git://github.com/stdlib-js/stdlib.git" + }, + "bugs": { + "url": "https://github.com/stdlib-js/stdlib/issues" + }, + "dependencies": {}, + "devDependencies": {}, + "engines": { + "node": ">=0.10.0", + "npm": ">2.7.0" + }, + "os": [ + "aix", + "darwin", + "freebsd", + "linux", + "macos", + "openbsd", + "sunos", + "win32", + "windows" + ], + "keywords": [ + "stdlib", + "plot", + "base", + "vega", + "utilities", + "utility", + "utils", + "util", + "assert", + "test", + "check", + "is", + "valid", + "validate", + "validation", + "isvalid" + ], + "__stdlib__": {} +} diff --git a/lib/node_modules/@stdlib/plot/vega/base/assert/is-scale-range-interpolation-method/test/test.js b/lib/node_modules/@stdlib/plot/vega/base/assert/is-scale-range-interpolation-method/test/test.js new file mode 100644 index 000000000000..bb58c9135bc3 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/assert/is-scale-range-interpolation-method/test/test.js @@ -0,0 +1,78 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var tape = require( 'tape' ); +var isScaleRangeInterpolationMethod = require( './../lib' ); // eslint-disable-line id-length + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof isScaleRangeInterpolationMethod, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'the function returns `true` if provided a supported scale range interpolation method', function test( t ) { + var values; + var bool; + var i; + + values = [ + 'rgb', + 'hsl', + 'hsl-long' + ]; + for ( i = 0; i < values.length; i++ ) { + bool = isScaleRangeInterpolationMethod( values[ i ] ); + t.strictEqual( bool, true, 'returns expected value when provided '+values[ i ] ); + } + t.end(); +}); + +tape( 'the function returns `false` if not provided a supported scale range interpolation method', function test( t ) { + var values; + var bool; + var i; + + values = [ + '', + 'beep', + 'boop', + 'foo', + 'bar', + 5, + NaN, + true, + false, + null, + void 0, + [], + {}, + function noop() {} + ]; + for ( i = 0; i < values.length; i++ ) { + bool = isScaleRangeInterpolationMethod( values[ i ] ); + t.strictEqual( bool, false, 'returns expected value when provided '+values[ i ] ); + } + t.end(); +}); diff --git a/lib/node_modules/@stdlib/plot/vega/base/assert/is-scale/README.md b/lib/node_modules/@stdlib/plot/vega/base/assert/is-scale/README.md new file mode 100644 index 000000000000..cbb750ac1422 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/assert/is-scale/README.md @@ -0,0 +1,125 @@ +<!-- + +@license Apache-2.0 + +Copyright (c) 2025 The Stdlib Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + +--> + +# isScale + +> Test if an input value is a [scale][@stdlib/plot/vega/scale/base/ctor]. + +<!-- Section to include introductory text. Make sure to keep an empty line after the intro `section` element and another before the `/section` close. --> + +<section class="intro"> + +</section> + +<!-- /.intro --> + +<!-- Package usage documentation. --> + +<section class="usage"> + +## Usage + +```javascript +var isScale = require( '@stdlib/plot/vega/base/assert/is-scale' ); +``` + +#### isScale( value ) + +Tests if an input value is a [scale][@stdlib/plot/vega/scale/base/ctor]. + +```javascript +var Scale = require( '@stdlib/plot/vega/scale/base/ctor' ); + +var v = new Scale({ + 'name': 'xScale' +}); +var bool = isScale( v ); +// returns true + +bool = isScale( {} ); +// returns false +``` + +</section> + +<!-- /.usage --> + +<!-- Package usage notes. Make sure to keep an empty line after the `section` element and another before the `/section` close. --> + +<section class="notes"> + +</section> + +<!-- /.notes --> + +<!-- Package usage examples. --> + +<section class="examples"> + +## Examples + +<!-- eslint no-undef: "error" --> + +```javascript +var Scale = require( '@stdlib/plot/vega/scale/base/ctor' ); +var isScale = require( '@stdlib/plot/vega/base/assert/is-scale' ); + +var v = new Scale({ + 'name': 'xScale' +}); +var bool = isScale( v ); +// returns true + +bool = isScale( {} ); +// returns false + +bool = isScale( 'foo' ); +// returns false +``` + +</section> + +<!-- /.examples --> + +<!-- Section to include cited references. If references are included, add a horizontal rule *before* the section. Make sure to keep an empty line after the `section` element and another before the `/section` close. --> + +<section class="references"> + +</section> + +<!-- /.references --> + +<!-- Section for related `stdlib` packages. Do not manually edit this section, as it is automatically populated. --> + +<section class="related"> + +</section> + +<!-- /.related --> + +<!-- Section for all links. Make sure to keep an empty line after the `section` element and another before the `/section` close. --> + +<section class="links"> + +[@stdlib/plot/vega/scale/base/ctor]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/plot/vega/scale/base/ctor + +</section> + +<!-- /.links --> diff --git a/lib/node_modules/@stdlib/plot/vega/base/assert/is-scale/benchmark/benchmark.js b/lib/node_modules/@stdlib/plot/vega/base/assert/is-scale/benchmark/benchmark.js new file mode 100644 index 000000000000..93c12512c4dc --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/assert/is-scale/benchmark/benchmark.js @@ -0,0 +1,93 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var bench = require( '@stdlib/bench' ); +var isBoolean = require( '@stdlib/assert/is-boolean' ).isPrimitive; +var Scale = require( '@stdlib/plot/vega/scale/base/ctor' ); +var pkg = require( './../package.json' ).name; +var isScale = require( './../lib' ); + + +// MAIN // + +bench( pkg+'::true', function benchmark( b ) { + var values; + var out; + var v; + var i; + + values = [ + new Scale({ + 'name': 'xScale' + }), + new Scale({ + 'name': 'yScale' + }) + ]; + + b.tic(); + for ( i = 0; i < b.iterations; i++ ) { + v = values[ i%values.length ]; + out = isScale( v ); + if ( typeof out !== 'boolean' ) { + b.fail( 'should return a boolean' ); + } + } + b.toc(); + if ( !isBoolean( out ) ) { + b.fail( 'should return a boolean' ); + } + b.pass( 'benchmark finished' ); + b.end(); +}); + +bench( pkg+'::false', function benchmark( b ) { + var values; + var out; + var v; + var i; + + values = [ + 'foo', + 'bar', + '', + 'beep', + 'boop', + [], + {} + ]; + + b.tic(); + for ( i = 0; i < b.iterations; i++ ) { + v = values[ i%values.length ]; + out = isScale( v ); + if ( typeof out !== 'boolean' ) { + b.fail( 'should return a boolean' ); + } + } + b.toc(); + if ( !isBoolean( out ) ) { + b.fail( 'should return a boolean' ); + } + b.pass( 'benchmark finished' ); + b.end(); +}); diff --git a/lib/node_modules/@stdlib/plot/vega/base/assert/is-scale/docs/repl.txt b/lib/node_modules/@stdlib/plot/vega/base/assert/is-scale/docs/repl.txt new file mode 100644 index 000000000000..d9eb5aacb956 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/assert/is-scale/docs/repl.txt @@ -0,0 +1,26 @@ + +{{alias}}( value ) + Tests if an input value is a scale instance. + + Parameters + ---------- + value: any + Value to test. + + Returns + ------- + bool: boolean + Boolean indicating if an input value is a scale instance. + + Examples + -------- + > var opts = { 'name': 'xScale' }; + > var v = new {{alias:@stdlib/plot/vega/scale/base/ctor}}( opts ); + > var bool = {{alias}}( v ) + true + > bool = {{alias}}( {} ) + false + + See Also + -------- + diff --git a/lib/node_modules/@stdlib/plot/vega/base/assert/is-scale/docs/types/index.d.ts b/lib/node_modules/@stdlib/plot/vega/base/assert/is-scale/docs/types/index.d.ts new file mode 100644 index 000000000000..295558d97ba0 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/assert/is-scale/docs/types/index.d.ts @@ -0,0 +1,47 @@ +/* +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +// TypeScript Version: 4.1 + +/** +* Tests whether an input value is a scale instance. +* +* @param v - value to test +* @returns boolean indicating whether an input value is a scale instance +* +* @example +* var Scale = require( '@stdlib/plot/vega/scale/base/ctor' ); +* +* var v = new Scale({ +* 'name': 'xScale' +* }); +* var bool = isScale( v ); +* // returns true +* +* bool = isScale( {} ); +* // returns false +* +* bool = isScale( 'foo' ); +* // returns false +*/ +declare function isScale( v: any ): boolean; + + +// EXPORTS // + +export = isScale; diff --git a/lib/node_modules/@stdlib/plot/vega/base/assert/is-scale/docs/types/test.ts b/lib/node_modules/@stdlib/plot/vega/base/assert/is-scale/docs/types/test.ts new file mode 100644 index 000000000000..0caf748b22d9 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/assert/is-scale/docs/types/test.ts @@ -0,0 +1,34 @@ +/* +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +import isScale = require( './index' ); + + +// TESTS // + +// The function returns a boolean... +{ + isScale( {} ); // $ExpectType boolean + isScale( 'foo' ); // $ExpectType boolean +} + +// The compiler throws an error if the function is provided an unsupported number of arguments... +{ + isScale(); // $ExpectError + isScale( undefined, 123 ); // $ExpectError +} diff --git a/lib/node_modules/@stdlib/plot/vega/base/assert/is-scale/examples/index.js b/lib/node_modules/@stdlib/plot/vega/base/assert/is-scale/examples/index.js new file mode 100644 index 000000000000..03d66f4ed1eb --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/assert/is-scale/examples/index.js @@ -0,0 +1,37 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +var Scale = require( '@stdlib/plot/vega/scale/base/ctor' ); +var isScale = require( './../lib' ); + +var v = new Scale({ + 'name': 'xScale' +}); +var bool = isScale( v ); +console.log( bool ); +// => true + +bool = isScale( {} ); +console.log( bool ); +// => false + +bool = isScale( 'foo' ); +console.log( bool ); +// => false diff --git a/lib/node_modules/@stdlib/plot/vega/base/assert/is-scale/lib/index.js b/lib/node_modules/@stdlib/plot/vega/base/assert/is-scale/lib/index.js new file mode 100644 index 000000000000..e8ab289361ed --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/assert/is-scale/lib/index.js @@ -0,0 +1,50 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +/** +* Test whether an input value is a scale instance. +* +* @module @stdlib/plot/vega/base/assert/is-scale +* +* @example +* var Scale = require( '@stdlib/plot/vega/scale/base/ctor' ); +* var isScale = require( '@stdlib/plot/vega/base/assert/is-scale' ); +* +* var v = new Scale({ +* 'name': 'xScale' +* }); +* var bool = isScale( v ); +* // returns true +* +* bool = isScale( {} ); +* // returns false +* +* bool = isScale( 'foo' ); +* // returns false +*/ + +// MODULES // + +var main = require( './main.js' ); + + +// EXPORTS // + +module.exports = main; diff --git a/lib/node_modules/@stdlib/plot/vega/base/assert/is-scale/lib/main.js b/lib/node_modules/@stdlib/plot/vega/base/assert/is-scale/lib/main.js new file mode 100644 index 000000000000..400be21ab066 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/assert/is-scale/lib/main.js @@ -0,0 +1,70 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var isScaleName = require( '@stdlib/plot/vega/base/assert/is-scale-name' ); +var isObject = require( '@stdlib/assert/is-object' ); +var hasProp = require( '@stdlib/assert/has-property' ); +var Scale = require( '@stdlib/plot/vega/scale/base/ctor' ); + + +// MAIN // + +/** +* Tests whether an input value is a scale instance. +* +* @param {*} value - value to test +* @returns {boolean} boolean indicating whether an input value is a scale instance +* +* @example +* var Scale = require( '@stdlib/plot/vega/scale/base/ctor' ); +* +* var v = new Scale({ +* 'name': 'xScale' +* }); +* var bool = isScale( v ); +* // returns true +* +* bool = isScale( {} ); +* // returns false +* +* bool = isScale( 'foo' ); +* // returns false +*/ +function isScale( value ) { + return ( + value instanceof Scale || + + // The following is a set of rather imperfect heuristics for handling instances originating in a different realm... + ( + isObject( value ) && + isScaleName( value.type ) && + hasProp( value, 'name' ) && + hasProp( value, 'domain' ) && + hasProp( value, 'range' ) + ) + ); +} + + +// EXPORTS // + +module.exports = isScale; diff --git a/lib/node_modules/@stdlib/plot/vega/base/assert/is-scale/package.json b/lib/node_modules/@stdlib/plot/vega/base/assert/is-scale/package.json new file mode 100644 index 000000000000..7c61761cbc56 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/assert/is-scale/package.json @@ -0,0 +1,70 @@ +{ + "name": "@stdlib/plot/vega/base/assert/is-scale", + "version": "0.0.0", + "description": "Test if an input value is a scale instance.", + "license": "Apache-2.0", + "author": { + "name": "The Stdlib Authors", + "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" + }, + "contributors": [ + { + "name": "The Stdlib Authors", + "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" + } + ], + "main": "./lib", + "directories": { + "benchmark": "./benchmark", + "doc": "./docs", + "example": "./examples", + "lib": "./lib", + "test": "./test" + }, + "types": "./docs/types", + "scripts": {}, + "homepage": "https://github.com/stdlib-js/stdlib", + "repository": { + "type": "git", + "url": "git://github.com/stdlib-js/stdlib.git" + }, + "bugs": { + "url": "https://github.com/stdlib-js/stdlib/issues" + }, + "dependencies": {}, + "devDependencies": {}, + "engines": { + "node": ">=0.10.0", + "npm": ">2.7.0" + }, + "os": [ + "aix", + "darwin", + "freebsd", + "linux", + "macos", + "openbsd", + "sunos", + "win32", + "windows" + ], + "keywords": [ + "stdlib", + "plot", + "base", + "vega", + "utilities", + "utility", + "utils", + "util", + "assert", + "test", + "check", + "is", + "valid", + "validate", + "validation", + "isvalid" + ], + "__stdlib__": {} +} diff --git a/lib/node_modules/@stdlib/plot/vega/base/assert/is-scale/test/test.js b/lib/node_modules/@stdlib/plot/vega/base/assert/is-scale/test/test.js new file mode 100644 index 000000000000..875cdeab2adc --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/assert/is-scale/test/test.js @@ -0,0 +1,87 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var tape = require( 'tape' ); +var LinearScale = require( '@stdlib/plot/vega/scale/linear' ); +var QuantitativeScale = require( '@stdlib/plot/vega/scale/quantitative' ); +var Scale = require( '@stdlib/plot/vega/scale/base/ctor' ); +var isScale = require( './../lib' ); + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof isScale, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'the function returns `true` if provided a scale instance', function test( t ) { + var values; + var bool; + var i; + + values = [ + new Scale({ + 'name': 'xScale' + }), + new LinearScale({ + 'name': 'yScale' + }), + new QuantitativeScale({ + 'name': 'zScale' + }) + ]; + for ( i = 0; i < values.length; i++ ) { + bool = isScale( values[ i ] ); + t.strictEqual( bool, true, 'returns expected value when provided '+values[ i ] ); + } + t.end(); +}); + +tape( 'the function returns `false` if not provided a scale instance', function test( t ) { + var values; + var bool; + var i; + + values = [ + '', + 'beep', + 'boop', + 'foo', + 'bar', + 5, + NaN, + true, + false, + null, + void 0, + [], + {}, + function noop() {} + ]; + for ( i = 0; i < values.length; i++ ) { + bool = isScale( values[ i ] ); + t.strictEqual( bool, false, 'returns expected value when provided '+values[ i ] ); + } + t.end(); +}); diff --git a/lib/node_modules/@stdlib/plot/vega/base/assert/is-stroke-cap/README.md b/lib/node_modules/@stdlib/plot/vega/base/assert/is-stroke-cap/README.md new file mode 100644 index 000000000000..b564ab736ff4 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/assert/is-stroke-cap/README.md @@ -0,0 +1,119 @@ +<!-- + +@license Apache-2.0 + +Copyright (c) 2025 The Stdlib Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + +--> + +# isStrokeCap + +> Test if an input value is a supported [stroke cap][@stdlib/plot/vega/base/stroke-caps]. + +<!-- Section to include introductory text. Make sure to keep an empty line after the intro `section` element and another before the `/section` close. --> + +<section class="intro"> + +</section> + +<!-- /.intro --> + +<!-- Package usage documentation. --> + +<section class="usage"> + +## Usage + +```javascript +var isStrokeCap = require( '@stdlib/plot/vega/base/assert/is-stroke-cap' ); +``` + +#### isStrokeCap( value ) + +Tests if an input value is a supported [stroke cap][@stdlib/plot/vega/base/stroke-caps]. + +```javascript +var bool = isStrokeCap( 'round' ); +// returns true + +bool = isStrokeCap( 'foo' ); +// returns false +``` + +</section> + +<!-- /.usage --> + +<!-- Package usage notes. Make sure to keep an empty line after the `section` element and another before the `/section` close. --> + +<section class="notes"> + +</section> + +<!-- /.notes --> + +<!-- Package usage examples. --> + +<section class="examples"> + +## Examples + +<!-- eslint no-undef: "error" --> + +```javascript +var isStrokeCap = require( '@stdlib/plot/vega/base/assert/is-stroke-cap' ); + +var bool = isStrokeCap( 'round' ); +// returns true + +bool = isStrokeCap( 'square' ); +// returns true + +bool = isStrokeCap( '' ); +// returns false + +bool = isStrokeCap( 'foo' ); +// returns false +``` + +</section> + +<!-- /.examples --> + +<!-- Section to include cited references. If references are included, add a horizontal rule *before* the section. Make sure to keep an empty line after the `section` element and another before the `/section` close. --> + +<section class="references"> + +</section> + +<!-- /.references --> + +<!-- Section for related `stdlib` packages. Do not manually edit this section, as it is automatically populated. --> + +<section class="related"> + +</section> + +<!-- /.related --> + +<!-- Section for all links. Make sure to keep an empty line after the `section` element and another before the `/section` close. --> + +<section class="links"> + +[@stdlib/plot/vega/base/stroke-caps]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/plot/vega/base/stroke-caps + +</section> + +<!-- /.links --> diff --git a/lib/node_modules/@stdlib/plot/vega/base/assert/is-stroke-cap/benchmark/benchmark.js b/lib/node_modules/@stdlib/plot/vega/base/assert/is-stroke-cap/benchmark/benchmark.js new file mode 100644 index 000000000000..4924359baeb4 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/assert/is-stroke-cap/benchmark/benchmark.js @@ -0,0 +1,62 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var bench = require( '@stdlib/bench' ); +var isBoolean = require( '@stdlib/assert/is-boolean' ).isPrimitive; +var pkg = require( './../package.json' ).name; +var isStrokeCap = require( './../lib' ); + + +// MAIN // + +bench( pkg, function benchmark( b ) { + var values; + var out; + var v; + var i; + + values = [ + 'square', + 'round', + + 'foo', + 'bar', + '', + 'beep', + 'boop' + ]; + + b.tic(); + for ( i = 0; i < b.iterations; i++ ) { + v = values[ i%values.length ]; + out = isStrokeCap( v ); + if ( typeof out !== 'boolean' ) { + b.fail( 'should return a boolean' ); + } + } + b.toc(); + if ( !isBoolean( out ) ) { + b.fail( 'should return a boolean' ); + } + b.pass( 'benchmark finished' ); + b.end(); +}); diff --git a/lib/node_modules/@stdlib/plot/vega/base/assert/is-stroke-cap/docs/repl.txt b/lib/node_modules/@stdlib/plot/vega/base/assert/is-stroke-cap/docs/repl.txt new file mode 100644 index 000000000000..9ab3b7b49d85 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/assert/is-stroke-cap/docs/repl.txt @@ -0,0 +1,28 @@ + +{{alias}}( value ) + Tests if an input value is a supported stroke cap. + + Parameters + ---------- + value: any + Value to test. + + Returns + ------- + bool: boolean + Boolean indicating if an input value is a supported stroke cap. + + Examples + -------- + > var bool = {{alias}}( 'round' ) + true + > bool = {{alias}}( 'square' ) + true + > bool = {{alias}}( '' ) + false + > bool = {{alias}}( 'beep' ) + false + + See Also + -------- + diff --git a/lib/node_modules/@stdlib/plot/vega/base/assert/is-stroke-cap/docs/types/index.d.ts b/lib/node_modules/@stdlib/plot/vega/base/assert/is-stroke-cap/docs/types/index.d.ts new file mode 100644 index 000000000000..610473b3a2b6 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/assert/is-stroke-cap/docs/types/index.d.ts @@ -0,0 +1,45 @@ +/* +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +// TypeScript Version: 4.1 + +/** +* Tests whether an input value is a supported stroke cap. +* +* @param v - value to test +* @returns boolean indicating whether an input value is a supported stroke cap +* +* @example +* var bool = isStrokeCap( 'round' ); +* // returns true +* +* bool = isStrokeCap( 'square' ); +* // returns true +* +* bool = isStrokeCap( 'bar' ); +* // returns false +* +* bool = isStrokeCap( 'foo' ); +* // returns false +*/ +declare function isStrokeCap( v: any ): boolean; + + +// EXPORTS // + +export = isStrokeCap; diff --git a/lib/node_modules/@stdlib/plot/vega/base/assert/is-stroke-cap/docs/types/test.ts b/lib/node_modules/@stdlib/plot/vega/base/assert/is-stroke-cap/docs/types/test.ts new file mode 100644 index 000000000000..0b103412259e --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/assert/is-stroke-cap/docs/types/test.ts @@ -0,0 +1,34 @@ +/* +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +import isStrokeCap = require( './index' ); + + +// TESTS // + +// The function returns a boolean... +{ + isStrokeCap( 'square' ); // $ExpectType boolean + isStrokeCap( 'foo' ); // $ExpectType boolean +} + +// The compiler throws an error if the function is provided an unsupported number of arguments... +{ + isStrokeCap(); // $ExpectError + isStrokeCap( undefined, 123 ); // $ExpectError +} diff --git a/lib/node_modules/@stdlib/plot/vega/base/assert/is-stroke-cap/examples/index.js b/lib/node_modules/@stdlib/plot/vega/base/assert/is-stroke-cap/examples/index.js new file mode 100644 index 000000000000..e39bab6d1336 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/assert/is-stroke-cap/examples/index.js @@ -0,0 +1,37 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +var isStrokeCap = require( './../lib' ); + +var bool = isStrokeCap( 'round' ); +console.log( bool ); +// => true + +bool = isStrokeCap( 'square' ); +console.log( bool ); +// => true + +bool = isStrokeCap( '' ); +console.log( bool ); +// => false + +bool = isStrokeCap( 'foo' ); +console.log( bool ); +// => false diff --git a/lib/node_modules/@stdlib/plot/vega/base/assert/is-stroke-cap/lib/index.js b/lib/node_modules/@stdlib/plot/vega/base/assert/is-stroke-cap/lib/index.js new file mode 100644 index 000000000000..872ac6312ae8 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/assert/is-stroke-cap/lib/index.js @@ -0,0 +1,49 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +/** +* Test whether an input value is a supported stroke cap. +* +* @module @stdlib/plot/vega/base/assert/is-stroke-cap +* +* @example +* var isStrokeCap = require( '@stdlib/plot/vega/base/assert/is-stroke-cap' ); +* +* var bool = isStrokeCap( 'round' ); +* // returns true +* +* bool = isStrokeCap( 'square' ); +* // returns true +* +* bool = isStrokeCap( 'bar' ); +* // returns false +* +* bool = isStrokeCap( 'foo' ); +* // returns false +*/ + +// MODULES // + +var main = require( './main.js' ); + + +// EXPORTS // + +module.exports = main; diff --git a/lib/node_modules/@stdlib/plot/vega/base/assert/is-stroke-cap/lib/main.js b/lib/node_modules/@stdlib/plot/vega/base/assert/is-stroke-cap/lib/main.js new file mode 100644 index 000000000000..db720d060f7f --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/assert/is-stroke-cap/lib/main.js @@ -0,0 +1,55 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var contains = require( '@stdlib/array/base/assert/contains' ).factory; +var strokeCaps = require( '@stdlib/plot/vega/base/stroke-caps' ); + + +// MAIN // + +/** +* Tests whether an input value is a supported stroke cap. +* +* @name isStrokeCap +* @type {Function} +* @param {*} v - value to test +* @returns {boolean} boolean indicating whether an input value is a supported stroke cap +* +* @example +* var bool = isStrokeCap( 'round' ); +* // returns true +* +* bool = isStrokeCap( 'square' ); +* // returns true +* +* bool = isStrokeCap( 'bar' ); +* // returns false +* +* bool = isStrokeCap( 'foo' ); +* // returns false +*/ +var isStrokeCap = contains( strokeCaps() ); + + +// EXPORTS // + +module.exports = isStrokeCap; diff --git a/lib/node_modules/@stdlib/plot/vega/base/assert/is-stroke-cap/package.json b/lib/node_modules/@stdlib/plot/vega/base/assert/is-stroke-cap/package.json new file mode 100644 index 000000000000..76708cfde54e --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/assert/is-stroke-cap/package.json @@ -0,0 +1,70 @@ +{ + "name": "@stdlib/plot/vega/base/assert/is-stroke-cap", + "version": "0.0.0", + "description": "Test if an input value is a supported stroke cap.", + "license": "Apache-2.0", + "author": { + "name": "The Stdlib Authors", + "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" + }, + "contributors": [ + { + "name": "The Stdlib Authors", + "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" + } + ], + "main": "./lib", + "directories": { + "benchmark": "./benchmark", + "doc": "./docs", + "example": "./examples", + "lib": "./lib", + "test": "./test" + }, + "types": "./docs/types", + "scripts": {}, + "homepage": "https://github.com/stdlib-js/stdlib", + "repository": { + "type": "git", + "url": "git://github.com/stdlib-js/stdlib.git" + }, + "bugs": { + "url": "https://github.com/stdlib-js/stdlib/issues" + }, + "dependencies": {}, + "devDependencies": {}, + "engines": { + "node": ">=0.10.0", + "npm": ">2.7.0" + }, + "os": [ + "aix", + "darwin", + "freebsd", + "linux", + "macos", + "openbsd", + "sunos", + "win32", + "windows" + ], + "keywords": [ + "stdlib", + "plot", + "base", + "vega", + "utilities", + "utility", + "utils", + "util", + "assert", + "test", + "check", + "is", + "valid", + "validate", + "validation", + "isvalid" + ], + "__stdlib__": {} +} diff --git a/lib/node_modules/@stdlib/plot/vega/base/assert/is-stroke-cap/test/test.js b/lib/node_modules/@stdlib/plot/vega/base/assert/is-stroke-cap/test/test.js new file mode 100644 index 000000000000..fc476d90f88a --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/assert/is-stroke-cap/test/test.js @@ -0,0 +1,78 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var tape = require( 'tape' ); +var isStrokeCap = require( './../lib' ); + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof isStrokeCap, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'the function returns `true` if provided a supported stroke cap', function test( t ) { + var values; + var bool; + var i; + + values = [ + 'round', + 'square', + 'butt' + ]; + for ( i = 0; i < values.length; i++ ) { + bool = isStrokeCap( values[ i ] ); + t.strictEqual( bool, true, 'returns expected value when provided '+values[ i ] ); + } + t.end(); +}); + +tape( 'the function returns `false` if not provided a supported stroke cap', function test( t ) { + var values; + var bool; + var i; + + values = [ + '', + 'beep', + 'boop', + 'foo', + 'bar', + 5, + NaN, + true, + false, + null, + void 0, + [], + {}, + function noop() {} + ]; + for ( i = 0; i < values.length; i++ ) { + bool = isStrokeCap( values[ i ] ); + t.strictEqual( bool, false, 'returns expected value when provided '+values[ i ] ); + } + t.end(); +}); diff --git a/lib/node_modules/@stdlib/plot/vega/base/assert/is-title-orientation/README.md b/lib/node_modules/@stdlib/plot/vega/base/assert/is-title-orientation/README.md new file mode 100644 index 000000000000..09bc0f6c2b0d --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/assert/is-title-orientation/README.md @@ -0,0 +1,119 @@ +<!-- + +@license Apache-2.0 + +Copyright (c) 2025 The Stdlib Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + +--> + +# isTitleOrientation + +> Test if an input value is a supported [title orientation][@stdlib/plot/vega/title/orientations]. + +<!-- Section to include introductory text. Make sure to keep an empty line after the intro `section` element and another before the `/section` close. --> + +<section class="intro"> + +</section> + +<!-- /.intro --> + +<!-- Package usage documentation. --> + +<section class="usage"> + +## Usage + +```javascript +var isTitleOrientation = require( '@stdlib/plot/vega/base/assert/is-title-orientation' ); +``` + +#### isTitleOrientation( value ) + +Tests if an input value is a supported [title orientation][@stdlib/plot/vega/title/orientations]. + +```javascript +var bool = isTitleOrientation( 'bottom' ); +// returns true + +bool = isTitleOrientation( 'foo' ); +// returns false +``` + +</section> + +<!-- /.usage --> + +<!-- Package usage notes. Make sure to keep an empty line after the `section` element and another before the `/section` close. --> + +<section class="notes"> + +</section> + +<!-- /.notes --> + +<!-- Package usage examples. --> + +<section class="examples"> + +## Examples + +<!-- eslint no-undef: "error" --> + +```javascript +var isTitleOrientation = require( '@stdlib/plot/vega/base/assert/is-title-orientation' ); + +var bool = isTitleOrientation( 'bottom' ); +// returns true + +bool = isTitleOrientation( 'left' ); +// returns true + +bool = isTitleOrientation( '' ); +// returns false + +bool = isTitleOrientation( 'foo' ); +// returns false +``` + +</section> + +<!-- /.examples --> + +<!-- Section to include cited references. If references are included, add a horizontal rule *before* the section. Make sure to keep an empty line after the `section` element and another before the `/section` close. --> + +<section class="references"> + +</section> + +<!-- /.references --> + +<!-- Section for related `stdlib` packages. Do not manually edit this section, as it is automatically populated. --> + +<section class="related"> + +</section> + +<!-- /.related --> + +<!-- Section for all links. Make sure to keep an empty line after the `section` element and another before the `/section` close. --> + +<section class="links"> + +[@stdlib/plot/vega/title/orientations]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/plot/vega/title/orientations + +</section> + +<!-- /.links --> diff --git a/lib/node_modules/@stdlib/plot/vega/base/assert/is-title-orientation/benchmark/benchmark.js b/lib/node_modules/@stdlib/plot/vega/base/assert/is-title-orientation/benchmark/benchmark.js new file mode 100644 index 000000000000..0d9713bfcf58 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/assert/is-title-orientation/benchmark/benchmark.js @@ -0,0 +1,62 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var bench = require( '@stdlib/bench' ); +var isBoolean = require( '@stdlib/assert/is-boolean' ).isPrimitive; +var pkg = require( './../package.json' ).name; +var isTitleOrientation = require( './../lib' ); + + +// MAIN // + +bench( pkg, function benchmark( b ) { + var values; + var out; + var v; + var i; + + values = [ + 'left', + 'bottom', + + 'foo', + 'bar', + '', + 'beep', + 'boop' + ]; + + b.tic(); + for ( i = 0; i < b.iterations; i++ ) { + v = values[ i%values.length ]; + out = isTitleOrientation( v ); + if ( typeof out !== 'boolean' ) { + b.fail( 'should return a boolean' ); + } + } + b.toc(); + if ( !isBoolean( out ) ) { + b.fail( 'should return a boolean' ); + } + b.pass( 'benchmark finished' ); + b.end(); +}); diff --git a/lib/node_modules/@stdlib/plot/vega/base/assert/is-title-orientation/docs/repl.txt b/lib/node_modules/@stdlib/plot/vega/base/assert/is-title-orientation/docs/repl.txt new file mode 100644 index 000000000000..4d3c8ba6cd3d --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/assert/is-title-orientation/docs/repl.txt @@ -0,0 +1,28 @@ + +{{alias}}( value ) + Tests if an input value is a supported title orientation. + + Parameters + ---------- + value: any + Value to test. + + Returns + ------- + bool: boolean + Boolean indicating if an input value is a supported title orientation. + + Examples + -------- + > var bool = {{alias}}( 'bottom' ) + true + > bool = {{alias}}( 'left' ) + true + > bool = {{alias}}( '' ) + false + > bool = {{alias}}( 'beep' ) + false + + See Also + -------- + diff --git a/lib/node_modules/@stdlib/plot/vega/base/assert/is-title-orientation/docs/types/index.d.ts b/lib/node_modules/@stdlib/plot/vega/base/assert/is-title-orientation/docs/types/index.d.ts new file mode 100644 index 000000000000..47b83de10a2d --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/assert/is-title-orientation/docs/types/index.d.ts @@ -0,0 +1,45 @@ +/* +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +// TypeScript Version: 4.1 + +/** +* Tests whether an input value is a supported title orientation. +* +* @param v - value to test +* @returns boolean indicating whether an input value is a supported title orientation +* +* @example +* var bool = isTitleOrientation( 'bottom' ); +* // returns true +* +* bool = isTitleOrientation( 'left' ); +* // returns true +* +* bool = isTitleOrientation( 'bar' ); +* // returns false +* +* bool = isTitleOrientation( 'foo' ); +* // returns false +*/ +declare function isTitleOrientation( v: any ): boolean; + + +// EXPORTS // + +export = isTitleOrientation; diff --git a/lib/node_modules/@stdlib/plot/vega/base/assert/is-title-orientation/docs/types/test.ts b/lib/node_modules/@stdlib/plot/vega/base/assert/is-title-orientation/docs/types/test.ts new file mode 100644 index 000000000000..190c0a535adf --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/assert/is-title-orientation/docs/types/test.ts @@ -0,0 +1,34 @@ +/* +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +import isTitleOrientation = require( './index' ); + + +// TESTS // + +// The function returns a boolean... +{ + isTitleOrientation( 'left' ); // $ExpectType boolean + isTitleOrientation( 'foo' ); // $ExpectType boolean +} + +// The compiler throws an error if the function is provided an unsupported number of arguments... +{ + isTitleOrientation(); // $ExpectError + isTitleOrientation( undefined, 123 ); // $ExpectError +} diff --git a/lib/node_modules/@stdlib/plot/vega/base/assert/is-title-orientation/examples/index.js b/lib/node_modules/@stdlib/plot/vega/base/assert/is-title-orientation/examples/index.js new file mode 100644 index 000000000000..903444eaf5fc --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/assert/is-title-orientation/examples/index.js @@ -0,0 +1,37 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +var isTitleOrientation = require( './../lib' ); + +var bool = isTitleOrientation( 'bottom' ); +console.log( bool ); +// => true + +bool = isTitleOrientation( 'left' ); +console.log( bool ); +// => true + +bool = isTitleOrientation( '' ); +console.log( bool ); +// => false + +bool = isTitleOrientation( 'foo' ); +console.log( bool ); +// => false diff --git a/lib/node_modules/@stdlib/plot/vega/base/assert/is-title-orientation/lib/index.js b/lib/node_modules/@stdlib/plot/vega/base/assert/is-title-orientation/lib/index.js new file mode 100644 index 000000000000..361df8ba40c8 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/assert/is-title-orientation/lib/index.js @@ -0,0 +1,49 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +/** +* Test whether an input value is a supported title orientation. +* +* @module @stdlib/plot/vega/base/assert/is-title-orientation +* +* @example +* var isTitleOrientation = require( '@stdlib/plot/vega/base/assert/is-title-orientation' ); +* +* var bool = isTitleOrientation( 'bottom' ); +* // returns true +* +* bool = isTitleOrientation( 'left' ); +* // returns true +* +* bool = isTitleOrientation( 'bar' ); +* // returns false +* +* bool = isTitleOrientation( 'foo' ); +* // returns false +*/ + +// MODULES // + +var main = require( './main.js' ); + + +// EXPORTS // + +module.exports = main; diff --git a/lib/node_modules/@stdlib/plot/vega/base/assert/is-title-orientation/lib/main.js b/lib/node_modules/@stdlib/plot/vega/base/assert/is-title-orientation/lib/main.js new file mode 100644 index 000000000000..167e04995175 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/assert/is-title-orientation/lib/main.js @@ -0,0 +1,55 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var contains = require( '@stdlib/array/base/assert/contains' ).factory; +var titleOrientations = require( '@stdlib/plot/vega/title/orientations' ); + + +// MAIN // + +/** +* Tests whether an input value is a supported title orientation. +* +* @name isTitleOrientation +* @type {Function} +* @param {*} v - value to test +* @returns {boolean} boolean indicating whether an input value is a supported title orientation +* +* @example +* var bool = isTitleOrientation( 'bottom' ); +* // returns true +* +* bool = isTitleOrientation( 'left' ); +* // returns true +* +* bool = isTitleOrientation( 'bar' ); +* // returns false +* +* bool = isTitleOrientation( 'foo' ); +* // returns false +*/ +var isTitleOrientation = contains( titleOrientations() ); + + +// EXPORTS // + +module.exports = isTitleOrientation; diff --git a/lib/node_modules/@stdlib/plot/vega/base/assert/is-title-orientation/package.json b/lib/node_modules/@stdlib/plot/vega/base/assert/is-title-orientation/package.json new file mode 100644 index 000000000000..a4153c0bea9b --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/assert/is-title-orientation/package.json @@ -0,0 +1,70 @@ +{ + "name": "@stdlib/plot/vega/base/assert/is-title-orientation", + "version": "0.0.0", + "description": "Test if an input value is a supported title orientation.", + "license": "Apache-2.0", + "author": { + "name": "The Stdlib Authors", + "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" + }, + "contributors": [ + { + "name": "The Stdlib Authors", + "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" + } + ], + "main": "./lib", + "directories": { + "benchmark": "./benchmark", + "doc": "./docs", + "example": "./examples", + "lib": "./lib", + "test": "./test" + }, + "types": "./docs/types", + "scripts": {}, + "homepage": "https://github.com/stdlib-js/stdlib", + "repository": { + "type": "git", + "url": "git://github.com/stdlib-js/stdlib.git" + }, + "bugs": { + "url": "https://github.com/stdlib-js/stdlib/issues" + }, + "dependencies": {}, + "devDependencies": {}, + "engines": { + "node": ">=0.10.0", + "npm": ">2.7.0" + }, + "os": [ + "aix", + "darwin", + "freebsd", + "linux", + "macos", + "openbsd", + "sunos", + "win32", + "windows" + ], + "keywords": [ + "stdlib", + "plot", + "base", + "vega", + "utilities", + "utility", + "utils", + "util", + "assert", + "test", + "check", + "is", + "valid", + "validate", + "validation", + "isvalid" + ], + "__stdlib__": {} +} diff --git a/lib/node_modules/@stdlib/plot/vega/base/assert/is-title-orientation/test/test.js b/lib/node_modules/@stdlib/plot/vega/base/assert/is-title-orientation/test/test.js new file mode 100644 index 000000000000..342c68923dfd --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/assert/is-title-orientation/test/test.js @@ -0,0 +1,79 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var tape = require( 'tape' ); +var isTitleOrientation = require( './../lib' ); + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof isTitleOrientation, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'the function returns `true` if provided a supported title orientation', function test( t ) { + var values; + var bool; + var i; + + values = [ + 'bottom', + 'left', + 'top', + 'right' + ]; + for ( i = 0; i < values.length; i++ ) { + bool = isTitleOrientation( values[ i ] ); + t.strictEqual( bool, true, 'returns expected value when provided '+values[ i ] ); + } + t.end(); +}); + +tape( 'the function returns `false` if not provided a supported title orientation', function test( t ) { + var values; + var bool; + var i; + + values = [ + '', + 'beep', + 'boop', + 'foo', + 'bar', + 5, + NaN, + true, + false, + null, + void 0, + [], + {}, + function noop() {} + ]; + for ( i = 0; i < values.length; i++ ) { + bool = isTitleOrientation( values[ i ] ); + t.strictEqual( bool, false, 'returns expected value when provided '+values[ i ] ); + } + t.end(); +}); diff --git a/lib/node_modules/@stdlib/plot/vega/base/assert/is-title/README.md b/lib/node_modules/@stdlib/plot/vega/base/assert/is-title/README.md new file mode 100644 index 000000000000..deffa94d69d8 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/assert/is-title/README.md @@ -0,0 +1,125 @@ +<!-- + +@license Apache-2.0 + +Copyright (c) 2025 The Stdlib Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + +--> + +# isTitle + +> Test if an input value is a [title][@stdlib/plot/vega/title/ctor]. + +<!-- Section to include introductory text. Make sure to keep an empty line after the intro `section` element and another before the `/section` close. --> + +<section class="intro"> + +</section> + +<!-- /.intro --> + +<!-- Package usage documentation. --> + +<section class="usage"> + +## Usage + +```javascript +var isTitle = require( '@stdlib/plot/vega/base/assert/is-title' ); +``` + +#### isTitle( value ) + +Tests if an input value is a [title][@stdlib/plot/vega/title/ctor]. + +```javascript +var Title = require( '@stdlib/plot/vega/title/ctor' ); + +var v = new Title({ + 'text': 'Beep' +}); +var bool = isTitle( v ); +// returns true + +bool = isTitle( 'foo' ); +// returns false +``` + +</section> + +<!-- /.usage --> + +<!-- Package usage notes. Make sure to keep an empty line after the `section` element and another before the `/section` close. --> + +<section class="notes"> + +</section> + +<!-- /.notes --> + +<!-- Package usage examples. --> + +<section class="examples"> + +## Examples + +<!-- eslint no-undef: "error" --> + +```javascript +var Title = require( '@stdlib/plot/vega/title/ctor' ); +var isTitle = require( '@stdlib/plot/vega/base/assert/is-title' ); + +var v = new Title({ + 'text': 'foo' +}); +var bool = isTitle( v ); +// returns true + +bool = isTitle( {} ); +// returns false + +bool = isTitle( 'foo' ); +// returns false +``` + +</section> + +<!-- /.examples --> + +<!-- Section to include cited references. If references are included, add a horizontal rule *before* the section. Make sure to keep an empty line after the `section` element and another before the `/section` close. --> + +<section class="references"> + +</section> + +<!-- /.references --> + +<!-- Section for related `stdlib` packages. Do not manually edit this section, as it is automatically populated. --> + +<section class="related"> + +</section> + +<!-- /.related --> + +<!-- Section for all links. Make sure to keep an empty line after the `section` element and another before the `/section` close. --> + +<section class="links"> + +[@stdlib/plot/vega/title/ctor]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/plot/vega/title/ctor + +</section> + +<!-- /.links --> diff --git a/lib/node_modules/@stdlib/plot/vega/base/assert/is-title/benchmark/benchmark.js b/lib/node_modules/@stdlib/plot/vega/base/assert/is-title/benchmark/benchmark.js new file mode 100644 index 000000000000..5f592af98a4e --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/assert/is-title/benchmark/benchmark.js @@ -0,0 +1,93 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var bench = require( '@stdlib/bench' ); +var isBoolean = require( '@stdlib/assert/is-boolean' ).isPrimitive; +var Title = require( '@stdlib/plot/vega/title/ctor' ); +var pkg = require( './../package.json' ).name; +var isTitle = require( './../lib' ); + + +// MAIN // + +bench( pkg+'::true', function benchmark( b ) { + var values; + var out; + var v; + var i; + + values = [ + new Title({ + 'text': 'foo' + }), + new Title({ + 'text': 'bar' + }) + ]; + + b.tic(); + for ( i = 0; i < b.iterations; i++ ) { + v = values[ i%values.length ]; + out = isTitle( v ); + if ( typeof out !== 'boolean' ) { + b.fail( 'should return a boolean' ); + } + } + b.toc(); + if ( !isBoolean( out ) ) { + b.fail( 'should return a boolean' ); + } + b.pass( 'benchmark finished' ); + b.end(); +}); + +bench( pkg+'::false', function benchmark( b ) { + var values; + var out; + var v; + var i; + + values = [ + 'foo', + 'bar', + '', + 'beep', + 'boop', + [], + {} + ]; + + b.tic(); + for ( i = 0; i < b.iterations; i++ ) { + v = values[ i%values.length ]; + out = isTitle( v ); + if ( typeof out !== 'boolean' ) { + b.fail( 'should return a boolean' ); + } + } + b.toc(); + if ( !isBoolean( out ) ) { + b.fail( 'should return a boolean' ); + } + b.pass( 'benchmark finished' ); + b.end(); +}); diff --git a/lib/node_modules/@stdlib/plot/vega/base/assert/is-title/docs/repl.txt b/lib/node_modules/@stdlib/plot/vega/base/assert/is-title/docs/repl.txt new file mode 100644 index 000000000000..e87a93f1afe2 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/assert/is-title/docs/repl.txt @@ -0,0 +1,26 @@ + +{{alias}}( value ) + Tests if an input value is a title instance. + + Parameters + ---------- + value: any + Value to test. + + Returns + ------- + bool: boolean + Boolean indicating if an input value is a title instance. + + Examples + -------- + > var opts = { 'text': 'foo' }; + > var v = new {{alias:@stdlib/plot/vega/title/ctor}}( opts ); + > var bool = {{alias}}( v ) + true + > bool = {{alias}}( {} ) + false + + See Also + -------- + diff --git a/lib/node_modules/@stdlib/plot/vega/base/assert/is-title/docs/types/index.d.ts b/lib/node_modules/@stdlib/plot/vega/base/assert/is-title/docs/types/index.d.ts new file mode 100644 index 000000000000..4f7f25e3fa2e --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/assert/is-title/docs/types/index.d.ts @@ -0,0 +1,47 @@ +/* +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +// TypeScript Version: 4.1 + +/** +* Tests whether an input value is a title instance. +* +* @param v - value to test +* @returns boolean indicating whether an input value is a title instance +* +* @example +* var Title = require( '@stdlib/plot/vega/title/ctor' ); +* +* var v = new Title({ +* 'text': 'foo' +* }); +* var bool = isTitle( v ); +* // returns true +* +* bool = isTitle( {} ); +* // returns false +* +* bool = isTitle( 'foo' ); +* // returns false +*/ +declare function isTitle( v: any ): boolean; + + +// EXPORTS // + +export = isTitle; diff --git a/lib/node_modules/@stdlib/plot/vega/base/assert/is-title/docs/types/test.ts b/lib/node_modules/@stdlib/plot/vega/base/assert/is-title/docs/types/test.ts new file mode 100644 index 000000000000..0d1d5a9a4622 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/assert/is-title/docs/types/test.ts @@ -0,0 +1,34 @@ +/* +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +import isTitle = require( './index' ); + + +// TESTS // + +// The function returns a boolean... +{ + isTitle( {} ); // $ExpectType boolean + isTitle( 'foo' ); // $ExpectType boolean +} + +// The compiler throws an error if the function is provided an unsupported number of arguments... +{ + isTitle(); // $ExpectError + isTitle( undefined, 123 ); // $ExpectError +} diff --git a/lib/node_modules/@stdlib/plot/vega/base/assert/is-title/examples/index.js b/lib/node_modules/@stdlib/plot/vega/base/assert/is-title/examples/index.js new file mode 100644 index 000000000000..3f020bcea3d5 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/assert/is-title/examples/index.js @@ -0,0 +1,37 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +var Title = require( '@stdlib/plot/vega/title/ctor' ); +var isTitle = require( './../lib' ); + +var v = new Title({ + 'text': 'foo' +}); +var bool = isTitle( v ); +console.log( bool ); +// => true + +bool = isTitle( {} ); +console.log( bool ); +// => false + +bool = isTitle( 'foo' ); +console.log( bool ); +// => false diff --git a/lib/node_modules/@stdlib/plot/vega/base/assert/is-title/lib/index.js b/lib/node_modules/@stdlib/plot/vega/base/assert/is-title/lib/index.js new file mode 100644 index 000000000000..a89aa42140a2 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/assert/is-title/lib/index.js @@ -0,0 +1,50 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +/** +* Test whether an input value is a title instance. +* +* @module @stdlib/plot/vega/base/assert/is-title +* +* @example +* var Title = require( '@stdlib/plot/vega/title/ctor' ); +* var isTitle = require( '@stdlib/plot/vega/base/assert/is-title' ); +* +* var v = new Title({ +* 'text': 'foo' +* }); +* var bool = isTitle( v ); +* // returns true +* +* bool = isTitle( {} ); +* // returns false +* +* bool = isTitle( 'foo' ); +* // returns false +*/ + +// MODULES // + +var main = require( './main.js' ); + + +// EXPORTS // + +module.exports = main; diff --git a/lib/node_modules/@stdlib/plot/vega/base/assert/is-title/lib/main.js b/lib/node_modules/@stdlib/plot/vega/base/assert/is-title/lib/main.js new file mode 100644 index 000000000000..ef42a96defd6 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/assert/is-title/lib/main.js @@ -0,0 +1,69 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var isObject = require( '@stdlib/assert/is-object' ); +var isString = require( '@stdlib/assert/is-string' ).isPrimitive; +var hasProp = require( '@stdlib/assert/has-property' ); +var Title = require( '@stdlib/plot/vega/title/ctor' ); + + +// MAIN // + +/** +* Tests whether an input value is a title instance. +* +* @param {*} value - value to test +* @returns {boolean} boolean indicating whether an input value is a title instance +* +* @example +* var Title = require( '@stdlib/plot/vega/title/ctor' ); +* +* var v = new Title({ +* 'text': 'foo' +* }); +* var bool = isTitle( v ); +* // returns true +* +* bool = isTitle( {} ); +* // returns false +* +* bool = isTitle( 'foo' ); +* // returns false +*/ +function isTitle( value ) { + return ( + value instanceof Title || + + // The following is a set of rather imperfect heuristics for handling instances originating in a different realm... + ( + isObject( value ) && + isString( value.text ) && + hasProp( value, 'subtitle' ) && + hasProp( value, 'subtitlePadding' ) + ) + ); +} + + +// EXPORTS // + +module.exports = isTitle; diff --git a/lib/node_modules/@stdlib/plot/vega/base/assert/is-title/package.json b/lib/node_modules/@stdlib/plot/vega/base/assert/is-title/package.json new file mode 100644 index 000000000000..3c4ba074cd10 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/assert/is-title/package.json @@ -0,0 +1,70 @@ +{ + "name": "@stdlib/plot/vega/base/assert/is-title", + "version": "0.0.0", + "description": "Test if an input value is a title instance.", + "license": "Apache-2.0", + "author": { + "name": "The Stdlib Authors", + "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" + }, + "contributors": [ + { + "name": "The Stdlib Authors", + "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" + } + ], + "main": "./lib", + "directories": { + "benchmark": "./benchmark", + "doc": "./docs", + "example": "./examples", + "lib": "./lib", + "test": "./test" + }, + "types": "./docs/types", + "scripts": {}, + "homepage": "https://github.com/stdlib-js/stdlib", + "repository": { + "type": "git", + "url": "git://github.com/stdlib-js/stdlib.git" + }, + "bugs": { + "url": "https://github.com/stdlib-js/stdlib/issues" + }, + "dependencies": {}, + "devDependencies": {}, + "engines": { + "node": ">=0.10.0", + "npm": ">2.7.0" + }, + "os": [ + "aix", + "darwin", + "freebsd", + "linux", + "macos", + "openbsd", + "sunos", + "win32", + "windows" + ], + "keywords": [ + "stdlib", + "plot", + "base", + "vega", + "utilities", + "utility", + "utils", + "util", + "assert", + "test", + "check", + "is", + "valid", + "validate", + "validation", + "isvalid" + ], + "__stdlib__": {} +} diff --git a/lib/node_modules/@stdlib/plot/vega/base/assert/is-title/test/test.js b/lib/node_modules/@stdlib/plot/vega/base/assert/is-title/test/test.js new file mode 100644 index 000000000000..01617fda2d08 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/assert/is-title/test/test.js @@ -0,0 +1,82 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var tape = require( 'tape' ); +var Title = require( '@stdlib/plot/vega/title/ctor' ); +var isTitle = require( './../lib' ); + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof isTitle, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'the function returns `true` if provided a title instance', function test( t ) { + var values; + var bool; + var i; + + values = [ + new Title({ + 'text': 'foo' + }), + new Title({ + 'text': 'bar' + }) + ]; + for ( i = 0; i < values.length; i++ ) { + bool = isTitle( values[ i ] ); + t.strictEqual( bool, true, 'returns expected value when provided '+values[ i ] ); + } + t.end(); +}); + +tape( 'the function returns `false` if not provided a title instance', function test( t ) { + var values; + var bool; + var i; + + values = [ + '', + 'beep', + 'boop', + 'foo', + 'bar', + 5, + NaN, + true, + false, + null, + void 0, + [], + {}, + function noop() {} + ]; + for ( i = 0; i < values.length; i++ ) { + bool = isTitle( values[ i ] ); + t.strictEqual( bool, false, 'returns expected value when provided '+values[ i ] ); + } + t.end(); +}); diff --git a/lib/node_modules/@stdlib/plot/vega/base/assert/is-trigger-array/README.md b/lib/node_modules/@stdlib/plot/vega/base/assert/is-trigger-array/README.md new file mode 100644 index 000000000000..be676b984b7f --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/assert/is-trigger-array/README.md @@ -0,0 +1,129 @@ +<!-- + +@license Apache-2.0 + +Copyright (c) 2025 The Stdlib Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + +--> + +# isTriggerArray + +> Test if an input value is an array of [triggers][@stdlib/plot/vega/trigger/base/ctor]. + +<!-- Section to include introductory text. Make sure to keep an empty line after the intro `section` element and another before the `/section` close. --> + +<section class="intro"> + +</section> + +<!-- /.intro --> + +<!-- Package usage documentation. --> + +<section class="usage"> + +## Usage + +```javascript +var isTriggerArray = require( '@stdlib/plot/vega/base/assert/is-trigger-array' ); +``` + +#### isTriggerArray( value ) + +Tests if an input value is an array of [triggers][@stdlib/plot/vega/trigger/base/ctor]. + +```javascript +var Trigger = require( '@stdlib/plot/vega/trigger/base/ctor' ); + +var v = new Trigger({ + 'trigger': '!shift' +}); +var bool = isTriggerArray( [ v ] ); +// returns true +``` + +If provided an empty array, the function returns `false`. + +```javascript +var bool = isTriggerArray( [] ); +// returns false +``` + +</section> + +<!-- /.usage --> + +<!-- Package usage notes. Make sure to keep an empty line after the `section` element and another before the `/section` close. --> + +<section class="notes"> + +</section> + +<!-- /.notes --> + +<!-- Package usage examples. --> + +<section class="examples"> + +## Examples + +<!-- eslint no-undef: "error" --> + +```javascript +var Trigger = require( '@stdlib/plot/vega/trigger/base/ctor' ); +var isTriggerArray = require( '@stdlib/plot/vega/base/assert/is-trigger-array' ); + +var v = new Trigger({ + 'trigger': '!shift' +}); +var bool = isTriggerArray( [ v ] ); +// returns true + +bool = isTriggerArray( {} ); +// returns false + +bool = isTriggerArray( 'foo' ); +// returns false +``` + +</section> + +<!-- /.examples --> + +<!-- Section to include cited references. If references are included, add a horizontal rule *before* the section. Make sure to keep an empty line after the `section` element and another before the `/section` close. --> + +<section class="references"> + +</section> + +<!-- /.references --> + +<!-- Section for related `stdlib` packages. Do not manually edit this section, as it is automatically populated. --> + +<section class="related"> + +</section> + +<!-- /.related --> + +<!-- Section for all links. Make sure to keep an empty line after the `section` element and another before the `/section` close. --> + +<section class="links"> + +[@stdlib/plot/vega/trigger/base/ctor]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/plot/vega/trigger/base/ctor + +</section> + +<!-- /.links --> diff --git a/lib/node_modules/@stdlib/plot/vega/base/assert/is-trigger-array/benchmark/benchmark.js b/lib/node_modules/@stdlib/plot/vega/base/assert/is-trigger-array/benchmark/benchmark.js new file mode 100644 index 000000000000..75fdd92c66bb --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/assert/is-trigger-array/benchmark/benchmark.js @@ -0,0 +1,91 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var bench = require( '@stdlib/bench' ); +var isBoolean = require( '@stdlib/assert/is-boolean' ).isPrimitive; +var Trigger = require( '@stdlib/plot/vega/trigger/base/ctor' ); +var pkg = require( './../package.json' ).name; +var isTriggerArray = require( './../lib' ); + + +// MAIN // + +bench( pkg+'::true', function benchmark( b ) { + var values; + var out; + var i; + + values = [ + new Trigger({ + 'trigger': '!shift' + }), + new Trigger({ + 'trigger': '!shift' + }) + ]; + + b.tic(); + for ( i = 0; i < b.iterations; i++ ) { + out = isTriggerArray( [ values[ i%values.length ] ] ); + if ( typeof out !== 'boolean' ) { + b.fail( 'should return a boolean' ); + } + } + b.toc(); + if ( !isBoolean( out ) ) { + b.fail( 'should return a boolean' ); + } + b.pass( 'benchmark finished' ); + b.end(); +}); + +bench( pkg+'::false', function benchmark( b ) { + var values; + var out; + var v; + var i; + + values = [ + 'foo', + 'bar', + '', + 'beep', + 'boop', + [], + {} + ]; + + b.tic(); + for ( i = 0; i < b.iterations; i++ ) { + v = values[ i%values.length ]; + out = isTriggerArray( v ); + if ( typeof out !== 'boolean' ) { + b.fail( 'should return a boolean' ); + } + } + b.toc(); + if ( !isBoolean( out ) ) { + b.fail( 'should return a boolean' ); + } + b.pass( 'benchmark finished' ); + b.end(); +}); diff --git a/lib/node_modules/@stdlib/plot/vega/base/assert/is-trigger-array/docs/repl.txt b/lib/node_modules/@stdlib/plot/vega/base/assert/is-trigger-array/docs/repl.txt new file mode 100644 index 000000000000..476395e33bcc --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/assert/is-trigger-array/docs/repl.txt @@ -0,0 +1,26 @@ + +{{alias}}( value ) + Tests if an input value is an array of trigger instances. + + Parameters + ---------- + value: any + Value to test. + + Returns + ------- + bool: boolean + Boolean indicating if an input value is an array of trigger instances. + + Examples + -------- + > var opts = { 'trigger': '!shift' }; + > var v = new {{alias:@stdlib/plot/vega/trigger/base/ctor}}( opts ); + > var bool = {{alias}}( [ v ] ) + true + > bool = {{alias}}( {} ) + false + + See Also + -------- + diff --git a/lib/node_modules/@stdlib/plot/vega/base/assert/is-trigger-array/docs/types/index.d.ts b/lib/node_modules/@stdlib/plot/vega/base/assert/is-trigger-array/docs/types/index.d.ts new file mode 100644 index 000000000000..4794d8e00b0e --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/assert/is-trigger-array/docs/types/index.d.ts @@ -0,0 +1,47 @@ +/* +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +// TypeScript Version: 4.1 + +/** +* Tests whether an input value is an array of trigger instances. +* +* @param v - value to test +* @returns boolean indicating whether an input value is an array of trigger instances +* +* @example +* var Trigger = require( '@stdlib/plot/vega/trigger/base/ctor' ); +* +* var v = new Trigger({ +* 'trigger': '!shift' +* }); +* var bool = isTriggerArray( [ v ] ); +* // returns true +* +* bool = isTriggerArray( {} ); +* // returns false +* +* bool = isTriggerArray( 'foo' ); +* // returns false +*/ +declare function isTriggerArray( v: any ): boolean; + + +// EXPORTS // + +export = isTriggerArray; diff --git a/lib/node_modules/@stdlib/plot/vega/base/assert/is-trigger-array/docs/types/test.ts b/lib/node_modules/@stdlib/plot/vega/base/assert/is-trigger-array/docs/types/test.ts new file mode 100644 index 000000000000..abfa31b27ab6 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/assert/is-trigger-array/docs/types/test.ts @@ -0,0 +1,34 @@ +/* +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +import isTriggerArray = require( './index' ); + + +// TESTS // + +// The function returns a boolean... +{ + isTriggerArray( {} ); // $ExpectType boolean + isTriggerArray( 'foo' ); // $ExpectType boolean +} + +// The compiler throws an error if the function is provided an unsupported number of arguments... +{ + isTriggerArray(); // $ExpectError + isTriggerArray( undefined, 123 ); // $ExpectError +} diff --git a/lib/node_modules/@stdlib/plot/vega/base/assert/is-trigger-array/examples/index.js b/lib/node_modules/@stdlib/plot/vega/base/assert/is-trigger-array/examples/index.js new file mode 100644 index 000000000000..4a0c34e5e64a --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/assert/is-trigger-array/examples/index.js @@ -0,0 +1,37 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +var Trigger = require( '@stdlib/plot/vega/trigger/base/ctor' ); +var isTriggerArray = require( './../lib' ); + +var v = new Trigger({ + 'trigger': '!shift' +}); +var bool = isTriggerArray( [ v ] ); +console.log( bool ); +// => true + +bool = isTriggerArray( {} ); +console.log( bool ); +// => false + +bool = isTriggerArray( 'foo' ); +console.log( bool ); +// => false diff --git a/lib/node_modules/@stdlib/plot/vega/base/assert/is-trigger-array/lib/index.js b/lib/node_modules/@stdlib/plot/vega/base/assert/is-trigger-array/lib/index.js new file mode 100644 index 000000000000..4edb47df1186 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/assert/is-trigger-array/lib/index.js @@ -0,0 +1,50 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +/** +* Test whether an input value is an array of trigger instances. +* +* @module @stdlib/plot/vega/base/assert/is-trigger-array +* +* @example +* var Trigger = require( '@stdlib/plot/vega/trigger/base/ctor' ); +* var isTriggerArray = require( '@stdlib/plot/vega/base/assert/is-trigger-array' ); +* +* var v = new Trigger({ +* 'trigger': '!shift' +* }); +* var bool = isTriggerArray( [ v ] ); +* // returns true +* +* bool = isTriggerArray( {} ); +* // returns false +* +* bool = isTriggerArray( 'foo' ); +* // returns false +*/ + +// MODULES // + +var main = require( './main.js' ); + + +// EXPORTS // + +module.exports = main; diff --git a/lib/node_modules/@stdlib/plot/vega/base/assert/is-trigger-array/lib/main.js b/lib/node_modules/@stdlib/plot/vega/base/assert/is-trigger-array/lib/main.js new file mode 100644 index 000000000000..762d37013d80 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/assert/is-trigger-array/lib/main.js @@ -0,0 +1,57 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var arraylikefcn = require( '@stdlib/assert/tools/array-like-function' ); +var isTrigger = require( '@stdlib/plot/vega/base/assert/is-trigger' ); + + +// MAIN // + +/** +* Tests whether an input value is an array of trigger instances. +* +* @name isTriggerArray +* @type {Function} +* @param {*} value - value to test +* @returns {boolean} boolean indicating whether an input value is an array of trigger instances +* +* @example +* var Trigger = require( '@stdlib/plot/vega/trigger/base/ctor' ); +* +* var v = new Trigger({ +* 'trigger': '!shift' +* }); +* var bool = isTriggerArray( [ v ] ); +* // returns true +* +* bool = isTriggerArray( {} ); +* // returns false +* +* bool = isTriggerArray( 'foo' ); +* // returns false +*/ +var isTriggerArray = arraylikefcn( isTrigger ); + + +// EXPORTS // + +module.exports = isTriggerArray; diff --git a/lib/node_modules/@stdlib/plot/vega/base/assert/is-trigger-array/package.json b/lib/node_modules/@stdlib/plot/vega/base/assert/is-trigger-array/package.json new file mode 100644 index 000000000000..750eeef37577 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/assert/is-trigger-array/package.json @@ -0,0 +1,70 @@ +{ + "name": "@stdlib/plot/vega/base/assert/is-trigger-array", + "version": "0.0.0", + "description": "Test if an input value is an array of trigger instances.", + "license": "Apache-2.0", + "author": { + "name": "The Stdlib Authors", + "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" + }, + "contributors": [ + { + "name": "The Stdlib Authors", + "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" + } + ], + "main": "./lib", + "directories": { + "benchmark": "./benchmark", + "doc": "./docs", + "example": "./examples", + "lib": "./lib", + "test": "./test" + }, + "types": "./docs/types", + "scripts": {}, + "homepage": "https://github.com/stdlib-js/stdlib", + "repository": { + "type": "git", + "url": "git://github.com/stdlib-js/stdlib.git" + }, + "bugs": { + "url": "https://github.com/stdlib-js/stdlib/issues" + }, + "dependencies": {}, + "devDependencies": {}, + "engines": { + "node": ">=0.10.0", + "npm": ">2.7.0" + }, + "os": [ + "aix", + "darwin", + "freebsd", + "linux", + "macos", + "openbsd", + "sunos", + "win32", + "windows" + ], + "keywords": [ + "stdlib", + "plot", + "base", + "vega", + "utilities", + "utility", + "utils", + "util", + "assert", + "test", + "check", + "is", + "valid", + "validate", + "validation", + "isvalid" + ], + "__stdlib__": {} +} diff --git a/lib/node_modules/@stdlib/plot/vega/base/assert/is-trigger-array/test/test.js b/lib/node_modules/@stdlib/plot/vega/base/assert/is-trigger-array/test/test.js new file mode 100644 index 000000000000..06beb9250aa7 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/assert/is-trigger-array/test/test.js @@ -0,0 +1,77 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var tape = require( 'tape' ); +var Trigger = require( '@stdlib/plot/vega/trigger/base/ctor' ); +var isTriggerArray = require( './../lib' ); + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof isTriggerArray, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'the function returns `true` if provided an array of trigger instances', function test( t ) { + var values; + var actual; + + values = [ + new Trigger({ + 'trigger': '!shift' + }) + ]; + actual = isTriggerArray( values ); + t.strictEqual( actual, true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function returns `false` if not provided an array of trigger instances', function test( t ) { + var values; + var bool; + var i; + + values = [ + '', + 'beep', + 'boop', + 'foo', + 'bar', + 5, + NaN, + true, + false, + null, + void 0, + [], + {}, + function noop() {} + ]; + for ( i = 0; i < values.length; i++ ) { + bool = isTriggerArray( values[ i ] ); + t.strictEqual( bool, false, 'returns expected value when provided '+values[ i ] ); + } + t.end(); +}); diff --git a/lib/node_modules/@stdlib/plot/vega/base/assert/is-trigger/README.md b/lib/node_modules/@stdlib/plot/vega/base/assert/is-trigger/README.md new file mode 100644 index 000000000000..69d8a71d13a6 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/assert/is-trigger/README.md @@ -0,0 +1,125 @@ +<!-- + +@license Apache-2.0 + +Copyright (c) 2025 The Stdlib Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + +--> + +# isTrigger + +> Test if an input value is a [trigger][@stdlib/plot/vega/trigger/base/ctor]. + +<!-- Section to include introductory text. Make sure to keep an empty line after the intro `section` element and another before the `/section` close. --> + +<section class="intro"> + +</section> + +<!-- /.intro --> + +<!-- Package usage documentation. --> + +<section class="usage"> + +## Usage + +```javascript +var isTrigger = require( '@stdlib/plot/vega/base/assert/is-trigger' ); +``` + +#### isTrigger( value ) + +Tests if an input value is a [trigger][@stdlib/plot/vega/trigger/base/ctor]. + +```javascript +var Trigger = require( '@stdlib/plot/vega/trigger/base/ctor' ); + +var v = new Trigger({ + 'trigger': '!shift' +}); +var bool = isTrigger( v ); +// returns true + +bool = isTrigger( {} ); +// returns false +``` + +</section> + +<!-- /.usage --> + +<!-- Package usage notes. Make sure to keep an empty line after the `section` element and another before the `/section` close. --> + +<section class="notes"> + +</section> + +<!-- /.notes --> + +<!-- Package usage examples. --> + +<section class="examples"> + +## Examples + +<!-- eslint no-undef: "error" --> + +```javascript +var Trigger = require( '@stdlib/plot/vega/trigger/base/ctor' ); +var isTrigger = require( '@stdlib/plot/vega/base/assert/is-trigger' ); + +var v = new Trigger({ + 'trigger': '!shift' +}); +var bool = isTrigger( v ); +// returns true + +bool = isTrigger( {} ); +// returns false + +bool = isTrigger( 'foo' ); +// returns false +``` + +</section> + +<!-- /.examples --> + +<!-- Section to include cited references. If references are included, add a horizontal rule *before* the section. Make sure to keep an empty line after the `section` element and another before the `/section` close. --> + +<section class="references"> + +</section> + +<!-- /.references --> + +<!-- Section for related `stdlib` packages. Do not manually edit this section, as it is automatically populated. --> + +<section class="related"> + +</section> + +<!-- /.related --> + +<!-- Section for all links. Make sure to keep an empty line after the `section` element and another before the `/section` close. --> + +<section class="links"> + +[@stdlib/plot/vega/trigger/base/ctor]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/plot/vega/trigger/base/ctor + +</section> + +<!-- /.links --> diff --git a/lib/node_modules/@stdlib/plot/vega/base/assert/is-trigger/benchmark/benchmark.js b/lib/node_modules/@stdlib/plot/vega/base/assert/is-trigger/benchmark/benchmark.js new file mode 100644 index 000000000000..533480ac7bf0 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/assert/is-trigger/benchmark/benchmark.js @@ -0,0 +1,93 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var bench = require( '@stdlib/bench' ); +var isBoolean = require( '@stdlib/assert/is-boolean' ).isPrimitive; +var Trigger = require( '@stdlib/plot/vega/trigger/base/ctor' ); +var pkg = require( './../package.json' ).name; +var isTrigger = require( './../lib' ); + + +// MAIN // + +bench( pkg+'::true', function benchmark( b ) { + var values; + var out; + var v; + var i; + + values = [ + new Trigger({ + 'trigger': '!shift' + }), + new Trigger({ + 'trigger': '!shift' + }) + ]; + + b.tic(); + for ( i = 0; i < b.iterations; i++ ) { + v = values[ i%values.length ]; + out = isTrigger( v ); + if ( typeof out !== 'boolean' ) { + b.fail( 'should return a boolean' ); + } + } + b.toc(); + if ( !isBoolean( out ) ) { + b.fail( 'should return a boolean' ); + } + b.pass( 'benchmark finished' ); + b.end(); +}); + +bench( pkg+'::false', function benchmark( b ) { + var values; + var out; + var v; + var i; + + values = [ + 'foo', + 'bar', + '', + 'beep', + 'boop', + [], + {} + ]; + + b.tic(); + for ( i = 0; i < b.iterations; i++ ) { + v = values[ i%values.length ]; + out = isTrigger( v ); + if ( typeof out !== 'boolean' ) { + b.fail( 'should return a boolean' ); + } + } + b.toc(); + if ( !isBoolean( out ) ) { + b.fail( 'should return a boolean' ); + } + b.pass( 'benchmark finished' ); + b.end(); +}); diff --git a/lib/node_modules/@stdlib/plot/vega/base/assert/is-trigger/docs/repl.txt b/lib/node_modules/@stdlib/plot/vega/base/assert/is-trigger/docs/repl.txt new file mode 100644 index 000000000000..f9ebefe75f44 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/assert/is-trigger/docs/repl.txt @@ -0,0 +1,26 @@ + +{{alias}}( value ) + Tests if an input value is a trigger instance. + + Parameters + ---------- + value: any + Value to test. + + Returns + ------- + bool: boolean + Boolean indicating if an input value is a trigger instance. + + Examples + -------- + > var opts = { 'trigger': '!shift' }; + > var v = new {{alias:@stdlib/plot/vega/trigger/base/ctor}}( opts ); + > var bool = {{alias}}( v ) + true + > bool = {{alias}}( {} ) + false + + See Also + -------- + diff --git a/lib/node_modules/@stdlib/plot/vega/base/assert/is-trigger/docs/types/index.d.ts b/lib/node_modules/@stdlib/plot/vega/base/assert/is-trigger/docs/types/index.d.ts new file mode 100644 index 000000000000..8ca1aa1444fa --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/assert/is-trigger/docs/types/index.d.ts @@ -0,0 +1,47 @@ +/* +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +// TypeScript Version: 4.1 + +/** +* Tests whether an input value is a trigger instance. +* +* @param v - value to test +* @returns boolean indicating whether an input value is a trigger instance +* +* @example +* var Trigger = require( '@stdlib/plot/vega/trigger/base/ctor' ); +* +* var v = new Trigger({ +* 'trigger': '!shift' +* }); +* var bool = isTrigger( v ); +* // returns true +* +* bool = isTrigger( {} ); +* // returns false +* +* bool = isTrigger( 'foo' ); +* // returns false +*/ +declare function isTrigger( v: any ): boolean; + + +// EXPORTS // + +export = isTrigger; diff --git a/lib/node_modules/@stdlib/plot/vega/base/assert/is-trigger/docs/types/test.ts b/lib/node_modules/@stdlib/plot/vega/base/assert/is-trigger/docs/types/test.ts new file mode 100644 index 000000000000..772fadf448fb --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/assert/is-trigger/docs/types/test.ts @@ -0,0 +1,34 @@ +/* +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +import isTrigger = require( './index' ); + + +// TESTS // + +// The function returns a boolean... +{ + isTrigger( {} ); // $ExpectType boolean + isTrigger( 'foo' ); // $ExpectType boolean +} + +// The compiler throws an error if the function is provided an unsupported number of arguments... +{ + isTrigger(); // $ExpectError + isTrigger( undefined, 123 ); // $ExpectError +} diff --git a/lib/node_modules/@stdlib/plot/vega/base/assert/is-trigger/examples/index.js b/lib/node_modules/@stdlib/plot/vega/base/assert/is-trigger/examples/index.js new file mode 100644 index 000000000000..8a67d9853305 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/assert/is-trigger/examples/index.js @@ -0,0 +1,37 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +var Trigger = require( '@stdlib/plot/vega/trigger/base/ctor' ); +var isTrigger = require( './../lib' ); + +var v = new Trigger({ + 'trigger': '!shift' +}); +var bool = isTrigger( v ); +console.log( bool ); +// => true + +bool = isTrigger( {} ); +console.log( bool ); +// => false + +bool = isTrigger( 'foo' ); +console.log( bool ); +// => false diff --git a/lib/node_modules/@stdlib/plot/vega/base/assert/is-trigger/lib/index.js b/lib/node_modules/@stdlib/plot/vega/base/assert/is-trigger/lib/index.js new file mode 100644 index 000000000000..bdf3b72b691b --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/assert/is-trigger/lib/index.js @@ -0,0 +1,50 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +/** +* Test whether an input value is a trigger instance. +* +* @module @stdlib/plot/vega/base/assert/is-trigger +* +* @example +* var Trigger = require( '@stdlib/plot/vega/trigger/base/ctor' ); +* var isTrigger = require( '@stdlib/plot/vega/base/assert/is-trigger' ); +* +* var v = new Trigger({ +* 'trigger': '!shift' +* }); +* var bool = isTrigger( v ); +* // returns true +* +* bool = isTrigger( {} ); +* // returns false +* +* bool = isTrigger( 'foo' ); +* // returns false +*/ + +// MODULES // + +var main = require( './main.js' ); + + +// EXPORTS // + +module.exports = main; diff --git a/lib/node_modules/@stdlib/plot/vega/base/assert/is-trigger/lib/main.js b/lib/node_modules/@stdlib/plot/vega/base/assert/is-trigger/lib/main.js new file mode 100644 index 000000000000..736683400c1d --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/assert/is-trigger/lib/main.js @@ -0,0 +1,66 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var isString = require( '@stdlib/assert/is-string' ).isPrimitive; +var isObject = require( '@stdlib/assert/is-object' ); +var Trigger = require( '@stdlib/plot/vega/trigger/base/ctor' ); + + +// MAIN // + +/** +* Tests whether an input value is a trigger instance. +* +* @param {*} value - value to test +* @returns {boolean} boolean indicating whether an input value is a trigger instance +* +* @example +* var Trigger = require( '@stdlib/plot/vega/trigger/base/ctor' ); +* +* var v = new Trigger({ +* 'trigger': '!shift' +* }); +* var bool = isTrigger( v ); +* // returns true +* +* bool = isTrigger( {} ); +* // returns false +* +* bool = isTrigger( 'foo' ); +* // returns false +*/ +function isTrigger( value ) { + return ( + value instanceof Trigger || + + // The following is a set of rather imperfect heuristics for handling instances originating in a different realm... + ( + isObject( value ) && + isString( value.trigger ) + ) + ); +} + + +// EXPORTS // + +module.exports = isTrigger; diff --git a/lib/node_modules/@stdlib/plot/vega/base/assert/is-trigger/package.json b/lib/node_modules/@stdlib/plot/vega/base/assert/is-trigger/package.json new file mode 100644 index 000000000000..ef9bffb730d6 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/assert/is-trigger/package.json @@ -0,0 +1,70 @@ +{ + "name": "@stdlib/plot/vega/base/assert/is-trigger", + "version": "0.0.0", + "description": "Test if an input value is a trigger instance.", + "license": "Apache-2.0", + "author": { + "name": "The Stdlib Authors", + "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" + }, + "contributors": [ + { + "name": "The Stdlib Authors", + "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" + } + ], + "main": "./lib", + "directories": { + "benchmark": "./benchmark", + "doc": "./docs", + "example": "./examples", + "lib": "./lib", + "test": "./test" + }, + "types": "./docs/types", + "scripts": {}, + "homepage": "https://github.com/stdlib-js/stdlib", + "repository": { + "type": "git", + "url": "git://github.com/stdlib-js/stdlib.git" + }, + "bugs": { + "url": "https://github.com/stdlib-js/stdlib/issues" + }, + "dependencies": {}, + "devDependencies": {}, + "engines": { + "node": ">=0.10.0", + "npm": ">2.7.0" + }, + "os": [ + "aix", + "darwin", + "freebsd", + "linux", + "macos", + "openbsd", + "sunos", + "win32", + "windows" + ], + "keywords": [ + "stdlib", + "plot", + "base", + "vega", + "utilities", + "utility", + "utils", + "util", + "assert", + "test", + "check", + "is", + "valid", + "validate", + "validation", + "isvalid" + ], + "__stdlib__": {} +} diff --git a/lib/node_modules/@stdlib/plot/vega/base/assert/is-trigger/test/test.js b/lib/node_modules/@stdlib/plot/vega/base/assert/is-trigger/test/test.js new file mode 100644 index 000000000000..fecd5fc41876 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/assert/is-trigger/test/test.js @@ -0,0 +1,79 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var tape = require( 'tape' ); +var Trigger = require( '@stdlib/plot/vega/trigger/base/ctor' ); +var isTrigger = require( './../lib' ); + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof isTrigger, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'the function returns `true` if provided a trigger instance', function test( t ) { + var values; + var bool; + var i; + + values = [ + new Trigger({ + 'trigger': '!shift' + }) + ]; + for ( i = 0; i < values.length; i++ ) { + bool = isTrigger( values[ i ] ); + t.strictEqual( bool, true, 'returns expected value when provided '+values[ i ] ); + } + t.end(); +}); + +tape( 'the function returns `false` if not provided a trigger instance', function test( t ) { + var values; + var bool; + var i; + + values = [ + '', + 'beep', + 'boop', + 'foo', + 'bar', + 5, + NaN, + true, + false, + null, + void 0, + [], + {}, + function noop() {} + ]; + for ( i = 0; i < values.length; i++ ) { + bool = isTrigger( values[ i ] ); + t.strictEqual( bool, false, 'returns expected value when provided '+values[ i ] ); + } + t.end(); +}); diff --git a/lib/node_modules/@stdlib/plot/vega/base/assert/is-vertical-baseline/README.md b/lib/node_modules/@stdlib/plot/vega/base/assert/is-vertical-baseline/README.md new file mode 100644 index 000000000000..25613e67251e --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/assert/is-vertical-baseline/README.md @@ -0,0 +1,119 @@ +<!-- + +@license Apache-2.0 + +Copyright (c) 2025 The Stdlib Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + +--> + +# isVerticalBaseline + +> Test if an input value is a supported [vertical baseline][@stdlib/plot/vega/base/vertical-baselines]. + +<!-- Section to include introductory text. Make sure to keep an empty line after the intro `section` element and another before the `/section` close. --> + +<section class="intro"> + +</section> + +<!-- /.intro --> + +<!-- Package usage documentation. --> + +<section class="usage"> + +## Usage + +```javascript +var isVerticalBaseline = require( '@stdlib/plot/vega/base/assert/is-vertical-baseline' ); +``` + +#### isVerticalBaseline( value ) + +Tests if an input value is a supported [vertical baseline][@stdlib/plot/vega/base/vertical-baselines]. + +```javascript +var bool = isVerticalBaseline( 'bottom' ); +// returns true + +bool = isVerticalBaseline( 'foo' ); +// returns false +``` + +</section> + +<!-- /.usage --> + +<!-- Package usage notes. Make sure to keep an empty line after the `section` element and another before the `/section` close. --> + +<section class="notes"> + +</section> + +<!-- /.notes --> + +<!-- Package usage examples. --> + +<section class="examples"> + +## Examples + +<!-- eslint no-undef: "error" --> + +```javascript +var isVerticalBaseline = require( '@stdlib/plot/vega/base/assert/is-vertical-baseline' ); + +var bool = isVerticalBaseline( 'bottom' ); +// returns true + +bool = isVerticalBaseline( 'middle' ); +// returns true + +bool = isVerticalBaseline( '' ); +// returns false + +bool = isVerticalBaseline( 'foo' ); +// returns false +``` + +</section> + +<!-- /.examples --> + +<!-- Section to include cited references. If references are included, add a horizontal rule *before* the section. Make sure to keep an empty line after the `section` element and another before the `/section` close. --> + +<section class="references"> + +</section> + +<!-- /.references --> + +<!-- Section for related `stdlib` packages. Do not manually edit this section, as it is automatically populated. --> + +<section class="related"> + +</section> + +<!-- /.related --> + +<!-- Section for all links. Make sure to keep an empty line after the `section` element and another before the `/section` close. --> + +<section class="links"> + +[@stdlib/plot/vega/base/vertical-baselines]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/plot/vega/base/vertical-baselines + +</section> + +<!-- /.links --> diff --git a/lib/node_modules/@stdlib/plot/vega/base/assert/is-vertical-baseline/benchmark/benchmark.js b/lib/node_modules/@stdlib/plot/vega/base/assert/is-vertical-baseline/benchmark/benchmark.js new file mode 100644 index 000000000000..d3d37908a7d5 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/assert/is-vertical-baseline/benchmark/benchmark.js @@ -0,0 +1,62 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var bench = require( '@stdlib/bench' ); +var isBoolean = require( '@stdlib/assert/is-boolean' ).isPrimitive; +var pkg = require( './../package.json' ).name; +var isVerticalBaseline = require( './../lib' ); + + +// MAIN // + +bench( pkg, function benchmark( b ) { + var values; + var out; + var v; + var i; + + values = [ + 'middle', + 'bottom', + + 'foo', + 'bar', + '', + 'beep', + 'boop' + ]; + + b.tic(); + for ( i = 0; i < b.iterations; i++ ) { + v = values[ i%values.length ]; + out = isVerticalBaseline( v ); + if ( typeof out !== 'boolean' ) { + b.fail( 'should return a boolean' ); + } + } + b.toc(); + if ( !isBoolean( out ) ) { + b.fail( 'should return a boolean' ); + } + b.pass( 'benchmark finished' ); + b.end(); +}); diff --git a/lib/node_modules/@stdlib/plot/vega/base/assert/is-vertical-baseline/docs/repl.txt b/lib/node_modules/@stdlib/plot/vega/base/assert/is-vertical-baseline/docs/repl.txt new file mode 100644 index 000000000000..5e9be2acc4c9 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/assert/is-vertical-baseline/docs/repl.txt @@ -0,0 +1,28 @@ + +{{alias}}( value ) + Tests if an input value is a supported vertical baseline. + + Parameters + ---------- + value: any + Value to test. + + Returns + ------- + bool: boolean + Boolean indicating if an input value is a supported vertical baseline. + + Examples + -------- + > var bool = {{alias}}( 'bottom' ) + true + > bool = {{alias}}( 'middle' ) + true + > bool = {{alias}}( '' ) + false + > bool = {{alias}}( 'beep' ) + false + + See Also + -------- + diff --git a/lib/node_modules/@stdlib/plot/vega/base/assert/is-vertical-baseline/docs/types/index.d.ts b/lib/node_modules/@stdlib/plot/vega/base/assert/is-vertical-baseline/docs/types/index.d.ts new file mode 100644 index 000000000000..fe63004d9856 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/assert/is-vertical-baseline/docs/types/index.d.ts @@ -0,0 +1,45 @@ +/* +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +// TypeScript Version: 4.1 + +/** +* Tests whether an input value is a supported vertical baseline. +* +* @param v - value to test +* @returns boolean indicating whether an input value is a supported vertical baseline +* +* @example +* var bool = isVerticalBaseline( 'bottom' ); +* // returns true +* +* bool = isVerticalBaseline( 'middle' ); +* // returns true +* +* bool = isVerticalBaseline( 'bar' ); +* // returns false +* +* bool = isVerticalBaseline( 'foo' ); +* // returns false +*/ +declare function isVerticalBaseline( v: any ): boolean; + + +// EXPORTS // + +export = isVerticalBaseline; diff --git a/lib/node_modules/@stdlib/plot/vega/base/assert/is-vertical-baseline/docs/types/test.ts b/lib/node_modules/@stdlib/plot/vega/base/assert/is-vertical-baseline/docs/types/test.ts new file mode 100644 index 000000000000..fd12e079db4a --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/assert/is-vertical-baseline/docs/types/test.ts @@ -0,0 +1,34 @@ +/* +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +import isVerticalBaseline = require( './index' ); + + +// TESTS // + +// The function returns a boolean... +{ + isVerticalBaseline( 'middle' ); // $ExpectType boolean + isVerticalBaseline( 'foo' ); // $ExpectType boolean +} + +// The compiler throws an error if the function is provided an unsupported number of arguments... +{ + isVerticalBaseline(); // $ExpectError + isVerticalBaseline( undefined, 123 ); // $ExpectError +} diff --git a/lib/node_modules/@stdlib/plot/vega/base/assert/is-vertical-baseline/examples/index.js b/lib/node_modules/@stdlib/plot/vega/base/assert/is-vertical-baseline/examples/index.js new file mode 100644 index 000000000000..c75b54b29d2b --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/assert/is-vertical-baseline/examples/index.js @@ -0,0 +1,37 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +var isVerticalBaseline = require( './../lib' ); + +var bool = isVerticalBaseline( 'bottom' ); +console.log( bool ); +// => true + +bool = isVerticalBaseline( 'middle' ); +console.log( bool ); +// => true + +bool = isVerticalBaseline( '' ); +console.log( bool ); +// => false + +bool = isVerticalBaseline( 'foo' ); +console.log( bool ); +// => false diff --git a/lib/node_modules/@stdlib/plot/vega/base/assert/is-vertical-baseline/lib/index.js b/lib/node_modules/@stdlib/plot/vega/base/assert/is-vertical-baseline/lib/index.js new file mode 100644 index 000000000000..b9a864f9e81c --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/assert/is-vertical-baseline/lib/index.js @@ -0,0 +1,49 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +/** +* Test whether an input value is a supported vertical baseline. +* +* @module @stdlib/plot/vega/base/assert/is-vertical-baseline +* +* @example +* var isVerticalBaseline = require( '@stdlib/plot/vega/base/assert/is-vertical-baseline' ); +* +* var bool = isVerticalBaseline( 'bottom' ); +* // returns true +* +* bool = isVerticalBaseline( 'middle' ); +* // returns true +* +* bool = isVerticalBaseline( 'bar' ); +* // returns false +* +* bool = isVerticalBaseline( 'foo' ); +* // returns false +*/ + +// MODULES // + +var main = require( './main.js' ); + + +// EXPORTS // + +module.exports = main; diff --git a/lib/node_modules/@stdlib/plot/vega/base/assert/is-vertical-baseline/lib/main.js b/lib/node_modules/@stdlib/plot/vega/base/assert/is-vertical-baseline/lib/main.js new file mode 100644 index 000000000000..b50264bc0bb8 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/assert/is-vertical-baseline/lib/main.js @@ -0,0 +1,55 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var contains = require( '@stdlib/array/base/assert/contains' ).factory; +var verticalBaselines = require( '@stdlib/plot/vega/base/vertical-baselines' ); + + +// MAIN // + +/** +* Tests whether an input value is a supported vertical baseline. +* +* @name isVerticalBaseline +* @type {Function} +* @param {*} v - value to test +* @returns {boolean} boolean indicating whether an input value is a supported vertical baseline +* +* @example +* var bool = isVerticalBaseline( 'bottom' ); +* // returns true +* +* bool = isVerticalBaseline( 'middle' ); +* // returns true +* +* bool = isVerticalBaseline( 'bar' ); +* // returns false +* +* bool = isVerticalBaseline( 'foo' ); +* // returns false +*/ +var isVerticalBaseline = contains( verticalBaselines() ); + + +// EXPORTS // + +module.exports = isVerticalBaseline; diff --git a/lib/node_modules/@stdlib/plot/vega/base/assert/is-vertical-baseline/package.json b/lib/node_modules/@stdlib/plot/vega/base/assert/is-vertical-baseline/package.json new file mode 100644 index 000000000000..b521a087eb60 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/assert/is-vertical-baseline/package.json @@ -0,0 +1,70 @@ +{ + "name": "@stdlib/plot/vega/base/assert/is-vertical-baseline", + "version": "0.0.0", + "description": "Test if an input value is a supported vertical baseline.", + "license": "Apache-2.0", + "author": { + "name": "The Stdlib Authors", + "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" + }, + "contributors": [ + { + "name": "The Stdlib Authors", + "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" + } + ], + "main": "./lib", + "directories": { + "benchmark": "./benchmark", + "doc": "./docs", + "example": "./examples", + "lib": "./lib", + "test": "./test" + }, + "types": "./docs/types", + "scripts": {}, + "homepage": "https://github.com/stdlib-js/stdlib", + "repository": { + "type": "git", + "url": "git://github.com/stdlib-js/stdlib.git" + }, + "bugs": { + "url": "https://github.com/stdlib-js/stdlib/issues" + }, + "dependencies": {}, + "devDependencies": {}, + "engines": { + "node": ">=0.10.0", + "npm": ">2.7.0" + }, + "os": [ + "aix", + "darwin", + "freebsd", + "linux", + "macos", + "openbsd", + "sunos", + "win32", + "windows" + ], + "keywords": [ + "stdlib", + "plot", + "base", + "vega", + "utilities", + "utility", + "utils", + "util", + "assert", + "test", + "check", + "is", + "valid", + "validate", + "validation", + "isvalid" + ], + "__stdlib__": {} +} diff --git a/lib/node_modules/@stdlib/plot/vega/base/assert/is-vertical-baseline/test/test.js b/lib/node_modules/@stdlib/plot/vega/base/assert/is-vertical-baseline/test/test.js new file mode 100644 index 000000000000..e83863512e35 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/assert/is-vertical-baseline/test/test.js @@ -0,0 +1,81 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var tape = require( 'tape' ); +var isVerticalBaseline = require( './../lib' ); + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof isVerticalBaseline, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'the function returns `true` if provided a supported vertical baseline', function test( t ) { + var values; + var bool; + var i; + + values = [ + 'alphabetic', + 'bottom', + 'middle', + 'top', + 'line-top', + 'line-bottom' + ]; + for ( i = 0; i < values.length; i++ ) { + bool = isVerticalBaseline( values[ i ] ); + t.strictEqual( bool, true, 'returns expected value when provided '+values[ i ] ); + } + t.end(); +}); + +tape( 'the function returns `false` if not provided a supported vertical baseline', function test( t ) { + var values; + var bool; + var i; + + values = [ + '', + 'beep', + 'boop', + 'foo', + 'bar', + 5, + NaN, + true, + false, + null, + void 0, + [], + {}, + function noop() {} + ]; + for ( i = 0; i < values.length; i++ ) { + bool = isVerticalBaseline( values[ i ] ); + t.strictEqual( bool, false, 'returns expected value when provided '+values[ i ] ); + } + t.end(); +}); diff --git a/lib/node_modules/@stdlib/plot/vega/base/assert/is-x-axis-orientation/README.md b/lib/node_modules/@stdlib/plot/vega/base/assert/is-x-axis-orientation/README.md new file mode 100644 index 000000000000..0f906a04a54a --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/assert/is-x-axis-orientation/README.md @@ -0,0 +1,119 @@ +<!-- + +@license Apache-2.0 + +Copyright (c) 2025 The Stdlib Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + +--> + +# isXAxisOrientation + +> Test if an input value is a supported [x-axis orientation][@stdlib/plot/vega/axis/x-orientations]. + +<!-- Section to include introductory text. Make sure to keep an empty line after the intro `section` element and another before the `/section` close. --> + +<section class="intro"> + +</section> + +<!-- /.intro --> + +<!-- Package usage documentation. --> + +<section class="usage"> + +## Usage + +```javascript +var isXAxisOrientation = require( '@stdlib/plot/vega/base/assert/is-x-axis-orientation' ); +``` + +#### isXAxisOrientation( value ) + +Tests if an input value is a supported [x-axis orientation][@stdlib/plot/vega/axis/x-orientations]. + +```javascript +var bool = isXAxisOrientation( 'top' ); +// returns true + +bool = isXAxisOrientation( 'foo' ); +// returns false +``` + +</section> + +<!-- /.usage --> + +<!-- Package usage notes. Make sure to keep an empty line after the `section` element and another before the `/section` close. --> + +<section class="notes"> + +</section> + +<!-- /.notes --> + +<!-- Package usage examples. --> + +<section class="examples"> + +## Examples + +<!-- eslint no-undef: "error" --> + +```javascript +var isXAxisOrientation = require( '@stdlib/plot/vega/base/assert/is-x-axis-orientation' ); + +var bool = isXAxisOrientation( 'top' ); +// returns true + +bool = isXAxisOrientation( 'bottom' ); +// returns true + +bool = isXAxisOrientation( '' ); +// returns false + +bool = isXAxisOrientation( 'foo' ); +// returns false +``` + +</section> + +<!-- /.examples --> + +<!-- Section to include cited references. If references are included, add a horizontal rule *before* the section. Make sure to keep an empty line after the `section` element and another before the `/section` close. --> + +<section class="references"> + +</section> + +<!-- /.references --> + +<!-- Section for related `stdlib` packages. Do not manually edit this section, as it is automatically populated. --> + +<section class="related"> + +</section> + +<!-- /.related --> + +<!-- Section for all links. Make sure to keep an empty line after the `section` element and another before the `/section` close. --> + +<section class="links"> + +[@stdlib/plot/vega/axis/x-orientations]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/plot/vega/axis/x-orientations + +</section> + +<!-- /.links --> diff --git a/lib/node_modules/@stdlib/plot/vega/base/assert/is-x-axis-orientation/benchmark/benchmark.js b/lib/node_modules/@stdlib/plot/vega/base/assert/is-x-axis-orientation/benchmark/benchmark.js new file mode 100644 index 000000000000..7def22e3f27f --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/assert/is-x-axis-orientation/benchmark/benchmark.js @@ -0,0 +1,62 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var bench = require( '@stdlib/bench' ); +var isBoolean = require( '@stdlib/assert/is-boolean' ).isPrimitive; +var pkg = require( './../package.json' ).name; +var isXAxisOrientation = require( './../lib' ); + + +// MAIN // + +bench( pkg, function benchmark( b ) { + var values; + var out; + var v; + var i; + + values = [ + 'bottom', + 'top', + + 'foo', + 'bar', + '', + 'beep', + 'boop' + ]; + + b.tic(); + for ( i = 0; i < b.iterations; i++ ) { + v = values[ i%values.length ]; + out = isXAxisOrientation( v ); + if ( typeof out !== 'boolean' ) { + b.fail( 'should return a boolean' ); + } + } + b.toc(); + if ( !isBoolean( out ) ) { + b.fail( 'should return a boolean' ); + } + b.pass( 'benchmark finished' ); + b.end(); +}); diff --git a/lib/node_modules/@stdlib/plot/vega/base/assert/is-x-axis-orientation/docs/repl.txt b/lib/node_modules/@stdlib/plot/vega/base/assert/is-x-axis-orientation/docs/repl.txt new file mode 100644 index 000000000000..f63fcf18ae8b --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/assert/is-x-axis-orientation/docs/repl.txt @@ -0,0 +1,28 @@ + +{{alias}}( value ) + Tests if an input value is a supported x-axis orientation. + + Parameters + ---------- + value: any + Value to test. + + Returns + ------- + bool: boolean + Boolean indicating if an input value is a supported x-axis orientation. + + Examples + -------- + > var bool = {{alias}}( 'top' ) + true + > bool = {{alias}}( 'bottom' ) + true + > bool = {{alias}}( '' ) + false + > bool = {{alias}}( 'beep' ) + false + + See Also + -------- + diff --git a/lib/node_modules/@stdlib/plot/vega/base/assert/is-x-axis-orientation/docs/types/index.d.ts b/lib/node_modules/@stdlib/plot/vega/base/assert/is-x-axis-orientation/docs/types/index.d.ts new file mode 100644 index 000000000000..0e5f794f9c0f --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/assert/is-x-axis-orientation/docs/types/index.d.ts @@ -0,0 +1,45 @@ +/* +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +// TypeScript Version: 4.1 + +/** +* Tests whether an input value is a supported x-axis orientation. +* +* @param v - value to test +* @returns boolean indicating whether an input value is a supported x-axis orientation +* +* @example +* var bool = isXAxisOrientation( 'top' ); +* // returns true +* +* bool = isXAxisOrientation( 'bottom' ); +* // returns true +* +* bool = isXAxisOrientation( 'bar' ); +* // returns false +* +* bool = isXAxisOrientation( 'foo' ); +* // returns false +*/ +declare function isXAxisOrientation( v: any ): boolean; + + +// EXPORTS // + +export = isXAxisOrientation; diff --git a/lib/node_modules/@stdlib/plot/vega/base/assert/is-x-axis-orientation/docs/types/test.ts b/lib/node_modules/@stdlib/plot/vega/base/assert/is-x-axis-orientation/docs/types/test.ts new file mode 100644 index 000000000000..0da8ea0ba714 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/assert/is-x-axis-orientation/docs/types/test.ts @@ -0,0 +1,34 @@ +/* +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +import isXAxisOrientation = require( './index' ); + + +// TESTS // + +// The function returns a boolean... +{ + isXAxisOrientation( 'bottom' ); // $ExpectType boolean + isXAxisOrientation( 'foo' ); // $ExpectType boolean +} + +// The compiler throws an error if the function is provided an unsupported number of arguments... +{ + isXAxisOrientation(); // $ExpectError + isXAxisOrientation( undefined, 123 ); // $ExpectError +} diff --git a/lib/node_modules/@stdlib/plot/vega/base/assert/is-x-axis-orientation/examples/index.js b/lib/node_modules/@stdlib/plot/vega/base/assert/is-x-axis-orientation/examples/index.js new file mode 100644 index 000000000000..c5cb6d4ae1b6 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/assert/is-x-axis-orientation/examples/index.js @@ -0,0 +1,37 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +var isXAxisOrientation = require( './../lib' ); + +var bool = isXAxisOrientation( 'top' ); +console.log( bool ); +// => true + +bool = isXAxisOrientation( 'bottom' ); +console.log( bool ); +// => true + +bool = isXAxisOrientation( '' ); +console.log( bool ); +// => false + +bool = isXAxisOrientation( 'foo' ); +console.log( bool ); +// => false diff --git a/lib/node_modules/@stdlib/plot/vega/base/assert/is-x-axis-orientation/lib/index.js b/lib/node_modules/@stdlib/plot/vega/base/assert/is-x-axis-orientation/lib/index.js new file mode 100644 index 000000000000..464b70f75541 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/assert/is-x-axis-orientation/lib/index.js @@ -0,0 +1,49 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +/** +* Test whether an input value is a supported x-axis orientation. +* +* @module @stdlib/plot/vega/base/assert/is-x-axis-orientation +* +* @example +* var isXAxisOrientation = require( '@stdlib/plot/vega/base/assert/is-x-axis-orientation' ); +* +* var bool = isXAxisOrientation( 'top' ); +* // returns true +* +* bool = isXAxisOrientation( 'bottom' ); +* // returns true +* +* bool = isXAxisOrientation( 'bar' ); +* // returns false +* +* bool = isXAxisOrientation( 'foo' ); +* // returns false +*/ + +// MODULES // + +var main = require( './main.js' ); + + +// EXPORTS // + +module.exports = main; diff --git a/lib/node_modules/@stdlib/plot/vega/base/assert/is-x-axis-orientation/lib/main.js b/lib/node_modules/@stdlib/plot/vega/base/assert/is-x-axis-orientation/lib/main.js new file mode 100644 index 000000000000..3aa638a4ac26 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/assert/is-x-axis-orientation/lib/main.js @@ -0,0 +1,55 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var contains = require( '@stdlib/array/base/assert/contains' ).factory; +var axisOrientations = require( '@stdlib/plot/vega/axis/x-orientations' ); + + +// MAIN // + +/** +* Tests whether an input value is a supported x-axis orientation. +* +* @name isXAxisOrientation +* @type {Function} +* @param {*} v - value to test +* @returns {boolean} boolean indicating whether an input value is a supported x-axis orientation +* +* @example +* var bool = isXAxisOrientation( 'top' ); +* // returns true +* +* bool = isXAxisOrientation( 'bottom' ); +* // returns true +* +* bool = isXAxisOrientation( 'bar' ); +* // returns false +* +* bool = isXAxisOrientation( 'foo' ); +* // returns false +*/ +var isXAxisOrientation = contains( axisOrientations() ); + + +// EXPORTS // + +module.exports = isXAxisOrientation; diff --git a/lib/node_modules/@stdlib/plot/vega/base/assert/is-x-axis-orientation/package.json b/lib/node_modules/@stdlib/plot/vega/base/assert/is-x-axis-orientation/package.json new file mode 100644 index 000000000000..8e9e6043dca3 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/assert/is-x-axis-orientation/package.json @@ -0,0 +1,70 @@ +{ + "name": "@stdlib/plot/vega/base/assert/is-x-axis-orientation", + "version": "0.0.0", + "description": "Test if an input value is a supported x-axis orientation.", + "license": "Apache-2.0", + "author": { + "name": "The Stdlib Authors", + "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" + }, + "contributors": [ + { + "name": "The Stdlib Authors", + "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" + } + ], + "main": "./lib", + "directories": { + "benchmark": "./benchmark", + "doc": "./docs", + "example": "./examples", + "lib": "./lib", + "test": "./test" + }, + "types": "./docs/types", + "scripts": {}, + "homepage": "https://github.com/stdlib-js/stdlib", + "repository": { + "type": "git", + "url": "git://github.com/stdlib-js/stdlib.git" + }, + "bugs": { + "url": "https://github.com/stdlib-js/stdlib/issues" + }, + "dependencies": {}, + "devDependencies": {}, + "engines": { + "node": ">=0.10.0", + "npm": ">2.7.0" + }, + "os": [ + "aix", + "darwin", + "freebsd", + "linux", + "macos", + "openbsd", + "sunos", + "win32", + "windows" + ], + "keywords": [ + "stdlib", + "plot", + "base", + "vega", + "utilities", + "utility", + "utils", + "util", + "assert", + "test", + "check", + "is", + "valid", + "validate", + "validation", + "isvalid" + ], + "__stdlib__": {} +} diff --git a/lib/node_modules/@stdlib/plot/vega/base/assert/is-x-axis-orientation/test/test.js b/lib/node_modules/@stdlib/plot/vega/base/assert/is-x-axis-orientation/test/test.js new file mode 100644 index 000000000000..226575a3ec0f --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/assert/is-x-axis-orientation/test/test.js @@ -0,0 +1,79 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var tape = require( 'tape' ); +var isXAxisOrientation = require( './../lib' ); + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof isXAxisOrientation, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'the function returns `true` if provided a supported axis orientation', function test( t ) { + var values; + var bool; + var i; + + values = [ + 'bottom', + 'top' + ]; + for ( i = 0; i < values.length; i++ ) { + bool = isXAxisOrientation( values[ i ] ); + t.strictEqual( bool, true, 'returns expected value when provided '+values[ i ] ); + } + t.end(); +}); + +tape( 'the function returns `false` if not provided a supported axis orientation', function test( t ) { + var values; + var bool; + var i; + + values = [ + 'left', + 'right', + '', + 'beep', + 'boop', + 'foo', + 'bar', + 5, + NaN, + true, + false, + null, + void 0, + [], + {}, + function noop() {} + ]; + for ( i = 0; i < values.length; i++ ) { + bool = isXAxisOrientation( values[ i ] ); + t.strictEqual( bool, false, 'returns expected value when provided '+values[ i ] ); + } + t.end(); +}); diff --git a/lib/node_modules/@stdlib/plot/vega/base/assert/is-y-axis-orientation/README.md b/lib/node_modules/@stdlib/plot/vega/base/assert/is-y-axis-orientation/README.md new file mode 100644 index 000000000000..8af93e089560 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/assert/is-y-axis-orientation/README.md @@ -0,0 +1,119 @@ +<!-- + +@license Apache-2.0 + +Copyright (c) 2025 The Stdlib Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + +--> + +# isYAxisOrientation + +> Test if an input value is a supported [y-axis orientation][@stdlib/plot/vega/axis/y-orientations]. + +<!-- Section to include introductory text. Make sure to keep an empty line after the intro `section` element and another before the `/section` close. --> + +<section class="intro"> + +</section> + +<!-- /.intro --> + +<!-- Package usage documentation. --> + +<section class="usage"> + +## Usage + +```javascript +var isYAxisOrientation = require( '@stdlib/plot/vega/base/assert/is-y-axis-orientation' ); +``` + +#### isYAxisOrientation( value ) + +Tests if an input value is a supported [y-axis orientation][@stdlib/plot/vega/axis/y-orientations]. + +```javascript +var bool = isYAxisOrientation( 'right' ); +// returns true + +bool = isYAxisOrientation( 'foo' ); +// returns false +``` + +</section> + +<!-- /.usage --> + +<!-- Package usage notes. Make sure to keep an empty line after the `section` element and another before the `/section` close. --> + +<section class="notes"> + +</section> + +<!-- /.notes --> + +<!-- Package usage examples. --> + +<section class="examples"> + +## Examples + +<!-- eslint no-undef: "error" --> + +```javascript +var isYAxisOrientation = require( '@stdlib/plot/vega/base/assert/is-y-axis-orientation' ); + +var bool = isYAxisOrientation( 'right' ); +// returns true + +bool = isYAxisOrientation( 'left' ); +// returns true + +bool = isYAxisOrientation( '' ); +// returns false + +bool = isYAxisOrientation( 'foo' ); +// returns false +``` + +</section> + +<!-- /.examples --> + +<!-- Section to include cited references. If references are included, add a horizontal rule *before* the section. Make sure to keep an empty line after the `section` element and another before the `/section` close. --> + +<section class="references"> + +</section> + +<!-- /.references --> + +<!-- Section for related `stdlib` packages. Do not manually edit this section, as it is automatically populated. --> + +<section class="related"> + +</section> + +<!-- /.related --> + +<!-- Section for all links. Make sure to keep an empty line after the `section` element and another before the `/section` close. --> + +<section class="links"> + +[@stdlib/plot/vega/axis/y-orientations]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/plot/vega/axis/y-orientations + +</section> + +<!-- /.links --> diff --git a/lib/node_modules/@stdlib/plot/vega/base/assert/is-y-axis-orientation/benchmark/benchmark.js b/lib/node_modules/@stdlib/plot/vega/base/assert/is-y-axis-orientation/benchmark/benchmark.js new file mode 100644 index 000000000000..4d4eed8c301a --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/assert/is-y-axis-orientation/benchmark/benchmark.js @@ -0,0 +1,62 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var bench = require( '@stdlib/bench' ); +var isBoolean = require( '@stdlib/assert/is-boolean' ).isPrimitive; +var pkg = require( './../package.json' ).name; +var isYAxisOrientation = require( './../lib' ); + + +// MAIN // + +bench( pkg, function benchmark( b ) { + var values; + var out; + var v; + var i; + + values = [ + 'left', + 'bottom', + + 'foo', + 'bar', + '', + 'beep', + 'boop' + ]; + + b.tic(); + for ( i = 0; i < b.iterations; i++ ) { + v = values[ i%values.length ]; + out = isYAxisOrientation( v ); + if ( typeof out !== 'boolean' ) { + b.fail( 'should return a boolean' ); + } + } + b.toc(); + if ( !isBoolean( out ) ) { + b.fail( 'should return a boolean' ); + } + b.pass( 'benchmark finished' ); + b.end(); +}); diff --git a/lib/node_modules/@stdlib/plot/vega/base/assert/is-y-axis-orientation/docs/repl.txt b/lib/node_modules/@stdlib/plot/vega/base/assert/is-y-axis-orientation/docs/repl.txt new file mode 100644 index 000000000000..1cafc4b535d7 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/assert/is-y-axis-orientation/docs/repl.txt @@ -0,0 +1,28 @@ + +{{alias}}( value ) + Tests if an input value is a supported y-axis orientation. + + Parameters + ---------- + value: any + Value to test. + + Returns + ------- + bool: boolean + Boolean indicating if an input value is a supported y-axis orientation. + + Examples + -------- + > var bool = {{alias}}( 'right' ) + true + > bool = {{alias}}( 'left' ) + true + > bool = {{alias}}( '' ) + false + > bool = {{alias}}( 'beep' ) + false + + See Also + -------- + diff --git a/lib/node_modules/@stdlib/plot/vega/base/assert/is-y-axis-orientation/docs/types/index.d.ts b/lib/node_modules/@stdlib/plot/vega/base/assert/is-y-axis-orientation/docs/types/index.d.ts new file mode 100644 index 000000000000..81c38705520e --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/assert/is-y-axis-orientation/docs/types/index.d.ts @@ -0,0 +1,45 @@ +/* +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +// TypeScript Version: 4.1 + +/** +* Tests whether an input value is a supported y-axis orientation. +* +* @param v - value to test +* @returns boolean indicating whether an input value is a supported y-axis orientation +* +* @example +* var bool = isYAxisOrientation( 'right' ); +* // returns true +* +* bool = isYAxisOrientation( 'left' ); +* // returns true +* +* bool = isYAxisOrientation( 'bar' ); +* // returns false +* +* bool = isYAxisOrientation( 'foo' ); +* // returns false +*/ +declare function isYAxisOrientation( v: any ): boolean; + + +// EXPORTS // + +export = isYAxisOrientation; diff --git a/lib/node_modules/@stdlib/plot/vega/base/assert/is-y-axis-orientation/docs/types/test.ts b/lib/node_modules/@stdlib/plot/vega/base/assert/is-y-axis-orientation/docs/types/test.ts new file mode 100644 index 000000000000..ed5fddcbe43b --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/assert/is-y-axis-orientation/docs/types/test.ts @@ -0,0 +1,34 @@ +/* +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +import isYAxisOrientation = require( './index' ); + + +// TESTS // + +// The function returns a boolean... +{ + isYAxisOrientation( 'left' ); // $ExpectType boolean + isYAxisOrientation( 'foo' ); // $ExpectType boolean +} + +// The compiler throws an error if the function is provided an unsupported number of arguments... +{ + isYAxisOrientation(); // $ExpectError + isYAxisOrientation( undefined, 123 ); // $ExpectError +} diff --git a/lib/node_modules/@stdlib/plot/vega/base/assert/is-y-axis-orientation/examples/index.js b/lib/node_modules/@stdlib/plot/vega/base/assert/is-y-axis-orientation/examples/index.js new file mode 100644 index 000000000000..488224b6b185 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/assert/is-y-axis-orientation/examples/index.js @@ -0,0 +1,37 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +var isYAxisOrientation = require( './../lib' ); + +var bool = isYAxisOrientation( 'right' ); +console.log( bool ); +// => true + +bool = isYAxisOrientation( 'left' ); +console.log( bool ); +// => true + +bool = isYAxisOrientation( '' ); +console.log( bool ); +// => false + +bool = isYAxisOrientation( 'foo' ); +console.log( bool ); +// => false diff --git a/lib/node_modules/@stdlib/plot/vega/base/assert/is-y-axis-orientation/lib/index.js b/lib/node_modules/@stdlib/plot/vega/base/assert/is-y-axis-orientation/lib/index.js new file mode 100644 index 000000000000..22872c110ffb --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/assert/is-y-axis-orientation/lib/index.js @@ -0,0 +1,49 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +/** +* Test whether an input value is a supported y-axis orientation. +* +* @module @stdlib/plot/vega/base/assert/is-y-axis-orientation +* +* @example +* var isYAxisOrientation = require( '@stdlib/plot/vega/base/assert/is-y-axis-orientation' ); +* +* var bool = isYAxisOrientation( 'right' ); +* // returns true +* +* bool = isYAxisOrientation( 'left' ); +* // returns true +* +* bool = isYAxisOrientation( 'bar' ); +* // returns false +* +* bool = isYAxisOrientation( 'foo' ); +* // returns false +*/ + +// MODULES // + +var main = require( './main.js' ); + + +// EXPORTS // + +module.exports = main; diff --git a/lib/node_modules/@stdlib/plot/vega/base/assert/is-y-axis-orientation/lib/main.js b/lib/node_modules/@stdlib/plot/vega/base/assert/is-y-axis-orientation/lib/main.js new file mode 100644 index 000000000000..eaf804102caa --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/assert/is-y-axis-orientation/lib/main.js @@ -0,0 +1,55 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var contains = require( '@stdlib/array/base/assert/contains' ).factory; +var axisOrientations = require( '@stdlib/plot/vega/axis/y-orientations' ); + + +// MAIN // + +/** +* Tests whether an input value is a supported y-axis orientation. +* +* @name isYAxisOrientation +* @type {Function} +* @param {*} v - value to test +* @returns {boolean} boolean indicating whether an input value is a supported y-axis orientation +* +* @example +* var bool = isYAxisOrientation( 'right' ); +* // returns true +* +* bool = isYAxisOrientation( 'left' ); +* // returns true +* +* bool = isYAxisOrientation( 'bar' ); +* // returns false +* +* bool = isYAxisOrientation( 'foo' ); +* // returns false +*/ +var isYAxisOrientation = contains( axisOrientations() ); + + +// EXPORTS // + +module.exports = isYAxisOrientation; diff --git a/lib/node_modules/@stdlib/plot/vega/base/assert/is-y-axis-orientation/package.json b/lib/node_modules/@stdlib/plot/vega/base/assert/is-y-axis-orientation/package.json new file mode 100644 index 000000000000..a21b2c5c1810 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/assert/is-y-axis-orientation/package.json @@ -0,0 +1,70 @@ +{ + "name": "@stdlib/plot/vega/base/assert/is-y-axis-orientation", + "version": "0.0.0", + "description": "Test if an input value is a supported y-axis orientation.", + "license": "Apache-2.0", + "author": { + "name": "The Stdlib Authors", + "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" + }, + "contributors": [ + { + "name": "The Stdlib Authors", + "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" + } + ], + "main": "./lib", + "directories": { + "benchmark": "./benchmark", + "doc": "./docs", + "example": "./examples", + "lib": "./lib", + "test": "./test" + }, + "types": "./docs/types", + "scripts": {}, + "homepage": "https://github.com/stdlib-js/stdlib", + "repository": { + "type": "git", + "url": "git://github.com/stdlib-js/stdlib.git" + }, + "bugs": { + "url": "https://github.com/stdlib-js/stdlib/issues" + }, + "dependencies": {}, + "devDependencies": {}, + "engines": { + "node": ">=0.10.0", + "npm": ">2.7.0" + }, + "os": [ + "aix", + "darwin", + "freebsd", + "linux", + "macos", + "openbsd", + "sunos", + "win32", + "windows" + ], + "keywords": [ + "stdlib", + "plot", + "base", + "vega", + "utilities", + "utility", + "utils", + "util", + "assert", + "test", + "check", + "is", + "valid", + "validate", + "validation", + "isvalid" + ], + "__stdlib__": {} +} diff --git a/lib/node_modules/@stdlib/plot/vega/base/assert/is-y-axis-orientation/test/test.js b/lib/node_modules/@stdlib/plot/vega/base/assert/is-y-axis-orientation/test/test.js new file mode 100644 index 000000000000..1d134269638d --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/assert/is-y-axis-orientation/test/test.js @@ -0,0 +1,79 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var tape = require( 'tape' ); +var isYAxisOrientation = require( './../lib' ); + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof isYAxisOrientation, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'the function returns `true` if provided a supported axis orientation', function test( t ) { + var values; + var bool; + var i; + + values = [ + 'left', + 'right' + ]; + for ( i = 0; i < values.length; i++ ) { + bool = isYAxisOrientation( values[ i ] ); + t.strictEqual( bool, true, 'returns expected value when provided '+values[ i ] ); + } + t.end(); +}); + +tape( 'the function returns `false` if not provided a supported axis orientation', function test( t ) { + var values; + var bool; + var i; + + values = [ + 'bottom', + 'top', + '', + 'beep', + 'boop', + 'foo', + 'bar', + 5, + NaN, + true, + false, + null, + void 0, + [], + {}, + function noop() {} + ]; + for ( i = 0; i < values.length; i++ ) { + bool = isYAxisOrientation( values[ i ] ); + t.strictEqual( bool, false, 'returns expected value when provided '+values[ i ] ); + } + t.end(); +}); diff --git a/lib/node_modules/@stdlib/plot/vega/base/property2object/lib/index.js b/lib/node_modules/@stdlib/plot/vega/base/property2object/lib/index.js new file mode 100644 index 000000000000..91fd2f6b6ab9 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/property2object/lib/index.js @@ -0,0 +1,40 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +/** +* Convert a property name to an object with fields for accessing corresponding public and private properties. +* +* @module @stdlib/plot/vega/base/property2object +* +* @example +* var property2object = require( '@stdlib/plot/vega/base/property2object' ); +* +* var obj = property2object( 'foo' ); +* // returns { 'name': 'foo', 'private': '_foo' } +*/ + +// MODULES // + +var main = require( './main.js' ); + + +// EXPORTS // + +module.exports = main; diff --git a/lib/node_modules/@stdlib/plot/vega/base/property2object/lib/main.js b/lib/node_modules/@stdlib/plot/vega/base/property2object/lib/main.js new file mode 100644 index 000000000000..e59df785ee88 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/property2object/lib/main.js @@ -0,0 +1,43 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MAIN // + +/** +* Converts a property name to an object with fields for accessing corresponding public and private properties. +* +* @param {string} property - property name +* @returns {Object} object +* +* @example +* var obj = property2object( 'foo' ); +* // returns { 'name': 'foo', 'private': '_foo' } +*/ +function property2object( property ) { + return { + 'name': property, + 'private': '_'+property + }; +} + + +// EXPORTS // + +module.exports = property2object; diff --git a/lib/node_modules/@stdlib/plot/vega/base/property2object/package.json b/lib/node_modules/@stdlib/plot/vega/base/property2object/package.json new file mode 100644 index 000000000000..4b479275ac7e --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/property2object/package.json @@ -0,0 +1,58 @@ +{ + "name": "@stdlib/plot/vega/base/property2object", + "version": "0.0.0", + "description": "Convert a property name to an object with fields for accessing corresponding public and private properties.", + "license": "Apache-2.0", + "author": { + "name": "The Stdlib Authors", + "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" + }, + "contributors": [ + { + "name": "The Stdlib Authors", + "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" + } + ], + "main": "./lib", + "directories": { + "lib": "./lib" + }, + "types": "./docs/types", + "scripts": {}, + "homepage": "https://github.com/stdlib-js/stdlib", + "repository": { + "type": "git", + "url": "git://github.com/stdlib-js/stdlib.git" + }, + "bugs": { + "url": "https://github.com/stdlib-js/stdlib/issues" + }, + "dependencies": {}, + "devDependencies": {}, + "engines": { + "node": ">=0.10.0", + "npm": ">2.7.0" + }, + "os": [ + "aix", + "darwin", + "freebsd", + "linux", + "macos", + "openbsd", + "sunos", + "win32", + "windows" + ], + "keywords": [ + "stdlib", + "plot", + "vega", + "property", + "utilities", + "utility", + "utils", + "util" + ], + "__stdlib__": {} +} diff --git a/lib/node_modules/@stdlib/plot/vega/base/spec2svg/lib/index.js b/lib/node_modules/@stdlib/plot/vega/base/spec2svg/lib/index.js new file mode 100644 index 000000000000..30c59d8e422f --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/spec2svg/lib/index.js @@ -0,0 +1,39 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +/** +* Render a chart specified by a provided Vega specification to an SVG. +* +* @module @stdlib/plot/vega/base/spec2svg +* +* @example +* var spec2svg = require( '@stdlib/plot/vega/base/spec2svg' ); +* +* // TODO +*/ + +// MODULES // + +var main = require( './main.js' ); + + +// EXPORTS // + +module.exports = main; diff --git a/lib/node_modules/@stdlib/plot/vega/base/spec2svg/lib/main.js b/lib/node_modules/@stdlib/plot/vega/base/spec2svg/lib/main.js new file mode 100644 index 000000000000..23d690791ce5 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/spec2svg/lib/main.js @@ -0,0 +1,81 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var vega = require( '@stdlib/plot/vega/vendored' ); + + +// MAIN // + +/** +* Renders a chart specified by a provided Vega specification to an SVG. +* +* @param {Object} spec - Vega specification +* @param {Object} [theme] - theme configuration +* @param {Callback} clbk - callback to invoke upon rendering an SVG +* +* @example +* // TODO +*/ +function spec2svg( spec, theme, clbk ) { + var runtime; + var view; + var cb; + + if ( arguments.length > 2 ) { + runtime = vega.parse( spec, theme ); + cb = clbk; + } else { + runtime = vega.parse( spec ); + cb = theme; + } + view = new vega.View( runtime, { + 'renderer': 'none' + }); + view.toSVG().then( onResolve, onReject ); + + /** + * Callback invoked upon success. + * + * @private + * @param {string} result - result + * @returns {void} + */ + function onResolve( result ) { + return cb( null, result ); + } + + /** + * Callback invoked upon encountering a failure. + * + * @private + * @param {Error} err - error object + * @returns {void} + */ + function onReject( err ) { + return cb( err ); + } +} + + +// EXPORTS // + +module.exports = spec2svg; diff --git a/lib/node_modules/@stdlib/plot/vega/base/spec2svg/package.json b/lib/node_modules/@stdlib/plot/vega/base/spec2svg/package.json new file mode 100644 index 000000000000..251f67307d13 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/spec2svg/package.json @@ -0,0 +1,63 @@ +{ + "name": "@stdlib/plot/vega/base/spec2svg", + "version": "0.0.0", + "description": "Render a chart specified by a provided Vega specification to an SVG.", + "license": "Apache-2.0", + "author": { + "name": "The Stdlib Authors", + "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" + }, + "contributors": [ + { + "name": "The Stdlib Authors", + "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" + } + ], + "main": "./lib", + "directories": { + "benchmark": "./benchmark", + "doc": "./docs", + "example": "./examples", + "lib": "./lib", + "test": "./test" + }, + "types": "./docs/types", + "scripts": {}, + "homepage": "https://github.com/stdlib-js/stdlib", + "repository": { + "type": "git", + "url": "git://github.com/stdlib-js/stdlib.git" + }, + "bugs": { + "url": "https://github.com/stdlib-js/stdlib/issues" + }, + "dependencies": {}, + "devDependencies": {}, + "engines": { + "node": ">=0.10.0", + "npm": ">2.7.0" + }, + "os": [ + "aix", + "darwin", + "freebsd", + "linux", + "macos", + "openbsd", + "sunos", + "win32", + "windows" + ], + "keywords": [ + "stdlib", + "plot", + "vega", + "render", + "svg", + "utilities", + "utility", + "utils", + "util" + ], + "__stdlib__": {} +} diff --git a/lib/node_modules/@stdlib/plot/vega/base/stroke-caps/README.md b/lib/node_modules/@stdlib/plot/vega/base/stroke-caps/README.md new file mode 100644 index 000000000000..99332f687b15 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/stroke-caps/README.md @@ -0,0 +1,117 @@ +<!-- + +@license Apache-2.0 + +Copyright (c) 2025 The Stdlib Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + +--> + +# strokeCaps + +> List of supported Vega stroke caps. + +<!-- Section to include introductory text. Make sure to keep an empty line after the intro `section` element and another before the `/section` close. --> + +<section class="intro"> + +</section> + +<!-- /.intro --> + +<!-- Package usage documentation. --> + +<section class="usage"> + +## Usage + +```javascript +var strokeCaps = require( '@stdlib/plot/vega/base/stroke-caps' ); +``` + +#### strokeCaps() + +Returns a list of stroke caps. + +```javascript +var out = strokeCaps(); +// returns [ 'butt', 'round', 'square' ] +``` + +</section> + +<!-- /.usage --> + +<!-- Package usage notes. Make sure to keep an empty line after the `section` element and another before the `/section` close. --> + +<section class="notes"> + +</section> + +<!-- /.notes --> + +<!-- Package usage examples. --> + +<section class="examples"> + +## Examples + +<!-- eslint no-undef: "error" --> + +```javascript +var contains = require( '@stdlib/array/base/assert/contains' ).factory; +var strokeCaps = require( '@stdlib/plot/vega/base/stroke-caps' ); + +var isStrokeCap = contains( strokeCaps() ); + +var bool = isStrokeCap( 'round' ); +// returns true + +bool = isStrokeCap( 'square' ); +// returns true + +bool = isStrokeCap( 'beep' ); +// returns false + +bool = isStrokeCap( 'boop' ); +// returns false +``` + +</section> + +<!-- /.examples --> + +<!-- Section to include cited references. If references are included, add a horizontal rule *before* the section. Make sure to keep an empty line after the `section` element and another before the `/section` close. --> + +<section class="references"> + +</section> + +<!-- /.references --> + +<!-- Section for related `stdlib` packages. Do not manually edit this section, as it is automatically populated. --> + +<section class="related"> + +</section> + +<!-- /.related --> + +<!-- Section for all links. Make sure to keep an empty line after the `section` element and another before the `/section` close. --> + +<section class="links"> + +</section> + +<!-- /.links --> diff --git a/lib/node_modules/@stdlib/plot/vega/base/stroke-caps/benchmark/benchmark.js b/lib/node_modules/@stdlib/plot/vega/base/stroke-caps/benchmark/benchmark.js new file mode 100644 index 000000000000..93200ad290be --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/stroke-caps/benchmark/benchmark.js @@ -0,0 +1,48 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var bench = require( '@stdlib/bench' ); +var isStringArray = require( '@stdlib/assert/is-string-array' ).primitives; +var pkg = require( './../package.json' ).name; +var strokeCaps = require( './../lib' ); + + +// MAIN // + +bench( pkg, function benchmark( b ) { + var out; + var i; + + b.tic(); + for ( i = 0; i < b.iterations; i++ ) { + out = strokeCaps(); + if ( out.length < 2 ) { + b.fail( 'should return an array' ); + } + } + b.toc(); + if ( !isStringArray( out ) ) { + b.fail( 'should return an array of strings' ); + } + b.pass( 'benchmark finished' ); + b.end(); +}); diff --git a/lib/node_modules/@stdlib/plot/vega/base/stroke-caps/docs/repl.txt b/lib/node_modules/@stdlib/plot/vega/base/stroke-caps/docs/repl.txt new file mode 100644 index 000000000000..3bdb13e2f975 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/stroke-caps/docs/repl.txt @@ -0,0 +1,17 @@ + +{{alias}}() + Returns a list of stroke caps. + + Returns + ------- + out: Array<string> + List of stroke caps. + + Examples + -------- + > var out = {{alias}}() + [ 'butt', 'round', 'square' ] + + See Also + -------- + diff --git a/lib/node_modules/@stdlib/plot/vega/base/stroke-caps/docs/types/index.d.ts b/lib/node_modules/@stdlib/plot/vega/base/stroke-caps/docs/types/index.d.ts new file mode 100644 index 000000000000..ce111d51fbb5 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/stroke-caps/docs/types/index.d.ts @@ -0,0 +1,35 @@ +/* +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +// TypeScript Version: 4.1 + +/** +* Returns a list of stroke caps. +* +* @returns list of stroke caps +* +* @example +* var list = strokeCaps(); +* // returns [ 'butt', 'round', 'square' ] +*/ +declare function strokeCaps(): Array<string>; + + +// EXPORTS // + +export = strokeCaps; diff --git a/lib/node_modules/@stdlib/plot/vega/base/stroke-caps/docs/types/test.ts b/lib/node_modules/@stdlib/plot/vega/base/stroke-caps/docs/types/test.ts new file mode 100644 index 000000000000..8b8ecf24cbaa --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/stroke-caps/docs/types/test.ts @@ -0,0 +1,32 @@ +/* +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +import strokeCaps = require( './index' ); + + +// TESTS // + +// The function returns an array of strings... +{ + strokeCaps(); // $ExpectType string[] +} + +// The compiler throws an error if the function is provided any arguments... +{ + strokeCaps( 9 ); // $ExpectError +} diff --git a/lib/node_modules/@stdlib/plot/vega/base/stroke-caps/examples/index.js b/lib/node_modules/@stdlib/plot/vega/base/stroke-caps/examples/index.js new file mode 100644 index 000000000000..7abd721212b0 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/stroke-caps/examples/index.js @@ -0,0 +1,40 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +var contains = require( '@stdlib/array/base/assert/contains' ).factory; +var strokeCaps = require( './../lib' ); + +var isStrokeCap = contains( strokeCaps() ); + +var bool = isStrokeCap( 'round' ); +console.log( bool ); +// => true + +bool = isStrokeCap( 'square' ); +console.log( bool ); +// => true + +bool = isStrokeCap( 'beep' ); +console.log( bool ); +// => false + +bool = isStrokeCap( 'boop' ); +console.log( bool ); +// => false diff --git a/lib/node_modules/@stdlib/plot/vega/base/stroke-caps/lib/data.json b/lib/node_modules/@stdlib/plot/vega/base/stroke-caps/lib/data.json new file mode 100644 index 000000000000..51418594b96a --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/stroke-caps/lib/data.json @@ -0,0 +1,5 @@ +[ + "butt", + "round", + "square" +] diff --git a/lib/node_modules/@stdlib/plot/vega/base/stroke-caps/lib/index.js b/lib/node_modules/@stdlib/plot/vega/base/stroke-caps/lib/index.js new file mode 100644 index 000000000000..b3c513e56869 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/stroke-caps/lib/index.js @@ -0,0 +1,40 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +/** +* Return a list of stroke caps. +* +* @module @stdlib/plot/vega/base/stroke-caps +* +* @example +* var strokeCaps = require( '@stdlib/plot/vega/base/stroke-caps' ); +* +* var out = strokeCaps(); +* // returns [ 'butt', 'round', 'square' ] +*/ + +// MODULES // + +var main = require( './main.js' ); + + +// EXPORTS // + +module.exports = main; diff --git a/lib/node_modules/@stdlib/plot/vega/base/stroke-caps/lib/main.js b/lib/node_modules/@stdlib/plot/vega/base/stroke-caps/lib/main.js new file mode 100644 index 000000000000..ea570a5c5e31 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/stroke-caps/lib/main.js @@ -0,0 +1,44 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var DATA = require( './data.json' ); + + +// MAIN // + +/** +* Returns a list of stroke caps. +* +* @returns {StringArray} list of stroke caps +* +* @example +* var out = strokeCaps(); +* // returns [ 'butt', 'round', 'square' ] +*/ +function strokeCaps() { + return DATA.slice(); +} + + +// EXPORTS // + +module.exports = strokeCaps; diff --git a/lib/node_modules/@stdlib/plot/vega/base/stroke-caps/package.json b/lib/node_modules/@stdlib/plot/vega/base/stroke-caps/package.json new file mode 100644 index 000000000000..6a18a84a8135 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/stroke-caps/package.json @@ -0,0 +1,63 @@ +{ + "name": "@stdlib/plot/vega/base/stroke-caps", + "version": "0.0.0", + "description": "List of supported Vega stroke caps.", + "license": "Apache-2.0", + "author": { + "name": "The Stdlib Authors", + "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" + }, + "contributors": [ + { + "name": "The Stdlib Authors", + "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" + } + ], + "main": "./lib", + "directories": { + "benchmark": "./benchmark", + "doc": "./docs", + "example": "./examples", + "lib": "./lib", + "test": "./test" + }, + "types": "./docs/types", + "scripts": {}, + "homepage": "https://github.com/stdlib-js/stdlib", + "repository": { + "type": "git", + "url": "git://github.com/stdlib-js/stdlib.git" + }, + "bugs": { + "url": "https://github.com/stdlib-js/stdlib/issues" + }, + "dependencies": {}, + "devDependencies": {}, + "engines": { + "node": ">=0.10.0", + "npm": ">2.7.0" + }, + "os": [ + "aix", + "darwin", + "freebsd", + "linux", + "macos", + "openbsd", + "sunos", + "win32", + "windows" + ], + "keywords": [ + "stdlib", + "plot", + "vega", + "stroke", + "cap", + "utilities", + "utility", + "utils", + "util" + ], + "__stdlib__": {} +} diff --git a/lib/node_modules/@stdlib/plot/vega/base/stroke-caps/test/test.js b/lib/node_modules/@stdlib/plot/vega/base/stroke-caps/test/test.js new file mode 100644 index 000000000000..164617e0008b --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/stroke-caps/test/test.js @@ -0,0 +1,48 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var tape = require( 'tape' ); +var strokeCaps = require( './../lib' ); + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof strokeCaps, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'the function returns a list of stroke caps', function test( t ) { + var expected; + var actual; + + expected = [ + 'butt', + 'round', + 'square' + ]; + actual = strokeCaps(); + + t.deepEqual( actual, expected, 'returns expected value' ); + t.end(); +}); diff --git a/lib/node_modules/@stdlib/plot/vega/base/to-json/lib/index.js b/lib/node_modules/@stdlib/plot/vega/base/to-json/lib/index.js new file mode 100644 index 000000000000..d2d059a57b9b --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/to-json/lib/index.js @@ -0,0 +1,39 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +/** +* Serialize a list of private instance properties from a class instance to a JSON object. +* +* @module @stdlib/plot/vega/base/to-json +* +* @example +* var toJSON = require( '@stdlib/plot/vega/base/to-json' ); +* +* // TODO: example +*/ + +// MODULES // + +var main = require( './main.js' ); + + +// EXPORTS // + +module.exports = main; diff --git a/lib/node_modules/@stdlib/plot/vega/base/to-json/lib/main.js b/lib/node_modules/@stdlib/plot/vega/base/to-json/lib/main.js new file mode 100644 index 000000000000..a626b235125e --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/to-json/lib/main.js @@ -0,0 +1,81 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var isFunction = require( '@stdlib/assert/is-function' ); +var isArray = require( '@stdlib/assert/is-array' ); +var isObject = require( '@stdlib/assert/is-object' ); +var copy = require( '@stdlib/utils/copy' ); + + +// MAIN // + +/** +* Serializes a list of private instance properties from a class instance to a JSON object. +* +* @param {Object} obj - input instance +* @param {Array<string>} properties - properties to serialize +* @returns {Object} JSON object +*/ +function toJSON( obj, properties ) { + var out; + var tmp; + var v; + var o; + var k; + var i; + var j; + + out = {}; + for ( i = 0; i < properties.length; i++ ) { + k = properties[ i ]; + v = obj[ '_'+k ]; + if ( v === void 0 ) { + continue; + } + if ( isArray( v ) ) { + tmp = []; + for ( j = 0; j < v.length; j++ ) { + o = v[ j ]; + if ( o && isFunction( o.toJSON ) ) { + tmp.push( o.toJSON() ); + } else if ( isObject( o ) ) { + tmp.push( copy( o ) ); + } else { + tmp.push( o ); + } + } + out[ k ] = tmp; + } else if ( v && isFunction( v.toJSON ) ) { + out[ k ] = v.toJSON(); + } else if ( isObject( v ) ) { + out[ k ] = copy( v ); + } else { + out[ k ] = v; + } + } + return out; +} + + +// EXPORTS // + +module.exports = toJSON; diff --git a/lib/node_modules/@stdlib/plot/vega/base/to-json/package.json b/lib/node_modules/@stdlib/plot/vega/base/to-json/package.json new file mode 100644 index 000000000000..1855c70c0f51 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/to-json/package.json @@ -0,0 +1,58 @@ +{ + "name": "@stdlib/plot/vega/base/to-json", + "version": "0.0.0", + "description": "Serialize a list of private instance properties from a class instance to a JSON object.", + "license": "Apache-2.0", + "author": { + "name": "The Stdlib Authors", + "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" + }, + "contributors": [ + { + "name": "The Stdlib Authors", + "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" + } + ], + "main": "./lib", + "directories": { + "lib": "./lib" + }, + "types": "./docs/types", + "scripts": {}, + "homepage": "https://github.com/stdlib-js/stdlib", + "repository": { + "type": "git", + "url": "git://github.com/stdlib-js/stdlib.git" + }, + "bugs": { + "url": "https://github.com/stdlib-js/stdlib/issues" + }, + "dependencies": {}, + "devDependencies": {}, + "engines": { + "node": ">=0.10.0", + "npm": ">2.7.0" + }, + "os": [ + "aix", + "darwin", + "freebsd", + "linux", + "macos", + "openbsd", + "sunos", + "win32", + "windows" + ], + "keywords": [ + "stdlib", + "plot", + "vega", + "json", + "utilities", + "utility", + "utils", + "util" + ], + "__stdlib__": {} +} diff --git a/lib/node_modules/@stdlib/plot/vega/base/transform-validation-message/lib/index.js b/lib/node_modules/@stdlib/plot/vega/base/transform-validation-message/lib/index.js new file mode 100644 index 000000000000..0d2f9ae341ff --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/transform-validation-message/lib/index.js @@ -0,0 +1,39 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +/** +* Transform an "assignment" error message to an "option validation" error message. +* +* @module @stdlib/plot/vega/base/transform-validation-message +* +* @example +* var transformErrorMessage = require( '@stdlib/plot/vega/base/transform-validation-message' ); +* +* // TODO: example +*/ + +// MODULES // + +var main = require( './main.js' ); + + +// EXPORTS // + +module.exports = main; diff --git a/lib/node_modules/@stdlib/plot/vega/base/transform-validation-message/lib/main.js b/lib/node_modules/@stdlib/plot/vega/base/transform-validation-message/lib/main.js new file mode 100644 index 000000000000..d5ab7b113e41 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/transform-validation-message/lib/main.js @@ -0,0 +1,42 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var replace = require( '@stdlib/string/base/replace' ); + + +// MAIN // + +/** +* Transforms an "assignment" error message to an "option validation" error message. +* +* @param {string} msg - error message +* @returns {string} transformed message +*/ +function transformErrorMessage( msg ) { + var m = replace( msg, /invalid assignment\. `([^ ]+)`/, 'invalid option. `$1` option' ); + return replace( m, /\. Value:/, '. Option:' ); +} + + +// EXPORTS // + +module.exports = transformErrorMessage; diff --git a/lib/node_modules/@stdlib/plot/vega/base/transform-validation-message/package.json b/lib/node_modules/@stdlib/plot/vega/base/transform-validation-message/package.json new file mode 100644 index 000000000000..09499e73020f --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/transform-validation-message/package.json @@ -0,0 +1,57 @@ +{ + "name": "@stdlib/plot/vega/base/transform-validation-message", + "version": "0.0.0", + "description": "Transform an assignment error message to an option validation error message.", + "license": "Apache-2.0", + "author": { + "name": "The Stdlib Authors", + "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" + }, + "contributors": [ + { + "name": "The Stdlib Authors", + "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" + } + ], + "main": "./lib", + "directories": { + "lib": "./lib" + }, + "types": "./docs/types", + "scripts": {}, + "homepage": "https://github.com/stdlib-js/stdlib", + "repository": { + "type": "git", + "url": "git://github.com/stdlib-js/stdlib.git" + }, + "bugs": { + "url": "https://github.com/stdlib-js/stdlib/issues" + }, + "dependencies": {}, + "devDependencies": {}, + "engines": { + "node": ">=0.10.0", + "npm": ">2.7.0" + }, + "os": [ + "aix", + "darwin", + "freebsd", + "linux", + "macos", + "openbsd", + "sunos", + "win32", + "windows" + ], + "keywords": [ + "stdlib", + "plot", + "vega", + "utilities", + "utility", + "utils", + "util" + ], + "__stdlib__": {} +} diff --git a/lib/node_modules/@stdlib/plot/vega/base/vertical-baselines/README.md b/lib/node_modules/@stdlib/plot/vega/base/vertical-baselines/README.md new file mode 100644 index 000000000000..fd5a8a0f62f0 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/vertical-baselines/README.md @@ -0,0 +1,117 @@ +<!-- + +@license Apache-2.0 + +Copyright (c) 2025 The Stdlib Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + +--> + +# verticalBaselines + +> List of supported Vega vertical baselines. + +<!-- Section to include introductory text. Make sure to keep an empty line after the intro `section` element and another before the `/section` close. --> + +<section class="intro"> + +</section> + +<!-- /.intro --> + +<!-- Package usage documentation. --> + +<section class="usage"> + +## Usage + +```javascript +var verticalBaselines = require( '@stdlib/plot/vega/base/vertical-baselines' ); +``` + +#### verticalBaselines() + +Returns a list of vertical baselines. + +```javascript +var out = verticalBaselines(); +// returns [ 'alphabetic', 'top', 'middle', 'bottom', 'line-top', 'line-bottom' ] +``` + +</section> + +<!-- /.usage --> + +<!-- Package usage notes. Make sure to keep an empty line after the `section` element and another before the `/section` close. --> + +<section class="notes"> + +</section> + +<!-- /.notes --> + +<!-- Package usage examples. --> + +<section class="examples"> + +## Examples + +<!-- eslint no-undef: "error" --> + +```javascript +var contains = require( '@stdlib/array/base/assert/contains' ).factory; +var verticalBaselines = require( '@stdlib/plot/vega/base/vertical-baselines' ); + +var isVerticalBaseline = contains( verticalBaselines() ); + +var bool = isVerticalBaseline( 'top' ); +// returns true + +bool = isVerticalBaseline( 'middle' ); +// returns true + +bool = isVerticalBaseline( 'beep' ); +// returns false + +bool = isVerticalBaseline( 'boop' ); +// returns false +``` + +</section> + +<!-- /.examples --> + +<!-- Section to include cited references. If references are included, add a horizontal rule *before* the section. Make sure to keep an empty line after the `section` element and another before the `/section` close. --> + +<section class="references"> + +</section> + +<!-- /.references --> + +<!-- Section for related `stdlib` packages. Do not manually edit this section, as it is automatically populated. --> + +<section class="related"> + +</section> + +<!-- /.related --> + +<!-- Section for all links. Make sure to keep an empty line after the `section` element and another before the `/section` close. --> + +<section class="links"> + +</section> + +<!-- /.links --> diff --git a/lib/node_modules/@stdlib/plot/vega/base/vertical-baselines/benchmark/benchmark.js b/lib/node_modules/@stdlib/plot/vega/base/vertical-baselines/benchmark/benchmark.js new file mode 100644 index 000000000000..18bb77e7550f --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/vertical-baselines/benchmark/benchmark.js @@ -0,0 +1,48 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var bench = require( '@stdlib/bench' ); +var isStringArray = require( '@stdlib/assert/is-string-array' ).primitives; +var pkg = require( './../package.json' ).name; +var verticalBaselines = require( './../lib' ); + + +// MAIN // + +bench( pkg, function benchmark( b ) { + var out; + var i; + + b.tic(); + for ( i = 0; i < b.iterations; i++ ) { + out = verticalBaselines(); + if ( out.length < 2 ) { + b.fail( 'should return an array' ); + } + } + b.toc(); + if ( !isStringArray( out ) ) { + b.fail( 'should return an array of strings' ); + } + b.pass( 'benchmark finished' ); + b.end(); +}); diff --git a/lib/node_modules/@stdlib/plot/vega/base/vertical-baselines/docs/repl.txt b/lib/node_modules/@stdlib/plot/vega/base/vertical-baselines/docs/repl.txt new file mode 100644 index 000000000000..11674a371961 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/vertical-baselines/docs/repl.txt @@ -0,0 +1,17 @@ + +{{alias}}() + Returns a list of vertical baselines. + + Returns + ------- + out: Array<string> + List of vertical baselines. + + Examples + -------- + > var out = {{alias}}() + [ 'alphabetic', 'top', 'middle', 'bottom', 'line-top', 'line-bottom' ] + + See Also + -------- + diff --git a/lib/node_modules/@stdlib/plot/vega/base/vertical-baselines/docs/types/index.d.ts b/lib/node_modules/@stdlib/plot/vega/base/vertical-baselines/docs/types/index.d.ts new file mode 100644 index 000000000000..c334d0601f3e --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/vertical-baselines/docs/types/index.d.ts @@ -0,0 +1,35 @@ +/* +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +// TypeScript Version: 4.1 + +/** +* Returns a list of vertical baselines. +* +* @returns list of vertical baselines +* +* @example +* var list = verticalBaselines(); +* // returns [ 'alphabetic', 'top', 'middle', 'bottom', 'line-top', 'line-bottom' ] +*/ +declare function verticalBaselines(): Array<string>; + + +// EXPORTS // + +export = verticalBaselines; diff --git a/lib/node_modules/@stdlib/plot/vega/base/vertical-baselines/docs/types/test.ts b/lib/node_modules/@stdlib/plot/vega/base/vertical-baselines/docs/types/test.ts new file mode 100644 index 000000000000..82b428dfd175 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/vertical-baselines/docs/types/test.ts @@ -0,0 +1,32 @@ +/* +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +import verticalBaselines = require( './index' ); + + +// TESTS // + +// The function returns an array of strings... +{ + verticalBaselines(); // $ExpectType string[] +} + +// The compiler throws an error if the function is provided any arguments... +{ + verticalBaselines( 9 ); // $ExpectError +} diff --git a/lib/node_modules/@stdlib/plot/vega/base/vertical-baselines/examples/index.js b/lib/node_modules/@stdlib/plot/vega/base/vertical-baselines/examples/index.js new file mode 100644 index 000000000000..1079d358dc20 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/vertical-baselines/examples/index.js @@ -0,0 +1,40 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +var contains = require( '@stdlib/array/base/assert/contains' ).factory; +var verticalBaselines = require( './../lib' ); + +var isVerticalBaseline = contains( verticalBaselines() ); + +var bool = isVerticalBaseline( 'top' ); +console.log( bool ); +// => true + +bool = isVerticalBaseline( 'middle' ); +console.log( bool ); +// => true + +bool = isVerticalBaseline( 'beep' ); +console.log( bool ); +// => false + +bool = isVerticalBaseline( 'boop' ); +console.log( bool ); +// => false diff --git a/lib/node_modules/@stdlib/plot/vega/base/vertical-baselines/lib/data.json b/lib/node_modules/@stdlib/plot/vega/base/vertical-baselines/lib/data.json new file mode 100644 index 000000000000..e2bac8c32a81 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/vertical-baselines/lib/data.json @@ -0,0 +1,8 @@ +[ + "alphabetic", + "top", + "middle", + "bottom", + "line-top", + "line-bottom" +] diff --git a/lib/node_modules/@stdlib/plot/vega/base/vertical-baselines/lib/index.js b/lib/node_modules/@stdlib/plot/vega/base/vertical-baselines/lib/index.js new file mode 100644 index 000000000000..b4962e5adbe3 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/vertical-baselines/lib/index.js @@ -0,0 +1,40 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +/** +* Return a list of vertical baselines. +* +* @module @stdlib/plot/vega/base/vertical-baselines +* +* @example +* var verticalBaselines = require( '@stdlib/plot/vega/base/vertical-baselines' ); +* +* var out = verticalBaselines(); +* // returns [ 'alphabetic', 'top', 'middle', 'bottom', 'line-top', 'line-bottom' ] +*/ + +// MODULES // + +var main = require( './main.js' ); + + +// EXPORTS // + +module.exports = main; diff --git a/lib/node_modules/@stdlib/plot/vega/base/vertical-baselines/lib/main.js b/lib/node_modules/@stdlib/plot/vega/base/vertical-baselines/lib/main.js new file mode 100644 index 000000000000..7ac639141c31 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/vertical-baselines/lib/main.js @@ -0,0 +1,44 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var DATA = require( './data.json' ); + + +// MAIN // + +/** +* Returns a list of vertical baselines. +* +* @returns {StringArray} list of vertical baselines +* +* @example +* var out = orientations(); +* // returns [ 'alphabetic', 'top', 'middle', 'bottom', 'line-top', 'line-bottom' ] +*/ +function orientations() { + return DATA.slice(); +} + + +// EXPORTS // + +module.exports = orientations; diff --git a/lib/node_modules/@stdlib/plot/vega/base/vertical-baselines/package.json b/lib/node_modules/@stdlib/plot/vega/base/vertical-baselines/package.json new file mode 100644 index 000000000000..7870f8e5af76 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/vertical-baselines/package.json @@ -0,0 +1,63 @@ +{ + "name": "@stdlib/plot/vega/base/vertical-baselines", + "version": "0.0.0", + "description": "List of supported Vega vertical baselines.", + "license": "Apache-2.0", + "author": { + "name": "The Stdlib Authors", + "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" + }, + "contributors": [ + { + "name": "The Stdlib Authors", + "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" + } + ], + "main": "./lib", + "directories": { + "benchmark": "./benchmark", + "doc": "./docs", + "example": "./examples", + "lib": "./lib", + "test": "./test" + }, + "types": "./docs/types", + "scripts": {}, + "homepage": "https://github.com/stdlib-js/stdlib", + "repository": { + "type": "git", + "url": "git://github.com/stdlib-js/stdlib.git" + }, + "bugs": { + "url": "https://github.com/stdlib-js/stdlib/issues" + }, + "dependencies": {}, + "devDependencies": {}, + "engines": { + "node": ">=0.10.0", + "npm": ">2.7.0" + }, + "os": [ + "aix", + "darwin", + "freebsd", + "linux", + "macos", + "openbsd", + "sunos", + "win32", + "windows" + ], + "keywords": [ + "stdlib", + "plot", + "vega", + "vertical", + "baseline", + "utilities", + "utility", + "utils", + "util" + ], + "__stdlib__": {} +} diff --git a/lib/node_modules/@stdlib/plot/vega/base/vertical-baselines/test/test.js b/lib/node_modules/@stdlib/plot/vega/base/vertical-baselines/test/test.js new file mode 100644 index 000000000000..0398d38b8ee4 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/vertical-baselines/test/test.js @@ -0,0 +1,51 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var tape = require( 'tape' ); +var verticalBaselines = require( './../lib' ); + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof verticalBaselines, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'the function returns a list of vertical baselines', function test( t ) { + var expected; + var actual; + + expected = [ + 'alphabetic', + 'top', + 'middle', + 'bottom', + 'line-top', + 'line-bottom' + ]; + actual = verticalBaselines(); + + t.deepEqual( actual, expected, 'returns expected value' ); + t.end(); +}); diff --git a/lib/node_modules/@stdlib/plot/vega/builder/examples/index.js b/lib/node_modules/@stdlib/plot/vega/builder/examples/index.js new file mode 100644 index 000000000000..bbbde3e70b00 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/builder/examples/index.js @@ -0,0 +1,64 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +var Autosize = require( '@stdlib/plot/vega/autosize/ctor' ); +var Padding = require( '@stdlib/plot/vega/padding/ctor' ); +var Title = require( '@stdlib/plot/vega/title/ctor' ); +var LinearScale = require( '@stdlib/plot/vega/scale/linear' ); +var Axis = require( '@stdlib/plot/vega/axis/ctor' ); +var Visualization = require( './../lib' ); + +var autosize = new Autosize(); +var padding = new Padding(); +var title = new Title(); +var xScale = new LinearScale({ + 'name': 'xScale', + 'domain': [ 0, 99 ], + 'range': [ 0, 490 ] +}); +var yScale = new LinearScale({ + 'name': 'yScale', + 'domain': [ 0, 100 ], + 'range': [ 320, 0 ] +}); +var xAxis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom', + 'title': 'x' +}); +var yAxis = new Axis({ + 'scale': 'yScale', + 'orient': 'left', + 'title': 'y', + 'domain': false +}); +var viz = new Visualization({ + 'description': 'Beep boop', + 'width': 640, + 'height': 480, + 'padding': padding, + 'autosize': autosize, + 'title': title, + 'scales': [ xScale, yScale ], + 'axes': [ xAxis, yAxis ] +}); +console.log( viz.toJSON() ); + +console.log( JSON.stringify( viz.toJSON() ) ); diff --git a/lib/node_modules/@stdlib/plot/vega/builder/lib/autosize/get.js b/lib/node_modules/@stdlib/plot/vega/builder/lib/autosize/get.js new file mode 100644 index 000000000000..88a4296006fc --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/builder/lib/autosize/get.js @@ -0,0 +1,43 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable no-invalid-this */ + +'use strict'; + +// MODULES // + +var prop = require( './properties.js' ); + + +// MAIN // + +/** +* Returns the autosize configuration. +* +* @private +* @returns {(Autosize|Signal)} autosize configuration +*/ +function get() { + return this[ prop.private ]; +} + + +// EXPORTS // + +module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/vega/builder/lib/autosize/properties.js b/lib/node_modules/@stdlib/plot/vega/builder/lib/autosize/properties.js new file mode 100644 index 000000000000..64fe5ff97676 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/builder/lib/autosize/properties.js @@ -0,0 +1,33 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var property2object = require( '@stdlib/plot/vega/base/property2object' ); + + +// MAIN // + +var obj = property2object( 'autosize' ); + + +// EXPORTS // + +module.exports = obj; diff --git a/lib/node_modules/@stdlib/plot/vega/builder/lib/autosize/set.js b/lib/node_modules/@stdlib/plot/vega/builder/lib/autosize/set.js new file mode 100644 index 000000000000..3aa11d44fcb1 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/builder/lib/autosize/set.js @@ -0,0 +1,72 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable no-invalid-this */ + +'use strict'; + +// MODULES // + +var logger = require( 'debug' ); +var isAutosize = require( '@stdlib/plot/vega/base/assert/is-autosize' ); +var isString = require( '@stdlib/assert/is-nonnegative-number' ).isPrimitive; +var isObject = require( '@stdlib/assert/is-object' ); +var Autosize = require( '@stdlib/plot/vega/autosize/ctor' ); +var format = require( '@stdlib/string/format' ); +var changeEvent = require( './../change_event.js' ); +var prop = require( './properties.js' ); + + +// VARIABLES // + +var debug = logger( 'vega:builder:set:'+prop.name ); + + +// MAIN // + +/** +* Sets the autosize configuration. +* +* @private +* @param {(string|Autosize|Signal)} value - input value +* @throws {TypeError} must be either a string, an autosize instance, or a signal +* @returns {void} +*/ +function set( value ) { + if ( isString( value ) ) { + value = new Autosize({ + 'type': value + }); + } else if ( isObject( value ) ) { + // TODO: add signal support + } else if ( !isAutosize( value ) ) { + throw new TypeError( format( 'invalid assignment. `%s` must be either a string, an autosize instance, or a signal. Value: `%s`.', prop.name, value ) ); + } + if ( value !== this[ prop.private ] ) { + this._removeChangeListener( this[ prop.private ] ); + debug( 'Current value: %s. New value: %s.', JSON.stringify( this[ prop.private ] ), JSON.stringify( value ) ); + this[ prop.private ] = value; + this.emit( 'change', changeEvent( prop.name ) ); + this._addChangeListener( this[ prop.private ] ); + } +} + + +// EXPORTS // + +module.exports = set; diff --git a/lib/node_modules/@stdlib/plot/vega/builder/lib/axes/get.js b/lib/node_modules/@stdlib/plot/vega/builder/lib/axes/get.js new file mode 100644 index 000000000000..9e3540187445 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/builder/lib/axes/get.js @@ -0,0 +1,44 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable no-invalid-this */ + +'use strict'; + +// MODULES // + +var copy = require( '@stdlib/array/base/copy-indexed' ); +var prop = require( './properties.js' ); + + +// MAIN // + +/** +* Returns the coordinate axes. +* +* @private +* @returns {Array<Scale>} axes +*/ +function get() { + return copy( this[ prop.private ] ); +} + + +// EXPORTS // + +module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/vega/builder/lib/axes/properties.js b/lib/node_modules/@stdlib/plot/vega/builder/lib/axes/properties.js new file mode 100644 index 000000000000..b92ae702dc7f --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/builder/lib/axes/properties.js @@ -0,0 +1,33 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var property2object = require( '@stdlib/plot/vega/base/property2object' ); + + +// MAIN // + +var obj = property2object( 'axes' ); + + +// EXPORTS // + +module.exports = obj; diff --git a/lib/node_modules/@stdlib/plot/vega/builder/lib/axes/set.js b/lib/node_modules/@stdlib/plot/vega/builder/lib/axes/set.js new file mode 100644 index 000000000000..efa38a8023cf --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/builder/lib/axes/set.js @@ -0,0 +1,67 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable no-invalid-this */ + +'use strict'; + +// MODULES // + +var logger = require( 'debug' ); +var isEmptyArrayLikeObject = require( '@stdlib/assert/is-empty-array-like-object' ); +var hasEqualValues = require( '@stdlib/array/base/assert/has-equal-values' ); +var isAxisArray = require( '@stdlib/plot/vega/base/assert/is-axis-array' ); +var copy = require( '@stdlib/array/base/copy' ); +var format = require( '@stdlib/string/format' ); +var changeEvent = require( './../change_event.js' ); +var prop = require( './properties.js' ); + + +// VARIABLES // + +var debug = logger( 'vega:builder:set:'+prop.name ); + + +// MAIN // + +/** +* Sets the visualization coordinate axes. +* +* @private +* @param {ArrayLikeObject<Axis>} value - input value +* @throws {TypeError} must be an array of axis instances +* @returns {void} +*/ +function set( value ) { + if ( !isAxisArray( value ) && !isEmptyArrayLikeObject( value ) ) { + throw new TypeError( format( 'invalid assignment. `%s` must be an array of axis instances. Value: `%s`.', prop.name, value ) ); + } + value = copy( value ); + if ( !hasEqualValues( value, this[ prop.private ] ) ) { + this._removeChangeListeners( this[ prop.private ] ); + debug( 'Current value: %s. New value: %s.', JSON.stringify( this[ prop.private ] ), JSON.stringify( value ) ); + this[ prop.private ] = value; + this.emit( 'change', changeEvent( prop.name ) ); + this._addChangeListeners( this[ prop.private ] ); + } +} + + +// EXPORTS // + +module.exports = set; diff --git a/lib/node_modules/@stdlib/plot/vega/builder/lib/background/get.js b/lib/node_modules/@stdlib/plot/vega/builder/lib/background/get.js new file mode 100644 index 000000000000..7c7ab185dd2f --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/builder/lib/background/get.js @@ -0,0 +1,43 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable no-invalid-this */ + +'use strict'; + +// MODULES // + +var prop = require( './properties.js' ); + + +// MAIN // + +/** +* Returns the visualization background color. +* +* @private +* @returns {string} color +*/ +function get() { + return this[ prop.private ]; +} + + +// EXPORTS // + +module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/vega/builder/lib/background/properties.js b/lib/node_modules/@stdlib/plot/vega/builder/lib/background/properties.js new file mode 100644 index 000000000000..d24afd9496b9 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/builder/lib/background/properties.js @@ -0,0 +1,33 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var property2object = require( '@stdlib/plot/vega/base/property2object' ); + + +// MAIN // + +var obj = property2object( 'background' ); + + +// EXPORTS // + +module.exports = obj; diff --git a/lib/node_modules/@stdlib/plot/vega/builder/lib/background/set.js b/lib/node_modules/@stdlib/plot/vega/builder/lib/background/set.js new file mode 100644 index 000000000000..54438d472434 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/builder/lib/background/set.js @@ -0,0 +1,61 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable no-invalid-this */ + +'use strict'; + +// MODULES // + +var logger = require( 'debug' ); +var isString = require( '@stdlib/assert/is-string' ).isPrimitive; +var format = require( '@stdlib/string/format' ); +var changeEvent = require( './../change_event.js' ); +var prop = require( './properties.js' ); + + +// VARIABLES // + +var debug = logger( 'vega:builder:set:'+prop.name ); + + +// MAIN // + +/** +* Sets the visualization background color. +* +* @private +* @param {string} value - input value +* @throws {TypeError} must be a string +* @returns {void} +*/ +function set( value ) { + if ( !isString( value ) ) { + throw new TypeError( format( 'invalid assignment. `%s` must be a string. Value: `%s`.', prop.name, value ) ); + } + if ( value !== this[ prop.private ] ) { + debug( 'Current value: %s. New value: %s.', this[ prop.private ], value ); + this[ prop.private ] = value; + this.emit( 'change', changeEvent( prop.name ) ); + } +} + + +// EXPORTS // + +module.exports = set; diff --git a/lib/node_modules/@stdlib/plot/vega/builder/lib/change_event.js b/lib/node_modules/@stdlib/plot/vega/builder/lib/change_event.js new file mode 100644 index 000000000000..e406e971fe4e --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/builder/lib/change_event.js @@ -0,0 +1,41 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MAIN // + +/** +* Returns a new change event object. +* +* @private +* @param {string} property - property name +* @returns {Object} event object +*/ +function event( property ) { // eslint-disable-line stdlib/no-redeclare + return { + 'type': 'update', + 'source': 'visualization', + 'property': property + }; +} + + +// EXPORTS // + +module.exports = event; diff --git a/lib/node_modules/@stdlib/plot/vega/builder/lib/config/get.js b/lib/node_modules/@stdlib/plot/vega/builder/lib/config/get.js new file mode 100644 index 000000000000..640865dcbd6f --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/builder/lib/config/get.js @@ -0,0 +1,43 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable no-invalid-this */ + +'use strict'; + +// MODULES // + +var prop = require( './properties.js' ); + + +// MAIN // + +/** +* Returns the visualization theme. +* +* @private +* @returns {Config} theme +*/ +function get() { + return this[ prop.private ]; +} + + +// EXPORTS // + +module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/vega/builder/lib/config/properties.js b/lib/node_modules/@stdlib/plot/vega/builder/lib/config/properties.js new file mode 100644 index 000000000000..c62138888dc3 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/builder/lib/config/properties.js @@ -0,0 +1,33 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var property2object = require( '@stdlib/plot/vega/base/property2object' ); + + +// MAIN // + +var obj = property2object( 'config' ); + + +// EXPORTS // + +module.exports = obj; diff --git a/lib/node_modules/@stdlib/plot/vega/builder/lib/config/set.js b/lib/node_modules/@stdlib/plot/vega/builder/lib/config/set.js new file mode 100644 index 000000000000..1b7c09470c4f --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/builder/lib/config/set.js @@ -0,0 +1,63 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable no-invalid-this */ + +'use strict'; + +// MODULES // + +var logger = require( 'debug' ); +var isObject = require( '@stdlib/assert/is-object' ); +var format = require( '@stdlib/string/format' ); +var changeEvent = require( './../change_event.js' ); +var prop = require( './properties.js' ); + + +// VARIABLES // + +var debug = logger( 'vega:builder:set:'+prop.name ); + + +// MAIN // + +/** +* Sets the visualization theme. +* +* @private +* @param {Config} value - input value +* @throws {TypeError} must be a configuration instance +* @returns {void} +*/ +function set( value ) { + if ( !isObject( value ) ) { // FIXME: validate configuration instance + throw new TypeError( format( 'invalid assignment. `%s` must be a configuration instance. Value: `%s`.', prop.name, value ) ); + } + if ( value !== this[ prop.private ] ) { + this._removeChangeListener( this[ prop.private ] ); + debug( 'Current value: %s. New value: %s.', JSON.stringify( this[ prop.private ] ), JSON.stringify( value ) ); + this[ prop.private ] = value; + this.emit( 'change', changeEvent( prop.name ) ); + this._addChangeListener( this[ prop.private ] ); + } +} + + +// EXPORTS // + +module.exports = set; diff --git a/lib/node_modules/@stdlib/plot/vega/builder/lib/data/get.js b/lib/node_modules/@stdlib/plot/vega/builder/lib/data/get.js new file mode 100644 index 000000000000..6fcbad9273de --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/builder/lib/data/get.js @@ -0,0 +1,45 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable no-invalid-this */ + +'use strict'; + +// MODULES // + +var copy = require( '@stdlib/array/base/copy-indexed' ); +var prop = require( './properties.js' ); + + +// MAIN // + +// eslint-disable-next-line stdlib/jsdoc-typedef-typos +/** +* Returns a list of data set definitions and transforms. +* +* @private +* @returns {Array<Data>} data set definitions and transforms +*/ +function get() { + return copy( this[ prop.private ] ); +} + + +// EXPORTS // + +module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/vega/builder/lib/data/properties.js b/lib/node_modules/@stdlib/plot/vega/builder/lib/data/properties.js new file mode 100644 index 000000000000..f2a3cb70b387 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/builder/lib/data/properties.js @@ -0,0 +1,33 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var property2object = require( '@stdlib/plot/vega/base/property2object' ); + + +// MAIN // + +var obj = property2object( 'data' ); + + +// EXPORTS // + +module.exports = obj; diff --git a/lib/node_modules/@stdlib/plot/vega/builder/lib/data/set.js b/lib/node_modules/@stdlib/plot/vega/builder/lib/data/set.js new file mode 100644 index 000000000000..e805fd160fa0 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/builder/lib/data/set.js @@ -0,0 +1,67 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable no-invalid-this */ + +'use strict'; + +// MODULES // + +var logger = require( 'debug' ); +var isArrayLikeObject = require( '@stdlib/assert/is-array-like-object' ); +var hasEqualValues = require( '@stdlib/array/base/assert/has-equal-values' ); +var copy = require( '@stdlib/array/base/copy' ); +var format = require( '@stdlib/string/format' ); +var changeEvent = require( './../change_event.js' ); +var prop = require( './properties.js' ); + + +// VARIABLES // + +var debug = logger( 'vega:builder:set:'+prop.name ); + + +// MAIN // + +// eslint-disable-next-line stdlib/jsdoc-typedef-typos +/** +* Sets data set definitions and transforms. +* +* @private +* @param {ArrayLikeObject<Data>} value - input value +* @throws {TypeError} must be an array of data +* @returns {void} +*/ +function set( value ) { + if ( !isArrayLikeObject( value ) ) { // FIXME: validate array of data or an empty array + throw new TypeError( format( 'invalid assignment. `%s` must be an array of data. Value: `%s`.', prop.name, value ) ); + } + value = copy( value ); + if ( !hasEqualValues( value, this[ prop.private ] ) ) { + this._removeChangeListeners( this[ prop.private ] ); + debug( 'Current value: %s. New value: %s.', JSON.stringify( this[ prop.private ] ), JSON.stringify( value ) ); + this[ prop.private ] = value; + this.emit( 'change', changeEvent( prop.name ) ); + this._addChangeListeners( this[ prop.private ] ); + } +} + + +// EXPORTS // + +module.exports = set; diff --git a/lib/node_modules/@stdlib/plot/vega/builder/lib/defaults.js b/lib/node_modules/@stdlib/plot/vega/builder/lib/defaults.js new file mode 100644 index 000000000000..331fd13deeb1 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/builder/lib/defaults.js @@ -0,0 +1,100 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var Autosize = require( '@stdlib/plot/vega/autosize/ctor' ); +var Padding = require( '@stdlib/plot/vega/padding/ctor' ); +var Title = require( '@stdlib/plot/vega/title/ctor' ); + + +// MAIN // + +/** +* Returns defaults. +* +* @private +* @returns {Object} default options +* +* @example +* var o = defaults(); +* // returns {...} +*/ +function defaults() { + return { + // Schema URL: + '$schema': 'https://vega.github.io/schema/vega/v6.json', + + // Autosize configuration: + 'autosize': new Autosize(), + + // Coordinate axes: + 'axes': [], + + 'background': '', + + // Visualization theme: + 'config': {}, + + // Data set definitions and transforms: + 'data': [], + + // Visualization description: + 'description': '', + + // Visual encodings: + 'encode': {}, + + // Height (in pixels): + 'height': 0, + + // Legends: + 'legends': [], + + // Graphical marks: + 'marks': [], + + // Padding (in pixels): + 'padding': new Padding(), + + // Cartographic projections: + 'projections': [], + + // Visualization scales: + 'scales': [], + + // Signals for parameterizing a visualization: + 'signals': [], + + // Visualization title: + 'title': new Title(), + + // Optional meta data: + 'usermeta': {}, + + // Width (in pixels): + 'width': 0 + }; +} + + +// EXPORTS // + +module.exports = defaults; diff --git a/lib/node_modules/@stdlib/plot/vega/builder/lib/description/get.js b/lib/node_modules/@stdlib/plot/vega/builder/lib/description/get.js new file mode 100644 index 000000000000..b4d189a93686 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/builder/lib/description/get.js @@ -0,0 +1,43 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable no-invalid-this */ + +'use strict'; + +// MODULES // + +var prop = require( './properties.js' ); + + +// MAIN // + +/** +* Returns the visualization description. +* +* @private +* @returns {string} description +*/ +function get() { + return this[ prop.private ]; +} + + +// EXPORTS // + +module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/vega/builder/lib/description/properties.js b/lib/node_modules/@stdlib/plot/vega/builder/lib/description/properties.js new file mode 100644 index 000000000000..4df8dba29cc1 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/builder/lib/description/properties.js @@ -0,0 +1,33 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var property2object = require( '@stdlib/plot/vega/base/property2object' ); + + +// MAIN // + +var obj = property2object( 'description' ); + + +// EXPORTS // + +module.exports = obj; diff --git a/lib/node_modules/@stdlib/plot/vega/builder/lib/description/set.js b/lib/node_modules/@stdlib/plot/vega/builder/lib/description/set.js new file mode 100644 index 000000000000..0239e43c2526 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/builder/lib/description/set.js @@ -0,0 +1,61 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable no-invalid-this */ + +'use strict'; + +// MODULES // + +var logger = require( 'debug' ); +var isString = require( '@stdlib/assert/is-string' ).isPrimitive; +var format = require( '@stdlib/string/format' ); +var changeEvent = require( './../change_event.js' ); +var prop = require( './properties.js' ); + + +// VARIABLES // + +var debug = logger( 'vega:builder:set:'+prop.name ); + + +// MAIN // + +/** +* Sets the visualization description. +* +* @private +* @param {string} value - input value +* @throws {TypeError} must be a string +* @returns {void} +*/ +function set( value ) { + if ( !isString( value ) ) { + throw new TypeError( format( 'invalid assignment. `%s` must be a string. Value: `%s`.', prop.name, value ) ); + } + if ( value !== this[ prop.private ] ) { + debug( 'Current value: %s. New value: %s.', this[ prop.private ], value ); + this[ prop.private ] = value; + this.emit( 'change', changeEvent( prop.name ) ); + } +} + + +// EXPORTS // + +module.exports = set; diff --git a/lib/node_modules/@stdlib/plot/vega/builder/lib/encode/get.js b/lib/node_modules/@stdlib/plot/vega/builder/lib/encode/get.js new file mode 100644 index 000000000000..940b637b8ce7 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/builder/lib/encode/get.js @@ -0,0 +1,43 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable no-invalid-this */ + +'use strict'; + +// MODULES // + +var prop = require( './properties.js' ); + + +// MAIN // + +/** +* Returns encoding directives for the visual properties of the top-level group mark representing a visualization's data rectangle. +* +* @private +* @returns {Encode} encoding directives +*/ +function get() { + return this[ prop.private ]; +} + + +// EXPORTS // + +module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/vega/builder/lib/encode/properties.js b/lib/node_modules/@stdlib/plot/vega/builder/lib/encode/properties.js new file mode 100644 index 000000000000..889233bec2b9 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/builder/lib/encode/properties.js @@ -0,0 +1,33 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var property2object = require( '@stdlib/plot/vega/base/property2object' ); + + +// MAIN // + +var obj = property2object( 'encode' ); + + +// EXPORTS // + +module.exports = obj; diff --git a/lib/node_modules/@stdlib/plot/vega/builder/lib/encode/set.js b/lib/node_modules/@stdlib/plot/vega/builder/lib/encode/set.js new file mode 100644 index 000000000000..cb0a3cbfce65 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/builder/lib/encode/set.js @@ -0,0 +1,63 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable no-invalid-this */ + +'use strict'; + +// MODULES // + +var logger = require( 'debug' ); +var isObject = require( '@stdlib/assert/is-object' ); +var format = require( '@stdlib/string/format' ); +var changeEvent = require( './../change_event.js' ); +var prop = require( './properties.js' ); + + +// VARIABLES // + +var debug = logger( 'vega:builder:set:'+prop.name ); + + +// MAIN // + +/** +* Sets encoding directives for the visual properties of the top-level group mark representing a visualization's data rectangle. +* +* @private +* @param {Encode} value - input value +* @throws {TypeError} must be an encoding object +* @returns {void} +*/ +function set( value ) { + if ( !isObject( value ) ) { // FIXME: validate encoding object + throw new TypeError( format( 'invalid assignment. `%s` must be a valid encoding. Value: `%s`.', prop.name, value ) ); + } + if ( value !== this[ prop.private ] ) { + this._removeChangeListener( this[ prop.private ] ); + debug( 'Current value: %s. New value: %s.', JSON.stringify( this[ prop.private ] ), JSON.stringify( value ) ); + this[ prop.private ] = value; + this.emit( 'change', changeEvent( prop.name ) ); + this._addChangeListener( this[ prop.private ] ); + } +} + + +// EXPORTS // + +module.exports = set; diff --git a/lib/node_modules/@stdlib/plot/vega/builder/lib/height/get.js b/lib/node_modules/@stdlib/plot/vega/builder/lib/height/get.js new file mode 100644 index 000000000000..6717cedb4153 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/builder/lib/height/get.js @@ -0,0 +1,43 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable no-invalid-this */ + +'use strict'; + +// MODULES // + +var prop = require( './properties.js' ); + + +// MAIN // + +/** +* Returns the visualization height (in pixels). +* +* @private +* @returns {(NonNegativeNumber|Signal)} height +*/ +function get() { + return this[ prop.private ]; +} + + +// EXPORTS // + +module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/vega/builder/lib/height/properties.js b/lib/node_modules/@stdlib/plot/vega/builder/lib/height/properties.js new file mode 100644 index 000000000000..1a2e51f8a821 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/builder/lib/height/properties.js @@ -0,0 +1,33 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var property2object = require( '@stdlib/plot/vega/base/property2object' ); + + +// MAIN // + +var obj = property2object( 'height' ); + + +// EXPORTS // + +module.exports = obj; diff --git a/lib/node_modules/@stdlib/plot/vega/builder/lib/height/set.js b/lib/node_modules/@stdlib/plot/vega/builder/lib/height/set.js new file mode 100644 index 000000000000..5d9d9571f4de --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/builder/lib/height/set.js @@ -0,0 +1,62 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable no-invalid-this */ + +'use strict'; + +// MODULES // + +var logger = require( 'debug' ); +var isNonNegativeNumber = require( '@stdlib/assert/is-nonnegative-number' ).isPrimitive; +var isObject = require( '@stdlib/assert/is-object' ); +var format = require( '@stdlib/string/format' ); +var changeEvent = require( './../change_event.js' ); +var prop = require( './properties.js' ); + + +// VARIABLES // + +var debug = logger( 'vega:builder:set:'+prop.name ); + + +// MAIN // + +/** +* Sets the visualization height (in pixels). +* +* @private +* @param {(NonNegativeNumber|Signal)} value - input value +* @throws {TypeError} must be either a nonnegative number or a signal +* @returns {void} +*/ +function set( value ) { + if ( !isNonNegativeNumber( value ) && !isObject( value ) ) { + throw new TypeError( format( 'invalid assignment. `%s` must be either a nonnegative number or a signal. Value: `%s`.', prop.name, value ) ); + } + if ( value !== this[ prop.private ] ) { + debug( 'Current value: %s. New value: %s.', this[ prop.private ], value ); + this[ prop.private ] = value; + this.emit( 'change', changeEvent( prop.name ) ); + } +} + + +// EXPORTS // + +module.exports = set; diff --git a/lib/node_modules/@stdlib/plot/vega/builder/lib/index.js b/lib/node_modules/@stdlib/plot/vega/builder/lib/index.js new file mode 100644 index 000000000000..ff245a41cf23 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/builder/lib/index.js @@ -0,0 +1,42 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +/** +* Visualization constructor. +* +* @module @stdlib/plot/vega/builder +* +* @example +* var Visualization = require( '@stdlib/plot/vega/builder' ); +* +* var viz = new Visualization({ +* 'description': 'Beep boop' +* }); +* // returns <Visualization> +*/ + +// MODULES // + +var main = require( './main.js' ); + + +// EXPORTS // + +module.exports = main; diff --git a/lib/node_modules/@stdlib/plot/vega/builder/lib/legends/get.js b/lib/node_modules/@stdlib/plot/vega/builder/lib/legends/get.js new file mode 100644 index 000000000000..f416b2ab91e6 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/builder/lib/legends/get.js @@ -0,0 +1,44 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable no-invalid-this */ + +'use strict'; + +// MODULES // + +var copy = require( '@stdlib/array/base/copy-indexed' ); +var prop = require( './properties.js' ); + + +// MAIN // + +/** +* Returns a list of legends. +* +* @private +* @returns {Array<Legend>} legends +*/ +function get() { + return copy( this[ prop.private ] ); +} + + +// EXPORTS // + +module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/vega/builder/lib/legends/properties.js b/lib/node_modules/@stdlib/plot/vega/builder/lib/legends/properties.js new file mode 100644 index 000000000000..2478bcb32dd5 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/builder/lib/legends/properties.js @@ -0,0 +1,33 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var property2object = require( '@stdlib/plot/vega/base/property2object' ); + + +// MAIN // + +var obj = property2object( 'legends' ); + + +// EXPORTS // + +module.exports = obj; diff --git a/lib/node_modules/@stdlib/plot/vega/builder/lib/legends/set.js b/lib/node_modules/@stdlib/plot/vega/builder/lib/legends/set.js new file mode 100644 index 000000000000..47a9d99168ee --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/builder/lib/legends/set.js @@ -0,0 +1,66 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable no-invalid-this */ + +'use strict'; + +// MODULES // + +var logger = require( 'debug' ); +var isArrayLikeObject = require( '@stdlib/assert/is-array-like-object' ); +var hasEqualValues = require( '@stdlib/array/base/assert/has-equal-values' ); +var copy = require( '@stdlib/array/base/copy' ); +var format = require( '@stdlib/string/format' ); +var changeEvent = require( './../change_event.js' ); +var prop = require( './properties.js' ); + + +// VARIABLES // + +var debug = logger( 'vega:builder:set:'+prop.name ); + + +// MAIN // + +/** +* Sets visualization legends. +* +* @private +* @param {ArrayLikeObject<Legend>} value - input value +* @throws {TypeError} must be an array of legends +* @returns {void} +*/ +function set( value ) { + if ( !isArrayLikeObject( value ) ) { // FIXME: validate array of legends or an empty array + throw new TypeError( format( 'invalid assignment. `%s` must be an array of legends. Value: `%s`.', prop.name, value ) ); + } + value = copy( value ); + if ( !hasEqualValues( value, this[ prop.private ] ) ) { + this._removeChangeListeners( this[ prop.private ] ); + debug( 'Current value: %s. New value: %s.', JSON.stringify( this[ prop.private ] ), JSON.stringify( value ) ); + this[ prop.private ] = value; + this.emit( 'change', changeEvent( prop.name ) ); + this._addChangeListeners( this[ prop.private ] ); + } +} + + +// EXPORTS // + +module.exports = set; diff --git a/lib/node_modules/@stdlib/plot/vega/builder/lib/main.js b/lib/node_modules/@stdlib/plot/vega/builder/lib/main.js new file mode 100644 index 000000000000..abdcd383e216 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/builder/lib/main.js @@ -0,0 +1,611 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable no-restricted-syntax, no-invalid-this */ + +'use strict'; + +// MODULES // + +var EventEmitter = require( 'events' ).EventEmitter; +var logger = require( 'debug' ); +var isObject = require( '@stdlib/assert/is-object' ); +var setNonEnumerableReadOnly = require( '@stdlib/utils/define-nonenumerable-read-only-property' ); +var setNonEnumerableReadOnlyAccessor = require( '@stdlib/utils/define-nonenumerable-read-only-accessor' ); // eslint-disable-line id-length +var setReadWriteAccessor = require( '@stdlib/utils/define-read-write-accessor' ); +var setReadOnlyAccessor = require( '@stdlib/utils/define-read-only-accessor' ); +var hasProp = require( '@stdlib/assert/has-property' ); +var inherit = require( '@stdlib/utils/inherit' ); +var objectKeys = require( '@stdlib/utils/keys' ); +var transformErrorMessage = require( '@stdlib/plot/vega/base/transform-validation-message' ); +var instance2json = require( '@stdlib/plot/vega/base/to-json' ); +var format = require( '@stdlib/string/format' ); +var properties = require( './properties.json' ); +var defaults = require( './defaults.js' ); + +// Note: keep the following in alphabetical order according to the `require` path... +var getAutosize = require( './autosize/get.js' ); +var setAutosize = require( './autosize/set.js' ); +var getAxes = require( './axes/get.js' ); +var setAxes = require( './axes/set.js' ); + +var getBackground = require( './background/get.js' ); +var setBackground = require( './background/set.js' ); + +var getConfig = require( './config/get.js' ); +var setConfig = require( './config/set.js' ); + +var getData = require( './data/get.js' ); +var setData = require( './data/set.js' ); +var getDescription = require( './description/get.js' ); +var setDescription = require( './description/set.js' ); + +var getEncode = require( './encode/get.js' ); +var setEncode = require( './encode/set.js' ); + +var getHeight = require( './height/get.js' ); +var setHeight = require( './height/set.js' ); + +var getLegends = require( './legends/get.js' ); +var setLegends = require( './legends/set.js' ); + +var getMarks = require( './marks/get.js' ); +var setMarks = require( './marks/set.js' ); + +var getPadding = require( './padding/get.js' ); +var setPadding = require( './padding/set.js' ); +var getProjections = require( './projections/get.js' ); +var setProjections = require( './projections/set.js' ); +var getProperties = require( './properties/get.js' ); + +var getScales = require( './scales/get.js' ); +var setScales = require( './scales/set.js' ); +var getSchema = require( './schema/get.js' ); +var getSignals = require( './signals/get.js' ); +var setSignals = require( './signals/set.js' ); + +var getTitle = require( './title/get.js' ); +var setTitle = require( './title/set.js' ); + +var getUserMeta = require( './usermeta/get.js' ); +var setUserMeta = require( './usermeta/set.js' ); + +var getWidth = require( './width/get.js' ); +var setWidth = require( './width/set.js' ); + + +// VARIABLES // + +var debug = logger( 'vega:builder:main' ); + + +// MAIN // + +/** +* Visualization constructor. +* +* @constructor +* @param {Options} options - constructor options +* @param {(string|Autosize|Signal)} [options.autosize='pad'] - specifies to determine the visualization size +* @param {Array<Axis>} [options.axes] - coordinate axes +* @param {(string|Signal)} [options.background] - background color of the entire visualization view +* @param {Object} [options.config] - configuration settings for default mark, axis, and legend values +* @param {Array<Object>} [options.data] - data set definitions and transforms +* @param {string} [options.description=''] - visualization description +* @param {Object} [options.encode] - encoding directives +* @param {(NonNegativeNumber|Signal)} [options.height] - visualization height (in pixels) +* @param {Array<Legend>} [options.legends] - visualization legends +* @param {Array<Mark>} [options.marks] - graphical marks +* @param {(number|Padding|Signal)} [options.padding] - padding (in pixels) around the visualization +* @param {Array<Projection>} [options.projections] - cartographic projections +* @param {Array<Scale>} [options.scales] - visualization scales +* @param {Array<Signal>} [options.signals] - dynamic variables which parameterize the visualization +* @param {Title} [options.title] - visualization title +* @param {Object} [options.usermeta] - optional metadata +* @param {(NonNegativeNumber|Signal)} [options.width] - visualization width (in pixels) +* @throws {TypeError} options argument must be an object +* @throws {Error} must provide valid options +* @returns {Visualization} visualization instance +* +* @example +* var viz = new Visualization(); +* // returns <Visualization> +*/ +function Visualization( options ) { + var self; + var keys; + var opts; + var k; + var v; + var i; + if ( !( this instanceof Visualization ) ) { + if ( arguments.length ) { + return new Visualization( options ); + } + return new Visualization(); + } + self = this; + EventEmitter.call( this ); + + // Resolve the default configuration: + opts = defaults(); + + // Set internal properties according to the default configuration... + keys = objectKeys( opts ); + for ( i = 0; i < keys.length; i++ ) { + k = keys[ i ]; + this[ '_'+k ] = opts[ k ]; + } + // Define an internal change event listener: + this._onChange = onChange; + + // Validate provided options by attempting to assign option values to corresponding fields... + if ( arguments.length ) { + if ( !isObject( options ) ) { + throw new TypeError( format( 'invalid argument. Options argument must be an object. Value: `%s`.', options ) ); + } + for ( i = 0; i < properties.length; i++ ) { + k = properties[ i ]; + if ( !hasProp( options, k ) ) { + continue; + } + v = options[ k ]; + try { + this[ k ] = v; + } catch ( err ) { + debug( 'Encountered an error. Error: %s', err.message ); + + // FIXME: retain thrown error type + throw new Error( transformErrorMessage( err.message ) ); + } + } + } + return this; + + /** + * Callback invoked upon a change event. + * + * @private + * @param {Object} event - event object + */ + function onChange( event ) { + debug( 'Received a change event: %s', JSON.stringify( event ) ); + self.emit( 'change', event ); + } +} + +/* +* Inherit from the `EventEmitter` prototype. +*/ +inherit( Visualization, EventEmitter ); + +/** +* Constructor name. +* +* @private +* @name name +* @memberof Visualization +* @readonly +* @type {string} +*/ +setNonEnumerableReadOnly( Visualization, 'name', 'Visualization' ); + +/** +* Adds an internal listener to a change event on a child instance. +* +* @private +* @name _addChangeListener +* @memberof Visualization.prototype +* @type {Function} +* @param {Object} emitter - event emitter +* @returns {Visualization} visualization instance +*/ +setNonEnumerableReadOnly( Visualization.prototype, '_addChangeListener', function addChangeListener( emitter ) { + emitter.on( 'change', this._onChange ); + return this; +}); + +/** +* Adds internal listeners to change events on child instances. +* +* @private +* @name _addChangeListeners +* @memberof Visualization.prototype +* @type {Function} +* @param {ArrayLikeObject<Object>} emitters - list of event emitters +* @returns {Visualization} visualization instance +*/ +setNonEnumerableReadOnly( Visualization.prototype, '_addChangeListeners', function addChangeListeners( emitters ) { + var i; + for ( i = 0; i < emitters.length; i++ ) { + this._addChangeListener( emitters[ i ] ); + } + return this; +}); + +/** +* Removes an internal listener to a change event on a child instance. +* +* @private +* @name _removeChangeListener +* @memberof Visualization.prototype +* @type {Function} +* @param {Object} emitter - event emitter +* @returns {Visualization} visualization instance +*/ +setNonEnumerableReadOnly( Visualization.prototype, '_removeChangeListener', function removeChangeListener( emitter ) { + emitter.removeListener( 'change', this._onChange ); + return this; +}); + +/** +* Removes internal listeners to change events on child instances. +* +* @private +* @name _removeChangeListeners +* @memberof Visualization.prototype +* @type {Function} +* @param {ArrayLikeObject<Object>} emitters - list of event emitters +* @returns {Visualization} visualization instance +*/ +setNonEnumerableReadOnly( Visualization.prototype, '_removeChangeListeners', function removeChangeListeners( emitters ) { + var i; + for ( i = 0; i < emitters.length; i++ ) { + this._removeChangeListener( emitters[ i ] ); + } + return this; +}); + +/** +* Visualization schema URL. +* +* @name $schema +* @memberof Visualization.prototype +* @type {string} +* +* @example +* var viz = new Visualization(); +* +* var v = viz.$schema; +* // returns '...' +*/ +setReadOnlyAccessor( Visualization.prototype, '$schema', getSchema ); + +/** +* Visualization autosize configuration. +* +* @name autosize +* @memberof Visualization.prototype +* @type {(Signal|Autosize)} +* +* @example +* var Autosize = require( '@stdlib/plot/vega/autosize/ctor' ); +* +* var autosize = new Autosize(); +* var viz = new Visualization({ +* 'autosize': autosize +* }); +* +* var v = viz.autosize; +* // returns <Autosize> +*/ +setReadWriteAccessor( Visualization.prototype, 'autosize', getAutosize, setAutosize ); + +/** +* Visualization coordinate axes. +* +* @name axes +* @memberof Visualization.prototype +* @type {Array<Axis>} +* +* @example +* var Axis = require( '@stdlib/plot/vega/axis/ctor' ); +* +* var axis = new Axis({ +* 'scale': 'xScale', +* 'orient': 'bottom' +* }); +* var viz = new Visualization({ +* 'axes': [ axis ] +* }); +* +* var v = viz.axes; +* // returns [ <Axis> ] +*/ +setReadWriteAccessor( Visualization.prototype, 'axes', getAxes, setAxes ); + +/** +* Visualization background color. +* +* @name background +* @memberof Visualization.prototype +* @type {string} +* @default '' +* +* @example +* var viz = new Visualization({ +* 'background': 'white' +* }); +* +* var v = viz.background; +* // returns 'white' +*/ +setReadWriteAccessor( Visualization.prototype, 'background', getBackground, setBackground ); + +/** +* Visualization theme. +* +* @name config +* @memberof Visualization.prototype +* @type {Config} +* +* @example +* // TODO: example +*/ +setReadWriteAccessor( Visualization.prototype, 'config', getConfig, setConfig ); + +// eslint-disable-next-line stdlib/empty-line-before-comment, stdlib/jsdoc-typedef-typos +/** +* Data set definitions and transforms. +* +* @name data +* @memberof Visualization.prototype +* @type {Array<Data>} +* +* @example +* // TODO: example +*/ +setReadWriteAccessor( Visualization.prototype, 'data', getData, setData ); + +/** +* Visualization description. +* +* @name description +* @memberof Visualization.prototype +* @type {string} +* @default '' +* +* @example +* var viz = new Visualization({ +* 'description': 'Foo Bar' +* }); +* +* var v = viz.description; +* // returns 'Foo Bar' +*/ +setReadWriteAccessor( Visualization.prototype, 'description', getDescription, setDescription ); + +/** +* Encoding directives for the visual properties of the top-level group mark representing a visualization's data rectangle. +* +* @name encode +* @memberof Visualization.prototype +* @type {Encode} +* +* @example +* // TODO: example +*/ +setReadWriteAccessor( Visualization.prototype, 'encode', getEncode, setEncode ); + +/** +* Visualization height (in pixels). +* +* @name height +* @memberof Visualization.prototype +* @type {(NonNegativeNumber|Signal)} +* +* @example +* var viz = new Visualization({ +* 'height': 480 +* }); +* +* var v = viz.height; +* // returns 480 +*/ +setReadWriteAccessor( Visualization.prototype, 'height', getHeight, setHeight ); + +/** +* Visualization legends. +* +* @name legends +* @memberof Visualization.prototype +* @type {Array<Legend>} +* +* @example +* // TODO: example +*/ +setReadWriteAccessor( Visualization.prototype, 'legends', getLegends, setLegends ); + +/** +* Graphical marks which visually encode data using geometric primitives. +* +* @name marks +* @memberof Visualization.prototype +* @type {Array<Mark>} +* +* @example +* // TODO: example +*/ +setReadWriteAccessor( Visualization.prototype, 'marks', getMarks, setMarks ); + +/** +* Visualization padding. +* +* @name padding +* @memberof Visualization.prototype +* @type {(Signal|Padding)} +* +* @example +* var Padding = require( '@stdlib/plot/vega/padding/ctor' ); +* +* var padding = new Padding(); +* var viz = new Visualization({ +* 'padding': padding +* }); +* +* var v = viz.padding; +* // returns <Padding> +*/ +setReadWriteAccessor( Visualization.prototype, 'padding', getPadding, setPadding ); + +/** +* Cartographic projections. +* +* @name projections +* @memberof Visualization.prototype +* @type {Array<Projection>} +* +* @example +* // TODO: example +*/ +setReadWriteAccessor( Visualization.prototype, 'projections', getProjections, setProjections ); + +/** +* Visualization properties. +* +* @name properties +* @memberof Visualization.prototype +* @type {Array<string>} +* +* @example +* var viz = new Visualization(); +* +* var v = viz.properties; +* // returns [...] +*/ +setNonEnumerableReadOnlyAccessor( Visualization.prototype, 'properties', getProperties ); + +/** +* Visualization scales. +* +* @name scales +* @memberof Visualization.prototype +* @type {Array<Scale>} +* +* @example +* var Scale = require( '@stdlib/plot/vega/scale/base/ctor' ); +* +* var scale = new Scale({ +* 'name': 'xScale' +* }); +* var viz = new Visualization({ +* 'scales': [ scale ] +* }); +* +* var v = viz.scales; +* // returns [ <Scale> ] +*/ +setReadWriteAccessor( Visualization.prototype, 'scales', getScales, setScales ); + +/** +* Dynamic variables which parameterize a visualization. +* +* @name signals +* @memberof Visualization.prototype +* @type {Array<Signal>} +* +* @example +* // TODO: example +*/ +setReadWriteAccessor( Visualization.prototype, 'signals', getSignals, setSignals ); + +/** +* Visualization title. +* +* @name title +* @memberof Visualization.prototype +* @type {Title} +* +* @example +* var Title = require( '@stdlib/plot/vega/title/ctor' ); +* +* var title = new Title({ +* 'text': 'Foo Bar' +* }); +* var viz = new Visualization({ +* 'title': title +* }); +* +* var v = viz.title; +* // returns <Title> +*/ +setReadWriteAccessor( Visualization.prototype, 'title', getTitle, setTitle ); + +/** +* Visualization metadata. +* +* @name usermeta +* @memberof Visualization.prototype +* @type {Object} +* +* @example +* var obj = { +* 'foo': 'bar' +* }; +* var viz = new Visualization({ +* 'usermeta': obj +* }); +* +* var v = viz.usermeta; +* // returns { 'foo': 'bar' } +*/ +setReadWriteAccessor( Visualization.prototype, 'usermeta', getUserMeta, setUserMeta ); + +/** +* Visualization width (in pixels). +* +* @name width +* @memberof Visualization.prototype +* @type {(NonNegativeNumber|Signal)} +* +* @example +* var viz = new Visualization({ +* 'width': 640 +* }); +* +* var v = viz.width; +* // returns 640 +*/ +setReadWriteAccessor( Visualization.prototype, 'width', getWidth, setWidth ); + +/** +* Serializes an instance to a JSON object. +* +* ## Notes +* +* - This method is implicitly invoked by `JSON.stringify`. +* +* @name toJSON +* @memberof Visualization.prototype +* @type {Function} +* @returns {Object} JSON object +* +* @example +* var viz = new Visualization(); +* +* var v = viz.toJSON(); +* // returns {...} +*/ +setNonEnumerableReadOnly( Visualization.prototype, 'toJSON', function toJSON() { + return instance2json( this, properties ); +}); + + +// EXPORTS // + +module.exports = Visualization; diff --git a/lib/node_modules/@stdlib/plot/vega/builder/lib/marks/get.js b/lib/node_modules/@stdlib/plot/vega/builder/lib/marks/get.js new file mode 100644 index 000000000000..06daf1c5c9f6 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/builder/lib/marks/get.js @@ -0,0 +1,44 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable no-invalid-this */ + +'use strict'; + +// MODULES // + +var copy = require( '@stdlib/array/base/copy-indexed' ); +var prop = require( './properties.js' ); + + +// MAIN // + +/** +* Returns a list of graphical marks. +* +* @private +* @returns {Array<Mark>} graphical marks +*/ +function get() { + return copy( this[ prop.private ] ); +} + + +// EXPORTS // + +module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/vega/builder/lib/marks/properties.js b/lib/node_modules/@stdlib/plot/vega/builder/lib/marks/properties.js new file mode 100644 index 000000000000..313258f1ea31 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/builder/lib/marks/properties.js @@ -0,0 +1,33 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var property2object = require( '@stdlib/plot/vega/base/property2object' ); + + +// MAIN // + +var obj = property2object( 'marks' ); + + +// EXPORTS // + +module.exports = obj; diff --git a/lib/node_modules/@stdlib/plot/vega/builder/lib/marks/set.js b/lib/node_modules/@stdlib/plot/vega/builder/lib/marks/set.js new file mode 100644 index 000000000000..090983463d5b --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/builder/lib/marks/set.js @@ -0,0 +1,67 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable no-invalid-this */ + +'use strict'; + +// MODULES // + +var logger = require( 'debug' ); +var isMarkArray = require( '@stdlib/plot/vega/base/assert/is-mark-array' ); +var isEmptyArrayLikeObject = require( '@stdlib/assert/is-empty-array-like-object' ); +var hasEqualValues = require( '@stdlib/array/base/assert/has-equal-values' ); +var copy = require( '@stdlib/array/base/copy' ); +var format = require( '@stdlib/string/format' ); +var changeEvent = require( './../change_event.js' ); +var prop = require( './properties.js' ); + + +// VARIABLES // + +var debug = logger( 'vega:builder:set:'+prop.name ); + + +// MAIN // + +/** +* Sets graphical marks. +* +* @private +* @param {ArrayLikeObject<Mark>} value - input value +* @throws {TypeError} must be an array of marks +* @returns {void} +*/ +function set( value ) { + if ( !isMarkArray( value ) && !isEmptyArrayLikeObject( value ) ) { + throw new TypeError( format( 'invalid assignment. `%s` must be an array of marks. Value: `%s`.', prop.name, value ) ); + } + value = copy( value ); + if ( !hasEqualValues( value, this[ prop.private ] ) ) { + this._removeChangeListeners( this[ prop.private ] ); + debug( 'Current value: %s. New value: %s.', JSON.stringify( this[ prop.private ] ), JSON.stringify( value ) ); + this[ prop.private ] = value; + this.emit( 'change', changeEvent( prop.name ) ); + this._addChangeListeners( this[ prop.private ] ); + } +} + + +// EXPORTS // + +module.exports = set; diff --git a/lib/node_modules/@stdlib/plot/vega/builder/lib/padding/get.js b/lib/node_modules/@stdlib/plot/vega/builder/lib/padding/get.js new file mode 100644 index 000000000000..e2482165ed10 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/builder/lib/padding/get.js @@ -0,0 +1,43 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable no-invalid-this */ + +'use strict'; + +// MODULES // + +var prop = require( './properties.js' ); + + +// MAIN // + +/** +* Returns the visualization padding. +* +* @private +* @returns {(Padding|Signal)} padding +*/ +function get() { + return this[ prop.private ]; +} + + +// EXPORTS // + +module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/vega/builder/lib/padding/properties.js b/lib/node_modules/@stdlib/plot/vega/builder/lib/padding/properties.js new file mode 100644 index 000000000000..4263049cd90b --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/builder/lib/padding/properties.js @@ -0,0 +1,33 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var property2object = require( '@stdlib/plot/vega/base/property2object' ); + + +// MAIN // + +var obj = property2object( 'padding' ); + + +// EXPORTS // + +module.exports = obj; diff --git a/lib/node_modules/@stdlib/plot/vega/builder/lib/padding/set.js b/lib/node_modules/@stdlib/plot/vega/builder/lib/padding/set.js new file mode 100644 index 000000000000..28ef9b09c8ed --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/builder/lib/padding/set.js @@ -0,0 +1,63 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable no-invalid-this */ + +'use strict'; + +// MODULES // + +var logger = require( 'debug' ); +var isPadding = require( '@stdlib/plot/vega/base/assert/is-padding' ); +var format = require( '@stdlib/string/format' ); +var changeEvent = require( './../change_event.js' ); +var prop = require( './properties.js' ); + + +// VARIABLES // + +var debug = logger( 'vega:builder:set:'+prop.name ); + + +// MAIN // + +/** +* Sets the visualization padding. +* +* @private +* @param {(Padding|Signal)} value - input value +* @throws {TypeError} must be a padding instance or a signal +* @returns {void} +*/ +function set( value ) { + if ( !isPadding( value ) ) { // TODO: add signal support + throw new TypeError( format( 'invalid assignment. `%s` must be a padding instance or a signal. Value: `%s`.', prop.name, value ) ); + } + if ( value !== this[ prop.private ] ) { + this._removeChangeListener( this[ prop.private ] ); + debug( 'Current value: %s. New value: %s.', JSON.stringify( this[ prop.private ] ), JSON.stringify( value ) ); + this[ prop.private ] = value; + this.emit( 'change', changeEvent( prop.name ) ); + this._addChangeListener( this[ prop.private ] ); + } +} + + +// EXPORTS // + +module.exports = set; diff --git a/lib/node_modules/@stdlib/plot/vega/builder/lib/projections/get.js b/lib/node_modules/@stdlib/plot/vega/builder/lib/projections/get.js new file mode 100644 index 000000000000..3bc62ab50532 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/builder/lib/projections/get.js @@ -0,0 +1,44 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable no-invalid-this */ + +'use strict'; + +// MODULES // + +var copy = require( '@stdlib/array/base/copy-indexed' ); +var prop = require( './properties.js' ); + + +// MAIN // + +/** +* Returns a list of cartographic projections. +* +* @private +* @returns {Array<Projection>} projections +*/ +function get() { + return copy( this[ prop.private ] ); +} + + +// EXPORTS // + +module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/vega/builder/lib/projections/properties.js b/lib/node_modules/@stdlib/plot/vega/builder/lib/projections/properties.js new file mode 100644 index 000000000000..cb080990e999 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/builder/lib/projections/properties.js @@ -0,0 +1,33 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var property2object = require( '@stdlib/plot/vega/base/property2object' ); + + +// MAIN // + +var obj = property2object( 'projections' ); + + +// EXPORTS // + +module.exports = obj; diff --git a/lib/node_modules/@stdlib/plot/vega/builder/lib/projections/set.js b/lib/node_modules/@stdlib/plot/vega/builder/lib/projections/set.js new file mode 100644 index 000000000000..b66720c57895 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/builder/lib/projections/set.js @@ -0,0 +1,66 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable no-invalid-this */ + +'use strict'; + +// MODULES // + +var logger = require( 'debug' ); +var isArrayLikeObject = require( '@stdlib/assert/is-array-like-object' ); +var hasEqualValues = require( '@stdlib/array/base/assert/has-equal-values' ); +var copy = require( '@stdlib/array/base/copy' ); +var format = require( '@stdlib/string/format' ); +var changeEvent = require( './../change_event.js' ); +var prop = require( './properties.js' ); + + +// VARIABLES // + +var debug = logger( 'vega:builder:set:'+prop.name ); + + +// MAIN // + +/** +* Sets cartographic projections. +* +* @private +* @param {ArrayLikeObject<Projection>} value - input value +* @throws {TypeError} must be an array of projections +* @returns {void} +*/ +function set( value ) { + if ( !isArrayLikeObject( value ) ) { // FIXME: validate array of projections or an empty array + throw new TypeError( format( 'invalid assignment. `%s` must be an array of projections. Value: `%s`.', prop.name, value ) ); + } + value = copy( value ); + if ( !hasEqualValues( value, this[ prop.private ] ) ) { + this._removeChangeListeners( this[ prop.private ] ); + debug( 'Current value: %s. New value: %s.', JSON.stringify( this[ prop.private ] ), JSON.stringify( value ) ); + this[ prop.private ] = value; + this.emit( 'change', changeEvent( prop.name ) ); + this._addChangeListeners( this[ prop.private ] ); + } +} + + +// EXPORTS // + +module.exports = set; diff --git a/lib/node_modules/@stdlib/plot/vega/builder/lib/properties.json b/lib/node_modules/@stdlib/plot/vega/builder/lib/properties.json new file mode 100644 index 000000000000..e4c16f79f960 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/builder/lib/properties.json @@ -0,0 +1,20 @@ +[ + "$schema", + "autosize", + "axes", + "background", + "config", + "data", + "description", + "encode", + "height", + "legends", + "marks", + "padding", + "projections", + "scales", + "signals", + "title", + "usermeta", + "width" +] diff --git a/lib/node_modules/@stdlib/plot/vega/builder/lib/properties/get.js b/lib/node_modules/@stdlib/plot/vega/builder/lib/properties/get.js new file mode 100644 index 000000000000..8fc57de14e90 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/builder/lib/properties/get.js @@ -0,0 +1,41 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var properties = require( './../properties.json' ); + + +// MAIN // + +/** +* Returns the list of enumerable properties. +* +* @private +* @returns {Array<string>} properties +*/ +function get() { + return properties.slice(); +} + + +// EXPORTS // + +module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/vega/builder/lib/scales/get.js b/lib/node_modules/@stdlib/plot/vega/builder/lib/scales/get.js new file mode 100644 index 000000000000..0bf274b42e83 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/builder/lib/scales/get.js @@ -0,0 +1,44 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable no-invalid-this */ + +'use strict'; + +// MODULES // + +var copy = require( '@stdlib/array/base/copy-indexed' ); +var prop = require( './properties.js' ); + + +// MAIN // + +/** +* Returns the visualization scales. +* +* @private +* @returns {Array<Scale>} scales +*/ +function get() { + return copy( this[ prop.private ] ); +} + + +// EXPORTS // + +module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/vega/builder/lib/scales/properties.js b/lib/node_modules/@stdlib/plot/vega/builder/lib/scales/properties.js new file mode 100644 index 000000000000..dfad000dd527 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/builder/lib/scales/properties.js @@ -0,0 +1,33 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var property2object = require( '@stdlib/plot/vega/base/property2object' ); + + +// MAIN // + +var obj = property2object( 'scales' ); + + +// EXPORTS // + +module.exports = obj; diff --git a/lib/node_modules/@stdlib/plot/vega/builder/lib/scales/set.js b/lib/node_modules/@stdlib/plot/vega/builder/lib/scales/set.js new file mode 100644 index 000000000000..4ce2c52d4294 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/builder/lib/scales/set.js @@ -0,0 +1,67 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable no-invalid-this */ + +'use strict'; + +// MODULES // + +var logger = require( 'debug' ); +var isEmptyArrayLikeObject = require( '@stdlib/assert/is-empty-array-like-object' ); +var hasEqualValues = require( '@stdlib/array/base/assert/has-equal-values' ); +var isScaleArray = require( '@stdlib/plot/vega/base/assert/is-scale-array' ); +var copy = require( '@stdlib/array/base/copy' ); +var format = require( '@stdlib/string/format' ); +var changeEvent = require( './../change_event.js' ); +var prop = require( './properties.js' ); + + +// VARIABLES // + +var debug = logger( 'vega:builder:set:'+prop.name ); + + +// MAIN // + +/** +* Sets the visualization scales. +* +* @private +* @param {ArrayLikeObject<Scale>} value - input value +* @throws {TypeError} must be an array of scale instances +* @returns {void} +*/ +function set( value ) { + if ( !isScaleArray( value ) && !isEmptyArrayLikeObject( value ) ) { + throw new TypeError( format( 'invalid assignment. `%s` must be an array of scale instances. Value: `%s`.', prop.name, value ) ); + } + value = copy( value ); + if ( !hasEqualValues( value, this[ prop.private ] ) ) { + this._removeChangeListeners( this[ prop.private ] ); + debug( 'Current value: %s. New value: %s.', JSON.stringify( this[ prop.private ] ), JSON.stringify( value ) ); + this[ prop.private ] = value; + this.emit( 'change', changeEvent( prop.name ) ); + this._addChangeListeners( this[ prop.private ] ); + } +} + + +// EXPORTS // + +module.exports = set; diff --git a/lib/node_modules/@stdlib/plot/vega/builder/lib/schema/get.js b/lib/node_modules/@stdlib/plot/vega/builder/lib/schema/get.js new file mode 100644 index 000000000000..0b2aeafc7a97 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/builder/lib/schema/get.js @@ -0,0 +1,38 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable no-invalid-this */ + +'use strict'; + +// MAIN // + +/** +* Returns the configuration schema URL. +* +* @private +* @returns {string} schema URL +*/ +function get() { + return this._$schema; +} + + +// EXPORTS // + +module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/vega/builder/lib/signals/get.js b/lib/node_modules/@stdlib/plot/vega/builder/lib/signals/get.js new file mode 100644 index 000000000000..bafc08458a5b --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/builder/lib/signals/get.js @@ -0,0 +1,44 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable no-invalid-this */ + +'use strict'; + +// MODULES // + +var copy = require( '@stdlib/array/base/copy-indexed' ); +var prop = require( './properties.js' ); + + +// MAIN // + +/** +* Returns a list of dynamic variables which parameterize a visualization. +* +* @private +* @returns {Array<Signal>} signals +*/ +function get() { + return copy( this[ prop.private ] ); +} + + +// EXPORTS // + +module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/vega/builder/lib/signals/properties.js b/lib/node_modules/@stdlib/plot/vega/builder/lib/signals/properties.js new file mode 100644 index 000000000000..8abf712243c4 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/builder/lib/signals/properties.js @@ -0,0 +1,33 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var property2object = require( '@stdlib/plot/vega/base/property2object' ); + + +// MAIN // + +var obj = property2object( 'signals' ); + + +// EXPORTS // + +module.exports = obj; diff --git a/lib/node_modules/@stdlib/plot/vega/builder/lib/signals/set.js b/lib/node_modules/@stdlib/plot/vega/builder/lib/signals/set.js new file mode 100644 index 000000000000..c794b519d28f --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/builder/lib/signals/set.js @@ -0,0 +1,66 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable no-invalid-this */ + +'use strict'; + +// MODULES // + +var logger = require( 'debug' ); +var isArrayLikeObject = require( '@stdlib/assert/is-array-like-object' ); +var hasEqualValues = require( '@stdlib/array/base/assert/has-equal-values' ); +var copy = require( '@stdlib/array/base/copy' ); +var format = require( '@stdlib/string/format' ); +var changeEvent = require( './../change_event.js' ); +var prop = require( './properties.js' ); + + +// VARIABLES // + +var debug = logger( 'vega:builder:set:'+prop.name ); + + +// MAIN // + +/** +* Sets dynamic variables which parameterize a visualization. +* +* @private +* @param {ArrayLikeObject<Signal>} value - input value +* @throws {TypeError} must be an array of signals +* @returns {void} +*/ +function set( value ) { + if ( !isArrayLikeObject( value ) ) { // FIXME: validate array of signals or an empty array + throw new TypeError( format( 'invalid assignment. `%s` must be an array of signals. Value: `%s`.', prop.name, value ) ); + } + value = copy( value ); + if ( !hasEqualValues( value, this[ prop.private ] ) ) { + this._removeChangeListeners( this[ prop.private ] ); + debug( 'Current value: %s. New value: %s.', JSON.stringify( this[ prop.private ] ), JSON.stringify( value ) ); + this[ prop.private ] = value; + this.emit( 'change', changeEvent( prop.name ) ); + this._addChangeListeners( this[ prop.private ] ); + } +} + + +// EXPORTS // + +module.exports = set; diff --git a/lib/node_modules/@stdlib/plot/vega/builder/lib/title/get.js b/lib/node_modules/@stdlib/plot/vega/builder/lib/title/get.js new file mode 100644 index 000000000000..91ca9552d86b --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/builder/lib/title/get.js @@ -0,0 +1,43 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable no-invalid-this */ + +'use strict'; + +// MODULES // + +var prop = require( './properties.js' ); + + +// MAIN // + +/** +* Returns the visualization title. +* +* @private +* @returns {Title} title +*/ +function get() { + return this[ prop.private ]; +} + + +// EXPORTS // + +module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/vega/builder/lib/title/properties.js b/lib/node_modules/@stdlib/plot/vega/builder/lib/title/properties.js new file mode 100644 index 000000000000..8b6ce18df555 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/builder/lib/title/properties.js @@ -0,0 +1,33 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var property2object = require( '@stdlib/plot/vega/base/property2object' ); + + +// MAIN // + +var obj = property2object( 'title' ); + + +// EXPORTS // + +module.exports = obj; diff --git a/lib/node_modules/@stdlib/plot/vega/builder/lib/title/set.js b/lib/node_modules/@stdlib/plot/vega/builder/lib/title/set.js new file mode 100644 index 000000000000..38a18865b15b --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/builder/lib/title/set.js @@ -0,0 +1,63 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable no-invalid-this */ + +'use strict'; + +// MODULES // + +var logger = require( 'debug' ); +var isTitle = require( '@stdlib/plot/vega/base/assert/is-title' ); +var format = require( '@stdlib/string/format' ); +var changeEvent = require( './../change_event.js' ); +var prop = require( './properties.js' ); + + +// VARIABLES // + +var debug = logger( 'vega:builder:set:'+prop.name ); + + +// MAIN // + +/** +* Sets the visualization title. +* +* @private +* @param {Title} value - input value +* @throws {TypeError} must be a title instance +* @returns {void} +*/ +function set( value ) { + if ( !isTitle( value ) ) { + throw new TypeError( format( 'invalid assignment. `%s` must be a title instance. Value: `%s`.', prop.name, value ) ); + } + if ( value !== this[ prop.private ] ) { + this._removeChangeListener( this[ prop.private ] ); + debug( 'Current value: %s. New value: %s.', JSON.stringify( this[ prop.private ] ), JSON.stringify( value ) ); + this[ prop.private ] = value; + this.emit( 'change', changeEvent( prop.name ) ); + this._addChangeListener( this[ prop.private ] ); + } +} + + +// EXPORTS // + +module.exports = set; diff --git a/lib/node_modules/@stdlib/plot/vega/builder/lib/usermeta/get.js b/lib/node_modules/@stdlib/plot/vega/builder/lib/usermeta/get.js new file mode 100644 index 000000000000..9bb4dbdd3781 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/builder/lib/usermeta/get.js @@ -0,0 +1,43 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable no-invalid-this */ + +'use strict'; + +// MODULES // + +var prop = require( './properties.js' ); + + +// MAIN // + +/** +* Returns visualization metadata. +* +* @private +* @returns {Object} metadata +*/ +function get() { + return this[ prop.private ]; +} + + +// EXPORTS // + +module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/vega/builder/lib/usermeta/properties.js b/lib/node_modules/@stdlib/plot/vega/builder/lib/usermeta/properties.js new file mode 100644 index 000000000000..103485c6a259 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/builder/lib/usermeta/properties.js @@ -0,0 +1,33 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var property2object = require( '@stdlib/plot/vega/base/property2object' ); + + +// MAIN // + +var obj = property2object( 'usermeta' ); + + +// EXPORTS // + +module.exports = obj; diff --git a/lib/node_modules/@stdlib/plot/vega/builder/lib/usermeta/set.js b/lib/node_modules/@stdlib/plot/vega/builder/lib/usermeta/set.js new file mode 100644 index 000000000000..f6e9e847bc85 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/builder/lib/usermeta/set.js @@ -0,0 +1,57 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable no-invalid-this */ + +'use strict'; + +// MODULES // + +var logger = require( 'debug' ); +var isObject = require( '@stdlib/assert/is-object' ); +var format = require( '@stdlib/string/format' ); +var prop = require( './properties.js' ); + + +// VARIABLES // + +var debug = logger( 'vega:builder:set:'+prop.name ); + + +// MAIN // + +/** +* Sets optional metadata. +* +* @private +* @param {Object} value - input value +* @throws {TypeError} must be an object +* @returns {void} +*/ +function set( value ) { + if ( !isObject( value ) ) { + throw new TypeError( format( 'invalid assignment. `%s` must be an object. Value: `%s`.', prop.name, value ) ); + } + debug( 'Current value: %s. New value: %s.', JSON.stringify( this[ prop.private ] ), JSON.stringify( value ) ); + this[ prop.private ] = value; +} + + +// EXPORTS // + +module.exports = set; diff --git a/lib/node_modules/@stdlib/plot/vega/builder/lib/width/get.js b/lib/node_modules/@stdlib/plot/vega/builder/lib/width/get.js new file mode 100644 index 000000000000..33df7bd00350 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/builder/lib/width/get.js @@ -0,0 +1,43 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable no-invalid-this */ + +'use strict'; + +// MODULES // + +var prop = require( './properties.js' ); + + +// MAIN // + +/** +* Returns the visualization width (in pixels). +* +* @private +* @returns {(NonNegativeNumber|Signal)} width +*/ +function get() { + return this[ prop.private ]; +} + + +// EXPORTS // + +module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/vega/builder/lib/width/properties.js b/lib/node_modules/@stdlib/plot/vega/builder/lib/width/properties.js new file mode 100644 index 000000000000..421ccbce19c3 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/builder/lib/width/properties.js @@ -0,0 +1,33 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var property2object = require( '@stdlib/plot/vega/base/property2object' ); + + +// MAIN // + +var obj = property2object( 'width' ); + + +// EXPORTS // + +module.exports = obj; diff --git a/lib/node_modules/@stdlib/plot/vega/builder/lib/width/set.js b/lib/node_modules/@stdlib/plot/vega/builder/lib/width/set.js new file mode 100644 index 000000000000..f32276146bfc --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/builder/lib/width/set.js @@ -0,0 +1,62 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable no-invalid-this */ + +'use strict'; + +// MODULES // + +var logger = require( 'debug' ); +var isNonNegativeNumber = require( '@stdlib/assert/is-nonnegative-number' ).isPrimitive; +var isObject = require( '@stdlib/assert/is-object' ); +var format = require( '@stdlib/string/format' ); +var changeEvent = require( './../change_event.js' ); +var prop = require( './properties.js' ); + + +// VARIABLES // + +var debug = logger( 'vega:builder:set:'+prop.name ); + + +// MAIN // + +/** +* Sets the visualization width (in pixels). +* +* @private +* @param {(NonNegativeNumber|Signal)} value - input value +* @throws {TypeError} must be either a nonnegative number or a signal +* @returns {void} +*/ +function set( value ) { + if ( !isNonNegativeNumber( value ) && !isObject( value ) ) { + throw new TypeError( format( 'invalid assignment. `%s` must be either a nonnegative number or a signal. Value: `%s`.', prop.name, value ) ); + } + if ( value !== this[ prop.private ] ) { + debug( 'Current value: %s. New value: %s.', this[ prop.private ], value ); + this[ prop.private ] = value; + this.emit( 'change', changeEvent( prop.name ) ); + } +} + + +// EXPORTS // + +module.exports = set; diff --git a/lib/node_modules/@stdlib/plot/vega/builder/package.json b/lib/node_modules/@stdlib/plot/vega/builder/package.json new file mode 100644 index 000000000000..35ebb7faa207 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/builder/package.json @@ -0,0 +1,60 @@ +{ + "name": "@stdlib/plot/vega/builder", + "version": "0.0.0", + "description": "Visualization constructor.", + "license": "Apache-2.0", + "author": { + "name": "The Stdlib Authors", + "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" + }, + "contributors": [ + { + "name": "The Stdlib Authors", + "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" + } + ], + "main": "./lib", + "directories": { + "benchmark": "./benchmark", + "doc": "./docs", + "example": "./examples", + "lib": "./lib", + "test": "./test" + }, + "types": "./docs/types", + "scripts": {}, + "homepage": "https://github.com/stdlib-js/stdlib", + "repository": { + "type": "git", + "url": "git://github.com/stdlib-js/stdlib.git" + }, + "bugs": { + "url": "https://github.com/stdlib-js/stdlib/issues" + }, + "dependencies": {}, + "devDependencies": {}, + "engines": { + "node": ">=0.10.0", + "npm": ">2.7.0" + }, + "os": [ + "aix", + "darwin", + "freebsd", + "linux", + "macos", + "openbsd", + "sunos", + "win32", + "windows" + ], + "keywords": [ + "stdlib", + "plot", + "vega", + "visualization", + "constructor", + "ctor" + ], + "__stdlib__": {} +} diff --git a/lib/node_modules/@stdlib/plot/vega/data/base/ctor/examples/index.js b/lib/node_modules/@stdlib/plot/vega/data/base/ctor/examples/index.js new file mode 100644 index 000000000000..cbb7e252759e --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/data/base/ctor/examples/index.js @@ -0,0 +1,27 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +var DataSet = require( './../lib' ); + +var data = new DataSet({ + 'name': 'table' +}); + +console.log( data.toJSON() ); diff --git a/lib/node_modules/@stdlib/plot/vega/data/base/ctor/lib/async/get.js b/lib/node_modules/@stdlib/plot/vega/data/base/ctor/lib/async/get.js new file mode 100644 index 000000000000..bc1cebd920ba --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/data/base/ctor/lib/async/get.js @@ -0,0 +1,43 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable no-invalid-this */ + +'use strict'; + +// MODULES // + +var prop = require( './properties.js' ); + + +// MAIN // + +/** +* Returns a boolean indicating whether to data loading or reformatting should be performed asynchronously. +* +* @private +* @returns {boolean} boolean flag +*/ +function get() { + return this[ prop.private ]; +} + + +// EXPORTS // + +module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/vega/data/base/ctor/lib/async/properties.js b/lib/node_modules/@stdlib/plot/vega/data/base/ctor/lib/async/properties.js new file mode 100644 index 000000000000..ebb2e3a64604 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/data/base/ctor/lib/async/properties.js @@ -0,0 +1,33 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var property2object = require( '@stdlib/plot/vega/base/property2object' ); + + +// MAIN // + +var obj = property2object( 'async' ); + + +// EXPORTS // + +module.exports = obj; diff --git a/lib/node_modules/@stdlib/plot/vega/data/base/ctor/lib/async/set.js b/lib/node_modules/@stdlib/plot/vega/data/base/ctor/lib/async/set.js new file mode 100644 index 000000000000..e88901b79fd6 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/data/base/ctor/lib/async/set.js @@ -0,0 +1,61 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable no-invalid-this */ + +'use strict'; + +// MODULES // + +var logger = require( 'debug' ); +var isBoolean = require( '@stdlib/assert/is-boolean' ).isPrimitive; +var format = require( '@stdlib/string/format' ); +var changeEvent = require( './../change_event.js' ); +var prop = require( './properties.js' ); + + +// VARIABLES // + +var debug = logger( 'vega:data:set:'+prop.name ); + + +// MAIN // + +/** +* Sets a boolean flag indicating whether to data loading or reformatting should be done asynchronously. +* +* @private +* @param {boolean} value - input value +* @throws {TypeError} must be a boolean +* @returns {void} +*/ +function set( value ) { + if ( !isBoolean( value ) ) { + throw new TypeError( format( 'invalid assignment. `%s` must be a boolean. Value: `%s`.', prop.name, value ) ); + } + if ( value !== this[ prop.private ] ) { + debug( 'Current value: %s. New value: %s.', this[ prop.private ], value ); + this[ prop.private ] = value; + this.emit( 'change', changeEvent( prop.name ) ); + } +} + + +// EXPORTS // + +module.exports = set; diff --git a/lib/node_modules/@stdlib/plot/vega/data/base/ctor/lib/change_event.js b/lib/node_modules/@stdlib/plot/vega/data/base/ctor/lib/change_event.js new file mode 100644 index 000000000000..ba839622e669 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/data/base/ctor/lib/change_event.js @@ -0,0 +1,41 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MAIN // + +/** +* Returns a new change event object. +* +* @private +* @param {string} property - property name +* @returns {Object} event object +*/ +function event( property ) { // eslint-disable-line stdlib/no-redeclare + return { + 'type': 'update', + 'source': 'data', + 'property': property + }; +} + + +// EXPORTS // + +module.exports = event; diff --git a/lib/node_modules/@stdlib/plot/vega/data/base/ctor/lib/defaults.js b/lib/node_modules/@stdlib/plot/vega/data/base/ctor/lib/defaults.js new file mode 100644 index 000000000000..ea1727709ec7 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/data/base/ctor/lib/defaults.js @@ -0,0 +1,49 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MAIN // + +/** +* Returns defaults. +* +* @private +* @returns {Object} default options +* +* @example +* var o = defaults(); +* // returns {...} +*/ +function defaults() { + return { + // Boolean indicating whether to perform data loading or reformatting asynchronously: + 'async': false, + + // List of transforms to perform on the input data: + 'transform': [], + + // List of array updates to perform when trigger conditions are met: + 'triggers': [] + }; +} + + +// EXPORTS // + +module.exports = defaults; diff --git a/lib/node_modules/@stdlib/plot/vega/data/base/ctor/lib/index.js b/lib/node_modules/@stdlib/plot/vega/data/base/ctor/lib/index.js new file mode 100644 index 000000000000..888eede2e8a0 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/data/base/ctor/lib/index.js @@ -0,0 +1,42 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +/** +* Data set constructor. +* +* @module @stdlib/plot/vega/data/base/ctor +* +* @example +* var DataSet = require( '@stdlib/plot/vega/data/base/ctor' ); +* +* var data = new DataSet({ +* 'name': 'table' +* }); +* // returns <DataSet> +*/ + +// MODULES // + +var main = require( './main.js' ); + + +// EXPORTS // + +module.exports = main; diff --git a/lib/node_modules/@stdlib/plot/vega/data/base/ctor/lib/main.js b/lib/node_modules/@stdlib/plot/vega/data/base/ctor/lib/main.js new file mode 100644 index 000000000000..056bb3c4b1e8 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/data/base/ctor/lib/main.js @@ -0,0 +1,232 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable no-restricted-syntax, no-invalid-this */ + +'use strict'; + +// MODULES // + +var EventEmitter = require( 'events' ).EventEmitter; +var logger = require( 'debug' ); +var isObject = require( '@stdlib/assert/is-object' ); +var setNonEnumerableReadOnly = require( '@stdlib/utils/define-nonenumerable-read-only-property' ); +var setReadWriteAccessor = require( '@stdlib/utils/define-read-write-accessor' ); +var hasProp = require( '@stdlib/assert/has-property' ); +var inherit = require( '@stdlib/utils/inherit' ); +var objectKeys = require( '@stdlib/utils/keys' ); +var transformErrorMessage = require( '@stdlib/plot/vega/base/transform-validation-message' ); +var instance2json = require( '@stdlib/plot/vega/base/to-json' ); +var format = require( '@stdlib/string/format' ); +var properties = require( './properties.json' ); +var defaults = require( './defaults.js' ); + +// Note: keep the following in alphabetical order according to the `require` path... +var getAsync = require( './async/get.js' ); +var setAsync = require( './async/set.js' ); + +var getName = require( './name/get.js' ); +var setName = require( './name/set.js' ); + +var getTriggers = require( './triggers/get.js' ); +var setTriggers = require( './triggers/set.js' ); + +// TODO: add `format` support + +// TODO: add `transform` support + + +// VARIABLES // + +var debug = logger( 'vega:data:main' ); + + +// MAIN // + +/** +* Data set constructor. +* +* @constructor +* @param {Options} options - constructor options +* @param {string} options.name - data set name +* @param {boolean} [options.async=false] - boolean indicating whether data loading or reformatting should be performed asynchronously +* @param {Format} [options.format] - format specification for parsing a data file or values +* @param {Array<Transform>} [options.transforms=[]] - list of transforms to perform on input data +* @param {Array<Trigger>} [options.triggers=[]] - list of updates to perform when trigger conditions are met +* @throws {TypeError} options argument must be an object +* @throws {Error} must provide valid options +* @returns {DataSet} data set instance +* +* @example +* var data = new DataSet({ +* 'name': 'table' +* }); +* // returns <DataSet> +*/ +function DataSet( options ) { + var opts; + var keys; + var v; + var k; + var i; + if ( !( this instanceof DataSet ) ) { + return new DataSet( options ); + } + EventEmitter.call( this ); + if ( !isObject( options ) ) { + throw new TypeError( format( 'invalid argument. Options argument must be an object. Value: `%s`.', options ) ); + } + // Resolve the default configuration: + opts = defaults(); + + // Set internal properties according to the default configuration... + keys = objectKeys( opts ); + for ( i = 0; i < keys.length; i++ ) { + k = keys[ i ]; + this[ '_'+k ] = opts[ k ]; + if ( k === 'on' ) { + this._triggers = opts[ k ]; // set an alias + } else if ( k === 'triggers' ) { + this._on = opts[ k ]; // set an alias + } + } + // Check for required properties... + if ( !hasProp( options, 'name' ) ) { + throw new TypeError( 'invalid argument. Options argument must specify the data set name.' ); + } + // Validate provided options by attempting to assign option values to corresponding fields... + for ( i = 0; i < properties.length; i++ ) { + k = properties[ i ]; + if ( !hasProp( options, k ) ) { + continue; + } + v = options[ k ]; + if ( k === 'on' ) { + // Avoid conflict with event emitter method: + k = 'triggers'; + } + try { + this[ k ] = v; + } catch ( err ) { + debug( 'Encountered an error. Error: %s', err.message ); + + // FIXME: retain thrown error type + throw new Error( transformErrorMessage( err.message ) ); + } + } + return this; +} + +/* +* Inherit from the `EventEmitter` prototype. +*/ +inherit( DataSet, EventEmitter ); + +/** +* Constructor name. +* +* @private +* @name name +* @memberof DataSet +* @readonly +* @type {string} +*/ +setNonEnumerableReadOnly( DataSet, 'name', 'DataSet' ); + +/** +* Boolean flag indicating whether to perform data loading or reformatting asynchronously. +* +* @name async +* @memberof DataSet.prototype +* @type {boolean} +* @default false +* +* @example +* var data = new DataSet({ +* 'name': 'table', +* 'async': true +* }); +* +* var v = data.async; +* // returns true +*/ +setReadWriteAccessor( DataSet.prototype, 'async', getAsync, setAsync ); + +/** +* Data set name. +* +* @name name +* @memberof DataSet.prototype +* @type {string} +* +* @example +* var data = new DataSet({ +* 'name': 'table' +* }); +* +* var v = data.name; +* // returns 'table' +*/ +setReadWriteAccessor( DataSet.prototype, 'name', getName, setName ); + +/** +* List of updates to perform when trigger conditions are met. +* +* @name triggers +* @memberof DataSet.prototype +* @type {Array<Trigger>} +* +* @example +* var data = new DataSet({ +* 'name': 'table', +* 'triggers': [] +* }); +* +* var v = data.triggers; +* // returns [] +*/ +setReadWriteAccessor( DataSet.prototype, 'triggers', getTriggers, setTriggers ); + +/** +* Serializes an instance to a JSON object. +* +* ## Notes +* +* - This method is implicitly invoked by `JSON.stringify`. +* +* @name toJSON +* @memberof DataSet.prototype +* @type {Function} +* @returns {Object} JSON object +* +* @example +* var data = new DataSet({ +* 'name': 'table' +* }); +* +* var v = data.toJSON(); +* // returns {...} +*/ +setNonEnumerableReadOnly( DataSet.prototype, 'toJSON', function toJSON() { + return instance2json( this, properties ); +}); + + +// EXPORTS // + +module.exports = DataSet; diff --git a/lib/node_modules/@stdlib/plot/vega/data/base/ctor/lib/name/get.js b/lib/node_modules/@stdlib/plot/vega/data/base/ctor/lib/name/get.js new file mode 100644 index 000000000000..2b9fc5d82274 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/data/base/ctor/lib/name/get.js @@ -0,0 +1,43 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable no-invalid-this */ + +'use strict'; + +// MODULES // + +var prop = require( './properties.js' ); + + +// MAIN // + +/** +* Returns the data set name. +* +* @private +* @returns {string} name +*/ +function get() { + return this[ prop.private ]; +} + + +// EXPORTS // + +module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/vega/data/base/ctor/lib/name/properties.js b/lib/node_modules/@stdlib/plot/vega/data/base/ctor/lib/name/properties.js new file mode 100644 index 000000000000..729209deffa2 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/data/base/ctor/lib/name/properties.js @@ -0,0 +1,33 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var property2object = require( '@stdlib/plot/vega/base/property2object' ); + + +// MAIN // + +var obj = property2object( 'name' ); + + +// EXPORTS // + +module.exports = obj; diff --git a/lib/node_modules/@stdlib/plot/vega/data/base/ctor/lib/name/set.js b/lib/node_modules/@stdlib/plot/vega/data/base/ctor/lib/name/set.js new file mode 100644 index 000000000000..b1876dd54c57 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/data/base/ctor/lib/name/set.js @@ -0,0 +1,61 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable no-invalid-this */ + +'use strict'; + +// MODULES // + +var logger = require( 'debug' ); +var isString = require( '@stdlib/assert/is-string' ).isPrimitive; +var format = require( '@stdlib/string/format' ); +var changeEvent = require( './../change_event.js' ); +var prop = require( './properties.js' ); + + +// VARIABLES // + +var debug = logger( 'vega:data:set:'+prop.name ); + + +// MAIN // + +/** +* Sets the data set name. +* +* @private +* @param {string} value - input value +* @throws {TypeError} must be a non-empty string +* @returns {void} +*/ +function set( value ) { + if ( !isString( value ) || value.length <= 0 ) { + throw new TypeError( format( 'invalid assignment. `%s` must be a non-empty string. Value: `%s`.', prop.name, value ) ); + } + if ( value !== this[ prop.private ] ) { + debug( 'Current value: %s. New value: %s.', this[ prop.private ], value ); + this[ prop.private ] = value; + this.emit( 'change', changeEvent( prop.name ) ); + } +} + + +// EXPORTS // + +module.exports = set; diff --git a/lib/node_modules/@stdlib/plot/vega/data/base/ctor/lib/properties.json b/lib/node_modules/@stdlib/plot/vega/data/base/ctor/lib/properties.json new file mode 100644 index 000000000000..3c82608400db --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/data/base/ctor/lib/properties.json @@ -0,0 +1,9 @@ +[ + "async", + "format", + "name", + + "on", + + "transform" +] diff --git a/lib/node_modules/@stdlib/plot/vega/data/base/ctor/lib/triggers/get.js b/lib/node_modules/@stdlib/plot/vega/data/base/ctor/lib/triggers/get.js new file mode 100644 index 000000000000..f41ed186033d --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/data/base/ctor/lib/triggers/get.js @@ -0,0 +1,44 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable no-invalid-this */ + +'use strict'; + +// MODULES // + +var copy = require( '@stdlib/array/base/copy-indexed' ); +var prop = require( './properties.js' ); + + +// MAIN // + +/** +* Returns a list of updates to perform when trigger conditions are met. +* +* @private +* @returns {Array<Trigger>} list of updates +*/ +function get() { + return copy( this[ prop.private ] ); +} + + +// EXPORTS // + +module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/vega/data/base/ctor/lib/triggers/properties.js b/lib/node_modules/@stdlib/plot/vega/data/base/ctor/lib/triggers/properties.js new file mode 100644 index 000000000000..2340b2f70079 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/data/base/ctor/lib/triggers/properties.js @@ -0,0 +1,33 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var property2object = require( '@stdlib/plot/vega/base/property2object' ); + + +// MAIN // + +var obj = property2object( 'triggers' ); + + +// EXPORTS // + +module.exports = obj; diff --git a/lib/node_modules/@stdlib/plot/vega/data/base/ctor/lib/triggers/set.js b/lib/node_modules/@stdlib/plot/vega/data/base/ctor/lib/triggers/set.js new file mode 100644 index 000000000000..19d699c2a21d --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/data/base/ctor/lib/triggers/set.js @@ -0,0 +1,68 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable no-invalid-this */ + +'use strict'; + +// MODULES // + +var logger = require( 'debug' ); +var isEmptyArrayLikeObject = require( '@stdlib/assert/is-empty-array-like-object' ); +var hasEqualValues = require( '@stdlib/array/base/assert/has-equal-values' ); +var isTriggerArray = require( '@stdlib/plot/vega/base/assert/is-trigger-array' ); +var copy = require( '@stdlib/array/base/copy' ); +var format = require( '@stdlib/string/format' ); +var changeEvent = require( './../change_event.js' ); +var prop = require( './properties.js' ); + + +// VARIABLES // + +var debug = logger( 'vega:data:set:'+prop.name ); + + +// MAIN // + +/** +* Sets a list of updates to perform when trigger conditions are met. +* +* @private +* @param {ArrayLikeObject<Trigger>} value - input value +* @throws {TypeError} must be an array of trigger instances +* @returns {void} +*/ +function set( value ) { + if ( !isTriggerArray( value ) && !isEmptyArrayLikeObject( value ) ) { + throw new TypeError( format( 'invalid assignment. `%s` must be an array of trigger instances. Value: `%s`.', prop.name, value ) ); + } + value = copy( value ); + if ( !hasEqualValues( value, this[ prop.private ] ) ) { + this._removeChangeListeners( this[ prop.private ] ); + debug( 'Current value: %s. New value: %s.', JSON.stringify( this[ prop.private ] ), JSON.stringify( value ) ); + this[ prop.private ] = value; + this._on = value; // set an alias to ensure correct serialization + this.emit( 'change', changeEvent( prop.name ) ); + this._addChangeListeners( this[ prop.private ] ); + } +} + + +// EXPORTS // + +module.exports = set; diff --git a/lib/node_modules/@stdlib/plot/vega/data/base/ctor/package.json b/lib/node_modules/@stdlib/plot/vega/data/base/ctor/package.json new file mode 100644 index 000000000000..54c4aa6902bd --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/data/base/ctor/package.json @@ -0,0 +1,61 @@ +{ + "name": "@stdlib/plot/vega/data/base/ctor", + "version": "0.0.0", + "description": "Data set constructor.", + "license": "Apache-2.0", + "author": { + "name": "The Stdlib Authors", + "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" + }, + "contributors": [ + { + "name": "The Stdlib Authors", + "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" + } + ], + "main": "./lib", + "directories": { + "benchmark": "./benchmark", + "doc": "./docs", + "example": "./examples", + "lib": "./lib", + "test": "./test" + }, + "types": "./docs/types", + "scripts": {}, + "homepage": "https://github.com/stdlib-js/stdlib", + "repository": { + "type": "git", + "url": "git://github.com/stdlib-js/stdlib.git" + }, + "bugs": { + "url": "https://github.com/stdlib-js/stdlib/issues" + }, + "dependencies": {}, + "devDependencies": {}, + "engines": { + "node": ">=0.10.0", + "npm": ">2.7.0" + }, + "os": [ + "aix", + "darwin", + "freebsd", + "linux", + "macos", + "openbsd", + "sunos", + "win32", + "windows" + ], + "keywords": [ + "stdlib", + "plot", + "vega", + "data", + "dataset", + "constructor", + "ctor" + ], + "__stdlib__": {} +} diff --git a/lib/node_modules/@stdlib/plot/vega/data/tidy/from-array/examples/index.js b/lib/node_modules/@stdlib/plot/vega/data/tidy/from-array/examples/index.js new file mode 100644 index 000000000000..bde52f8a3b1f --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/data/tidy/from-array/examples/index.js @@ -0,0 +1,30 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +var discreteUniform = require( '@stdlib/random/array/discrete-uniform' ); +var array2tidy = require( './../lib' ); + +var arr = discreteUniform( 10, -100, 100 ); +var data = array2tidy( arr, 'series', [ 'x', 'y' ] ); + +var out = data.toJSON(); +console.log( out ); + +console.log( JSON.stringify( out ) ); diff --git a/lib/node_modules/@stdlib/plot/vega/data/tidy/from-array/lib/index.js b/lib/node_modules/@stdlib/plot/vega/data/tidy/from-array/lib/index.js new file mode 100644 index 000000000000..de0d57d42861 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/data/tidy/from-array/lib/index.js @@ -0,0 +1,42 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +/** +* Convert an array to a "tidy" data set. +* +* @module @stdlib/plot/vega/data/tidy/from-array +* +* @example +* var array2tidy = require( '@stdlib/plot/vega/data/tidy/from-array' ); +* +* var x = [ 1, 2, 3 ]; +* +* var v = array2tidy( x, 'data', [ 'index', 'value' ] ); +* // returns <DataSet> +*/ + +// MODULES // + +var main = require( './main.js' ); + + +// EXPORTS // + +module.exports = main; diff --git a/lib/node_modules/@stdlib/plot/vega/data/tidy/from-array/lib/main.js b/lib/node_modules/@stdlib/plot/vega/data/tidy/from-array/lib/main.js new file mode 100644 index 000000000000..e50507c8be3d --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/data/tidy/from-array/lib/main.js @@ -0,0 +1,55 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var entries2views = require( '@stdlib/array/base/entries2views' ); +var DataSet = require( '@stdlib/plot/vega/data/values' ); + + +// MAIN // + +/** +* Converts an array to a "tidy" data set. +* +* @param {Collection} arr - input array +* @param {string} name - data set name +* @param {Array<string>} fields - list of field names +* @returns {DataSet} data set instance +* +* @example +* var x = [ 1, 2, 3 ]; +* +* var v = array2tidy( x, 'data', [ 'index', 'value' ] ); +* // returns <DataSet> +*/ +function array2tidy( arr, name, fields ) { + // TODO: add input argument validation + + return new DataSet({ + 'name': name, + 'values': entries2views( arr, fields ) + }); +} + + +// EXPORTS // + +module.exports = array2tidy; diff --git a/lib/node_modules/@stdlib/plot/vega/data/tidy/from-array/package.json b/lib/node_modules/@stdlib/plot/vega/data/tidy/from-array/package.json new file mode 100644 index 000000000000..4531faf09f44 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/data/tidy/from-array/package.json @@ -0,0 +1,63 @@ +{ + "name": "@stdlib/plot/vega/data/tidy/from-array", + "version": "0.0.0", + "description": "Convert an array to a tidy data set.", + "license": "Apache-2.0", + "author": { + "name": "The Stdlib Authors", + "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" + }, + "contributors": [ + { + "name": "The Stdlib Authors", + "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" + } + ], + "main": "./lib", + "directories": { + "benchmark": "./benchmark", + "doc": "./docs", + "example": "./examples", + "lib": "./lib", + "test": "./test" + }, + "types": "./docs/types", + "scripts": {}, + "homepage": "https://github.com/stdlib-js/stdlib", + "repository": { + "type": "git", + "url": "git://github.com/stdlib-js/stdlib.git" + }, + "bugs": { + "url": "https://github.com/stdlib-js/stdlib/issues" + }, + "dependencies": {}, + "devDependencies": {}, + "engines": { + "node": ">=0.10.0", + "npm": ">2.7.0" + }, + "os": [ + "aix", + "darwin", + "freebsd", + "linux", + "macos", + "openbsd", + "sunos", + "win32", + "windows" + ], + "keywords": [ + "stdlib", + "plot", + "vega", + "data", + "dataset", + "factory", + "tidy", + "array", + "collection" + ], + "__stdlib__": {} +} diff --git a/lib/node_modules/@stdlib/plot/vega/data/tidy/from-arrays/examples/index.js b/lib/node_modules/@stdlib/plot/vega/data/tidy/from-arrays/examples/index.js new file mode 100644 index 000000000000..b3552d236d41 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/data/tidy/from-arrays/examples/index.js @@ -0,0 +1,32 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +var discreteUniform = require( '@stdlib/random/array/discrete-uniform' ); +var zeroTo = require( '@stdlib/array/zero-to' ); +var arrays2tidy = require( './../lib' ); + +var x = zeroTo( 10 ); +var y = discreteUniform( 10, -100, 100 ); +var data = arrays2tidy( [ x, y ], 'series', [ 'x', 'y' ] ); + +var out = data.toJSON(); +console.log( out ); + +console.log( JSON.stringify( out ) ); diff --git a/lib/node_modules/@stdlib/plot/vega/data/tidy/from-arrays/lib/index.js b/lib/node_modules/@stdlib/plot/vega/data/tidy/from-arrays/lib/index.js new file mode 100644 index 000000000000..f6ef038c992c --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/data/tidy/from-arrays/lib/index.js @@ -0,0 +1,43 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +/** +* Convert a list of arrays to a "tidy" data set. +* +* @module @stdlib/plot/vega/data/tidy/from-arrays +* +* @example +* var arrays2tidy = require( '@stdlib/plot/vega/data/tidy/from-arrays' ); +* +* var x = [ 1, 2, 3 ]; +* var y = [ 4, 5, 6 ]; +* +* var v = arrays2tidy( [ x, y ], 'data', [ 'x', 'y' ] ); +* // returns <DataSet> +*/ + +// MODULES // + +var main = require( './main.js' ); + + +// EXPORTS // + +module.exports = main; diff --git a/lib/node_modules/@stdlib/plot/vega/data/tidy/from-arrays/lib/main.js b/lib/node_modules/@stdlib/plot/vega/data/tidy/from-arrays/lib/main.js new file mode 100644 index 000000000000..6c829efd0671 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/data/tidy/from-arrays/lib/main.js @@ -0,0 +1,56 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var zip2views = require( '@stdlib/array/base/zip2views' ); +var DataSet = require( '@stdlib/plot/vega/data/values' ); + + +// MAIN // + +/** +* Converts a list of arrays to a "tidy" data set. +* +* @param {ArrayLikeObject<Collection>} list - list of arrays +* @param {string} name - data set name +* @param {Array<string>} fields - list of field names +* @returns {DataSet} data set instance +* +* @example +* var x = [ 1, 2, 3 ]; +* var y = [ 4, 5, 6 ]; +* +* var v = arrays2tidy( [ x, y ], 'data', [ 'x', 'y' ] ); +* // returns <DataSet> +*/ +function arrays2tidy( list, name, fields ) { + // TODO: add input argument validation + + return new DataSet({ + 'name': name, + 'values': zip2views( list, fields ) + }); +} + + +// EXPORTS // + +module.exports = arrays2tidy; diff --git a/lib/node_modules/@stdlib/plot/vega/data/tidy/from-arrays/package.json b/lib/node_modules/@stdlib/plot/vega/data/tidy/from-arrays/package.json new file mode 100644 index 000000000000..3fd401f8a4e0 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/data/tidy/from-arrays/package.json @@ -0,0 +1,63 @@ +{ + "name": "@stdlib/plot/vega/data/tidy/from-arrays", + "version": "0.0.0", + "description": "Convert a list of arrays to a tidy data set.", + "license": "Apache-2.0", + "author": { + "name": "The Stdlib Authors", + "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" + }, + "contributors": [ + { + "name": "The Stdlib Authors", + "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" + } + ], + "main": "./lib", + "directories": { + "benchmark": "./benchmark", + "doc": "./docs", + "example": "./examples", + "lib": "./lib", + "test": "./test" + }, + "types": "./docs/types", + "scripts": {}, + "homepage": "https://github.com/stdlib-js/stdlib", + "repository": { + "type": "git", + "url": "git://github.com/stdlib-js/stdlib.git" + }, + "bugs": { + "url": "https://github.com/stdlib-js/stdlib/issues" + }, + "dependencies": {}, + "devDependencies": {}, + "engines": { + "node": ">=0.10.0", + "npm": ">2.7.0" + }, + "os": [ + "aix", + "darwin", + "freebsd", + "linux", + "macos", + "openbsd", + "sunos", + "win32", + "windows" + ], + "keywords": [ + "stdlib", + "plot", + "vega", + "data", + "dataset", + "factory", + "tidy", + "array", + "collection" + ], + "__stdlib__": {} +} diff --git a/lib/node_modules/@stdlib/plot/vega/data/tidy/from-matrix-columns/examples/index.js b/lib/node_modules/@stdlib/plot/vega/data/tidy/from-matrix-columns/examples/index.js new file mode 100644 index 000000000000..ff7253b8c55c --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/data/tidy/from-matrix-columns/examples/index.js @@ -0,0 +1,36 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +var discreteUniform = require( '@stdlib/random/array/discrete-uniform' ); +var array = require( '@stdlib/ndarray/array' ); +var columns2tidy = require( './../lib' ); + +var arr = array( discreteUniform( 10, -100, 100 ), { + 'shape': [ 5, 2 ] +}); +var data = columns2tidy( arr, [ 'series1', 'series2' ], [ 'x', 'y' ] ); + +var out = data[ 0 ].toJSON(); +console.log( out ); + +out = data[ 1 ].toJSON(); +console.log( out ); + +console.log( JSON.stringify( data ) ); diff --git a/lib/node_modules/@stdlib/plot/vega/data/tidy/from-matrix-columns/lib/index.js b/lib/node_modules/@stdlib/plot/vega/data/tidy/from-matrix-columns/lib/index.js new file mode 100644 index 000000000000..65d17c42874f --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/data/tidy/from-matrix-columns/lib/index.js @@ -0,0 +1,45 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +/** +* Convert the columns of a two-dimensional ndarray to "tidy" data sets. +* +* @module @stdlib/plot/vega/data/tidy/from-matrix-columns +* +* @example +* var array = require( '@stdlib/ndarray/array' ); +* var columns2tidy = require( '@stdlib/plot/vega/data/tidy/from-matrix-columns' ); +* +* var x = array( [ 1, 2, 3, 4 ], { +* 'shape': [ 2, 2 ] +* }); +* +* var v = columns2tidy( x, [ 'series1', 'series2' ], [ 'index', 'value' ] ); +* // returns [ <DataSet>, <DataSet> ] +*/ + +// MODULES // + +var main = require( './main.js' ); + + +// EXPORTS // + +module.exports = main; diff --git a/lib/node_modules/@stdlib/plot/vega/data/tidy/from-matrix-columns/lib/main.js b/lib/node_modules/@stdlib/plot/vega/data/tidy/from-matrix-columns/lib/main.js new file mode 100644 index 000000000000..64750897d337 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/data/tidy/from-matrix-columns/lib/main.js @@ -0,0 +1,97 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var array2ndarray = require( '@stdlib/ndarray/base/from-array' ); +var zip2views1d = require( '@stdlib/ndarray/base/zip2views1d' ); +var zeroTo = require( '@stdlib/array/zero-to' ); +var getShape = require( '@stdlib/ndarray/shape' ); +var defaults = require( '@stdlib/ndarray/defaults' ); +var nditerColumns = require( '@stdlib/ndarray/iter/columns' ); +var DataSet = require( '@stdlib/plot/vega/data/values' ); + + +// VARIABLES // + +// Resolve the default memory layout: +var ORDER = defaults.get( 'order' ); + +// Specify the default index data type for the index array: +var DTYPE = 'float64'; // note: we don't use `dtype.index`, as that can be `int32` which would prevent accommodating arrays having lengths greater than 2^31-1 + + +// MAIN // + +/** +* Converts the columns of a two-dimensional ndarray to "tidy" data sets. +* +* @param {ndarrayLike} arr - input array +* @param {Array<string>} names - data set (column) names +* @param {Array<string>} fields - list of field names +* @returns {Array<DataSet>} array of data sets +* +* @example +* var array = require( '@stdlib/ndarray/array' ); +* +* var x = array( [ 1, 2, 3, 4 ], { +* 'shape': [ 2, 2 ] +* }); +* +* var v = columns2tidy( x, [ 'series1', 'series2' ], [ 'index', 'value' ] ); +* // returns [ <DataSet>, <DataSet> ] +*/ +function columns2tidy( arr, names, fields ) { + var indices; + var out; + var it; + var sh; + var v; + var d; + var i; + + // TODO: add input argument validation + + sh = getShape( arr ); + indices = zeroTo( sh[ 0 ], DTYPE ); + indices = array2ndarray( indices, ORDER ); + + it = nditerColumns( arr ); + out = []; + i = 0; + while ( true ) { + v = it.next(); + if ( v.done ) { + break; + } + d = new DataSet({ + 'name': names[ i ], + 'values': zip2views1d( [ indices, v.value ], fields ) + }); + out.push( d ); + i += 1; + } + return out; +} + + +// EXPORTS // + +module.exports = columns2tidy; diff --git a/lib/node_modules/@stdlib/plot/vega/data/tidy/from-matrix-columns/package.json b/lib/node_modules/@stdlib/plot/vega/data/tidy/from-matrix-columns/package.json new file mode 100644 index 000000000000..2d9b69a0dc10 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/data/tidy/from-matrix-columns/package.json @@ -0,0 +1,65 @@ +{ + "name": "@stdlib/plot/vega/data/tidy/from-matrix-columns", + "version": "0.0.0", + "description": "Convert the columns of a two-dimensional ndarray to tidy data sets.", + "license": "Apache-2.0", + "author": { + "name": "The Stdlib Authors", + "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" + }, + "contributors": [ + { + "name": "The Stdlib Authors", + "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" + } + ], + "main": "./lib", + "directories": { + "benchmark": "./benchmark", + "doc": "./docs", + "example": "./examples", + "lib": "./lib", + "test": "./test" + }, + "types": "./docs/types", + "scripts": {}, + "homepage": "https://github.com/stdlib-js/stdlib", + "repository": { + "type": "git", + "url": "git://github.com/stdlib-js/stdlib.git" + }, + "bugs": { + "url": "https://github.com/stdlib-js/stdlib/issues" + }, + "dependencies": {}, + "devDependencies": {}, + "engines": { + "node": ">=0.10.0", + "npm": ">2.7.0" + }, + "os": [ + "aix", + "darwin", + "freebsd", + "linux", + "macos", + "openbsd", + "sunos", + "win32", + "windows" + ], + "keywords": [ + "stdlib", + "plot", + "vega", + "data", + "dataset", + "factory", + "tidy", + "array", + "ndarray", + "multidimensional", + "matrix" + ], + "__stdlib__": {} +} diff --git a/lib/node_modules/@stdlib/plot/vega/data/tidy/from-nested-array/examples/index.js b/lib/node_modules/@stdlib/plot/vega/data/tidy/from-nested-array/examples/index.js new file mode 100644 index 000000000000..4b8fe813cc23 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/data/tidy/from-nested-array/examples/index.js @@ -0,0 +1,31 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +var discreteUniform = require( '@stdlib/random/base/discrete-uniform' ).factory; +var filled2dBy = require( '@stdlib/array/base/filled2d-by' ); +var nested2tidy = require( './../lib' ); + +var arr = filled2dBy( [ 10, 2 ], discreteUniform( -100, 100 ) ); +var data = nested2tidy( arr, 'series', [ 'x', 'y' ] ); + +var out = data.toJSON(); +console.log( out ); + +console.log( JSON.stringify( out ) ); diff --git a/lib/node_modules/@stdlib/plot/vega/data/tidy/from-nested-array/lib/index.js b/lib/node_modules/@stdlib/plot/vega/data/tidy/from-nested-array/lib/index.js new file mode 100644 index 000000000000..0072b6fed2c4 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/data/tidy/from-nested-array/lib/index.js @@ -0,0 +1,42 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +/** +* Convert an array of arrays to a "tidy" data set. +* +* @module @stdlib/plot/vega/data/tidy/from-nested-array +* +* @example +* var nested2tidy = require( '@stdlib/plot/vega/data/tidy/from-nested-array' ); +* +* var x = [ [ 1, 2 ], [ 3, 4 ] ]; +* +* var v = nested2tidy( x, 'data', [ 'x', 'y' ] ); +* // returns <DataSet> +*/ + +// MODULES // + +var main = require( './main.js' ); + + +// EXPORTS // + +module.exports = main; diff --git a/lib/node_modules/@stdlib/plot/vega/data/tidy/from-nested-array/lib/main.js b/lib/node_modules/@stdlib/plot/vega/data/tidy/from-nested-array/lib/main.js new file mode 100644 index 000000000000..127fd7e21065 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/data/tidy/from-nested-array/lib/main.js @@ -0,0 +1,55 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var nested2views = require( '@stdlib/array/base/nested2views' ); +var DataSet = require( '@stdlib/plot/vega/data/values' ); + + +// MAIN // + +/** +* Converts an array of arrays to a "tidy" data set. +* +* @param {Collection<Collection>} arr - input array containing nested arrays +* @param {string} name - data set name +* @param {Array<string>} fields - list of field names +* @returns {DataSet} data set instance +* +* @example +* var x = [ [ 1, 2 ], [ 3, 4 ] ]; +* +* var v = nested2tidy( x, 'data', [ 'index', 'value' ] ); +* // returns <DataSet> +*/ +function nested2tidy( arr, name, fields ) { + // TODO: add input argument validation + + return new DataSet({ + 'name': name, + 'values': nested2views( arr, fields ) + }); +} + + +// EXPORTS // + +module.exports = nested2tidy; diff --git a/lib/node_modules/@stdlib/plot/vega/data/tidy/from-nested-array/package.json b/lib/node_modules/@stdlib/plot/vega/data/tidy/from-nested-array/package.json new file mode 100644 index 000000000000..6e2cd3fea642 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/data/tidy/from-nested-array/package.json @@ -0,0 +1,64 @@ +{ + "name": "@stdlib/plot/vega/data/tidy/from-nested-array", + "version": "0.0.0", + "description": "Convert an array of arrays to a tidy data set.", + "license": "Apache-2.0", + "author": { + "name": "The Stdlib Authors", + "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" + }, + "contributors": [ + { + "name": "The Stdlib Authors", + "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" + } + ], + "main": "./lib", + "directories": { + "benchmark": "./benchmark", + "doc": "./docs", + "example": "./examples", + "lib": "./lib", + "test": "./test" + }, + "types": "./docs/types", + "scripts": {}, + "homepage": "https://github.com/stdlib-js/stdlib", + "repository": { + "type": "git", + "url": "git://github.com/stdlib-js/stdlib.git" + }, + "bugs": { + "url": "https://github.com/stdlib-js/stdlib/issues" + }, + "dependencies": {}, + "devDependencies": {}, + "engines": { + "node": ">=0.10.0", + "npm": ">2.7.0" + }, + "os": [ + "aix", + "darwin", + "freebsd", + "linux", + "macos", + "openbsd", + "sunos", + "win32", + "windows" + ], + "keywords": [ + "stdlib", + "plot", + "vega", + "data", + "dataset", + "factory", + "tidy", + "array", + "collection", + "nested" + ], + "__stdlib__": {} +} diff --git a/lib/node_modules/@stdlib/plot/vega/data/tidy/from-nested-arrays/examples/index.js b/lib/node_modules/@stdlib/plot/vega/data/tidy/from-nested-arrays/examples/index.js new file mode 100644 index 000000000000..4cb486e44e27 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/data/tidy/from-nested-arrays/examples/index.js @@ -0,0 +1,35 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +var discreteUniform = require( '@stdlib/random/base/discrete-uniform' ).factory; +var filled2dBy = require( '@stdlib/array/base/filled2d-by' ); +var nestedarrays2tidy = require( './../lib' ); + +var arr1 = filled2dBy( [ 10, 2 ], discreteUniform( -100, 100 ) ); +var arr2 = filled2dBy( [ 10, 2 ], discreteUniform( -100, 100 ) ); +var data = nestedarrays2tidy( [ arr1, arr2 ], [ 'series1', 'series2' ], [ 'x', 'y' ] ); + +var out = data[ 0 ].toJSON(); +console.log( out ); + +out = data[ 1 ].toJSON(); +console.log( out ); + +console.log( JSON.stringify( out ) ); diff --git a/lib/node_modules/@stdlib/plot/vega/data/tidy/from-nested-arrays/lib/index.js b/lib/node_modules/@stdlib/plot/vega/data/tidy/from-nested-arrays/lib/index.js new file mode 100644 index 000000000000..1a4827b97670 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/data/tidy/from-nested-arrays/lib/index.js @@ -0,0 +1,43 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +/** +* Convert a list of nested arrays to "tidy" data sets. +* +* @module @stdlib/plot/vega/data/tidy/from-nested-arrays +* +* @example +* var nestedarrays2tidy = require( '@stdlib/plot/vega/data/tidy/from-nested-arrays' ); +* +* var a = [ [ 1, 2 ], [ 3, 4 ] ]; +* var b = [ [ 5, 6 ], [ 7, 8 ] ]; +* +* var v = nestedarrays2tidy( [ a, b ], [ 'data1', 'data2' ], [ 'x', 'y' ] ); +* // returns [ <DataSet>, <DataSet> ] +*/ + +// MODULES // + +var main = require( './main.js' ); + + +// EXPORTS // + +module.exports = main; diff --git a/lib/node_modules/@stdlib/plot/vega/data/tidy/from-nested-arrays/lib/main.js b/lib/node_modules/@stdlib/plot/vega/data/tidy/from-nested-arrays/lib/main.js new file mode 100644 index 000000000000..674c9643d942 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/data/tidy/from-nested-arrays/lib/main.js @@ -0,0 +1,61 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var nested2tidy = require( '@stdlib/plot/vega/data/tidy/from-nested-array' ); + + +// MAIN // + +/** +* Converts a list of nested arrays to "tidy" data sets. +* +* @param {ArrayLikeObject<ArrayLikeObject<Collection>>} arr - list of nested arrays +* @param {Array<string>} names - data set names +* @param {Array<string>} fields - list of field names +* @returns {Array<DataSet>} list of data set +* +* @example +* var a = [ [ 1, 2 ], [ 3, 4 ] ]; +* var b = [ [ 5, 6 ], [ 7, 8 ] ]; +* +* var v = nestedarrays2tidy( [ a, b ], [ 'data1', 'data2' ], [ 'x', 'y' ] ); +* // returns [ <DataSet>, <DataSet> ] +*/ +function nestedarrays2tidy( arr, names, fields ) { + var out; + var d; + var i; + + // TODO: add input argument validation + + out = []; + for ( i = 0; i < arr.length; i++ ) { + d = nested2tidy( arr[ i ], names[ i ], fields ); + out.push( d ); + } + return out; +} + + +// EXPORTS // + +module.exports = nestedarrays2tidy; diff --git a/lib/node_modules/@stdlib/plot/vega/data/tidy/from-nested-arrays/package.json b/lib/node_modules/@stdlib/plot/vega/data/tidy/from-nested-arrays/package.json new file mode 100644 index 000000000000..7ca9c63cbdc7 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/data/tidy/from-nested-arrays/package.json @@ -0,0 +1,64 @@ +{ + "name": "@stdlib/plot/vega/data/tidy/from-nested-arrays", + "version": "0.0.0", + "description": "Convert a list of nested arrays to tidy data sets.", + "license": "Apache-2.0", + "author": { + "name": "The Stdlib Authors", + "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" + }, + "contributors": [ + { + "name": "The Stdlib Authors", + "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" + } + ], + "main": "./lib", + "directories": { + "benchmark": "./benchmark", + "doc": "./docs", + "example": "./examples", + "lib": "./lib", + "test": "./test" + }, + "types": "./docs/types", + "scripts": {}, + "homepage": "https://github.com/stdlib-js/stdlib", + "repository": { + "type": "git", + "url": "git://github.com/stdlib-js/stdlib.git" + }, + "bugs": { + "url": "https://github.com/stdlib-js/stdlib/issues" + }, + "dependencies": {}, + "devDependencies": {}, + "engines": { + "node": ">=0.10.0", + "npm": ">2.7.0" + }, + "os": [ + "aix", + "darwin", + "freebsd", + "linux", + "macos", + "openbsd", + "sunos", + "win32", + "windows" + ], + "keywords": [ + "stdlib", + "plot", + "vega", + "data", + "dataset", + "factory", + "tidy", + "array", + "collection", + "nested" + ], + "__stdlib__": {} +} diff --git a/lib/node_modules/@stdlib/plot/vega/data/tidy/from-object-array/examples/index.js b/lib/node_modules/@stdlib/plot/vega/data/tidy/from-object-array/examples/index.js new file mode 100644 index 000000000000..51b1dfe2f106 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/data/tidy/from-object-array/examples/index.js @@ -0,0 +1,43 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +var discreteUniform = require( '@stdlib/random/base/discrete-uniform' ); +var filledBy = require( '@stdlib/array/base/filled-by' ); +var objarray2tidy = require( './../lib' ); + +function clbk( i ) { + return { + 'a': i, + 'b': discreteUniform( -100, 100 ) + }; +} + +var arr = filledBy( 10, clbk ); + +var mapping = { + 'a': 'x', + 'b': 'y' +}; +var data = objarray2tidy( arr, 'series', mapping ); + +var out = data.toJSON(); +console.log( out ); + +console.log( JSON.stringify( out ) ); diff --git a/lib/node_modules/@stdlib/plot/vega/data/tidy/from-object-array/lib/index.js b/lib/node_modules/@stdlib/plot/vega/data/tidy/from-object-array/lib/index.js new file mode 100644 index 000000000000..239242a2a270 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/data/tidy/from-object-array/lib/index.js @@ -0,0 +1,55 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +/** +* Convert an array of objects to a "tidy" data set. +* +* @module @stdlib/plot/vega/data/tidy/from-object-array +* +* @example +* var objarray2tidy = require( '@stdlib/plot/vega/data/tidy/from-object-array' ); +* +* var x = [ +* { +* 'a': 1, +* 'b': 2 +* }, +* { +* 'a': 3, +* 'b': 4 +* } +* ]; +* +* var mapping = { +* 'a': 'x', +* 'b': 'y' +* }; +* var v = objarray2tidy( x, 'data', mapping ); +* // returns <DataSet> +*/ + +// MODULES // + +var main = require( './main.js' ); + + +// EXPORTS // + +module.exports = main; diff --git a/lib/node_modules/@stdlib/plot/vega/data/tidy/from-object-array/lib/main.js b/lib/node_modules/@stdlib/plot/vega/data/tidy/from-object-array/lib/main.js new file mode 100644 index 000000000000..8f65b1f23540 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/data/tidy/from-object-array/lib/main.js @@ -0,0 +1,87 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var objectKeys = require( '@stdlib/utils/keys' ); +var rekeyViews = require( '@stdlib/array/base/rekey-views' ); +var DataSet = require( '@stdlib/plot/vega/data/values' ); + + +// MAIN // + +/** +* Converts an array of object to a "tidy" data set. +* +* @param {ArrayLikeObject<Object>} arr - input array +* @param {string} name - data set name +* @param {Object} [mapping] - object mapping existing field names to new field names +* @returns {DataSet} data set instance +* +* @example +* var x = [ +* { +* 'a': 1, +* 'b': 2 +* }, +* { +* 'a': 3, +* 'b': 4 +* } +* ]; +* +* var mapping = { +* 'a': 'x', +* 'b': 'y' +* }; +* var v = objarray2tidy( x, 'data', mapping ); +* // returns <DataSet> +*/ +function objarray2tidy( arr, name, mapping ) { + var keys; + var flg; + var i; + var k; + + // TODO: add input argument validation + + if ( arguments.length > 2 ) { + // Resolve the list of keys needing to be mapped: + keys = objectKeys( mapping ); + + // We only want to generate "re-keyed" views if we have to, so check that the mapping object actually contains keys needing to be renamed... + for ( i = 0; i < keys.length; i++ ) { + k = keys[ i ]; + if ( k !== mapping[ k ] ) { + flg = true; + break; + } + } + } + return new DataSet({ + 'name': name, + 'values': ( flg ) ? rekeyViews( arr, mapping ) : arr + }); +} + + +// EXPORTS // + +module.exports = objarray2tidy; diff --git a/lib/node_modules/@stdlib/plot/vega/data/tidy/from-object-array/package.json b/lib/node_modules/@stdlib/plot/vega/data/tidy/from-object-array/package.json new file mode 100644 index 000000000000..b7d2390561b1 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/data/tidy/from-object-array/package.json @@ -0,0 +1,63 @@ +{ + "name": "@stdlib/plot/vega/data/tidy/from-object-array", + "version": "0.0.0", + "description": "Convert an array of objects to a tidy data set.", + "license": "Apache-2.0", + "author": { + "name": "The Stdlib Authors", + "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" + }, + "contributors": [ + { + "name": "The Stdlib Authors", + "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" + } + ], + "main": "./lib", + "directories": { + "benchmark": "./benchmark", + "doc": "./docs", + "example": "./examples", + "lib": "./lib", + "test": "./test" + }, + "types": "./docs/types", + "scripts": {}, + "homepage": "https://github.com/stdlib-js/stdlib", + "repository": { + "type": "git", + "url": "git://github.com/stdlib-js/stdlib.git" + }, + "bugs": { + "url": "https://github.com/stdlib-js/stdlib/issues" + }, + "dependencies": {}, + "devDependencies": {}, + "engines": { + "node": ">=0.10.0", + "npm": ">2.7.0" + }, + "os": [ + "aix", + "darwin", + "freebsd", + "linux", + "macos", + "openbsd", + "sunos", + "win32", + "windows" + ], + "keywords": [ + "stdlib", + "plot", + "vega", + "data", + "dataset", + "factory", + "tidy", + "array", + "collection" + ], + "__stdlib__": {} +} diff --git a/lib/node_modules/@stdlib/plot/vega/data/tidy/from-object-arrays/examples/index.js b/lib/node_modules/@stdlib/plot/vega/data/tidy/from-object-arrays/examples/index.js new file mode 100644 index 000000000000..8268483ca8b2 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/data/tidy/from-object-arrays/examples/index.js @@ -0,0 +1,47 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +var discreteUniform = require( '@stdlib/random/base/discrete-uniform' ); +var filledBy = require( '@stdlib/array/base/filled-by' ); +var objarrays2tidy = require( './../lib' ); + +function clbk( i ) { + return { + 'a': i, + 'b': discreteUniform( -100, 100 ) + }; +} + +var arr1 = filledBy( 10, clbk ); +var arr2 = filledBy( 10, clbk ); + +var mapping = { + 'a': 'x', + 'b': 'y' +}; +var data = objarrays2tidy( [ arr1, arr2 ], [ 'series1', 'series2' ], mapping ); + +var out = data[ 0 ].toJSON(); +console.log( out ); + +out = data[ 1 ].toJSON(); +console.log( out ); + +console.log( JSON.stringify( out ) ); diff --git a/lib/node_modules/@stdlib/plot/vega/data/tidy/from-object-arrays/lib/index.js b/lib/node_modules/@stdlib/plot/vega/data/tidy/from-object-arrays/lib/index.js new file mode 100644 index 000000000000..2d74d4d57023 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/data/tidy/from-object-arrays/lib/index.js @@ -0,0 +1,66 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +/** +* Convert a list of object arrays to "tidy" data sets. +* +* @module @stdlib/plot/vega/data/tidy/from-object-arrays +* +* @example +* var objarrays2tidy = require( '@stdlib/plot/vega/data/tidy/from-object-arrays' ); +* +* var x = [ +* { +* 'a': 1, +* 'b': 2 +* }, +* { +* 'a': 3, +* 'b': 4 +* } +* ]; + +* var y = [ +* { +* 'a': 5, +* 'b': 6 +* }, +* { +* 'a': 7, +* 'b': 8 +* } +* ]; +* +* var mapping = { +* 'a': 'x', +* 'b': 'y' +* }; +* var v = objarrays2tidy( [ x, y ], [ 'data1', 'data2' ], mapping ); +* // returns [ <DataSet>, <DataSet> ] +*/ + +// MODULES // + +var main = require( './main.js' ); + + +// EXPORTS // + +module.exports = main; diff --git a/lib/node_modules/@stdlib/plot/vega/data/tidy/from-object-arrays/lib/main.js b/lib/node_modules/@stdlib/plot/vega/data/tidy/from-object-arrays/lib/main.js new file mode 100644 index 000000000000..08205ff488b1 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/data/tidy/from-object-arrays/lib/main.js @@ -0,0 +1,84 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var objarray2tidy = require( '@stdlib/plot/vega/data/tidy/from-object-array' ); + + +// MAIN // + +/** +* Convert a list of object arrays to "tidy" data sets. +* +* @param {ArrayLikeObject<ArrayLikeObject<Object>>} arr - list of arrays +* @param {Array<string>} names - data set names +* @param {Object} [mapping] - object mapping existing field names to new field names +* @returns {Array<DataSet>} list of data sets +* +* @example +* var x = [ +* { +* 'a': 1, +* 'b': 2 +* }, +* { +* 'a': 3, +* 'b': 4 +* } +* ]; + +* var y = [ +* { +* 'a': 5, +* 'b': 6 +* }, +* { +* 'a': 7, +* 'b': 8 +* } +* ]; +* +* var mapping = { +* 'a': 'x', +* 'b': 'y' +* }; +* var v = objarrays2tidy( [ x, y ], [ 'data1', 'data2' ], mapping ); +* // returns [ <DataSet>, <DataSet> ] +*/ +function objarrays2tidy( arr, names, mapping ) { + var out; + var d; + var i; + + // TODO: add input argument validation + + out = []; + for ( i = 0; i < arr.length; i++ ) { + d = objarray2tidy( arr[ i ], names[ i ], mapping ); + out.push( d ); + } + return out; +} + + +// EXPORTS // + +module.exports = objarrays2tidy; diff --git a/lib/node_modules/@stdlib/plot/vega/data/tidy/from-object-arrays/package.json b/lib/node_modules/@stdlib/plot/vega/data/tidy/from-object-arrays/package.json new file mode 100644 index 000000000000..cb0a2a3be6d1 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/data/tidy/from-object-arrays/package.json @@ -0,0 +1,63 @@ +{ + "name": "@stdlib/plot/vega/data/tidy/from-object-arrays", + "version": "0.0.0", + "description": "Convert a list of object arrays to tidy data sets.", + "license": "Apache-2.0", + "author": { + "name": "The Stdlib Authors", + "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" + }, + "contributors": [ + { + "name": "The Stdlib Authors", + "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" + } + ], + "main": "./lib", + "directories": { + "benchmark": "./benchmark", + "doc": "./docs", + "example": "./examples", + "lib": "./lib", + "test": "./test" + }, + "types": "./docs/types", + "scripts": {}, + "homepage": "https://github.com/stdlib-js/stdlib", + "repository": { + "type": "git", + "url": "git://github.com/stdlib-js/stdlib.git" + }, + "bugs": { + "url": "https://github.com/stdlib-js/stdlib/issues" + }, + "dependencies": {}, + "devDependencies": {}, + "engines": { + "node": ">=0.10.0", + "npm": ">2.7.0" + }, + "os": [ + "aix", + "darwin", + "freebsd", + "linux", + "macos", + "openbsd", + "sunos", + "win32", + "windows" + ], + "keywords": [ + "stdlib", + "plot", + "vega", + "data", + "dataset", + "factory", + "tidy", + "array", + "collection" + ], + "__stdlib__": {} +} diff --git a/lib/node_modules/@stdlib/plot/vega/data/tidy/from-paired-arrays/examples/index.js b/lib/node_modules/@stdlib/plot/vega/data/tidy/from-paired-arrays/examples/index.js new file mode 100644 index 000000000000..96493689fe53 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/data/tidy/from-paired-arrays/examples/index.js @@ -0,0 +1,37 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +var discreteUniform = require( '@stdlib/random/array/discrete-uniform' ); +var zeroTo = require( '@stdlib/array/zero-to' ); +var pairedarrays2tidy = require( './../lib' ); + +var x = zeroTo( 10 ); +var y = discreteUniform( 10, -100, 100 ); +var z = discreteUniform( 10, -100, 100 ); + +var data = pairedarrays2tidy( [ x ], [ y, z ], [ 'series1', 'series2' ], [ 'x', 'y' ] ); + +var out = data[ 0 ].toJSON(); +console.log( out ); + +out = data[ 1 ].toJSON(); +console.log( out ); + +console.log( JSON.stringify( data ) ); diff --git a/lib/node_modules/@stdlib/plot/vega/data/tidy/from-paired-arrays/lib/index.js b/lib/node_modules/@stdlib/plot/vega/data/tidy/from-paired-arrays/lib/index.js new file mode 100644 index 000000000000..7d656533341e --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/data/tidy/from-paired-arrays/lib/index.js @@ -0,0 +1,47 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +/** +* Create tidy data sets by pairing each array in one list of arrays with a corresponding array in another list of arrays. +* +* @module @stdlib/plot/vega/data/tidy/from-paired-arrays +* +* @example +* var pairedarrays2tidy = require( '@stdlib/plot/vega/data/tidy/from-paired-arrays' ); +* +* var x = [ 1, 2, 3 ]; +* var y = [ 4, 5, 6 ]; +* var z = [ 7, 8, 9 ]; +* +* var names = [ 'data1', 'data2' ]; +* var fields = [ 'x', 'y' ]; +* +* var v = pairedarrays2tidy( [ x ], [ y, z ], names, fields ); +* // returns [ <DataSet>, <DataSet> ] +*/ + +// MODULES // + +var main = require( './main.js' ); + + +// EXPORTS // + +module.exports = main; diff --git a/lib/node_modules/@stdlib/plot/vega/data/tidy/from-paired-arrays/lib/main.js b/lib/node_modules/@stdlib/plot/vega/data/tidy/from-paired-arrays/lib/main.js new file mode 100644 index 000000000000..17c5360409a0 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/data/tidy/from-paired-arrays/lib/main.js @@ -0,0 +1,111 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var arrays2tidy = require( '@stdlib/plot/vega/data/tidy/from-arrays' ); + + +// MAIN // + +/** +* Creates tidy data sets by pairing each array in one list of arrays with a corresponding array in another list of arrays. +* +* ## Notes +* +* - The function provided limited support for "broadcasting". If either list of arrays contains only a single array, that array is broadcasted against the arrays in the other list. +* +* @param {ArrayLikeObject<ArrayLikeObject<Collection>>} list1 - first list of arrays +* @param {ArrayLikeObject<ArrayLikeObject<Collection>>} list2 - second list of arrays +* @param {Array<string>} names - data set names +* @param {Array<string>} fields - list of field names +* @throws {Error} provided lists must be broadcast-compatible +* @throws {Error} must provide non-empty lists +* @returns {Array<DataSet>} list of data sets +* +* @example +* var x = [ 1, 2, 3 ]; +* var y = [ 4, 5, 6 ]; +* var z = [ 7, 8, 9 ]; +* +* var names = [ 'data1', 'data2' ]; +* var fields = [ 'x', 'y' ]; +* +* var v = pairedarrays2tidy( [ x ], [ y, z ], names, fields ); +* // returns [ <DataSet>, <DataSet> ] +*/ +function pairedarrays2tidy( list1, list2, names, fields ) { + var out; + var S1; + var S2; + var sx; + var sy; + var ix; + var iy; + var N; + var d; + var i; + + // TODO: add input argument validation + + S1 = list1.length; + S2 = list2.length; + if ( S1 === 0 ) { + throw new Error( 'invalid argument. First argument must be a non-empty array.' ); + } + if ( S2 === 0 ) { + throw new Error( 'invalid argument. Second argument must be a non-empty array.' ); + } + // Resolve iteration strides to allow for broadcasting... + if ( S1 === 1 ) { + sx = 0; + } else { + sx = 1; + } + if ( S2 === 1 ) { + sy = 0; + } else { + sy = 1; + } + // Determine the number of data sets... + if ( S1 > S2 ) { + N = S1; + } else { + N = S2; + } + // Initialize pointers to the first indexed elements in each list: + ix = 0; + iy = 0; + + // Create the datasets... + out = []; + for ( i = 0; i < N; i++ ) { + d = arrays2tidy( [ list1[ ix ], list2[ iy ] ], names[ i ], fields ); + out.push( d ); + ix += sx; + iy += sy; + } + return out; +} + + +// EXPORTS // + +module.exports = pairedarrays2tidy; diff --git a/lib/node_modules/@stdlib/plot/vega/data/tidy/from-paired-arrays/package.json b/lib/node_modules/@stdlib/plot/vega/data/tidy/from-paired-arrays/package.json new file mode 100644 index 000000000000..fabdfe31c43d --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/data/tidy/from-paired-arrays/package.json @@ -0,0 +1,64 @@ +{ + "name": "@stdlib/plot/vega/data/tidy/from-paired-arrays", + "version": "0.0.0", + "description": "Create tidy data sets by pairing each array in one list of arrays with a corresponding array in another list of arrays.", + "license": "Apache-2.0", + "author": { + "name": "The Stdlib Authors", + "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" + }, + "contributors": [ + { + "name": "The Stdlib Authors", + "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" + } + ], + "main": "./lib", + "directories": { + "benchmark": "./benchmark", + "doc": "./docs", + "example": "./examples", + "lib": "./lib", + "test": "./test" + }, + "types": "./docs/types", + "scripts": {}, + "homepage": "https://github.com/stdlib-js/stdlib", + "repository": { + "type": "git", + "url": "git://github.com/stdlib-js/stdlib.git" + }, + "bugs": { + "url": "https://github.com/stdlib-js/stdlib/issues" + }, + "dependencies": {}, + "devDependencies": {}, + "engines": { + "node": ">=0.10.0", + "npm": ">2.7.0" + }, + "os": [ + "aix", + "darwin", + "freebsd", + "linux", + "macos", + "openbsd", + "sunos", + "win32", + "windows" + ], + "keywords": [ + "stdlib", + "plot", + "vega", + "data", + "dataset", + "factory", + "tidy", + "array", + "collection", + "paired" + ], + "__stdlib__": {} +} diff --git a/lib/node_modules/@stdlib/plot/vega/data/tidy/from-paired-matrix-columns/examples/index.js b/lib/node_modules/@stdlib/plot/vega/data/tidy/from-paired-matrix-columns/examples/index.js new file mode 100644 index 000000000000..2d898916dae3 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/data/tidy/from-paired-matrix-columns/examples/index.js @@ -0,0 +1,43 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +var discreteUniform = require( '@stdlib/random/array/discrete-uniform' ); +var zeroTo = require( '@stdlib/array/zero-to' ); +var array = require( '@stdlib/ndarray/array' ); +var pairedcolumns2tidy = require( './../lib' ); + +var x = array( zeroTo( 10 ), { + 'shape': [ 5, 2 ], + 'order': 'column-major' +}); +var y = array( discreteUniform( 10, -100, 100 ), { + 'shape': [ 5, 2 ], + 'order': 'column-major' +}); + +var data = pairedcolumns2tidy( x, y, [ 'series1', 'series2' ], [ 'x', 'y' ] ); + +var out = data[ 0 ].toJSON(); +console.log( out ); + +out = data[ 1 ].toJSON(); +console.log( out ); + +console.log( JSON.stringify( data ) ); diff --git a/lib/node_modules/@stdlib/plot/vega/data/tidy/from-paired-matrix-columns/lib/index.js b/lib/node_modules/@stdlib/plot/vega/data/tidy/from-paired-matrix-columns/lib/index.js new file mode 100644 index 000000000000..111720209d88 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/data/tidy/from-paired-matrix-columns/lib/index.js @@ -0,0 +1,51 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +/** +* Create tidy data sets by pairing each column in a two-dimensional ndarray with its counterpart in another two-dimensional ndarray. +* +* @module @stdlib/plot/vega/data/tidy/from-paired-matrix-columns +* +* @example +* var array = require( '@stdlib/ndarray/array' ); +* var pairedcolumns2tidy = require( '@stdlib/plot/vega/data/tidy/from-paired-matrix-columns' ); +* +* var opts = { +* 'shape': [ 2, 2 ], +* 'order': 'column-major' +* }; +* var x = array( [ 1, 2, 3, 4 ], opts ); +* var y = array( [ 5, 6, 7, 8 ], opts ); +* +* var names = [ 'data1', 'data2' ]; +* var fields = [ 'x', 'y' ]; +* +* var v = pairedcolumns2tidy( x, y, names, fields ); +* // returns [ <DataSet>, <DataSet> ] +*/ + +// MODULES // + +var main = require( './main.js' ); + + +// EXPORTS // + +module.exports = main; diff --git a/lib/node_modules/@stdlib/plot/vega/data/tidy/from-paired-matrix-columns/lib/main.js b/lib/node_modules/@stdlib/plot/vega/data/tidy/from-paired-matrix-columns/lib/main.js new file mode 100644 index 000000000000..4dc0a2635add --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/data/tidy/from-paired-matrix-columns/lib/main.js @@ -0,0 +1,75 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var nditerColumns = require( '@stdlib/ndarray/iter/columns' ); +var iter2array = require( '@stdlib/array/from-iterator' ); +var pairedvectors2tidy = require( '@stdlib/plot/vega/data/tidy/from-paired-vectors' ); + + +// MAIN // + +/** +* Creates tidy data sets by pairing each column in a two-dimensional ndarray with its counterpart in another two-dimensional ndarray. +* +* ## Notes +* +* - The function provided limited support for "broadcasting". If either ndarray contains only a single column, that column is broadcasted against all the columns in the other ndarray. +* +* @param {ndarrayLike} x - first ndarray +* @param {ndarrayLike} y - second ndarray +* @param {Array<string>} names - data set names +* @param {Array<string>} fields - list of field names +* @throws {Error} provided ndarrays must be broadcast-compatible +* @throws {Error} must provide non-empty ndarrays +* @returns {Array<DataSet>} list of data sets +* +* @example +* var array = require( '@stdlib/ndarray/array' ); +* +* var opts = { +* 'shape': [ 2, 2 ], +* 'order': 'column-major' +* }; +* var x = array( [ 1, 2, 3, 4 ], opts ); +* var y = array( [ 5, 6, 7, 8 ], opts ); +* +* var names = [ 'data1', 'data2' ]; +* var fields = [ 'x', 'y' ]; +* +* var v = pairedcolumns2tidy( x, y, names, fields ); +* // returns [ <DataSet>, <DataSet> ] +*/ +function pairedcolumns2tidy( x, y, names, fields ) { + var list1; + var list2; + + // TODO: add input argument validation + + list1 = iter2array( nditerColumns( x ) ); + list2 = iter2array( nditerColumns( y ) ); + return pairedvectors2tidy( list1, list2, names, fields ); +} + + +// EXPORTS // + +module.exports = pairedcolumns2tidy; diff --git a/lib/node_modules/@stdlib/plot/vega/data/tidy/from-paired-matrix-columns/package.json b/lib/node_modules/@stdlib/plot/vega/data/tidy/from-paired-matrix-columns/package.json new file mode 100644 index 000000000000..865523b82d74 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/data/tidy/from-paired-matrix-columns/package.json @@ -0,0 +1,66 @@ +{ + "name": "@stdlib/plot/vega/data/tidy/from-paired-matrix-columns", + "version": "0.0.0", + "description": "Create tidy data sets by pairing each column in a two-dimensional ndarray with its counterpart in another two-dimensional ndarray.", + "license": "Apache-2.0", + "author": { + "name": "The Stdlib Authors", + "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" + }, + "contributors": [ + { + "name": "The Stdlib Authors", + "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" + } + ], + "main": "./lib", + "directories": { + "benchmark": "./benchmark", + "doc": "./docs", + "example": "./examples", + "lib": "./lib", + "test": "./test" + }, + "types": "./docs/types", + "scripts": {}, + "homepage": "https://github.com/stdlib-js/stdlib", + "repository": { + "type": "git", + "url": "git://github.com/stdlib-js/stdlib.git" + }, + "bugs": { + "url": "https://github.com/stdlib-js/stdlib/issues" + }, + "dependencies": {}, + "devDependencies": {}, + "engines": { + "node": ">=0.10.0", + "npm": ">2.7.0" + }, + "os": [ + "aix", + "darwin", + "freebsd", + "linux", + "macos", + "openbsd", + "sunos", + "win32", + "windows" + ], + "keywords": [ + "stdlib", + "plot", + "vega", + "data", + "dataset", + "factory", + "tidy", + "array", + "ndarray", + "multidimensional", + "matrix", + "paired" + ], + "__stdlib__": {} +} diff --git a/lib/node_modules/@stdlib/plot/vega/data/tidy/from-paired-vectors/examples/index.js b/lib/node_modules/@stdlib/plot/vega/data/tidy/from-paired-vectors/examples/index.js new file mode 100644 index 000000000000..4110f34dd692 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/data/tidy/from-paired-vectors/examples/index.js @@ -0,0 +1,38 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +var discreteUniform = require( '@stdlib/random/array/discrete-uniform' ); +var zeroTo = require( '@stdlib/array/zero-to' ); +var array = require( '@stdlib/ndarray/array' ); +var pairedvectors2tidy = require( './../lib' ); + +var x = array( zeroTo( 10 ) ); +var y = array( discreteUniform( 10, -100, 100 ) ); +var z = array( discreteUniform( 10, -100, 100 ) ); + +var data = pairedvectors2tidy( [ x ], [ y, z ], [ 'series1', 'series2' ], [ 'x', 'y' ] ); + +var out = data[ 0 ].toJSON(); +console.log( out ); + +out = data[ 1 ].toJSON(); +console.log( out ); + +console.log( JSON.stringify( data ) ); diff --git a/lib/node_modules/@stdlib/plot/vega/data/tidy/from-paired-vectors/lib/index.js b/lib/node_modules/@stdlib/plot/vega/data/tidy/from-paired-vectors/lib/index.js new file mode 100644 index 000000000000..1be2d4ee8c84 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/data/tidy/from-paired-vectors/lib/index.js @@ -0,0 +1,48 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +/** +* Create tidy data sets by pairing each one-dimensional ndarray in one list with its counterpart in another list. +* +* @module @stdlib/plot/vega/data/tidy/from-paired-vectors +* +* @example +* var array = require( '@stdlib/ndarray/array' ); +* var pairedvectors2tidy = require( '@stdlib/plot/vega/data/tidy/from-paired-vectors' ); +* +* var x = array( [ 1, 2, 3 ] ); +* var y = array( [ 4, 5, 6 ] ); +* var z = array( [ 7, 8, 9 ] ); +* +* var names = [ 'data1', 'data2' ]; +* var fields = [ 'x', 'y' ]; +* +* var v = pairedvectors2tidy( [ x ], [ y, z ], names, fields ); +* // returns [ <DataSet>, <DataSet> ] +*/ + +// MODULES // + +var main = require( './main.js' ); + + +// EXPORTS // + +module.exports = main; diff --git a/lib/node_modules/@stdlib/plot/vega/data/tidy/from-paired-vectors/lib/main.js b/lib/node_modules/@stdlib/plot/vega/data/tidy/from-paired-vectors/lib/main.js new file mode 100644 index 000000000000..e1f6931ea885 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/data/tidy/from-paired-vectors/lib/main.js @@ -0,0 +1,113 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var vectors2tidy = require( '@stdlib/plot/vega/data/tidy/from-vectors' ); + + +// MAIN // + +/** +* Creates tidy data sets by pairing each one-dimensional ndarray in one list with its counterpart in another list. +* +* ## Notes +* +* - The function provided limited support for "broadcasting". If either list of ndarrays contains only a single ndarray, that ndarray is broadcasted against the ndarrays in the other list. +* +* @param {ArrayLikeObject<ArrayLikeObject<ndarrayLike>>} list1 - first list of ndarrays +* @param {ArrayLikeObject<ArrayLikeObject<ndarrayLike>>} list2 - second list of ndarrays +* @param {Array<string>} names - data set names +* @param {Array<string>} fields - list of field names +* @throws {Error} provided lists must be broadcast-compatible +* @throws {Error} must provide non-empty lists +* @returns {Array<DataSet>} list of data sets +* +* @example +* var array = require( '@stdlib/ndarray/array' ); +* +* var x = array( [ 1, 2, 3 ] ); +* var y = array( [ 4, 5, 6 ] ); +* var z = array( [ 7, 8, 9 ] ); +* +* var names = [ 'data1', 'data2' ]; +* var fields = [ 'x', 'y' ]; +* +* var v = pairedvectors2tidy( [ x ], [ y, z ], names, fields ); +* // returns [ <DataSet>, <DataSet> ] +*/ +function pairedvectors2tidy( list1, list2, names, fields ) { + var out; + var S1; + var S2; + var sx; + var sy; + var ix; + var iy; + var N; + var d; + var i; + + // TODO: add input argument validation + + S1 = list1.length; + S2 = list2.length; + if ( S1 === 0 ) { + throw new Error( 'invalid argument. First argument must be a non-empty array.' ); + } + if ( S2 === 0 ) { + throw new Error( 'invalid argument. Second argument must be a non-empty array.' ); + } + // Resolve iteration strides to allow for broadcasting... + if ( S1 === 1 ) { + sx = 0; + } else { + sx = 1; + } + if ( S2 === 1 ) { + sy = 0; + } else { + sy = 1; + } + // Determine the number of data sets... + if ( S1 > S2 ) { + N = S1; + } else { + N = S2; + } + // Initialize pointers to the first indexed elements in each list: + ix = 0; + iy = 0; + + // Create the datasets... + out = []; + for ( i = 0; i < N; i++ ) { + d = vectors2tidy( [ list1[ ix ], list2[ iy ] ], names[ i ], fields ); + out.push( d ); + ix += sx; + iy += sy; + } + return out; +} + + +// EXPORTS // + +module.exports = pairedvectors2tidy; diff --git a/lib/node_modules/@stdlib/plot/vega/data/tidy/from-paired-vectors/package.json b/lib/node_modules/@stdlib/plot/vega/data/tidy/from-paired-vectors/package.json new file mode 100644 index 000000000000..a5ac0319ddc7 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/data/tidy/from-paired-vectors/package.json @@ -0,0 +1,66 @@ +{ + "name": "@stdlib/plot/vega/data/tidy/from-paired-vectors", + "version": "0.0.0", + "description": "Create tidy data sets by pairing each one-dimensional ndarray in one list with its counterpart in another list.", + "license": "Apache-2.0", + "author": { + "name": "The Stdlib Authors", + "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" + }, + "contributors": [ + { + "name": "The Stdlib Authors", + "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" + } + ], + "main": "./lib", + "directories": { + "benchmark": "./benchmark", + "doc": "./docs", + "example": "./examples", + "lib": "./lib", + "test": "./test" + }, + "types": "./docs/types", + "scripts": {}, + "homepage": "https://github.com/stdlib-js/stdlib", + "repository": { + "type": "git", + "url": "git://github.com/stdlib-js/stdlib.git" + }, + "bugs": { + "url": "https://github.com/stdlib-js/stdlib/issues" + }, + "dependencies": {}, + "devDependencies": {}, + "engines": { + "node": ">=0.10.0", + "npm": ">2.7.0" + }, + "os": [ + "aix", + "darwin", + "freebsd", + "linux", + "macos", + "openbsd", + "sunos", + "win32", + "windows" + ], + "keywords": [ + "stdlib", + "plot", + "vega", + "data", + "dataset", + "factory", + "tidy", + "array", + "ndarray", + "multidimensional", + "vector", + "paired" + ], + "__stdlib__": {} +} diff --git a/lib/node_modules/@stdlib/plot/vega/data/tidy/from-vector/examples/index.js b/lib/node_modules/@stdlib/plot/vega/data/tidy/from-vector/examples/index.js new file mode 100644 index 000000000000..ae1bf2e7f523 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/data/tidy/from-vector/examples/index.js @@ -0,0 +1,31 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +var discreteUniform = require( '@stdlib/random/array/discrete-uniform' ); +var array = require( '@stdlib/ndarray/array' ); +var vector2tidy = require( './../lib' ); + +var arr = array( discreteUniform( 10, -100, 100 ) ); +var data = vector2tidy( arr, 'series', [ 'x', 'y' ] ); + +var out = data.toJSON(); +console.log( out ); + +console.log( JSON.stringify( out ) ); diff --git a/lib/node_modules/@stdlib/plot/vega/data/tidy/from-vector/lib/index.js b/lib/node_modules/@stdlib/plot/vega/data/tidy/from-vector/lib/index.js new file mode 100644 index 000000000000..ead42436a027 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/data/tidy/from-vector/lib/index.js @@ -0,0 +1,43 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +/** +* Convert a one-dimensional ndarray to a "tidy" data set. +* +* @module @stdlib/plot/vega/data/tidy/from-vector +* +* @example +* var array = require( '@stdlib/ndarray/array' ); +* var vector2tidy = require( '@stdlib/plot/vega/data/tidy/from-vector' ); +* +* var x = array( [ 1, 2, 3 ] ); +* +* var v = vector2tidy( x, 'data', [ 'index', 'value' ] ); +* // returns <DataSet> +*/ + +// MODULES // + +var main = require( './main.js' ); + + +// EXPORTS // + +module.exports = main; diff --git a/lib/node_modules/@stdlib/plot/vega/data/tidy/from-vector/lib/main.js b/lib/node_modules/@stdlib/plot/vega/data/tidy/from-vector/lib/main.js new file mode 100644 index 000000000000..b3f03d03e5d7 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/data/tidy/from-vector/lib/main.js @@ -0,0 +1,75 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var array2ndarray = require( '@stdlib/ndarray/base/from-array' ); +var zip2views1d = require( '@stdlib/ndarray/base/zip2views1d' ); +var zeroTo = require( '@stdlib/array/zero-to' ); +var numel = require( '@stdlib/ndarray/numel' ); +var defaults = require( '@stdlib/ndarray/defaults' ); +var DataSet = require( '@stdlib/plot/vega/data/values' ); + + +// VARIABLES // + +// Resolve the default memory layout: +var ORDER = defaults.get( 'order' ); + +// Specify the default index data type for the index array: +var DTYPE = 'float64'; // note: we don't use `dtype.index`, as that can be `int32` which would prevent accommodating arrays having lengths greater than 2^31-1 + + +// MAIN // + +/** +* Converts a one-dimensional ndarray to a "tidy" data set. +* +* @param {ndarrayLike} arr - input array +* @param {string} name - data set name +* @param {Array<string>} fields - list of field names +* @returns {DataSet} data set instance +* +* @example +* var array = require( '@stdlib/ndarray/array' ); +* +* var x = array( [ 1, 2, 3 ] ); +* +* var v = vector2tidy( x, 'data', [ 'index', 'value' ] ); +* // returns <DataSet> +*/ +function vector2tidy( arr, name, fields ) { + var indices; + + // TODO: add input argument validation + + indices = zeroTo( numel( arr ), DTYPE ); + indices = array2ndarray( indices, ORDER ); + + return new DataSet({ + 'name': name, + 'values': zip2views1d( [ indices, arr ], fields ) + }); +} + + +// EXPORTS // + +module.exports = vector2tidy; diff --git a/lib/node_modules/@stdlib/plot/vega/data/tidy/from-vector/package.json b/lib/node_modules/@stdlib/plot/vega/data/tidy/from-vector/package.json new file mode 100644 index 000000000000..bf9564c63bc9 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/data/tidy/from-vector/package.json @@ -0,0 +1,64 @@ +{ + "name": "@stdlib/plot/vega/data/tidy/from-vector", + "version": "0.0.0", + "description": "Convert a one-dimensional ndarray to a tidy data set.", + "license": "Apache-2.0", + "author": { + "name": "The Stdlib Authors", + "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" + }, + "contributors": [ + { + "name": "The Stdlib Authors", + "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" + } + ], + "main": "./lib", + "directories": { + "benchmark": "./benchmark", + "doc": "./docs", + "example": "./examples", + "lib": "./lib", + "test": "./test" + }, + "types": "./docs/types", + "scripts": {}, + "homepage": "https://github.com/stdlib-js/stdlib", + "repository": { + "type": "git", + "url": "git://github.com/stdlib-js/stdlib.git" + }, + "bugs": { + "url": "https://github.com/stdlib-js/stdlib/issues" + }, + "dependencies": {}, + "devDependencies": {}, + "engines": { + "node": ">=0.10.0", + "npm": ">2.7.0" + }, + "os": [ + "aix", + "darwin", + "freebsd", + "linux", + "macos", + "openbsd", + "sunos", + "win32", + "windows" + ], + "keywords": [ + "stdlib", + "plot", + "vega", + "data", + "dataset", + "factory", + "tidy", + "array", + "ndarray", + "multidimensional" + ], + "__stdlib__": {} +} diff --git a/lib/node_modules/@stdlib/plot/vega/data/tidy/from-vectors/examples/index.js b/lib/node_modules/@stdlib/plot/vega/data/tidy/from-vectors/examples/index.js new file mode 100644 index 000000000000..3e8d9d47a498 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/data/tidy/from-vectors/examples/index.js @@ -0,0 +1,33 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +var discreteUniform = require( '@stdlib/random/array/discrete-uniform' ); +var zeroTo = require( '@stdlib/array/zero-to' ); +var array = require( '@stdlib/ndarray/array' ); +var vectors2tidy = require( './../lib' ); + +var x = array( zeroTo( 10 ) ); +var y = array( discreteUniform( 10, -100, 100 ) ); +var data = vectors2tidy( [ x, y ], 'series', [ 'x', 'y' ] ); + +var out = data.toJSON(); +console.log( out ); + +console.log( JSON.stringify( out ) ); diff --git a/lib/node_modules/@stdlib/plot/vega/data/tidy/from-vectors/lib/index.js b/lib/node_modules/@stdlib/plot/vega/data/tidy/from-vectors/lib/index.js new file mode 100644 index 000000000000..b07a8566d109 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/data/tidy/from-vectors/lib/index.js @@ -0,0 +1,44 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +/** +* Convert a list of one-dimensional ndarrays to a "tidy" data set. +* +* @module @stdlib/plot/vega/data/tidy/from-vectors +* +* @example +* var array = require( '@stdlib/ndarray/array' ); +* var vectors2tidy = require( '@stdlib/plot/vega/data/tidy/from-vectors' ); +* +* var x = array( [ 1, 2, 3 ] ); +* var y = array( [ 4, 5, 6 ] ); +* +* var v = vectors2tidy( [ x, y ], 'data', [ 'x', 'y' ] ); +* // returns <DataSet> +*/ + +// MODULES // + +var main = require( './main.js' ); + + +// EXPORTS // + +module.exports = main; diff --git a/lib/node_modules/@stdlib/plot/vega/data/tidy/from-vectors/lib/main.js b/lib/node_modules/@stdlib/plot/vega/data/tidy/from-vectors/lib/main.js new file mode 100644 index 000000000000..9764ee3f114b --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/data/tidy/from-vectors/lib/main.js @@ -0,0 +1,58 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var zip2views1d = require( '@stdlib/ndarray/base/zip2views1d' ); +var DataSet = require( '@stdlib/plot/vega/data/values' ); + + +// MAIN // + +/** +* Converts a list of one-dimensional ndarrays to a "tidy" data set. +* +* @param {ArrayLikeObject<ndarrayLike>} list - list of ndarrays +* @param {string} name - data set name +* @param {Array<string>} fields - list of field names +* @returns {DataSet} data set instance +* +* @example +* var array = require( '@stdlib/ndarray/array' ); +* +* var x = array( [ 1, 2, 3 ] ); +* var y = array( [ 4, 5, 6 ] ); +* +* var v = vectors2tidy( [ x, y ], 'data', [ 'x', 'y' ] ); +* // returns <DataSet> +*/ +function vectors2tidy( list, name, fields ) { + // TODO: add input argument validation + + return new DataSet({ + 'name': name, + 'values': zip2views1d( list, fields ) + }); +} + + +// EXPORTS // + +module.exports = vectors2tidy; diff --git a/lib/node_modules/@stdlib/plot/vega/data/tidy/from-vectors/package.json b/lib/node_modules/@stdlib/plot/vega/data/tidy/from-vectors/package.json new file mode 100644 index 000000000000..54e906236d77 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/data/tidy/from-vectors/package.json @@ -0,0 +1,64 @@ +{ + "name": "@stdlib/plot/vega/data/tidy/from-vectors", + "version": "0.0.0", + "description": "Convert a list of one-dimensional ndarrays to a tidy data set.", + "license": "Apache-2.0", + "author": { + "name": "The Stdlib Authors", + "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" + }, + "contributors": [ + { + "name": "The Stdlib Authors", + "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" + } + ], + "main": "./lib", + "directories": { + "benchmark": "./benchmark", + "doc": "./docs", + "example": "./examples", + "lib": "./lib", + "test": "./test" + }, + "types": "./docs/types", + "scripts": {}, + "homepage": "https://github.com/stdlib-js/stdlib", + "repository": { + "type": "git", + "url": "git://github.com/stdlib-js/stdlib.git" + }, + "bugs": { + "url": "https://github.com/stdlib-js/stdlib/issues" + }, + "dependencies": {}, + "devDependencies": {}, + "engines": { + "node": ">=0.10.0", + "npm": ">2.7.0" + }, + "os": [ + "aix", + "darwin", + "freebsd", + "linux", + "macos", + "openbsd", + "sunos", + "win32", + "windows" + ], + "keywords": [ + "stdlib", + "plot", + "vega", + "data", + "dataset", + "factory", + "tidy", + "array", + "ndarray", + "multidimensional" + ], + "__stdlib__": {} +} diff --git a/lib/node_modules/@stdlib/plot/vega/data/tidy/from-xy-arguments/examples/index.js b/lib/node_modules/@stdlib/plot/vega/data/tidy/from-xy-arguments/examples/index.js new file mode 100644 index 000000000000..86492405ee52 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/data/tidy/from-xy-arguments/examples/index.js @@ -0,0 +1,312 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +var randomArray = require( '@stdlib/random/array/discrete-uniform' ); +var randomNumber = require( '@stdlib/random/base/discrete-uniform' ); +var bernoulli = require( '@stdlib/random/base/bernoulli' ); +var filledBy = require( '@stdlib/array/base/filled-by' ); +var filled2dBy = require( '@stdlib/array/base/filled2d-by' ); +var zeroTo = require( '@stdlib/array/zero-to' ); +var array = require( '@stdlib/ndarray/array' ); +var ndarray2array = require( '@stdlib/ndarray/to-array' ); +var args2tidy = require( './../lib' ); + +/* ---- */ + +console.log( '' ); +console.log( 'Array of numbers:' ); + +var arr = randomArray( 10, -100, 100 ); +var data = args2tidy( [ arr ] ); +console.log( arr ); +console.log( JSON.stringify( data ) ); + +/* ---- */ + +console.log( '' ); +console.log( 'Array of objects:' ); + +function clbk1( i ) { + return { + 'x': i, + 'y': randomNumber( -100, 100 ) + }; +} + +arr = filledBy( 10, clbk1 ); +data = args2tidy( [ arr ] ); +console.log( arr ); +console.log( JSON.stringify( data ) ); + +/* ---- */ + +console.log( '' ); +console.log( 'Array of tuples:' ); + +arr = filled2dBy( [ 10, 2 ], randomNumber.factory( -100, 100 ) ); +data = args2tidy( [ arr ] ); +console.log( arr ); +console.log( JSON.stringify( data ) ); + +/* ---- */ + +console.log( '' ); +console.log( 'Vector:' ); + +arr = array( randomArray( 10, -100, 100 ), { + 'shape': [ 10 ] +}); +data = args2tidy( [ arr ] ); +console.log( ndarray2array( arr ) ); +console.log( JSON.stringify( data ) ); + +/* ---- */ + +console.log( '' ); +console.log( 'Array of array of objects:' ); + +var arr1 = filledBy( 10, clbk1 ); +var arr2 = filledBy( 10, clbk1 ); +data = args2tidy( [ [ arr1, arr2 ] ] ); +console.log( arr1 ); +console.log( arr2 ); +console.log( JSON.stringify( data ) ); + +/* ---- */ + +console.log( '' ); +console.log( 'Array of array of tuples:' ); + +arr1 = filled2dBy( [ 10, 2 ], randomNumber.factory( -100, 100 ) ); +arr2 = filled2dBy( [ 10, 2 ], randomNumber.factory( -100, 100 ) ); +data = args2tidy( [ [ arr1, arr2 ] ] ); +console.log( arr1 ); +console.log( arr2 ); +console.log( JSON.stringify( data ) ); + +/* ---- */ + +console.log( '' ); +console.log( 'Matrix of columns:' ); + +arr = array( randomArray( 10, -100, 100 ), { + 'shape': [ 5, 2 ] +}); +data = args2tidy( [ arr ] ); +console.log( ndarray2array( arr ) ); +console.log( JSON.stringify( data ) ); + +/* ---- */ + +console.log( '' ); +console.log( 'Array of vectors:' ); + +arr1 = array( randomArray( 10, -100, 100 ), { + 'shape': [ 10 ] +}); +arr2 = array( randomArray( 10, -100, 100 ), { + 'shape': [ 10 ] +}); +data = args2tidy( [ [ arr1, arr2 ] ] ); +console.log( ndarray2array( arr1 ) ); +console.log( ndarray2array( arr2 ) ); +console.log( JSON.stringify( data ) ); + +/* ---- */ + +console.log( '' ); +console.log( 'Array of grouped objects:' ); + +function clbk2( i ) { + return { + 'x': i, + 'y': randomNumber( -100, 100 ), + 'z': bernoulli( 0.5 ) + }; +} + +arr = filledBy( 20, clbk2 ); +data = args2tidy( [ arr ], { + 'x': 'x', + 'y': 'y', + 'z': 'z' +}); +console.log( arr ); +console.log( JSON.stringify( data ) ); + +/* ---- */ + +console.log( '' ); +console.log( 'Array of numbers with array of numbers:' ); + +arr1 = zeroTo( 10 ); +arr2 = randomArray( 10, -100, 100 ); +data = args2tidy( [ arr1, arr2 ] ); +console.log( arr1 ); +console.log( arr2 ); +console.log( JSON.stringify( data ) ); + +/* ---- */ + +console.log( '' ); +console.log( 'Array of numbers with array of arrays:' ); + +arr1 = zeroTo( 5 ); +arr2 = filled2dBy( [ 5, 5 ], randomNumber.factory( -100, 100 ) ); +data = args2tidy( [ arr1, arr2 ] ); +console.log( arr1 ); +console.log( arr2 ); +console.log( JSON.stringify( data ) ); + +/* ---- */ + +console.log( '' ); +console.log( 'Array of arrays with array of numbers:' ); + +arr1 = filled2dBy( [ 5, 5 ], randomNumber.factory( -100, 100 ) ); +arr2 = zeroTo( 5 ); +data = args2tidy( [ arr1, arr2 ] ); +console.log( arr1 ); +console.log( arr2 ); +console.log( JSON.stringify( data ) ); + +/* ---- */ + +console.log( '' ); +console.log( 'Array of arrays with array of arrays:' ); + +arr1 = filled2dBy( [ 5, 5 ], randomNumber.factory( -100, 100 ) ); +arr2 = filled2dBy( [ 5, 5 ], randomNumber.factory( -100, 100 ) ); +data = args2tidy( [ arr1, arr2 ] ); +console.log( arr1 ); +console.log( arr2 ); +console.log( JSON.stringify( data ) ); + +/* ---- */ + +console.log( '' ); +console.log( 'Vector with vector:' ); + +arr1 = array( randomArray( 10, -100, 100 ), { + 'shape': [ 10 ] +}); +arr2 = array( randomArray( 10, -100, 100 ), { + 'shape': [ 10 ] +}); +data = args2tidy( [ arr1, arr2 ] ); +console.log( ndarray2array( arr1 ) ); +console.log( ndarray2array( arr2 ) ); +console.log( JSON.stringify( data ) ); + +/* ---- */ + +console.log( '' ); +console.log( 'Vector with array of vectors:' ); + +arr1 = array( randomArray( 10, -100, 100 ), { + 'shape': [ 10 ] +}); +arr2 = array( randomArray( 10, -100, 100 ), { + 'shape': [ 10 ] +}); +data = args2tidy( [ arr1, [ arr2, arr1 ] ] ); +console.log( ndarray2array( arr1 ) ); +console.log( ndarray2array( arr2 ) ); +console.log( JSON.stringify( data ) ); + +/* ---- */ + +console.log( '' ); +console.log( 'Array of vectors with vector:' ); + +arr1 = array( randomArray( 10, -100, 100 ), { + 'shape': [ 10 ] +}); +arr2 = array( randomArray( 10, -100, 100 ), { + 'shape': [ 10 ] +}); +data = args2tidy( [ [ arr1, arr2 ], arr2 ] ); +console.log( ndarray2array( arr1 ) ); +console.log( ndarray2array( arr2 ) ); +console.log( JSON.stringify( data ) ); + +/* ---- */ + +console.log( '' ); +console.log( 'Array of vectors with array of vectors:' ); + +arr1 = array( randomArray( 10, -100, 100 ), { + 'shape': [ 10 ] +}); +arr2 = array( randomArray( 10, -100, 100 ), { + 'shape': [ 10 ] +}); +data = args2tidy( [ [ arr1, arr2 ], [ arr2, arr1 ] ] ); +console.log( ndarray2array( arr1 ) ); +console.log( ndarray2array( arr2 ) ); +console.log( JSON.stringify( data ) ); + +/* ---- */ + +console.log( '' ); +console.log( 'Vector with matrix:' ); + +arr1 = array( randomArray( 5, -100, 100 ), { + 'shape': [ 5 ] +}); +arr2 = array( randomArray( 10, -100, 100 ), { + 'shape': [ 5, 2 ] +}); +data = args2tidy( [ arr1, arr2 ] ); +console.log( ndarray2array( arr1 ) ); +console.log( ndarray2array( arr2 ) ); +console.log( JSON.stringify( data ) ); + +/* ---- */ + +console.log( '' ); +console.log( 'Matrix with vector:' ); + +arr1 = array( randomArray( 10, -100, 100 ), { + 'shape': [ 5, 2 ] +}); +arr2 = array( randomArray( 5, -100, 100 ), { + 'shape': [ 5 ] +}); +data = args2tidy( [ arr1, arr2 ] ); +console.log( ndarray2array( arr1 ) ); +console.log( ndarray2array( arr2 ) ); +console.log( JSON.stringify( data ) ); + +/* ---- */ + +console.log( '' ); +console.log( 'Matrix with matrix:' ); + +arr1 = array( randomArray( 10, -100, 100 ), { + 'shape': [ 5, 2 ] +}); +arr2 = array( randomArray( 10, -100, 100 ), { + 'shape': [ 5, 2 ] +}); +data = args2tidy( [ arr1, arr2 ] ); +console.log( ndarray2array( arr1 ) ); +console.log( ndarray2array( arr2 ) ); +console.log( JSON.stringify( data ) ); diff --git a/lib/node_modules/@stdlib/plot/vega/data/tidy/from-xy-arguments/lib/index.js b/lib/node_modules/@stdlib/plot/vega/data/tidy/from-xy-arguments/lib/index.js new file mode 100644 index 000000000000..276a4fd563ae --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/data/tidy/from-xy-arguments/lib/index.js @@ -0,0 +1,39 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +/** +* Convert a list of arguments corresponding to `x` and `y` coordinates to a list of tidy data sets. +* +* @module @stdlib/plot/vega/data/tidy/from-xy-arguments +* +* @example +* var args2tidy = require( '@stdlib/plot/vega/data/tidy/from-xy-arguments' ); +* +* // TODO +*/ + +// MODULES // + +var main = require( './main.js' ); + + +// EXPORTS // + +module.exports = main; diff --git a/lib/node_modules/@stdlib/plot/vega/data/tidy/from-xy-arguments/lib/main.js b/lib/node_modules/@stdlib/plot/vega/data/tidy/from-xy-arguments/lib/main.js new file mode 100644 index 000000000000..5ed4b168ad6b --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/data/tidy/from-xy-arguments/lib/main.js @@ -0,0 +1,393 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var isCollection = require( '@stdlib/assert/is-collection' ); +var isObject = require( '@stdlib/assert/is-object' ); +var isndarrayLike = require( '@stdlib/assert/is-ndarray-like' ); +var max = require( '@stdlib/math/base/special/fast/max' ); +var getShape = require( '@stdlib/ndarray/shape' ); +var resolveGetter = require( '@stdlib/array/base/resolve-getter' ); +var expandDimensions = require( '@stdlib/ndarray/base/expand-dimensions' ); +var array2tidy = require( '@stdlib/plot/vega/data/tidy/from-array' ); +var columns2tidy = require( '@stdlib/plot/vega/data/tidy/from-matrix-columns' ); +var nested2tidy = require( '@stdlib/plot/vega/data/tidy/from-nested-array' ); +var nestedarrays2tidy = require( '@stdlib/plot/vega/data/tidy/from-nested-arrays' ); +var objarray2tidy = require( '@stdlib/plot/vega/data/tidy/from-object-array' ); +var objarrays2tidy = require( '@stdlib/plot/vega/data/tidy/from-object-arrays' ); +var vector2tidy = require( '@stdlib/plot/vega/data/tidy/from-vector' ); +var vectors2tidy = require( '@stdlib/plot/vega/data/tidy/from-vectors' ); +var pairedarrays2tidy = require( '@stdlib/plot/vega/data/tidy/from-paired-arrays' ); +var pairedcolumns2tidy = require( '@stdlib/plot/vega/data/tidy/from-paired-matrix-columns' ); +var pairedvectors2tidy = require( '@stdlib/plot/vega/data/tidy/from-paired-vectors' ); +var splitOnKey = require( '@stdlib/plot/vega/data/tidy/split-on-key' ); +var format = require( '@stdlib/string/format' ); + + +// VARIABLES // + +var MAPPING = { + 'x': 'x', + 'y': 'y' +}; +var FIELDS = [ 'x', 'y' ]; + + +// FUNCTIONS // + +/** +* Returns a data set name. +* +* @private +* @param {NonNegativeInteger} id - data set identifier +* @returns {string} name +*/ +function name( id ) { // eslint-disable-line stdlib/no-redeclare + return 'dataset' + id; +} + +/** +* Returns a list of data set names. +* +* @private +* @param {NonNegativeInteger} len - number of names +* @param {NonNegativeInteger} start - starting data set identifier +* @returns {Array<string>} list of names +*/ +function names( len, start ) { + var out; + var i; + + out = []; + for ( i = 0; i < len; i++ ) { + out.push( name( start+i ) ); + } + return out; +} + +/** +* Converts a single argument to a list of tidy data sets. +* +* @private +* @param {(Collection|ndarrayLike)} arg - argument +* @param {Object} mapping - object mapping field names to encoding channels ('x', 'y', and 'z') +* @throws {TypeError} must provide a valid argument +* @returns {Array<DataSet>} list of data sets +*/ +function unary( arg, mapping ) { + var out; + var tmp; + var get; + var sh; + var v; + var q; + var d; + var s; + var i; + + out = []; + + // Case: f( ndarray ) + if ( isndarrayLike( arg ) ) { + sh = getShape( arg ); + + // Case: f( vector ) + if ( sh.length === 1 ) { + // Assume a one-dimensional ndarray with an implicit "x" channel... + d = vector2tidy( arg, name( 1 ), FIELDS ); + out.push( d ); + return out; + } + // Case: f( matrix_columns ) + if ( sh.length === 2 ) { + // Assume that each column is an independent series with an implicit "x" channel... + d = columns2tidy( arg, names( sh[ 1 ], 1 ), FIELDS ); + for ( i = 0; i < d.length; i++ ) { + out.push( d[ i ] ); + } + return out; + } + throw new TypeError( 'invalid argument. First argument must be either a one- or two-dimensional ndarray.' ); + } + // Case: f( ??? ) + if ( !isCollection( arg ) ) { + throw new TypeError( format( 'invalid argument. First argument must be an array-like object, an ndarray, or an array of array-like objects or ndarrays.', arg ) ); + } + // Case: f( [ ???, ... ] ) + get = resolveGetter( arg ); + + // Resolve the first array element: + v = get( arg, 0 ); + + // Case: f( [ vector, vector, ... ] ) + if ( isndarrayLike( v ) ) { + // Assume a list of one-dimensional ndarrays with an implicit "x" channel... + for ( i = 0; i < arg.length; i++ ) { + v = arg[ i ]; + sh = getShape( v ); + if ( sh.length !== 1 ) { + throw new TypeError( 'invalid argument. First argument must be an array of one-dimensional ndarrays.' ); + } + d = vector2tidy( v, name( i+1 ), FIELDS ); + out.push( d ); + } + return out; + } + // Case: f( [ [ ??? ], [ ??? ], ... ] ) + if ( isCollection( v ) ) { + // Resolve the first array element of the nested array: + get = resolveGetter( v ); + q = get( v, 0 ); + + // Case: f( [ [ [...], [...] ], [ [...], [...] ], ... ] ) + if ( isCollection( q ) ) { + // Assume each nested array is an array of x/y tuples representing a single dataset... + d = nestedarrays2tidy( arg, names( v.length, 1 ), FIELDS ); + for ( i = 0; i < d.length; i++ ) { + out.push( d[ i ] ); + } + return out; + } + // Case: f( [ [ {...}, {...} ], [ {...}, {...} ], ... ] ) + if ( isObject( q ) ) { + // Assume each nested array of objects represents a single dataset... + d = objarrays2tidy( arg, names( v.length, 1 ), mapping ); + for ( i = 0; i < d.length; i++ ) { + out.push( d[ i ] ); + } + return out; + } + // Case: f( [ [ primitive, primitive, ... ], ... ] ) + + // Assume each nested array represents a single dataset with an implicit "x" channel... + d = nested2tidy( arg, name( 1 ), FIELDS ); + out.push( d ); + return out; + } + // Case: f( [ {...}, {...} ] ) + if ( isObject( v ) ) { + // Assume a single list of values which may contain multiple datasets grouped according to the "z" channel... + d = objarray2tidy( arg, name( 1 ), mapping ); + if ( mapping.z ) { + tmp = splitOnKey( d, mapping.z ); + for ( i = 0; i < tmp.length; i++ ) { + s = tmp[ i ]; + s.name = name( i+1 ); + out.push( s ); + } + } else { + out.push( d ); + } + return out; + } + // Case: f( [ primitive, primitive, ... ] ) + + // Assume a single list of y-values with an implicit "x" channel... + d = array2tidy( arg, name( 1 ), FIELDS ); + out.push( d ); + return out; +} + +/** +* Converts two argument to a list of tidy data sets. +* +* @private +* @param {(Array|ndarrayLike)} arg1 - first argument +* @param {(Array|ndarrayLike)} arg2 - second argument +* @throws {TypeError} must provide a valid argument +* @returns {Array<DataSet>} list of data sets +*/ +function binary( arg1, arg2 ) { + var get; + var out; + var shx; + var shy; + var N; + var v; + var d; + var i; + + // Case: f( ndarray, ??? ) + if ( isndarrayLike( arg1 ) ) { + shx = getShape( arg1 ); + + // Case: f( ndarray, ndarray ) + if ( isndarrayLike( arg2 ) ) { + if ( shx.length < 1 || shx.length > 2 ) { + throw new TypeError( 'invalid argument. First argument must be either a one- or two-dimensional ndarray.' ); + } + // If we were provided a vector for the first argument, expand to a column matrix... + if ( shx.length === 1 ) { + // Case: f( vector, ndarray ) + arg1 = expandDimensions( arg1, 1 ); + shx.push( 1 ); + } + // Assume that each column in the first argument is an "x" vector and each column in the second argument is a "y" vector... + shy = getShape( arg2 ); + if ( shy.length < 1 || shy.length > 2 ) { + throw new TypeError( 'invalid argument. Second argument must be either a one- or two-dimensional ndarray.' ); + } + // Case: f( ndarray, vector ) + if ( shy.length === 1 ) { + arg2 = expandDimensions( arg2, 1 ); + shy.push( 1 ); + } + // By this point, we should be equivalent to f( matrix, matrix )... + N = max( shx[ 1 ], shy[ 1 ] ); + return pairedcolumns2tidy( arg1, arg2, names( N, 1 ), FIELDS ); + } + if ( shx.length !== 1 ) { + throw new TypeError( 'invalid argument. First argument must be a one-dimensional ndarray.' ); + } + // Case: f( vector, [ vector, vector, ... ] ) + if ( isCollection( arg2 ) ) { + // Assume that each element in the second argument is a "y" vector... + out = []; + for ( i = 0; i < arg2.length; i++ ) { + v = arg2[ i ]; + if ( !isndarrayLike( v ) ) { + throw new TypeError( format( 'invalid argument. Second argument must be either an ndarray or an array of ndarrays. Value: `%s`.', arg2 ) ); + } + shy = getShape( v ); + if ( shy.length !== 1 ) { + throw new TypeError( 'invalid argument. Second argument must be an array of one-dimensional ndarrays.' ); + } + d = vectors2tidy( [ arg1, v ], name( i+1 ), FIELDS ); + out.push( d ); + } + return out; + } + throw new TypeError( format( 'invalid argument. Second argument must be either an ndarray or an array of ndarrays. Value: `%s`.', arg2 ) ); + } + // Case: f( ???, ??? ) + if ( !isCollection( arg1 ) ) { + throw new TypeError( format( 'invalid argument. First argument must be an array-like object, an ndarray, or an array of array-like objects or ndarrays.', arg1 ) ); + } + // Case: f( [ ???, ... ], ??? ) + get = resolveGetter( arg1 ); + + // Resolve the first array element: + v = get( arg1, 0 ); + + // Case: f( [ ndarray, ... ], ??? ) + if ( isndarrayLike( v ) ) { + // Case: f( [ ndarray, ... ], ndarray ) + if ( isndarrayLike( arg2 ) ) { + shy = getShape( arg2 ); + if ( shy.length !== 1 ) { + throw new TypeError( 'invalid argument. Second argument must be a one-dimensional ndarray.' ); + } + // Assume that each element in the first argument is an "x" vector... + out = []; + for ( i = 0; i < arg1.length; i++ ) { + v = arg1[ i ]; + if ( !isndarrayLike( v ) ) { + throw new TypeError( format( 'invalid argument. First argument must be either an ndarray or an array of ndarrays. Value: `%s`.', arg1 ) ); + } + shx = getShape( v ); + if ( shx.length !== 1 ) { + throw new TypeError( 'invalid argument. First argument must be an array of one-dimensional ndarrays.' ); + } + d = vectors2tidy( [ v, arg2 ], name( i+1 ), FIELDS ); + out.push( d ); + } + return out; + } + // Case: f( [ vector, ... ], [ vector, ... ] ) + if ( isCollection( arg2 ) ) { + N = max( arg1.length, arg2.length ); + return pairedvectors2tidy( arg1, arg2, names( N, 1 ), FIELDS ); + } + throw new TypeError( format( 'invalid argument. Second argument must be either an ndarray or an array of ndarrays. Value: `%s`.', arg2 ) ); + } + // Case: f( [ primitive, primitive, ... ], ??? ) + if ( !isCollection( v ) ) { + // Assume that the first argument is a single list of x-values... + arg1 = [ arg1 ]; + } + // Resolve the first array element of the second argument: + get = resolveGetter( arg2 ); + v = get( arg2, 0 ); + + // Case: f( [...], [ primitive, primitive, ... ] ) + if ( !isCollection( v ) ) { + // Assume that the second argument is a single list of y-values... + arg2 = [ arg2 ]; + } + // At this point, both `arg1` and `arg2` should be arrays of arrays, and, more specifically, are assumed to be arrays of arrays representing x/y vectors, respectively... + N = max( arg1.length, arg2.length ); + return pairedarrays2tidy( arg1, arg2, names( N, 1 ), FIELDS ); +} + + +// MAIN // + +/** +* Converts a list of arguments corresponding to `x` and `y` coordinates to a list of tidy data sets. +* +* ## Notes +* +* - Encoding channels: +* +* - **x**: x-coordinate encoding channel. +* - **y**: y-coordinate encoding channel. +* - **z**: group encoding channel. +* +* - The `z` encoding channel only applies to arguments which are arrays of objects and is used to split an array of objects into multiple data sets whose elements are grouped according to the values assigned to the corresponding channel field. +* +* @param {Array} args - list of arguments +* @param {Object} channels - object mapping field names to encoding channels ('x', 'y', and 'z') +* @throws {TypeError} first argument must be an array-like object +* @throws {TypeError} second argument must be an object +* @throws {TypeError} must provide valid arguments +* @returns {Array<DataSet>} list of data sets +* +* @example +* // TODO +*/ +function args2tidy( args, channels ) { + var mapping; + if ( !isCollection( args ) ) { + throw new TypeError( format( 'invalid argument. First argument must be an array-like object. Value: `%s`.', args ) ); + } + if ( arguments.length > 1 ) { + if ( !isObject( channels ) ) { + throw new TypeError( format( 'invalid argument. Second argument must be an object. Value: `%s`.', channels ) ); + } + mapping = channels; + + // TODO: validate channels + } else { + mapping = MAPPING; + } + if ( args.length === 0 ) { + return []; + } + if ( args.length === 1 ) { + return unary( args[ 0 ], mapping ); + } + return binary( args[ 0 ], args[ 1 ] ); +} + + +// EXPORTS // + +module.exports = args2tidy; diff --git a/lib/node_modules/@stdlib/plot/vega/data/tidy/from-xy-arguments/package.json b/lib/node_modules/@stdlib/plot/vega/data/tidy/from-xy-arguments/package.json new file mode 100644 index 000000000000..a4a5107afcd0 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/data/tidy/from-xy-arguments/package.json @@ -0,0 +1,64 @@ +{ + "name": "@stdlib/plot/vega/data/tidy/from-xy-arguments", + "version": "0.0.0", + "description": "Convert a list of arguments corresponding to `x` and `y` coordinates to a list of tidy data sets.", + "license": "Apache-2.0", + "author": { + "name": "The Stdlib Authors", + "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" + }, + "contributors": [ + { + "name": "The Stdlib Authors", + "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" + } + ], + "main": "./lib", + "directories": { + "benchmark": "./benchmark", + "doc": "./docs", + "example": "./examples", + "lib": "./lib", + "test": "./test" + }, + "types": "./docs/types", + "scripts": {}, + "homepage": "https://github.com/stdlib-js/stdlib", + "repository": { + "type": "git", + "url": "git://github.com/stdlib-js/stdlib.git" + }, + "bugs": { + "url": "https://github.com/stdlib-js/stdlib/issues" + }, + "dependencies": {}, + "devDependencies": {}, + "engines": { + "node": ">=0.10.0", + "npm": ">2.7.0" + }, + "os": [ + "aix", + "darwin", + "freebsd", + "linux", + "macos", + "openbsd", + "sunos", + "win32", + "windows" + ], + "keywords": [ + "stdlib", + "plot", + "vega", + "data", + "dataset", + "factory", + "tidy", + "array", + "ndarray", + "multidimensional" + ], + "__stdlib__": {} +} diff --git a/lib/node_modules/@stdlib/plot/vega/data/tidy/split-on-key/examples/index.js b/lib/node_modules/@stdlib/plot/vega/data/tidy/split-on-key/examples/index.js new file mode 100644 index 000000000000..40c3731150f0 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/data/tidy/split-on-key/examples/index.js @@ -0,0 +1,44 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +var discreteUniform = require( '@stdlib/random/base/discrete-uniform' ); +var bernoulli = require( '@stdlib/random/base/bernoulli' ); +var filledBy = require( '@stdlib/array/base/filled-by' ); +var objarray2tidy = require( '@stdlib/plot/vega/data/tidy/from-object-array' ); +var splitOnKey = require( './../lib' ); + +function clbk( i ) { + return { + 'x': i, + 'y': discreteUniform( -100, 100 ), + 'z': bernoulli( 0.5 ) + }; +} + +var arr = filledBy( 20, clbk ); +var data = splitOnKey( objarray2tidy( arr, 'series' ), 'z' ); + +var out = data[ 0 ].toJSON(); +console.log( out ); + +out = data[ 1 ].toJSON(); +console.log( out ); + +console.log( JSON.stringify( data ) ); diff --git a/lib/node_modules/@stdlib/plot/vega/data/tidy/split-on-key/examples/rekeyed.js b/lib/node_modules/@stdlib/plot/vega/data/tidy/split-on-key/examples/rekeyed.js new file mode 100644 index 000000000000..62c603c9a48a --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/data/tidy/split-on-key/examples/rekeyed.js @@ -0,0 +1,56 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +var discreteUniform = require( '@stdlib/random/base/discrete-uniform' ); +var bernoulli = require( '@stdlib/random/base/bernoulli' ); +var filledBy = require( '@stdlib/array/base/filled-by' ); +var objarray2tidy = require( '@stdlib/plot/vega/data/tidy/from-object-array' ); +var splitOnKey = require( './../lib' ); + +function clbk( i ) { + return { + 'a': i, + 'b': discreteUniform( -100, 100 ), + 'c': bernoulli( 0.5 ) + }; +} + +// Generate a "raw" data array: +var arr = filledBy( 20, clbk ); + +// Convert the raw data to a tidy dataset... +var mapping = { + 'a': 'x', + 'b': 'y', + 'c': 'z' +}; +var dataset = objarray2tidy( arr, 'series', mapping ); + +// Split the tidy data set according to the re-keyed "z" property: +var data = splitOnKey( dataset, 'z' ); + +// Print the results: +var out = data[ 0 ].toJSON(); +console.log( out ); + +out = data[ 1 ].toJSON(); +console.log( out ); + +console.log( JSON.stringify( data ) ); diff --git a/lib/node_modules/@stdlib/plot/vega/data/tidy/split-on-key/lib/index.js b/lib/node_modules/@stdlib/plot/vega/data/tidy/split-on-key/lib/index.js new file mode 100644 index 000000000000..b1e2571f280c --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/data/tidy/split-on-key/lib/index.js @@ -0,0 +1,56 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +/** +* Split a tidy data set into multiple data sets according to a specified key. +* +* @module @stdlib/plot/vega/data/tidy/split-on-key +* +* @example +* var objarray2tidy = require( '@stdlib/plot/vega/data/tidy/from-object-array' ); +* var splitOnKey = require( '@stdlib/plot/vega/data/tidy/split-on-key' ); +* +* var x = [ +* { +* 'x': 0, +* 'y': 1 +* }, +* { +* 'x': 1, +* 'y': 2 +* }, +* { +* 'x': 0, +* 'y': 3 +* } +* ]; +* +* var v = splitOnKey( objarray2tidy( x, 'series' ), 'x' ); +* // returns [ <DataSet>, <DataSet> ] +*/ + +// MODULES // + +var main = require( './main.js' ); + + +// EXPORTS // + +module.exports = main; diff --git a/lib/node_modules/@stdlib/plot/vega/data/tidy/split-on-key/lib/main.js b/lib/node_modules/@stdlib/plot/vega/data/tidy/split-on-key/lib/main.js new file mode 100644 index 000000000000..feb89e53ca8b --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/data/tidy/split-on-key/lib/main.js @@ -0,0 +1,84 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var objectKeys = require( '@stdlib/utils/keys' ); +var groupValuesOnKey = require( '@stdlib/array/base/group-values-on-key' ); +var DataSet = require( '@stdlib/plot/vega/data/values' ); + + +// MAIN // + +/** +* Splits a tidy data set into multiple data sets according to a specified key. +* +* @param {DataSet} data - input data set +* @param {string} key - property name which is used to group data elements +* @returns {Array<DataSet>} array of data sets +* +* @example +* var objarray2tidy = require( '@stdlib/plot/vega/data/tidy/from-object-array' ); +* +* var x = [ +* { +* 'x': 0, +* 'y': 1 +* }, +* { +* 'x': 1, +* 'y': 2 +* }, +* { +* 'x': 0, +* 'y': 3 +* } +* ]; +* +* var v = splitOnKey( objarray2tidy( x, 'series' ), 'x' ); +* // returns [ <DataSet>, <DataSet> ] +*/ +function splitOnKey( data, key ) { + var groups; + var keys; + var out; + var d; + var i; + + // TODO: add input argument validation + + groups = groupValuesOnKey( data.values, key ); + keys = objectKeys( groups ); + + out = []; + for ( i = 0; i < keys.length; i++ ) { + d = new DataSet({ + 'name': keys[ i ], + 'values': groups[ keys[ i ] ] + }); + out.push( d ); + } + return out; +} + + +// EXPORTS // + +module.exports = splitOnKey; diff --git a/lib/node_modules/@stdlib/plot/vega/data/tidy/split-on-key/package.json b/lib/node_modules/@stdlib/plot/vega/data/tidy/split-on-key/package.json new file mode 100644 index 000000000000..5a7379e4fe38 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/data/tidy/split-on-key/package.json @@ -0,0 +1,64 @@ +{ + "name": "@stdlib/plot/vega/data/tidy/split-on-key", + "version": "0.0.0", + "description": "Split a tidy data set into multiple data sets according to a specified key.", + "license": "Apache-2.0", + "author": { + "name": "The Stdlib Authors", + "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" + }, + "contributors": [ + { + "name": "The Stdlib Authors", + "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" + } + ], + "main": "./lib", + "directories": { + "benchmark": "./benchmark", + "doc": "./docs", + "example": "./examples", + "lib": "./lib", + "test": "./test" + }, + "types": "./docs/types", + "scripts": {}, + "homepage": "https://github.com/stdlib-js/stdlib", + "repository": { + "type": "git", + "url": "git://github.com/stdlib-js/stdlib.git" + }, + "bugs": { + "url": "https://github.com/stdlib-js/stdlib/issues" + }, + "dependencies": {}, + "devDependencies": {}, + "engines": { + "node": ">=0.10.0", + "npm": ">2.7.0" + }, + "os": [ + "aix", + "darwin", + "freebsd", + "linux", + "macos", + "openbsd", + "sunos", + "win32", + "windows" + ], + "keywords": [ + "stdlib", + "plot", + "vega", + "data", + "dataset", + "factory", + "tidy", + "array", + "collection", + "split" + ], + "__stdlib__": {} +} diff --git a/lib/node_modules/@stdlib/plot/vega/data/values/examples/index.js b/lib/node_modules/@stdlib/plot/vega/data/values/examples/index.js new file mode 100644 index 000000000000..5d89240279ad --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/data/values/examples/index.js @@ -0,0 +1,28 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +var DataSet = require( './../lib' ); + +var data = new DataSet({ + 'name': 'table' +}); + +var out = data.toJSON(); +console.log( out ); diff --git a/lib/node_modules/@stdlib/plot/vega/data/values/lib/change_event.js b/lib/node_modules/@stdlib/plot/vega/data/values/lib/change_event.js new file mode 100644 index 000000000000..ba839622e669 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/data/values/lib/change_event.js @@ -0,0 +1,41 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MAIN // + +/** +* Returns a new change event object. +* +* @private +* @param {string} property - property name +* @returns {Object} event object +*/ +function event( property ) { // eslint-disable-line stdlib/no-redeclare + return { + 'type': 'update', + 'source': 'data', + 'property': property + }; +} + + +// EXPORTS // + +module.exports = event; diff --git a/lib/node_modules/@stdlib/plot/vega/data/values/lib/defaults.js b/lib/node_modules/@stdlib/plot/vega/data/values/lib/defaults.js new file mode 100644 index 000000000000..5141343d4e46 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/data/values/lib/defaults.js @@ -0,0 +1,40 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MAIN // + +/** +* Returns defaults. +* +* @private +* @returns {Object} default options +* +* @example +* var o = defaults(); +* // returns {...} +*/ +function defaults() { + return {}; +} + + +// EXPORTS // + +module.exports = defaults; diff --git a/lib/node_modules/@stdlib/plot/vega/data/values/lib/index.js b/lib/node_modules/@stdlib/plot/vega/data/values/lib/index.js new file mode 100644 index 000000000000..a520a08ce665 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/data/values/lib/index.js @@ -0,0 +1,42 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +/** +* Data set constructor for inline values. +* +* @module @stdlib/plot/vega/data/values +* +* @example +* var DataSet = require( '@stdlib/plot/vega/data/values' ); +* +* var data = new DataSet({ +* 'name': 'table' +* }); +* // returns <DataSet> +*/ + +// MODULES // + +var main = require( './main.js' ); + + +// EXPORTS // + +module.exports = main; diff --git a/lib/node_modules/@stdlib/plot/vega/data/values/lib/main.js b/lib/node_modules/@stdlib/plot/vega/data/values/lib/main.js new file mode 100644 index 000000000000..ca95f5188a71 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/data/values/lib/main.js @@ -0,0 +1,188 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable no-restricted-syntax, no-invalid-this */ + +'use strict'; + +// MODULES // + +var logger = require( 'debug' ); +var isObject = require( '@stdlib/assert/is-object' ); +var setNonEnumerableReadOnly = require( '@stdlib/utils/define-nonenumerable-read-only-property' ); +var setReadWriteAccessor = require( '@stdlib/utils/define-read-write-accessor' ); +var hasProp = require( '@stdlib/assert/has-property' ); +var inherit = require( '@stdlib/utils/inherit' ); +var objectKeys = require( '@stdlib/utils/keys' ); +var transformErrorMessage = require( '@stdlib/plot/vega/base/transform-validation-message' ); +var BaseDataSet = require( '@stdlib/plot/vega/data/base/ctor' ); +var format = require( '@stdlib/string/format' ); +var properties = require( './properties.json' ); +var defaults = require( './defaults.js' ); + +// Note: keep the following in alphabetical order according to the `require` path... +var getValues = require( './values/get.js' ); +var setValues = require( './values/set.js' ); + + +// VARIABLES // + +var debug = logger( 'vega:values-data:main' ); + + +// MAIN // + +/** +* Data set constructor for inline values. +* +* @constructor +* @param {Options} options - constructor options +* @param {string} options.name - data set name +* @param {boolean} [options.async=false] - boolean indicating whether data loading or reformatting should be performed asynchronously +* @param {Format} [options.format] - format specification for parsing a data file or values +* @param {Array<Transform>} [options.transforms=[]] - list of transforms to perform on input data +* @param {Array<Trigger>} [options.triggers=[]] - list of updates to perform when trigger conditions are met +* @param {*} [options.values] - inline data set values +* @throws {TypeError} options argument must be an object +* @throws {Error} must provide valid options +* @returns {DataSet} data set instance +* +* @example +* var trigger = new DataSet({ +* 'name': 'table' +* }); +* // returns <DataSet> +*/ +function DataSet( options ) { + var opts; + var keys; + var v; + var k; + var i; + if ( !( this instanceof DataSet ) ) { + return new DataSet( options ); + } + if ( !isObject( options ) ) { + throw new TypeError( format( 'invalid argument. Options argument must be an object. Value: `%s`.', options ) ); + } + // Check for required properties... + if ( !hasProp( options, 'name' ) ) { + throw new TypeError( 'invalid argument. Options argument must specify the data set name.' ); + } + BaseDataSet.call( this, { + 'name': options.name + }); + + // Resolve the default configuration: + opts = defaults(); + + // Set internal properties according to the default configuration... + keys = objectKeys( opts ); + for ( i = 0; i < keys.length; i++ ) { + k = keys[ i ]; + this[ '_'+k ] = opts[ k ]; + } + // Validate provided options by attempting to assign option values to corresponding fields... + for ( i = 0; i < properties.length; i++ ) { + k = properties[ i ]; + if ( !hasProp( options, k ) ) { + continue; + } + v = options[ k ]; + try { + this[ k ] = v; + } catch ( err ) { + debug( 'Encountered an error. Error: %s', err.message ); + + // FIXME: retain thrown error type + throw new Error( transformErrorMessage( err.message ) ); + } + } + return this; +} + +/* +* Inherit from the `BaseDataSet` prototype. +*/ +inherit( DataSet, BaseDataSet ); + +/** +* Constructor name. +* +* @private +* @name name +* @memberof DataSet +* @readonly +* @type {string} +*/ +setNonEnumerableReadOnly( DataSet, 'name', 'DataSet' ); + +/** +* Inline data set values. +* +* @name values +* @memberof DataSet.prototype +* @type {*} +* +* @example +* var data = new DataSet({ +* 'name': 'table', +* 'values': [ 1, 2, 3 ] +* }); +* +* var v = data.values; +* // returns [ 1, 2, 3 ] +*/ +setReadWriteAccessor( DataSet.prototype, 'values', getValues, setValues ); + +/** +* Serializes an instance to a JSON object. +* +* ## Notes +* +* - This method is implicitly invoked by `JSON.stringify`. +* +* @name toJSON +* @memberof DataSet.prototype +* @type {Function} +* @returns {Object} JSON object +* +* @example +* var data = new DataSet({ +* 'name': 'table' +* }); +* +* var v = data.toJSON(); +* // returns {...} +*/ +setNonEnumerableReadOnly( DataSet.prototype, 'toJSON', function toJSON() { + var out; + + // Call the parent method so that we serialize all inherited properties: + out = BaseDataSet.prototype.toJSON.call( this ); + + // Explicitly assign the inlined values in order to avoid triggering explicit JSON serialization (note: JSON.stringify will recursively call `#.toJSON`, so values will still be JSON serialized for portable transmission; however, we don't want to eagerly serialize here in order to avoid unnecessary data copying): + out.values = this._values; + + return out; +}); + + +// EXPORTS // + +module.exports = DataSet; diff --git a/lib/node_modules/@stdlib/plot/vega/data/values/lib/properties.json b/lib/node_modules/@stdlib/plot/vega/data/values/lib/properties.json new file mode 100644 index 000000000000..83f2d8c8765f --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/data/values/lib/properties.json @@ -0,0 +1,3 @@ +[ + "values" +] diff --git a/lib/node_modules/@stdlib/plot/vega/data/values/lib/values/get.js b/lib/node_modules/@stdlib/plot/vega/data/values/lib/values/get.js new file mode 100644 index 000000000000..6da709ccdd75 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/data/values/lib/values/get.js @@ -0,0 +1,43 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable no-invalid-this */ + +'use strict'; + +// MODULES // + +var prop = require( './properties.js' ); + + +// MAIN // + +/** +* Returns an inline data set. +* +* @private +* @returns {*} data set +*/ +function get() { + return this[ prop.private ]; +} + + +// EXPORTS // + +module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/vega/data/values/lib/values/properties.js b/lib/node_modules/@stdlib/plot/vega/data/values/lib/values/properties.js new file mode 100644 index 000000000000..518d28563e40 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/data/values/lib/values/properties.js @@ -0,0 +1,33 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var property2object = require( '@stdlib/plot/vega/base/property2object' ); + + +// MAIN // + +var obj = property2object( 'values' ); + + +// EXPORTS // + +module.exports = obj; diff --git a/lib/node_modules/@stdlib/plot/vega/data/values/lib/values/set.js b/lib/node_modules/@stdlib/plot/vega/data/values/lib/values/set.js new file mode 100644 index 000000000000..fe3d42532d80 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/data/values/lib/values/set.js @@ -0,0 +1,55 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable no-invalid-this */ + +'use strict'; + +// MODULES // + +var logger = require( 'debug' ); +var changeEvent = require( './../change_event.js' ); +var prop = require( './properties.js' ); + + +// VARIABLES // + +var debug = logger( 'vega:values-data:set:'+prop.name ); + + +// MAIN // + +/** +* Sets an inline data set. +* +* @private +* @param {*} value - input value +* @returns {void} +*/ +function set( value ) { + if ( value !== this[ prop.private ] ) { + debug( 'New data set.' ); + this[ prop.private ] = value; + this.emit( 'change', changeEvent( prop.name ) ); + } +} + + +// EXPORTS // + +module.exports = set; diff --git a/lib/node_modules/@stdlib/plot/vega/data/values/package.json b/lib/node_modules/@stdlib/plot/vega/data/values/package.json new file mode 100644 index 000000000000..97560fc0c152 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/data/values/package.json @@ -0,0 +1,61 @@ +{ + "name": "@stdlib/plot/vega/data/values", + "version": "0.0.0", + "description": "Data set constructor for inline values.", + "license": "Apache-2.0", + "author": { + "name": "The Stdlib Authors", + "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" + }, + "contributors": [ + { + "name": "The Stdlib Authors", + "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" + } + ], + "main": "./lib", + "directories": { + "benchmark": "./benchmark", + "doc": "./docs", + "example": "./examples", + "lib": "./lib", + "test": "./test" + }, + "types": "./docs/types", + "scripts": {}, + "homepage": "https://github.com/stdlib-js/stdlib", + "repository": { + "type": "git", + "url": "git://github.com/stdlib-js/stdlib.git" + }, + "bugs": { + "url": "https://github.com/stdlib-js/stdlib/issues" + }, + "dependencies": {}, + "devDependencies": {}, + "engines": { + "node": ">=0.10.0", + "npm": ">2.7.0" + }, + "os": [ + "aix", + "darwin", + "freebsd", + "linux", + "macos", + "openbsd", + "sunos", + "win32", + "windows" + ], + "keywords": [ + "stdlib", + "plot", + "vega", + "data", + "dataset", + "constructor", + "ctor" + ], + "__stdlib__": {} +} diff --git a/lib/node_modules/@stdlib/plot/vega/mark/base/ctor/examples/index.js b/lib/node_modules/@stdlib/plot/vega/mark/base/ctor/examples/index.js new file mode 100644 index 000000000000..6bd1fa87875c --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/mark/base/ctor/examples/index.js @@ -0,0 +1,27 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +var Mark = require( './../lib' ); + +var mark = new Mark({ + 'type': 'line' +}); + +console.log( mark.toJSON() ); diff --git a/lib/node_modules/@stdlib/plot/vega/mark/base/ctor/lib/aria/get.js b/lib/node_modules/@stdlib/plot/vega/mark/base/ctor/lib/aria/get.js new file mode 100644 index 000000000000..53f67df8b546 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/mark/base/ctor/lib/aria/get.js @@ -0,0 +1,43 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable no-invalid-this */ + +'use strict'; + +// MODULES // + +var prop = require( './properties.js' ); + + +// MAIN // + +/** +* Returns a boolean indicating whether ARIA attributes should be included in SVG output. +* +* @private +* @returns {boolean} boolean flag +*/ +function get() { + return this[ prop.private ]; +} + + +// EXPORTS // + +module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/vega/mark/base/ctor/lib/aria/properties.js b/lib/node_modules/@stdlib/plot/vega/mark/base/ctor/lib/aria/properties.js new file mode 100644 index 000000000000..e8ae54164c30 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/mark/base/ctor/lib/aria/properties.js @@ -0,0 +1,33 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var property2object = require( '@stdlib/plot/vega/base/property2object' ); + + +// MAIN // + +var obj = property2object( 'aria' ); + + +// EXPORTS // + +module.exports = obj; diff --git a/lib/node_modules/@stdlib/plot/vega/mark/base/ctor/lib/aria/set.js b/lib/node_modules/@stdlib/plot/vega/mark/base/ctor/lib/aria/set.js new file mode 100644 index 000000000000..ab5dfa868b81 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/mark/base/ctor/lib/aria/set.js @@ -0,0 +1,61 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable no-invalid-this */ + +'use strict'; + +// MODULES // + +var logger = require( 'debug' ); +var isBoolean = require( '@stdlib/assert/is-boolean' ).isPrimitive; +var format = require( '@stdlib/string/format' ); +var changeEvent = require( './../change_event.js' ); +var prop = require( './properties.js' ); + + +// VARIABLES // + +var debug = logger( 'vega:mark:set:'+prop.name ); + + +// MAIN // + +/** +* Sets a boolean flag indicating whether ARIA attributes should be included in SVG output. +* +* @private +* @param {boolean} value - input value +* @throws {TypeError} must be a boolean +* @returns {void} +*/ +function set( value ) { + if ( !isBoolean( value ) ) { + throw new TypeError( format( 'invalid assignment. `%s` must be a boolean. Value: `%s`.', prop.name, value ) ); + } + if ( value !== this[ prop.private ] ) { + debug( 'Current value: %s. New value: %s.', this[ prop.private ], value ); + this[ prop.private ] = value; + this.emit( 'change', changeEvent( prop.name ) ); + } +} + + +// EXPORTS // + +module.exports = set; diff --git a/lib/node_modules/@stdlib/plot/vega/mark/base/ctor/lib/change_event.js b/lib/node_modules/@stdlib/plot/vega/mark/base/ctor/lib/change_event.js new file mode 100644 index 000000000000..7215c59e3a56 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/mark/base/ctor/lib/change_event.js @@ -0,0 +1,41 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MAIN // + +/** +* Returns a new change event object. +* +* @private +* @param {string} property - property name +* @returns {Object} event object +*/ +function event( property ) { // eslint-disable-line stdlib/no-redeclare + return { + 'type': 'update', + 'source': 'mark', + 'property': property + }; +} + + +// EXPORTS // + +module.exports = event; diff --git a/lib/node_modules/@stdlib/plot/vega/mark/base/ctor/lib/defaults.js b/lib/node_modules/@stdlib/plot/vega/mark/base/ctor/lib/defaults.js new file mode 100644 index 000000000000..bf1ce19e832b --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/mark/base/ctor/lib/defaults.js @@ -0,0 +1,58 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MAIN // + +/** +* Returns defaults. +* +* @private +* @returns {Object} default options +* +* @example +* var o = defaults(); +* // returns {...} +*/ +function defaults() { + return { + // Boolean indicating whether to include ARIA attributes in SVG output: + 'aria': true, + + // Boolean indicating if a mark should be clipped to a specified shape: + 'clip': false, + + // Boolean indicating whether a mark can serve as an input event source: + 'interactive': true, + + // Custom default styles to apply to a mark: + 'style': [], + + // List of triggers for modifying mark properties in response to signal changes: + 'triggers': [], + + // Integer z-index indicating the layering of a mark relative to other marks: + 'zindex': 0 + }; +} + + +// EXPORTS // + +module.exports = defaults; diff --git a/lib/node_modules/@stdlib/plot/vega/mark/base/ctor/lib/encode/get.js b/lib/node_modules/@stdlib/plot/vega/mark/base/ctor/lib/encode/get.js new file mode 100644 index 000000000000..f2cadf8ee17e --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/mark/base/ctor/lib/encode/get.js @@ -0,0 +1,44 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable no-invalid-this */ + +'use strict'; + +// MODULES // + +var copy = require( '@stdlib/utils/copy' ); +var prop = require( './properties.js' ); + + +// MAIN // + +/** +* Returns the set of visual encoding rules for mark properties. +* +* @private +* @returns {(Object|void)} encodings +*/ +function get() { + return copy( this[ prop.private ] ); // FIXME: `copy` is relatively slow. Potential speedup? +} + + +// EXPORTS // + +module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/vega/mark/base/ctor/lib/encode/properties.js b/lib/node_modules/@stdlib/plot/vega/mark/base/ctor/lib/encode/properties.js new file mode 100644 index 000000000000..889233bec2b9 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/mark/base/ctor/lib/encode/properties.js @@ -0,0 +1,33 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var property2object = require( '@stdlib/plot/vega/base/property2object' ); + + +// MAIN // + +var obj = property2object( 'encode' ); + + +// EXPORTS // + +module.exports = obj; diff --git a/lib/node_modules/@stdlib/plot/vega/mark/base/ctor/lib/encode/set.js b/lib/node_modules/@stdlib/plot/vega/mark/base/ctor/lib/encode/set.js new file mode 100644 index 000000000000..ce3c9e05bfa1 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/mark/base/ctor/lib/encode/set.js @@ -0,0 +1,69 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable no-invalid-this */ + +'use strict'; + +// MODULES // + +var logger = require( 'debug' ); +var isObject = require( '@stdlib/assert/is-object' ); +var isUndefined = require( '@stdlib/assert/is-undefined' ); +var copy = require( '@stdlib/utils/copy' ); +var format = require( '@stdlib/string/format' ); +var changeEvent = require( './../change_event.js' ); +var prop = require( './properties.js' ); + + +// VARIABLES // + +var debug = logger( 'vega:mark:set:'+prop.name ); + + +// MAIN // + +/** +* Sets the visual encoding rules for mark properties. +* +* ## Notes +* +* - Providing `undefined` "unsets" the configured value. +* +* @private +* @param {(Object|void)} value - input value +* @throws {TypeError} must be an object +* @returns {void} +*/ +function set( value ) { + // FIXME: perform more robust validation of encoding objects + if ( !isObject( value ) && !isUndefined( value ) ) { + throw new TypeError( format( 'invalid assignment. `%s` must be an object. Value: `%s`.', prop.name, value ) ); + } + // TODO: consider deep equality check + if ( value !== this[ prop.private ] ) { + debug( 'Current value: %s. New value: %s.', JSON.stringify( this[ prop.private ] ), JSON.stringify( value ) ); + this[ prop.private ] = copy( value ); + this.emit( 'change', changeEvent( prop.name ) ); + } +} + + +// EXPORTS // + +module.exports = set; diff --git a/lib/node_modules/@stdlib/plot/vega/mark/base/ctor/lib/from/get.js b/lib/node_modules/@stdlib/plot/vega/mark/base/ctor/lib/from/get.js new file mode 100644 index 000000000000..50c41379ecb0 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/mark/base/ctor/lib/from/get.js @@ -0,0 +1,44 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable no-invalid-this */ + +'use strict'; + +// MODULES // + +var copy = require( '@stdlib/utils/copy' ); +var prop = require( './properties.js' ); + + +// MAIN // + +/** +* Returns the mark data source. +* +* @private +* @returns {(Object|void)} mark data source +*/ +function get() { + return copy( this[ prop.private ] ); // TODO: can we avoid using `copy` and use a more performant alternative? +} + + +// EXPORTS // + +module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/vega/mark/base/ctor/lib/from/properties.js b/lib/node_modules/@stdlib/plot/vega/mark/base/ctor/lib/from/properties.js new file mode 100644 index 000000000000..6212cb323fd4 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/mark/base/ctor/lib/from/properties.js @@ -0,0 +1,33 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var property2object = require( '@stdlib/plot/vega/base/property2object' ); + + +// MAIN // + +var obj = property2object( 'from' ); + + +// EXPORTS // + +module.exports = obj; diff --git a/lib/node_modules/@stdlib/plot/vega/mark/base/ctor/lib/from/set.js b/lib/node_modules/@stdlib/plot/vega/mark/base/ctor/lib/from/set.js new file mode 100644 index 000000000000..ec644007f5e5 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/mark/base/ctor/lib/from/set.js @@ -0,0 +1,68 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable no-invalid-this */ + +'use strict'; + +// MODULES // + +var logger = require( 'debug' ); +var isObject = require( '@stdlib/assert/is-object' ); +var isUndefined = require( '@stdlib/assert/is-undefined' ); +var copy = require( '@stdlib/utils/copy' ); +var format = require( '@stdlib/string/format' ); +var changeEvent = require( './../change_event.js' ); +var prop = require( './properties.js' ); + + +// VARIABLES // + +var debug = logger( 'vega:mark:set:'+prop.name ); + + +// MAIN // + +/** +* Sets the mark data source. +* +* ## Notes +* +* - Providing `undefined` "unsets" the configured value. +* +* @private +* @param {string} value - input value +* @throws {TypeError} must be an object +* @returns {void} +*/ +function set( value ) { + if ( !isObject( value ) && !isUndefined( value ) ) { + throw new TypeError( format( 'invalid assignment. `%s` must be an object. Value: `%s`.', prop.name, value ) ); + } + // TODO: consider deep equality check + if ( value !== this[ prop.private ] ) { + debug( 'Current value: %s. New value: %s.', JSON.stringify( this[ prop.private ] ), JSON.stringify( value ) ); + this[ prop.private ] = copy( value ); + this.emit( 'change', changeEvent( prop.name ) ); + } +} + + +// EXPORTS // + +module.exports = set; diff --git a/lib/node_modules/@stdlib/plot/vega/mark/base/ctor/lib/index.js b/lib/node_modules/@stdlib/plot/vega/mark/base/ctor/lib/index.js new file mode 100644 index 000000000000..bae8c750d4fd --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/mark/base/ctor/lib/index.js @@ -0,0 +1,42 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +/** +* Mark constructor. +* +* @module @stdlib/plot/vega/mark/base/ctor +* +* @example +* var Mark = require( '@stdlib/plot/vega/mark/base/ctor' ); +* +* var mark = new Mark({ +* 'type': 'line' +* }); +* // returns <Mark> +*/ + +// MODULES // + +var main = require( './main.js' ); + + +// EXPORTS // + +module.exports = main; diff --git a/lib/node_modules/@stdlib/plot/vega/mark/base/ctor/lib/main.js b/lib/node_modules/@stdlib/plot/vega/mark/base/ctor/lib/main.js new file mode 100644 index 000000000000..93d0846e4457 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/mark/base/ctor/lib/main.js @@ -0,0 +1,330 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable no-restricted-syntax, no-invalid-this */ + +'use strict'; + +// MODULES // + +var EventEmitter = require( 'events' ).EventEmitter; +var logger = require( 'debug' ); +var isObject = require( '@stdlib/assert/is-object' ); +var setNonEnumerableReadOnly = require( '@stdlib/utils/define-nonenumerable-read-only-property' ); +var setNonEnumerableReadOnlyAccessor = require( '@stdlib/utils/define-nonenumerable-read-only-accessor' ); // eslint-disable-line id-length +var setReadWriteAccessor = require( '@stdlib/utils/define-read-write-accessor' ); +var hasProp = require( '@stdlib/assert/has-property' ); +var inherit = require( '@stdlib/utils/inherit' ); +var objectKeys = require( '@stdlib/utils/keys' ); +var transformErrorMessage = require( '@stdlib/plot/vega/base/transform-validation-message' ); +var instance2json = require( '@stdlib/plot/vega/base/to-json' ); +var format = require( '@stdlib/string/format' ); +var properties = require( './properties.json' ); +var defaults = require( './defaults.js' ); + +// Note: keep the following in alphabetical order according to the `require` path... +var getARIA = require( './aria/get.js' ); +var setARIA = require( './aria/set.js' ); + +var getEncode = require( './encode/get.js' ); +var setEncode = require( './encode/set.js' ); + +var getFrom = require( './from/get.js' ); +var setFrom = require( './from/set.js' ); + +var getProperties = require( './properties/get.js' ); + +var getTriggers = require( './triggers/get.js' ); +var setTriggers = require( './triggers/set.js' ); + +var getType = require( './type/get.js' ); +var setType = require( './type/set.js' ); + +var getZIndex = require( './zindex/get.js' ); +var setZIndex = require( './zindex/set.js' ); + + +// VARIABLES // + +var debug = logger( 'vega:mark:main' ); + + +// MAIN // + +/** +* Mark constructor. +* +* @constructor +* @param {Options} options - constructor options +* @param {string} options.type - mark type +* @param {boolean} [options.aria=true] - boolean indicating whether to include ARIA attributes in SVG output +* @param {(boolean|Signal|Object)} [options.clip=false] - setting indicating whether to clip marks to a specified shape +* @param {string} [options.description] - text description of a mark for ARIA accessibility +* @param {Object} [options.encode] - object containing visual encoding rules for mark properties +* @param {Object} [options.from] - object describing the data a mark should visualize +* @param {boolean} [options.interactive=true] - boolean indicating whether a mark can serve as an input event source +* @param {(string|Object)} [options.key] - data field to use as a unique key for data binding +* @param {string} [options.name] - unique name +* @param {Array<Trigger>} [options.triggers=[]] - list of triggers for modifying mark properties in response to signal changes +* @param {Object} [options.sort] - comparator for sorting mark items +* @param {Array<Transform>} [options.transforms=[]] - list of post-encoding transforms to apply after any "encode" blocks and which operate directly on mark scenegraph items +* @param {string} [options.role] - metadata string indicating the role of a mark +* @param {(string|Array<string>)} [options.style] - custom styles to apply to a mark +* @param {number} [options.zindex=0] - integer z-index indicating the layering of a mark relative to other marks +* @throws {TypeError} options argument must be an object +* @throws {Error} must provide valid options +* @returns {Mark} mark instance +* +* @example +* var mark = new Mark({ +* 'type': 'line' +* }); +* // returns <Mark> +*/ +function Mark( options ) { + var opts; + var keys; + var v; + var k; + var i; + if ( !( this instanceof Mark ) ) { + return new Mark( options ); + } + EventEmitter.call( this ); + if ( !isObject( options ) ) { + throw new TypeError( format( 'invalid argument. Options argument must be an object. Value: `%s`.', options ) ); + } + // Resolve the default configuration: + opts = defaults(); + + // Set internal properties according to the default configuration... + keys = objectKeys( opts ); + for ( i = 0; i < keys.length; i++ ) { + k = keys[ i ]; + this[ '_'+k ] = opts[ k ]; + if ( k === 'on' ) { + this._triggers = opts[ k ]; // set an alias + } else if ( k === 'triggers' ) { + this._on = opts[ k ]; // set an alias + } + } + // Check for required properties... + if ( !hasProp( options, 'type' ) ) { + throw new TypeError( 'invalid argument. Options argument must specify the mark type.' ); + } + // Validate provided options by attempting to assign option values to corresponding fields... + for ( i = 0; i < properties.length; i++ ) { + k = properties[ i ]; + if ( !hasProp( options, k ) ) { + continue; + } + v = options[ k ]; + if ( k === 'on' ) { + // Avoid conflict with event emitter method: + k = 'triggers'; + } + try { + this[ k ] = v; + } catch ( err ) { + debug( 'Encountered an error. Error: %s', err.message ); + + // FIXME: retain thrown error type + throw new Error( transformErrorMessage( err.message ) ); + } + } + return this; +} + +/* +* Inherit from the `EventEmitter` prototype. +*/ +inherit( Mark, EventEmitter ); + +/** +* Constructor name. +* +* @private +* @name name +* @memberof Mark +* @readonly +* @type {string} +*/ +setNonEnumerableReadOnly( Mark, 'name', 'Mark' ); + +/** +* Boolean indicating whether to include ARIA attributes in SVG output. +* +* @name aria +* @memberof Mark.prototype +* @type {boolean} +* @default true +* +* @example +* var mark = new Mark({ +* 'type': 'line', +* 'aria': true +* }); +* +* var v = mark.aria; +* // returns true +*/ +setReadWriteAccessor( Mark.prototype, 'aria', getARIA, setARIA ); + +/** +* Visual encoding rules for mark properties. +* +* @name encode +* @memberof Mark.prototype +* @type {(Object|void)} +* +* @example +* var mark = new Mark({ +* 'type': 'line', +* 'encode': { +* 'enter': { +* 'stroke': { +* 'value': 'steelblue' +* } +* } +* } +* }); +* +* var v = mark.encode; +* // returns {...} +*/ +setReadWriteAccessor( Mark.prototype, 'encode', getEncode, setEncode ); + +/** +* Mark data source. +* +* @name from +* @memberof Mark.prototype +* @type {(Object|void)} +* +* @example +* var mark = new Mark({ +* 'type': 'line', +* 'from': { +* 'data': 'foo' +* } +* }); +* +* var v = mark.from; +* // returns { 'data': 'foo' } +*/ +setReadWriteAccessor( Mark.prototype, 'from', getFrom, setFrom ); + +/** +* Mark properties. +* +* @name properties +* @memberof Mark.prototype +* @type {Array<string>} +* +* @example +* var mark = new Mark({ +* 'type': 'line' +* }); +* +* var v = mark.properties; +* // returns [...] +*/ +setNonEnumerableReadOnlyAccessor( Mark.prototype, 'properties', getProperties ); + +/** +* List of triggers for modifying mark properties in response to signal changes. +* +* @name triggers +* @memberof Mark.prototype +* @type {Array<Trigger>} +* +* @example +* var mark = new Mark({ +* 'type': 'line', +* 'triggers': [] +* }); +* +* var v = mark.triggers; +* // returns [] +*/ +setReadWriteAccessor( Mark.prototype, 'triggers', getTriggers, setTriggers ); + +/** +* Graphical mark type. +* +* @name type +* @memberof Mark.prototype +* @type {string} +* +* @example +* var mark = new Mark({ +* 'type': 'line' +* }); +* +* var v = mark.type; +* // returns 'line' +*/ +setReadWriteAccessor( Mark.prototype, 'type', getType, setType ); + +/** +* Integer z-index indicating the layering of a mark relative to other marks. +* +* @name zindex +* @memberof Mark.prototype +* @type {string} +* @default 0 +* +* @example +* var mark = new Mark({ +* 'type': 'line', +* 'zindex': 2 +* }); +* +* var v = mark.zindex; +* // returns 2 +*/ +setReadWriteAccessor( Mark.prototype, 'zindex', getZIndex, setZIndex ); + +/** +* Serializes an instance to a JSON object. +* +* ## Notes +* +* - This method is implicitly invoked by `JSON.stringify`. +* +* @name toJSON +* @memberof Mark.prototype +* @type {Function} +* @returns {Object} JSON object +* +* @example +* var mark = new Mark({ +* 'type': 'line' +* }); +* +* var v = mark.toJSON(); +* // returns {...} +*/ +setNonEnumerableReadOnly( Mark.prototype, 'toJSON', function toJSON() { + return instance2json( this, properties ); +}); + + +// EXPORTS // + +module.exports = Mark; diff --git a/lib/node_modules/@stdlib/plot/vega/mark/base/ctor/lib/properties.json b/lib/node_modules/@stdlib/plot/vega/mark/base/ctor/lib/properties.json new file mode 100644 index 000000000000..2dcc6947bb2e --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/mark/base/ctor/lib/properties.json @@ -0,0 +1,17 @@ +[ + "aria", + "clip", + "description", + "encode", + "from", + "interactive", + "key", + "name", + "role", + "sort", + "style", + "transform", + "triggers", + "type", + "zindex" +] diff --git a/lib/node_modules/@stdlib/plot/vega/mark/base/ctor/lib/properties/get.js b/lib/node_modules/@stdlib/plot/vega/mark/base/ctor/lib/properties/get.js new file mode 100644 index 000000000000..8fc57de14e90 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/mark/base/ctor/lib/properties/get.js @@ -0,0 +1,41 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var properties = require( './../properties.json' ); + + +// MAIN // + +/** +* Returns the list of enumerable properties. +* +* @private +* @returns {Array<string>} properties +*/ +function get() { + return properties.slice(); +} + + +// EXPORTS // + +module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/vega/mark/base/ctor/lib/triggers/get.js b/lib/node_modules/@stdlib/plot/vega/mark/base/ctor/lib/triggers/get.js new file mode 100644 index 000000000000..29c3a67ed11a --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/mark/base/ctor/lib/triggers/get.js @@ -0,0 +1,44 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable no-invalid-this */ + +'use strict'; + +// MODULES // + +var copy = require( '@stdlib/array/base/copy-indexed' ); +var prop = require( './properties.js' ); + + +// MAIN // + +/** +* Returns a list of triggers for modifying mark properties in response to signal changes. +* +* @private +* @returns {Array<Trigger>} list of updates +*/ +function get() { + return copy( this[ prop.private ] ); +} + + +// EXPORTS // + +module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/vega/mark/base/ctor/lib/triggers/properties.js b/lib/node_modules/@stdlib/plot/vega/mark/base/ctor/lib/triggers/properties.js new file mode 100644 index 000000000000..2340b2f70079 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/mark/base/ctor/lib/triggers/properties.js @@ -0,0 +1,33 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var property2object = require( '@stdlib/plot/vega/base/property2object' ); + + +// MAIN // + +var obj = property2object( 'triggers' ); + + +// EXPORTS // + +module.exports = obj; diff --git a/lib/node_modules/@stdlib/plot/vega/mark/base/ctor/lib/triggers/set.js b/lib/node_modules/@stdlib/plot/vega/mark/base/ctor/lib/triggers/set.js new file mode 100644 index 000000000000..16f0a1277825 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/mark/base/ctor/lib/triggers/set.js @@ -0,0 +1,68 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable no-invalid-this */ + +'use strict'; + +// MODULES // + +var logger = require( 'debug' ); +var isEmptyArrayLikeObject = require( '@stdlib/assert/is-empty-array-like-object' ); +var hasEqualValues = require( '@stdlib/array/base/assert/has-equal-values' ); +var isTriggerArray = require( '@stdlib/plot/vega/base/assert/is-trigger-array' ); +var copy = require( '@stdlib/array/base/copy' ); +var format = require( '@stdlib/string/format' ); +var changeEvent = require( './../change_event.js' ); +var prop = require( './properties.js' ); + + +// VARIABLES // + +var debug = logger( 'vega:mark:set:'+prop.name ); + + +// MAIN // + +/** +* Sets a list of triggers for modifying mark properties in response to signal changes. +* +* @private +* @param {ArrayLikeObject<Trigger>} value - input value +* @throws {TypeError} must be an array of trigger instances +* @returns {void} +*/ +function set( value ) { + if ( !isTriggerArray( value ) && !isEmptyArrayLikeObject( value ) ) { + throw new TypeError( format( 'invalid assignment. `%s` must be an array of trigger instances. Value: `%s`.', prop.name, value ) ); + } + value = copy( value ); + if ( !hasEqualValues( value, this[ prop.private ] ) ) { + this._removeChangeListeners( this[ prop.private ] ); + debug( 'Current value: %s. New value: %s.', JSON.stringify( this[ prop.private ] ), JSON.stringify( value ) ); + this[ prop.private ] = value; + this._on = value; // set an alias to ensure correct serialization + this.emit( 'change', changeEvent( prop.name ) ); + this._addChangeListeners( this[ prop.private ] ); + } +} + + +// EXPORTS // + +module.exports = set; diff --git a/lib/node_modules/@stdlib/plot/vega/mark/base/ctor/lib/type/get.js b/lib/node_modules/@stdlib/plot/vega/mark/base/ctor/lib/type/get.js new file mode 100644 index 000000000000..8385b0173de1 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/mark/base/ctor/lib/type/get.js @@ -0,0 +1,43 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable no-invalid-this */ + +'use strict'; + +// MODULES // + +var prop = require( './properties.js' ); + + +// MAIN // + +/** +* Returns the mark type. +* +* @private +* @returns {string} mark type +*/ +function get() { + return this[ prop.private ]; +} + + +// EXPORTS // + +module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/vega/mark/base/ctor/lib/type/properties.js b/lib/node_modules/@stdlib/plot/vega/mark/base/ctor/lib/type/properties.js new file mode 100644 index 000000000000..d4cf0dee043b --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/mark/base/ctor/lib/type/properties.js @@ -0,0 +1,33 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var property2object = require( '@stdlib/plot/vega/base/property2object' ); + + +// MAIN // + +var obj = property2object( 'type' ); + + +// EXPORTS // + +module.exports = obj; diff --git a/lib/node_modules/@stdlib/plot/vega/mark/base/ctor/lib/type/set.js b/lib/node_modules/@stdlib/plot/vega/mark/base/ctor/lib/type/set.js new file mode 100644 index 000000000000..81d2ffd2c45f --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/mark/base/ctor/lib/type/set.js @@ -0,0 +1,63 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable no-invalid-this */ + +'use strict'; + +// MODULES // + +var logger = require( 'debug' ); +var isMarkName = require( '@stdlib/plot/vega/base/assert/is-mark-name' ); +var join = require( '@stdlib/array/base/join' ); +var names = require( '@stdlib/plot/vega/mark/names' ); +var format = require( '@stdlib/string/format' ); +var changeEvent = require( './../change_event.js' ); +var prop = require( './properties.js' ); + + +// VARIABLES // + +var debug = logger( 'vega:mark:set:'+prop.name ); + + +// MAIN // + +/** +* Sets the mark type. +* +* @private +* @param {string} value - input value +* @throws {TypeError} must be a valid mark +* @returns {void} +*/ +function set( value ) { + if ( !isMarkName( value ) ) { + throw new TypeError( format( 'invalid assignment. `%s` must be one of the following: "%s". Value: `%s`.', prop.name, join( names(), '", "' ), value ) ); + } + if ( value !== this[ prop.private ] ) { + debug( 'Current value: %s. New value: %s.', this[ prop.private ], value ); + this[ prop.private ] = value; + this.emit( 'change', changeEvent( prop.name ) ); + } +} + + +// EXPORTS // + +module.exports = set; diff --git a/lib/node_modules/@stdlib/plot/vega/mark/base/ctor/lib/zindex/get.js b/lib/node_modules/@stdlib/plot/vega/mark/base/ctor/lib/zindex/get.js new file mode 100644 index 000000000000..e6ffccaefc54 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/mark/base/ctor/lib/zindex/get.js @@ -0,0 +1,43 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable no-invalid-this */ + +'use strict'; + +// MODULES // + +var prop = require( './properties.js' ); + + +// MAIN // + +/** +* Returns the integer z-index indicating the layering of a mark relative to other marks. +* +* @private +* @returns {number} z-index +*/ +function get() { + return this[ prop.private ]; +} + + +// EXPORTS // + +module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/vega/mark/base/ctor/lib/zindex/properties.js b/lib/node_modules/@stdlib/plot/vega/mark/base/ctor/lib/zindex/properties.js new file mode 100644 index 000000000000..4640b5d43e8c --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/mark/base/ctor/lib/zindex/properties.js @@ -0,0 +1,33 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var property2object = require( '@stdlib/plot/vega/base/property2object' ); + + +// MAIN // + +var obj = property2object( 'zindex' ); + + +// EXPORTS // + +module.exports = obj; diff --git a/lib/node_modules/@stdlib/plot/vega/mark/base/ctor/lib/zindex/set.js b/lib/node_modules/@stdlib/plot/vega/mark/base/ctor/lib/zindex/set.js new file mode 100644 index 000000000000..9e49041b1755 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/mark/base/ctor/lib/zindex/set.js @@ -0,0 +1,61 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable no-invalid-this */ + +'use strict'; + +// MODULES // + +var logger = require( 'debug' ); +var isNumber = require( '@stdlib/assert/is-number' ).isPrimitive; +var format = require( '@stdlib/string/format' ); +var changeEvent = require( './../change_event.js' ); +var prop = require( './properties.js' ); + + +// VARIABLES // + +var debug = logger( 'vega:mark:set:'+prop.name ); + + +// MAIN // + +/** +* Sets the integer z-index indicating the layering of a mark relative to other marks. +* +* @private +* @param {number} value - input value +* @throws {TypeError} must be a number +* @returns {void} +*/ +function set( value ) { + if ( !isNumber( value ) ) { + throw new TypeError( format( 'invalid assignment. `%s` must be a number. Value: `%s`.', prop.name, value ) ); + } + if ( value !== this[ prop.private ] ) { + debug( 'Current value: %s. New value: %s.', this[ prop.private ], value ); + this[ prop.private ] = value; + this.emit( 'change', changeEvent( prop.name ) ); + } +} + + +// EXPORTS // + +module.exports = set; diff --git a/lib/node_modules/@stdlib/plot/vega/mark/base/ctor/package.json b/lib/node_modules/@stdlib/plot/vega/mark/base/ctor/package.json new file mode 100644 index 000000000000..25550cf3034b --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/mark/base/ctor/package.json @@ -0,0 +1,61 @@ +{ + "name": "@stdlib/plot/vega/mark/base/ctor", + "version": "0.0.0", + "description": "Mark constructor.", + "license": "Apache-2.0", + "author": { + "name": "The Stdlib Authors", + "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" + }, + "contributors": [ + { + "name": "The Stdlib Authors", + "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" + } + ], + "main": "./lib", + "directories": { + "benchmark": "./benchmark", + "doc": "./docs", + "example": "./examples", + "lib": "./lib", + "test": "./test" + }, + "types": "./docs/types", + "scripts": {}, + "homepage": "https://github.com/stdlib-js/stdlib", + "repository": { + "type": "git", + "url": "git://github.com/stdlib-js/stdlib.git" + }, + "bugs": { + "url": "https://github.com/stdlib-js/stdlib/issues" + }, + "dependencies": {}, + "devDependencies": {}, + "engines": { + "node": ">=0.10.0", + "npm": ">2.7.0" + }, + "os": [ + "aix", + "darwin", + "freebsd", + "linux", + "macos", + "openbsd", + "sunos", + "win32", + "windows" + ], + "keywords": [ + "stdlib", + "plot", + "vega", + "mark", + "encoding", + "constructor", + "ctor" + ], + "__stdlib__": {} +} diff --git a/lib/node_modules/@stdlib/plot/vega/mark/names/README.md b/lib/node_modules/@stdlib/plot/vega/mark/names/README.md new file mode 100644 index 000000000000..3277372b298c --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/mark/names/README.md @@ -0,0 +1,117 @@ +<!-- + +@license Apache-2.0 + +Copyright (c) 2025 The Stdlib Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + +--> + +# marks + +> List of supported Vega mark types. + +<!-- Section to include introductory text. Make sure to keep an empty line after the intro `section` element and another before the `/section` close. --> + +<section class="intro"> + +</section> + +<!-- /.intro --> + +<!-- Package usage documentation. --> + +<section class="usage"> + +## Usage + +```javascript +var marks = require( '@stdlib/plot/vega/mark/names' ); +``` + +#### marks() + +Returns a list of supported mark types. + +```javascript +var out = marks(); +// e.g., returns [ 'line', 'rect', ... ] +``` + +</section> + +<!-- /.usage --> + +<!-- Package usage notes. Make sure to keep an empty line after the `section` element and another before the `/section` close. --> + +<section class="notes"> + +</section> + +<!-- /.notes --> + +<!-- Package usage examples. --> + +<section class="examples"> + +## Examples + +<!-- eslint no-undef: "error" --> + +```javascript +var contains = require( '@stdlib/array/base/assert/contains' ).factory; +var marks = require( '@stdlib/plot/vega/mark/names' ); + +var isMark = contains( marks() ); + +var bool = isMark( 'line' ); +// returns true + +bool = isMark( 'rect' ); +// returns true + +bool = isMark( 'beep' ); +// returns false + +bool = isMark( 'boop' ); +// returns false +``` + +</section> + +<!-- /.examples --> + +<!-- Section to include cited references. If references are included, add a horizontal rule *before* the section. Make sure to keep an empty line after the `section` element and another before the `/section` close. --> + +<section class="references"> + +</section> + +<!-- /.references --> + +<!-- Section for related `stdlib` packages. Do not manually edit this section, as it is automatically populated. --> + +<section class="related"> + +</section> + +<!-- /.related --> + +<!-- Section for all links. Make sure to keep an empty line after the `section` element and another before the `/section` close. --> + +<section class="links"> + +</section> + +<!-- /.links --> diff --git a/lib/node_modules/@stdlib/plot/vega/mark/names/benchmark/benchmark.js b/lib/node_modules/@stdlib/plot/vega/mark/names/benchmark/benchmark.js new file mode 100644 index 000000000000..ee7bd7f211e5 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/mark/names/benchmark/benchmark.js @@ -0,0 +1,48 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var bench = require( '@stdlib/bench' ); +var isStringArray = require( '@stdlib/assert/is-string-array' ).primitives; +var pkg = require( './../package.json' ).name; +var types = require( './../lib' ); + + +// MAIN // + +bench( pkg, function benchmark( b ) { + var out; + var i; + + b.tic(); + for ( i = 0; i < b.iterations; i++ ) { + out = types(); + if ( out.length < 2 ) { + b.fail( 'should return an array' ); + } + } + b.toc(); + if ( !isStringArray( out ) ) { + b.fail( 'should return an array of strings' ); + } + b.pass( 'benchmark finished' ); + b.end(); +}); diff --git a/lib/node_modules/@stdlib/plot/vega/mark/names/docs/repl.txt b/lib/node_modules/@stdlib/plot/vega/mark/names/docs/repl.txt new file mode 100644 index 000000000000..a72a22976b2b --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/mark/names/docs/repl.txt @@ -0,0 +1,17 @@ + +{{alias}}() + Returns a list of supported mark types. + + Returns + ------- + out: Array<string> + List of mark types. + + Examples + -------- + > var out = {{alias}}() + e.g., [ 'arc', 'area', ... ] + + See Also + -------- + diff --git a/lib/node_modules/@stdlib/plot/vega/mark/names/docs/types/index.d.ts b/lib/node_modules/@stdlib/plot/vega/mark/names/docs/types/index.d.ts new file mode 100644 index 000000000000..8c4c30e73306 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/mark/names/docs/types/index.d.ts @@ -0,0 +1,35 @@ +/* +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +// TypeScript Version: 4.1 + +/** +* Returns a list of supported mark types. +* +* @returns list of mark types +* +* @example +* var out = marks(); +* // e.g., returns [ 'arc', 'area', ... ] +*/ +declare function marks(): Array<string>; + + +// EXPORTS // + +export = marks; diff --git a/lib/node_modules/@stdlib/plot/vega/mark/names/docs/types/test.ts b/lib/node_modules/@stdlib/plot/vega/mark/names/docs/types/test.ts new file mode 100644 index 000000000000..186fb8dbe95f --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/mark/names/docs/types/test.ts @@ -0,0 +1,32 @@ +/* +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +import scales = require( './index' ); + + +// TESTS // + +// The function returns an array of strings... +{ + scales(); // $ExpectType string[] +} + +// The compiler throws an error if the function is provided an unsupported number of arguments... +{ + scales( {} ); // $ExpectError +} diff --git a/lib/node_modules/@stdlib/plot/vega/mark/names/examples/index.js b/lib/node_modules/@stdlib/plot/vega/mark/names/examples/index.js new file mode 100644 index 000000000000..d6a2ef5123a6 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/mark/names/examples/index.js @@ -0,0 +1,40 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +var contains = require( '@stdlib/array/base/assert/contains' ).factory; +var marks = require( './../lib' ); + +var isMark = contains( marks() ); + +var bool = isMark( 'line' ); +console.log( bool ); +// => true + +bool = isMark( 'rect' ); +console.log( bool ); +// => true + +bool = isMark( 'beep' ); +console.log( bool ); +// => false + +bool = isMark( 'boop' ); +console.log( bool ); +// => false diff --git a/lib/node_modules/@stdlib/plot/vega/mark/names/lib/data.json b/lib/node_modules/@stdlib/plot/vega/mark/names/lib/data.json new file mode 100644 index 000000000000..5d7d52d81043 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/mark/names/lib/data.json @@ -0,0 +1,14 @@ +[ + "arc", + "area", + "image", + "group", + "line", + "path", + "rect", + "rule", + "shape", + "symbol", + "text", + "trail" +] diff --git a/lib/node_modules/@stdlib/plot/vega/mark/names/lib/index.js b/lib/node_modules/@stdlib/plot/vega/mark/names/lib/index.js new file mode 100644 index 000000000000..67c01aaa435a --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/mark/names/lib/index.js @@ -0,0 +1,40 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +/** +* Return a list of supported mark types. +* +* @module @stdlib/plot/vega/mark/names +* +* @example +* var marks = require( '@stdlib/plot/vega/mark/names' ); +* +* var out = marks(); +* // e.g., returns [ 'arc', 'area', ... ] +*/ + +// MODULES // + +var main = require( './main.js' ); + + +// EXPORTS // + +module.exports = main; diff --git a/lib/node_modules/@stdlib/plot/vega/mark/names/lib/main.js b/lib/node_modules/@stdlib/plot/vega/mark/names/lib/main.js new file mode 100644 index 000000000000..39524718e877 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/mark/names/lib/main.js @@ -0,0 +1,44 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var DATA = require( './data.json' ); + + +// MAIN // + +/** +* Returns a list of supported mark types. +* +* @returns {StringArray} list of mark types +* +* @example +* var out = marks(); +* // e.g., returns [ 'arc', 'area', ... ] +*/ +function marks() { + return DATA.slice(); +} + + +// EXPORTS // + +module.exports = marks; diff --git a/lib/node_modules/@stdlib/plot/vega/mark/names/package.json b/lib/node_modules/@stdlib/plot/vega/mark/names/package.json new file mode 100644 index 000000000000..31da32368d5a --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/mark/names/package.json @@ -0,0 +1,62 @@ +{ + "name": "@stdlib/plot/vega/mark/names", + "version": "0.0.0", + "description": "List of supported Vega mark types.", + "license": "Apache-2.0", + "author": { + "name": "The Stdlib Authors", + "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" + }, + "contributors": [ + { + "name": "The Stdlib Authors", + "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" + } + ], + "main": "./lib", + "directories": { + "benchmark": "./benchmark", + "doc": "./docs", + "example": "./examples", + "lib": "./lib", + "test": "./test" + }, + "types": "./docs/types", + "scripts": {}, + "homepage": "https://github.com/stdlib-js/stdlib", + "repository": { + "type": "git", + "url": "git://github.com/stdlib-js/stdlib.git" + }, + "bugs": { + "url": "https://github.com/stdlib-js/stdlib/issues" + }, + "dependencies": {}, + "devDependencies": {}, + "engines": { + "node": ">=0.10.0", + "npm": ">2.7.0" + }, + "os": [ + "aix", + "darwin", + "freebsd", + "linux", + "macos", + "openbsd", + "sunos", + "win32", + "windows" + ], + "keywords": [ + "stdlib", + "plot", + "vega", + "marks", + "utilities", + "utility", + "utils", + "util" + ], + "__stdlib__": {} +} diff --git a/lib/node_modules/@stdlib/plot/vega/mark/names/test/test.js b/lib/node_modules/@stdlib/plot/vega/mark/names/test/test.js new file mode 100644 index 000000000000..9b60651c9592 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/mark/names/test/test.js @@ -0,0 +1,57 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var tape = require( 'tape' ); +var marks = require( './../lib' ); + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof marks, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'the function returns a list of mark types', function test( t ) { + var expected; + var actual; + + expected = [ + 'arc', + 'area', + 'image', + 'group', + 'line', + 'path', + 'rect', + 'rule', + 'shape', + 'symbol', + 'text', + 'trail' + ]; + actual = marks(); + + t.deepEqual( actual, expected, 'returns expected value' ); + t.end(); +}); diff --git a/lib/node_modules/@stdlib/plot/vega/padding/ctor/examples/index.js b/lib/node_modules/@stdlib/plot/vega/padding/ctor/examples/index.js new file mode 100644 index 000000000000..b6ffadfdc46c --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/padding/ctor/examples/index.js @@ -0,0 +1,24 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +var Padding = require( './../lib' ); + +var padding = new Padding(); +console.log( padding.toJSON() ); diff --git a/lib/node_modules/@stdlib/plot/vega/padding/ctor/lib/bottom/get.js b/lib/node_modules/@stdlib/plot/vega/padding/ctor/lib/bottom/get.js new file mode 100644 index 000000000000..a311a4a5194e --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/padding/ctor/lib/bottom/get.js @@ -0,0 +1,43 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable no-invalid-this */ + +'use strict'; + +// MODULES // + +var prop = require( './properties.js' ); + + +// MAIN // + +/** +* Returns the bottom padding (in pixels). +* +* @private +* @returns {number} padding +*/ +function get() { + return this[ prop.private ]; +} + + +// EXPORTS // + +module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/vega/padding/ctor/lib/bottom/properties.js b/lib/node_modules/@stdlib/plot/vega/padding/ctor/lib/bottom/properties.js new file mode 100644 index 000000000000..f3e8170decae --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/padding/ctor/lib/bottom/properties.js @@ -0,0 +1,33 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var property2object = require( '@stdlib/plot/vega/base/property2object' ); + + +// MAIN // + +var obj = property2object( 'bottom' ); + + +// EXPORTS // + +module.exports = obj; diff --git a/lib/node_modules/@stdlib/plot/vega/padding/ctor/lib/bottom/set.js b/lib/node_modules/@stdlib/plot/vega/padding/ctor/lib/bottom/set.js new file mode 100644 index 000000000000..4a93dccc320a --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/padding/ctor/lib/bottom/set.js @@ -0,0 +1,61 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable no-invalid-this */ + +'use strict'; + +// MODULES // + +var logger = require( 'debug' ); +var isNumber = require( '@stdlib/assert/is-number' ).isPrimitive; +var format = require( '@stdlib/string/format' ); +var changeEvent = require( './../change_event.js' ); +var prop = require( './properties.js' ); + + +// VARIABLES // + +var debug = logger( 'vega:padding:set:'+prop.name ); + + +// MAIN // + +/** +* Sets the bottom padding (in pixels). +* +* @private +* @param {number} value - input value +* @throws {TypeError} must be a number +* @returns {void} +*/ +function set( value ) { + if ( !isNumber( value ) ) { + throw new TypeError( format( 'invalid assignment. `%s` must be a number. Value: `%s`.', prop.name, value ) ); + } + if ( value !== this[ prop.private ] ) { + debug( 'Current value: %s. New value: %s.', this[ prop.private ], value ); + this[ prop.private ] = value; + this.emit( 'change', changeEvent( prop.name ) ); + } +} + + +// EXPORTS // + +module.exports = set; diff --git a/lib/node_modules/@stdlib/plot/vega/padding/ctor/lib/change_event.js b/lib/node_modules/@stdlib/plot/vega/padding/ctor/lib/change_event.js new file mode 100644 index 000000000000..86884daebad3 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/padding/ctor/lib/change_event.js @@ -0,0 +1,41 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MAIN // + +/** +* Returns a new change event object. +* +* @private +* @param {string} property - property name +* @returns {Object} event object +*/ +function event( property ) { // eslint-disable-line stdlib/no-redeclare + return { + 'type': 'update', + 'source': 'padding', + 'property': property + }; +} + + +// EXPORTS // + +module.exports = event; diff --git a/lib/node_modules/@stdlib/plot/vega/padding/ctor/lib/defaults.js b/lib/node_modules/@stdlib/plot/vega/padding/ctor/lib/defaults.js new file mode 100644 index 000000000000..8347e851a5f0 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/padding/ctor/lib/defaults.js @@ -0,0 +1,52 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MAIN // + +/** +* Returns defaults. +* +* @private +* @returns {Object} default options +* +* @example +* var o = defaults(); +* // returns {...} +*/ +function defaults() { + return { + // Bottom padding (in pixels): + 'bottom': 0, + + // Left padding (in pixels): + 'left': 0, + + // Right padding (in pixels): + 'right': 0, + + // Top padding (in pixels): + 'top': 0 + }; +} + + +// EXPORTS // + +module.exports = defaults; diff --git a/lib/node_modules/@stdlib/plot/vega/padding/ctor/lib/index.js b/lib/node_modules/@stdlib/plot/vega/padding/ctor/lib/index.js new file mode 100644 index 000000000000..a4ee881f8249 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/padding/ctor/lib/index.js @@ -0,0 +1,40 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +/** +* Padding constructor. +* +* @module @stdlib/plot/vega/padding/ctor +* +* @example +* var Padding = require( '@stdlib/plot/vega/padding/ctor' ); +* +* var padding = new Padding(); +* // returns <Padding> +*/ + +// MODULES // + +var main = require( './main.js' ); + + +// EXPORTS // + +module.exports = main; diff --git a/lib/node_modules/@stdlib/plot/vega/padding/ctor/lib/left/get.js b/lib/node_modules/@stdlib/plot/vega/padding/ctor/lib/left/get.js new file mode 100644 index 000000000000..b43fd3ab14e2 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/padding/ctor/lib/left/get.js @@ -0,0 +1,43 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable no-invalid-this */ + +'use strict'; + +// MODULES // + +var prop = require( './properties.js' ); + + +// MAIN // + +/** +* Returns the left padding (in pixels). +* +* @private +* @returns {number} padding +*/ +function get() { + return this[ prop.private ]; +} + + +// EXPORTS // + +module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/vega/padding/ctor/lib/left/properties.js b/lib/node_modules/@stdlib/plot/vega/padding/ctor/lib/left/properties.js new file mode 100644 index 000000000000..9bacd776a326 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/padding/ctor/lib/left/properties.js @@ -0,0 +1,33 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var property2object = require( '@stdlib/plot/vega/base/property2object' ); + + +// MAIN // + +var obj = property2object( 'left' ); + + +// EXPORTS // + +module.exports = obj; diff --git a/lib/node_modules/@stdlib/plot/vega/padding/ctor/lib/left/set.js b/lib/node_modules/@stdlib/plot/vega/padding/ctor/lib/left/set.js new file mode 100644 index 000000000000..c90d65f64e77 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/padding/ctor/lib/left/set.js @@ -0,0 +1,61 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable no-invalid-this */ + +'use strict'; + +// MODULES // + +var logger = require( 'debug' ); +var isNumber = require( '@stdlib/assert/is-number' ).isPrimitive; +var format = require( '@stdlib/string/format' ); +var changeEvent = require( './../change_event.js' ); +var prop = require( './properties.js' ); + + +// VARIABLES // + +var debug = logger( 'vega:padding:set:'+prop.name ); + + +// MAIN // + +/** +* Sets the left padding (in pixels). +* +* @private +* @param {number} value - input value +* @throws {TypeError} must be a number +* @returns {void} +*/ +function set( value ) { + if ( !isNumber( value ) ) { + throw new TypeError( format( 'invalid assignment. `%s` must be a number. Value: `%s`.', prop.name, value ) ); + } + if ( value !== this[ prop.private ] ) { + debug( 'Current value: %s. New value: %s.', this[ prop.private ], value ); + this[ prop.private ] = value; + this.emit( 'change', changeEvent( prop.name ) ); + } +} + + +// EXPORTS // + +module.exports = set; diff --git a/lib/node_modules/@stdlib/plot/vega/padding/ctor/lib/main.js b/lib/node_modules/@stdlib/plot/vega/padding/ctor/lib/main.js new file mode 100644 index 000000000000..09f91fa631d4 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/padding/ctor/lib/main.js @@ -0,0 +1,258 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable no-restricted-syntax, no-invalid-this */ + +'use strict'; + +// MODULES // + +var EventEmitter = require( 'events' ).EventEmitter; +var logger = require( 'debug' ); +var isObject = require( '@stdlib/assert/is-object' ); +var setNonEnumerableReadOnly = require( '@stdlib/utils/define-nonenumerable-read-only-property' ); +var setNonEnumerableReadOnlyAccessor = require( '@stdlib/utils/define-nonenumerable-read-only-accessor' ); // eslint-disable-line id-length +var setReadWriteAccessor = require( '@stdlib/utils/define-read-write-accessor' ); +var hasProp = require( '@stdlib/assert/has-property' ); +var inherit = require( '@stdlib/utils/inherit' ); +var objectKeys = require( '@stdlib/utils/keys' ); +var transformErrorMessage = require( '@stdlib/plot/vega/base/transform-validation-message' ); +var instance2json = require( '@stdlib/plot/vega/base/to-json' ); +var format = require( '@stdlib/string/format' ); +var properties = require( './properties.json' ); +var defaults = require( './defaults.js' ); + +// Note: keep the following in alphabetical order according to the `require` path... +var getBottom = require( './bottom/get.js' ); +var setBottom = require( './bottom/set.js' ); + +var getLeft = require( './left/get.js' ); +var setLeft = require( './left/set.js' ); + +var getProperties = require( './properties/get.js' ); + +var getRight = require( './right/get.js' ); +var setRight = require( './right/set.js' ); + +var getTop = require( './top/get.js' ); +var setTop = require( './top/set.js' ); + + +// VARIABLES // + +var debug = logger( 'vega:padding:main' ); + + +// MAIN // + +/** +* Padding constructor. +* +* @constructor +* @param {Options} [options] - constructor options +* @param {number} [options.bottom=0] - bottom padding (in pixels) +* @param {number} [options.left=0] - left padding (in pixels) +* @param {number} [options.right=0] - right padding (in pixels) +* @param {number} [options.top=0] - top padding (in pixels) +* @throws {TypeError} options argument must be an object +* @throws {Error} must provide valid options +* @returns {Padding} padding instance +* +* @example +* var padding = new Padding(); +* // returns <Padding> +*/ +function Padding( options ) { + var nargs; + var opts; + var keys; + var v; + var k; + var i; + + nargs = arguments.length; + if ( !( this instanceof Padding ) ) { + if ( nargs ) { + return new Padding( options ); + } + return new Padding(); + } + EventEmitter.call( this ); + + // Resolve the default configuration: + opts = defaults(); + + // Set internal properties according to the default configuration... + keys = objectKeys( opts ); + for ( i = 0; i < keys.length; i++ ) { + k = keys[ i ]; + this[ '_'+k ] = opts[ k ]; + } + if ( nargs ) { + if ( !isObject( options ) ) { + throw new TypeError( format( 'invalid argument. Options argument must be an object. Value: `%s`.', options ) ); + } + // Validate provided options by attempting to assign option values to corresponding fields... + for ( i = 0; i < properties.length; i++ ) { + k = properties[ i ]; + if ( !hasProp( options, k ) ) { + continue; + } + v = options[ k ]; + try { + this[ k ] = v; + } catch ( err ) { + debug( 'Encountered an error. Error: %s', err.message ); + + // FIXME: retain thrown error type + throw new Error( transformErrorMessage( err.message ) ); + } + } + } + return this; +} + +/* +* Inherit from the `EventEmitter` prototype. +*/ +inherit( Padding, EventEmitter ); + +/** +* Constructor name. +* +* @private +* @name name +* @memberof Padding +* @readonly +* @type {string} +*/ +setNonEnumerableReadOnly( Padding, 'name', 'Padding' ); + +/** +* Bottom padding (in pixels). +* +* @name bottom +* @memberof Padding.prototype +* @type {number} +* @default 0 +* +* @example +* var padding = new Padding({ +* 'bottom': 10 +* }); +* +* var v = padding.bottom; +* // returns 10 +*/ +setReadWriteAccessor( Padding.prototype, 'bottom', getBottom, setBottom ); + +/** +* Left padding (in pixels). +* +* @name left +* @memberof Padding.prototype +* @type {number} +* @default 0 +* +* @example +* var padding = new Padding({ +* 'left': 10 +* }); +* +* var v = padding.left; +* // returns 10 +*/ +setReadWriteAccessor( Padding.prototype, 'left', getLeft, setLeft ); + +/** +* Padding properties. +* +* @name properties +* @memberof Padding.prototype +* @type {Array<string>} +* +* @example +* var padding = new Padding(); +* +* var v = padding.properties; +* // returns [...] +*/ +setNonEnumerableReadOnlyAccessor( Padding.prototype, 'properties', getProperties ); + +/** +* Right padding (in pixels). +* +* @name right +* @memberof Padding.prototype +* @type {number} +* @default 0 +* +* @example +* var padding = new Padding({ +* 'right': 10 +* }); +* +* var v = padding.right; +* // returns 10 +*/ +setReadWriteAccessor( Padding.prototype, 'right', getRight, setRight ); + +/** +* Top padding (in pixels). +* +* @name top +* @memberof Padding.prototype +* @type {number} +* @default 0 +* +* @example +* var padding = new Padding({ +* 'top': 10 +* }); +* +* var v = padding.top; +* // returns 10 +*/ +setReadWriteAccessor( Padding.prototype, 'top', getTop, setTop ); + +/** +* Serializes an padding instance to a JSON object. +* +* ## Notes +* +* - This method is implicitly invoked by `JSON.stringify`. +* +* @name toJSON +* @memberof Padding.prototype +* @type {Function} +* @returns {Object} JSON object +* +* @example +* var padding = new Padding(); +* +* var v = padding.toJSON(); +* // returns {...} +*/ +setNonEnumerableReadOnly( Padding.prototype, 'toJSON', function toJSON() { + return instance2json( this, properties ); +}); + + +// EXPORTS // + +module.exports = Padding; diff --git a/lib/node_modules/@stdlib/plot/vega/padding/ctor/lib/properties.json b/lib/node_modules/@stdlib/plot/vega/padding/ctor/lib/properties.json new file mode 100644 index 000000000000..59012048fab1 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/padding/ctor/lib/properties.json @@ -0,0 +1,6 @@ +[ + "bottom", + "left", + "right", + "top" +] diff --git a/lib/node_modules/@stdlib/plot/vega/padding/ctor/lib/properties/get.js b/lib/node_modules/@stdlib/plot/vega/padding/ctor/lib/properties/get.js new file mode 100644 index 000000000000..8fc57de14e90 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/padding/ctor/lib/properties/get.js @@ -0,0 +1,41 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var properties = require( './../properties.json' ); + + +// MAIN // + +/** +* Returns the list of enumerable properties. +* +* @private +* @returns {Array<string>} properties +*/ +function get() { + return properties.slice(); +} + + +// EXPORTS // + +module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/vega/padding/ctor/lib/right/get.js b/lib/node_modules/@stdlib/plot/vega/padding/ctor/lib/right/get.js new file mode 100644 index 000000000000..aaf2d8c915cc --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/padding/ctor/lib/right/get.js @@ -0,0 +1,43 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable no-invalid-this */ + +'use strict'; + +// MODULES // + +var prop = require( './properties.js' ); + + +// MAIN // + +/** +* Returns the right padding (in pixels). +* +* @private +* @returns {number} padding +*/ +function get() { + return this[ prop.private ]; +} + + +// EXPORTS // + +module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/vega/padding/ctor/lib/right/properties.js b/lib/node_modules/@stdlib/plot/vega/padding/ctor/lib/right/properties.js new file mode 100644 index 000000000000..e8635ab62d3d --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/padding/ctor/lib/right/properties.js @@ -0,0 +1,33 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var property2object = require( '@stdlib/plot/vega/base/property2object' ); + + +// MAIN // + +var obj = property2object( 'right' ); + + +// EXPORTS // + +module.exports = obj; diff --git a/lib/node_modules/@stdlib/plot/vega/padding/ctor/lib/right/set.js b/lib/node_modules/@stdlib/plot/vega/padding/ctor/lib/right/set.js new file mode 100644 index 000000000000..c512084c2545 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/padding/ctor/lib/right/set.js @@ -0,0 +1,61 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable no-invalid-this */ + +'use strict'; + +// MODULES // + +var logger = require( 'debug' ); +var isNumber = require( '@stdlib/assert/is-number' ).isPrimitive; +var format = require( '@stdlib/string/format' ); +var changeEvent = require( './../change_event.js' ); +var prop = require( './properties.js' ); + + +// VARIABLES // + +var debug = logger( 'vega:padding:set:'+prop.name ); + + +// MAIN // + +/** +* Sets the right padding (in pixels). +* +* @private +* @param {number} value - input value +* @throws {TypeError} must be a number +* @returns {void} +*/ +function set( value ) { + if ( !isNumber( value ) ) { + throw new TypeError( format( 'invalid assignment. `%s` must be a number. Value: `%s`.', prop.name, value ) ); + } + if ( value !== this[ prop.private ] ) { + debug( 'Current value: %s. New value: %s.', this[ prop.private ], value ); + this[ prop.private ] = value; + this.emit( 'change', changeEvent( prop.name ) ); + } +} + + +// EXPORTS // + +module.exports = set; diff --git a/lib/node_modules/@stdlib/plot/vega/padding/ctor/lib/top/get.js b/lib/node_modules/@stdlib/plot/vega/padding/ctor/lib/top/get.js new file mode 100644 index 000000000000..c9b22be09c8b --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/padding/ctor/lib/top/get.js @@ -0,0 +1,43 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable no-invalid-this */ + +'use strict'; + +// MODULES // + +var prop = require( './properties.js' ); + + +// MAIN // + +/** +* Returns the top padding (in pixels). +* +* @private +* @returns {number} padding +*/ +function get() { + return this[ prop.private ]; +} + + +// EXPORTS // + +module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/vega/padding/ctor/lib/top/properties.js b/lib/node_modules/@stdlib/plot/vega/padding/ctor/lib/top/properties.js new file mode 100644 index 000000000000..4144bb1c88ec --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/padding/ctor/lib/top/properties.js @@ -0,0 +1,33 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var property2object = require( '@stdlib/plot/vega/base/property2object' ); + + +// MAIN // + +var obj = property2object( 'top' ); + + +// EXPORTS // + +module.exports = obj; diff --git a/lib/node_modules/@stdlib/plot/vega/padding/ctor/lib/top/set.js b/lib/node_modules/@stdlib/plot/vega/padding/ctor/lib/top/set.js new file mode 100644 index 000000000000..a2f6495df143 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/padding/ctor/lib/top/set.js @@ -0,0 +1,61 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable no-invalid-this */ + +'use strict'; + +// MODULES // + +var logger = require( 'debug' ); +var isNumber = require( '@stdlib/assert/is-number' ).isPrimitive; +var format = require( '@stdlib/string/format' ); +var changeEvent = require( './../change_event.js' ); +var prop = require( './properties.js' ); + + +// VARIABLES // + +var debug = logger( 'vega:padding:set:'+prop.name ); + + +// MAIN // + +/** +* Sets the top padding (in pixels). +* +* @private +* @param {number} value - input value +* @throws {TypeError} must be a number +* @returns {void} +*/ +function set( value ) { + if ( !isNumber( value ) ) { + throw new TypeError( format( 'invalid assignment. `%s` must be a number. Value: `%s`.', prop.name, value ) ); + } + if ( value !== this[ prop.private ] ) { + debug( 'Current value: %s. New value: %s.', this[ prop.private ], value ); + this[ prop.private ] = value; + this.emit( 'change', changeEvent( prop.name ) ); + } +} + + +// EXPORTS // + +module.exports = set; diff --git a/lib/node_modules/@stdlib/plot/vega/padding/ctor/package.json b/lib/node_modules/@stdlib/plot/vega/padding/ctor/package.json new file mode 100644 index 000000000000..453a7c03ba3b --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/padding/ctor/package.json @@ -0,0 +1,61 @@ +{ + "name": "@stdlib/plot/vega/padding/ctor", + "version": "0.0.0", + "description": "Padding constructor.", + "license": "Apache-2.0", + "author": { + "name": "The Stdlib Authors", + "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" + }, + "contributors": [ + { + "name": "The Stdlib Authors", + "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" + } + ], + "main": "./lib", + "directories": { + "benchmark": "./benchmark", + "doc": "./docs", + "example": "./examples", + "lib": "./lib", + "test": "./test" + }, + "types": "./docs/types", + "scripts": {}, + "homepage": "https://github.com/stdlib-js/stdlib", + "repository": { + "type": "git", + "url": "git://github.com/stdlib-js/stdlib.git" + }, + "bugs": { + "url": "https://github.com/stdlib-js/stdlib/issues" + }, + "dependencies": {}, + "devDependencies": {}, + "engines": { + "node": ">=0.10.0", + "npm": ">2.7.0" + }, + "os": [ + "aix", + "darwin", + "freebsd", + "linux", + "macos", + "openbsd", + "sunos", + "win32", + "windows" + ], + "keywords": [ + "stdlib", + "plot", + "vega", + "padding", + "layout", + "constructor", + "ctor" + ], + "__stdlib__": {} +} diff --git a/lib/node_modules/@stdlib/plot/vega/scale/base/ctor/examples/index.js b/lib/node_modules/@stdlib/plot/vega/scale/base/ctor/examples/index.js new file mode 100644 index 000000000000..a9ead85865a5 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/scale/base/ctor/examples/index.js @@ -0,0 +1,27 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +var Scale = require( './../lib' ); + +var scale = new Scale({ + 'name': 'xScale' +}); + +console.log( scale.toJSON() ); diff --git a/lib/node_modules/@stdlib/plot/vega/scale/base/ctor/lib/change_event.js b/lib/node_modules/@stdlib/plot/vega/scale/base/ctor/lib/change_event.js new file mode 100644 index 000000000000..55baae0c617a --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/scale/base/ctor/lib/change_event.js @@ -0,0 +1,41 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MAIN // + +/** +* Returns a new change event object. +* +* @private +* @param {string} property - property name +* @returns {Object} event object +*/ +function event( property ) { // eslint-disable-line stdlib/no-redeclare + return { + 'type': 'update', + 'source': 'scale', + 'property': property + }; +} + + +// EXPORTS // + +module.exports = event; diff --git a/lib/node_modules/@stdlib/plot/vega/scale/base/ctor/lib/defaults.js b/lib/node_modules/@stdlib/plot/vega/scale/base/ctor/lib/defaults.js new file mode 100644 index 000000000000..a101f8625ebd --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/scale/base/ctor/lib/defaults.js @@ -0,0 +1,49 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MAIN // + +/** +* Returns defaults. +* +* @private +* @returns {Object} default options +* +* @example +* var o = defaults(); +* // returns {...} +*/ +function defaults() { + return { + // Boolean indicating whether to reverse the order of the scale range: + 'reverse': false, + + // Boolean indicating whether to round numeric output values to integers: + 'round': false, + + // Scale type: + 'type': 'linear' + }; +} + + +// EXPORTS // + +module.exports = defaults; diff --git a/lib/node_modules/@stdlib/plot/vega/scale/base/ctor/lib/domain-max/get.js b/lib/node_modules/@stdlib/plot/vega/scale/base/ctor/lib/domain-max/get.js new file mode 100644 index 000000000000..e2fc272e3cca --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/scale/base/ctor/lib/domain-max/get.js @@ -0,0 +1,43 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable no-invalid-this */ + +'use strict'; + +// MODULES // + +var prop = require( './properties.js' ); + + +// MAIN // + +/** +* Returns an explicitly set maximum value in the scale domain. +* +* @private +* @returns {(void|number)} maximum value +*/ +function get() { + return this[ prop.private ]; +} + + +// EXPORTS // + +module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/vega/scale/base/ctor/lib/domain-max/properties.js b/lib/node_modules/@stdlib/plot/vega/scale/base/ctor/lib/domain-max/properties.js new file mode 100644 index 000000000000..2eaf47cb5d2a --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/scale/base/ctor/lib/domain-max/properties.js @@ -0,0 +1,33 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var property2object = require( '@stdlib/plot/vega/base/property2object' ); + + +// MAIN // + +var obj = property2object( 'domainMax' ); + + +// EXPORTS // + +module.exports = obj; diff --git a/lib/node_modules/@stdlib/plot/vega/scale/base/ctor/lib/domain-max/set.js b/lib/node_modules/@stdlib/plot/vega/scale/base/ctor/lib/domain-max/set.js new file mode 100644 index 000000000000..ab8675453d78 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/scale/base/ctor/lib/domain-max/set.js @@ -0,0 +1,66 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable no-invalid-this */ + +'use strict'; + +// MODULES // + +var logger = require( 'debug' ); +var isNumber = require( '@stdlib/assert/is-number' ).isPrimitive; +var isUndefined = require( '@stdlib/assert/is-undefined' ); +var format = require( '@stdlib/string/format' ); +var changeEvent = require( './../change_event.js' ); +var prop = require( './properties.js' ); + + +// VARIABLES // + +var debug = logger( 'vega:scale:set:'+prop.name ); + + +// MAIN // + +/** +* Sets an explicit maximum value in the scale domain. +* +* ## Notes +* +* - Providing `undefined` "unsets" the configured value. +* +* @private +* @param {(number|void)} value - input value +* @throws {TypeError} must be a number +* @returns {void} +*/ +function set( value ) { + if ( !isNumber( value ) && !isUndefined( value ) ) { + throw new TypeError( format( 'invalid assignment. `%s` must be a number. Value: `%s`.', prop.name, value ) ); + } + if ( value !== this[ prop.private ] ) { + debug( 'Current value: %s. New value: %s.', this[ prop.private ], value ); + this[ prop.private ] = value; + this.emit( 'change', changeEvent( prop.name ) ); + } +} + + +// EXPORTS // + +module.exports = set; diff --git a/lib/node_modules/@stdlib/plot/vega/scale/base/ctor/lib/domain-mid/get.js b/lib/node_modules/@stdlib/plot/vega/scale/base/ctor/lib/domain-mid/get.js new file mode 100644 index 000000000000..a786626a97c2 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/scale/base/ctor/lib/domain-mid/get.js @@ -0,0 +1,43 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable no-invalid-this */ + +'use strict'; + +// MODULES // + +var prop = require( './properties.js' ); + + +// MAIN // + +/** +* Returns an inserted mid-point value in a two-element scale domain. +* +* @private +* @returns {(void|number)} mid-point value +*/ +function get() { + return this[ prop.private ]; +} + + +// EXPORTS // + +module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/vega/scale/base/ctor/lib/domain-mid/properties.js b/lib/node_modules/@stdlib/plot/vega/scale/base/ctor/lib/domain-mid/properties.js new file mode 100644 index 000000000000..15f23d5ed1f0 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/scale/base/ctor/lib/domain-mid/properties.js @@ -0,0 +1,33 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var property2object = require( '@stdlib/plot/vega/base/property2object' ); + + +// MAIN // + +var obj = property2object( 'domainMid' ); + + +// EXPORTS // + +module.exports = obj; diff --git a/lib/node_modules/@stdlib/plot/vega/scale/base/ctor/lib/domain-mid/set.js b/lib/node_modules/@stdlib/plot/vega/scale/base/ctor/lib/domain-mid/set.js new file mode 100644 index 000000000000..b120a0832ffc --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/scale/base/ctor/lib/domain-mid/set.js @@ -0,0 +1,66 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable no-invalid-this */ + +'use strict'; + +// MODULES // + +var logger = require( 'debug' ); +var isNumber = require( '@stdlib/assert/is-number' ).isPrimitive; +var isUndefined = require( '@stdlib/assert/is-undefined' ); +var format = require( '@stdlib/string/format' ); +var changeEvent = require( './../change_event.js' ); +var prop = require( './properties.js' ); + + +// VARIABLES // + +var debug = logger( 'vega:scale:set:'+prop.name ); + + +// MAIN // + +/** +* Sets a mid-point value in a two-element scale domain. +* +* ## Notes +* +* - Providing `undefined` "unsets" the configured value. +* +* @private +* @param {(number|void)} value - input value +* @throws {TypeError} must be a number +* @returns {void} +*/ +function set( value ) { + if ( !isNumber( value ) && !isUndefined( value ) ) { + throw new TypeError( format( 'invalid assignment. `%s` must be a number. Value: `%s`.', prop.name, value ) ); + } + if ( value !== this[ prop.private ] ) { + debug( 'Current value: %s. New value: %s.', this[ prop.private ], value ); + this[ prop.private ] = value; + this.emit( 'change', changeEvent( prop.name ) ); + } +} + + +// EXPORTS // + +module.exports = set; diff --git a/lib/node_modules/@stdlib/plot/vega/scale/base/ctor/lib/domain-min/get.js b/lib/node_modules/@stdlib/plot/vega/scale/base/ctor/lib/domain-min/get.js new file mode 100644 index 000000000000..d21c82144b66 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/scale/base/ctor/lib/domain-min/get.js @@ -0,0 +1,43 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable no-invalid-this */ + +'use strict'; + +// MODULES // + +var prop = require( './properties.js' ); + + +// MAIN // + +/** +* Returns an explicitly set minimum value in the scale domain. +* +* @private +* @returns {(void|number)} minimum value +*/ +function get() { + return this[ prop.private ]; +} + + +// EXPORTS // + +module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/vega/scale/base/ctor/lib/domain-min/properties.js b/lib/node_modules/@stdlib/plot/vega/scale/base/ctor/lib/domain-min/properties.js new file mode 100644 index 000000000000..6941cd34becb --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/scale/base/ctor/lib/domain-min/properties.js @@ -0,0 +1,33 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var property2object = require( '@stdlib/plot/vega/base/property2object' ); + + +// MAIN // + +var obj = property2object( 'domainMin' ); + + +// EXPORTS // + +module.exports = obj; diff --git a/lib/node_modules/@stdlib/plot/vega/scale/base/ctor/lib/domain-min/set.js b/lib/node_modules/@stdlib/plot/vega/scale/base/ctor/lib/domain-min/set.js new file mode 100644 index 000000000000..bb4eb89c507d --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/scale/base/ctor/lib/domain-min/set.js @@ -0,0 +1,66 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable no-invalid-this */ + +'use strict'; + +// MODULES // + +var logger = require( 'debug' ); +var isNumber = require( '@stdlib/assert/is-number' ).isPrimitive; +var isUndefined = require( '@stdlib/assert/is-undefined' ); +var format = require( '@stdlib/string/format' ); +var changeEvent = require( './../change_event.js' ); +var prop = require( './properties.js' ); + + +// VARIABLES // + +var debug = logger( 'vega:scale:set:'+prop.name ); + + +// MAIN // + +/** +* Sets an explicit minimum value in the scale domain. +* +* ## Notes +* +* - Providing `undefined` "unsets" the configured value. +* +* @private +* @param {(number|void)} value - input value +* @throws {TypeError} must be a number +* @returns {void} +*/ +function set( value ) { + if ( !isNumber( value ) && !isUndefined( value ) ) { + throw new TypeError( format( 'invalid assignment. `%s` must be a number. Value: `%s`.', prop.name, value ) ); + } + if ( value !== this[ prop.private ] ) { + debug( 'Current value: %s. New value: %s.', this[ prop.private ], value ); + this[ prop.private ] = value; + this.emit( 'change', changeEvent( prop.name ) ); + } +} + + +// EXPORTS // + +module.exports = set; diff --git a/lib/node_modules/@stdlib/plot/vega/scale/base/ctor/lib/domain-raw/get.js b/lib/node_modules/@stdlib/plot/vega/scale/base/ctor/lib/domain-raw/get.js new file mode 100644 index 000000000000..a6282c3e3237 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/scale/base/ctor/lib/domain-raw/get.js @@ -0,0 +1,44 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable no-invalid-this */ + +'use strict'; + +// MODULES // + +var copy = require( '@stdlib/utils/copy' ); +var prop = require( './properties.js' ); + + +// MAIN // + +/** +* Returns a set of raw domain values. +* +* @private +* @returns {(Array|void)} raw domain +*/ +function get() { + return copy( this[ prop.private ] ); // FIXME: can we avoid using `utils/copy` here? +} + + +// EXPORTS // + +module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/vega/scale/base/ctor/lib/domain-raw/properties.js b/lib/node_modules/@stdlib/plot/vega/scale/base/ctor/lib/domain-raw/properties.js new file mode 100644 index 000000000000..ec2ae175d478 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/scale/base/ctor/lib/domain-raw/properties.js @@ -0,0 +1,33 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var property2object = require( '@stdlib/plot/vega/base/property2object' ); + + +// MAIN // + +var obj = property2object( 'domainRaw' ); + + +// EXPORTS // + +module.exports = obj; diff --git a/lib/node_modules/@stdlib/plot/vega/scale/base/ctor/lib/domain-raw/set.js b/lib/node_modules/@stdlib/plot/vega/scale/base/ctor/lib/domain-raw/set.js new file mode 100644 index 000000000000..c516b717c794 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/scale/base/ctor/lib/domain-raw/set.js @@ -0,0 +1,69 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable no-invalid-this */ + +'use strict'; + +// MODULES // + +var logger = require( 'debug' ); +var isCollection = require( '@stdlib/assert/is-collection' ); +var isUndefined = require( '@stdlib/assert/is-undefined' ); +var copy = require( '@stdlib/utils/copy' ); +var format = require( '@stdlib/string/format' ); +var changeEvent = require( './../change_event.js' ); +var prop = require( './properties.js' ); + + +// VARIABLES // + +var debug = logger( 'vega:scale:set:'+prop.name ); + + +// MAIN // + +/** +* Sets raw domain values. +* +* ## Notes +* +* - Providing `undefined` "unsets" the configured value. +* +* @private +* @param {(Collection|void)} value - input value +* @throws {TypeError} must be an array-like object +* @returns {void} +*/ +function set( value ) { + if ( !isCollection( value ) && !isUndefined( value ) ) { + throw new TypeError( format( 'invalid assignment. `%s` must be an array-like object. Value: `%s`.', prop.name, value ) ); + } + + // FIXME: should we perform a deep equal check here in order to avoid a potential false positive change event? + + value = copy( value ); + debug( 'Current value: %s. New value: %s.', JSON.stringify( this[ prop.private ] ), JSON.stringify( value ) ); + this[ prop.private ] = value; + this.emit( 'change', changeEvent( prop.name ) ); +} + + +// EXPORTS // + +module.exports = set; diff --git a/lib/node_modules/@stdlib/plot/vega/scale/base/ctor/lib/domain/get.js b/lib/node_modules/@stdlib/plot/vega/scale/base/ctor/lib/domain/get.js new file mode 100644 index 000000000000..f2d02ee4166d --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/scale/base/ctor/lib/domain/get.js @@ -0,0 +1,44 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable no-invalid-this */ + +'use strict'; + +// MODULES // + +var copy = require( '@stdlib/utils/copy' ); +var prop = require( './properties.js' ); + + +// MAIN // + +/** +* Returns the scale domain. +* +* @private +* @returns {(Array|Object|Signal|void)} scale domain +*/ +function get() { + return copy( this[ prop.private ] ); // FIXME: can we avoid using `utils/copy` here? +} + + +// EXPORTS // + +module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/vega/scale/base/ctor/lib/domain/properties.js b/lib/node_modules/@stdlib/plot/vega/scale/base/ctor/lib/domain/properties.js new file mode 100644 index 000000000000..fe79c7fb79f6 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/scale/base/ctor/lib/domain/properties.js @@ -0,0 +1,33 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var property2object = require( '@stdlib/plot/vega/base/property2object' ); + + +// MAIN // + +var obj = property2object( 'domain' ); + + +// EXPORTS // + +module.exports = obj; diff --git a/lib/node_modules/@stdlib/plot/vega/scale/base/ctor/lib/domain/set.js b/lib/node_modules/@stdlib/plot/vega/scale/base/ctor/lib/domain/set.js new file mode 100644 index 000000000000..62e777799405 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/scale/base/ctor/lib/domain/set.js @@ -0,0 +1,78 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable no-invalid-this */ + +'use strict'; + +// MODULES // + +var logger = require( 'debug' ); +var isCollection = require( '@stdlib/assert/is-collection' ); +var isUndefined = require( '@stdlib/assert/is-undefined' ); +var isObject = require( '@stdlib/assert/is-object' ); +var copyArray = require( '@stdlib/array/base/copy' ); +var copy = require( '@stdlib/utils/copy' ); +var format = require( '@stdlib/string/format' ); +var changeEvent = require( './../change_event.js' ); +var prop = require( './properties.js' ); + + +// VARIABLES // + +var debug = logger( 'vega:scale:set:'+prop.name ); + + +// MAIN // + +/** +* Sets the scale domain. +* +* ## Notes +* +* - Providing `undefined` "unsets" the configured value. +* +* @private +* @param {(Collection|Object|Signal|void)} value - input value +* @throws {TypeError} must be either an array-like object, an object, or a signal instance +* @returns {void} +*/ +function set( value ) { + var isArr = isCollection( value ); + if ( !isArr && !isObject( value ) && !isUndefined( value ) ) { + throw new TypeError( format( 'invalid assignment. `%s` must be either an array-like object, an object, or a signal instance. Value: `%s`.', prop.name, value ) ); + } + + // FIXME: should we perform a deep equal check here in order to avoid a potential false positive change event? + + // FIXME: can we do further validation of objects (e.g., data reference or signal reference)? + + if ( isArr ) { + value = copyArray( value ); + } else { + value = copy( value ); + } + debug( 'Current value: %s. New value: %s.', JSON.stringify( this[ prop.private ] ), JSON.stringify( value ) ); + this[ prop.private ] = value; + this.emit( 'change', changeEvent( prop.name ) ); +} + + +// EXPORTS // + +module.exports = set; diff --git a/lib/node_modules/@stdlib/plot/vega/scale/base/ctor/lib/index.js b/lib/node_modules/@stdlib/plot/vega/scale/base/ctor/lib/index.js new file mode 100644 index 000000000000..0a99da61fd2e --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/scale/base/ctor/lib/index.js @@ -0,0 +1,42 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +/** +* Scale constructor. +* +* @module @stdlib/plot/vega/scale/base/ctor +* +* @example +* var Scale = require( '@stdlib/plot/vega/scale/base/ctor' ); +* +* var scale = new Scale({ +* 'name': 'xScale' +* }); +* // returns <Scale> +*/ + +// MODULES // + +var main = require( './main.js' ); + + +// EXPORTS // + +module.exports = main; diff --git a/lib/node_modules/@stdlib/plot/vega/scale/base/ctor/lib/interpolate/get.js b/lib/node_modules/@stdlib/plot/vega/scale/base/ctor/lib/interpolate/get.js new file mode 100644 index 000000000000..0c9bc04aefd8 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/scale/base/ctor/lib/interpolate/get.js @@ -0,0 +1,44 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable no-invalid-this */ + +'use strict'; + +// MODULES // + +var copy = require( '@stdlib/utils/copy' ); +var prop = require( './properties.js' ); + + +// MAIN // + +/** +* Returns the scale range interpolation method. +* +* @private +* @returns {(string|Object|void)} interpolation method +*/ +function get() { + return copy( this[ prop.private ] ); +} + + +// EXPORTS // + +module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/vega/scale/base/ctor/lib/interpolate/properties.js b/lib/node_modules/@stdlib/plot/vega/scale/base/ctor/lib/interpolate/properties.js new file mode 100644 index 000000000000..5322639eb55f --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/scale/base/ctor/lib/interpolate/properties.js @@ -0,0 +1,33 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var property2object = require( '@stdlib/plot/vega/base/property2object' ); + + +// MAIN // + +var obj = property2object( 'interpolate' ); + + +// EXPORTS // + +module.exports = obj; diff --git a/lib/node_modules/@stdlib/plot/vega/scale/base/ctor/lib/interpolate/set.js b/lib/node_modules/@stdlib/plot/vega/scale/base/ctor/lib/interpolate/set.js new file mode 100644 index 000000000000..976ce212835a --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/scale/base/ctor/lib/interpolate/set.js @@ -0,0 +1,71 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable no-invalid-this */ + +'use strict'; + +// MODULES // + +var logger = require( 'debug' ); +var isInterpolationMethod = require( '@stdlib/plot/vega/base/assert/is-scale-range-interpolation-method' ); +var isObject = require( '@stdlib/assert/is-object' ); +var isUndefined = require( '@stdlib/assert/is-undefined' ); +var copy = require( '@stdlib/utils/copy' ); +var format = require( '@stdlib/string/format' ); +var changeEvent = require( './../change_event.js' ); +var prop = require( './properties.js' ); + + +// VARIABLES // + +var debug = logger( 'vega:scale:set:'+prop.name ); + + +// MAIN // + +/** +* Sets the scale range interpolation method. +* +* ## Notes +* +* - Providing `undefined` "unsets" the configured value. +* +* @private +* @param {(string|Object|void)} value - input value +* @throws {TypeError} must be a valid interpolation method +* @returns {void} +*/ +function set( value ) { + var flg = isInterpolationMethod( value ); + if ( !flg && !isObject( value ) && !isUndefined( value ) ) { + throw new TypeError( format( 'invalid assignment. `%s` must be either an object or a valid interpolation method. Value: `%s`.', prop.name, value ) ); + } + value = copy( value ); + + // FIXME: should we perform a deep equal comparison to avoid triggering a false positive change event? + + debug( 'Current value: %s. New value: %s.', this[ prop.private ], value ); + this[ prop.private ] = value; + this.emit( 'change', changeEvent( prop.name ) ); +} + + +// EXPORTS // + +module.exports = set; diff --git a/lib/node_modules/@stdlib/plot/vega/scale/base/ctor/lib/main.js b/lib/node_modules/@stdlib/plot/vega/scale/base/ctor/lib/main.js new file mode 100644 index 000000000000..5895dc4435dd --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/scale/base/ctor/lib/main.js @@ -0,0 +1,409 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable no-restricted-syntax, no-invalid-this */ + +'use strict'; + +// MODULES // + +var EventEmitter = require( 'events' ).EventEmitter; +var logger = require( 'debug' ); +var isObject = require( '@stdlib/assert/is-object' ); +var setNonEnumerableReadOnly = require( '@stdlib/utils/define-nonenumerable-read-only-property' ); +var setNonEnumerableReadOnlyAccessor = require( '@stdlib/utils/define-nonenumerable-read-only-accessor' ); // eslint-disable-line id-length +var setReadWriteAccessor = require( '@stdlib/utils/define-read-write-accessor' ); +var hasProp = require( '@stdlib/assert/has-property' ); +var inherit = require( '@stdlib/utils/inherit' ); +var objectKeys = require( '@stdlib/utils/keys' ); +var transformErrorMessage = require( '@stdlib/plot/vega/base/transform-validation-message' ); +var instance2json = require( '@stdlib/plot/vega/base/to-json' ); +var format = require( '@stdlib/string/format' ); +var properties = require( './properties.json' ); +var defaults = require( './defaults.js' ); + +// Note: keep the following in alphabetical order according to the `require` path... +var getDomain = require( './domain/get.js' ); +var setDomain = require( './domain/set.js' ); +var getDomainMax = require( './domain-max/get.js' ); +var setDomainMax = require( './domain-max/set.js' ); +var getDomainMid = require( './domain-mid/get.js' ); +var setDomainMid = require( './domain-mid/set.js' ); +var getDomainMin = require( './domain-min/get.js' ); +var setDomainMin = require( './domain-min/set.js' ); +var getDomainRaw = require( './domain-raw/get.js' ); +var setDomainRaw = require( './domain-raw/set.js' ); + +var getInterpolate = require( './interpolate/get.js' ); +var setInterpolate = require( './interpolate/set.js' ); + +var getName = require( './name/get.js' ); +var setName = require( './name/set.js' ); + +var getProperties = require( './properties/get.js' ); + +var getRange = require( './range/get.js' ); +var setRange = require( './range/set.js' ); +var getReverse = require( './reverse/get.js' ); +var setReverse = require( './reverse/set.js' ); +var getRound = require( './round/get.js' ); +var setRound = require( './round/set.js' ); + +var getType = require( './type/get.js' ); +var setType = require( './type/set.js' ); + + +// VARIABLES // + +var debug = logger( 'vega:scale:main' ); + + +// MAIN // + +/** +* Scale constructor. +* +* @constructor +* @param {Options} options - constructor options +* @param {string} options.name - scale name +* @param {(Collection|Object|Signal)} [options.domain] - domain of associated data values +* @param {number} [options.domainMax] - maximum value in the scale domain (overrides the `domain` option) +* @param {number} [options.domainMin] - minimum value in the scale domain (overrides the `domain` option) +* @param {number} [options.domainMid] - single mid-point value inserted into a two-element domain +* @param {Collection} [options.domainRaw] - array of raw domain values which overrides the `domain` property +* @param {(string|Object)} [options.interpolate] - scale range interpolation method +* @param {(Collection|Object|Signal|string)} [options.range] - scale range +* @param {boolean} [options.reverse=false] - boolean indicating whether to reverse the order of the scale range +* @param {boolean} [options.round=false] - boolean indicating whether to round numeric output values to integers +* @param {string} [options.type='linear'] - scale type +* @throws {TypeError} options argument must be an object +* @throws {Error} must provide valid options +* @returns {Scale} scale instance +* +* @example +* var scale = new Scale({ +* 'name': 'xScale' +* }); +* // returns <Scale> +*/ +function Scale( options ) { + var opts; + var keys; + var v; + var k; + var i; + if ( !( this instanceof Scale ) ) { + return new Scale( options ); + } + EventEmitter.call( this ); + if ( !isObject( options ) ) { + throw new TypeError( format( 'invalid argument. Options argument must be an object. Value: `%s`.', options ) ); + } + // Resolve the default configuration: + opts = defaults(); + + // Set internal properties according to the default configuration... + keys = objectKeys( opts ); + for ( i = 0; i < keys.length; i++ ) { + k = keys[ i ]; + this[ '_'+k ] = opts[ k ]; + } + // Check for required properties... + if ( !hasProp( options, 'name' ) ) { + throw new TypeError( 'invalid argument. Options argument must specify the scale name.' ); + } + // Validate provided options by attempting to assign option values to corresponding fields... + for ( i = 0; i < properties.length; i++ ) { + k = properties[ i ]; + if ( !hasProp( options, k ) ) { + continue; + } + v = options[ k ]; + try { + this[ k ] = v; + } catch ( err ) { + debug( 'Encountered an error. Error: %s', err.message ); + + // FIXME: retain thrown error type + throw new Error( transformErrorMessage( err.message ) ); + } + } + return this; +} + +/* +* Inherit from the `EventEmitter` prototype. +*/ +inherit( Scale, EventEmitter ); + +/** +* Constructor name. +* +* @private +* @name name +* @memberof Scale +* @readonly +* @type {string} +*/ +setNonEnumerableReadOnly( Scale, 'name', 'Scale' ); + +/** +* Scale domain. +* +* @name domain +* @memberof Scale.prototype +* @type {(Array|Object|Signal|void)} +* +* @example +* var scale = new Scale({ +* 'name': 'xScale', +* 'domain': [ 0, 100 ] +* }); +* +* var v = scale.domain; +* // returns [ 0, 100 ] +*/ +setReadWriteAccessor( Scale.prototype, 'domain', getDomain, setDomain ); + +/** +* Explicit scale domain maximum value. +* +* @name domainMax +* @memberof Scale.prototype +* @type {(number|void)} +* +* @example +* var scale = new Scale({ +* 'name': 'xScale', +* 'domainMax': 100 +* }); +* +* var v = scale.domainMax; +* // returns 100 +*/ +setReadWriteAccessor( Scale.prototype, 'domainMax', getDomainMax, setDomainMax ); + +/** +* Mid-point inserted into a two-element scale domain. +* +* @name domainMid +* @memberof Scale.prototype +* @type {(number|void)} +* +* @example +* var scale = new Scale({ +* 'name': 'xScale', +* 'domainMid': 50 +* }); +* +* var v = scale.domainMid; +* // returns 50 +*/ +setReadWriteAccessor( Scale.prototype, 'domainMid', getDomainMid, setDomainMid ); + +/** +* Explicit scale domain minimum value. +* +* @name domainMin +* @memberof Scale.prototype +* @type {(number|void)} +* +* @example +* var scale = new Scale({ +* 'name': 'xScale', +* 'domainMin': 0 +* }); +* +* var v = scale.domainMin; +* // returns 0 +*/ +setReadWriteAccessor( Scale.prototype, 'domainMin', getDomainMin, setDomainMin ); + +/** +* Raw scale domain values. +* +* @name domainRaw +* @memberof Scale.prototype +* @type {(Array|void)} +* +* @example +* var scale = new Scale({ +* 'name': 'xScale', +* 'domainRaw': [ 0, 1, 2, 3, 4, 5 ] +* }); +* +* var v = scale.domainRaw; +* // returns [ 0, 1, 2, 3, 4, 5 ] +*/ +setReadWriteAccessor( Scale.prototype, 'domainRaw', getDomainRaw, setDomainRaw ); + +/** +* Scale range interpolation method. +* +* @name interpolate +* @memberof Scale.prototype +* @type {(string|Object|void)} +* +* @example +* var scale = new Scale({ +* 'name': 'xScale', +* 'interpolate': 'rgb' +* }); +* +* var v = scale.interpolate; +* // returns 'rgb' +*/ +setReadWriteAccessor( Scale.prototype, 'interpolate', getInterpolate, setInterpolate ); + +/** +* Scale name. +* +* @name name +* @memberof Scale.prototype +* @type {string} +* +* @example +* var scale = new Scale({ +* 'name': 'xScale' +* }); +* +* var v = scale.name; +* // returns 'xScale' +*/ +setReadWriteAccessor( Scale.prototype, 'name', getName, setName ); + +/** +* Scale properties. +* +* @name properties +* @memberof Scale.prototype +* @type {Array<string>} +* +* @example +* var scale = new Scale({ +* 'name': 'xScale' +* }); +* +* var v = scale.properties; +* // returns [...] +*/ +setNonEnumerableReadOnlyAccessor( Scale.prototype, 'properties', getProperties ); + +/** +* Scale range. +* +* @name range +* @memberof Scale.prototype +* @type {(Array|Object|Signal|string|void)} +* +* @example +* var scale = new Scale({ +* 'name': 'xScale', +* 'range': [ 0, 100 ] +* }); +* +* var v = scale.range; +* // returns [ 0, 100 ] +*/ +setReadWriteAccessor( Scale.prototype, 'range', getRange, setRange ); + +/** +* Boolean indicating whether to reverse the order of the scale range. +* +* @name reverse +* @memberof Scale.prototype +* @type {boolean} +* @default false +* +* @example +* var scale = new Scale({ +* 'name': 'xScale', +* 'reverse': true +* }); +* +* var v = scale.reverse; +* // returns true +*/ +setReadWriteAccessor( Scale.prototype, 'reverse', getReverse, setReverse ); + +/** +* Boolean indicating whether to round numeric output value to integers. +* +* @name round +* @memberof Scale.prototype +* @type {boolean} +* @default false +* +* @example +* var scale = new Scale({ +* 'name': 'xScale', +* 'round': true +* }); +* +* var v = scale.round; +* // returns true +*/ +setReadWriteAccessor( Scale.prototype, 'round', getRound, setRound ); + +/** +* Scale type. +* +* @name type +* @memberof Scale.prototype +* @type {string} +* @default 'linear' +* +* @example +* var scale = new Scale({ +* 'name': 'xScale', +* 'type': 'log' +* }); +* +* var v = scale.type; +* // returns 'log' +*/ +setReadWriteAccessor( Scale.prototype, 'type', getType, setType ); + +/** +* Serializes an instance to a JSON object. +* +* ## Notes +* +* - This method is implicitly invoked by `JSON.stringify`. +* +* @name toJSON +* @memberof Scale.prototype +* @type {Function} +* @returns {Object} JSON object +* +* @example +* var scale = new Scale({ +* 'name': 'xScale' +* }); +* +* var v = scale.toJSON(); +* // returns {...} +*/ +setNonEnumerableReadOnly( Scale.prototype, 'toJSON', function toJSON() { + return instance2json( this, properties ); +}); + + +// EXPORTS // + +module.exports = Scale; diff --git a/lib/node_modules/@stdlib/plot/vega/scale/base/ctor/lib/name/get.js b/lib/node_modules/@stdlib/plot/vega/scale/base/ctor/lib/name/get.js new file mode 100644 index 000000000000..edc3ba73cbb4 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/scale/base/ctor/lib/name/get.js @@ -0,0 +1,43 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable no-invalid-this */ + +'use strict'; + +// MODULES // + +var prop = require( './properties.js' ); + + +// MAIN // + +/** +* Returns the scale name. +* +* @private +* @returns {string} scale name +*/ +function get() { + return this[ prop.private ]; +} + + +// EXPORTS // + +module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/vega/scale/base/ctor/lib/name/properties.js b/lib/node_modules/@stdlib/plot/vega/scale/base/ctor/lib/name/properties.js new file mode 100644 index 000000000000..729209deffa2 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/scale/base/ctor/lib/name/properties.js @@ -0,0 +1,33 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var property2object = require( '@stdlib/plot/vega/base/property2object' ); + + +// MAIN // + +var obj = property2object( 'name' ); + + +// EXPORTS // + +module.exports = obj; diff --git a/lib/node_modules/@stdlib/plot/vega/scale/base/ctor/lib/name/set.js b/lib/node_modules/@stdlib/plot/vega/scale/base/ctor/lib/name/set.js new file mode 100644 index 000000000000..d9b05b09f214 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/scale/base/ctor/lib/name/set.js @@ -0,0 +1,61 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable no-invalid-this */ + +'use strict'; + +// MODULES // + +var logger = require( 'debug' ); +var isString = require( '@stdlib/assert/is-string' ).isPrimitive; +var format = require( '@stdlib/string/format' ); +var changeEvent = require( './../change_event.js' ); +var prop = require( './properties.js' ); + + +// VARIABLES // + +var debug = logger( 'vega:scale:set:'+prop.name ); + + +// MAIN // + +/** +* Sets the scale name. +* +* @private +* @param {string} value - input value +* @throws {TypeError} must be a string +* @returns {void} +*/ +function set( value ) { + if ( !isString( value ) ) { + throw new TypeError( format( 'invalid assignment. `%s` must be a string. Value: `%s`.', prop.name, value ) ); + } + if ( value !== this[ prop.private ] ) { + debug( 'Current value: %s. New value: %s.', this[ prop.private ], value ); + this[ prop.private ] = value; + this.emit( 'change', changeEvent( prop.name ) ); + } +} + + +// EXPORTS // + +module.exports = set; diff --git a/lib/node_modules/@stdlib/plot/vega/scale/base/ctor/lib/properties.json b/lib/node_modules/@stdlib/plot/vega/scale/base/ctor/lib/properties.json new file mode 100644 index 000000000000..9bea25e4e1b6 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/scale/base/ctor/lib/properties.json @@ -0,0 +1,13 @@ +[ + "domain", + "domainMax", + "domainMin", + "domainMid", + "domainRaw", + "interpolate", + "name", + "range", + "reverse", + "round", + "type" +] diff --git a/lib/node_modules/@stdlib/plot/vega/scale/base/ctor/lib/properties/get.js b/lib/node_modules/@stdlib/plot/vega/scale/base/ctor/lib/properties/get.js new file mode 100644 index 000000000000..8fc57de14e90 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/scale/base/ctor/lib/properties/get.js @@ -0,0 +1,41 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var properties = require( './../properties.json' ); + + +// MAIN // + +/** +* Returns the list of enumerable properties. +* +* @private +* @returns {Array<string>} properties +*/ +function get() { + return properties.slice(); +} + + +// EXPORTS // + +module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/vega/scale/base/ctor/lib/range/get.js b/lib/node_modules/@stdlib/plot/vega/scale/base/ctor/lib/range/get.js new file mode 100644 index 000000000000..a513085a0a87 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/scale/base/ctor/lib/range/get.js @@ -0,0 +1,44 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable no-invalid-this */ + +'use strict'; + +// MODULES // + +var copy = require( '@stdlib/utils/copy' ); +var prop = require( './properties.js' ); + + +// MAIN // + +/** +* Returns the scale range. +* +* @private +* @returns {(Array|Object|Signal|string|void)} scale range +*/ +function get() { + return copy( this[ prop.private ] ); // FIXME: can we avoid using `utils/copy` here? +} + + +// EXPORTS // + +module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/vega/scale/base/ctor/lib/range/properties.js b/lib/node_modules/@stdlib/plot/vega/scale/base/ctor/lib/range/properties.js new file mode 100644 index 000000000000..b656b2eecd5f --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/scale/base/ctor/lib/range/properties.js @@ -0,0 +1,33 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var property2object = require( '@stdlib/plot/vega/base/property2object' ); + + +// MAIN // + +var obj = property2object( 'range' ); + + +// EXPORTS // + +module.exports = obj; diff --git a/lib/node_modules/@stdlib/plot/vega/scale/base/ctor/lib/range/set.js b/lib/node_modules/@stdlib/plot/vega/scale/base/ctor/lib/range/set.js new file mode 100644 index 000000000000..35f208558a66 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/scale/base/ctor/lib/range/set.js @@ -0,0 +1,79 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable no-invalid-this */ + +'use strict'; + +// MODULES // + +var logger = require( 'debug' ); +var isCollection = require( '@stdlib/assert/is-collection' ); +var isUndefined = require( '@stdlib/assert/is-undefined' ); +var isString = require( '@stdlib/assert/is-string' ).isPrimitive; +var isObject = require( '@stdlib/assert/is-object' ); +var copyArray = require( '@stdlib/array/base/copy' ); +var copy = require( '@stdlib/utils/copy' ); +var format = require( '@stdlib/string/format' ); +var changeEvent = require( './../change_event.js' ); +var prop = require( './properties.js' ); + + +// VARIABLES // + +var debug = logger( 'vega:scale:set:'+prop.name ); + + +// MAIN // + +/** +* Sets the scale range. +* +* ## Notes +* +* - Providing `undefined` "unsets" the configured value. +* +* @private +* @param {(Collection|Object|Signal|string|void)} value - input value +* @throws {TypeError} must be either an array-like object, an object, a signal, or a string +* @returns {void} +*/ +function set( value ) { + var isArr = isCollection( value ); + if ( !isArr && !isObject( value ) && !isString( value ) && !isUndefined( value ) ) { + throw new TypeError( format( 'invalid assignment. `%s` must be either an array-like object, an object, a signal, or a string. Value: `%s`.', prop.name, value ) ); + } + + // FIXME: should we perform a deep equal check here in order to avoid a potential false positive change event? + + // FIXME: can we do further validation of objects (e.g., data reference or signal reference)? + + if ( isArr ) { + value = copyArray( value ); + } else { + value = copy( value ); + } + debug( 'Current value: %s. New value: %s.', JSON.stringify( this[ prop.private ] ), JSON.stringify( value ) ); + this[ prop.private ] = value; + this.emit( 'change', changeEvent( prop.name ) ); +} + + +// EXPORTS // + +module.exports = set; diff --git a/lib/node_modules/@stdlib/plot/vega/scale/base/ctor/lib/reverse/get.js b/lib/node_modules/@stdlib/plot/vega/scale/base/ctor/lib/reverse/get.js new file mode 100644 index 000000000000..6ce1253551a4 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/scale/base/ctor/lib/reverse/get.js @@ -0,0 +1,43 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable no-invalid-this */ + +'use strict'; + +// MODULES // + +var prop = require( './properties.js' ); + + +// MAIN // + +/** +* Returns a boolean indicating whether to reverse the order of the scale range. +* +* @private +* @returns {boolean} boolean flag +*/ +function get() { + return this[ prop.private ]; +} + + +// EXPORTS // + +module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/vega/scale/base/ctor/lib/reverse/properties.js b/lib/node_modules/@stdlib/plot/vega/scale/base/ctor/lib/reverse/properties.js new file mode 100644 index 000000000000..7ce318ac3879 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/scale/base/ctor/lib/reverse/properties.js @@ -0,0 +1,33 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var property2object = require( '@stdlib/plot/vega/base/property2object' ); + + +// MAIN // + +var obj = property2object( 'reverse' ); + + +// EXPORTS // + +module.exports = obj; diff --git a/lib/node_modules/@stdlib/plot/vega/scale/base/ctor/lib/reverse/set.js b/lib/node_modules/@stdlib/plot/vega/scale/base/ctor/lib/reverse/set.js new file mode 100644 index 000000000000..f3474a2403df --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/scale/base/ctor/lib/reverse/set.js @@ -0,0 +1,61 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable no-invalid-this */ + +'use strict'; + +// MODULES // + +var logger = require( 'debug' ); +var isBoolean = require( '@stdlib/assert/is-boolean' ).isPrimitive; +var format = require( '@stdlib/string/format' ); +var changeEvent = require( './../change_event.js' ); +var prop = require( './properties.js' ); + + +// VARIABLES // + +var debug = logger( 'vega:scale:set:'+prop.name ); + + +// MAIN // + +/** +* Sets a boolean flag indicating whether to reverse the order of the scale range. +* +* @private +* @param {boolean} value - input value +* @throws {TypeError} must be a boolean +* @returns {void} +*/ +function set( value ) { + if ( !isBoolean( value ) ) { + throw new TypeError( format( 'invalid assignment. `%s` must be a boolean. Value: `%s`.', prop.name, value ) ); + } + if ( value !== this[ prop.private ] ) { + debug( 'Current value: %s. New value: %s.', this[ prop.private ], value ); + this[ prop.private ] = value; + this.emit( 'change', changeEvent( prop.name ) ); + } +} + + +// EXPORTS // + +module.exports = set; diff --git a/lib/node_modules/@stdlib/plot/vega/scale/base/ctor/lib/round/get.js b/lib/node_modules/@stdlib/plot/vega/scale/base/ctor/lib/round/get.js new file mode 100644 index 000000000000..077c23a8f2cc --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/scale/base/ctor/lib/round/get.js @@ -0,0 +1,43 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable no-invalid-this */ + +'use strict'; + +// MODULES // + +var prop = require( './properties.js' ); + + +// MAIN // + +/** +* Returns a boolean indicating whether to round numeric output values to integers. +* +* @private +* @returns {boolean} boolean flag +*/ +function get() { + return this[ prop.private ]; +} + + +// EXPORTS // + +module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/vega/scale/base/ctor/lib/round/properties.js b/lib/node_modules/@stdlib/plot/vega/scale/base/ctor/lib/round/properties.js new file mode 100644 index 000000000000..2ec3f60c9812 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/scale/base/ctor/lib/round/properties.js @@ -0,0 +1,33 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var property2object = require( '@stdlib/plot/vega/base/property2object' ); + + +// MAIN // + +var obj = property2object( 'round' ); + + +// EXPORTS // + +module.exports = obj; diff --git a/lib/node_modules/@stdlib/plot/vega/scale/base/ctor/lib/round/set.js b/lib/node_modules/@stdlib/plot/vega/scale/base/ctor/lib/round/set.js new file mode 100644 index 000000000000..fb5036a7cc23 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/scale/base/ctor/lib/round/set.js @@ -0,0 +1,61 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable no-invalid-this */ + +'use strict'; + +// MODULES // + +var logger = require( 'debug' ); +var isBoolean = require( '@stdlib/assert/is-boolean' ).isPrimitive; +var format = require( '@stdlib/string/format' ); +var changeEvent = require( './../change_event.js' ); +var prop = require( './properties.js' ); + + +// VARIABLES // + +var debug = logger( 'vega:scale:set:'+prop.name ); + + +// MAIN // + +/** +* Sets a boolean flag indicating whether to round numeric output values to integers. +* +* @private +* @param {boolean} value - input value +* @throws {TypeError} must be a boolean +* @returns {void} +*/ +function set( value ) { + if ( !isBoolean( value ) ) { + throw new TypeError( format( 'invalid assignment. `%s` must be a boolean. Value: `%s`.', prop.name, value ) ); + } + if ( value !== this[ prop.private ] ) { + debug( 'Current value: %s. New value: %s.', this[ prop.private ], value ); + this[ prop.private ] = value; + this.emit( 'change', changeEvent( prop.name ) ); + } +} + + +// EXPORTS // + +module.exports = set; diff --git a/lib/node_modules/@stdlib/plot/vega/scale/base/ctor/lib/type/get.js b/lib/node_modules/@stdlib/plot/vega/scale/base/ctor/lib/type/get.js new file mode 100644 index 000000000000..ae7ac7957738 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/scale/base/ctor/lib/type/get.js @@ -0,0 +1,43 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable no-invalid-this */ + +'use strict'; + +// MODULES // + +var prop = require( './properties.js' ); + + +// MAIN // + +/** +* Returns the scale type. +* +* @private +* @returns {string} scale type +*/ +function get() { + return this[ prop.private ]; +} + + +// EXPORTS // + +module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/vega/scale/base/ctor/lib/type/properties.js b/lib/node_modules/@stdlib/plot/vega/scale/base/ctor/lib/type/properties.js new file mode 100644 index 000000000000..d4cf0dee043b --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/scale/base/ctor/lib/type/properties.js @@ -0,0 +1,33 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var property2object = require( '@stdlib/plot/vega/base/property2object' ); + + +// MAIN // + +var obj = property2object( 'type' ); + + +// EXPORTS // + +module.exports = obj; diff --git a/lib/node_modules/@stdlib/plot/vega/scale/base/ctor/lib/type/set.js b/lib/node_modules/@stdlib/plot/vega/scale/base/ctor/lib/type/set.js new file mode 100644 index 000000000000..b66dae840360 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/scale/base/ctor/lib/type/set.js @@ -0,0 +1,63 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable no-invalid-this */ + +'use strict'; + +// MODULES // + +var logger = require( 'debug' ); +var isScaleName = require( '@stdlib/plot/vega/base/assert/is-scale-name' ); +var join = require( '@stdlib/array/base/join' ); +var scales = require( '@stdlib/plot/vega/scale/names' ); +var format = require( '@stdlib/string/format' ); +var changeEvent = require( './../change_event.js' ); +var prop = require( './properties.js' ); + + +// VARIABLES // + +var debug = logger( 'vega:scale:set:'+prop.name ); + + +// MAIN // + +/** +* Sets the scale type. +* +* @private +* @param {string} value - input value +* @throws {TypeError} must be a valid scale +* @returns {void} +*/ +function set( value ) { + if ( !isScaleName( value ) ) { + throw new TypeError( format( 'invalid assignment. `%s` must be one of the following: "%s". Value: `%s`.', prop.name, join( scales(), '", "' ), value ) ); + } + if ( value !== this[ prop.private ] ) { + debug( 'Current value: %s. New value: %s.', this[ prop.private ], value ); + this[ prop.private ] = value; + this.emit( 'change', changeEvent( prop.name ) ); + } +} + + +// EXPORTS // + +module.exports = set; diff --git a/lib/node_modules/@stdlib/plot/vega/scale/base/ctor/package.json b/lib/node_modules/@stdlib/plot/vega/scale/base/ctor/package.json new file mode 100644 index 000000000000..f9a80bce73d1 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/scale/base/ctor/package.json @@ -0,0 +1,60 @@ +{ + "name": "@stdlib/plot/vega/scale/base/ctor", + "version": "0.0.0", + "description": "Scale constructor.", + "license": "Apache-2.0", + "author": { + "name": "The Stdlib Authors", + "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" + }, + "contributors": [ + { + "name": "The Stdlib Authors", + "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" + } + ], + "main": "./lib", + "directories": { + "benchmark": "./benchmark", + "doc": "./docs", + "example": "./examples", + "lib": "./lib", + "test": "./test" + }, + "types": "./docs/types", + "scripts": {}, + "homepage": "https://github.com/stdlib-js/stdlib", + "repository": { + "type": "git", + "url": "git://github.com/stdlib-js/stdlib.git" + }, + "bugs": { + "url": "https://github.com/stdlib-js/stdlib/issues" + }, + "dependencies": {}, + "devDependencies": {}, + "engines": { + "node": ">=0.10.0", + "npm": ">2.7.0" + }, + "os": [ + "aix", + "darwin", + "freebsd", + "linux", + "macos", + "openbsd", + "sunos", + "win32", + "windows" + ], + "keywords": [ + "stdlib", + "plot", + "vega", + "scale", + "constructor", + "ctor" + ], + "__stdlib__": {} +} diff --git a/lib/node_modules/@stdlib/plot/vega/scale/base/range-defaults/README.md b/lib/node_modules/@stdlib/plot/vega/scale/base/range-defaults/README.md new file mode 100644 index 000000000000..d808cfac1341 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/scale/base/range-defaults/README.md @@ -0,0 +1,117 @@ +<!-- + +@license Apache-2.0 + +Copyright (c) 2025 The Stdlib Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + +--> + +# scaleRangeDefaults + +> List of supported Vega scale range defaults. + +<!-- Section to include introductory text. Make sure to keep an empty line after the intro `section` element and another before the `/section` close. --> + +<section class="intro"> + +</section> + +<!-- /.intro --> + +<!-- Package usage documentation. --> + +<section class="usage"> + +## Usage + +```javascript +var scaleRangeDefaults = require( '@stdlib/plot/vega/scale/base/range-defaults' ); +``` + +#### scaleRangeDefaults() + +Returns a list of supported scale range defaults. + +```javascript +var out = scaleRangeDefaults(); +// e.g., returns [ 'width', 'height', ... ] +``` + +</section> + +<!-- /.usage --> + +<!-- Package usage notes. Make sure to keep an empty line after the `section` element and another before the `/section` close. --> + +<section class="notes"> + +</section> + +<!-- /.notes --> + +<!-- Package usage examples. --> + +<section class="examples"> + +## Examples + +<!-- eslint no-undef: "error" --> + +```javascript +var contains = require( '@stdlib/array/base/assert/contains' ).factory; +var scaleRangeDefaults = require( '@stdlib/plot/vega/scale/base/range-defaults' ); + +var isScaleRangeDefault = contains( scaleRangeDefaults() ); + +var bool = isScaleRangeDefault( 'width' ); +// returns true + +bool = isScaleRangeDefault( 'height' ); +// returns true + +bool = isScaleRangeDefault( 'beep' ); +// returns false + +bool = isScaleRangeDefault( 'boop' ); +// returns false +``` + +</section> + +<!-- /.examples --> + +<!-- Section to include cited references. If references are included, add a horizontal rule *before* the section. Make sure to keep an empty line after the `section` element and another before the `/section` close. --> + +<section class="references"> + +</section> + +<!-- /.references --> + +<!-- Section for related `stdlib` packages. Do not manually edit this section, as it is automatically populated. --> + +<section class="related"> + +</section> + +<!-- /.related --> + +<!-- Section for all links. Make sure to keep an empty line after the `section` element and another before the `/section` close. --> + +<section class="links"> + +</section> + +<!-- /.links --> diff --git a/lib/node_modules/@stdlib/plot/vega/scale/base/range-defaults/benchmark/benchmark.js b/lib/node_modules/@stdlib/plot/vega/scale/base/range-defaults/benchmark/benchmark.js new file mode 100644 index 000000000000..1ed2f31184ff --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/scale/base/range-defaults/benchmark/benchmark.js @@ -0,0 +1,48 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var bench = require( '@stdlib/bench' ); +var isStringArray = require( '@stdlib/assert/is-string-array' ).primitives; +var pkg = require( './../package.json' ).name; +var scaleRangeDefaults = require( './../lib' ); + + +// MAIN // + +bench( pkg, function benchmark( b ) { + var out; + var i; + + b.tic(); + for ( i = 0; i < b.iterations; i++ ) { + out = scaleRangeDefaults(); + if ( out.length < 2 ) { + b.fail( 'should return an array' ); + } + } + b.toc(); + if ( !isStringArray( out ) ) { + b.fail( 'should return an array of strings' ); + } + b.pass( 'benchmark finished' ); + b.end(); +}); diff --git a/lib/node_modules/@stdlib/plot/vega/scale/base/range-defaults/docs/repl.txt b/lib/node_modules/@stdlib/plot/vega/scale/base/range-defaults/docs/repl.txt new file mode 100644 index 000000000000..ca5f66abb743 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/scale/base/range-defaults/docs/repl.txt @@ -0,0 +1,17 @@ + +{{alias}}() + Returns a list of supported scale range defaults. + + Returns + ------- + out: Array<string> + List of scale range defaults. + + Examples + -------- + > var out = {{alias}}() + e.g., [ 'width', 'height', ... ] + + See Also + -------- + diff --git a/lib/node_modules/@stdlib/plot/vega/scale/base/range-defaults/docs/types/index.d.ts b/lib/node_modules/@stdlib/plot/vega/scale/base/range-defaults/docs/types/index.d.ts new file mode 100644 index 000000000000..91095e08524b --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/scale/base/range-defaults/docs/types/index.d.ts @@ -0,0 +1,35 @@ +/* +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +// TypeScript Version: 4.1 + +/** +* Returns a list of supported scale range defaults. +* +* @returns list of scale range defaults +* +* @example +* var list = scaleRangeDefaults(); +* // e.g., returns [ 'width', 'height', ... ] +*/ +declare function scaleRangeDefaults(): Array<string>; + + +// EXPORTS // + +export = scaleRangeDefaults; diff --git a/lib/node_modules/@stdlib/plot/vega/scale/base/range-defaults/docs/types/test.ts b/lib/node_modules/@stdlib/plot/vega/scale/base/range-defaults/docs/types/test.ts new file mode 100644 index 000000000000..d4bfad387ecf --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/scale/base/range-defaults/docs/types/test.ts @@ -0,0 +1,32 @@ +/* +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +import scaleRangeDefaults = require( './index' ); + + +// TESTS // + +// The function returns an array of strings... +{ + scaleRangeDefaults(); // $ExpectType string[] +} + +// The compiler throws an error if the function is provided any arguments... +{ + scaleRangeDefaults( 9 ); // $ExpectError +} diff --git a/lib/node_modules/@stdlib/plot/vega/scale/base/range-defaults/examples/index.js b/lib/node_modules/@stdlib/plot/vega/scale/base/range-defaults/examples/index.js new file mode 100644 index 000000000000..1de4066a7e1e --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/scale/base/range-defaults/examples/index.js @@ -0,0 +1,40 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +var contains = require( '@stdlib/array/base/assert/contains' ).factory; +var scaleRangeDefaults = require( './../lib' ); + +var isScaleRangeDefault = contains( scaleRangeDefaults() ); + +var bool = isScaleRangeDefault( 'width' ); +console.log( bool ); +// => true + +bool = isScaleRangeDefault( 'height' ); +console.log( bool ); +// => true + +bool = isScaleRangeDefault( 'beep' ); +console.log( bool ); +// => false + +bool = isScaleRangeDefault( 'boop' ); +console.log( bool ); +// => false diff --git a/lib/node_modules/@stdlib/plot/vega/scale/base/range-defaults/lib/data.json b/lib/node_modules/@stdlib/plot/vega/scale/base/range-defaults/lib/data.json new file mode 100644 index 000000000000..ff388baacc70 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/scale/base/range-defaults/lib/data.json @@ -0,0 +1,10 @@ +[ + "width", + "height", + "symbol", + "category", + "diverging", + "ordinal", + "ramp", + "heatmap" +] diff --git a/lib/node_modules/@stdlib/plot/vega/scale/base/range-defaults/lib/index.js b/lib/node_modules/@stdlib/plot/vega/scale/base/range-defaults/lib/index.js new file mode 100644 index 000000000000..3b0f17729cdb --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/scale/base/range-defaults/lib/index.js @@ -0,0 +1,40 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +/** +* Return a list of supported scale range defaults. +* +* @module @stdlib/plot/vega/scale/base/range-defaults +* +* @example +* var scaleRangeDefaults = require( '@stdlib/plot/vega/scale/base/range-defaults' ); +* +* var out = scaleRangeDefaults(); +* // e.g., returns [ 'width', 'height', ... ] +*/ + +// MODULES // + +var main = require( './main.js' ); + + +// EXPORTS // + +module.exports = main; diff --git a/lib/node_modules/@stdlib/plot/vega/scale/base/range-defaults/lib/main.js b/lib/node_modules/@stdlib/plot/vega/scale/base/range-defaults/lib/main.js new file mode 100644 index 000000000000..aed896a86d50 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/scale/base/range-defaults/lib/main.js @@ -0,0 +1,44 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var DATA = require( './data.json' ); + + +// MAIN // + +/** +* Returns a list of supported scale range defaults. +* +* @returns {StringArray} list of scale range defaults +* +* @example +* var out = scaleRangeDefaults(); +* // e.g., returns [ 'width', 'height', ... ] +*/ +function scaleRangeDefaults() { + return DATA.slice(); +} + + +// EXPORTS // + +module.exports = scaleRangeDefaults; diff --git a/lib/node_modules/@stdlib/plot/vega/scale/base/range-defaults/package.json b/lib/node_modules/@stdlib/plot/vega/scale/base/range-defaults/package.json new file mode 100644 index 000000000000..116770753b2e --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/scale/base/range-defaults/package.json @@ -0,0 +1,63 @@ +{ + "name": "@stdlib/plot/vega/scale/base/range-defaults", + "version": "0.0.0", + "description": "List of supported Vega scale range defaults.", + "license": "Apache-2.0", + "author": { + "name": "The Stdlib Authors", + "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" + }, + "contributors": [ + { + "name": "The Stdlib Authors", + "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" + } + ], + "main": "./lib", + "directories": { + "benchmark": "./benchmark", + "doc": "./docs", + "example": "./examples", + "lib": "./lib", + "test": "./test" + }, + "types": "./docs/types", + "scripts": {}, + "homepage": "https://github.com/stdlib-js/stdlib", + "repository": { + "type": "git", + "url": "git://github.com/stdlib-js/stdlib.git" + }, + "bugs": { + "url": "https://github.com/stdlib-js/stdlib/issues" + }, + "dependencies": {}, + "devDependencies": {}, + "engines": { + "node": ">=0.10.0", + "npm": ">2.7.0" + }, + "os": [ + "aix", + "darwin", + "freebsd", + "linux", + "macos", + "openbsd", + "sunos", + "win32", + "windows" + ], + "keywords": [ + "stdlib", + "plot", + "vega", + "scale", + "range", + "utilities", + "utility", + "utils", + "util" + ], + "__stdlib__": {} +} diff --git a/lib/node_modules/@stdlib/plot/vega/scale/base/range-defaults/test/test.js b/lib/node_modules/@stdlib/plot/vega/scale/base/range-defaults/test/test.js new file mode 100644 index 000000000000..6aea570c7bae --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/scale/base/range-defaults/test/test.js @@ -0,0 +1,53 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var tape = require( 'tape' ); +var scaleRangeDefaults = require( './../lib' ); + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof scaleRangeDefaults, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'the function returns a list of scale range defaults', function test( t ) { + var expected; + var actual; + + expected = [ + 'width', + 'height', + 'symbol', + 'category', + 'diverging', + 'ordinal', + 'ramp', + 'heatmap' + ]; + actual = scaleRangeDefaults(); + + t.deepEqual( actual, expected, 'returns expected value' ); + t.end(); +}); diff --git a/lib/node_modules/@stdlib/plot/vega/scale/base/range-interpolation-methods/README.md b/lib/node_modules/@stdlib/plot/vega/scale/base/range-interpolation-methods/README.md new file mode 100644 index 000000000000..99948d3440cc --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/scale/base/range-interpolation-methods/README.md @@ -0,0 +1,123 @@ +<!-- + +@license Apache-2.0 + +Copyright (c) 2025 The Stdlib Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + +--> + +# scaleRangeInterpolationMethods + +> List of supported Vega scale range interpolation methods. + +<!-- Section to include introductory text. Make sure to keep an empty line after the intro `section` element and another before the `/section` close. --> + +<section class="intro"> + +</section> + +<!-- /.intro --> + +<!-- Package usage documentation. --> + +<section class="usage"> + +## Usage + +<!-- eslint-disable id-length --> + +```javascript +var scaleRangeInterpolationMethods = require( '@stdlib/plot/vega/scale/base/range-interpolation-methods' ); +``` + +#### scaleRangeInterpolationMethods() + +Returns a list of supported scale range interpolation methods. + +<!-- eslint-disable id-length --> + +```javascript +var out = scaleRangeInterpolationMethods(); +// e.g., returns [ 'rgb', 'hsl', ... ] +``` + +</section> + +<!-- /.usage --> + +<!-- Package usage notes. Make sure to keep an empty line after the `section` element and another before the `/section` close. --> + +<section class="notes"> + +</section> + +<!-- /.notes --> + +<!-- Package usage examples. --> + +<section class="examples"> + +## Examples + +<!-- eslint-disable id-length, max-len --> + +<!-- eslint no-undef: "error" --> + +```javascript +var contains = require( '@stdlib/array/base/assert/contains' ).factory; +var scaleRangeInterpolationMethods = require( '@stdlib/plot/vega/scale/base/range-interpolation-methods' ); + +var isScaleRangeInterpolationMethod = contains( scaleRangeInterpolationMethods() ); + +var bool = isScaleRangeInterpolationMethod( 'rgb' ); +// returns true + +bool = isScaleRangeInterpolationMethod( 'hsl' ); +// returns true + +bool = isScaleRangeInterpolationMethod( 'beep' ); +// returns false + +bool = isScaleRangeInterpolationMethod( 'boop' ); +// returns false +``` + +</section> + +<!-- /.examples --> + +<!-- Section to include cited references. If references are included, add a horizontal rule *before* the section. Make sure to keep an empty line after the `section` element and another before the `/section` close. --> + +<section class="references"> + +</section> + +<!-- /.references --> + +<!-- Section for related `stdlib` packages. Do not manually edit this section, as it is automatically populated. --> + +<section class="related"> + +</section> + +<!-- /.related --> + +<!-- Section for all links. Make sure to keep an empty line after the `section` element and another before the `/section` close. --> + +<section class="links"> + +</section> + +<!-- /.links --> diff --git a/lib/node_modules/@stdlib/plot/vega/scale/base/range-interpolation-methods/benchmark/benchmark.js b/lib/node_modules/@stdlib/plot/vega/scale/base/range-interpolation-methods/benchmark/benchmark.js new file mode 100644 index 000000000000..fb31cd8fc5b8 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/scale/base/range-interpolation-methods/benchmark/benchmark.js @@ -0,0 +1,48 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var bench = require( '@stdlib/bench' ); +var isStringArray = require( '@stdlib/assert/is-string-array' ).primitives; +var pkg = require( './../package.json' ).name; +var scaleRangeInterpolationMethods = require( './../lib' ); // eslint-disable-line id-length + + +// MAIN // + +bench( pkg, function benchmark( b ) { + var out; + var i; + + b.tic(); + for ( i = 0; i < b.iterations; i++ ) { + out = scaleRangeInterpolationMethods(); + if ( out.length < 2 ) { + b.fail( 'should return an array' ); + } + } + b.toc(); + if ( !isStringArray( out ) ) { + b.fail( 'should return an array of strings' ); + } + b.pass( 'benchmark finished' ); + b.end(); +}); diff --git a/lib/node_modules/@stdlib/plot/vega/scale/base/range-interpolation-methods/docs/repl.txt b/lib/node_modules/@stdlib/plot/vega/scale/base/range-interpolation-methods/docs/repl.txt new file mode 100644 index 000000000000..839a5b861053 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/scale/base/range-interpolation-methods/docs/repl.txt @@ -0,0 +1,17 @@ + +{{alias}}() + Returns a list of supported scale range interpolation methods. + + Returns + ------- + out: Array<string> + List of scale range interpolation methods. + + Examples + -------- + > var out = {{alias}}() + e.g., [ 'rgb', 'hsl', ... ] + + See Also + -------- + diff --git a/lib/node_modules/@stdlib/plot/vega/scale/base/range-interpolation-methods/docs/types/index.d.ts b/lib/node_modules/@stdlib/plot/vega/scale/base/range-interpolation-methods/docs/types/index.d.ts new file mode 100644 index 000000000000..bb30422d6253 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/scale/base/range-interpolation-methods/docs/types/index.d.ts @@ -0,0 +1,35 @@ +/* +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +// TypeScript Version: 4.1 + +/** +* Returns a list of supported scale range interpolation methods. +* +* @returns list of scale range interpolation methods +* +* @example +* var list = scaleRangeInterpolationMethods(); +* // e.g., returns [ 'rgb', 'hsl', ... ] +*/ +declare function scaleRangeInterpolationMethods(): Array<string>; + + +// EXPORTS // + +export = scaleRangeInterpolationMethods; diff --git a/lib/node_modules/@stdlib/plot/vega/scale/base/range-interpolation-methods/docs/types/test.ts b/lib/node_modules/@stdlib/plot/vega/scale/base/range-interpolation-methods/docs/types/test.ts new file mode 100644 index 000000000000..52be9d9a912c --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/scale/base/range-interpolation-methods/docs/types/test.ts @@ -0,0 +1,32 @@ +/* +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +import scaleRangeInterpolationMethods = require( './index' ); + + +// TESTS // + +// The function returns an array of strings... +{ + scaleRangeInterpolationMethods(); // $ExpectType string[] +} + +// The compiler throws an error if the function is provided any arguments... +{ + scaleRangeInterpolationMethods( 9 ); // $ExpectError +} diff --git a/lib/node_modules/@stdlib/plot/vega/scale/base/range-interpolation-methods/examples/index.js b/lib/node_modules/@stdlib/plot/vega/scale/base/range-interpolation-methods/examples/index.js new file mode 100644 index 000000000000..bb9c2c0be961 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/scale/base/range-interpolation-methods/examples/index.js @@ -0,0 +1,40 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +var contains = require( '@stdlib/array/base/assert/contains' ).factory; +var scaleRangeInterpolationMethods = require( './../lib' ); // eslint-disable-line id-length + +var isScaleRangeInterpolationMethod = contains( scaleRangeInterpolationMethods() ); // eslint-disable-line id-length, max-len + +var bool = isScaleRangeInterpolationMethod( 'rgb' ); +console.log( bool ); +// => true + +bool = isScaleRangeInterpolationMethod( 'hsl' ); +console.log( bool ); +// => true + +bool = isScaleRangeInterpolationMethod( 'beep' ); +console.log( bool ); +// => false + +bool = isScaleRangeInterpolationMethod( 'boop' ); +console.log( bool ); +// => false diff --git a/lib/node_modules/@stdlib/plot/vega/scale/base/range-interpolation-methods/lib/data.json b/lib/node_modules/@stdlib/plot/vega/scale/base/range-interpolation-methods/lib/data.json new file mode 100644 index 000000000000..d0220b187140 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/scale/base/range-interpolation-methods/lib/data.json @@ -0,0 +1,10 @@ +[ + "rgb", + "hsl", + "hsl-long", + "lab", + "hcl", + "hcl-long", + "cubehelix", + "cubehelix-long" +] diff --git a/lib/node_modules/@stdlib/plot/vega/scale/base/range-interpolation-methods/lib/index.js b/lib/node_modules/@stdlib/plot/vega/scale/base/range-interpolation-methods/lib/index.js new file mode 100644 index 000000000000..c3f48b450eb6 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/scale/base/range-interpolation-methods/lib/index.js @@ -0,0 +1,40 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +/** +* Return a list of supported scale range interpolation methods. +* +* @module @stdlib/plot/vega/scale/base/range-interpolation-methods +* +* @example +* var scaleRangeInterpolationMethods = require( '@stdlib/plot/vega/scale/base/range-interpolation-methods' ); +* +* var out = scaleRangeInterpolationMethods(); +* // e.g., returns [ 'rgb', 'hsl', ... ] +*/ + +// MODULES // + +var main = require( './main.js' ); + + +// EXPORTS // + +module.exports = main; diff --git a/lib/node_modules/@stdlib/plot/vega/scale/base/range-interpolation-methods/lib/main.js b/lib/node_modules/@stdlib/plot/vega/scale/base/range-interpolation-methods/lib/main.js new file mode 100644 index 000000000000..c45a86578f1d --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/scale/base/range-interpolation-methods/lib/main.js @@ -0,0 +1,44 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var DATA = require( './data.json' ); + + +// MAIN // + +/** +* Returns a list of supported scale range interpolation methods. +* +* @returns {StringArray} list of scale range interpolation methods +* +* @example +* var out = scaleRangeInterpolationMethods(); +* // e.g., returns [ 'rgb', 'hsl', ... ] +*/ +function scaleRangeInterpolationMethods() { // eslint-disable-line id-length + return DATA.slice(); +} + + +// EXPORTS // + +module.exports = scaleRangeInterpolationMethods; diff --git a/lib/node_modules/@stdlib/plot/vega/scale/base/range-interpolation-methods/package.json b/lib/node_modules/@stdlib/plot/vega/scale/base/range-interpolation-methods/package.json new file mode 100644 index 000000000000..4cb35afc8c6e --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/scale/base/range-interpolation-methods/package.json @@ -0,0 +1,63 @@ +{ + "name": "@stdlib/plot/vega/scale/base/range-interpolation-methods", + "version": "0.0.0", + "description": "List of supported Vega scale range interpolation methods.", + "license": "Apache-2.0", + "author": { + "name": "The Stdlib Authors", + "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" + }, + "contributors": [ + { + "name": "The Stdlib Authors", + "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" + } + ], + "main": "./lib", + "directories": { + "benchmark": "./benchmark", + "doc": "./docs", + "example": "./examples", + "lib": "./lib", + "test": "./test" + }, + "types": "./docs/types", + "scripts": {}, + "homepage": "https://github.com/stdlib-js/stdlib", + "repository": { + "type": "git", + "url": "git://github.com/stdlib-js/stdlib.git" + }, + "bugs": { + "url": "https://github.com/stdlib-js/stdlib/issues" + }, + "dependencies": {}, + "devDependencies": {}, + "engines": { + "node": ">=0.10.0", + "npm": ">2.7.0" + }, + "os": [ + "aix", + "darwin", + "freebsd", + "linux", + "macos", + "openbsd", + "sunos", + "win32", + "windows" + ], + "keywords": [ + "stdlib", + "plot", + "vega", + "scale", + "range", + "utilities", + "utility", + "utils", + "util" + ], + "__stdlib__": {} +} diff --git a/lib/node_modules/@stdlib/plot/vega/scale/base/range-interpolation-methods/test/test.js b/lib/node_modules/@stdlib/plot/vega/scale/base/range-interpolation-methods/test/test.js new file mode 100644 index 000000000000..34aef07faff0 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/scale/base/range-interpolation-methods/test/test.js @@ -0,0 +1,53 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var tape = require( 'tape' ); +var scaleRangeInterpolationMethods = require( './../lib' ); // eslint-disable-line id-length + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof scaleRangeInterpolationMethods, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'the function returns a list of scale range interpolation methods', function test( t ) { + var expected; + var actual; + + expected = [ + 'rgb', + 'hsl', + 'hsl-long', + 'lab', + 'hcl', + 'hcl-long', + 'cubehelix', + 'cubehelix-long' + ]; + actual = scaleRangeInterpolationMethods(); + + t.deepEqual( actual, expected, 'returns expected value' ); + t.end(); +}); diff --git a/lib/node_modules/@stdlib/plot/vega/scale/ctors/lib/ctors.js b/lib/node_modules/@stdlib/plot/vega/scale/ctors/lib/ctors.js new file mode 100644 index 000000000000..4f6373d5b859 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/scale/ctors/lib/ctors.js @@ -0,0 +1,48 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var LinearScale = require( '@stdlib/plot/vega/scale/linear' ); +var LogScale = require( '@stdlib/plot/vega/scale/log' ); +var PowerScale = require( '@stdlib/plot/vega/scale/power' ); +var SqrtScale = require( '@stdlib/plot/vega/scale/sqrt' ); +var SymLogScale = require( '@stdlib/plot/vega/scale/symmetric-log' ); +var TimeScale = require( '@stdlib/plot/vega/scale/time' ); +var UTCScale = require( '@stdlib/plot/vega/scale/utc' ); + + +// MAIN // + +// Mapping from scale types to scale constructors... +var ctors = { + 'linear': LinearScale, + 'log': LogScale, + 'pow': PowerScale, + 'sqrt': SqrtScale, + 'symlog': SymLogScale, + 'time': TimeScale, + 'utc': UTCScale +}; + + +// EXPORTS // + +module.exports = ctors; diff --git a/lib/node_modules/@stdlib/plot/vega/scale/ctors/lib/index.js b/lib/node_modules/@stdlib/plot/vega/scale/ctors/lib/index.js new file mode 100644 index 000000000000..cbff9bd4c68f --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/scale/ctors/lib/index.js @@ -0,0 +1,43 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +/** +* Scale constructors. +* +* @module @stdlib/plot/vega/scale/ctors +* +* @example +* var ctors = require( '@stdlib/plot/vega/scale/ctors' ); +* +* var ctor = ctors( 'linear' ); +* // returns <Function> +* +* ctor = ctors( 'foobar' ); +* // returns null +*/ + +// MODULES // + +var main = require( './main.js' ); + + +// EXPORTS // + +module.exports = main; diff --git a/lib/node_modules/@stdlib/plot/vega/scale/ctors/lib/main.js b/lib/node_modules/@stdlib/plot/vega/scale/ctors/lib/main.js new file mode 100644 index 000000000000..ea217e34000b --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/scale/ctors/lib/main.js @@ -0,0 +1,49 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var table = require( './ctors.js' ); + + +// MAIN // + +/** +* Returns a scale constructor. +* +* @param {string} type - scale type +* @returns {(Function|null)} constructor or null +* +* @example +* var ctor = ctors( 'linear' ); +* // returns <Function> +* +* @example +* var ctor = ctors( 'foobar' ); +* // returns null +*/ +function ctors( type ) { + return table[ type ] || null; +} + + +// EXPORTS // + +module.exports = ctors; diff --git a/lib/node_modules/@stdlib/plot/vega/scale/ctors/package.json b/lib/node_modules/@stdlib/plot/vega/scale/ctors/package.json new file mode 100644 index 000000000000..1bace5e773f6 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/scale/ctors/package.json @@ -0,0 +1,61 @@ +{ + "name": "@stdlib/plot/vega/scale/ctors", + "version": "0.0.0", + "description": "Scale constructors.", + "license": "Apache-2.0", + "author": { + "name": "The Stdlib Authors", + "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" + }, + "contributors": [ + { + "name": "The Stdlib Authors", + "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" + } + ], + "main": "./lib", + "directories": { + "benchmark": "./benchmark", + "doc": "./docs", + "example": "./examples", + "lib": "./lib", + "test": "./test" + }, + "types": "./docs/types", + "scripts": {}, + "homepage": "https://github.com/stdlib-js/stdlib", + "repository": { + "type": "git", + "url": "git://github.com/stdlib-js/stdlib.git" + }, + "bugs": { + "url": "https://github.com/stdlib-js/stdlib/issues" + }, + "dependencies": {}, + "devDependencies": {}, + "engines": { + "node": ">=0.10.0", + "npm": ">2.7.0" + }, + "os": [ + "aix", + "darwin", + "freebsd", + "linux", + "macos", + "openbsd", + "sunos", + "win32", + "windows" + ], + "keywords": [ + "stdlib", + "plot", + "vega", + "scale", + "constructors", + "ctors", + "ctor" + ], + "__stdlib__": {} +} diff --git a/lib/node_modules/@stdlib/plot/vega/scale/generalized/examples/index.js b/lib/node_modules/@stdlib/plot/vega/scale/generalized/examples/index.js new file mode 100644 index 000000000000..6199b34b01d1 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/scale/generalized/examples/index.js @@ -0,0 +1,45 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +var GeneralizedScale = require( './../lib' ); + +var scale = new GeneralizedScale(); +console.log( scale.toJSON() ); + +scale.type = 'linear'; +console.log( scale.toJSON() ); + +scale.type = 'log'; +console.log( scale.toJSON() ); + +scale.type = 'pow'; +console.log( scale.toJSON() ); + +scale.type = 'sqrt'; +console.log( scale.toJSON() ); + +scale.type = 'symlog'; +console.log( scale.toJSON() ); + +scale.type = 'time'; +console.log( scale.toJSON() ); + +scale.type = 'utc'; +console.log( scale.toJSON() ); diff --git a/lib/node_modules/@stdlib/plot/vega/scale/generalized/lib/change_event.js b/lib/node_modules/@stdlib/plot/vega/scale/generalized/lib/change_event.js new file mode 100644 index 000000000000..55baae0c617a --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/scale/generalized/lib/change_event.js @@ -0,0 +1,41 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MAIN // + +/** +* Returns a new change event object. +* +* @private +* @param {string} property - property name +* @returns {Object} event object +*/ +function event( property ) { // eslint-disable-line stdlib/no-redeclare + return { + 'type': 'update', + 'source': 'scale', + 'property': property + }; +} + + +// EXPORTS // + +module.exports = event; diff --git a/lib/node_modules/@stdlib/plot/vega/scale/generalized/lib/factory.js b/lib/node_modules/@stdlib/plot/vega/scale/generalized/lib/factory.js new file mode 100644 index 000000000000..36d0181f09b7 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/scale/generalized/lib/factory.js @@ -0,0 +1,363 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable no-restricted-syntax, no-invalid-this */ + +'use strict'; + +// MODULES // + +var logger = require( 'debug' ); +var isString = require( '@stdlib/assert/is-string' ).isPrimitive; +var isPlainObject = require( '@stdlib/assert/is-plain-object' ); +var isObject = require( '@stdlib/assert/is-object' ); +var isScaleNameArray = require( '@stdlib/plot/vega/base/assert/is-scale-name-array' ); +var hasProp = require( '@stdlib/assert/has-property' ); +var hasOwnProp = require( '@stdlib/assert/has-own-property' ); +var setNonEnumerableProperty = require( '@stdlib/utils/define-nonenumerable-property' ); +var setNonEnumerableReadOnly = require( '@stdlib/utils/define-nonenumerable-read-only-property' ); +var setReadWriteAccessor = require( '@stdlib/utils/define-read-write-accessor' ); +var contains = require( '@stdlib/array/base/assert/contains' ); +var join = require( '@stdlib/array/base/join' ); +var dedupe = require( '@stdlib/array/base/dedupe' ); +var objectAssignIn = require( '@stdlib/object/assign-in' ); +var inherit = require( '@stdlib/utils/inherit' ); +var ctors = require( '@stdlib/plot/vega/scale/ctors' ); +var Scale = require( '@stdlib/plot/vega/scale/base/ctor' ); +var format = require( '@stdlib/string/format' ); +var changeEvent = require( './change_event.js' ); +var properties = require( './properties.json' ); + + +// VARIABLES // + +var debug = logger( 'vega:generalized-scale:main' ); +var DEFAULT_NAME = 'scale'; + + +// MAIN // + +/** +* Returns a generalized scale constructor. +* +* @param {Array<string>} scales - list of supported scale names +* @param {Options} [defaults] - defaults +* @param {string} [defaults.name='scale'] - default scale name +* @param {string} [defaults.type=scales[0]] - default scale type +* @throws {TypeError} first argument must be an array of scale names +* @throws {TypeError} second argument must be an object +* @throws {TypeError} must provide valid options +* @returns {Function} constructor +* +* @example +* var scales = [ 'linear', 'log' ]; +* +* var GeneralizedScale = factory( scales, { +* 'name': 'xScale' +* }); +* // returns <Function> +* +* var xScale = GeneralizedScale(); +* // returns <GeneralizedScale> +*/ +function factory( scales, defaults ) { + var cache; + var props; + var OPTS; + var tmp; + var k; + var i; + if ( !isScaleNameArray( scales ) ) { + throw new TypeError( format( 'invalid argument. First argument must be an array of scale names. Value: `%s`.', scales ) ); + } + OPTS = { + 'name': DEFAULT_NAME, + 'type': scales[ 0 ] + }; + if ( arguments.length > 1 ) { + if ( !isPlainObject( defaults ) ) { + throw new TypeError( format( 'invalid argument. Second argument must be an object. Value: `%s`.', defaults ) ); + } + if ( hasOwnProp( defaults, 'name' ) ) { + if ( !isString( defaults.name ) ) { + throw new TypeError( format( 'invalid option. `%s` option must be a string. Option: `%s`.', 'name', defaults.name ) ); + } + OPTS.name = defaults.name; + } + if ( hasOwnProp( defaults, 'type' ) ) { + if ( !contains( scales, defaults.type ) ) { + throw new TypeError( format( 'invalid option. `%s` option must be one of the following: "%s". Option: `%s`.', 'type', join( scales, '", "' ), defaults.type ) ); + } + OPTS.type = defaults.type; + } + } + // Initialize a cache for storing scale instances: + cache = {}; + + // Resolve the list of property names which are unique to the list of provided scales... + props = properties.all.slice(); + for ( i = 0; i < scales.length; i++ ) { + tmp = properties[ scales[ i ] ]; + for ( k = 0; k < tmp.length; k++ ) { + props.push( tmp[ k ] ); + } + } + props = dedupe( props.sort() ); + + /** + * Returns the scale type. + * + * @private + * @returns {string} scale type + */ + function getType() { + return this.__scale__.type; + } + + /** + * Sets the scale type. + * + * @private + * @param {string} value - input value + * @throws {TypeError} must be a valid scale + * @returns {void} + */ + function setType( value ) { + var scale; + var ctor; + var curr; + var k; + var v; + var i; + + curr = this.type; + if ( value === curr ) { + return; + } + if ( !contains( scales, value ) ) { + throw new TypeError( format( 'invalid assignment. `%s` must be one of the following: "%s". Value: `%s`.', 'type', join( scales, '", "' ), value ) ); + } + debug( 'Current value: %s. New value: %s.', curr, value ); + if ( hasOwnProp( cache, value ) ) { + this.__scale__.removeListener( this._onChange ); + scale = cache[ value ]; + } else { + ctor = ctors( value ); + scale = new ctor({ + 'name': this.name + }); + } + // Attempt to set scale properties based on the current scale's configuration (imagined use case: a user toggles a scale type between 'linear' and 'log' and would like to see the domain min and max remain the same after toggling rather than the scale reverting to a previous state), while recognizing that some assignments may fail if transitioning between scales with incompatible fields (e.g., quantitative to discrete). In those cases, we simply skip assignment... + for ( i = 0; i < props.length; i++ ) { + k = props[ i ]; + if ( k === 'type' ) { + continue; + } + v = this.__scale__[ k ]; + if ( v === void 0 ) { + continue; + } + try { + scale[ k ] = v; + } catch ( err ) { + debug( 'Encountered an error when attempting to assign the current scale property value to the new scale. Property: %s. Value: %s. Error: %s', k, JSON.stringify( v ), err.message ); + continue; + } + } + this.__scale__ = scale; + scale.on( 'change', this._onChange ); + this.emit( 'change', changeEvent( 'type' ) ); + } + + /** + * Returns an accessor for retrieving a property value. + * + * @private + * @param {string} name - property name + * @returns {Function} accessor + */ + function getter( name ) { + return get; + + /** + * Returns a property value. + * + * @private + * @returns {(*|void)} property value + */ + function get() { + if ( hasProp( this.__scale__, name ) ) { + // Forward the request to the underlying specialized scale: + return this.__scale__[ name ]; + } + } + } + + /** + * Returns an accessor for setting a property value. + * + * @private + * @param {string} name - property name + * @returns {Function} accessor + */ + function setter( name ) { + return set; + + /** + * Sets a property value. + * + * @private + * @param {*} value - value to set + */ + function set( value ) { + if ( hasProp( this.__scale__, name ) ) { + // Forward the request to the underlying specialized scale: + this.__scale__[ name ] = value; + } + } + } + + /** + * Generalized scale constructor. + * + * @private + * @constructor + * @param {Options} [options] - constructor options + * @throws {TypeError} options argument must be an object + * @throws {TypeError} must provide valid options + * @returns {GeneralizedScale} scale instance + */ + function GeneralizedScale( options ) { + var scale; + var nargs; + var opts; + var ctor; + var self; + + nargs = arguments.length; + if ( !( this instanceof GeneralizedScale ) ) { + if ( nargs ) { + return new GeneralizedScale( options ); + } + return new GeneralizedScale(); + } + self = this; + + // Resolve constructor options... + if ( nargs ) { + if ( !isObject( options ) ) { + throw new TypeError( format( 'invalid argument. Options argument must be an object. Value: `%s`.', options ) ); + } + opts = objectAssignIn( {}, options ); + if ( !hasProp( opts, 'name' ) ) { + opts.name = OPTS.name; + } + } else { + opts = { + 'name': OPTS.name + }; + } + if ( hasProp( opts, 'type' ) ) { + if ( !contains( scales, opts.type ) ) { + throw new TypeError( format( 'invalid option. `%s` option must be one of the following: "%s". Option: `%s`.', 'type', join( scales, '", "' ), opts.type ) ); + } + } else { + opts.type = OPTS.type; + } + // Resolve a specialized scale constructor: + ctor = ctors( opts.type ); + + // Initialize a specialized scale type: + scale = ctor( opts ); + + // Add the scale to the cache: + cache[ opts.type ] = scale; + setNonEnumerableProperty( this, '__scale__', scale ); + + // Set a callback for handling 'change' events from specialized constructors: + setNonEnumerableReadOnly( this, '_onChange', onChange ); + + // Setup event listeners: + scale.on( 'change', this._onChange ); + + // Call the parent constructor which ensures that the returned scale satisfies `instanceof Scale`: + Scale.call( this, OPTS ); + + return this; + + /** + * Callback invoked upon receiving a change event. + * + * @private + * @param {Object} event - event object + */ + function onChange( event ) { + debug( 'Received a change event: %s', JSON.stringify( event ) ); + self.emit( 'change', event ); + } + } + + /* + * Inherit from the `Scale` prototype. + */ + inherit( GeneralizedScale, Scale ); + + /** + * Scale type. + * + * @name type + * @memberof GeneralizedScale.prototype + * @type {string} + */ + setReadWriteAccessor( GeneralizedScale.prototype, 'type', getType, setType ); + + // Add prototype methods which forward requests to the underlying specialized scale instance... + for ( i = 0; i < props.length; i++ ) { + k = props[ i ]; + + // Skip the 'type' property, as we use a specialized handler for switching between specialized scale types... + if ( k === 'type' ) { + continue; + } + // For other properties, we can delegate to the underlying specialized scale: + setReadWriteAccessor( GeneralizedScale.prototype, k, getter( k ), setter( k ) ); // eslint-disable-line max-len + } + + /** + * Serializes an instance to a JSON object. + * + * ## Notes + * + * - This method is implicitly invoked by `JSON.stringify`. + * + * @name toJSON + * @memberof GeneralizedScale.prototype + * @type {Function} + * @returns {Object} JSON object + */ + setNonEnumerableReadOnly( GeneralizedScale.prototype, 'toJSON', function toJSON() { + return this.__scale__.toJSON(); + }); + + return GeneralizedScale; +} + + +// EXPORTS // + +module.exports = factory; diff --git a/lib/node_modules/@stdlib/plot/vega/scale/generalized/lib/index.js b/lib/node_modules/@stdlib/plot/vega/scale/generalized/lib/index.js new file mode 100644 index 000000000000..f1e2e969e64f --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/scale/generalized/lib/index.js @@ -0,0 +1,60 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +/** +* Generalized scale constructor. +* +* @module @stdlib/plot/vega/scale/generalized +* +* @example +* var GeneralizedScale = require( '@stdlib/plot/vega/scale/generalized' ); +* +* var scale = new GeneralizedScale(); +* // returns <GeneralizedScale> +* +* @example +* var GeneralizedScale = require( '@stdlib/plot/vega/scale/generalized' ); +* +* var scales = [ 'linear', 'log' ]; +* +* var Scale = GeneralizedScale.factory( scales, { +* 'name': 'xScale', +* 'type': 'linear' +* }); +* +* var scale = new Scale(); +* // returns <GeneralizedScale> +*/ + +// MODULES // + +var setReadOnly = require( '@stdlib/utils/define-nonenumerable-read-only-property' ); +var factory = require( './factory.js' ); +var main = require( './main.js' ); + + +// MAIN // + +setReadOnly( main, 'factory', factory ); + + +// EXPORTS // + +module.exports = main; diff --git a/lib/node_modules/@stdlib/plot/vega/scale/generalized/lib/main.js b/lib/node_modules/@stdlib/plot/vega/scale/generalized/lib/main.js new file mode 100644 index 000000000000..afcddb7c0ac8 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/scale/generalized/lib/main.js @@ -0,0 +1,74 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var scales = require( '@stdlib/plot/vega/scale/names' ); +var factory = require( './factory.js' ); + + +// MAIN // + +/** +* Generalized scale constructor. +* +* @name GeneralizedScale +* @constructor +* @type {Function} +* @param {Options} [options] - constructor options +* @param {number} [options.align=0.5] - alignment of elements within a band scale range +* @param {number} [options.base=10] - base of the logarithm to use when performing logarithmic transforms +* @param {(Collection|Object|Signal)} [options.bins] - bin boundaries over the scale domain +* @param {boolean} [options.clamp=false] - boolean indicating whether to clamp output values to the scale range +* @param {number} [options.constant=1] - constant which determines the slope of the symmetric-log transform around zero +* @param {(Collection|Object|Signal)} [options.domain] - domain of associated data values +* @param {boolean} [options.domainImplicit=false] - boolean indicating if an ordinal domain should be implicitly extended with new values +* @param {number} [options.domainMax] - maximum value in the scale domain (overrides the `domain` option) +* @param {number} [options.domainMin] - minimum value in the scale domain (overrides the `domain` option) +* @param {number} [options.domainMid] - single mid-point value inserted into a two-element domain +* @param {Collection} [options.domainRaw] - array of raw domain values which overrides the `domain` property +* @param {number} [options.exponent=1] - exponent to use when performing exponential transforms +* @param {(string|Object)} [options.interpolate] - scale range interpolation method +* @param {string} [options.name='scale'] - scale name +* @param {(boolean|number|string|Object|Signal)} [options.nice=false] - scale domain "nicing" +* @param {number} [options.padding=0] - scale domain padding (in pixels) +* @param {number} [options.paddingInner=0] - inner padding (spacing) within each step of a band scale +* @param {number} [options.paddingOuter=0] - outer padding (spacing) at the ends of a band scale +* @param {(Collection|Object|Signal|string)} [options.range] - scale range +* @param {boolean} [options.reverse=false] - boolean indicating whether to reverse the order of the scale range +* @param {boolean} [options.round=false] - boolean indicating whether to round numeric output values to integers +* @param {string} [options.type='linear'] - scale type +* @param {boolean} [options.zero] - boolean indicating whether the scale domain should include zero +* @throws {TypeError} options argument must be an object +* @throws {TypeError} must provide valid options +* @returns {GeneralizedScale} scale instance +* +* @example +* var scale = new GeneralizedScale(); +* // returns <GeneralizedScale> +*/ +var GeneralizedScale = factory( scales(), { + 'type': 'linear' +}); + + +// EXPORTS // + +module.exports = GeneralizedScale; diff --git a/lib/node_modules/@stdlib/plot/vega/scale/generalized/lib/properties.json b/lib/node_modules/@stdlib/plot/vega/scale/generalized/lib/properties.json new file mode 100644 index 000000000000..e3d841440459 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/scale/generalized/lib/properties.json @@ -0,0 +1,104 @@ +{ + "all": [ + "domain", + "domainMax", + "domainMin", + "domainMid", + "domainRaw", + "interpolate", + "name", + "range", + "reverse", + "round", + "type" + ], + + "linear": [ + "bins", + "clamp", + "padding", + "nice", + "zero" + ], + + "log": [ + "bins", + "clamp", + "padding", + "nice", + "zero", + + "base" + ], + + "pow": [ + "bins", + "clamp", + "padding", + "nice", + "zero", + + "exponent" + ], + + "sqrt": [ + "bins", + "clamp", + "padding", + "nice", + "zero" + ], + + "symlog": [ + "bins", + "clamp", + "padding", + "nice", + "zero", + + "constant" + ], + + "time": [ + "bins", + "clamp", + "padding", + "nice", + "zero" + ], + + "utc": [ + "bins", + "clamp", + "padding", + "nice", + "zero" + ], + + "ordinal": [], + + "band": [ + "align", + "domainImplicit", + "paddingInner", + "paddingOuter" + ], + + "point": [ + "align", + "paddingOuter" + ], + + "quantile": [], + + "quantize": [ + "nice", + "zero" + ], + + "threshold": [], + + "bin-ordinal": [ + "bins" + ] +} diff --git a/lib/node_modules/@stdlib/plot/vega/scale/generalized/package.json b/lib/node_modules/@stdlib/plot/vega/scale/generalized/package.json new file mode 100644 index 000000000000..edd0818d982b --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/scale/generalized/package.json @@ -0,0 +1,61 @@ +{ + "name": "@stdlib/plot/vega/scale/generalized", + "version": "0.0.0", + "description": "Generalized scale constructor.", + "license": "Apache-2.0", + "author": { + "name": "The Stdlib Authors", + "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" + }, + "contributors": [ + { + "name": "The Stdlib Authors", + "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" + } + ], + "main": "./lib", + "directories": { + "benchmark": "./benchmark", + "doc": "./docs", + "example": "./examples", + "lib": "./lib", + "test": "./test" + }, + "types": "./docs/types", + "scripts": {}, + "homepage": "https://github.com/stdlib-js/stdlib", + "repository": { + "type": "git", + "url": "git://github.com/stdlib-js/stdlib.git" + }, + "bugs": { + "url": "https://github.com/stdlib-js/stdlib/issues" + }, + "dependencies": {}, + "devDependencies": {}, + "engines": { + "node": ">=0.10.0", + "npm": ">2.7.0" + }, + "os": [ + "aix", + "darwin", + "freebsd", + "linux", + "macos", + "openbsd", + "sunos", + "win32", + "windows" + ], + "keywords": [ + "stdlib", + "plot", + "vega", + "scale", + "constructor", + "ctor", + "factory" + ], + "__stdlib__": {} +} diff --git a/lib/node_modules/@stdlib/plot/vega/scale/linear/examples/index.js b/lib/node_modules/@stdlib/plot/vega/scale/linear/examples/index.js new file mode 100644 index 000000000000..9500eb3266ba --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/scale/linear/examples/index.js @@ -0,0 +1,27 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +var LinearScale = require( './../lib' ); + +var scale = new LinearScale({ + 'name': 'xScale' +}); + +console.log( scale.toJSON() ); diff --git a/lib/node_modules/@stdlib/plot/vega/scale/linear/lib/index.js b/lib/node_modules/@stdlib/plot/vega/scale/linear/lib/index.js new file mode 100644 index 000000000000..d0c805265e91 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/scale/linear/lib/index.js @@ -0,0 +1,42 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +/** +* Linear scale constructor. +* +* @module @stdlib/plot/vega/scale/linear +* +* @example +* var LinearScale = require( '@stdlib/plot/vega/scale/linear' ); +* +* var scale = new LinearScale({ +* 'name': 'xScale' +* }); +* // returns <LinearScale> +*/ + +// MODULES // + +var main = require( './main.js' ); + + +// EXPORTS // + +module.exports = main; diff --git a/lib/node_modules/@stdlib/plot/vega/scale/linear/lib/main.js b/lib/node_modules/@stdlib/plot/vega/scale/linear/lib/main.js new file mode 100644 index 000000000000..8f61c823cbed --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/scale/linear/lib/main.js @@ -0,0 +1,119 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var isObject = require( '@stdlib/assert/is-object' ); +var hasProp = require( '@stdlib/assert/has-property' ); +var setReadWriteAccessor = require( '@stdlib/utils/define-read-write-accessor' ); +var setReadOnly = require( '@stdlib/utils/define-nonenumerable-read-only-property' ); +var inherit = require( '@stdlib/utils/inherit' ); +var QuantitativeScale = require( '@stdlib/plot/vega/scale/quantitative' ); +var format = require( '@stdlib/string/format' ); +var TYPE = require( './type/type.js' ); +var getType = require( './type/get.js' ); +var setType = require( './type/set.js' ); + + +// MAIN // + +/** +* Linear scale constructor. +* +* @constructor +* @param {Options} options - constructor options +* @param {string} options.name - scale name +* @param {(Collection|Object|Signal)} [options.bins] - bin boundaries over the scale domain +* @param {boolean} [options.clamp=false] - boolean indicating whether to clamp output values to the scale range +* @param {(Collection|Object|Signal)} [options.domain] - domain of associated data values +* @param {number} [options.domainMax] - maximum value in the scale domain (overrides the `domain` option) +* @param {number} [options.domainMin] - minimum value in the scale domain (overrides the `domain` option) +* @param {number} [options.domainMid] - single mid-point value inserted into a two-element domain +* @param {Collection} [options.domainRaw] - array of raw domain values which overrides the `domain` property +* @param {(string|Object)} [options.interpolate] - scale range interpolation method +* @param {(boolean|number|Signal)} [options.nice=false] - scale domain "nicing" +* @param {number} [options.padding] - scale domain padding (in pixels) +* @param {(Collection|Object|Signal|string)} [options.range] - scale range +* @param {boolean} [options.reverse=false] - boolean indicating whether to reverse the order of the scale range +* @param {boolean} [options.round=false] - boolean indicating whether to round numeric output values to integers +* @param {boolean} [options.zero] - boolean indicating whether the scale domain should include zero +* @throws {TypeError} options argument must be an object +* @throws {Error} must provide valid options +* @returns {LinearScale} scale instance +* +* @example +* var scale = new LinearScale({ +* 'name': 'xScale' +* }); +* // returns <LinearScale> +*/ +function LinearScale( options ) { + if ( !( this instanceof LinearScale ) ) { + return new LinearScale( options ); + } + if ( !isObject( options ) ) { + throw new TypeError( format( 'invalid argument. Options argument must be an object. Value: `%s`.', options ) ); + } + if ( hasProp( options, 'type' ) && options.type !== TYPE ) { + throw new TypeError( format( 'invalid argument. `%s` option must be equal to "%s". Option: `%s`.', 'type', TYPE, options.type ) ); + } + QuantitativeScale.call( this, options ); + this._type = TYPE; + return this; +} + +/* +* Inherit from a parent prototype. +*/ +inherit( LinearScale, QuantitativeScale ); + +/** +* Constructor name. +* +* @private +* @name name +* @memberof LinearScale +* @readonly +* @type {string} +*/ +setReadOnly( LinearScale, 'name', 'LinearScale' ); + +/** +* Scale type. +* +* @name type +* @memberof LinearScale.prototype +* @type {string} +* @default 'linear' +* +* @example +* var scale = new LinearScale({ +* 'name': 'xScale' +* }); +* +* var v = scale.type; +* // returns 'linear' +*/ +setReadWriteAccessor( LinearScale.prototype, 'type', getType, setType ); + + +// EXPORTS // + +module.exports = LinearScale; diff --git a/lib/node_modules/@stdlib/plot/vega/scale/linear/lib/type/get.js b/lib/node_modules/@stdlib/plot/vega/scale/linear/lib/type/get.js new file mode 100644 index 000000000000..8f5ecbfba703 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/scale/linear/lib/type/get.js @@ -0,0 +1,41 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var TYPE = require( './type.js' ); + + +// MAIN // + +/** +* Returns the scale type. +* +* @private +* @returns {string} scale type +*/ +function get() { + return TYPE; +} + + +// EXPORTS // + +module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/vega/scale/linear/lib/type/set.js b/lib/node_modules/@stdlib/plot/vega/scale/linear/lib/type/set.js new file mode 100644 index 000000000000..8690534fdb51 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/scale/linear/lib/type/set.js @@ -0,0 +1,46 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var format = require( '@stdlib/string/format' ); +var TYPE = require( './type.js' ); + + +// MAIN // + +/** +* Sets the scale type. +* +* @private +* @param {string} value - input value +* @throws {TypeError} must be a valid scale +* @returns {void} +*/ +function set( value ) { + if ( value !== TYPE ) { + throw new TypeError( format( 'invalid assignment. `%s` must be equal to "%s". Value: `%s`.', 'type', TYPE, value ) ); + } +} + + +// EXPORTS // + +module.exports = set; diff --git a/lib/node_modules/@stdlib/plot/vega/scale/linear/lib/type/type.js b/lib/node_modules/@stdlib/plot/vega/scale/linear/lib/type/type.js new file mode 100644 index 000000000000..cfe92cdc9122 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/scale/linear/lib/type/type.js @@ -0,0 +1,23 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// EXPORTS // + +module.exports = 'linear'; diff --git a/lib/node_modules/@stdlib/plot/vega/scale/linear/package.json b/lib/node_modules/@stdlib/plot/vega/scale/linear/package.json new file mode 100644 index 000000000000..487040afc82b --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/scale/linear/package.json @@ -0,0 +1,62 @@ +{ + "name": "@stdlib/plot/vega/scale/linear", + "version": "0.0.0", + "description": "Linear scale constructor.", + "license": "Apache-2.0", + "author": { + "name": "The Stdlib Authors", + "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" + }, + "contributors": [ + { + "name": "The Stdlib Authors", + "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" + } + ], + "main": "./lib", + "directories": { + "benchmark": "./benchmark", + "doc": "./docs", + "example": "./examples", + "lib": "./lib", + "test": "./test" + }, + "types": "./docs/types", + "scripts": {}, + "homepage": "https://github.com/stdlib-js/stdlib", + "repository": { + "type": "git", + "url": "git://github.com/stdlib-js/stdlib.git" + }, + "bugs": { + "url": "https://github.com/stdlib-js/stdlib/issues" + }, + "dependencies": {}, + "devDependencies": {}, + "engines": { + "node": ">=0.10.0", + "npm": ">2.7.0" + }, + "os": [ + "aix", + "darwin", + "freebsd", + "linux", + "macos", + "openbsd", + "sunos", + "win32", + "windows" + ], + "keywords": [ + "stdlib", + "plot", + "vega", + "scale", + "quantitative", + "linear", + "constructor", + "ctor" + ], + "__stdlib__": {} +} diff --git a/lib/node_modules/@stdlib/plot/vega/scale/log/examples/index.js b/lib/node_modules/@stdlib/plot/vega/scale/log/examples/index.js new file mode 100644 index 000000000000..1ccffd1c8abb --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/scale/log/examples/index.js @@ -0,0 +1,27 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +var LogScale = require( './../lib' ); + +var scale = new LogScale({ + 'name': 'xScale' +}); + +console.log( scale.toJSON() ); diff --git a/lib/node_modules/@stdlib/plot/vega/scale/log/lib/base/get.js b/lib/node_modules/@stdlib/plot/vega/scale/log/lib/base/get.js new file mode 100644 index 000000000000..04b7cb0aad33 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/scale/log/lib/base/get.js @@ -0,0 +1,43 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable no-invalid-this */ + +'use strict'; + +// MODULES // + +var prop = require( './properties.js' ); + + +// MAIN // + +/** +* Returns the base which is used by the scale when computing the logarithm. +* +* @private +* @returns {number} base of the logarithm +*/ +function get() { + return this[ prop.private ]; +} + + +// EXPORTS // + +module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/vega/scale/log/lib/base/properties.js b/lib/node_modules/@stdlib/plot/vega/scale/log/lib/base/properties.js new file mode 100644 index 000000000000..67fe3136eaa6 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/scale/log/lib/base/properties.js @@ -0,0 +1,33 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var property2object = require( '@stdlib/plot/vega/base/property2object' ); + + +// MAIN // + +var obj = property2object( 'base' ); + + +// EXPORTS // + +module.exports = obj; diff --git a/lib/node_modules/@stdlib/plot/vega/scale/log/lib/base/set.js b/lib/node_modules/@stdlib/plot/vega/scale/log/lib/base/set.js new file mode 100644 index 000000000000..19f0db1e80b1 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/scale/log/lib/base/set.js @@ -0,0 +1,61 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable no-invalid-this */ + +'use strict'; + +// MODULES // + +var logger = require( 'debug' ); +var isFiniteNumber = require( '@stdlib/assert/is-finite' ).isPrimitive; +var format = require( '@stdlib/string/format' ); +var changeEvent = require( './../change_event.js' ); +var prop = require( './properties.js' ); + + +// VARIABLES // + +var debug = logger( 'vega:log-scale:set:'+prop.name ); + + +// MAIN // + +/** +* Sets the base which is used by the scale when computing the logarithm. +* +* @private +* @param {number} value - input value +* @throws {TypeError} must be a finite number +* @returns {void} +*/ +function set( value ) { + if ( !isFiniteNumber( value ) ) { + throw new TypeError( format( 'invalid assignment. `%s` must be a finite number. Value: `%s`.', prop.name, value ) ); + } + if ( value !== this[ prop.private ] ) { + debug( 'Current value: %s. New value: %s.', this[ prop.private ], value ); + this[ prop.private ] = value; + this.emit( 'change', changeEvent( prop.name ) ); + } +} + + +// EXPORTS // + +module.exports = set; diff --git a/lib/node_modules/@stdlib/plot/vega/scale/log/lib/change_event.js b/lib/node_modules/@stdlib/plot/vega/scale/log/lib/change_event.js new file mode 100644 index 000000000000..55baae0c617a --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/scale/log/lib/change_event.js @@ -0,0 +1,41 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MAIN // + +/** +* Returns a new change event object. +* +* @private +* @param {string} property - property name +* @returns {Object} event object +*/ +function event( property ) { // eslint-disable-line stdlib/no-redeclare + return { + 'type': 'update', + 'source': 'scale', + 'property': property + }; +} + + +// EXPORTS // + +module.exports = event; diff --git a/lib/node_modules/@stdlib/plot/vega/scale/log/lib/defaults.js b/lib/node_modules/@stdlib/plot/vega/scale/log/lib/defaults.js new file mode 100644 index 000000000000..5135f9f2d19f --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/scale/log/lib/defaults.js @@ -0,0 +1,43 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MAIN // + +/** +* Returns defaults. +* +* @private +* @returns {Object} default options +* +* @example +* var o = defaults(); +* // returns {...} +*/ +function defaults() { + return { + // Base of the logarithm: + 'base': 10 + }; +} + + +// EXPORTS // + +module.exports = defaults; diff --git a/lib/node_modules/@stdlib/plot/vega/scale/log/lib/index.js b/lib/node_modules/@stdlib/plot/vega/scale/log/lib/index.js new file mode 100644 index 000000000000..4a3c65a8d412 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/scale/log/lib/index.js @@ -0,0 +1,42 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +/** +* Logarithmic scale constructor. +* +* @module @stdlib/plot/vega/scale/log +* +* @example +* var LogScale = require( '@stdlib/plot/vega/scale/log' ); +* +* var scale = new LogScale({ +* 'name': 'xScale' +* }); +* // returns <LogScale> +*/ + +// MODULES // + +var main = require( './main.js' ); + + +// EXPORTS // + +module.exports = main; diff --git a/lib/node_modules/@stdlib/plot/vega/scale/log/lib/main.js b/lib/node_modules/@stdlib/plot/vega/scale/log/lib/main.js new file mode 100644 index 000000000000..99a354f5b042 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/scale/log/lib/main.js @@ -0,0 +1,238 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable no-restricted-syntax, no-invalid-this */ + +'use strict'; + +// MODULES // + +var logger = require( 'debug' ); +var isObject = require( '@stdlib/assert/is-object' ); +var hasProp = require( '@stdlib/assert/has-property' ); +var setReadWriteAccessor = require( '@stdlib/utils/define-read-write-accessor' ); +var setNonEnumerableReadOnly = require( '@stdlib/utils/define-nonenumerable-read-only-property' ); +var setNonEnumerableReadOnlyAccessor = require( '@stdlib/utils/define-nonenumerable-read-only-accessor' ); // eslint-disable-line id-length +var inherit = require( '@stdlib/utils/inherit' ); +var objectKeys = require( '@stdlib/utils/keys' ); +var QuantitativeScale = require( '@stdlib/plot/vega/scale/quantitative' ); +var transformErrorMessage = require( '@stdlib/plot/vega/base/transform-validation-message' ); +var instance2json = require( '@stdlib/plot/vega/base/to-json' ); +var format = require( '@stdlib/string/format' ); +var properties = require( './properties.json' ); +var defaults = require( './defaults.js' ); +var TYPE = require( './type/type.js' ); + +// Note: keep the following in alphabetical order according to the `require` path... +var getBase = require( './base/get.js' ); +var setBase = require( './base/set.js' ); + +var getProperties = require( './properties/get.js' ); + +var getType = require( './type/get.js' ); +var setType = require( './type/set.js' ); + + +// VARIABLES // + +var debug = logger( 'vega:log-scale:main' ); + + +// MAIN // + +/** +* Logarithmic scale constructor. +* +* @constructor +* @param {Options} options - constructor options +* @param {string} options.name - scale name +* @param {number} [options.base=10] - base of the logarithm +* @param {(Collection|Object|Signal)} [options.bins] - bin boundaries over the scale domain +* @param {boolean} [options.clamp=false] - boolean indicating whether to clamp output values to the scale range +* @param {(Collection|Object|Signal)} [options.domain] - domain of associated data values +* @param {number} [options.domainMax] - maximum value in the scale domain (overrides the `domain` option) +* @param {number} [options.domainMin] - minimum value in the scale domain (overrides the `domain` option) +* @param {number} [options.domainMid] - single mid-point value inserted into a two-element domain +* @param {Collection} [options.domainRaw] - array of raw domain values which overrides the `domain` property +* @param {(string|Object)} [options.interpolate] - scale range interpolation method +* @param {(boolean|number|Signal)} [options.nice=false] - scale domain "nicing" +* @param {number} [options.padding] - scale domain padding (in pixels) +* @param {(Collection|Object|Signal|string)} [options.range] - scale range +* @param {boolean} [options.reverse=false] - boolean indicating whether to reverse the order of the scale range +* @param {boolean} [options.round=false] - boolean indicating whether to round numeric output values to integers +* @param {boolean} [options.zero] - boolean indicating whether the scale domain should include zero +* @throws {TypeError} options argument must be an object +* @throws {Error} must provide valid options +* @returns {LogScale} scale instance +* +* @example +* var scale = new LogScale({ +* 'name': 'xScale' +* }); +* // returns <LogScale> +*/ +function LogScale( options ) { + var opts; + var keys; + var v; + var k; + var i; + if ( !( this instanceof LogScale ) ) { + return new LogScale( options ); + } + if ( !isObject( options ) ) { + throw new TypeError( format( 'invalid argument. Options argument must be an object. Value: `%s`.', options ) ); + } + if ( hasProp( options, 'type' ) && options.type !== TYPE ) { + throw new TypeError( format( 'invalid argument. `%s` option must be equal to "%s". Option: `%s`.', 'type', TYPE, options.type ) ); + } + // Check for required properties... + if ( !hasProp( options, 'name' ) ) { + throw new TypeError( 'invalid argument. Options argument must specify the scale name.' ); + } + QuantitativeScale.call( this, { + 'name': options.name + }); + this._type = TYPE; + + // Resolve the default configuration: + opts = defaults(); + + // Set internal properties according to the default configuration... + keys = objectKeys( opts ); + for ( i = 0; i < keys.length; i++ ) { + k = keys[ i ]; + this[ '_'+k ] = opts[ k ]; + } + // Validate provided options by attempting to assign option values to corresponding fields... + for ( i = 0; i < properties.length; i++ ) { + k = properties[ i ]; + if ( !hasProp( options, k ) ) { + continue; + } + v = options[ k ]; + try { + this[ k ] = v; + } catch ( err ) { + debug( 'Encountered an error. Error: %s', err.message ); + + // FIXME: retain thrown error type + throw new Error( transformErrorMessage( err.message ) ); + } + } + return this; +} + +/* +* Inherit from a parent prototype. +*/ +inherit( LogScale, QuantitativeScale ); + +/** +* Constructor name. +* +* @private +* @name name +* @memberof LogScale +* @readonly +* @type {string} +*/ +setNonEnumerableReadOnly( LogScale, 'name', 'LogScale' ); + +/** +* Base which is used by the scale when computing the logarithm. +* +* @name base +* @memberof LogScale.prototype +* @type {number} +* @default 10 +* +* @example +* var scale = new LogScale({ +* 'name': 'xScale', +* 'base': 2 +* }); +* +* var v = scale.base; +* // returns 2 +*/ +setReadWriteAccessor( LogScale.prototype, 'base', getBase, setBase ); + +/** +* Scale properties. +* +* @name properties +* @memberof LogScale.prototype +* @type {Array<string>} +* +* @example +* var scale = new LogScale({ +* 'name': 'xScale' +* }); +* +* var v = scale.properties; +* // returns [...] +*/ +setNonEnumerableReadOnlyAccessor( LogScale.prototype, 'properties', getProperties ); + +/** +* Scale type. +* +* @name type +* @memberof LogScale.prototype +* @type {string} +* @default 'log' +* +* @example +* var scale = new LogScale({ +* 'name': 'xScale' +* }); +* +* var v = scale.type; +* // returns 'log' +*/ +setReadWriteAccessor( LogScale.prototype, 'type', getType, setType ); + +/** +* Serializes an instance to a JSON object. +* +* ## Notes +* +* - This method is implicitly invoked by `JSON.stringify`. +* +* @name toJSON +* @memberof LogScale.prototype +* @type {Function} +* @returns {Object} JSON object +* +* @example +* var scale = new LogScale({ +* 'name': 'xScale' +* }); +* +* var v = scale.toJSON(); +* // returns {...} +*/ +setNonEnumerableReadOnly( LogScale.prototype, 'toJSON', function toJSON() { + return instance2json( this, properties ); +}); + + +// EXPORTS // + +module.exports = LogScale; diff --git a/lib/node_modules/@stdlib/plot/vega/scale/log/lib/properties.json b/lib/node_modules/@stdlib/plot/vega/scale/log/lib/properties.json new file mode 100644 index 000000000000..847343f70aeb --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/scale/log/lib/properties.json @@ -0,0 +1,21 @@ +[ + "domain", + "domainMax", + "domainMin", + "domainMid", + "domainRaw", + "interpolate", + "name", + "range", + "reverse", + "round", + "type", + + "bins", + "clamp", + "padding", + "nice", + "zero", + + "base" +] diff --git a/lib/node_modules/@stdlib/plot/vega/scale/log/lib/properties/get.js b/lib/node_modules/@stdlib/plot/vega/scale/log/lib/properties/get.js new file mode 100644 index 000000000000..8fc57de14e90 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/scale/log/lib/properties/get.js @@ -0,0 +1,41 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var properties = require( './../properties.json' ); + + +// MAIN // + +/** +* Returns the list of enumerable properties. +* +* @private +* @returns {Array<string>} properties +*/ +function get() { + return properties.slice(); +} + + +// EXPORTS // + +module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/vega/scale/log/lib/type/get.js b/lib/node_modules/@stdlib/plot/vega/scale/log/lib/type/get.js new file mode 100644 index 000000000000..8f5ecbfba703 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/scale/log/lib/type/get.js @@ -0,0 +1,41 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var TYPE = require( './type.js' ); + + +// MAIN // + +/** +* Returns the scale type. +* +* @private +* @returns {string} scale type +*/ +function get() { + return TYPE; +} + + +// EXPORTS // + +module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/vega/scale/log/lib/type/set.js b/lib/node_modules/@stdlib/plot/vega/scale/log/lib/type/set.js new file mode 100644 index 000000000000..8690534fdb51 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/scale/log/lib/type/set.js @@ -0,0 +1,46 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var format = require( '@stdlib/string/format' ); +var TYPE = require( './type.js' ); + + +// MAIN // + +/** +* Sets the scale type. +* +* @private +* @param {string} value - input value +* @throws {TypeError} must be a valid scale +* @returns {void} +*/ +function set( value ) { + if ( value !== TYPE ) { + throw new TypeError( format( 'invalid assignment. `%s` must be equal to "%s". Value: `%s`.', 'type', TYPE, value ) ); + } +} + + +// EXPORTS // + +module.exports = set; diff --git a/lib/node_modules/@stdlib/plot/vega/scale/log/lib/type/type.js b/lib/node_modules/@stdlib/plot/vega/scale/log/lib/type/type.js new file mode 100644 index 000000000000..926ccfe4f2f5 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/scale/log/lib/type/type.js @@ -0,0 +1,23 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// EXPORTS // + +module.exports = 'log'; diff --git a/lib/node_modules/@stdlib/plot/vega/scale/log/package.json b/lib/node_modules/@stdlib/plot/vega/scale/log/package.json new file mode 100644 index 000000000000..73fa69fc0eac --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/scale/log/package.json @@ -0,0 +1,63 @@ +{ + "name": "@stdlib/plot/vega/scale/log", + "version": "0.0.0", + "description": "Logarithmic scale constructor.", + "license": "Apache-2.0", + "author": { + "name": "The Stdlib Authors", + "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" + }, + "contributors": [ + { + "name": "The Stdlib Authors", + "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" + } + ], + "main": "./lib", + "directories": { + "benchmark": "./benchmark", + "doc": "./docs", + "example": "./examples", + "lib": "./lib", + "test": "./test" + }, + "types": "./docs/types", + "scripts": {}, + "homepage": "https://github.com/stdlib-js/stdlib", + "repository": { + "type": "git", + "url": "git://github.com/stdlib-js/stdlib.git" + }, + "bugs": { + "url": "https://github.com/stdlib-js/stdlib/issues" + }, + "dependencies": {}, + "devDependencies": {}, + "engines": { + "node": ">=0.10.0", + "npm": ">2.7.0" + }, + "os": [ + "aix", + "darwin", + "freebsd", + "linux", + "macos", + "openbsd", + "sunos", + "win32", + "windows" + ], + "keywords": [ + "stdlib", + "plot", + "vega", + "scale", + "quantitative", + "log", + "logarithm", + "constructor", + "ctor" + ], + "__stdlib__": {} +} diff --git a/lib/node_modules/@stdlib/plot/vega/scale/named/examples/index.js b/lib/node_modules/@stdlib/plot/vega/scale/named/examples/index.js new file mode 100644 index 000000000000..ea4e5387ab98 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/scale/named/examples/index.js @@ -0,0 +1,27 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +var namedScale = require( './../lib' ); + +var xScale = namedScale.factory( 'linear', 'xScale' ); +// returns <Function> + +var scale = xScale(); +console.log( scale.toJSON() ); diff --git a/lib/node_modules/@stdlib/plot/vega/scale/named/lib/factory.js b/lib/node_modules/@stdlib/plot/vega/scale/named/lib/factory.js new file mode 100644 index 000000000000..9c5eb0bc5b64 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/scale/named/lib/factory.js @@ -0,0 +1,90 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var hasProp = require( '@stdlib/assert/has-property' ); +var isScaleName = require( '@stdlib/plot/vega/base/assert/is-scale-name' ); +var isString = require( '@stdlib/assert/is-string' ).isPrimitive; +var objectAssignIn = require( '@stdlib/object/assign-in' ); +var join = require( '@stdlib/array/base/join' ); +var ctors = require( '@stdlib/plot/vega/scale/ctors' ); +var scaleNames = require( '@stdlib/plot/vega/scale/names' ); +var format = require( '@stdlib/string/format' ); + + +// MAIN // + +/** +* Returns a function for creating a named scale. +* +* @param {string} type - scale type +* @param {string} name - default scale name +* @throws {TypeError} first argument must be a supported scale type +* @throws {TypeError} second argument must be a string +* @returns {Function} function for creating a named scale +* +* @example +* var xScale = factory( 'linear', 'xScale' ); +* +* var scale = xScale(); +* // returns <LinearScale> +*/ +function factory( type, name ) { + var defaults; + var ctor; + if ( !isScaleName( type ) ) { + throw new TypeError( format( 'invalid argument. First argument must be one of the following: "%s". Value: `%s`.', join( scaleNames(), ', ' ), type ) ); + } + if ( !isString( name ) ) { + throw new TypeError( format( 'invalid argument. Second argument must be a string. Value: `%s`.', name ) ); + } + ctor = ctors( type ); + defaults = { + 'name': name + }; + return createScale; + + /** + * Returns a named scale. + * + * @private + * @param {Options} [options] - function options + * @throws {TypeError} options argument must be an object + * @throws {Error} must provide valid options + * @returns {Scale} scale instance + */ + function createScale( options ) { + var opts; + if ( arguments.length ) { + opts = objectAssignIn( {}, options ); + if ( !hasProp( opts, 'name' ) ) { + opts.name = defaults.name; + } + return new ctor( opts ); + } + return new ctor( defaults ); + } +} + + +// EXPORTS // + +module.exports = factory; diff --git a/lib/node_modules/@stdlib/plot/vega/scale/named/lib/index.js b/lib/node_modules/@stdlib/plot/vega/scale/named/lib/index.js new file mode 100644 index 000000000000..dc50676a8cfa --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/scale/named/lib/index.js @@ -0,0 +1,57 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +/** +* Create a named scale. +* +* @module @stdlib/plot/vega/scale/named +* +* @example +* var namedScale = require( '@stdlib/plot/vega/scale/named' ); +* +* var scale = namedScale( 'linear', 'xScale' ); +* // returns <LinearScale> +* +* @example +* var namedScale = require( '@stdlib/plot/vega/scale/named' ); +* +* var xScale = namedScale.factory( 'linear', 'xScale' ); +* +* var scale = xScale(); +* // returns <LinearScale> +*/ + +// MODULES // + +var setReadOnly = require( '@stdlib/utils/define-nonenumerable-read-only-property' ); +var factory = require( './factory.js' ); +var main = require( './main.js' ); + + +// MAIN // + +setReadOnly( main, 'factory', factory ); + + +// EXPORTS // + +module.exports = main; + +// exports: { "factory": "main.factory" } diff --git a/lib/node_modules/@stdlib/plot/vega/scale/named/lib/main.js b/lib/node_modules/@stdlib/plot/vega/scale/named/lib/main.js new file mode 100644 index 000000000000..9b8edee14960 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/scale/named/lib/main.js @@ -0,0 +1,54 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var factory = require( './factory.js' ); + + +// MAIN // + +/** +* Returns a named scale. +* +* @param {string} type - scale type +* @param {string} name - scale name +* @param {Options} [options] - function options +* @throws {TypeError} first argument must be a supported scale type +* @throws {TypeError} second argument must be a string +* @throws {TypeError} options argument must be an object +* @throws {Error} must provide valid options +* @returns {Scale} scale instance +* +* @example +* var scale = namedScale( 'linear', 'xScale'); +* // returns <LinearScale> +*/ +function namedScale( type, name, options ) { + if ( arguments.length < 3 ) { + return factory( type, name )(); + } + return factory( type, name )( options ); +} + + +// EXPORTS // + +module.exports = namedScale; diff --git a/lib/node_modules/@stdlib/plot/vega/scale/named/package.json b/lib/node_modules/@stdlib/plot/vega/scale/named/package.json new file mode 100644 index 000000000000..4ab6318704b9 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/scale/named/package.json @@ -0,0 +1,59 @@ +{ + "name": "@stdlib/plot/vega/scale/named", + "version": "0.0.0", + "description": "Create a named scale.", + "license": "Apache-2.0", + "author": { + "name": "The Stdlib Authors", + "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" + }, + "contributors": [ + { + "name": "The Stdlib Authors", + "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" + } + ], + "main": "./lib", + "directories": { + "benchmark": "./benchmark", + "doc": "./docs", + "example": "./examples", + "lib": "./lib", + "test": "./test" + }, + "types": "./docs/types", + "scripts": {}, + "homepage": "https://github.com/stdlib-js/stdlib", + "repository": { + "type": "git", + "url": "git://github.com/stdlib-js/stdlib.git" + }, + "bugs": { + "url": "https://github.com/stdlib-js/stdlib/issues" + }, + "dependencies": {}, + "devDependencies": {}, + "engines": { + "node": ">=0.10.0", + "npm": ">2.7.0" + }, + "os": [ + "aix", + "darwin", + "freebsd", + "linux", + "macos", + "openbsd", + "sunos", + "win32", + "windows" + ], + "keywords": [ + "stdlib", + "plot", + "vega", + "scale", + "factory" + ], + "__stdlib__": {} +} diff --git a/lib/node_modules/@stdlib/plot/vega/scale/names/README.md b/lib/node_modules/@stdlib/plot/vega/scale/names/README.md new file mode 100644 index 000000000000..b60a748eb121 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/scale/names/README.md @@ -0,0 +1,133 @@ +<!-- + +@license Apache-2.0 + +Copyright (c) 2025 The Stdlib Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + +--> + +# scales + +> List of supported Vega scale names. + +<!-- Section to include introductory text. Make sure to keep an empty line after the intro `section` element and another before the `/section` close. --> + +<section class="intro"> + +</section> + +<!-- /.intro --> + +<!-- Package usage documentation. --> + +<section class="usage"> + +## Usage + +```javascript +var scales = require( '@stdlib/plot/vega/scale/names' ); +``` + +#### scales( \[kind] ) + +Returns a list of supported scale names. + +```javascript +var out = scales(); +// e.g., returns [ 'linear', 'log', ... ] +``` + +The function has the following parameters: + +- **kind**: scale kind. Must be one of the following: + + - `'all'`: all scales (default). + - `'quantitative'`: quantitative scales. + - `'discrete'`: discrete scales. + - `'discreting'`: scales which split a continuous domain into discrete segments. + +By default, the function returns all supported scales. To support only those scales of a specified kind, provide a `kind` argument. + +```javascript +var out = scales( 'discrete' ); +// e.g., returns [ 'ordinal', 'band', 'point' ] +``` + +</section> + +<!-- /.usage --> + +<!-- Package usage notes. Make sure to keep an empty line after the `section` element and another before the `/section` close. --> + +<section class="notes"> + +</section> + +<!-- /.notes --> + +<!-- Package usage examples. --> + +<section class="examples"> + +## Examples + +<!-- eslint no-undef: "error" --> + +```javascript +var contains = require( '@stdlib/array/base/assert/contains' ).factory; +var scales = require( '@stdlib/plot/vega/scale/names' ); + +var isScale = contains( scales() ); + +var bool = isScale( 'linear' ); +// returns true + +bool = isScale( 'log' ); +// returns true + +bool = isScale( 'beep' ); +// returns false + +bool = isScale( 'boop' ); +// returns false +``` + +</section> + +<!-- /.examples --> + +<!-- Section to include cited references. If references are included, add a horizontal rule *before* the section. Make sure to keep an empty line after the `section` element and another before the `/section` close. --> + +<section class="references"> + +</section> + +<!-- /.references --> + +<!-- Section for related `stdlib` packages. Do not manually edit this section, as it is automatically populated. --> + +<section class="related"> + +</section> + +<!-- /.related --> + +<!-- Section for all links. Make sure to keep an empty line after the `section` element and another before the `/section` close. --> + +<section class="links"> + +</section> + +<!-- /.links --> diff --git a/lib/node_modules/@stdlib/plot/vega/scale/names/benchmark/benchmark.js b/lib/node_modules/@stdlib/plot/vega/scale/names/benchmark/benchmark.js new file mode 100644 index 000000000000..e1068e2e27ab --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/scale/names/benchmark/benchmark.js @@ -0,0 +1,105 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var bench = require( '@stdlib/bench' ); +var isStringArray = require( '@stdlib/assert/is-string-array' ).primitives; +var pkg = require( './../package.json' ).name; +var scales = require( './../lib' ); + + +// MAIN // + +bench( pkg, function benchmark( b ) { + var out; + var i; + + b.tic(); + for ( i = 0; i < b.iterations; i++ ) { + out = scales(); + if ( out.length < 2 ) { + b.fail( 'should return an array' ); + } + } + b.toc(); + if ( !isStringArray( out ) ) { + b.fail( 'should return an array of strings' ); + } + b.pass( 'benchmark finished' ); + b.end(); +}); + +bench( pkg+':kind=quantitative', function benchmark( b ) { + var out; + var i; + + b.tic(); + for ( i = 0; i < b.iterations; i++ ) { + out = scales( 'quantitative' ); + if ( out.length < 2 ) { + b.fail( 'should return an array' ); + } + } + b.toc(); + if ( !isStringArray( out ) ) { + b.fail( 'should return an array of strings' ); + } + b.pass( 'benchmark finished' ); + b.end(); +}); + +bench( pkg+':kind=discrete', function benchmark( b ) { + var out; + var i; + + b.tic(); + for ( i = 0; i < b.iterations; i++ ) { + out = scales( 'discrete' ); + if ( out.length < 2 ) { + b.fail( 'should return an array' ); + } + } + b.toc(); + if ( !isStringArray( out ) ) { + b.fail( 'should return an array of strings' ); + } + b.pass( 'benchmark finished' ); + b.end(); +}); + +bench( pkg+':kind=discretizing', function benchmark( b ) { + var out; + var i; + + b.tic(); + for ( i = 0; i < b.iterations; i++ ) { + out = scales( 'discretizing' ); + if ( out.length < 2 ) { + b.fail( 'should return an array' ); + } + } + b.toc(); + if ( !isStringArray( out ) ) { + b.fail( 'should return an array of strings' ); + } + b.pass( 'benchmark finished' ); + b.end(); +}); diff --git a/lib/node_modules/@stdlib/plot/vega/scale/names/docs/repl.txt b/lib/node_modules/@stdlib/plot/vega/scale/names/docs/repl.txt new file mode 100644 index 000000000000..2ec0d40dcffb --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/scale/names/docs/repl.txt @@ -0,0 +1,30 @@ + +{{alias}}( [kind] ) + Returns a list of supported scale names. + + Parameters + ---------- + kind: string (optional) + Scale kind. Must be one of the following: + + - all: all scales (default). + - quantitative: quantitative scales. + - discrete: discrete scales. + - discretizing: scales which split a continuous domain into discrete + segments. + + Returns + ------- + out: Array<string> + List of scale names. + + Examples + -------- + > var out = {{alias}}() + e.g., [ 'linear', 'log', ... ] + > out = {{alias}}( 'discrete' ) + [ 'ordinal', 'band', ... ] + + See Also + -------- + diff --git a/lib/node_modules/@stdlib/plot/vega/scale/names/docs/types/index.d.ts b/lib/node_modules/@stdlib/plot/vega/scale/names/docs/types/index.d.ts new file mode 100644 index 000000000000..bd69d524484d --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/scale/names/docs/types/index.d.ts @@ -0,0 +1,45 @@ +/* +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +// TypeScript Version: 4.1 + +/** +* Scale kind. +*/ +type ScaleKind = 'all' | 'quantitative' | 'discrete' | 'discretizing'; + +/** +* Returns a list of supported scale names. +* +* @param kind - scale kind +* @returns list of scale names +* +* @example +* var out = scales(); +* // e.g., returns [ 'linear', 'log', ... ] +* +* @example +* var list = scales( 'discrete' ); +* // e.g., returns [ 'ordinal', 'band', ... ] +*/ +declare function scales( kind?: ScaleKind ): Array<string>; + + +// EXPORTS // + +export = scales; diff --git a/lib/node_modules/@stdlib/plot/vega/scale/names/docs/types/test.ts b/lib/node_modules/@stdlib/plot/vega/scale/names/docs/types/test.ts new file mode 100644 index 000000000000..43ee831aff0f --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/scale/names/docs/types/test.ts @@ -0,0 +1,51 @@ +/* +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +import scales = require( './index' ); + + +// TESTS // + +// The function returns an array of strings when not provided any arguments... +{ + scales(); // $ExpectType string[] +} + +// The function returns an array of strings when provided a recognized scale kind... +{ + scales( 'all' ); // $ExpectType string[] + scales( 'quantitative' ); // $ExpectType string[] + scales( 'discrete' ); // $ExpectType string[] + scales( 'discretizing' ); // $ExpectType string[] +} + +// The compiler throws an error if the function is provided an invalid first argument... +{ + scales( 5 ); // $ExpectError + scales( true ); // $ExpectError + scales( false ); // $ExpectError + scales( null ); // $ExpectError + scales( [] ); // $ExpectError + scales( {} ); // $ExpectError + scales( ( x: number ): number => x ); // $ExpectError +} + +// The compiler throws an error if the function is provided an unsupported number of arguments... +{ + scales( 'quantitative', {} ); // $ExpectError +} diff --git a/lib/node_modules/@stdlib/plot/vega/scale/names/examples/index.js b/lib/node_modules/@stdlib/plot/vega/scale/names/examples/index.js new file mode 100644 index 000000000000..53a04460aa51 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/scale/names/examples/index.js @@ -0,0 +1,40 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +var contains = require( '@stdlib/array/base/assert/contains' ).factory; +var scales = require( './../lib' ); + +var isScale = contains( scales() ); + +var bool = isScale( 'linear' ); +console.log( bool ); +// => true + +bool = isScale( 'log' ); +console.log( bool ); +// => true + +bool = isScale( 'beep' ); +console.log( bool ); +// => false + +bool = isScale( 'boop' ); +console.log( bool ); +// => false diff --git a/lib/node_modules/@stdlib/plot/vega/scale/names/lib/data.json b/lib/node_modules/@stdlib/plot/vega/scale/names/lib/data.json new file mode 100644 index 000000000000..ff09be86b78d --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/scale/names/lib/data.json @@ -0,0 +1,40 @@ +{ + "all": [ + "linear", + "log", + "pow", + "sqrt", + "symlog", + "time", + "utc", + + "ordinal", + "band", + "point", + + "quantile", + "quantize", + "threshold", + "bin-ordinal" + ], + "quantitative": [ + "linear", + "log", + "pow", + "sqrt", + "symlog", + "time", + "utc" + ], + "discrete": [ + "ordinal", + "band", + "point" + ], + "discretizing": [ + "quantile", + "quantize", + "threshold", + "bin-ordinal" + ] +} diff --git a/lib/node_modules/@stdlib/plot/vega/scale/names/lib/index.js b/lib/node_modules/@stdlib/plot/vega/scale/names/lib/index.js new file mode 100644 index 000000000000..b7699900811b --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/scale/names/lib/index.js @@ -0,0 +1,40 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +/** +* Return a list of supported scale names. +* +* @module @stdlib/plot/vega/scale/names +* +* @example +* var scales = require( '@stdlib/plot/vega/scale/names' ); +* +* var out = scales(); +* // e.g., returns [ 'linear', 'log', ... ] +*/ + +// MODULES // + +var main = require( './main.js' ); + + +// EXPORTS // + +module.exports = main; diff --git a/lib/node_modules/@stdlib/plot/vega/scale/names/lib/main.js b/lib/node_modules/@stdlib/plot/vega/scale/names/lib/main.js new file mode 100644 index 000000000000..4b3f085b8996 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/scale/names/lib/main.js @@ -0,0 +1,54 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var DATA = require( './data.json' ); + + +// MAIN // + +/** +* Returns a list of supported scale names. +* +* @param {string} [kind] - scale kind +* @returns {StringArray} list of scale names +* +* @example +* var out = scales(); +* // e.g., returns [ 'linear', 'log', ... ] +* +* @example +* var list = scales( 'discrete' ); +* // e.g., returns [ 'ordinal', 'band', ... ] +*/ +function scales( kind ) { + var v; + if ( arguments.length ) { + v = DATA[ kind ]; + return ( v ) ? v.slice() : []; + } + return DATA.all.slice(); +} + + +// EXPORTS // + +module.exports = scales; diff --git a/lib/node_modules/@stdlib/plot/vega/scale/names/package.json b/lib/node_modules/@stdlib/plot/vega/scale/names/package.json new file mode 100644 index 000000000000..9de67984bdaf --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/scale/names/package.json @@ -0,0 +1,62 @@ +{ + "name": "@stdlib/plot/vega/scale/names", + "version": "0.0.0", + "description": "List of supported Vega scale names.", + "license": "Apache-2.0", + "author": { + "name": "The Stdlib Authors", + "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" + }, + "contributors": [ + { + "name": "The Stdlib Authors", + "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" + } + ], + "main": "./lib", + "directories": { + "benchmark": "./benchmark", + "doc": "./docs", + "example": "./examples", + "lib": "./lib", + "test": "./test" + }, + "types": "./docs/types", + "scripts": {}, + "homepage": "https://github.com/stdlib-js/stdlib", + "repository": { + "type": "git", + "url": "git://github.com/stdlib-js/stdlib.git" + }, + "bugs": { + "url": "https://github.com/stdlib-js/stdlib/issues" + }, + "dependencies": {}, + "devDependencies": {}, + "engines": { + "node": ">=0.10.0", + "npm": ">2.7.0" + }, + "os": [ + "aix", + "darwin", + "freebsd", + "linux", + "macos", + "openbsd", + "sunos", + "win32", + "windows" + ], + "keywords": [ + "stdlib", + "plot", + "vega", + "scales", + "utilities", + "utility", + "utils", + "util" + ], + "__stdlib__": {} +} diff --git a/lib/node_modules/@stdlib/plot/vega/scale/names/test/test.js b/lib/node_modules/@stdlib/plot/vega/scale/names/test/test.js new file mode 100644 index 000000000000..2a2c2b7fbee3 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/scale/names/test/test.js @@ -0,0 +1,139 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var tape = require( 'tape' ); +var scales = require( './../lib' ); + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof scales, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'the function returns a list of scales (default)', function test( t ) { + var expected; + var actual; + + expected = [ + 'linear', + 'log', + 'pow', + 'sqrt', + 'symlog', + 'time', + 'utc', + + 'ordinal', + 'band', + 'point', + + 'quantile', + 'quantize', + 'threshold', + 'bin-ordinal' + ]; + actual = scales(); + + t.deepEqual( actual, expected, 'returns expected value' ); + t.end(); +}); + +tape( 'the function returns a list of scales (kind=all)', function test( t ) { + var expected; + var actual; + + expected = [ + 'linear', + 'log', + 'pow', + 'sqrt', + 'symlog', + 'time', + 'utc', + + 'ordinal', + 'band', + 'point', + + 'quantile', + 'quantize', + 'threshold', + 'bin-ordinal' + ]; + actual = scales( 'all' ); + + t.deepEqual( actual, expected, 'returns expected value' ); + t.end(); +}); + +tape( 'the function returns a list of quantitative scales (kind=quantitative)', function test( t ) { + var expected; + var actual; + + expected = [ + 'linear', + 'log', + 'pow', + 'sqrt', + 'symlog', + 'time', + 'utc' + ]; + actual = scales( 'quantitative' ); + + t.deepEqual( actual, expected, 'returns expected value' ); + t.end(); +}); + +tape( 'the function returns a list of scales (kind=discrete)', function test( t ) { + var expected; + var actual; + + expected = [ + 'ordinal', + 'band', + 'point' + ]; + actual = scales( 'discrete' ); + + t.deepEqual( actual, expected, 'returns expected value' ); + t.end(); +}); + +tape( 'the function returns a list of scales (kind=discretizing)', function test( t ) { + var expected; + var actual; + + expected = [ + 'quantile', + 'quantize', + 'threshold', + 'bin-ordinal' + ]; + actual = scales( 'discretizing' ); + + t.deepEqual( actual, expected, 'returns expected value' ); + t.end(); +}); diff --git a/lib/node_modules/@stdlib/plot/vega/scale/ordinal/examples/index.js b/lib/node_modules/@stdlib/plot/vega/scale/ordinal/examples/index.js new file mode 100644 index 000000000000..45325870c9c2 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/scale/ordinal/examples/index.js @@ -0,0 +1,27 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +var OrdinalScale = require( './../lib' ); + +var scale = new OrdinalScale({ + 'name': 'colorScale' +}); + +console.log( scale.toJSON() ); diff --git a/lib/node_modules/@stdlib/plot/vega/scale/ordinal/lib/index.js b/lib/node_modules/@stdlib/plot/vega/scale/ordinal/lib/index.js new file mode 100644 index 000000000000..97bda391fb4f --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/scale/ordinal/lib/index.js @@ -0,0 +1,42 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +/** +* Ordinal scale constructor. +* +* @module @stdlib/plot/vega/scale/ordinal +* +* @example +* var OrdinalScale = require( '@stdlib/plot/vega/scale/ordinal' ); +* +* var scale = new OrdinalScale({ +* 'name': 'colorScale' +* }); +* // returns <OrdinalScale> +*/ + +// MODULES // + +var main = require( './main.js' ); + + +// EXPORTS // + +module.exports = main; diff --git a/lib/node_modules/@stdlib/plot/vega/scale/ordinal/lib/main.js b/lib/node_modules/@stdlib/plot/vega/scale/ordinal/lib/main.js new file mode 100644 index 000000000000..c50664db12f4 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/scale/ordinal/lib/main.js @@ -0,0 +1,110 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var isObject = require( '@stdlib/assert/is-object' ); +var hasProp = require( '@stdlib/assert/has-property' ); +var setReadWriteAccessor = require( '@stdlib/utils/define-read-write-accessor' ); +var setReadOnly = require( '@stdlib/utils/define-nonenumerable-read-only-property' ); +var inherit = require( '@stdlib/utils/inherit' ); +var Scale = require( '@stdlib/plot/vega/scale/base/ctor' ); +var format = require( '@stdlib/string/format' ); +var TYPE = require( './type/type.js' ); +var getType = require( './type/get.js' ); +var setType = require( './type/set.js' ); + + +// MAIN // + +/** +* Ordinal scale constructor. +* +* @constructor +* @param {Options} options - constructor options +* @param {string} options.name - scale name +* @param {(Collection|Object|Signal)} [options.domain] - domain of associated data values +* @param {Collection} [options.domainRaw] - array of raw domain values which overrides the `domain` property +* @param {(string|Object)} [options.interpolate] - scale range interpolation method +* @param {(Collection|Object|Signal|string)} [options.range] - scale range +* @param {boolean} [options.reverse=false] - boolean indicating whether to reverse the order of the scale range +* @throws {TypeError} options argument must be an object +* @throws {Error} must provide valid options +* @returns {OrdinalScale} scale instance +* +* @example +* var scale = new OrdinalScale({ +* 'name': 'colorScale' +* }); +* // returns <OrdinalScale> +*/ +function OrdinalScale( options ) { + if ( !( this instanceof OrdinalScale ) ) { + return new OrdinalScale( options ); + } + if ( !isObject( options ) ) { + throw new TypeError( format( 'invalid argument. Options argument must be an object. Value: `%s`.', options ) ); + } + if ( hasProp( options, 'type' ) && options.type !== TYPE ) { + throw new TypeError( format( 'invalid argument. `%s` option must be equal to "%s". Option: `%s`.', 'type', TYPE, options.type ) ); + } + Scale.call( this, options ); + this._type = TYPE; + return this; +} + +/* +* Inherit from a parent prototype. +*/ +inherit( OrdinalScale, Scale ); + +/** +* Constructor name. +* +* @private +* @name name +* @memberof OrdinalScale +* @readonly +* @type {string} +*/ +setReadOnly( OrdinalScale, 'name', 'OrdinalScale' ); + +/** +* Scale type. +* +* @name type +* @memberof OrdinalScale.prototype +* @type {string} +* @default 'ordinal' +* +* @example +* var scale = new OrdinalScale({ +* 'name': 'colorScale' +* }); +* +* var v = scale.type; +* // returns 'ordinal' +*/ +setReadWriteAccessor( OrdinalScale.prototype, 'type', getType, setType ); + + +// EXPORTS // + +module.exports = OrdinalScale; diff --git a/lib/node_modules/@stdlib/plot/vega/scale/ordinal/lib/type/get.js b/lib/node_modules/@stdlib/plot/vega/scale/ordinal/lib/type/get.js new file mode 100644 index 000000000000..8f5ecbfba703 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/scale/ordinal/lib/type/get.js @@ -0,0 +1,41 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var TYPE = require( './type.js' ); + + +// MAIN // + +/** +* Returns the scale type. +* +* @private +* @returns {string} scale type +*/ +function get() { + return TYPE; +} + + +// EXPORTS // + +module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/vega/scale/ordinal/lib/type/set.js b/lib/node_modules/@stdlib/plot/vega/scale/ordinal/lib/type/set.js new file mode 100644 index 000000000000..8690534fdb51 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/scale/ordinal/lib/type/set.js @@ -0,0 +1,46 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var format = require( '@stdlib/string/format' ); +var TYPE = require( './type.js' ); + + +// MAIN // + +/** +* Sets the scale type. +* +* @private +* @param {string} value - input value +* @throws {TypeError} must be a valid scale +* @returns {void} +*/ +function set( value ) { + if ( value !== TYPE ) { + throw new TypeError( format( 'invalid assignment. `%s` must be equal to "%s". Value: `%s`.', 'type', TYPE, value ) ); + } +} + + +// EXPORTS // + +module.exports = set; diff --git a/lib/node_modules/@stdlib/plot/vega/scale/ordinal/lib/type/type.js b/lib/node_modules/@stdlib/plot/vega/scale/ordinal/lib/type/type.js new file mode 100644 index 000000000000..2b24434b58a5 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/scale/ordinal/lib/type/type.js @@ -0,0 +1,23 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// EXPORTS // + +module.exports = 'ordinal'; diff --git a/lib/node_modules/@stdlib/plot/vega/scale/ordinal/package.json b/lib/node_modules/@stdlib/plot/vega/scale/ordinal/package.json new file mode 100644 index 000000000000..e8dea1de129b --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/scale/ordinal/package.json @@ -0,0 +1,63 @@ +{ + "name": "@stdlib/plot/vega/scale/ordinal", + "version": "0.0.0", + "description": "Ordinal scale constructor.", + "license": "Apache-2.0", + "author": { + "name": "The Stdlib Authors", + "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" + }, + "contributors": [ + { + "name": "The Stdlib Authors", + "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" + } + ], + "main": "./lib", + "directories": { + "benchmark": "./benchmark", + "doc": "./docs", + "example": "./examples", + "lib": "./lib", + "test": "./test" + }, + "types": "./docs/types", + "scripts": {}, + "homepage": "https://github.com/stdlib-js/stdlib", + "repository": { + "type": "git", + "url": "git://github.com/stdlib-js/stdlib.git" + }, + "bugs": { + "url": "https://github.com/stdlib-js/stdlib/issues" + }, + "dependencies": {}, + "devDependencies": {}, + "engines": { + "node": ">=0.10.0", + "npm": ">2.7.0" + }, + "os": [ + "aix", + "darwin", + "freebsd", + "linux", + "macos", + "openbsd", + "sunos", + "win32", + "windows" + ], + "keywords": [ + "stdlib", + "plot", + "vega", + "scale", + "discrete", + "categorical", + "ordinal", + "constructor", + "ctor" + ], + "__stdlib__": {} +} diff --git a/lib/node_modules/@stdlib/plot/vega/scale/power/examples/index.js b/lib/node_modules/@stdlib/plot/vega/scale/power/examples/index.js new file mode 100644 index 000000000000..ae6155275ec5 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/scale/power/examples/index.js @@ -0,0 +1,27 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +var PowerScale = require( './../lib' ); + +var scale = new PowerScale({ + 'name': 'xScale' +}); + +console.log( scale.toJSON() ); diff --git a/lib/node_modules/@stdlib/plot/vega/scale/power/lib/change_event.js b/lib/node_modules/@stdlib/plot/vega/scale/power/lib/change_event.js new file mode 100644 index 000000000000..55baae0c617a --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/scale/power/lib/change_event.js @@ -0,0 +1,41 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MAIN // + +/** +* Returns a new change event object. +* +* @private +* @param {string} property - property name +* @returns {Object} event object +*/ +function event( property ) { // eslint-disable-line stdlib/no-redeclare + return { + 'type': 'update', + 'source': 'scale', + 'property': property + }; +} + + +// EXPORTS // + +module.exports = event; diff --git a/lib/node_modules/@stdlib/plot/vega/scale/power/lib/defaults.js b/lib/node_modules/@stdlib/plot/vega/scale/power/lib/defaults.js new file mode 100644 index 000000000000..a457095ddfdd --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/scale/power/lib/defaults.js @@ -0,0 +1,43 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MAIN // + +/** +* Returns defaults. +* +* @private +* @returns {Object} default options +* +* @example +* var o = defaults(); +* // returns {...} +*/ +function defaults() { + return { + // Exponent: + 'exponent': 1 + }; +} + + +// EXPORTS // + +module.exports = defaults; diff --git a/lib/node_modules/@stdlib/plot/vega/scale/power/lib/exponent/get.js b/lib/node_modules/@stdlib/plot/vega/scale/power/lib/exponent/get.js new file mode 100644 index 000000000000..d8adcff3d857 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/scale/power/lib/exponent/get.js @@ -0,0 +1,43 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable no-invalid-this */ + +'use strict'; + +// MODULES // + +var prop = require( './properties.js' ); + + +// MAIN // + +/** +* Returns the exponent which is used by the scale when computing an exponential transform. +* +* @private +* @returns {number} exponent +*/ +function get() { + return this[ prop.private ]; +} + + +// EXPORTS // + +module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/vega/scale/power/lib/exponent/properties.js b/lib/node_modules/@stdlib/plot/vega/scale/power/lib/exponent/properties.js new file mode 100644 index 000000000000..c962460392a5 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/scale/power/lib/exponent/properties.js @@ -0,0 +1,33 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var property2object = require( '@stdlib/plot/vega/base/property2object' ); + + +// MAIN // + +var obj = property2object( 'exponent' ); + + +// EXPORTS // + +module.exports = obj; diff --git a/lib/node_modules/@stdlib/plot/vega/scale/power/lib/exponent/set.js b/lib/node_modules/@stdlib/plot/vega/scale/power/lib/exponent/set.js new file mode 100644 index 000000000000..9d36ca28aefe --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/scale/power/lib/exponent/set.js @@ -0,0 +1,61 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable no-invalid-this */ + +'use strict'; + +// MODULES // + +var logger = require( 'debug' ); +var isFiniteNumber = require( '@stdlib/assert/is-finite' ).isPrimitive; +var format = require( '@stdlib/string/format' ); +var changeEvent = require( './../change_event.js' ); +var prop = require( './properties.js' ); + + +// VARIABLES // + +var debug = logger( 'vega:power-scale:set:'+prop.name ); + + +// MAIN // + +/** +* Sets the exponent which is used by the scale when computing an exponential transform. +* +* @private +* @param {number} value - input value +* @throws {TypeError} must be a finite number +* @returns {void} +*/ +function set( value ) { + if ( !isFiniteNumber( value ) ) { + throw new TypeError( format( 'invalid assignment. `%s` must be a finite number. Value: `%s`.', prop.name, value ) ); + } + if ( value !== this[ prop.private ] ) { + debug( 'Current value: %s. New value: %s.', this[ prop.private ], value ); + this[ prop.private ] = value; + this.emit( 'change', changeEvent( prop.name ) ); + } +} + + +// EXPORTS // + +module.exports = set; diff --git a/lib/node_modules/@stdlib/plot/vega/scale/power/lib/index.js b/lib/node_modules/@stdlib/plot/vega/scale/power/lib/index.js new file mode 100644 index 000000000000..494b199ae8ba --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/scale/power/lib/index.js @@ -0,0 +1,42 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +/** +* Power scale constructor. +* +* @module @stdlib/plot/vega/scale/power +* +* @example +* var PowerScale = require( '@stdlib/plot/vega/scale/power' ); +* +* var scale = new PowerScale({ +* 'name': 'xScale' +* }); +* // returns <PowerScale> +*/ + +// MODULES // + +var main = require( './main.js' ); + + +// EXPORTS // + +module.exports = main; diff --git a/lib/node_modules/@stdlib/plot/vega/scale/power/lib/main.js b/lib/node_modules/@stdlib/plot/vega/scale/power/lib/main.js new file mode 100644 index 000000000000..954e3fd37843 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/scale/power/lib/main.js @@ -0,0 +1,238 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable no-restricted-syntax, no-invalid-this */ + +'use strict'; + +// MODULES // + +var logger = require( 'debug' ); +var isObject = require( '@stdlib/assert/is-object' ); +var hasProp = require( '@stdlib/assert/has-property' ); +var setReadWriteAccessor = require( '@stdlib/utils/define-read-write-accessor' ); +var setNonEnumerableReadOnly = require( '@stdlib/utils/define-nonenumerable-read-only-property' ); +var setNonEnumerableReadOnlyAccessor = require( '@stdlib/utils/define-nonenumerable-read-only-accessor' ); // eslint-disable-line id-length +var inherit = require( '@stdlib/utils/inherit' ); +var objectKeys = require( '@stdlib/utils/keys' ); +var QuantitativeScale = require( '@stdlib/plot/vega/scale/quantitative' ); +var transformErrorMessage = require( '@stdlib/plot/vega/base/transform-validation-message' ); +var instance2json = require( '@stdlib/plot/vega/base/to-json' ); +var format = require( '@stdlib/string/format' ); +var properties = require( './properties.json' ); +var defaults = require( './defaults.js' ); +var TYPE = require( './type/type.js' ); + +// Note: keep the following in alphabetical order according to the `require` path... +var getExponent = require( './exponent/get.js' ); +var setExponent = require( './exponent/set.js' ); + +var getProperties = require( './properties/get.js' ); + +var getType = require( './type/get.js' ); +var setType = require( './type/set.js' ); + + +// VARIABLES // + +var debug = logger( 'vega:log-scale:main' ); + + +// MAIN // + +/** +* Power scale constructor. +* +* @constructor +* @param {Options} options - constructor options +* @param {string} options.name - scale name +* @param {(Collection|Object|Signal)} [options.bins] - bin boundaries over the scale domain +* @param {boolean} [options.clamp=false] - boolean indicating whether to clamp output values to the scale range +* @param {(Collection|Object|Signal)} [options.domain] - domain of associated data values +* @param {number} [options.domainMax] - maximum value in the scale domain (overrides the `domain` option) +* @param {number} [options.domainMin] - minimum value in the scale domain (overrides the `domain` option) +* @param {number} [options.domainMid] - single mid-point value inserted into a two-element domain +* @param {Collection} [options.domainRaw] - array of raw domain values which overrides the `domain` property +* @param {number} [options.exponent=1] - exponent +* @param {(string|Object)} [options.interpolate] - scale range interpolation method +* @param {(boolean|number|Signal)} [options.nice=false] - scale domain "nicing" +* @param {number} [options.padding] - scale domain padding (in pixels) +* @param {(Collection|Object|Signal|string)} [options.range] - scale range +* @param {boolean} [options.reverse=false] - boolean indicating whether to reverse the order of the scale range +* @param {boolean} [options.round=false] - boolean indicating whether to round numeric output values to integers +* @param {boolean} [options.zero] - boolean indicating whether the scale domain should include zero +* @throws {TypeError} options argument must be an object +* @throws {Error} must provide valid options +* @returns {PowerScale} scale instance +* +* @example +* var scale = new PowerScale({ +* 'name': 'xScale' +* }); +* // returns <PowerScale> +*/ +function PowerScale( options ) { + var opts; + var keys; + var v; + var k; + var i; + if ( !( this instanceof PowerScale ) ) { + return new PowerScale( options ); + } + if ( !isObject( options ) ) { + throw new TypeError( format( 'invalid argument. Options argument must be an object. Value: `%s`.', options ) ); + } + if ( hasProp( options, 'type' ) && options.type !== TYPE ) { + throw new TypeError( format( 'invalid argument. `%s` option must be equal to "%s". Option: `%s`.', 'type', TYPE, options.type ) ); + } + // Check for required properties... + if ( !hasProp( options, 'name' ) ) { + throw new TypeError( 'invalid argument. Options argument must specify the scale name.' ); + } + QuantitativeScale.call( this, { + 'name': options.name + }); + this._type = TYPE; + + // Resolve the default configuration: + opts = defaults(); + + // Set internal properties according to the default configuration... + keys = objectKeys( opts ); + for ( i = 0; i < keys.length; i++ ) { + k = keys[ i ]; + this[ '_'+k ] = opts[ k ]; + } + // Validate provided options by attempting to assign option values to corresponding fields... + for ( i = 0; i < properties.length; i++ ) { + k = properties[ i ]; + if ( !hasProp( options, k ) ) { + continue; + } + v = options[ k ]; + try { + this[ k ] = v; + } catch ( err ) { + debug( 'Encountered an error. Error: %s', err.message ); + + // FIXME: retain thrown error type + throw new Error( transformErrorMessage( err.message ) ); + } + } + return this; +} + +/* +* Inherit from a parent prototype. +*/ +inherit( PowerScale, QuantitativeScale ); + +/** +* Constructor name. +* +* @private +* @name name +* @memberof PowerScale +* @readonly +* @type {string} +*/ +setNonEnumerableReadOnly( PowerScale, 'name', 'PowerScale' ); + +/** +* Exponent which is used by the scale when computing an exponential transform. +* +* @name exponent +* @memberof PowerScale.prototype +* @type {number} +* @default 10 +* +* @example +* var scale = new PowerScale({ +* 'name': 'xScale', +* 'exponent': 2 +* }); +* +* var v = scale.exponent; +* // returns 2 +*/ +setReadWriteAccessor( PowerScale.prototype, 'exponent', getExponent, setExponent ); + +/** +* Scale properties. +* +* @name properties +* @memberof PowerScale.prototype +* @type {Array<string>} +* +* @example +* var scale = new PowerScale({ +* 'name': 'xScale' +* }); +* +* var v = scale.properties; +* // returns [...] +*/ +setNonEnumerableReadOnlyAccessor( PowerScale.prototype, 'properties', getProperties ); + +/** +* Scale type. +* +* @name type +* @memberof PowerScale.prototype +* @type {string} +* @default 'pow' +* +* @example +* var scale = new PowerScale({ +* 'name': 'xScale' +* }); +* +* var v = scale.type; +* // returns 'pow' +*/ +setReadWriteAccessor( PowerScale.prototype, 'type', getType, setType ); + +/** +* Serializes an instance to a JSON object. +* +* ## Notes +* +* - This method is implicitly invoked by `JSON.stringify`. +* +* @name toJSON +* @memberof PowerScale.prototype +* @type {Function} +* @returns {Object} JSON object +* +* @example +* var scale = new PowerScale({ +* 'name': 'xScale' +* }); +* +* var v = scale.toJSON(); +* // returns {...} +*/ +setNonEnumerableReadOnly( PowerScale.prototype, 'toJSON', function toJSON() { + return instance2json( this, properties ); +}); + + +// EXPORTS // + +module.exports = PowerScale; diff --git a/lib/node_modules/@stdlib/plot/vega/scale/power/lib/properties.json b/lib/node_modules/@stdlib/plot/vega/scale/power/lib/properties.json new file mode 100644 index 000000000000..816f8d5c5a1e --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/scale/power/lib/properties.json @@ -0,0 +1,21 @@ +[ + "domain", + "domainMax", + "domainMin", + "domainMid", + "domainRaw", + "interpolate", + "name", + "range", + "reverse", + "round", + "type", + + "bins", + "clamp", + "padding", + "nice", + "zero", + + "exponent" +] diff --git a/lib/node_modules/@stdlib/plot/vega/scale/power/lib/properties/get.js b/lib/node_modules/@stdlib/plot/vega/scale/power/lib/properties/get.js new file mode 100644 index 000000000000..8fc57de14e90 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/scale/power/lib/properties/get.js @@ -0,0 +1,41 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var properties = require( './../properties.json' ); + + +// MAIN // + +/** +* Returns the list of enumerable properties. +* +* @private +* @returns {Array<string>} properties +*/ +function get() { + return properties.slice(); +} + + +// EXPORTS // + +module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/vega/scale/power/lib/type/get.js b/lib/node_modules/@stdlib/plot/vega/scale/power/lib/type/get.js new file mode 100644 index 000000000000..8f5ecbfba703 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/scale/power/lib/type/get.js @@ -0,0 +1,41 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var TYPE = require( './type.js' ); + + +// MAIN // + +/** +* Returns the scale type. +* +* @private +* @returns {string} scale type +*/ +function get() { + return TYPE; +} + + +// EXPORTS // + +module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/vega/scale/power/lib/type/set.js b/lib/node_modules/@stdlib/plot/vega/scale/power/lib/type/set.js new file mode 100644 index 000000000000..8690534fdb51 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/scale/power/lib/type/set.js @@ -0,0 +1,46 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var format = require( '@stdlib/string/format' ); +var TYPE = require( './type.js' ); + + +// MAIN // + +/** +* Sets the scale type. +* +* @private +* @param {string} value - input value +* @throws {TypeError} must be a valid scale +* @returns {void} +*/ +function set( value ) { + if ( value !== TYPE ) { + throw new TypeError( format( 'invalid assignment. `%s` must be equal to "%s". Value: `%s`.', 'type', TYPE, value ) ); + } +} + + +// EXPORTS // + +module.exports = set; diff --git a/lib/node_modules/@stdlib/plot/vega/scale/power/lib/type/type.js b/lib/node_modules/@stdlib/plot/vega/scale/power/lib/type/type.js new file mode 100644 index 000000000000..293ec06fcd97 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/scale/power/lib/type/type.js @@ -0,0 +1,23 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// EXPORTS // + +module.exports = 'pow'; diff --git a/lib/node_modules/@stdlib/plot/vega/scale/power/package.json b/lib/node_modules/@stdlib/plot/vega/scale/power/package.json new file mode 100644 index 000000000000..233fffb3aaf9 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/scale/power/package.json @@ -0,0 +1,63 @@ +{ + "name": "@stdlib/plot/vega/scale/power", + "version": "0.0.0", + "description": "Power scale constructor.", + "license": "Apache-2.0", + "author": { + "name": "The Stdlib Authors", + "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" + }, + "contributors": [ + { + "name": "The Stdlib Authors", + "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" + } + ], + "main": "./lib", + "directories": { + "benchmark": "./benchmark", + "doc": "./docs", + "example": "./examples", + "lib": "./lib", + "test": "./test" + }, + "types": "./docs/types", + "scripts": {}, + "homepage": "https://github.com/stdlib-js/stdlib", + "repository": { + "type": "git", + "url": "git://github.com/stdlib-js/stdlib.git" + }, + "bugs": { + "url": "https://github.com/stdlib-js/stdlib/issues" + }, + "dependencies": {}, + "devDependencies": {}, + "engines": { + "node": ">=0.10.0", + "npm": ">2.7.0" + }, + "os": [ + "aix", + "darwin", + "freebsd", + "linux", + "macos", + "openbsd", + "sunos", + "win32", + "windows" + ], + "keywords": [ + "stdlib", + "plot", + "vega", + "scale", + "quantitative", + "pow", + "power", + "constructor", + "ctor" + ], + "__stdlib__": {} +} diff --git a/lib/node_modules/@stdlib/plot/vega/scale/quantitative/examples/index.js b/lib/node_modules/@stdlib/plot/vega/scale/quantitative/examples/index.js new file mode 100644 index 000000000000..078c2bd47622 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/scale/quantitative/examples/index.js @@ -0,0 +1,27 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +var QuantitativeScale = require( './../lib' ); + +var scale = new QuantitativeScale({ + 'name': 'xScale' +}); + +console.log( scale.toJSON() ); diff --git a/lib/node_modules/@stdlib/plot/vega/scale/quantitative/lib/bins/get.js b/lib/node_modules/@stdlib/plot/vega/scale/quantitative/lib/bins/get.js new file mode 100644 index 000000000000..6c7024eb5ed4 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/scale/quantitative/lib/bins/get.js @@ -0,0 +1,44 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable no-invalid-this */ + +'use strict'; + +// MODULES // + +var copy = require( '@stdlib/utils/copy' ); +var prop = require( './properties.js' ); + + +// MAIN // + +/** +* Returns bin boundaries of the scale domain. +* +* @private +* @returns {(Array|Object|void)} bin boundaries +*/ +function get() { + return copy( this[ prop.private ] ); // FIXME: can we avoid using `utils/copy` here? +} + + +// EXPORTS // + +module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/vega/scale/quantitative/lib/bins/properties.js b/lib/node_modules/@stdlib/plot/vega/scale/quantitative/lib/bins/properties.js new file mode 100644 index 000000000000..d9214994506a --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/scale/quantitative/lib/bins/properties.js @@ -0,0 +1,33 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var property2object = require( '@stdlib/plot/vega/base/property2object' ); + + +// MAIN // + +var obj = property2object( 'bins' ); + + +// EXPORTS // + +module.exports = obj; diff --git a/lib/node_modules/@stdlib/plot/vega/scale/quantitative/lib/bins/set.js b/lib/node_modules/@stdlib/plot/vega/scale/quantitative/lib/bins/set.js new file mode 100644 index 000000000000..4705dc202ebb --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/scale/quantitative/lib/bins/set.js @@ -0,0 +1,78 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable no-invalid-this */ + +'use strict'; + +// MODULES // + +var logger = require( 'debug' ); +var isCollection = require( '@stdlib/assert/is-collection' ); +var isUndefined = require( '@stdlib/assert/is-undefined' ); +var isObject = require( '@stdlib/assert/is-object' ); +var copyArray = require( '@stdlib/array/base/copy' ); +var copy = require( '@stdlib/utils/copy' ); +var format = require( '@stdlib/string/format' ); +var changeEvent = require( './../change_event.js' ); +var prop = require( './properties.js' ); + + +// VARIABLES // + +var debug = logger( 'vega:quantitative-scale:set:'+prop.name ); + + +// MAIN // + +/** +* Sets bin boundaries over the scale domain. +* +* ## Notes +* +* - Providing `undefined` "unsets" the configured value. +* +* @private +* @param {(Collection|Object|Signal|void)} value - input value +* @throws {TypeError} must be either an array-like object or an object +* @returns {void} +*/ +function set( value ) { + var isArr = isCollection( value ); + if ( !isArr && !isObject( value ) && !isUndefined( value ) ) { + throw new TypeError( format( 'invalid assignment. `%s` must be either an array-like object or an object. Value: `%s`.', prop.name, value ) ); + } + + // FIXME: should we perform a deep equal check here in order to avoid a potential false positive change event? + + // FIXME: can we do further validation of objects (e.g., data reference or signal reference)? + + if ( isArr ) { + value = copyArray( value ); + } else { + value = copy( value ); + } + debug( 'Current value: %s. New value: %s.', JSON.stringify( this[ prop.private ] ), JSON.stringify( value ) ); + this[ prop.private ] = value; + this.emit( 'change', changeEvent( prop.name ) ); +} + + +// EXPORTS // + +module.exports = set; diff --git a/lib/node_modules/@stdlib/plot/vega/scale/quantitative/lib/change_event.js b/lib/node_modules/@stdlib/plot/vega/scale/quantitative/lib/change_event.js new file mode 100644 index 000000000000..55baae0c617a --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/scale/quantitative/lib/change_event.js @@ -0,0 +1,41 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MAIN // + +/** +* Returns a new change event object. +* +* @private +* @param {string} property - property name +* @returns {Object} event object +*/ +function event( property ) { // eslint-disable-line stdlib/no-redeclare + return { + 'type': 'update', + 'source': 'scale', + 'property': property + }; +} + + +// EXPORTS // + +module.exports = event; diff --git a/lib/node_modules/@stdlib/plot/vega/scale/quantitative/lib/clamp/get.js b/lib/node_modules/@stdlib/plot/vega/scale/quantitative/lib/clamp/get.js new file mode 100644 index 000000000000..4f2c48ac477a --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/scale/quantitative/lib/clamp/get.js @@ -0,0 +1,43 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable no-invalid-this */ + +'use strict'; + +// MODULES // + +var prop = require( './properties.js' ); + + +// MAIN // + +/** +* Returns a boolean indicating whether to clamp output values to the scale range. +* +* @private +* @returns {boolean} boolean flag +*/ +function get() { + return this[ prop.private ]; +} + + +// EXPORTS // + +module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/vega/scale/quantitative/lib/clamp/properties.js b/lib/node_modules/@stdlib/plot/vega/scale/quantitative/lib/clamp/properties.js new file mode 100644 index 000000000000..302dcb61d634 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/scale/quantitative/lib/clamp/properties.js @@ -0,0 +1,33 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var property2object = require( '@stdlib/plot/vega/base/property2object' ); + + +// MAIN // + +var obj = property2object( 'clamp' ); + + +// EXPORTS // + +module.exports = obj; diff --git a/lib/node_modules/@stdlib/plot/vega/scale/quantitative/lib/clamp/set.js b/lib/node_modules/@stdlib/plot/vega/scale/quantitative/lib/clamp/set.js new file mode 100644 index 000000000000..03bec16ae6f7 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/scale/quantitative/lib/clamp/set.js @@ -0,0 +1,61 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable no-invalid-this */ + +'use strict'; + +// MODULES // + +var logger = require( 'debug' ); +var isBoolean = require( '@stdlib/assert/is-boolean' ).isPrimitive; +var format = require( '@stdlib/string/format' ); +var changeEvent = require( './../change_event.js' ); +var prop = require( './properties.js' ); + + +// VARIABLES // + +var debug = logger( 'vega:quantitative-scale:set:'+prop.name ); + + +// MAIN // + +/** +* Sets a boolean flag indicating whether to clamp output values to the scale range. +* +* @private +* @param {boolean} value - input value +* @throws {TypeError} must be a boolean +* @returns {void} +*/ +function set( value ) { + if ( !isBoolean( value ) ) { + throw new TypeError( format( 'invalid assignment. `%s` must be a boolean. Value: `%s`.', prop.name, value ) ); + } + if ( value !== this[ prop.private ] ) { + debug( 'Current value: %s. New value: %s.', this[ prop.private ], value ); + this[ prop.private ] = value; + this.emit( 'change', changeEvent( prop.name ) ); + } +} + + +// EXPORTS // + +module.exports = set; diff --git a/lib/node_modules/@stdlib/plot/vega/scale/quantitative/lib/defaults.js b/lib/node_modules/@stdlib/plot/vega/scale/quantitative/lib/defaults.js new file mode 100644 index 000000000000..4bab62af16a3 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/scale/quantitative/lib/defaults.js @@ -0,0 +1,46 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MAIN // + +/** +* Returns defaults. +* +* @private +* @returns {Object} default options +* +* @example +* var o = defaults(); +* // returns {...} +*/ +function defaults() { + return { + // Boolean indicating whether to clamp output ranges to the scale range: + 'clamp': false, + + // Boolean indicating whether to extend a scale domain so that the domain starts and ends on round values: + 'nice': false + }; +} + + +// EXPORTS // + +module.exports = defaults; diff --git a/lib/node_modules/@stdlib/plot/vega/scale/quantitative/lib/index.js b/lib/node_modules/@stdlib/plot/vega/scale/quantitative/lib/index.js new file mode 100644 index 000000000000..eb92f78914f3 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/scale/quantitative/lib/index.js @@ -0,0 +1,42 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +/** +* Quantitative scale constructor. +* +* @module @stdlib/plot/vega/scale/quantitative +* +* @example +* var QuantitativeScale = require( '@stdlib/plot/vega/scale/quantitative' ); +* +* var scale = new QuantitativeScale({ +* 'name': 'xScale' +* }); +* // returns <QuantitativeScale> +*/ + +// MODULES // + +var main = require( './main.js' ); + + +// EXPORTS // + +module.exports = main; diff --git a/lib/node_modules/@stdlib/plot/vega/scale/quantitative/lib/main.js b/lib/node_modules/@stdlib/plot/vega/scale/quantitative/lib/main.js new file mode 100644 index 000000000000..07c022424911 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/scale/quantitative/lib/main.js @@ -0,0 +1,318 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable no-restricted-syntax, no-invalid-this */ + +'use strict'; + +// MODULES // + +var logger = require( 'debug' ); +var isObject = require( '@stdlib/assert/is-object' ); +var setReadWriteAccessor = require( '@stdlib/utils/define-read-write-accessor' ); +var setNonEnumerableReadOnly = require( '@stdlib/utils/define-nonenumerable-read-only-property' ); +var setNonEnumerableReadOnlyAccessor = require( '@stdlib/utils/define-nonenumerable-read-only-accessor' ); // eslint-disable-line id-length +var hasProp = require( '@stdlib/assert/has-property' ); +var inherit = require( '@stdlib/utils/inherit' ); +var objectKeys = require( '@stdlib/utils/keys' ); +var transformErrorMessage = require( '@stdlib/plot/vega/base/transform-validation-message' ); +var instance2json = require( '@stdlib/plot/vega/base/to-json' ); +var Scale = require( '@stdlib/plot/vega/scale/base/ctor' ); +var format = require( '@stdlib/string/format' ); +var properties = require( './properties.json' ); +var defaults = require( './defaults.js' ); + +// Note: keep the following in alphabetical order according to the `require` path... +var getBins = require( './bins/get.js' ); +var setBins = require( './bins/set.js' ); + +var getClamp = require( './clamp/get.js' ); +var setClamp = require( './clamp/set.js' ); + +var getPadding = require( './padding/get.js' ); +var setPadding = require( './padding/set.js' ); +var getProperties = require( './properties/get.js' ); + +var getNice = require( './nice/get.js' ); +var setNice = require( './nice/set.js' ); + +var getType = require( './type/get.js' ); +var setType = require( './type/set.js' ); + +var getZero = require( './zero/get.js' ); +var setZero = require( './zero/set.js' ); + + +// VARIABLES // + +var debug = logger( 'vega:quantitative-scale:main' ); + + +// MAIN // + +/** +* Quantitative scale constructor. +* +* @constructor +* @param {Options} options - constructor options +* @param {string} options.name - scale name +* @param {(Collection|Object|Signal)} [options.bins] - bin boundaries over the scale domain +* @param {boolean} [options.clamp=false] - boolean indicating whether to clamp output values to the scale range +* @param {(Collection|Object|Signal)} [options.domain] - domain of associated data values +* @param {number} [options.domainMax] - maximum value in the scale domain (overrides the `domain` option) +* @param {number} [options.domainMin] - minimum value in the scale domain (overrides the `domain` option) +* @param {number} [options.domainMid] - single mid-point value inserted into a two-element domain +* @param {Collection} [options.domainRaw] - array of raw domain values which overrides the `domain` property +* @param {(string|Object)} [options.interpolate] - scale range interpolation method +* @param {(boolean|number|Signal)} [options.nice=false] - scale domain "nicing" +* @param {number} [options.padding] - scale domain padding (in pixels) +* @param {(Collection|Object|Signal|string)} [options.range] - scale range +* @param {boolean} [options.reverse=false] - boolean indicating whether to reverse the order of the scale range +* @param {boolean} [options.round=false] - boolean indicating whether to round numeric output values to integers +* @param {string} [options.type='linear'] - scale type +* @param {boolean} [options.zero] - boolean indicating whether the scale domain should include zero +* @throws {TypeError} options argument must be an object +* @throws {Error} must provide valid options +* @returns {QuantitativeScale} scale instance +* +* @example +* var scale = new QuantitativeScale({ +* 'name': 'xScale' +* }); +* // returns <QuantitativeScale> +*/ +function QuantitativeScale( options ) { + var opts; + var keys; + var v; + var k; + var i; + if ( !( this instanceof QuantitativeScale ) ) { + return new QuantitativeScale( options ); + } + if ( !isObject( options ) ) { + throw new TypeError( format( 'invalid argument. Options argument must be an object. Value: `%s`.', options ) ); + } + // Check for required properties... + if ( !hasProp( options, 'name' ) ) { + throw new TypeError( 'invalid argument. Options argument must specify the scale name.' ); + } + Scale.call( this, { + 'name': options.name + }); + + // Resolve the default configuration: + opts = defaults(); + + // Set internal properties according to the default configuration... + keys = objectKeys( opts ); + for ( i = 0; i < keys.length; i++ ) { + k = keys[ i ]; + this[ '_'+k ] = opts[ k ]; + } + // Validate provided options by attempting to assign option values to corresponding fields... + for ( i = 0; i < properties.length; i++ ) { + k = properties[ i ]; + if ( !hasProp( options, k ) ) { + continue; + } + v = options[ k ]; + try { + this[ k ] = v; + } catch ( err ) { + debug( 'Encountered an error. Error: %s', err.message ); + + // FIXME: retain thrown error type + throw new Error( transformErrorMessage( err.message ) ); + } + } + return this; +} + +/* +* Inherit from a parent prototype. +*/ +inherit( QuantitativeScale, Scale ); + +/** +* Constructor name. +* +* @private +* @name name +* @memberof QuantitativeScale +* @readonly +* @type {string} +*/ +setNonEnumerableReadOnly( QuantitativeScale, 'name', 'QuantitativeScale' ); + +/** +* Bins boundaries of the scale domain. +* +* @name bins +* @memberof QuantitativeScale.prototype +* @type {(Array|Object|Signal|void)} +* +* @example +* var scale = new QuantitativeScale({ +* 'name': 'xScale', +* 'bins': [ 0, 5, 10, 15, 20 ] +* }); +* +* var v = scale.bins; +* // returns [ 0, 5, 10, 15, 20 ] +*/ +setReadWriteAccessor( QuantitativeScale.prototype, 'bins', getBins, setBins ); + +/** +* Boolean indicating whether to clamp output values to the scale range. +* +* @name clamp +* @memberof QuantitativeScale.prototype +* @type {boolean} +* @default false +* +* @example +* var scale = new QuantitativeScale({ +* 'name': 'xScale', +* 'clamp': true +* }); +* +* var v = scale.clamp; +* // returns true +*/ +setReadWriteAccessor( QuantitativeScale.prototype, 'clamp', getClamp, setClamp ); + +/** +* Scale domain "nicing". +* +* @name nice +* @memberof QuantitativeScale.prototype +* @type {(boolean|number|Signal)} +* @default false +* +* @example +* var scale = new QuantitativeScale({ +* 'name': 'xScale', +* 'nice': true +* }); +* +* var v = scale.nice; +* // returns true +*/ +setReadWriteAccessor( QuantitativeScale.prototype, 'nice', getNice, setNice ); + +/** +* Scale domain padding (in pixels). +* +* @name padding +* @memberof QuantitativeScale.prototype +* @type {(number|void)} +* +* @example +* var scale = new QuantitativeScale({ +* 'name': 'xScale', +* 'padding': 10 +* }); +* +* var v = scale.padding; +* // returns 10 +*/ +setReadWriteAccessor( QuantitativeScale.prototype, 'padding', getPadding, setPadding ); + +/** +* Scale properties. +* +* @name properties +* @memberof QuantitativeScale.prototype +* @type {Array<string>} +* +* @example +* var scale = new QuantitativeScale({ +* 'name': 'xScale' +* }); +* +* var v = scale.properties; +* // returns [...] +*/ +setNonEnumerableReadOnlyAccessor( QuantitativeScale.prototype, 'properties', getProperties ); + +/** +* Scale type. +* +* @name type +* @memberof QuantitativeScale.prototype +* @type {string} +* @default 'linear' +* +* @example +* var scale = new QuantitativeScale({ +* 'name': 'xScale', +* 'type': 'log' +* }); +* +* var v = scale.type; +* // returns 'log' +*/ +setReadWriteAccessor( QuantitativeScale.prototype, 'type', getType, setType ); + +/** +* Boolean indicating whether the scale domain should include zero. +* +* @name zero +* @memberof QuantitativeScale.prototype +* @type {(boolean|void)} +* +* @example +* var scale = new QuantitativeScale({ +* 'name': 'xScale', +* 'zero': false +* }); +* +* var v = scale.zero; +* // returns false +*/ +setReadWriteAccessor( QuantitativeScale.prototype, 'zero', getZero, setZero ); + +/** +* Serializes an instance to a JSON object. +* +* ## Notes +* +* - This method is implicitly invoked by `JSON.stringify`. +* +* @name toJSON +* @memberof QuantitativeScale.prototype +* @type {Function} +* @returns {Object} JSON object +* +* @example +* var scale = new QuantitativeScale({ +* 'name': 'xScale' +* }); +* +* var v = scale.toJSON(); +* // returns {...} +*/ +setNonEnumerableReadOnly( QuantitativeScale.prototype, 'toJSON', function toJSON() { + return instance2json( this, properties ); +}); + + +// EXPORTS // + +module.exports = QuantitativeScale; diff --git a/lib/node_modules/@stdlib/plot/vega/scale/quantitative/lib/nice/get.js b/lib/node_modules/@stdlib/plot/vega/scale/quantitative/lib/nice/get.js new file mode 100644 index 000000000000..70c83d267ab4 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/scale/quantitative/lib/nice/get.js @@ -0,0 +1,43 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable no-invalid-this */ + +'use strict'; + +// MODULES // + +var prop = require( './properties.js' ); + + +// MAIN // + +/** +* Returns scale domain "nicing". +* +* @private +* @returns {(void|number|Signal|boolean)} output value +*/ +function get() { + return this[ prop.private ]; +} + + +// EXPORTS // + +module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/vega/scale/quantitative/lib/nice/properties.js b/lib/node_modules/@stdlib/plot/vega/scale/quantitative/lib/nice/properties.js new file mode 100644 index 000000000000..9f70d83d59bb --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/scale/quantitative/lib/nice/properties.js @@ -0,0 +1,33 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var property2object = require( '@stdlib/plot/vega/base/property2object' ); + + +// MAIN // + +var obj = property2object( 'nice' ); + + +// EXPORTS // + +module.exports = obj; diff --git a/lib/node_modules/@stdlib/plot/vega/scale/quantitative/lib/nice/set.js b/lib/node_modules/@stdlib/plot/vega/scale/quantitative/lib/nice/set.js new file mode 100644 index 000000000000..65758ab23f93 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/scale/quantitative/lib/nice/set.js @@ -0,0 +1,71 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable no-invalid-this */ + +'use strict'; + +// MODULES // + +var logger = require( 'debug' ); +var isNumber = require( '@stdlib/assert/is-number' ).isPrimitive; +var isBoolean = require( '@stdlib/assert/is-boolean' ).isPrimitive; +var isObject = require( '@stdlib/assert/is-object' ); +var copy = require( '@stdlib/utils/copy' ); +var format = require( '@stdlib/string/format' ); +var changeEvent = require( './../change_event.js' ); +var prop = require( './properties.js' ); + + +// VARIABLES // + +var debug = logger( 'vega:quantitative-scale:set:'+prop.name ); + + +// MAIN // + +/** +* Sets scale domain "nicing". +* +* @private +* @param {(number|boolean|Signal)} value - input value +* @throws {TypeError} must be either a number, boolean, or a signal +* @returns {void} +*/ +function set( value ) { + var isObj = isObject( value ); + if ( !isObj && !isNumber( value ) && !isBoolean( value ) ) { + throw new TypeError( format( 'invalid assignment. `%s` must be either a number, boolean, or a signal. Value: `%s`.', prop.name, value ) ); + } + if ( isObj ) { + value = copy( value ); + } + + // FIXME: should we perform deep equality comparison for provided objects in order to avoid potential false positive change events? + + if ( value !== this[ prop.private ] ) { + debug( 'Current value: %s. New value: %s.', this[ prop.private ], value ); + this[ prop.private ] = value; + this.emit( 'change', changeEvent( prop.name ) ); + } +} + + +// EXPORTS // + +module.exports = set; diff --git a/lib/node_modules/@stdlib/plot/vega/scale/quantitative/lib/padding/get.js b/lib/node_modules/@stdlib/plot/vega/scale/quantitative/lib/padding/get.js new file mode 100644 index 000000000000..db77ebb701c4 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/scale/quantitative/lib/padding/get.js @@ -0,0 +1,43 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable no-invalid-this */ + +'use strict'; + +// MODULES // + +var prop = require( './properties.js' ); + + +// MAIN // + +/** +* Returns scale domain padding (in pixels). +* +* @private +* @returns {(void|number)} padding +*/ +function get() { + return this[ prop.private ]; +} + + +// EXPORTS // + +module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/vega/scale/quantitative/lib/padding/properties.js b/lib/node_modules/@stdlib/plot/vega/scale/quantitative/lib/padding/properties.js new file mode 100644 index 000000000000..4263049cd90b --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/scale/quantitative/lib/padding/properties.js @@ -0,0 +1,33 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var property2object = require( '@stdlib/plot/vega/base/property2object' ); + + +// MAIN // + +var obj = property2object( 'padding' ); + + +// EXPORTS // + +module.exports = obj; diff --git a/lib/node_modules/@stdlib/plot/vega/scale/quantitative/lib/padding/set.js b/lib/node_modules/@stdlib/plot/vega/scale/quantitative/lib/padding/set.js new file mode 100644 index 000000000000..4d7a1b3f8c7f --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/scale/quantitative/lib/padding/set.js @@ -0,0 +1,66 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable no-invalid-this */ + +'use strict'; + +// MODULES // + +var logger = require( 'debug' ); +var isNumber = require( '@stdlib/assert/is-number' ).isPrimitive; +var isUndefined = require( '@stdlib/assert/is-undefined' ); +var format = require( '@stdlib/string/format' ); +var changeEvent = require( './../change_event.js' ); +var prop = require( './properties.js' ); + + +// VARIABLES // + +var debug = logger( 'vega:quantitative-scale:set:'+prop.name ); + + +// MAIN // + +/** +* Sets scale domain padding (in pixels). +* +* ## Notes +* +* - Providing `undefined` "unsets" the configured value. +* +* @private +* @param {(number|void)} value - input value +* @throws {TypeError} must be a number +* @returns {void} +*/ +function set( value ) { + if ( !isNumber( value ) && !isUndefined( value ) ) { + throw new TypeError( format( 'invalid assignment. `%s` must be a number. Value: `%s`.', prop.name, value ) ); + } + if ( value !== this[ prop.private ] ) { + debug( 'Current value: %s. New value: %s.', this[ prop.private ], value ); + this[ prop.private ] = value; + this.emit( 'change', changeEvent( prop.name ) ); + } +} + + +// EXPORTS // + +module.exports = set; diff --git a/lib/node_modules/@stdlib/plot/vega/scale/quantitative/lib/properties.json b/lib/node_modules/@stdlib/plot/vega/scale/quantitative/lib/properties.json new file mode 100644 index 000000000000..8611c18d48fe --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/scale/quantitative/lib/properties.json @@ -0,0 +1,19 @@ +[ + "domain", + "domainMax", + "domainMin", + "domainMid", + "domainRaw", + "interpolate", + "name", + "range", + "reverse", + "round", + "type", + + "bins", + "clamp", + "padding", + "nice", + "zero" +] diff --git a/lib/node_modules/@stdlib/plot/vega/scale/quantitative/lib/properties/get.js b/lib/node_modules/@stdlib/plot/vega/scale/quantitative/lib/properties/get.js new file mode 100644 index 000000000000..8fc57de14e90 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/scale/quantitative/lib/properties/get.js @@ -0,0 +1,41 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var properties = require( './../properties.json' ); + + +// MAIN // + +/** +* Returns the list of enumerable properties. +* +* @private +* @returns {Array<string>} properties +*/ +function get() { + return properties.slice(); +} + + +// EXPORTS // + +module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/vega/scale/quantitative/lib/type/get.js b/lib/node_modules/@stdlib/plot/vega/scale/quantitative/lib/type/get.js new file mode 100644 index 000000000000..ae7ac7957738 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/scale/quantitative/lib/type/get.js @@ -0,0 +1,43 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable no-invalid-this */ + +'use strict'; + +// MODULES // + +var prop = require( './properties.js' ); + + +// MAIN // + +/** +* Returns the scale type. +* +* @private +* @returns {string} scale type +*/ +function get() { + return this[ prop.private ]; +} + + +// EXPORTS // + +module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/vega/scale/quantitative/lib/type/properties.js b/lib/node_modules/@stdlib/plot/vega/scale/quantitative/lib/type/properties.js new file mode 100644 index 000000000000..d4cf0dee043b --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/scale/quantitative/lib/type/properties.js @@ -0,0 +1,33 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var property2object = require( '@stdlib/plot/vega/base/property2object' ); + + +// MAIN // + +var obj = property2object( 'type' ); + + +// EXPORTS // + +module.exports = obj; diff --git a/lib/node_modules/@stdlib/plot/vega/scale/quantitative/lib/type/set.js b/lib/node_modules/@stdlib/plot/vega/scale/quantitative/lib/type/set.js new file mode 100644 index 000000000000..adad6dac6ff1 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/scale/quantitative/lib/type/set.js @@ -0,0 +1,63 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable no-invalid-this */ + +'use strict'; + +// MODULES // + +var logger = require( 'debug' ); +var isQuantitativeScaleName = require( '@stdlib/plot/vega/base/assert/is-quantitative-scale-name' ); +var join = require( '@stdlib/array/base/join' ); +var scales = require( '@stdlib/plot/vega/scale/names' ); +var format = require( '@stdlib/string/format' ); +var changeEvent = require( './../change_event.js' ); +var prop = require( './properties.js' ); + + +// VARIABLES // + +var debug = logger( 'vega:quantitative-scale:set:'+prop.name ); + + +// MAIN // + +/** +* Sets the scale type. +* +* @private +* @param {string} value - input value +* @throws {TypeError} must be a valid scale +* @returns {void} +*/ +function set( value ) { + if ( !isQuantitativeScaleName( value ) ) { + throw new TypeError( format( 'invalid assignment. `%s` must be one of the following: "%s". Value: `%s`.', prop.name, join( scales( 'quantitative' ), '", "' ), value ) ); + } + if ( value !== this[ prop.private ] ) { + debug( 'Current value: %s. New value: %s.', this[ prop.private ], value ); + this[ prop.private ] = value; + this.emit( 'change', changeEvent( prop.name ) ); + } +} + + +// EXPORTS // + +module.exports = set; diff --git a/lib/node_modules/@stdlib/plot/vega/scale/quantitative/lib/zero/get.js b/lib/node_modules/@stdlib/plot/vega/scale/quantitative/lib/zero/get.js new file mode 100644 index 000000000000..5a7fc96f106a --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/scale/quantitative/lib/zero/get.js @@ -0,0 +1,43 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable no-invalid-this */ + +'use strict'; + +// MODULES // + +var prop = require( './properties.js' ); + + +// MAIN // + +/** +* Returns a boolean indicating whether the scale domain should include zero. +* +* @private +* @returns {(boolean|void)} boolean flag +*/ +function get() { + return this[ prop.private ]; +} + + +// EXPORTS // + +module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/vega/scale/quantitative/lib/zero/properties.js b/lib/node_modules/@stdlib/plot/vega/scale/quantitative/lib/zero/properties.js new file mode 100644 index 000000000000..819fbaa43773 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/scale/quantitative/lib/zero/properties.js @@ -0,0 +1,33 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var property2object = require( '@stdlib/plot/vega/base/property2object' ); + + +// MAIN // + +var obj = property2object( 'zero' ); + + +// EXPORTS // + +module.exports = obj; diff --git a/lib/node_modules/@stdlib/plot/vega/scale/quantitative/lib/zero/set.js b/lib/node_modules/@stdlib/plot/vega/scale/quantitative/lib/zero/set.js new file mode 100644 index 000000000000..0b07d681ee0f --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/scale/quantitative/lib/zero/set.js @@ -0,0 +1,66 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable no-invalid-this */ + +'use strict'; + +// MODULES // + +var logger = require( 'debug' ); +var isBoolean = require( '@stdlib/assert/is-boolean' ).isPrimitive; +var isUndefined = require( '@stdlib/assert/is-undefined' ); +var format = require( '@stdlib/string/format' ); +var changeEvent = require( './../change_event.js' ); +var prop = require( './properties.js' ); + + +// VARIABLES // + +var debug = logger( 'vega:quantitative-scale:set:'+prop.name ); + + +// MAIN // + +/** +* Sets a boolean flag indicating whether the scale domain should include zero. +* +* ## Notes +* +* - Providing `undefined` "unsets" the configured value. +* +* @private +* @param {(boolean|void)} value - input value +* @throws {TypeError} must be a boolean +* @returns {void} +*/ +function set( value ) { + if ( !isBoolean( value ) && !isUndefined( value ) ) { + throw new TypeError( format( 'invalid assignment. `%s` must be a boolean. Value: `%s`.', prop.name, value ) ); + } + if ( value !== this[ prop.private ] ) { + debug( 'Current value: %s. New value: %s.', this[ prop.private ], value ); + this[ prop.private ] = value; + this.emit( 'change', changeEvent( prop.name ) ); + } +} + + +// EXPORTS // + +module.exports = set; diff --git a/lib/node_modules/@stdlib/plot/vega/scale/quantitative/package.json b/lib/node_modules/@stdlib/plot/vega/scale/quantitative/package.json new file mode 100644 index 000000000000..64a71d0f0342 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/scale/quantitative/package.json @@ -0,0 +1,61 @@ +{ + "name": "@stdlib/plot/vega/scale/quantitative", + "version": "0.0.0", + "description": "Quantitative scale constructor.", + "license": "Apache-2.0", + "author": { + "name": "The Stdlib Authors", + "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" + }, + "contributors": [ + { + "name": "The Stdlib Authors", + "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" + } + ], + "main": "./lib", + "directories": { + "benchmark": "./benchmark", + "doc": "./docs", + "example": "./examples", + "lib": "./lib", + "test": "./test" + }, + "types": "./docs/types", + "scripts": {}, + "homepage": "https://github.com/stdlib-js/stdlib", + "repository": { + "type": "git", + "url": "git://github.com/stdlib-js/stdlib.git" + }, + "bugs": { + "url": "https://github.com/stdlib-js/stdlib/issues" + }, + "dependencies": {}, + "devDependencies": {}, + "engines": { + "node": ">=0.10.0", + "npm": ">2.7.0" + }, + "os": [ + "aix", + "darwin", + "freebsd", + "linux", + "macos", + "openbsd", + "sunos", + "win32", + "windows" + ], + "keywords": [ + "stdlib", + "plot", + "vega", + "scale", + "quantitative", + "constructor", + "ctor" + ], + "__stdlib__": {} +} diff --git a/lib/node_modules/@stdlib/plot/vega/scale/sqrt/examples/index.js b/lib/node_modules/@stdlib/plot/vega/scale/sqrt/examples/index.js new file mode 100644 index 000000000000..3371ff838162 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/scale/sqrt/examples/index.js @@ -0,0 +1,27 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +var SqrtScale = require( './../lib' ); + +var scale = new SqrtScale({ + 'name': 'xScale' +}); + +console.log( scale.toJSON() ); diff --git a/lib/node_modules/@stdlib/plot/vega/scale/sqrt/lib/exponent/get.js b/lib/node_modules/@stdlib/plot/vega/scale/sqrt/lib/exponent/get.js new file mode 100644 index 000000000000..4556f2baa0f4 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/scale/sqrt/lib/exponent/get.js @@ -0,0 +1,41 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var VALUE = require( './value.js' ); + + +// MAIN // + +/** +* Returns the exponent which is used by the scale when computing an exponential transform. +* +* @private +* @returns {number} exponent +*/ +function get() { + return VALUE; +} + + +// EXPORTS // + +module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/vega/scale/sqrt/lib/exponent/set.js b/lib/node_modules/@stdlib/plot/vega/scale/sqrt/lib/exponent/set.js new file mode 100644 index 000000000000..9b8acc772400 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/scale/sqrt/lib/exponent/set.js @@ -0,0 +1,46 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var format = require( '@stdlib/string/format' ); +var VALUE = require( './value.js' ); + + +// MAIN // + +/** +* Sets the exponent which is used by the scale when computing an exponential transform. +* +* @private +* @param {number} value - input value +* @throws {TypeError} must be a valid exponent +* @returns {void} +*/ +function set( value ) { + if ( value !== VALUE ) { + throw new TypeError( format( 'invalid assignment. `%s` must be equal to "%s". Value: `%s`.', 'value', VALUE, value ) ); + } +} + + +// EXPORTS // + +module.exports = set; diff --git a/lib/node_modules/@stdlib/plot/vega/scale/sqrt/lib/exponent/value.js b/lib/node_modules/@stdlib/plot/vega/scale/sqrt/lib/exponent/value.js new file mode 100644 index 000000000000..a9b99cc104d2 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/scale/sqrt/lib/exponent/value.js @@ -0,0 +1,23 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// EXPORTS // + +module.exports = 0.5; diff --git a/lib/node_modules/@stdlib/plot/vega/scale/sqrt/lib/index.js b/lib/node_modules/@stdlib/plot/vega/scale/sqrt/lib/index.js new file mode 100644 index 000000000000..2aa34ba05294 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/scale/sqrt/lib/index.js @@ -0,0 +1,42 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +/** +* Square root scale constructor. +* +* @module @stdlib/plot/vega/scale/sqrt +* +* @example +* var SqrtScale = require( '@stdlib/plot/vega/scale/sqrt' ); +* +* var scale = new SqrtScale({ +* 'name': 'xScale' +* }); +* // returns <SqrtScale> +*/ + +// MODULES // + +var main = require( './main.js' ); + + +// EXPORTS // + +module.exports = main; diff --git a/lib/node_modules/@stdlib/plot/vega/scale/sqrt/lib/main.js b/lib/node_modules/@stdlib/plot/vega/scale/sqrt/lib/main.js new file mode 100644 index 000000000000..6aedd99928be --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/scale/sqrt/lib/main.js @@ -0,0 +1,195 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable no-restricted-syntax, no-invalid-this */ + +'use strict'; + +// MODULES // + +var isObject = require( '@stdlib/assert/is-object' ); +var hasProp = require( '@stdlib/assert/has-property' ); +var setReadWriteAccessor = require( '@stdlib/utils/define-read-write-accessor' ); +var setNonEnumerableReadOnly = require( '@stdlib/utils/define-nonenumerable-read-only-property' ); +var setNonEnumerableReadOnlyAccessor = require( '@stdlib/utils/define-nonenumerable-read-only-accessor' ); // eslint-disable-line id-length +var inherit = require( '@stdlib/utils/inherit' ); +var instance2json = require( '@stdlib/plot/vega/base/to-json' ); +var PowerScale = require( '@stdlib/plot/vega/scale/power' ); +var format = require( '@stdlib/string/format' ); +var properties = require( './properties.json' ); + +// Note: keep the following in alphabetical order according to the `require` path... +var EXPONENT = require( './exponent/value.js' ); +var getExponent = require( './exponent/get.js' ); +var setExponent = require( './exponent/set.js' ); + +var getProperties = require( './properties/get.js' ); + +var TYPE = require( './type/type.js' ); +var getType = require( './type/get.js' ); +var setType = require( './type/set.js' ); + + +// MAIN // + +/** +* Square root scale constructor. +* +* @constructor +* @param {Options} options - constructor options +* @param {string} options.name - scale name +* @param {(Collection|Object|Signal)} [options.bins] - bin boundaries over the scale domain +* @param {boolean} [options.clamp=false] - boolean indicating whether to clamp output values to the scale range +* @param {(Collection|Object|Signal)} [options.domain] - domain of associated data values +* @param {number} [options.domainMax] - maximum value in the scale domain (overrides the `domain` option) +* @param {number} [options.domainMin] - minimum value in the scale domain (overrides the `domain` option) +* @param {number} [options.domainMid] - single mid-point value inserted into a two-element domain +* @param {Collection} [options.domainRaw] - array of raw domain values which overrides the `domain` property +* @param {(string|Object)} [options.interpolate] - scale range interpolation method +* @param {(boolean|number|Signal)} [options.nice=false] - scale domain "nicing" +* @param {number} [options.padding] - scale domain padding (in pixels) +* @param {(Collection|Object|Signal|string)} [options.range] - scale range +* @param {boolean} [options.reverse=false] - boolean indicating whether to reverse the order of the scale range +* @param {boolean} [options.round=false] - boolean indicating whether to round numeric output values to integers +* @param {boolean} [options.zero] - boolean indicating whether the scale domain should include zero +* @throws {TypeError} options argument must be an object +* @throws {Error} must provide valid options +* @returns {SqrtScale} scale instance +* +* @example +* var scale = new SqrtScale({ +* 'name': 'xScale' +* }); +* // returns <SqrtScale> +*/ +function SqrtScale( options ) { + if ( !( this instanceof SqrtScale ) ) { + return new SqrtScale( options ); + } + if ( !isObject( options ) ) { + throw new TypeError( format( 'invalid argument. Options argument must be an object. Value: `%s`.', options ) ); + } + if ( hasProp( options, 'type' ) && options.type !== TYPE ) { + throw new TypeError( format( 'invalid argument. `%s` option must be equal to "%s". Option: `%s`.', 'type', TYPE, options.type ) ); + } + if ( hasProp( options, 'exponent' ) && options.exponent !== EXPONENT ) { + throw new TypeError( format( 'invalid argument. `%s` option must be equal to "%s". Option: `%s`.', 'exponent', EXPONENT, options.exponent ) ); + } + PowerScale.call( this, options ); + this._type = TYPE; + this._exponent = EXPONENT; + return this; +} + +/* +* Inherit from a parent prototype. +*/ +inherit( SqrtScale, PowerScale ); + +/** +* Constructor name. +* +* @private +* @name name +* @memberof SqrtScale +* @readonly +* @type {string} +*/ +setNonEnumerableReadOnly( SqrtScale, 'name', 'SqrtScale' ); + +/** +* Exponent which is used by the scale when computing an exponential transform. +* +* @name exponent +* @memberof SqrtScale.prototype +* @type {number} +* @default 0.5 +* +* @example +* var scale = new SqrtScale({ +* 'name': 'xScale' +* }); +* +* var v = scale.exponent; +* // returns 0.5 +*/ +setReadWriteAccessor( SqrtScale.prototype, 'exponent', getExponent, setExponent ); + +/** +* Scale properties. +* +* @name properties +* @memberof SqrtScale.prototype +* @type {Array<string>} +* +* @example +* var scale = new SqrtScale({ +* 'name': 'xScale' +* }); +* +* var v = scale.properties; +* // returns [...] +*/ +setNonEnumerableReadOnlyAccessor( SqrtScale.prototype, 'properties', getProperties ); + +/** +* Scale type. +* +* @name type +* @memberof SqrtScale.prototype +* @type {string} +* @default 'sqrt' +* +* @example +* var scale = new SqrtScale({ +* 'name': 'xScale' +* }); +* +* var v = scale.type; +* // returns 'sqrt' +*/ +setReadWriteAccessor( SqrtScale.prototype, 'type', getType, setType ); + +/** +* Serializes an instance to a JSON object. +* +* ## Notes +* +* - This method is implicitly invoked by `JSON.stringify`. +* +* @name toJSON +* @memberof SqrtScale.prototype +* @type {Function} +* @returns {Object} JSON object +* +* @example +* var scale = new SqrtScale({ +* 'name': 'xScale' +* }); +* +* var v = scale.toJSON(); +* // returns {...} +*/ +setNonEnumerableReadOnly( SqrtScale.prototype, 'toJSON', function toJSON() { + return instance2json( this, properties ); +}); + + +// EXPORTS // + +module.exports = SqrtScale; diff --git a/lib/node_modules/@stdlib/plot/vega/scale/sqrt/lib/properties.json b/lib/node_modules/@stdlib/plot/vega/scale/sqrt/lib/properties.json new file mode 100644 index 000000000000..816f8d5c5a1e --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/scale/sqrt/lib/properties.json @@ -0,0 +1,21 @@ +[ + "domain", + "domainMax", + "domainMin", + "domainMid", + "domainRaw", + "interpolate", + "name", + "range", + "reverse", + "round", + "type", + + "bins", + "clamp", + "padding", + "nice", + "zero", + + "exponent" +] diff --git a/lib/node_modules/@stdlib/plot/vega/scale/sqrt/lib/properties/get.js b/lib/node_modules/@stdlib/plot/vega/scale/sqrt/lib/properties/get.js new file mode 100644 index 000000000000..8fc57de14e90 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/scale/sqrt/lib/properties/get.js @@ -0,0 +1,41 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var properties = require( './../properties.json' ); + + +// MAIN // + +/** +* Returns the list of enumerable properties. +* +* @private +* @returns {Array<string>} properties +*/ +function get() { + return properties.slice(); +} + + +// EXPORTS // + +module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/vega/scale/sqrt/lib/type/get.js b/lib/node_modules/@stdlib/plot/vega/scale/sqrt/lib/type/get.js new file mode 100644 index 000000000000..8f5ecbfba703 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/scale/sqrt/lib/type/get.js @@ -0,0 +1,41 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var TYPE = require( './type.js' ); + + +// MAIN // + +/** +* Returns the scale type. +* +* @private +* @returns {string} scale type +*/ +function get() { + return TYPE; +} + + +// EXPORTS // + +module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/vega/scale/sqrt/lib/type/set.js b/lib/node_modules/@stdlib/plot/vega/scale/sqrt/lib/type/set.js new file mode 100644 index 000000000000..8690534fdb51 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/scale/sqrt/lib/type/set.js @@ -0,0 +1,46 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var format = require( '@stdlib/string/format' ); +var TYPE = require( './type.js' ); + + +// MAIN // + +/** +* Sets the scale type. +* +* @private +* @param {string} value - input value +* @throws {TypeError} must be a valid scale +* @returns {void} +*/ +function set( value ) { + if ( value !== TYPE ) { + throw new TypeError( format( 'invalid assignment. `%s` must be equal to "%s". Value: `%s`.', 'type', TYPE, value ) ); + } +} + + +// EXPORTS // + +module.exports = set; diff --git a/lib/node_modules/@stdlib/plot/vega/scale/sqrt/lib/type/type.js b/lib/node_modules/@stdlib/plot/vega/scale/sqrt/lib/type/type.js new file mode 100644 index 000000000000..cfaa65306d2e --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/scale/sqrt/lib/type/type.js @@ -0,0 +1,23 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// EXPORTS // + +module.exports = 'sqrt'; diff --git a/lib/node_modules/@stdlib/plot/vega/scale/sqrt/package.json b/lib/node_modules/@stdlib/plot/vega/scale/sqrt/package.json new file mode 100644 index 000000000000..487040afc82b --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/scale/sqrt/package.json @@ -0,0 +1,62 @@ +{ + "name": "@stdlib/plot/vega/scale/linear", + "version": "0.0.0", + "description": "Linear scale constructor.", + "license": "Apache-2.0", + "author": { + "name": "The Stdlib Authors", + "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" + }, + "contributors": [ + { + "name": "The Stdlib Authors", + "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" + } + ], + "main": "./lib", + "directories": { + "benchmark": "./benchmark", + "doc": "./docs", + "example": "./examples", + "lib": "./lib", + "test": "./test" + }, + "types": "./docs/types", + "scripts": {}, + "homepage": "https://github.com/stdlib-js/stdlib", + "repository": { + "type": "git", + "url": "git://github.com/stdlib-js/stdlib.git" + }, + "bugs": { + "url": "https://github.com/stdlib-js/stdlib/issues" + }, + "dependencies": {}, + "devDependencies": {}, + "engines": { + "node": ">=0.10.0", + "npm": ">2.7.0" + }, + "os": [ + "aix", + "darwin", + "freebsd", + "linux", + "macos", + "openbsd", + "sunos", + "win32", + "windows" + ], + "keywords": [ + "stdlib", + "plot", + "vega", + "scale", + "quantitative", + "linear", + "constructor", + "ctor" + ], + "__stdlib__": {} +} diff --git a/lib/node_modules/@stdlib/plot/vega/scale/symmetric-log/examples/index.js b/lib/node_modules/@stdlib/plot/vega/scale/symmetric-log/examples/index.js new file mode 100644 index 000000000000..3a16cfffec90 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/scale/symmetric-log/examples/index.js @@ -0,0 +1,27 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +var SymLogScale = require( './../lib' ); + +var scale = new SymLogScale({ + 'name': 'xScale' +}); + +console.log( scale.toJSON() ); diff --git a/lib/node_modules/@stdlib/plot/vega/scale/symmetric-log/lib/change_event.js b/lib/node_modules/@stdlib/plot/vega/scale/symmetric-log/lib/change_event.js new file mode 100644 index 000000000000..55baae0c617a --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/scale/symmetric-log/lib/change_event.js @@ -0,0 +1,41 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MAIN // + +/** +* Returns a new change event object. +* +* @private +* @param {string} property - property name +* @returns {Object} event object +*/ +function event( property ) { // eslint-disable-line stdlib/no-redeclare + return { + 'type': 'update', + 'source': 'scale', + 'property': property + }; +} + + +// EXPORTS // + +module.exports = event; diff --git a/lib/node_modules/@stdlib/plot/vega/scale/symmetric-log/lib/constant/get.js b/lib/node_modules/@stdlib/plot/vega/scale/symmetric-log/lib/constant/get.js new file mode 100644 index 000000000000..a9435ab89095 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/scale/symmetric-log/lib/constant/get.js @@ -0,0 +1,43 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable no-invalid-this */ + +'use strict'; + +// MODULES // + +var prop = require( './properties.js' ); + + +// MAIN // + +/** +* Returns the constant which is used by the scale when determining the slope of the symlog function around zero. +* +* @private +* @returns {number} constant +*/ +function get() { + return this[ prop.private ]; +} + + +// EXPORTS // + +module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/vega/scale/symmetric-log/lib/constant/properties.js b/lib/node_modules/@stdlib/plot/vega/scale/symmetric-log/lib/constant/properties.js new file mode 100644 index 000000000000..cf1666c95979 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/scale/symmetric-log/lib/constant/properties.js @@ -0,0 +1,33 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var property2object = require( '@stdlib/plot/vega/base/property2object' ); + + +// MAIN // + +var obj = property2object( 'constant' ); + + +// EXPORTS // + +module.exports = obj; diff --git a/lib/node_modules/@stdlib/plot/vega/scale/symmetric-log/lib/constant/set.js b/lib/node_modules/@stdlib/plot/vega/scale/symmetric-log/lib/constant/set.js new file mode 100644 index 000000000000..19f3e26ba395 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/scale/symmetric-log/lib/constant/set.js @@ -0,0 +1,61 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable no-invalid-this */ + +'use strict'; + +// MODULES // + +var logger = require( 'debug' ); +var isFiniteNumber = require( '@stdlib/assert/is-finite' ).isPrimitive; +var format = require( '@stdlib/string/format' ); +var changeEvent = require( './../change_event.js' ); +var prop = require( './properties.js' ); + + +// VARIABLES // + +var debug = logger( 'vega:symmetric-log-scale:set:'+prop.name ); + + +// MAIN // + +/** +* Sets the constant which is used by the scale when determining the slope of the symlog function around zero. +* +* @private +* @param {number} value - input value +* @throws {TypeError} must be a finite number +* @returns {void} +*/ +function set( value ) { + if ( !isFiniteNumber( value ) ) { + throw new TypeError( format( 'invalid assignment. `%s` must be a finite number. Value: `%s`.', prop.name, value ) ); + } + if ( value !== this[ prop.private ] ) { + debug( 'Current value: %s. New value: %s.', this[ prop.private ], value ); + this[ prop.private ] = value; + this.emit( 'change', changeEvent( prop.name ) ); + } +} + + +// EXPORTS // + +module.exports = set; diff --git a/lib/node_modules/@stdlib/plot/vega/scale/symmetric-log/lib/defaults.js b/lib/node_modules/@stdlib/plot/vega/scale/symmetric-log/lib/defaults.js new file mode 100644 index 000000000000..ab271c7289b4 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/scale/symmetric-log/lib/defaults.js @@ -0,0 +1,43 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MAIN // + +/** +* Returns defaults. +* +* @private +* @returns {Object} default options +* +* @example +* var o = defaults(); +* // returns {...} +*/ +function defaults() { + return { + // Constant which is used by the scale when determining the slope of the symlog function around zero: + 'constant': 1 + }; +} + + +// EXPORTS // + +module.exports = defaults; diff --git a/lib/node_modules/@stdlib/plot/vega/scale/symmetric-log/lib/index.js b/lib/node_modules/@stdlib/plot/vega/scale/symmetric-log/lib/index.js new file mode 100644 index 000000000000..bb372d07e8b0 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/scale/symmetric-log/lib/index.js @@ -0,0 +1,42 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +/** +* Symmetric log scale constructor. +* +* @module @stdlib/plot/vega/scale/symmetric-log +* +* @example +* var SymLogScale = require( '@stdlib/plot/vega/scale/symmetric-log' ); +* +* var scale = new SymLogScale({ +* 'name': 'xScale' +* }); +* // returns <SymLogScale> +*/ + +// MODULES // + +var main = require( './main.js' ); + + +// EXPORTS // + +module.exports = main; diff --git a/lib/node_modules/@stdlib/plot/vega/scale/symmetric-log/lib/main.js b/lib/node_modules/@stdlib/plot/vega/scale/symmetric-log/lib/main.js new file mode 100644 index 000000000000..d6707480ca4e --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/scale/symmetric-log/lib/main.js @@ -0,0 +1,238 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable no-restricted-syntax, no-invalid-this */ + +'use strict'; + +// MODULES // + +var logger = require( 'debug' ); +var isObject = require( '@stdlib/assert/is-object' ); +var hasProp = require( '@stdlib/assert/has-property' ); +var setReadWriteAccessor = require( '@stdlib/utils/define-read-write-accessor' ); +var setNonEnumerableReadOnly = require( '@stdlib/utils/define-nonenumerable-read-only-property' ); +var setNonEnumerableReadOnlyAccessor = require( '@stdlib/utils/define-nonenumerable-read-only-accessor' ); // eslint-disable-line id-length +var inherit = require( '@stdlib/utils/inherit' ); +var objectKeys = require( '@stdlib/utils/keys' ); +var QuantitativeScale = require( '@stdlib/plot/vega/scale/quantitative' ); +var transformErrorMessage = require( '@stdlib/plot/vega/base/transform-validation-message' ); +var instance2json = require( '@stdlib/plot/vega/base/to-json' ); +var format = require( '@stdlib/string/format' ); +var properties = require( './properties.json' ); +var defaults = require( './defaults.js' ); +var TYPE = require( './type/type.js' ); + +// Note: keep the following in alphabetical order according to the `require` path... +var getConstant = require( './constant/get.js' ); +var setConstant = require( './constant/set.js' ); + +var getProperties = require( './properties/get.js' ); + +var getType = require( './type/get.js' ); +var setType = require( './type/set.js' ); + + +// VARIABLES // + +var debug = logger( 'vega:symmetric-log-scale:main' ); + + +// MAIN // + +/** +* Logarithmic scale constructor. +* +* @constructor +* @param {Options} options - constructor options +* @param {string} options.name - scale name +* @param {(Collection|Object|Signal)} [options.bins] - bin boundaries over the scale domain +* @param {boolean} [options.clamp=false] - boolean indicating whether to clamp output values to the scale range +* @param {number} [options.constant=1] - constant which is used by the scale when determining the slope of the symlog function around zero +* @param {(Collection|Object|Signal)} [options.domain] - domain of associated data values +* @param {number} [options.domainMax] - maximum value in the scale domain (overrides the `domain` option) +* @param {number} [options.domainMin] - minimum value in the scale domain (overrides the `domain` option) +* @param {number} [options.domainMid] - single mid-point value inserted into a two-element domain +* @param {Collection} [options.domainRaw] - array of raw domain values which overrides the `domain` property +* @param {(string|Object)} [options.interpolate] - scale range interpolation method +* @param {(boolean|number|Signal)} [options.nice=false] - scale domain "nicing" +* @param {number} [options.padding] - scale domain padding (in pixels) +* @param {(Collection|Object|Signal|string)} [options.range] - scale range +* @param {boolean} [options.reverse=false] - boolean indicating whether to reverse the order of the scale range +* @param {boolean} [options.round=false] - boolean indicating whether to round numeric output values to integers +* @param {boolean} [options.zero] - boolean indicating whether the scale domain should include zero +* @throws {TypeError} options argument must be an object +* @throws {Error} must provide valid options +* @returns {SymLogScale} scale instance +* +* @example +* var scale = new SymLogScale({ +* 'name': 'xScale' +* }); +* // returns <SymLogScale> +*/ +function SymLogScale( options ) { + var opts; + var keys; + var v; + var k; + var i; + if ( !( this instanceof SymLogScale ) ) { + return new SymLogScale( options ); + } + if ( !isObject( options ) ) { + throw new TypeError( format( 'invalid argument. Options argument must be an object. Value: `%s`.', options ) ); + } + if ( hasProp( options, 'type' ) && options.type !== TYPE ) { + throw new TypeError( format( 'invalid argument. `%s` option must be equal to "%s". Option: `%s`.', 'type', TYPE, options.type ) ); + } + // Check for required properties... + if ( !hasProp( options, 'name' ) ) { + throw new TypeError( 'invalid argument. Options argument must specify the scale name.' ); + } + QuantitativeScale.call( this, { + 'name': options.name + }); + this._type = TYPE; + + // Resolve the default configuration: + opts = defaults(); + + // Set internal properties according to the default configuration... + keys = objectKeys( opts ); + for ( i = 0; i < keys.length; i++ ) { + k = keys[ i ]; + this[ '_'+k ] = opts[ k ]; + } + // Validate provided options by attempting to assign option values to corresponding fields... + for ( i = 0; i < properties.length; i++ ) { + k = properties[ i ]; + if ( !hasProp( options, k ) ) { + continue; + } + v = options[ k ]; + try { + this[ k ] = v; + } catch ( err ) { + debug( 'Encountered an error. Error: %s', err.message ); + + // FIXME: retain thrown error type + throw new Error( transformErrorMessage( err.message ) ); + } + } + return this; +} + +/* +* Inherit from a parent prototype. +*/ +inherit( SymLogScale, QuantitativeScale ); + +/** +* Constructor name. +* +* @private +* @name name +* @memberof SymLogScale +* @readonly +* @type {string} +*/ +setNonEnumerableReadOnly( SymLogScale, 'name', 'SymLogScale' ); + +/** +* The constant which is used by the scale when determining the slope of the symlog function around zero. +* +* @name constant +* @memberof SymLogScale.prototype +* @type {number} +* @default 1 +* +* @example +* var scale = new SymLogScale({ +* 'name': 'xScale', +* 'constant': 2 +* }); +* +* var v = scale.constant; +* // returns 2 +*/ +setReadWriteAccessor( SymLogScale.prototype, 'constant', getConstant, setConstant ); + +/** +* Scale properties. +* +* @name properties +* @memberof SymLogScale.prototype +* @type {Array<string>} +* +* @example +* var scale = new SymLogScale({ +* 'name': 'xScale' +* }); +* +* var v = scale.properties; +* // returns [...] +*/ +setNonEnumerableReadOnlyAccessor( SymLogScale.prototype, 'properties', getProperties ); + +/** +* Scale type. +* +* @name type +* @memberof SymLogScale.prototype +* @type {string} +* @default 'symlog' +* +* @example +* var scale = new SymLogScale({ +* 'name': 'xScale' +* }); +* +* var v = scale.type; +* // returns 'symlog' +*/ +setReadWriteAccessor( SymLogScale.prototype, 'type', getType, setType ); + +/** +* Serializes an instance to a JSON object. +* +* ## Notes +* +* - This method is implicitly invoked by `JSON.stringify`. +* +* @name toJSON +* @memberof SymLogScale.prototype +* @type {Function} +* @returns {Object} JSON object +* +* @example +* var scale = new SymLogScale({ +* 'name': 'xScale' +* }); +* +* var v = scale.toJSON(); +* // returns {...} +*/ +setNonEnumerableReadOnly( SymLogScale.prototype, 'toJSON', function toJSON() { + return instance2json( this, properties ); +}); + + +// EXPORTS // + +module.exports = SymLogScale; diff --git a/lib/node_modules/@stdlib/plot/vega/scale/symmetric-log/lib/properties.json b/lib/node_modules/@stdlib/plot/vega/scale/symmetric-log/lib/properties.json new file mode 100644 index 000000000000..d9ed6e7d36dd --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/scale/symmetric-log/lib/properties.json @@ -0,0 +1,21 @@ +[ + "domain", + "domainMax", + "domainMin", + "domainMid", + "domainRaw", + "interpolate", + "name", + "range", + "reverse", + "round", + "type", + + "bins", + "clamp", + "padding", + "nice", + "zero", + + "constant" +] diff --git a/lib/node_modules/@stdlib/plot/vega/scale/symmetric-log/lib/properties/get.js b/lib/node_modules/@stdlib/plot/vega/scale/symmetric-log/lib/properties/get.js new file mode 100644 index 000000000000..8fc57de14e90 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/scale/symmetric-log/lib/properties/get.js @@ -0,0 +1,41 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var properties = require( './../properties.json' ); + + +// MAIN // + +/** +* Returns the list of enumerable properties. +* +* @private +* @returns {Array<string>} properties +*/ +function get() { + return properties.slice(); +} + + +// EXPORTS // + +module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/vega/scale/symmetric-log/lib/type/get.js b/lib/node_modules/@stdlib/plot/vega/scale/symmetric-log/lib/type/get.js new file mode 100644 index 000000000000..8f5ecbfba703 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/scale/symmetric-log/lib/type/get.js @@ -0,0 +1,41 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var TYPE = require( './type.js' ); + + +// MAIN // + +/** +* Returns the scale type. +* +* @private +* @returns {string} scale type +*/ +function get() { + return TYPE; +} + + +// EXPORTS // + +module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/vega/scale/symmetric-log/lib/type/set.js b/lib/node_modules/@stdlib/plot/vega/scale/symmetric-log/lib/type/set.js new file mode 100644 index 000000000000..8690534fdb51 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/scale/symmetric-log/lib/type/set.js @@ -0,0 +1,46 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var format = require( '@stdlib/string/format' ); +var TYPE = require( './type.js' ); + + +// MAIN // + +/** +* Sets the scale type. +* +* @private +* @param {string} value - input value +* @throws {TypeError} must be a valid scale +* @returns {void} +*/ +function set( value ) { + if ( value !== TYPE ) { + throw new TypeError( format( 'invalid assignment. `%s` must be equal to "%s". Value: `%s`.', 'type', TYPE, value ) ); + } +} + + +// EXPORTS // + +module.exports = set; diff --git a/lib/node_modules/@stdlib/plot/vega/scale/symmetric-log/lib/type/type.js b/lib/node_modules/@stdlib/plot/vega/scale/symmetric-log/lib/type/type.js new file mode 100644 index 000000000000..6a8d4f34ece2 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/scale/symmetric-log/lib/type/type.js @@ -0,0 +1,23 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// EXPORTS // + +module.exports = 'symlog'; diff --git a/lib/node_modules/@stdlib/plot/vega/scale/symmetric-log/package.json b/lib/node_modules/@stdlib/plot/vega/scale/symmetric-log/package.json new file mode 100644 index 000000000000..5302e96c0cd9 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/scale/symmetric-log/package.json @@ -0,0 +1,64 @@ +{ + "name": "@stdlib/plot/vega/scale/symmetric-log", + "version": "0.0.0", + "description": "Symmetric log scale constructor.", + "license": "Apache-2.0", + "author": { + "name": "The Stdlib Authors", + "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" + }, + "contributors": [ + { + "name": "The Stdlib Authors", + "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" + } + ], + "main": "./lib", + "directories": { + "benchmark": "./benchmark", + "doc": "./docs", + "example": "./examples", + "lib": "./lib", + "test": "./test" + }, + "types": "./docs/types", + "scripts": {}, + "homepage": "https://github.com/stdlib-js/stdlib", + "repository": { + "type": "git", + "url": "git://github.com/stdlib-js/stdlib.git" + }, + "bugs": { + "url": "https://github.com/stdlib-js/stdlib/issues" + }, + "dependencies": {}, + "devDependencies": {}, + "engines": { + "node": ">=0.10.0", + "npm": ">2.7.0" + }, + "os": [ + "aix", + "darwin", + "freebsd", + "linux", + "macos", + "openbsd", + "sunos", + "win32", + "windows" + ], + "keywords": [ + "stdlib", + "plot", + "vega", + "scale", + "quantitative", + "symmetric", + "log", + "logarithm", + "constructor", + "ctor" + ], + "__stdlib__": {} +} diff --git a/lib/node_modules/@stdlib/plot/vega/scale/time/examples/index.js b/lib/node_modules/@stdlib/plot/vega/scale/time/examples/index.js new file mode 100644 index 000000000000..ab6130948547 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/scale/time/examples/index.js @@ -0,0 +1,27 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +var TimeScale = require( './../lib' ); + +var scale = new TimeScale({ + 'name': 'xScale' +}); + +console.log( scale.toJSON() ); diff --git a/lib/node_modules/@stdlib/plot/vega/scale/time/lib/change_event.js b/lib/node_modules/@stdlib/plot/vega/scale/time/lib/change_event.js new file mode 100644 index 000000000000..55baae0c617a --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/scale/time/lib/change_event.js @@ -0,0 +1,41 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MAIN // + +/** +* Returns a new change event object. +* +* @private +* @param {string} property - property name +* @returns {Object} event object +*/ +function event( property ) { // eslint-disable-line stdlib/no-redeclare + return { + 'type': 'update', + 'source': 'scale', + 'property': property + }; +} + + +// EXPORTS // + +module.exports = event; diff --git a/lib/node_modules/@stdlib/plot/vega/scale/time/lib/index.js b/lib/node_modules/@stdlib/plot/vega/scale/time/lib/index.js new file mode 100644 index 000000000000..91268d5754fb --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/scale/time/lib/index.js @@ -0,0 +1,42 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +/** +* Time scale constructor. +* +* @module @stdlib/plot/vega/scale/time +* +* @example +* var TimeScale = require( '@stdlib/plot/vega/scale/time' ); +* +* var scale = new TimeScale({ +* 'name': 'xScale' +* }); +* // returns <TimeScale> +*/ + +// MODULES // + +var main = require( './main.js' ); + + +// EXPORTS // + +module.exports = main; diff --git a/lib/node_modules/@stdlib/plot/vega/scale/time/lib/main.js b/lib/node_modules/@stdlib/plot/vega/scale/time/lib/main.js new file mode 100644 index 000000000000..08f117d16ac5 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/scale/time/lib/main.js @@ -0,0 +1,143 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var isObject = require( '@stdlib/assert/is-object' ); +var hasProp = require( '@stdlib/assert/has-property' ); +var setReadWriteAccessor = require( '@stdlib/utils/define-read-write-accessor' ); +var setNonEnumerableReadOnly = require( '@stdlib/utils/define-nonenumerable-read-only-property' ); +var inherit = require( '@stdlib/utils/inherit' ); +var QuantitativeScale = require( '@stdlib/plot/vega/scale/quantitative' ); +var format = require( '@stdlib/string/format' ); + +// Note: keep the following in alphabetical order according to the `require` path... +var getNice = require( './nice/get.js' ); +var setNice = require( './nice/set.js' ); + +var TYPE = require( './type/type.js' ); +var getType = require( './type/get.js' ); +var setType = require( './type/set.js' ); + + +// MAIN // + +/** +* Time scale constructor. +* +* @constructor +* @param {Options} options - constructor options +* @param {string} options.name - scale name +* @param {(Collection|Object|Signal)} [options.bins] - bin boundaries over the scale domain +* @param {boolean} [options.clamp=false] - boolean indicating whether to clamp output values to the scale range +* @param {(Collection|Object|Signal)} [options.domain] - domain of associated data values +* @param {number} [options.domainMax] - maximum value in the scale domain (overrides the `domain` option) +* @param {number} [options.domainMin] - minimum value in the scale domain (overrides the `domain` option) +* @param {number} [options.domainMid] - single mid-point value inserted into a two-element domain +* @param {Collection} [options.domainRaw] - array of raw domain values which overrides the `domain` property +* @param {(string|Object)} [options.interpolate] - scale range interpolation method +* @param {(boolean|number|string|Object|Signal)} [options.nice=false] - scale domain "nicing" +* @param {number} [options.padding] - scale domain padding (in pixels) +* @param {(Collection|Object|Signal|string)} [options.range] - scale range +* @param {boolean} [options.reverse=false] - boolean indicating whether to reverse the order of the scale range +* @param {boolean} [options.round=false] - boolean indicating whether to round numeric output values to integers +* @param {boolean} [options.zero] - boolean indicating whether the scale domain should include zero +* @throws {TypeError} options argument must be an object +* @throws {Error} must provide valid options +* @returns {TimeScale} scale instance +* +* @example +* var scale = new TimeScale({ +* 'name': 'xScale' +* }); +* // returns <TimeScale> +*/ +function TimeScale( options ) { + if ( !( this instanceof TimeScale ) ) { + return new TimeScale( options ); + } + if ( !isObject( options ) ) { + throw new TypeError( format( 'invalid argument. Options argument must be an object. Value: `%s`.', options ) ); + } + if ( hasProp( options, 'type' ) && options.type !== TYPE ) { + throw new TypeError( format( 'invalid argument. `%s` option must be equal to "%s". Option: `%s`.', 'type', TYPE, options.type ) ); + } + QuantitativeScale.call( this, options ); + this._type = TYPE; + return this; +} + +/* +* Inherit from a parent prototype. +*/ +inherit( TimeScale, QuantitativeScale ); + +/** +* Constructor name. +* +* @private +* @name name +* @memberof TimeScale +* @readonly +* @type {string} +*/ +setNonEnumerableReadOnly( TimeScale, 'name', 'TimeScale' ); + +/** +* Scale domain "nicing". +* +* @name nice +* @memberof TimeScale.prototype +* @type {(boolean|number|string|Object|Signal)} +* @default false +* +* @example +* var scale = new TimeScale({ +* 'name': 'xScale', +* 'nice': true +* }); +* +* var v = scale.nice; +* // returns true +*/ +setReadWriteAccessor( TimeScale.prototype, 'nice', getNice, setNice ); + +/** +* Scale type. +* +* @name type +* @memberof TimeScale.prototype +* @type {string} +* @default 'time' +* +* @example +* var scale = new TimeScale({ +* 'name': 'xScale' +* }); +* +* var v = scale.type; +* // returns 'time' +*/ +setReadWriteAccessor( TimeScale.prototype, 'type', getType, setType ); + + +// EXPORTS // + +module.exports = TimeScale; diff --git a/lib/node_modules/@stdlib/plot/vega/scale/time/lib/nice/get.js b/lib/node_modules/@stdlib/plot/vega/scale/time/lib/nice/get.js new file mode 100644 index 000000000000..f8f7e1b00934 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/scale/time/lib/nice/get.js @@ -0,0 +1,46 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable no-invalid-this */ + +'use strict'; + +// MODULES // + +var isObject = require( '@stdlib/assert/is-object' ); +var copy = require( '@stdlib/utils/copy' ); +var prop = require( './properties.js' ); + + +// MAIN // + +/** +* Returns scale domain "nicing". +* +* @private +* @returns {(void|number|Signal|Object|boolean|string)} output value +*/ +function get() { + var v = this[ prop.private ]; + return ( isObject( v ) ) ? copy( v ) : v; +} + + +// EXPORTS // + +module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/vega/scale/time/lib/nice/properties.js b/lib/node_modules/@stdlib/plot/vega/scale/time/lib/nice/properties.js new file mode 100644 index 000000000000..9f70d83d59bb --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/scale/time/lib/nice/properties.js @@ -0,0 +1,33 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var property2object = require( '@stdlib/plot/vega/base/property2object' ); + + +// MAIN // + +var obj = property2object( 'nice' ); + + +// EXPORTS // + +module.exports = obj; diff --git a/lib/node_modules/@stdlib/plot/vega/scale/time/lib/nice/set.js b/lib/node_modules/@stdlib/plot/vega/scale/time/lib/nice/set.js new file mode 100644 index 000000000000..36e96c06114d --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/scale/time/lib/nice/set.js @@ -0,0 +1,83 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable no-invalid-this */ + +'use strict'; + +// MODULES // + +var logger = require( 'debug' ); +var isNumber = require( '@stdlib/assert/is-number' ).isPrimitive; +var isBoolean = require( '@stdlib/assert/is-boolean' ).isPrimitive; +var isString = require( '@stdlib/assert/is-string' ).isPrimitive; +var isObject = require( '@stdlib/assert/is-object' ); +var copy = require( '@stdlib/utils/copy' ); +var format = require( '@stdlib/string/format' ); +var changeEvent = require( './../change_event.js' ); +var prop = require( './properties.js' ); + + +// VARIABLES // + +var debug = logger( 'vega:time-scale:set:'+prop.name ); + + +// MAIN // + +/** +* Sets scale domain "nicing". +* +* @private +* @param {(number|boolean|Signal|Object|string)} value - input value +* @throws {TypeError} must be either a number, boolean, string, signal, or an object +* @returns {void} +*/ +function set( value ) { + var isObj = isObject( value ); + + // FIXME: if string, validate one of allowed nice values => plot/vega/base/assert/is-time-scale-nice-string + + // FIXME: if object, validate has expected fields => plot/vega/base/assert/is-time-scale-nice-object + + // FIXME: add signal support + if ( + !isObj && + !isNumber( value ) && + !isBoolean( value ) && + !isString( value ) + ) { + throw new TypeError( format( 'invalid assignment. `%s` must be either a number, boolean, string, signal, or an object. Value: `%s`.', prop.name, value ) ); + } + if ( isObj ) { + value = copy( value ); + } + + // FIXME: should we perform deep equality comparison for provided objects in order to avoid potential false positive change events? + + if ( value !== this[ prop.private ] ) { + debug( 'Current value: %s. New value: %s.', this[ prop.private ], value ); + this[ prop.private ] = value; + this.emit( 'change', changeEvent( prop.name ) ); + } +} + + +// EXPORTS // + +module.exports = set; diff --git a/lib/node_modules/@stdlib/plot/vega/scale/time/lib/type/get.js b/lib/node_modules/@stdlib/plot/vega/scale/time/lib/type/get.js new file mode 100644 index 000000000000..8f5ecbfba703 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/scale/time/lib/type/get.js @@ -0,0 +1,41 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var TYPE = require( './type.js' ); + + +// MAIN // + +/** +* Returns the scale type. +* +* @private +* @returns {string} scale type +*/ +function get() { + return TYPE; +} + + +// EXPORTS // + +module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/vega/scale/time/lib/type/set.js b/lib/node_modules/@stdlib/plot/vega/scale/time/lib/type/set.js new file mode 100644 index 000000000000..8690534fdb51 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/scale/time/lib/type/set.js @@ -0,0 +1,46 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var format = require( '@stdlib/string/format' ); +var TYPE = require( './type.js' ); + + +// MAIN // + +/** +* Sets the scale type. +* +* @private +* @param {string} value - input value +* @throws {TypeError} must be a valid scale +* @returns {void} +*/ +function set( value ) { + if ( value !== TYPE ) { + throw new TypeError( format( 'invalid assignment. `%s` must be equal to "%s". Value: `%s`.', 'type', TYPE, value ) ); + } +} + + +// EXPORTS // + +module.exports = set; diff --git a/lib/node_modules/@stdlib/plot/vega/scale/time/lib/type/type.js b/lib/node_modules/@stdlib/plot/vega/scale/time/lib/type/type.js new file mode 100644 index 000000000000..2c8ca966037a --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/scale/time/lib/type/type.js @@ -0,0 +1,23 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// EXPORTS // + +module.exports = 'time'; diff --git a/lib/node_modules/@stdlib/plot/vega/scale/time/package.json b/lib/node_modules/@stdlib/plot/vega/scale/time/package.json new file mode 100644 index 000000000000..9aa1451c3328 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/scale/time/package.json @@ -0,0 +1,62 @@ +{ + "name": "@stdlib/plot/vega/scale/time", + "version": "0.0.0", + "description": "Time scale constructor.", + "license": "Apache-2.0", + "author": { + "name": "The Stdlib Authors", + "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" + }, + "contributors": [ + { + "name": "The Stdlib Authors", + "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" + } + ], + "main": "./lib", + "directories": { + "benchmark": "./benchmark", + "doc": "./docs", + "example": "./examples", + "lib": "./lib", + "test": "./test" + }, + "types": "./docs/types", + "scripts": {}, + "homepage": "https://github.com/stdlib-js/stdlib", + "repository": { + "type": "git", + "url": "git://github.com/stdlib-js/stdlib.git" + }, + "bugs": { + "url": "https://github.com/stdlib-js/stdlib/issues" + }, + "dependencies": {}, + "devDependencies": {}, + "engines": { + "node": ">=0.10.0", + "npm": ">2.7.0" + }, + "os": [ + "aix", + "darwin", + "freebsd", + "linux", + "macos", + "openbsd", + "sunos", + "win32", + "windows" + ], + "keywords": [ + "stdlib", + "plot", + "vega", + "scale", + "quantitative", + "time", + "constructor", + "ctor" + ], + "__stdlib__": {} +} diff --git a/lib/node_modules/@stdlib/plot/vega/scale/utc/examples/index.js b/lib/node_modules/@stdlib/plot/vega/scale/utc/examples/index.js new file mode 100644 index 000000000000..52310727b636 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/scale/utc/examples/index.js @@ -0,0 +1,27 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +var UTCScale = require( './../lib' ); + +var scale = new UTCScale({ + 'name': 'xScale' +}); + +console.log( scale.toJSON() ); diff --git a/lib/node_modules/@stdlib/plot/vega/scale/utc/lib/change_event.js b/lib/node_modules/@stdlib/plot/vega/scale/utc/lib/change_event.js new file mode 100644 index 000000000000..55baae0c617a --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/scale/utc/lib/change_event.js @@ -0,0 +1,41 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MAIN // + +/** +* Returns a new change event object. +* +* @private +* @param {string} property - property name +* @returns {Object} event object +*/ +function event( property ) { // eslint-disable-line stdlib/no-redeclare + return { + 'type': 'update', + 'source': 'scale', + 'property': property + }; +} + + +// EXPORTS // + +module.exports = event; diff --git a/lib/node_modules/@stdlib/plot/vega/scale/utc/lib/index.js b/lib/node_modules/@stdlib/plot/vega/scale/utc/lib/index.js new file mode 100644 index 000000000000..6fb2371968c0 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/scale/utc/lib/index.js @@ -0,0 +1,42 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +/** +* UTC scale constructor. +* +* @module @stdlib/plot/vega/scale/utc +* +* @example +* var UTCScale = require( '@stdlib/plot/vega/scale/utc' ); +* +* var scale = new UTCScale({ +* 'name': 'xScale' +* }); +* // returns <UTCScale> +*/ + +// MODULES // + +var main = require( './main.js' ); + + +// EXPORTS // + +module.exports = main; diff --git a/lib/node_modules/@stdlib/plot/vega/scale/utc/lib/main.js b/lib/node_modules/@stdlib/plot/vega/scale/utc/lib/main.js new file mode 100644 index 000000000000..30fbf5d75fc5 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/scale/utc/lib/main.js @@ -0,0 +1,143 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var isObject = require( '@stdlib/assert/is-object' ); +var hasProp = require( '@stdlib/assert/has-property' ); +var setReadWriteAccessor = require( '@stdlib/utils/define-read-write-accessor' ); +var setReadOnly = require( '@stdlib/utils/define-nonenumerable-read-only-property' ); +var inherit = require( '@stdlib/utils/inherit' ); +var QuantitativeScale = require( '@stdlib/plot/vega/scale/quantitative' ); +var format = require( '@stdlib/string/format' ); + +// Note: keep the following in alphabetical order according to the `require` path... +var getNice = require( './nice/get.js' ); +var setNice = require( './nice/set.js' ); + +var TYPE = require( './type/type.js' ); +var getType = require( './type/get.js' ); +var setType = require( './type/set.js' ); + + +// MAIN // + +/** +* UTC scale constructor. +* +* @constructor +* @param {Options} options - constructor options +* @param {string} options.name - scale name +* @param {(Collection|Object|Signal)} [options.bins] - bin boundaries over the scale domain +* @param {boolean} [options.clamp=false] - boolean indicating whether to clamp output values to the scale range +* @param {(Collection|Object|Signal)} [options.domain] - domain of associated data values +* @param {number} [options.domainMax] - maximum value in the scale domain (overrides the `domain` option) +* @param {number} [options.domainMin] - minimum value in the scale domain (overrides the `domain` option) +* @param {number} [options.domainMid] - single mid-point value inserted into a two-element domain +* @param {Collection} [options.domainRaw] - array of raw domain values which overrides the `domain` property +* @param {(string|Object)} [options.interpolate] - scale range interpolation method +* @param {(boolean|number|string|Object|Signal)} [options.nice=false] - scale domain "nicing" +* @param {number} [options.padding] - scale domain padding (in pixels) +* @param {(Collection|Object|Signal|string)} [options.range] - scale range +* @param {boolean} [options.reverse=false] - boolean indicating whether to reverse the order of the scale range +* @param {boolean} [options.round=false] - boolean indicating whether to round numeric output values to integers +* @param {boolean} [options.zero] - boolean indicating whether the scale domain should include zero +* @throws {TypeError} options argument must be an object +* @throws {Error} must provide valid options +* @returns {UTCScale} scale instance +* +* @example +* var scale = new UTCScale({ +* 'name': 'xScale' +* }); +* // returns <UTCScale> +*/ +function UTCScale( options ) { + if ( !( this instanceof UTCScale ) ) { + return new UTCScale( options ); + } + if ( !isObject( options ) ) { + throw new TypeError( format( 'invalid argument. Options argument must be an object. Value: `%s`.', options ) ); + } + if ( hasProp( options, 'type' ) && options.type !== TYPE ) { + throw new TypeError( format( 'invalid argument. `%s` option must be equal to "%s". Option: `%s`.', 'type', TYPE, options.type ) ); + } + QuantitativeScale.call( this, options ); + this._type = TYPE; + return this; +} + +/* +* Inherit from a parent prototype. +*/ +inherit( UTCScale, QuantitativeScale ); + +/** +* Constructor name. +* +* @private +* @name name +* @memberof UTCScale +* @readonly +* @type {string} +*/ +setReadOnly( UTCScale, 'name', 'UTCScale' ); + +/** +* Scale domain "nicing". +* +* @name nice +* @memberof UTCScale.prototype +* @type {(boolean|number|string|Object|Signal)} +* @default false +* +* @example +* var scale = new UTCScale({ +* 'name': 'xScale', +* 'nice': true +* }); +* +* var v = scale.nice; +* // returns true +*/ +setReadWriteAccessor( UTCScale.prototype, 'nice', getNice, setNice ); + +/** +* Scale type. +* +* @name type +* @memberof UTCScale.prototype +* @type {string} +* @default 'utc' +* +* @example +* var scale = new UTCScale({ +* 'name': 'xScale' +* }); +* +* var v = scale.type; +* // returns 'utc' +*/ +setReadWriteAccessor( UTCScale.prototype, 'type', getType, setType ); + + +// EXPORTS // + +module.exports = UTCScale; diff --git a/lib/node_modules/@stdlib/plot/vega/scale/utc/lib/nice/get.js b/lib/node_modules/@stdlib/plot/vega/scale/utc/lib/nice/get.js new file mode 100644 index 000000000000..f8f7e1b00934 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/scale/utc/lib/nice/get.js @@ -0,0 +1,46 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable no-invalid-this */ + +'use strict'; + +// MODULES // + +var isObject = require( '@stdlib/assert/is-object' ); +var copy = require( '@stdlib/utils/copy' ); +var prop = require( './properties.js' ); + + +// MAIN // + +/** +* Returns scale domain "nicing". +* +* @private +* @returns {(void|number|Signal|Object|boolean|string)} output value +*/ +function get() { + var v = this[ prop.private ]; + return ( isObject( v ) ) ? copy( v ) : v; +} + + +// EXPORTS // + +module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/vega/scale/utc/lib/nice/properties.js b/lib/node_modules/@stdlib/plot/vega/scale/utc/lib/nice/properties.js new file mode 100644 index 000000000000..9f70d83d59bb --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/scale/utc/lib/nice/properties.js @@ -0,0 +1,33 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var property2object = require( '@stdlib/plot/vega/base/property2object' ); + + +// MAIN // + +var obj = property2object( 'nice' ); + + +// EXPORTS // + +module.exports = obj; diff --git a/lib/node_modules/@stdlib/plot/vega/scale/utc/lib/nice/set.js b/lib/node_modules/@stdlib/plot/vega/scale/utc/lib/nice/set.js new file mode 100644 index 000000000000..02d507a0d3bf --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/scale/utc/lib/nice/set.js @@ -0,0 +1,83 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable no-invalid-this */ + +'use strict'; + +// MODULES // + +var logger = require( 'debug' ); +var isNumber = require( '@stdlib/assert/is-number' ).isPrimitive; +var isBoolean = require( '@stdlib/assert/is-boolean' ).isPrimitive; +var isString = require( '@stdlib/assert/is-string' ).isPrimitive; +var isObject = require( '@stdlib/assert/is-object' ); +var copy = require( '@stdlib/utils/copy' ); +var format = require( '@stdlib/string/format' ); +var changeEvent = require( './../change_event.js' ); +var prop = require( './properties.js' ); + + +// VARIABLES // + +var debug = logger( 'vega:utc-scale:set:'+prop.name ); + + +// MAIN // + +/** +* Sets scale domain "nicing". +* +* @private +* @param {(number|boolean|Signal|Object|string)} value - input value +* @throws {TypeError} must be either a number, boolean, string, signal, or an object +* @returns {void} +*/ +function set( value ) { + var isObj = isObject( value ); + + // FIXME: if string, validate one of allowed nice values => plot/vega/base/assert/is-time-scale-nice-string + + // FIXME: if object, validate has expected fields => plot/vega/base/assert/is-time-scale-nice-object + + // FIXME: add signal support + if ( + !isObj && + !isNumber( value ) && + !isBoolean( value ) && + !isString( value ) + ) { + throw new TypeError( format( 'invalid assignment. `%s` must be either a number, boolean, string, signal, or an object. Value: `%s`.', prop.name, value ) ); + } + if ( isObj ) { + value = copy( value ); + } + + // FIXME: should we perform deep equality comparison for provided objects in order to avoid potential false positive change events? + + if ( value !== this[ prop.private ] ) { + debug( 'Current value: %s. New value: %s.', this[ prop.private ], value ); + this[ prop.private ] = value; + this.emit( 'change', changeEvent( prop.name ) ); + } +} + + +// EXPORTS // + +module.exports = set; diff --git a/lib/node_modules/@stdlib/plot/vega/scale/utc/lib/type/get.js b/lib/node_modules/@stdlib/plot/vega/scale/utc/lib/type/get.js new file mode 100644 index 000000000000..8f5ecbfba703 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/scale/utc/lib/type/get.js @@ -0,0 +1,41 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var TYPE = require( './type.js' ); + + +// MAIN // + +/** +* Returns the scale type. +* +* @private +* @returns {string} scale type +*/ +function get() { + return TYPE; +} + + +// EXPORTS // + +module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/vega/scale/utc/lib/type/set.js b/lib/node_modules/@stdlib/plot/vega/scale/utc/lib/type/set.js new file mode 100644 index 000000000000..8690534fdb51 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/scale/utc/lib/type/set.js @@ -0,0 +1,46 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var format = require( '@stdlib/string/format' ); +var TYPE = require( './type.js' ); + + +// MAIN // + +/** +* Sets the scale type. +* +* @private +* @param {string} value - input value +* @throws {TypeError} must be a valid scale +* @returns {void} +*/ +function set( value ) { + if ( value !== TYPE ) { + throw new TypeError( format( 'invalid assignment. `%s` must be equal to "%s". Value: `%s`.', 'type', TYPE, value ) ); + } +} + + +// EXPORTS // + +module.exports = set; diff --git a/lib/node_modules/@stdlib/plot/vega/scale/utc/lib/type/type.js b/lib/node_modules/@stdlib/plot/vega/scale/utc/lib/type/type.js new file mode 100644 index 000000000000..8d2db8dcb741 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/scale/utc/lib/type/type.js @@ -0,0 +1,23 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// EXPORTS // + +module.exports = 'utc'; diff --git a/lib/node_modules/@stdlib/plot/vega/scale/utc/package.json b/lib/node_modules/@stdlib/plot/vega/scale/utc/package.json new file mode 100644 index 000000000000..fb28846f8072 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/scale/utc/package.json @@ -0,0 +1,63 @@ +{ + "name": "@stdlib/plot/vega/scale/utc", + "version": "0.0.0", + "description": "UTC scale constructor.", + "license": "Apache-2.0", + "author": { + "name": "The Stdlib Authors", + "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" + }, + "contributors": [ + { + "name": "The Stdlib Authors", + "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" + } + ], + "main": "./lib", + "directories": { + "benchmark": "./benchmark", + "doc": "./docs", + "example": "./examples", + "lib": "./lib", + "test": "./test" + }, + "types": "./docs/types", + "scripts": {}, + "homepage": "https://github.com/stdlib-js/stdlib", + "repository": { + "type": "git", + "url": "git://github.com/stdlib-js/stdlib.git" + }, + "bugs": { + "url": "https://github.com/stdlib-js/stdlib/issues" + }, + "dependencies": {}, + "devDependencies": {}, + "engines": { + "node": ">=0.10.0", + "npm": ">2.7.0" + }, + "os": [ + "aix", + "darwin", + "freebsd", + "linux", + "macos", + "openbsd", + "sunos", + "win32", + "windows" + ], + "keywords": [ + "stdlib", + "plot", + "vega", + "scale", + "quantitative", + "time", + "utc", + "constructor", + "ctor" + ], + "__stdlib__": {} +} diff --git a/lib/node_modules/@stdlib/plot/vega/scale/x-linear/examples/index.js b/lib/node_modules/@stdlib/plot/vega/scale/x-linear/examples/index.js new file mode 100644 index 000000000000..a90e4f1faab6 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/scale/x-linear/examples/index.js @@ -0,0 +1,24 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +var xLinearScale = require( './../lib' ); + +var scale = xLinearScale(); +console.log( scale.toJSON() ); diff --git a/lib/node_modules/@stdlib/plot/vega/scale/x-linear/lib/index.js b/lib/node_modules/@stdlib/plot/vega/scale/x-linear/lib/index.js new file mode 100644 index 000000000000..ccb1714488f1 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/scale/x-linear/lib/index.js @@ -0,0 +1,40 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +/** +* Create a named linear scale. +* +* @module @stdlib/plot/vega/scale/x-linear +* +* @example +* var xLinearScale = require( '@stdlib/plot/vega/scale/x-linear' ); +* +* var scale = xLinearScale(); +* // returns <Scale> +*/ + +// MODULES // + +var main = require( './main.js' ); + + +// EXPORTS // + +module.exports = main; diff --git a/lib/node_modules/@stdlib/plot/vega/scale/x-linear/lib/main.js b/lib/node_modules/@stdlib/plot/vega/scale/x-linear/lib/main.js new file mode 100644 index 000000000000..f209a07ec230 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/scale/x-linear/lib/main.js @@ -0,0 +1,61 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var namedScaleFactory = require( '@stdlib/plot/vega/scale/named' ).factory; + + +// MAIN // + +/** +* Returns a named linear scale. +* +* @name xLinearScale +* @type {Function} +* @param {Options} [options] - function options +* @param {(Collection|Object|Signal)} [options.bins] - bin boundaries over the scale domain +* @param {boolean} [options.clamp=false] - boolean indicating whether to clamp output values to the scale range +* @param {(Collection|Object|Signal)} [options.domain] - domain of associated data values +* @param {number} [options.domainMax] - maximum value in the scale domain (overrides the `domain` option) +* @param {number} [options.domainMin] - minimum value in the scale domain (overrides the `domain` option) +* @param {number} [options.domainMid] - single mid-point value inserted into a two-element domain +* @param {Collection} [options.domainRaw] - array of raw domain values which overrides the `domain` property +* @param {(string|Object)} [options.interpolate] - scale range interpolation method +* @param {(boolean|number|Signal)} [options.nice=false] - scale domain "nicing" +* @param {number} [options.padding] - scale domain padding (in pixels) +* @param {(Collection|Object|Signal|string)} [options.range] - scale range +* @param {boolean} [options.reverse=false] - boolean indicating whether to reverse the order of the scale range +* @param {boolean} [options.round=false] - boolean indicating whether to round numeric output values to integers +* @param {boolean} [options.zero] - boolean indicating whether the scale domain should include zero +* @throws {TypeError} options argument must be an object +* @throws {Error} must provide valid options +* @returns {LinearScale} scale instance +* +* @example +* var scale = xLinearScale(); +* // returns <Scale> +*/ +var xLinearScale = namedScaleFactory( 'linear', 'xScale' ); + + +// EXPORTS // + +module.exports = xLinearScale; diff --git a/lib/node_modules/@stdlib/plot/vega/scale/x-linear/package.json b/lib/node_modules/@stdlib/plot/vega/scale/x-linear/package.json new file mode 100644 index 000000000000..7d3fe2fde6e2 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/scale/x-linear/package.json @@ -0,0 +1,60 @@ +{ + "name": "@stdlib/plot/vega/scale/x-linear", + "version": "0.0.0", + "description": "Create a named linear scale.", + "license": "Apache-2.0", + "author": { + "name": "The Stdlib Authors", + "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" + }, + "contributors": [ + { + "name": "The Stdlib Authors", + "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" + } + ], + "main": "./lib", + "directories": { + "benchmark": "./benchmark", + "doc": "./docs", + "example": "./examples", + "lib": "./lib", + "test": "./test" + }, + "types": "./docs/types", + "scripts": {}, + "homepage": "https://github.com/stdlib-js/stdlib", + "repository": { + "type": "git", + "url": "git://github.com/stdlib-js/stdlib.git" + }, + "bugs": { + "url": "https://github.com/stdlib-js/stdlib/issues" + }, + "dependencies": {}, + "devDependencies": {}, + "engines": { + "node": ">=0.10.0", + "npm": ">2.7.0" + }, + "os": [ + "aix", + "darwin", + "freebsd", + "linux", + "macos", + "openbsd", + "sunos", + "win32", + "windows" + ], + "keywords": [ + "stdlib", + "plot", + "vega", + "linear", + "scale", + "factory" + ], + "__stdlib__": {} +} diff --git a/lib/node_modules/@stdlib/plot/vega/scale/x-quantitative/examples/index.js b/lib/node_modules/@stdlib/plot/vega/scale/x-quantitative/examples/index.js new file mode 100644 index 000000000000..85fb3adcc5f9 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/scale/x-quantitative/examples/index.js @@ -0,0 +1,24 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +var xQuantitativeScale = require( './../lib' ); + +var scale = xQuantitativeScale(); +console.log( scale.toJSON() ); diff --git a/lib/node_modules/@stdlib/plot/vega/scale/x-quantitative/lib/index.js b/lib/node_modules/@stdlib/plot/vega/scale/x-quantitative/lib/index.js new file mode 100644 index 000000000000..045417d17434 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/scale/x-quantitative/lib/index.js @@ -0,0 +1,40 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +/** +* Create a generalized quantitative scale. +* +* @module @stdlib/plot/vega/scale/x-quantitative +* +* @example +* var xQuantitativeScale = require( '@stdlib/plot/vega/scale/x-quantitative' ); +* +* var scale = xQuantitativeScale(); +* // returns <GeneralizedScale> +*/ + +// MODULES // + +var main = require( './main.js' ); + + +// EXPORTS // + +module.exports = main; diff --git a/lib/node_modules/@stdlib/plot/vega/scale/x-quantitative/lib/main.js b/lib/node_modules/@stdlib/plot/vega/scale/x-quantitative/lib/main.js new file mode 100644 index 000000000000..23f7e550acd9 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/scale/x-quantitative/lib/main.js @@ -0,0 +1,70 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var scaleFactory = require( '@stdlib/plot/vega/scale/generalized' ).factory; +var scales = require( '@stdlib/plot/vega/scale/names' ); + + +// MAIN // + +/** +* Returns a quantitative scale. +* +* @name xQuantitativeScale +* @type {Function} +* @param {Options} [options] - function options +* @param {number} [options.base=10] - base of the logarithm to use when performing logarithmic transforms +* @param {(Collection|Object|Signal)} [options.bins] - bin boundaries over the scale domain +* @param {boolean} [options.clamp=false] - boolean indicating whether to clamp output values to the scale range +* @param {number} [options.constant=1] - constant which determines the slope of the symmetric-log transform around zero +* @param {(Collection|Object|Signal)} [options.domain] - domain of associated data values +* @param {number} [options.domainMax] - maximum value in the scale domain (overrides the `domain` option) +* @param {number} [options.domainMin] - minimum value in the scale domain (overrides the `domain` option) +* @param {number} [options.domainMid] - single mid-point value inserted into a two-element domain +* @param {Collection} [options.domainRaw] - array of raw domain values which overrides the `domain` property +* @param {number} [options.exponent=1] - exponent to use when performing exponential transforms +* @param {(string|Object)} [options.interpolate] - scale range interpolation method +* @param {string} [options.name='xScale'] - scale name +* @param {(boolean|number|string|Object|Signal)} [options.nice=false] - scale domain "nicing" +* @param {number} [options.padding] - scale domain padding (in pixels) +* @param {(Collection|Object|Signal|string)} [options.range] - scale range +* @param {boolean} [options.reverse=false] - boolean indicating whether to reverse the order of the scale range +* @param {boolean} [options.round=false] - boolean indicating whether to round numeric output values to integers +* @param {string} [options.type='linear'] - scale type +* @param {boolean} [options.zero] - boolean indicating whether the scale domain should include zero +* @throws {TypeError} options argument must be an object +* @throws {Error} must provide valid options +* @returns {GeneralizedScale} scale instance +* +* @example +* var scale = xQuantitativeScale(); +* // returns <GeneralizedScale> +*/ +var xQuantitativeScale = scaleFactory( scales( 'quantitative' ), { + 'name': 'xScale', + 'type': 'linear' +}); + + +// EXPORTS // + +module.exports = xQuantitativeScale; diff --git a/lib/node_modules/@stdlib/plot/vega/scale/x-quantitative/package.json b/lib/node_modules/@stdlib/plot/vega/scale/x-quantitative/package.json new file mode 100644 index 000000000000..1bb67facdbc8 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/scale/x-quantitative/package.json @@ -0,0 +1,60 @@ +{ + "name": "@stdlib/plot/vega/scale/x-quantitative", + "version": "0.0.0", + "description": "Create a generalized quantitative scale.", + "license": "Apache-2.0", + "author": { + "name": "The Stdlib Authors", + "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" + }, + "contributors": [ + { + "name": "The Stdlib Authors", + "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" + } + ], + "main": "./lib", + "directories": { + "benchmark": "./benchmark", + "doc": "./docs", + "example": "./examples", + "lib": "./lib", + "test": "./test" + }, + "types": "./docs/types", + "scripts": {}, + "homepage": "https://github.com/stdlib-js/stdlib", + "repository": { + "type": "git", + "url": "git://github.com/stdlib-js/stdlib.git" + }, + "bugs": { + "url": "https://github.com/stdlib-js/stdlib/issues" + }, + "dependencies": {}, + "devDependencies": {}, + "engines": { + "node": ">=0.10.0", + "npm": ">2.7.0" + }, + "os": [ + "aix", + "darwin", + "freebsd", + "linux", + "macos", + "openbsd", + "sunos", + "win32", + "windows" + ], + "keywords": [ + "stdlib", + "plot", + "vega", + "quantitative", + "scale", + "factory" + ], + "__stdlib__": {} +} diff --git a/lib/node_modules/@stdlib/plot/vega/scale/y-linear/examples/index.js b/lib/node_modules/@stdlib/plot/vega/scale/y-linear/examples/index.js new file mode 100644 index 000000000000..fea679089f11 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/scale/y-linear/examples/index.js @@ -0,0 +1,24 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +var yLinearScale = require( './../lib' ); + +var scale = yLinearScale(); +console.log( scale.toJSON() ); diff --git a/lib/node_modules/@stdlib/plot/vega/scale/y-linear/lib/index.js b/lib/node_modules/@stdlib/plot/vega/scale/y-linear/lib/index.js new file mode 100644 index 000000000000..3b9034a506ef --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/scale/y-linear/lib/index.js @@ -0,0 +1,40 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +/** +* Create a named linear scale. +* +* @module @stdlib/plot/vega/scale/y-linear +* +* @example +* var yLinearScale = require( '@stdlib/plot/vega/scale/y-linear' ); +* +* var scale = yLinearScale(); +* // returns <Scale> +*/ + +// MODULES // + +var main = require( './main.js' ); + + +// EXPORTS // + +module.exports = main; diff --git a/lib/node_modules/@stdlib/plot/vega/scale/y-linear/lib/main.js b/lib/node_modules/@stdlib/plot/vega/scale/y-linear/lib/main.js new file mode 100644 index 000000000000..475644f22293 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/scale/y-linear/lib/main.js @@ -0,0 +1,61 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var namedScaleFactory = require( '@stdlib/plot/vega/scale/named' ).factory; + + +// MAIN // + +/** +* Returns a named linear scale. +* +* @name yLinearScale +* @type {Function} +* @param {Options} [options] - function options +* @param {(Collection|Object|Signal)} [options.bins] - bin boundaries over the scale domain +* @param {boolean} [options.clamp=false] - boolean indicating whether to clamp output values to the scale range +* @param {(Collection|Object|Signal)} [options.domain] - domain of associated data values +* @param {number} [options.domainMax] - maximum value in the scale domain (overrides the `domain` option) +* @param {number} [options.domainMin] - minimum value in the scale domain (overrides the `domain` option) +* @param {number} [options.domainMid] - single mid-point value inserted into a two-element domain +* @param {Collection} [options.domainRaw] - array of raw domain values which overrides the `domain` property +* @param {(string|Object)} [options.interpolate] - scale range interpolation method +* @param {(boolean|number|Signal)} [options.nice=false] - scale domain "nicing" +* @param {number} [options.padding] - scale domain padding (in pixels) +* @param {(Collection|Object|Signal|string)} [options.range] - scale range +* @param {boolean} [options.reverse=false] - boolean indicating whether to reverse the order of the scale range +* @param {boolean} [options.round=false] - boolean indicating whether to round numeric output values to integers +* @param {boolean} [options.zero] - boolean indicating whether the scale domain should include zero +* @throws {TypeError} options argument must be an object +* @throws {Error} must provide valid options +* @returns {LinearScale} scale instance +* +* @example +* var scale = yLinearScale(); +* // returns <Scale> +*/ +var yLinearScale = namedScaleFactory( 'linear', 'yScale' ); + + +// EXPORTS // + +module.exports = yLinearScale; diff --git a/lib/node_modules/@stdlib/plot/vega/scale/y-linear/package.json b/lib/node_modules/@stdlib/plot/vega/scale/y-linear/package.json new file mode 100644 index 000000000000..de2a81315ada --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/scale/y-linear/package.json @@ -0,0 +1,60 @@ +{ + "name": "@stdlib/plot/vega/scale/y-linear", + "version": "0.0.0", + "description": "Create a named linear scale.", + "license": "Apache-2.0", + "author": { + "name": "The Stdlib Authors", + "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" + }, + "contributors": [ + { + "name": "The Stdlib Authors", + "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" + } + ], + "main": "./lib", + "directories": { + "benchmark": "./benchmark", + "doc": "./docs", + "example": "./examples", + "lib": "./lib", + "test": "./test" + }, + "types": "./docs/types", + "scripts": {}, + "homepage": "https://github.com/stdlib-js/stdlib", + "repository": { + "type": "git", + "url": "git://github.com/stdlib-js/stdlib.git" + }, + "bugs": { + "url": "https://github.com/stdlib-js/stdlib/issues" + }, + "dependencies": {}, + "devDependencies": {}, + "engines": { + "node": ">=0.10.0", + "npm": ">2.7.0" + }, + "os": [ + "aix", + "darwin", + "freebsd", + "linux", + "macos", + "openbsd", + "sunos", + "win32", + "windows" + ], + "keywords": [ + "stdlib", + "plot", + "vega", + "linear", + "scale", + "factory" + ], + "__stdlib__": {} +} diff --git a/lib/node_modules/@stdlib/plot/vega/scale/y-quantitative/examples/index.js b/lib/node_modules/@stdlib/plot/vega/scale/y-quantitative/examples/index.js new file mode 100644 index 000000000000..d084a781eda3 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/scale/y-quantitative/examples/index.js @@ -0,0 +1,24 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +var yQuantitativeScale = require( './../lib' ); + +var scale = yQuantitativeScale(); +console.log( scale.toJSON() ); diff --git a/lib/node_modules/@stdlib/plot/vega/scale/y-quantitative/lib/index.js b/lib/node_modules/@stdlib/plot/vega/scale/y-quantitative/lib/index.js new file mode 100644 index 000000000000..bcaabf911ceb --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/scale/y-quantitative/lib/index.js @@ -0,0 +1,40 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +/** +* Create a generalized quantitative scale. +* +* @module @stdlib/plot/vega/scale/y-quantitative +* +* @example +* var yQuantitativeScale = require( '@stdlib/plot/vega/scale/y-quantitative' ); +* +* var scale = yQuantitativeScale(); +* // returns <GeneralizedScale> +*/ + +// MODULES // + +var main = require( './main.js' ); + + +// EXPORTS // + +module.exports = main; diff --git a/lib/node_modules/@stdlib/plot/vega/scale/y-quantitative/lib/main.js b/lib/node_modules/@stdlib/plot/vega/scale/y-quantitative/lib/main.js new file mode 100644 index 000000000000..07185f608585 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/scale/y-quantitative/lib/main.js @@ -0,0 +1,70 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var scaleFactory = require( '@stdlib/plot/vega/scale/generalized' ).factory; +var scales = require( '@stdlib/plot/vega/scale/names' ); + + +// MAIN // + +/** +* Returns a quantitative scale. +* +* @name yQuantitativeScale +* @type {Function} +* @param {Options} [options] - function options +* @param {number} [options.base=10] - base of the logarithm to use when performing logarithmic transforms +* @param {(Collection|Object|Signal)} [options.bins] - bin boundaries over the scale domain +* @param {boolean} [options.clamp=false] - boolean indicating whether to clamp output values to the scale range +* @param {number} [options.constant=1] - constant which determines the slope of the symmetric-log transform around zero +* @param {(Collection|Object|Signal)} [options.domain] - domain of associated data values +* @param {number} [options.domainMax] - maximum value in the scale domain (overrides the `domain` option) +* @param {number} [options.domainMin] - minimum value in the scale domain (overrides the `domain` option) +* @param {number} [options.domainMid] - single mid-point value inserted into a two-element domain +* @param {Collection} [options.domainRaw] - array of raw domain values which overrides the `domain` property +* @param {number} [options.exponent=1] - exponent to use when performing exponential transforms +* @param {(string|Object)} [options.interpolate] - scale range interpolation method +* @param {string} [options.name='yScale'] - scale name +* @param {(boolean|number|string|Object|Signal)} [options.nice=false] - scale domain "nicing" +* @param {number} [options.padding] - scale domain padding (in pixels) +* @param {(Collection|Object|Signal|string)} [options.range] - scale range +* @param {boolean} [options.reverse=false] - boolean indicating whether to reverse the order of the scale range +* @param {boolean} [options.round=false] - boolean indicating whether to round numeric output values to integers +* @param {string} [options.type='linear'] - scale type +* @param {boolean} [options.zero] - boolean indicating whether the scale domain should include zero +* @throws {TypeError} options argument must be an object +* @throws {Error} must provide valid options +* @returns {GeneralizedScale} scale instance +* +* @example +* var scale = yQuantitativeScale(); +* // returns <GeneralizedScale> +*/ +var yQuantitativeScale = scaleFactory( scales( 'quantitative' ), { + 'name': 'yScale', + 'type': 'linear' +}); + + +// EXPORTS // + +module.exports = yQuantitativeScale; diff --git a/lib/node_modules/@stdlib/plot/vega/scale/y-quantitative/package.json b/lib/node_modules/@stdlib/plot/vega/scale/y-quantitative/package.json new file mode 100644 index 000000000000..66ab279415d8 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/scale/y-quantitative/package.json @@ -0,0 +1,60 @@ +{ + "name": "@stdlib/plot/vega/scale/y-quantitative", + "version": "0.0.0", + "description": "Create a generalized quantitative scale.", + "license": "Apache-2.0", + "author": { + "name": "The Stdlib Authors", + "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" + }, + "contributors": [ + { + "name": "The Stdlib Authors", + "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" + } + ], + "main": "./lib", + "directories": { + "benchmark": "./benchmark", + "doc": "./docs", + "example": "./examples", + "lib": "./lib", + "test": "./test" + }, + "types": "./docs/types", + "scripts": {}, + "homepage": "https://github.com/stdlib-js/stdlib", + "repository": { + "type": "git", + "url": "git://github.com/stdlib-js/stdlib.git" + }, + "bugs": { + "url": "https://github.com/stdlib-js/stdlib/issues" + }, + "dependencies": {}, + "devDependencies": {}, + "engines": { + "node": ">=0.10.0", + "npm": ">2.7.0" + }, + "os": [ + "aix", + "darwin", + "freebsd", + "linux", + "macos", + "openbsd", + "sunos", + "win32", + "windows" + ], + "keywords": [ + "stdlib", + "plot", + "vega", + "quantitative", + "scale", + "factory" + ], + "__stdlib__": {} +} diff --git a/lib/node_modules/@stdlib/plot/vega/title/ctor/examples/index.js b/lib/node_modules/@stdlib/plot/vega/title/ctor/examples/index.js new file mode 100644 index 000000000000..394013cb482d --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/title/ctor/examples/index.js @@ -0,0 +1,27 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +var Title = require( './../lib' ); + +var title = new Title({ + 'text': 'Hello World!' +}); + +console.log( title.toJSON() ); diff --git a/lib/node_modules/@stdlib/plot/vega/title/ctor/lib/align/get.js b/lib/node_modules/@stdlib/plot/vega/title/ctor/lib/align/get.js new file mode 100644 index 000000000000..09d1fee2d5f3 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/title/ctor/lib/align/get.js @@ -0,0 +1,43 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable no-invalid-this */ + +'use strict'; + +// MODULES // + +var prop = require( './properties.js' ); + + +// MAIN // + +/** +* Returns the horizontal text alignment of the title and subtitle. +* +* @private +* @returns {(string|void)} alignment +*/ +function get() { + return this[ prop.private ]; +} + + +// EXPORTS // + +module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/vega/title/ctor/lib/align/properties.js b/lib/node_modules/@stdlib/plot/vega/title/ctor/lib/align/properties.js new file mode 100644 index 000000000000..e116d82deb6c --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/title/ctor/lib/align/properties.js @@ -0,0 +1,33 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var property2object = require( '@stdlib/plot/vega/base/property2object' ); + + +// MAIN // + +var obj = property2object( 'align' ); + + +// EXPORTS // + +module.exports = obj; diff --git a/lib/node_modules/@stdlib/plot/vega/title/ctor/lib/align/set.js b/lib/node_modules/@stdlib/plot/vega/title/ctor/lib/align/set.js new file mode 100644 index 000000000000..b011a4a82612 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/title/ctor/lib/align/set.js @@ -0,0 +1,66 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable no-invalid-this */ + +'use strict'; + +// MODULES // + +var logger = require( 'debug' ); +var isString = require( '@stdlib/assert/is-string' ).isPrimitive; +var isUndefined = require( '@stdlib/assert/is-undefined' ); +var format = require( '@stdlib/string/format' ); +var changeEvent = require( './../change_event.js' ); +var prop = require( './properties.js' ); + + +// VARIABLES // + +var debug = logger( 'vega:title:set:'+prop.name ); + + +// MAIN // + +/** +* Sets the horizontal text alignment of the title and subtitle. +* +* ## Notes +* +* - Providing `undefined` "unsets" the configured value. +* +* @private +* @param {(string|void)} value - input value +* @throws {TypeError} must be a string +* @returns {void} +*/ +function set( value ) { + if ( !isString( value ) && !isUndefined( value ) ) { + throw new TypeError( format( 'invalid assignment. `%s` must be a string. Value: `%s`.', prop.name, value ) ); + } + if ( value !== this[ prop.private ] ) { + debug( 'Current value: %s. New value: %s.', this[ prop.private ], value ); + this[ prop.private ] = value; + this.emit( 'change', changeEvent( prop.name ) ); + } +} + + +// EXPORTS // + +module.exports = set; diff --git a/lib/node_modules/@stdlib/plot/vega/title/ctor/lib/anchor/get.js b/lib/node_modules/@stdlib/plot/vega/title/ctor/lib/anchor/get.js new file mode 100644 index 000000000000..e3c4c74704ec --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/title/ctor/lib/anchor/get.js @@ -0,0 +1,43 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable no-invalid-this */ + +'use strict'; + +// MODULES // + +var prop = require( './properties.js' ); + + +// MAIN // + +/** +* Returns the anchor position for placing the title and subtitle. +* +* @private +* @returns {string} anchor position +*/ +function get() { + return this[ prop.private ]; +} + + +// EXPORTS // + +module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/vega/title/ctor/lib/anchor/properties.js b/lib/node_modules/@stdlib/plot/vega/title/ctor/lib/anchor/properties.js new file mode 100644 index 000000000000..7374169b174e --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/title/ctor/lib/anchor/properties.js @@ -0,0 +1,33 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var property2object = require( '@stdlib/plot/vega/base/property2object' ); + + +// MAIN // + +var obj = property2object( 'anchor' ); + + +// EXPORTS // + +module.exports = obj; diff --git a/lib/node_modules/@stdlib/plot/vega/title/ctor/lib/anchor/set.js b/lib/node_modules/@stdlib/plot/vega/title/ctor/lib/anchor/set.js new file mode 100644 index 000000000000..61ed9492166f --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/title/ctor/lib/anchor/set.js @@ -0,0 +1,63 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable no-invalid-this */ + +'use strict'; + +// MODULES // + +var logger = require( 'debug' ); +var isAnchorPosition = require( '@stdlib/plot/vega/base/assert/is-anchor-position' ); +var join = require( '@stdlib/array/base/join' ); +var anchorPositions = require( '@stdlib/plot/vega/base/anchor-positions' ); +var format = require( '@stdlib/string/format' ); +var changeEvent = require( './../change_event.js' ); +var prop = require( './properties.js' ); + + +// VARIABLES // + +var debug = logger( 'vega:title:set:'+prop.name ); + + +// MAIN // + +/** +* Sets the anchor position for placing the title and subtitle. +* +* @private +* @param {string} value - input value +* @throws {TypeError} must be a valid anchor position +* @returns {void} +*/ +function set( value ) { + if ( !isAnchorPosition( value ) ) { + throw new TypeError( format( 'invalid assignment. `%s` must be one of the following: "%s". Value: `%s`.', prop.name, join( anchorPositions(), '", "' ), value ) ); + } + if ( value !== this[ prop.private ] ) { + debug( 'Current value: %s. New value: %s.', this[ prop.private ], value ); + this[ prop.private ] = value; + this.emit( 'change', changeEvent( prop.name ) ); + } +} + + +// EXPORTS // + +module.exports = set; diff --git a/lib/node_modules/@stdlib/plot/vega/title/ctor/lib/angle/get.js b/lib/node_modules/@stdlib/plot/vega/title/ctor/lib/angle/get.js new file mode 100644 index 000000000000..a52b9b9b2d82 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/title/ctor/lib/angle/get.js @@ -0,0 +1,43 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable no-invalid-this */ + +'use strict'; + +// MODULES // + +var prop = require( './properties.js' ); + + +// MAIN // + +/** +* Returns the angle (in degrees) of the title and subtitle text. +* +* @private +* @returns {(number|void)} angle +*/ +function get() { + return this[ prop.private ]; +} + + +// EXPORTS // + +module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/vega/title/ctor/lib/angle/properties.js b/lib/node_modules/@stdlib/plot/vega/title/ctor/lib/angle/properties.js new file mode 100644 index 000000000000..c39e24eb89c0 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/title/ctor/lib/angle/properties.js @@ -0,0 +1,33 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var property2object = require( '@stdlib/plot/vega/base/property2object' ); + + +// MAIN // + +var obj = property2object( 'angle' ); + + +// EXPORTS // + +module.exports = obj; diff --git a/lib/node_modules/@stdlib/plot/vega/title/ctor/lib/angle/set.js b/lib/node_modules/@stdlib/plot/vega/title/ctor/lib/angle/set.js new file mode 100644 index 000000000000..755aec3ba963 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/title/ctor/lib/angle/set.js @@ -0,0 +1,66 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable no-invalid-this */ + +'use strict'; + +// MODULES // + +var logger = require( 'debug' ); +var isNumber = require( '@stdlib/assert/is-number' ).isPrimitive; +var isUndefined = require( '@stdlib/assert/is-undefined' ); +var format = require( '@stdlib/string/format' ); +var changeEvent = require( './../change_event.js' ); +var prop = require( './properties.js' ); + + +// VARIABLES // + +var debug = logger( 'vega:title:set:'+prop.name ); + + +// MAIN // + +/** +* Sets the angle (in degrees) of the title and subtitle text. +* +* ## Notes +* +* - Providing `undefined` "unsets" the configured value. +* +* @private +* @param {(number|void)} value - input value +* @throws {TypeError} must be a number +* @returns {void} +*/ +function set( value ) { + if ( !isNumber( value ) && !isUndefined( value ) ) { + throw new TypeError( format( 'invalid assignment. `%s` must be a number. Value: `%s`.', prop.name, value ) ); + } + if ( value !== this[ prop.private ] ) { + debug( 'Current value: %s. New value: %s.', this[ prop.private ], value ); + this[ prop.private ] = value; + this.emit( 'change', changeEvent( prop.name ) ); + } +} + + +// EXPORTS // + +module.exports = set; diff --git a/lib/node_modules/@stdlib/plot/vega/title/ctor/lib/aria/get.js b/lib/node_modules/@stdlib/plot/vega/title/ctor/lib/aria/get.js new file mode 100644 index 000000000000..53f67df8b546 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/title/ctor/lib/aria/get.js @@ -0,0 +1,43 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable no-invalid-this */ + +'use strict'; + +// MODULES // + +var prop = require( './properties.js' ); + + +// MAIN // + +/** +* Returns a boolean indicating whether ARIA attributes should be included in SVG output. +* +* @private +* @returns {boolean} boolean flag +*/ +function get() { + return this[ prop.private ]; +} + + +// EXPORTS // + +module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/vega/title/ctor/lib/aria/properties.js b/lib/node_modules/@stdlib/plot/vega/title/ctor/lib/aria/properties.js new file mode 100644 index 000000000000..e8ae54164c30 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/title/ctor/lib/aria/properties.js @@ -0,0 +1,33 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var property2object = require( '@stdlib/plot/vega/base/property2object' ); + + +// MAIN // + +var obj = property2object( 'aria' ); + + +// EXPORTS // + +module.exports = obj; diff --git a/lib/node_modules/@stdlib/plot/vega/title/ctor/lib/aria/set.js b/lib/node_modules/@stdlib/plot/vega/title/ctor/lib/aria/set.js new file mode 100644 index 000000000000..77dacd0b843e --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/title/ctor/lib/aria/set.js @@ -0,0 +1,61 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable no-invalid-this */ + +'use strict'; + +// MODULES // + +var logger = require( 'debug' ); +var isBoolean = require( '@stdlib/assert/is-boolean' ).isPrimitive; +var format = require( '@stdlib/string/format' ); +var changeEvent = require( './../change_event.js' ); +var prop = require( './properties.js' ); + + +// VARIABLES // + +var debug = logger( 'vega:title:set:'+prop.name ); + + +// MAIN // + +/** +* Sets a boolean flag indicating whether ARIA attributes should be included in SVG output. +* +* @private +* @param {boolean} value - input value +* @throws {TypeError} must be a boolean +* @returns {void} +*/ +function set( value ) { + if ( !isBoolean( value ) ) { + throw new TypeError( format( 'invalid assignment. `%s` must be a boolean. Value: `%s`.', prop.name, value ) ); + } + if ( value !== this[ prop.private ] ) { + debug( 'Current value: %s. New value: %s.', this[ prop.private ], value ); + this[ prop.private ] = value; + this.emit( 'change', changeEvent( prop.name ) ); + } +} + + +// EXPORTS // + +module.exports = set; diff --git a/lib/node_modules/@stdlib/plot/vega/title/ctor/lib/baseline/get.js b/lib/node_modules/@stdlib/plot/vega/title/ctor/lib/baseline/get.js new file mode 100644 index 000000000000..54c9cde99314 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/title/ctor/lib/baseline/get.js @@ -0,0 +1,43 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable no-invalid-this */ + +'use strict'; + +// MODULES // + +var prop = require( './properties.js' ); + + +// MAIN // + +/** +* Returns the vertical baseline of the title and subtitle text. +* +* @private +* @returns {string} vertical baseline +*/ +function get() { + return this[ prop.private ]; +} + + +// EXPORTS // + +module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/vega/title/ctor/lib/baseline/properties.js b/lib/node_modules/@stdlib/plot/vega/title/ctor/lib/baseline/properties.js new file mode 100644 index 000000000000..d716ef72917b --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/title/ctor/lib/baseline/properties.js @@ -0,0 +1,33 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var property2object = require( '@stdlib/plot/vega/base/property2object' ); + + +// MAIN // + +var obj = property2object( 'baseline' ); + + +// EXPORTS // + +module.exports = obj; diff --git a/lib/node_modules/@stdlib/plot/vega/title/ctor/lib/baseline/set.js b/lib/node_modules/@stdlib/plot/vega/title/ctor/lib/baseline/set.js new file mode 100644 index 000000000000..487b72f576a2 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/title/ctor/lib/baseline/set.js @@ -0,0 +1,63 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable no-invalid-this */ + +'use strict'; + +// MODULES // + +var logger = require( 'debug' ); +var isVerticalBaseline = require( '@stdlib/plot/vega/base/assert/is-vertical-baseline' ); +var join = require( '@stdlib/array/base/join' ); +var verticalBaselines = require( '@stdlib/plot/vega/base/vertical-baselines' ); +var format = require( '@stdlib/string/format' ); +var changeEvent = require( './../change_event.js' ); +var prop = require( './properties.js' ); + + +// VARIABLES // + +var debug = logger( 'vega:title:set:'+prop.name ); + + +// MAIN // + +/** +* Sets the vertical baseline position of the title and subtitle text. +* +* @private +* @param {string} value - input value +* @throws {TypeError} must be a valid vertical baseline +* @returns {void} +*/ +function set( value ) { + if ( !isVerticalBaseline( value ) ) { + throw new TypeError( format( 'invalid assignment. `%s` must be one of the following: "%s". Value: `%s`.', prop.name, join( verticalBaselines(), '", "' ), value ) ); + } + if ( value !== this[ prop.private ] ) { + debug( 'Current value: %s. New value: %s.', this[ prop.private ], value ); + this[ prop.private ] = value; + this.emit( 'change', changeEvent( prop.name ) ); + } +} + + +// EXPORTS // + +module.exports = set; diff --git a/lib/node_modules/@stdlib/plot/vega/title/ctor/lib/change_event.js b/lib/node_modules/@stdlib/plot/vega/title/ctor/lib/change_event.js new file mode 100644 index 000000000000..bc555b78ad90 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/title/ctor/lib/change_event.js @@ -0,0 +1,41 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MAIN // + +/** +* Returns a new change event object. +* +* @private +* @param {string} property - property name +* @returns {Object} event object +*/ +function event( property ) { // eslint-disable-line stdlib/no-redeclare + return { + 'type': 'update', + 'source': 'title', + 'property': property + }; +} + + +// EXPORTS // + +module.exports = event; diff --git a/lib/node_modules/@stdlib/plot/vega/title/ctor/lib/color/get.js b/lib/node_modules/@stdlib/plot/vega/title/ctor/lib/color/get.js new file mode 100644 index 000000000000..87c822aae9bc --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/title/ctor/lib/color/get.js @@ -0,0 +1,43 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable no-invalid-this */ + +'use strict'; + +// MODULES // + +var prop = require( './properties.js' ); + + +// MAIN // + +/** +* Returns the color of the title text. +* +* @private +* @returns {(void|string)} color string +*/ +function get() { + return this[ prop.private ]; +} + + +// EXPORTS // + +module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/vega/title/ctor/lib/color/properties.js b/lib/node_modules/@stdlib/plot/vega/title/ctor/lib/color/properties.js new file mode 100644 index 000000000000..7fcc4bba8945 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/title/ctor/lib/color/properties.js @@ -0,0 +1,33 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var property2object = require( '@stdlib/plot/vega/base/property2object' ); + + +// MAIN // + +var obj = property2object( 'color' ); + + +// EXPORTS // + +module.exports = obj; diff --git a/lib/node_modules/@stdlib/plot/vega/title/ctor/lib/color/set.js b/lib/node_modules/@stdlib/plot/vega/title/ctor/lib/color/set.js new file mode 100644 index 000000000000..fff3529a9620 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/title/ctor/lib/color/set.js @@ -0,0 +1,66 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable no-invalid-this */ + +'use strict'; + +// MODULES // + +var logger = require( 'debug' ); +var isString = require( '@stdlib/assert/is-string' ).isPrimitive; +var isUndefined = require( '@stdlib/assert/is-undefined' ); +var format = require( '@stdlib/string/format' ); +var changeEvent = require( './../change_event.js' ); +var prop = require( './properties.js' ); + + +// VARIABLES // + +var debug = logger( 'vega:title:set:'+prop.name ); + + +// MAIN // + +/** +* Sets the color of the title text. +* +* ## Notes +* +* - Providing `undefined` "unsets" the configured value. +* +* @private +* @param {(string|void)} value - input value +* @throws {TypeError} must be a string +* @returns {void} +*/ +function set( value ) { + if ( !isString( value ) && !isUndefined( value ) ) { + throw new TypeError( format( 'invalid assignment. `%s` must be a string. Value: `%s`.', prop.name, value ) ); + } + if ( value !== this[ prop.private ] ) { + debug( 'Current value: %s. New value: %s.', this[ prop.private ], value ); + this[ prop.private ] = value; + this.emit( 'change', changeEvent( prop.name ) ); + } +} + + +// EXPORTS // + +module.exports = set; diff --git a/lib/node_modules/@stdlib/plot/vega/title/ctor/lib/defaults.js b/lib/node_modules/@stdlib/plot/vega/title/ctor/lib/defaults.js new file mode 100644 index 000000000000..aff0b120c775 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/title/ctor/lib/defaults.js @@ -0,0 +1,58 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MAIN // + +/** +* Returns defaults. +* +* @private +* @returns {Object} default options +* +* @example +* var o = defaults(); +* // returns {...} +*/ +function defaults() { + return { + // Boolean indicating whether to include ARIA attributes in SVG output: + 'aria': true, + + // Anchor position for placing title and subtitle: + 'anchor': 'middle', + + // Reference frame for the anchor position: + 'frame': 'bounds', + + // Title and subtitle orientation relative to the chart: + 'orient': 'top', + + // Title text: + 'text': [], + + // Integer z-index indicating the layering of a title group relative to other axis, mark, and legend groups: + 'zindex': 0 + }; +} + + +// EXPORTS // + +module.exports = defaults; diff --git a/lib/node_modules/@stdlib/plot/vega/title/ctor/lib/dx/get.js b/lib/node_modules/@stdlib/plot/vega/title/ctor/lib/dx/get.js new file mode 100644 index 000000000000..a062e08eb4d5 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/title/ctor/lib/dx/get.js @@ -0,0 +1,43 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable no-invalid-this */ + +'use strict'; + +// MODULES // + +var prop = require( './properties.js' ); + + +// MAIN // + +/** +* Returns the horizontal offset added to the title and subtitle x-coordinate. +* +* @private +* @returns {(number|void)} offset +*/ +function get() { + return this[ prop.private ]; +} + + +// EXPORTS // + +module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/vega/title/ctor/lib/dx/properties.js b/lib/node_modules/@stdlib/plot/vega/title/ctor/lib/dx/properties.js new file mode 100644 index 000000000000..dd8c83256449 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/title/ctor/lib/dx/properties.js @@ -0,0 +1,33 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var property2object = require( '@stdlib/plot/vega/base/property2object' ); + + +// MAIN // + +var obj = property2object( 'dx' ); + + +// EXPORTS // + +module.exports = obj; diff --git a/lib/node_modules/@stdlib/plot/vega/title/ctor/lib/dx/set.js b/lib/node_modules/@stdlib/plot/vega/title/ctor/lib/dx/set.js new file mode 100644 index 000000000000..e3068ed2aab8 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/title/ctor/lib/dx/set.js @@ -0,0 +1,66 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable no-invalid-this */ + +'use strict'; + +// MODULES // + +var logger = require( 'debug' ); +var isNumber = require( '@stdlib/assert/is-number' ).isPrimitive; +var isUndefined = require( '@stdlib/assert/is-undefined' ); +var format = require( '@stdlib/string/format' ); +var changeEvent = require( './../change_event.js' ); +var prop = require( './properties.js' ); + + +// VARIABLES // + +var debug = logger( 'vega:title:set:'+prop.name ); + + +// MAIN // + +/** +* Sets the horizontal offset added to the title and subtitle x-coordinate. +* +* ## Notes +* +* - Providing `undefined` "unsets" the configured value. +* +* @private +* @param {(number|void)} value - input value +* @throws {TypeError} must be a number +* @returns {void} +*/ +function set( value ) { + if ( !isNumber( value ) && !isUndefined( value ) ) { + throw new TypeError( format( 'invalid assignment. `%s` must be a number. Value: `%s`.', prop.name, value ) ); + } + if ( value !== this[ prop.private ] ) { + debug( 'Current value: %s. New value: %s.', this[ prop.private ], value ); + this[ prop.private ] = value; + this.emit( 'change', changeEvent( prop.name ) ); + } +} + + +// EXPORTS // + +module.exports = set; diff --git a/lib/node_modules/@stdlib/plot/vega/title/ctor/lib/dy/get.js b/lib/node_modules/@stdlib/plot/vega/title/ctor/lib/dy/get.js new file mode 100644 index 000000000000..4ccc86d87825 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/title/ctor/lib/dy/get.js @@ -0,0 +1,43 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable no-invalid-this */ + +'use strict'; + +// MODULES // + +var prop = require( './properties.js' ); + + +// MAIN // + +/** +* Returns the vertical offset added to the title and subtitle y-coordinate. +* +* @private +* @returns {(number|void)} offset +*/ +function get() { + return this[ prop.private ]; +} + + +// EXPORTS // + +module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/vega/title/ctor/lib/dy/properties.js b/lib/node_modules/@stdlib/plot/vega/title/ctor/lib/dy/properties.js new file mode 100644 index 000000000000..8798f00995fb --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/title/ctor/lib/dy/properties.js @@ -0,0 +1,33 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var property2object = require( '@stdlib/plot/vega/base/property2object' ); + + +// MAIN // + +var obj = property2object( 'dy' ); + + +// EXPORTS // + +module.exports = obj; diff --git a/lib/node_modules/@stdlib/plot/vega/title/ctor/lib/dy/set.js b/lib/node_modules/@stdlib/plot/vega/title/ctor/lib/dy/set.js new file mode 100644 index 000000000000..58057c923375 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/title/ctor/lib/dy/set.js @@ -0,0 +1,66 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable no-invalid-this */ + +'use strict'; + +// MODULES // + +var logger = require( 'debug' ); +var isNumber = require( '@stdlib/assert/is-number' ).isPrimitive; +var isUndefined = require( '@stdlib/assert/is-undefined' ); +var format = require( '@stdlib/string/format' ); +var changeEvent = require( './../change_event.js' ); +var prop = require( './properties.js' ); + + +// VARIABLES // + +var debug = logger( 'vega:title:set:'+prop.name ); + + +// MAIN // + +/** +* Sets the vertical offset added to the title and subtitle y-coordinate. +* +* ## Notes +* +* - Providing `undefined` "unsets" the configured value. +* +* @private +* @param {(number|void)} value - input value +* @throws {TypeError} must be a number +* @returns {void} +*/ +function set( value ) { + if ( !isNumber( value ) && !isUndefined( value ) ) { + throw new TypeError( format( 'invalid assignment. `%s` must be a number. Value: `%s`.', prop.name, value ) ); + } + if ( value !== this[ prop.private ] ) { + debug( 'Current value: %s. New value: %s.', this[ prop.private ], value ); + this[ prop.private ] = value; + this.emit( 'change', changeEvent( prop.name ) ); + } +} + + +// EXPORTS // + +module.exports = set; diff --git a/lib/node_modules/@stdlib/plot/vega/title/ctor/lib/encode/get.js b/lib/node_modules/@stdlib/plot/vega/title/ctor/lib/encode/get.js new file mode 100644 index 000000000000..d01aa3536c2c --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/title/ctor/lib/encode/get.js @@ -0,0 +1,44 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable no-invalid-this */ + +'use strict'; + +// MODULES // + +var copy = require( '@stdlib/utils/copy' ); +var prop = require( './properties.js' ); + + +// MAIN // + +/** +* Returns the mark encodings for custom title styling. +* +* @private +* @returns {(Object|void)} encodings +*/ +function get() { + return copy( this[ prop.private ] ); // FIXME: `copy` is relatively slow. Potential speedup? +} + + +// EXPORTS // + +module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/vega/title/ctor/lib/encode/properties.js b/lib/node_modules/@stdlib/plot/vega/title/ctor/lib/encode/properties.js new file mode 100644 index 000000000000..889233bec2b9 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/title/ctor/lib/encode/properties.js @@ -0,0 +1,33 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var property2object = require( '@stdlib/plot/vega/base/property2object' ); + + +// MAIN // + +var obj = property2object( 'encode' ); + + +// EXPORTS // + +module.exports = obj; diff --git a/lib/node_modules/@stdlib/plot/vega/title/ctor/lib/encode/set.js b/lib/node_modules/@stdlib/plot/vega/title/ctor/lib/encode/set.js new file mode 100644 index 000000000000..88e1648cc075 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/title/ctor/lib/encode/set.js @@ -0,0 +1,67 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable no-invalid-this */ + +'use strict'; + +// MODULES // + +var logger = require( 'debug' ); +var isObject = require( '@stdlib/assert/is-object' ); +var isUndefined = require( '@stdlib/assert/is-undefined' ); +var format = require( '@stdlib/string/format' ); +var changeEvent = require( './../change_event.js' ); +var prop = require( './properties.js' ); + + +// VARIABLES // + +var debug = logger( 'vega:title:set:'+prop.name ); + + +// MAIN // + +/** +* Sets mark encodings for custom title styling. +* +* ## Notes +* +* - Providing `undefined` "unsets" the configured value. +* +* @private +* @param {(Object|void)} value - input value +* @throws {TypeError} must be an object +* @returns {void} +*/ +function set( value ) { + // FIXME: perform more robust validation of encoding objects (e.g., only support for `group`, `title`, and `subtitle` fields, etc) + if ( !isObject( value ) && !isUndefined( value ) ) { + throw new TypeError( format( 'invalid assignment. `%s` must be an object. Value: `%s`.', prop.name, value ) ); + } + if ( value !== this[ prop.private ] ) { + debug( 'Current value: %s. New value: %s.', JSON.stringify( this[ prop.private ] ), JSON.stringify( value ) ); + this[ prop.private ] = value; + this.emit( 'change', changeEvent( prop.name ) ); + } +} + + +// EXPORTS // + +module.exports = set; diff --git a/lib/node_modules/@stdlib/plot/vega/title/ctor/lib/font-size/get.js b/lib/node_modules/@stdlib/plot/vega/title/ctor/lib/font-size/get.js new file mode 100644 index 000000000000..05bdc07c7a9e --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/title/ctor/lib/font-size/get.js @@ -0,0 +1,43 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable no-invalid-this */ + +'use strict'; + +// MODULES // + +var prop = require( './properties.js' ); + + +// MAIN // + +/** +* Returns the font size (in pixels) of title text. +* +* @private +* @returns {(number|void)} font size +*/ +function get() { + return this[ prop.private ]; +} + + +// EXPORTS // + +module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/vega/title/ctor/lib/font-size/properties.js b/lib/node_modules/@stdlib/plot/vega/title/ctor/lib/font-size/properties.js new file mode 100644 index 000000000000..04f6fefd6e90 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/title/ctor/lib/font-size/properties.js @@ -0,0 +1,33 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var property2object = require( '@stdlib/plot/vega/base/property2object' ); + + +// MAIN // + +var obj = property2object( 'fontSize' ); + + +// EXPORTS // + +module.exports = obj; diff --git a/lib/node_modules/@stdlib/plot/vega/title/ctor/lib/font-size/set.js b/lib/node_modules/@stdlib/plot/vega/title/ctor/lib/font-size/set.js new file mode 100644 index 000000000000..a6b885f1fc2f --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/title/ctor/lib/font-size/set.js @@ -0,0 +1,66 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable no-invalid-this */ + +'use strict'; + +// MODULES // + +var logger = require( 'debug' ); +var isNumber = require( '@stdlib/assert/is-number' ).isPrimitive; +var isUndefined = require( '@stdlib/assert/is-undefined' ); +var format = require( '@stdlib/string/format' ); +var changeEvent = require( './../change_event.js' ); +var prop = require( './properties.js' ); + + +// VARIABLES // + +var debug = logger( 'vega:title:set:'+prop.name ); + + +// MAIN // + +/** +* Sets the font size (in pixels) of title text. +* +* ## Notes +* +* - Providing `undefined` "unsets" the configured value. +* +* @private +* @param {(number|void)} value - input value +* @throws {TypeError} must be a number +* @returns {void} +*/ +function set( value ) { + if ( !isNumber( value ) && !isUndefined( value ) ) { + throw new TypeError( format( 'invalid assignment. `%s` must be a number. Value: `%s`.', prop.name, value ) ); + } + if ( value !== this[ prop.private ] ) { + debug( 'Current value: %s. New value: %s.', this[ prop.private ], value ); + this[ prop.private ] = value; + this.emit( 'change', changeEvent( prop.name ) ); + } +} + + +// EXPORTS // + +module.exports = set; diff --git a/lib/node_modules/@stdlib/plot/vega/title/ctor/lib/font-style/get.js b/lib/node_modules/@stdlib/plot/vega/title/ctor/lib/font-style/get.js new file mode 100644 index 000000000000..ee7351ba9da2 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/title/ctor/lib/font-style/get.js @@ -0,0 +1,43 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable no-invalid-this */ + +'use strict'; + +// MODULES // + +var prop = require( './properties.js' ); + + +// MAIN // + +/** +* Returns the font style of the title text. +* +* @private +* @returns {(string|void)} font style +*/ +function get() { + return this[ prop.private ]; +} + + +// EXPORTS // + +module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/vega/title/ctor/lib/font-style/properties.js b/lib/node_modules/@stdlib/plot/vega/title/ctor/lib/font-style/properties.js new file mode 100644 index 000000000000..2b14ac3597fa --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/title/ctor/lib/font-style/properties.js @@ -0,0 +1,33 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var property2object = require( '@stdlib/plot/vega/base/property2object' ); + + +// MAIN // + +var obj = property2object( 'fontStyle' ); + + +// EXPORTS // + +module.exports = obj; diff --git a/lib/node_modules/@stdlib/plot/vega/title/ctor/lib/font-style/set.js b/lib/node_modules/@stdlib/plot/vega/title/ctor/lib/font-style/set.js new file mode 100644 index 000000000000..50b65947a854 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/title/ctor/lib/font-style/set.js @@ -0,0 +1,66 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable no-invalid-this */ + +'use strict'; + +// MODULES // + +var logger = require( 'debug' ); +var isString = require( '@stdlib/assert/is-string' ).isPrimitive; +var isUndefined = require( '@stdlib/assert/is-undefined' ); +var format = require( '@stdlib/string/format' ); +var changeEvent = require( './../change_event.js' ); +var prop = require( './properties.js' ); + + +// VARIABLES // + +var debug = logger( 'vega:title:set:'+prop.name ); + + +// MAIN // + +/** +* Sets the font style of the title text. +* +* ## Notes +* +* - Providing `undefined` "unsets" the configured value. +* +* @private +* @param {(string|void)} value - input value +* @throws {TypeError} must be a string +* @returns {void} +*/ +function set( value ) { + if ( !isString( value ) && !isUndefined( value ) ) { + throw new TypeError( format( 'invalid assignment. `%s` must be a string. Value: `%s`.', prop.name, value ) ); + } + if ( value !== this[ prop.private ] ) { + debug( 'Current value: %s. New value: %s.', this[ prop.private ], value ); + this[ prop.private ] = value; + this.emit( 'change', changeEvent( prop.name ) ); + } +} + + +// EXPORTS // + +module.exports = set; diff --git a/lib/node_modules/@stdlib/plot/vega/title/ctor/lib/font-weight/get.js b/lib/node_modules/@stdlib/plot/vega/title/ctor/lib/font-weight/get.js new file mode 100644 index 000000000000..7dd9192bd9de --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/title/ctor/lib/font-weight/get.js @@ -0,0 +1,43 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable no-invalid-this */ + +'use strict'; + +// MODULES // + +var prop = require( './properties.js' ); + + +// MAIN // + +/** +* Returns the font weight of title text. +* +* @private +* @returns {(number|string|void)} font weight +*/ +function get() { + return this[ prop.private ]; +} + + +// EXPORTS // + +module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/vega/title/ctor/lib/font-weight/properties.js b/lib/node_modules/@stdlib/plot/vega/title/ctor/lib/font-weight/properties.js new file mode 100644 index 000000000000..154b9144d9d5 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/title/ctor/lib/font-weight/properties.js @@ -0,0 +1,33 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var property2object = require( '@stdlib/plot/vega/base/property2object' ); + + +// MAIN // + +var obj = property2object( 'fontWeight' ); + + +// EXPORTS // + +module.exports = obj; diff --git a/lib/node_modules/@stdlib/plot/vega/title/ctor/lib/font-weight/set.js b/lib/node_modules/@stdlib/plot/vega/title/ctor/lib/font-weight/set.js new file mode 100644 index 000000000000..2d105394e6d8 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/title/ctor/lib/font-weight/set.js @@ -0,0 +1,67 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable no-invalid-this */ + +'use strict'; + +// MODULES // + +var logger = require( 'debug' ); +var isNumber = require( '@stdlib/assert/is-number' ).isPrimitive; +var isString = require( '@stdlib/assert/is-string' ).isPrimitive; +var isUndefined = require( '@stdlib/assert/is-undefined' ); +var format = require( '@stdlib/string/format' ); +var changeEvent = require( './../change_event.js' ); +var prop = require( './properties.js' ); + + +// VARIABLES // + +var debug = logger( 'vega:title:set:'+prop.name ); + + +// MAIN // + +/** +* Sets the font weight of title text. +* +* ## Notes +* +* - Providing `undefined` "unsets" the configured value. +* +* @private +* @param {(number|string|void)} value - input value +* @throws {TypeError} must be a number or string +* @returns {void} +*/ +function set( value ) { + if ( !isNumber( value ) && !isString( value ) && !isUndefined( value ) ) { + throw new TypeError( format( 'invalid assignment. `%s` must be a number or string. Value: `%s`.', prop.name, value ) ); + } + if ( value !== this[ prop.private ] ) { + debug( 'Current value: %s. New value: %s.', this[ prop.private ], value ); + this[ prop.private ] = value; + this.emit( 'change', changeEvent( prop.name ) ); + } +} + + +// EXPORTS // + +module.exports = set; diff --git a/lib/node_modules/@stdlib/plot/vega/title/ctor/lib/font/get.js b/lib/node_modules/@stdlib/plot/vega/title/ctor/lib/font/get.js new file mode 100644 index 000000000000..c4c80613d6a7 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/title/ctor/lib/font/get.js @@ -0,0 +1,43 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable no-invalid-this */ + +'use strict'; + +// MODULES // + +var prop = require( './properties.js' ); + + +// MAIN // + +/** +* Returns the font name of the title text. +* +* @private +* @returns {(string|void)} font name +*/ +function get() { + return this[ prop.private ]; +} + + +// EXPORTS // + +module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/vega/title/ctor/lib/font/properties.js b/lib/node_modules/@stdlib/plot/vega/title/ctor/lib/font/properties.js new file mode 100644 index 000000000000..c9a8e0476a34 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/title/ctor/lib/font/properties.js @@ -0,0 +1,33 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var property2object = require( '@stdlib/plot/vega/base/property2object' ); + + +// MAIN // + +var obj = property2object( 'font' ); + + +// EXPORTS // + +module.exports = obj; diff --git a/lib/node_modules/@stdlib/plot/vega/title/ctor/lib/font/set.js b/lib/node_modules/@stdlib/plot/vega/title/ctor/lib/font/set.js new file mode 100644 index 000000000000..4e8507a2d806 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/title/ctor/lib/font/set.js @@ -0,0 +1,66 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable no-invalid-this */ + +'use strict'; + +// MODULES // + +var logger = require( 'debug' ); +var isString = require( '@stdlib/assert/is-string' ).isPrimitive; +var isUndefined = require( '@stdlib/assert/is-undefined' ); +var format = require( '@stdlib/string/format' ); +var changeEvent = require( './../change_event.js' ); +var prop = require( './properties.js' ); + + +// VARIABLES // + +var debug = logger( 'vega:title:set:'+prop.name ); + + +// MAIN // + +/** +* Sets the font name of the title text. +* +* ## Notes +* +* - Providing `undefined` "unsets" the configured value. +* +* @private +* @param {(string|void)} value - input value +* @throws {TypeError} must be a string +* @returns {void} +*/ +function set( value ) { + if ( !isString( value ) && !isUndefined( value ) ) { + throw new TypeError( format( 'invalid assignment. `%s` must be a string. Value: `%s`.', prop.name, value ) ); + } + if ( value !== this[ prop.private ] ) { + debug( 'Current value: %s. New value: %s.', this[ prop.private ], value ); + this[ prop.private ] = value; + this.emit( 'change', changeEvent( prop.name ) ); + } +} + + +// EXPORTS // + +module.exports = set; diff --git a/lib/node_modules/@stdlib/plot/vega/title/ctor/lib/frame/get.js b/lib/node_modules/@stdlib/plot/vega/title/ctor/lib/frame/get.js new file mode 100644 index 000000000000..4c76ab8f1ed7 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/title/ctor/lib/frame/get.js @@ -0,0 +1,43 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable no-invalid-this */ + +'use strict'; + +// MODULES // + +var prop = require( './properties.js' ); + + +// MAIN // + +/** +* Returns the reference frame for the anchor position. +* +* @private +* @returns {string} reference frame +*/ +function get() { + return this[ prop.private ]; +} + + +// EXPORTS // + +module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/vega/title/ctor/lib/frame/properties.js b/lib/node_modules/@stdlib/plot/vega/title/ctor/lib/frame/properties.js new file mode 100644 index 000000000000..aaaa9239a34b --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/title/ctor/lib/frame/properties.js @@ -0,0 +1,33 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var property2object = require( '@stdlib/plot/vega/base/property2object' ); + + +// MAIN // + +var obj = property2object( 'frame' ); + + +// EXPORTS // + +module.exports = obj; diff --git a/lib/node_modules/@stdlib/plot/vega/title/ctor/lib/frame/set.js b/lib/node_modules/@stdlib/plot/vega/title/ctor/lib/frame/set.js new file mode 100644 index 000000000000..b6c88e146064 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/title/ctor/lib/frame/set.js @@ -0,0 +1,63 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable no-invalid-this */ + +'use strict'; + +// MODULES // + +var logger = require( 'debug' ); +var isAnchorReferenceFrame = require( '@stdlib/plot/vega/base/assert/is-anchor-reference-frame' ); +var join = require( '@stdlib/array/base/join' ); +var anchorReferenceFrames = require( '@stdlib/plot/vega/base/anchor-reference-frames' ); +var format = require( '@stdlib/string/format' ); +var changeEvent = require( './../change_event.js' ); +var prop = require( './properties.js' ); + + +// VARIABLES // + +var debug = logger( 'vega:title:set:'+prop.name ); + + +// MAIN // + +/** +* Sets the the reference frame for the anchor position. +* +* @private +* @param {string} value - input value +* @throws {TypeError} must be a valid reference frame +* @returns {void} +*/ +function set( value ) { + if ( !isAnchorReferenceFrame( value ) ) { + throw new TypeError( format( 'invalid assignment. `%s` must be one of the following: "%s". Value: `%s`.', prop.name, join( anchorReferenceFrames(), '", "' ), value ) ); + } + if ( value !== this[ prop.private ] ) { + debug( 'Current value: %s. New value: %s.', this[ prop.private ], value ); + this[ prop.private ] = value; + this.emit( 'change', changeEvent( prop.name ) ); + } +} + + +// EXPORTS // + +module.exports = set; diff --git a/lib/node_modules/@stdlib/plot/vega/title/ctor/lib/index.js b/lib/node_modules/@stdlib/plot/vega/title/ctor/lib/index.js new file mode 100644 index 000000000000..73488b8d6ddd --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/title/ctor/lib/index.js @@ -0,0 +1,42 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +/** +* Title constructor. +* +* @module @stdlib/plot/vega/title/ctor +* +* @example +* var Title = require( '@stdlib/plot/vega/title/ctor' ); +* +* var title = new Title({ +* 'text': 'Beep boop' +* }); +* // returns <Title> +*/ + +// MODULES // + +var main = require( './main.js' ); + + +// EXPORTS // + +module.exports = main; diff --git a/lib/node_modules/@stdlib/plot/vega/title/ctor/lib/limit/get.js b/lib/node_modules/@stdlib/plot/vega/title/ctor/lib/limit/get.js new file mode 100644 index 000000000000..22d726ef3c5e --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/title/ctor/lib/limit/get.js @@ -0,0 +1,43 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable no-invalid-this */ + +'use strict'; + +// MODULES // + +var prop = require( './properties.js' ); + + +// MAIN // + +/** +* Returns the maximum allowed length (in pixels) of title and subtitle text. +* +* @private +* @returns {(number|void)} maximum allowed length +*/ +function get() { + return this[ prop.private ]; +} + + +// EXPORTS // + +module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/vega/title/ctor/lib/limit/properties.js b/lib/node_modules/@stdlib/plot/vega/title/ctor/lib/limit/properties.js new file mode 100644 index 000000000000..35b0c22fde45 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/title/ctor/lib/limit/properties.js @@ -0,0 +1,33 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var property2object = require( '@stdlib/plot/vega/base/property2object' ); + + +// MAIN // + +var obj = property2object( 'limit' ); + + +// EXPORTS // + +module.exports = obj; diff --git a/lib/node_modules/@stdlib/plot/vega/title/ctor/lib/limit/set.js b/lib/node_modules/@stdlib/plot/vega/title/ctor/lib/limit/set.js new file mode 100644 index 000000000000..5d9bc7ca16b7 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/title/ctor/lib/limit/set.js @@ -0,0 +1,66 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable no-invalid-this */ + +'use strict'; + +// MODULES // + +var logger = require( 'debug' ); +var isNumber = require( '@stdlib/assert/is-number' ).isPrimitive; +var isUndefined = require( '@stdlib/assert/is-undefined' ); +var format = require( '@stdlib/string/format' ); +var changeEvent = require( './../change_event.js' ); +var prop = require( './properties.js' ); + + +// VARIABLES // + +var debug = logger( 'vega:title:set:'+prop.name ); + + +// MAIN // + +/** +* Sets the maximum allowed length (in pixels) of title and subtitle text. +* +* ## Notes +* +* - Providing `undefined` "unsets" the configured value. +* +* @private +* @param {(number|void)} value - input value +* @throws {TypeError} must be a number +* @returns {void} +*/ +function set( value ) { + if ( !isNumber( value ) && !isUndefined( value ) ) { + throw new TypeError( format( 'invalid assignment. `%s` must be a number. Value: `%s`.', prop.name, value ) ); + } + if ( value !== this[ prop.private ] ) { + debug( 'Current value: %s. New value: %s.', this[ prop.private ], value ); + this[ prop.private ] = value; + this.emit( 'change', changeEvent( prop.name ) ); + } +} + + +// EXPORTS // + +module.exports = set; diff --git a/lib/node_modules/@stdlib/plot/vega/title/ctor/lib/line-height/get.js b/lib/node_modules/@stdlib/plot/vega/title/ctor/lib/line-height/get.js new file mode 100644 index 000000000000..d750bd0394a0 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/title/ctor/lib/line-height/get.js @@ -0,0 +1,43 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable no-invalid-this */ + +'use strict'; + +// MODULES // + +var prop = require( './properties.js' ); + + +// MAIN // + +/** +* Returns the line height (in pixels) for multi-line title text. +* +* @private +* @returns {(number|void)} line height +*/ +function get() { + return this[ prop.private ]; +} + + +// EXPORTS // + +module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/vega/title/ctor/lib/line-height/properties.js b/lib/node_modules/@stdlib/plot/vega/title/ctor/lib/line-height/properties.js new file mode 100644 index 000000000000..b4c0b1d9aac2 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/title/ctor/lib/line-height/properties.js @@ -0,0 +1,33 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var property2object = require( '@stdlib/plot/vega/base/property2object' ); + + +// MAIN // + +var obj = property2object( 'lineHeight' ); + + +// EXPORTS // + +module.exports = obj; diff --git a/lib/node_modules/@stdlib/plot/vega/title/ctor/lib/line-height/set.js b/lib/node_modules/@stdlib/plot/vega/title/ctor/lib/line-height/set.js new file mode 100644 index 000000000000..303f49476243 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/title/ctor/lib/line-height/set.js @@ -0,0 +1,66 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable no-invalid-this */ + +'use strict'; + +// MODULES // + +var logger = require( 'debug' ); +var isNumber = require( '@stdlib/assert/is-number' ).isPrimitive; +var isUndefined = require( '@stdlib/assert/is-undefined' ); +var format = require( '@stdlib/string/format' ); +var changeEvent = require( './../change_event.js' ); +var prop = require( './properties.js' ); + + +// VARIABLES // + +var debug = logger( 'vega:title:set:'+prop.name ); + + +// MAIN // + +/** +* Sets the line height (in pixels) of multi-line title text. +* +* ## Notes +* +* - Providing `undefined` "unsets" the configured value. +* +* @private +* @param {(number|void)} value - input value +* @throws {TypeError} must be a number +* @returns {void} +*/ +function set( value ) { + if ( !isNumber( value ) && !isUndefined( value ) ) { + throw new TypeError( format( 'invalid assignment. `%s` must be a number. Value: `%s`.', prop.name, value ) ); + } + if ( value !== this[ prop.private ] ) { + debug( 'Current value: %s. New value: %s.', this[ prop.private ], value ); + this[ prop.private ] = value; + this.emit( 'change', changeEvent( prop.name ) ); + } +} + + +// EXPORTS // + +module.exports = set; diff --git a/lib/node_modules/@stdlib/plot/vega/title/ctor/lib/main.js b/lib/node_modules/@stdlib/plot/vega/title/ctor/lib/main.js new file mode 100644 index 000000000000..9b7c03f9c857 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/title/ctor/lib/main.js @@ -0,0 +1,764 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable no-restricted-syntax, no-invalid-this */ + +'use strict'; + +// MODULES // + +var EventEmitter = require( 'events' ).EventEmitter; +var logger = require( 'debug' ); +var isObject = require( '@stdlib/assert/is-object' ); +var setNonEnumerableReadOnly = require( '@stdlib/utils/define-nonenumerable-read-only-property' ); +var setNonEnumerableReadOnlyAccessor = require( '@stdlib/utils/define-nonenumerable-read-only-accessor' ); // eslint-disable-line id-length +var setReadWriteAccessor = require( '@stdlib/utils/define-read-write-accessor' ); +var hasProp = require( '@stdlib/assert/has-property' ); +var inherit = require( '@stdlib/utils/inherit' ); +var objectKeys = require( '@stdlib/utils/keys' ); +var transformErrorMessage = require( '@stdlib/plot/vega/base/transform-validation-message' ); +var instance2json = require( '@stdlib/plot/vega/base/to-json' ); +var format = require( '@stdlib/string/format' ); +var properties = require( './properties.json' ); +var defaults = require( './defaults.js' ); + +// Note: keep the following in alphabetical order according to the `require` path... +var getAlign = require( './align/get.js' ); +var setAlign = require( './align/set.js' ); +var getAnchor = require( './anchor/get.js' ); +var setAnchor = require( './anchor/set.js' ); +var getAngle = require( './angle/get.js' ); +var setAngle = require( './angle/set.js' ); +var getARIA = require( './aria/get.js' ); +var setARIA = require( './aria/set.js' ); + +var getBaseline = require( './baseline/get.js' ); +var setBaseline = require( './baseline/set.js' ); + +var getColor = require( './color/get.js' ); +var setColor = require( './color/set.js' ); + +var getDX = require( './dx/get.js' ); +var setDX = require( './dx/set.js' ); +var getDY = require( './dy/get.js' ); +var setDY = require( './dy/set.js' ); + +var getEncode = require( './encode/get.js' ); +var setEncode = require( './encode/set.js' ); + +var getFont = require( './font/get.js' ); +var setFont = require( './font/set.js' ); +var getFontSize = require( './font-size/get.js' ); +var setFontSize = require( './font-size/set.js' ); +var getFontStyle = require( './font-style/get.js' ); +var setFontStyle = require( './font-style/set.js' ); +var getFontWeight = require( './font-weight/get.js' ); +var setFontWeight = require( './font-weight/set.js' ); + +var getFrame = require( './frame/get.js' ); +var setFrame = require( './frame/set.js' ); + +var getLimit = require( './limit/get.js' ); +var setLimit = require( './limit/set.js' ); +var getLineHeight = require( './line-height/get.js' ); +var setLineHeight = require( './line-height/set.js' ); + +var getOffset = require( './offset/get.js' ); +var setOffset = require( './offset/set.js' ); +var getOrient = require( './orient/get.js' ); +var setOrient = require( './orient/set.js' ); + +var getProperties = require( './properties/get.js' ); + +var getSubtitle = require( './subtitle/get.js' ); +var setSubtitle = require( './subtitle/set.js' ); +var getSubtitleColor = require( './subtitle-color/get.js' ); +var setSubtitleColor = require( './subtitle-color/set.js' ); +var getSubtitleFont = require( './subtitle-font/get.js' ); +var setSubtitleFont = require( './subtitle-font/set.js' ); +var getSubtitleFontSize = require( './subtitle-font-size/get.js' ); +var setSubtitleFontSize = require( './subtitle-font-size/set.js' ); +var getSubtitleFontStyle = require( './subtitle-font-style/get.js' ); +var setSubtitleFontStyle = require( './subtitle-font-style/set.js' ); +var getSubtitleFontWeight = require( './subtitle-font-weight/get.js' ); +var setSubtitleFontWeight = require( './subtitle-font-weight/set.js' ); +var getSubtitleLineHeight = require( './subtitle-line-height/get.js' ); +var setSubtitleLineHeight = require( './subtitle-line-height/set.js' ); +var getSubtitlePadding = require( './subtitle-padding/get.js' ); +var setSubtitlePadding = require( './subtitle-padding/set.js' ); + +var getText = require( './text/get.js' ); +var setText = require( './text/set.js' ); + +var getZIndex = require( './zindex/get.js' ); +var setZIndex = require( './zindex/set.js' ); + + +// VARIABLES // + +var debug = logger( 'vega:title:main' ); + + +// MAIN // + +/** +* Title constructor. +* +* @constructor +* @param {Options} [options] - constructor options +* @param {boolean} [options.aria=true] - boolean indicating whether ARIA attributes should be included in SVG output +* +* // FIXME: add parameters +* +* @throws {TypeError} options argument must be an object +* @throws {Error} must provide valid options +* @returns {Title} title instance +* +* @example +* var title = new Title({ +* 'text': 'Beep boop' +* }); +* // returns <Title> +*/ +function Title( options ) { + var nargs; + var opts; + var keys; + var v; + var k; + var i; + + nargs = arguments.length; + if ( !( this instanceof Title ) ) { + if ( nargs ) { + return new Title( options ); + } + return new Title(); + } + EventEmitter.call( this ); + + // Resolve the default configuration: + opts = defaults(); + + // Set internal properties according to the default configuration... + keys = objectKeys( opts ); + for ( i = 0; i < keys.length; i++ ) { + k = keys[ i ]; + this[ '_'+k ] = opts[ k ]; + } + if ( nargs ) { + if ( !isObject( options ) ) { + throw new TypeError( format( 'invalid argument. Options argument must be an object. Value: `%s`.', options ) ); + } + // Validate provided options by attempting to assign option values to corresponding fields... + for ( i = 0; i < properties.length; i++ ) { + k = properties[ i ]; + if ( !hasProp( options, k ) ) { + continue; + } + v = options[ k ]; + try { + this[ k ] = v; + } catch ( err ) { + debug( 'Encountered an error. Error: %s', err.message ); + + // FIXME: retain thrown error type + throw new Error( transformErrorMessage( err.message ) ); + } + } + } + return this; +} + +/* +* Inherit from the `EventEmitter` prototype. +*/ +inherit( Title, EventEmitter ); + +/** +* Constructor name. +* +* @private +* @name name +* @memberof Title +* @readonly +* @type {string} +*/ +setNonEnumerableReadOnly( Title, 'name', 'Title' ); + +/** +* Horizontal text alignment of the title and subtitle. +* +* @name align +* @memberof Title.prototype +* @type {(string|void)} +* +* @example +* var title = new Title({ +* 'text': 'Beep boop', +* 'align': 'left' +* }); +* +* var v = title.align; +* // returns 'left' +*/ +setReadWriteAccessor( Title.prototype, 'align', getAlign, setAlign ); + +/** +* Anchor position for placing the title and subtitle. +* +* @name anchor +* @memberof Title.prototype +* @type {(string|void)} +* @default 'middle' +* +* @example +* var title = new Title({ +* 'text': 'Beep boop', +* 'anchor': 'start' +* }); +* +* var v = title.anchor; +* // returns 'start' +*/ +setReadWriteAccessor( Title.prototype, 'anchor', getAnchor, setAnchor ); + +/** +* Angle (in degrees) of the title and subtitle text. +* +* @name angle +* @memberof Title.prototype +* @type {(number|void)} +* +* @example +* var title = new Title({ +* 'text': 'Beep boop', +* 'angle': 90 +* }); +* +* var v = title.angle; +* // returns 90 +*/ +setReadWriteAccessor( Title.prototype, 'angle', getAngle, setAngle ); + +/** +* Boolean indicating whether ARIA attributes should be included in SVG output. +* +* @name aria +* @memberof Title.prototype +* @type {boolean} +* @default true +* +* @example +* var title = new Title({ +* 'text': 'Beep boop', +* 'aria': false +* }); +* +* var v = title.aria; +* // returns false +*/ +setReadWriteAccessor( Title.prototype, 'aria', getARIA, setARIA ); + +/** +* Vertical baseline of the title and subtitle text. +* +* @name baseline +* @memberof Title.prototype +* @type {(string|void)} +* +* @example +* var title = new Title({ +* 'text': 'Beep boop', +* 'baseline': 'top' +* }); +* +* var v = title.baseline; +* // returns 'top' +*/ +setReadWriteAccessor( Title.prototype, 'baseline', getBaseline, setBaseline ); + +/** +* Color of the title text. +* +* @name color +* @memberof Title.prototype +* @type {(string|void)} +* +* @example +* var title = new Title({ +* 'text': 'Beep boop', +* 'color': 'steelblue' +* }); +* +* var v = title.color; +* // returns 'steelblue' +*/ +setReadWriteAccessor( Title.prototype, 'color', getColor, setColor ); + +/** +* Horizontal offset added to the title and subtitle x-coordinate. +* +* @name dx +* @memberof Title.prototype +* @type {(number|void)} +* +* @example +* var title = new Title({ +* 'text': 'Beep boop', +* 'dx': 2 +* }); +* +* var v = title.dx; +* // returns 2 +*/ +setReadWriteAccessor( Title.prototype, 'dx', getDX, setDX ); + +/** +* Vertical offset added to the title and subtitle y-coordinate. +* +* @name dy +* @memberof Title.prototype +* @type {(number|void)} +* +* @example +* var title = new Title({ +* 'text': 'Beep boop', +* 'dy': 2 +* }); +* +* var v = title.dy; +* // returns 2 +*/ +setReadWriteAccessor( Title.prototype, 'dy', getDY, setDY ); + +/** +* Mark encodings for custom title styling. +* +* @name encode +* @memberof Title.prototype +* @type {(Object|void)} +* +* @example +* var title = new Title({ +* 'text': 'Beep boop', +* 'encode': { +* 'title': { +* 'enter': { +* 'fill': { +* 'value': 'steelblue' +* } +* } +* } +* } +* }); +* +* var v = title.encode; +* // returns {...} +*/ +setReadWriteAccessor( Title.prototype, 'encode', getEncode, setEncode ); + +/** +* Font name of the title text. +* +* @name font +* @memberof Title.prototype +* @type {(string|void)} +* +* @example +* var title = new Title({ +* 'text': 'Beep boop', +* 'font': 'Arial' +* }); +* +* var v = title.font; +* // returns 'Arial' +*/ +setReadWriteAccessor( Title.prototype, 'font', getFont, setFont ); + +/** +* Font size of the title text. +* +* @name fontSize +* @memberof Title.prototype +* @type {(string|void)} +* +* @example +* var title = new Title({ +* 'text': 'Beep boop', +* 'fontSize': 12 +* }); +* +* var v = title.fontSize; +* // returns 12 +*/ +setReadWriteAccessor( Title.prototype, 'fontSize', getFontSize, setFontSize ); + +/** +* Font style of the title text. +* +* @name fontStyle +* @memberof Title.prototype +* @type {(string|void)} +* +* @example +* var title = new Title({ +* 'text': 'Beep boop', +* 'fontStyle': 'Arial' +* }); +* +* var v = title.fontStyle; +* // returns 'Arial' +*/ +setReadWriteAccessor( Title.prototype, 'fontStyle', getFontStyle, setFontStyle ); + +/** +* Font weight of the title text. +* +* @name fontWeight +* @memberof Title.prototype +* @type {(string|number|void)} +* +* @example +* var title = new Title({ +* 'text': 'Beep boop', +* 'fontWeight': 'bold' +* }); +* +* var v = title.fontWeight; +* // returns 'bold' +*/ +setReadWriteAccessor( Title.prototype, 'fontWeight', getFontWeight, setFontWeight ); + +/** +* Reference frame for the anchor position. +* +* @name frame +* @memberof Title.prototype +* @type {string} +* @default 'bounds' +* +* @example +* var title = new Title({ +* 'text': 'Beep boop', +* 'frame': 'group' +* }); +* +* var v = title.frame; +* // returns 'group' +*/ +setReadWriteAccessor( Title.prototype, 'frame', getFrame, setFrame ); + +/** +* Maximum allowed length (in pixels) of title and subtitle text. +* +* @name limit +* @memberof Title.prototype +* @type {(number|void)} +* +* @example +* var title = new Title({ +* 'text': 'Beep boop', +* 'limit': 100 +* }); +* +* var v = title.limit; +* // returns 100 +*/ +setReadWriteAccessor( Title.prototype, 'limit', getLimit, setLimit ); + +/** +* Line height (in pixels) for multi-line title text. +* +* @name lineHeight +* @memberof Title.prototype +* @type {(number|void)} +* +* @example +* var title = new Title({ +* 'text': 'Beep boop', +* 'lineHeight': 16 +* }); +* +* var v = title.lineHeight; +* // returns 16 +*/ +setReadWriteAccessor( Title.prototype, 'lineHeight', getLineHeight, setLineHeight ); + +/** +* Orthogonal offset in pixels by which to displace the title from its position along the edge of the chart. +* +* @name offset +* @memberof Title.prototype +* @type {(number|void)} +* +* @example +* var title = new Title({ +* 'text': 'Beep boop', +* 'offset': 12 +* }); +* +* var v = title.offset; +* // returns 12 +*/ +setReadWriteAccessor( Title.prototype, 'offset', getOffset, setOffset ); + +/** +* Title orientation. +* +* @name orient +* @memberof Title.prototype +* @type {string} +* @default 'top' +* +* @example +* var title = new Title({ +* 'text': 'Beep boop', +* 'orient': 'bottom' +* }); +* +* var v = title.orient; +* // returns 'bottom' +*/ +setReadWriteAccessor( Title.prototype, 'orient', getOrient, setOrient ); + +/** +* Title properties. +* +* @name properties +* @memberof Title.prototype +* @type {Array<string>} +* +* @example +* var title = new Title({ +* 'text': 'Beep boop' +* }); +* +* var v = title.properties; +* // returns [...] +*/ +setNonEnumerableReadOnlyAccessor( Title.prototype, 'properties', getProperties ); + +/** +* Subtitle text. +* +* @name subtitle +* @memberof Title.prototype +* @type {Array<string>} +* +* @example +* var title = new Title({ +* 'text': 'Beep boop', +* 'subtitle': 'foo bar' +* }); +* +* var v = title.subtitle; +* // returns [ 'foo bar' ] +*/ +setReadWriteAccessor( Title.prototype, 'subtitle', getSubtitle, setSubtitle ); + +/** +* Color of the subtitle text. +* +* @name subtitleColor +* @memberof Title.prototype +* @type {(string|void)} +* +* @example +* var title = new Title({ +* 'text': 'Beep boop', +* 'subtitleColor': 'steelblue' +* }); +* +* var v = title.subtitleColor; +* // returns 'steelblue' +*/ +setReadWriteAccessor( Title.prototype, 'subtitleColor', getSubtitleColor, setSubtitleColor ); + +/** +* Font name for the subtitle text. +* +* @name subtitleFont +* @memberof Title.prototype +* @type {(string|void)} +* +* @example +* var title = new Title({ +* 'text': 'Beep boop', +* 'subtitleFont': 'Arial' +* }); +* +* var v = title.subtitleFont; +* // returns 'Arial' +*/ +setReadWriteAccessor( Title.prototype, 'subtitleFont', getSubtitleFont, setSubtitleFont ); + +/** +* Font size for the subtitle text. +* +* @name subtitleFontSize +* @memberof Title.prototype +* @type {(number|void)} +* +* @example +* var title = new Title({ +* 'text': 'Beep boop', +* 'subtitleFontSize': 14 +* }); +* +* var v = title.subtitleFontSize; +* // returns 14 +*/ +setReadWriteAccessor( Title.prototype, 'subtitleFontSize', getSubtitleFontSize, setSubtitleFontSize ); + +/** +* Font style for the subtitle text. +* +* @name subtitleFontStyle +* @memberof Title.prototype +* @type {(string|void)} +* +* @example +* var title = new Title({ +* 'text': 'Beep boop', +* 'subtitleFontStyle': 'italic' +* }); +* +* var v = title.subtitleFontStyle; +* // returns 'italic' +*/ +setReadWriteAccessor( Title.prototype, 'subtitleFontStyle', getSubtitleFontStyle, setSubtitleFontStyle ); + +/** +* Font weight for the subtitle text. +* +* @name subtitleFontWeight +* @memberof Title.prototype +* @type {(string|number|void)} +* +* @example +* var title = new Title({ +* 'text': 'Beep boop', +* 'subtitleFontWeight': 'bold' +* }); +* +* var v = title.subtitleFontWeight; +* // returns 'bold' +*/ +setReadWriteAccessor( Title.prototype, 'subtitleFontWeight', getSubtitleFontWeight, setSubtitleFontWeight ); + +/** +* Line height (in pixels) for multi-line subtitle text. +* +* @name subtitleLineHeight +* @memberof Title.prototype +* @type {(number|void)} +* +* @example +* var title = new Title({ +* 'text': 'Beep boop', +* 'subtitleLineHeight': 16 +* }); +* +* var v = title.subtitleLineHeight; +* // returns 16 +*/ +setReadWriteAccessor( Title.prototype, 'subtitleLineHeight', getSubtitleLineHeight, setSubtitleLineHeight ); + +/** +* Padding (in pixels) between title and subtitle text. +* +* @name subtitlePadding +* @memberof Title.prototype +* @type {(number|void)} +* +* @example +* var title = new Title({ +* 'text': 'Beep boop', +* 'subtitlePadding': 24 +* }); +* +* var v = title.subtitlePadding; +* // returns 24 +*/ +setReadWriteAccessor( Title.prototype, 'subtitlePadding', getSubtitlePadding, setSubtitlePadding ); + +/** +* Title text. +* +* @name text +* @memberof Title.prototype +* @type {Array<string>} +* +* @example +* var title = new Title({ +* 'text': 'Beep boop' +* }); +* +* var v = title.text; +* // returns [ 'Beep boop' ] +*/ +setReadWriteAccessor( Title.prototype, 'text', getText, setText ); + +/** +* Integer z-index indicating the layering of the title group relative to other axis, mark, and legend groups. +* +* @name zindex +* @memberof Title.prototype +* @type {string} +* @default 0 +* +* @example +* var title = new Title({ +* 'text': 'Beep boop', +* 'zindex': 2 +* }); +* +* var v = title.zindex; +* // returns 2 +*/ +setReadWriteAccessor( Title.prototype, 'zindex', getZIndex, setZIndex ); + +/** +* Serializes an instance to a JSON object. +* +* ## Notes +* +* - This method is implicitly invoked by `JSON.stringify`. +* +* @name toJSON +* @memberof Title.prototype +* @type {Function} +* @returns {Object} JSON object +* +* @example +* var title = new Title({ +* 'text': 'Beep boop' +* }); +* +* var v = title.toJSON(); +* // returns {...} +*/ +setNonEnumerableReadOnly( Title.prototype, 'toJSON', function toJSON() { + return instance2json( this, properties ); +}); + + +// EXPORTS // + +module.exports = Title; diff --git a/lib/node_modules/@stdlib/plot/vega/title/ctor/lib/offset/get.js b/lib/node_modules/@stdlib/plot/vega/title/ctor/lib/offset/get.js new file mode 100644 index 000000000000..c6fed40f55b7 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/title/ctor/lib/offset/get.js @@ -0,0 +1,43 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable no-invalid-this */ + +'use strict'; + +// MODULES // + +var prop = require( './properties.js' ); + + +// MAIN // + +/** +* Returns the orthogonal offset (in pixels) by which to displace the title from its position along the edge of a chart. +* +* @private +* @returns {(number|void)} offset +*/ +function get() { + return this[ prop.private ]; +} + + +// EXPORTS // + +module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/vega/title/ctor/lib/offset/properties.js b/lib/node_modules/@stdlib/plot/vega/title/ctor/lib/offset/properties.js new file mode 100644 index 000000000000..5adae9fa1e15 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/title/ctor/lib/offset/properties.js @@ -0,0 +1,33 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var property2object = require( '@stdlib/plot/vega/base/property2object' ); + + +// MAIN // + +var obj = property2object( 'offset' ); + + +// EXPORTS // + +module.exports = obj; diff --git a/lib/node_modules/@stdlib/plot/vega/title/ctor/lib/offset/set.js b/lib/node_modules/@stdlib/plot/vega/title/ctor/lib/offset/set.js new file mode 100644 index 000000000000..721b4a6b19e8 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/title/ctor/lib/offset/set.js @@ -0,0 +1,66 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable no-invalid-this */ + +'use strict'; + +// MODULES // + +var logger = require( 'debug' ); +var isNumber = require( '@stdlib/assert/is-number' ).isPrimitive; +var isUndefined = require( '@stdlib/assert/is-undefined' ); +var format = require( '@stdlib/string/format' ); +var changeEvent = require( './../change_event.js' ); +var prop = require( './properties.js' ); + + +// VARIABLES // + +var debug = logger( 'vega:title:set:'+prop.name ); + + +// MAIN // + +/** +* Sets the orthogonal offset (in pixels) by which to displace the title from its position along the edge of a chart. +* +* ## Notes +* +* - Providing `undefined` "unsets" the configured value. +* +* @private +* @param {(number|void)} value - input value +* @throws {TypeError} must be a number +* @returns {void} +*/ +function set( value ) { + if ( !isNumber( value ) && !isUndefined( value ) ) { + throw new TypeError( format( 'invalid assignment. `%s` must be a number. Value: `%s`.', prop.name, value ) ); + } + if ( value !== this[ prop.private ] ) { + debug( 'Current value: %s. New value: %s.', this[ prop.private ], value ); + this[ prop.private ] = value; + this.emit( 'change', changeEvent( prop.name ) ); + } +} + + +// EXPORTS // + +module.exports = set; diff --git a/lib/node_modules/@stdlib/plot/vega/title/ctor/lib/orient/get.js b/lib/node_modules/@stdlib/plot/vega/title/ctor/lib/orient/get.js new file mode 100644 index 000000000000..8ffc4060d5f6 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/title/ctor/lib/orient/get.js @@ -0,0 +1,43 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable no-invalid-this */ + +'use strict'; + +// MODULES // + +var prop = require( './properties.js' ); + + +// MAIN // + +/** +* Returns the title orientation. +* +* @private +* @returns {string} orientation +*/ +function get() { + return this[ prop.private ]; +} + + +// EXPORTS // + +module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/vega/title/ctor/lib/orient/properties.js b/lib/node_modules/@stdlib/plot/vega/title/ctor/lib/orient/properties.js new file mode 100644 index 000000000000..bc16e7d16025 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/title/ctor/lib/orient/properties.js @@ -0,0 +1,33 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var property2object = require( '@stdlib/plot/vega/base/property2object' ); + + +// MAIN // + +var obj = property2object( 'orient' ); + + +// EXPORTS // + +module.exports = obj; diff --git a/lib/node_modules/@stdlib/plot/vega/title/ctor/lib/orient/set.js b/lib/node_modules/@stdlib/plot/vega/title/ctor/lib/orient/set.js new file mode 100644 index 000000000000..b45e8febb712 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/title/ctor/lib/orient/set.js @@ -0,0 +1,63 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable no-invalid-this */ + +'use strict'; + +// MODULES // + +var logger = require( 'debug' ); +var isTitleOrientation = require( '@stdlib/plot/vega/base/assert/is-title-orientation' ); +var join = require( '@stdlib/array/base/join' ); +var titleOrientations = require( '@stdlib/plot/vega/title/orientations' ); +var format = require( '@stdlib/string/format' ); +var changeEvent = require( './../change_event.js' ); +var prop = require( './properties.js' ); + + +// VARIABLES // + +var debug = logger( 'vega:title:set:'+prop.name ); + + +// MAIN // + +/** +* Sets a title orientation. +* +* @private +* @param {string} value - input value +* @throws {TypeError} must be a valid orientation +* @returns {void} +*/ +function set( value ) { + if ( !isTitleOrientation( value ) ) { + throw new TypeError( format( 'invalid assignment. `%s` must be one of the following: "%s". Value: `%s`.', prop.name, join( titleOrientations(), '", "' ), value ) ); + } + if ( value !== this[ prop.private ] ) { + debug( 'Current value: %s. New value: %s.', this[ prop.private ], value ); + this[ prop.private ] = value; + this.emit( 'change', changeEvent( prop.name ) ); + } +} + + +// EXPORTS // + +module.exports = set; diff --git a/lib/node_modules/@stdlib/plot/vega/title/ctor/lib/properties.json b/lib/node_modules/@stdlib/plot/vega/title/ctor/lib/properties.json new file mode 100644 index 000000000000..04d8ea7da9ac --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/title/ctor/lib/properties.json @@ -0,0 +1,30 @@ +[ + "aria", + "align", + "anchor", + "angle", + "baseline", + "color", + "dx", + "dy", + "encode", + "font", + "fontSize", + "fontStyle", + "fontWeight", + "frame", + "limit", + "lineHeight", + "offset", + "orient", + "subtitle", + "subtitleColor", + "subtitleFont", + "subtitleFontSize", + "subtitleFontStyle", + "subtitleFontWeight", + "subtitleLineHeight", + "subtitlePadding", + "text", + "zindex" +] diff --git a/lib/node_modules/@stdlib/plot/vega/title/ctor/lib/properties/get.js b/lib/node_modules/@stdlib/plot/vega/title/ctor/lib/properties/get.js new file mode 100644 index 000000000000..8fc57de14e90 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/title/ctor/lib/properties/get.js @@ -0,0 +1,41 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var properties = require( './../properties.json' ); + + +// MAIN // + +/** +* Returns the list of enumerable properties. +* +* @private +* @returns {Array<string>} properties +*/ +function get() { + return properties.slice(); +} + + +// EXPORTS // + +module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/vega/title/ctor/lib/subtitle-color/get.js b/lib/node_modules/@stdlib/plot/vega/title/ctor/lib/subtitle-color/get.js new file mode 100644 index 000000000000..f1bfe6ddc6ef --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/title/ctor/lib/subtitle-color/get.js @@ -0,0 +1,43 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable no-invalid-this */ + +'use strict'; + +// MODULES // + +var prop = require( './properties.js' ); + + +// MAIN // + +/** +* Returns the color of the subtitle text. +* +* @private +* @returns {(void|string)} color string +*/ +function get() { + return this[ prop.private ]; +} + + +// EXPORTS // + +module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/vega/title/ctor/lib/subtitle-color/properties.js b/lib/node_modules/@stdlib/plot/vega/title/ctor/lib/subtitle-color/properties.js new file mode 100644 index 000000000000..734eb7969e43 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/title/ctor/lib/subtitle-color/properties.js @@ -0,0 +1,33 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var property2object = require( '@stdlib/plot/vega/base/property2object' ); + + +// MAIN // + +var obj = property2object( 'subtitleColor' ); + + +// EXPORTS // + +module.exports = obj; diff --git a/lib/node_modules/@stdlib/plot/vega/title/ctor/lib/subtitle-color/set.js b/lib/node_modules/@stdlib/plot/vega/title/ctor/lib/subtitle-color/set.js new file mode 100644 index 000000000000..112c8243eae0 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/title/ctor/lib/subtitle-color/set.js @@ -0,0 +1,66 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable no-invalid-this */ + +'use strict'; + +// MODULES // + +var logger = require( 'debug' ); +var isString = require( '@stdlib/assert/is-string' ).isPrimitive; +var isUndefined = require( '@stdlib/assert/is-undefined' ); +var format = require( '@stdlib/string/format' ); +var changeEvent = require( './../change_event.js' ); +var prop = require( './properties.js' ); + + +// VARIABLES // + +var debug = logger( 'vega:title:set:'+prop.name ); + + +// MAIN // + +/** +* Sets the color of the subtitle text. +* +* ## Notes +* +* - Providing `undefined` "unsets" the configured value. +* +* @private +* @param {(string|void)} value - input value +* @throws {TypeError} must be a string +* @returns {void} +*/ +function set( value ) { + if ( !isString( value ) && !isUndefined( value ) ) { + throw new TypeError( format( 'invalid assignment. `%s` must be a string. Value: `%s`.', prop.name, value ) ); + } + if ( value !== this[ prop.private ] ) { + debug( 'Current value: %s. New value: %s.', this[ prop.private ], value ); + this[ prop.private ] = value; + this.emit( 'change', changeEvent( prop.name ) ); + } +} + + +// EXPORTS // + +module.exports = set; diff --git a/lib/node_modules/@stdlib/plot/vega/title/ctor/lib/subtitle-font-size/get.js b/lib/node_modules/@stdlib/plot/vega/title/ctor/lib/subtitle-font-size/get.js new file mode 100644 index 000000000000..b7aab3c9738e --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/title/ctor/lib/subtitle-font-size/get.js @@ -0,0 +1,43 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable no-invalid-this */ + +'use strict'; + +// MODULES // + +var prop = require( './properties.js' ); + + +// MAIN // + +/** +* Returns the font size (in pixels) of subtitle text. +* +* @private +* @returns {(number|void)} font size +*/ +function get() { + return this[ prop.private ]; +} + + +// EXPORTS // + +module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/vega/title/ctor/lib/subtitle-font-size/properties.js b/lib/node_modules/@stdlib/plot/vega/title/ctor/lib/subtitle-font-size/properties.js new file mode 100644 index 000000000000..5689d5f2c797 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/title/ctor/lib/subtitle-font-size/properties.js @@ -0,0 +1,33 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var property2object = require( '@stdlib/plot/vega/base/property2object' ); + + +// MAIN // + +var obj = property2object( 'subtitleFontSize' ); + + +// EXPORTS // + +module.exports = obj; diff --git a/lib/node_modules/@stdlib/plot/vega/title/ctor/lib/subtitle-font-size/set.js b/lib/node_modules/@stdlib/plot/vega/title/ctor/lib/subtitle-font-size/set.js new file mode 100644 index 000000000000..6e8f433832ad --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/title/ctor/lib/subtitle-font-size/set.js @@ -0,0 +1,66 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable no-invalid-this */ + +'use strict'; + +// MODULES // + +var logger = require( 'debug' ); +var isNumber = require( '@stdlib/assert/is-number' ).isPrimitive; +var isUndefined = require( '@stdlib/assert/is-undefined' ); +var format = require( '@stdlib/string/format' ); +var changeEvent = require( './../change_event.js' ); +var prop = require( './properties.js' ); + + +// VARIABLES // + +var debug = logger( 'vega:title:set:'+prop.name ); + + +// MAIN // + +/** +* Sets the font size (in pixels) of subtitle text. +* +* ## Notes +* +* - Providing `undefined` "unsets" the configured value. +* +* @private +* @param {(number|void)} value - input value +* @throws {TypeError} must be a number +* @returns {void} +*/ +function set( value ) { + if ( !isNumber( value ) && !isUndefined( value ) ) { + throw new TypeError( format( 'invalid assignment. `%s` must be a number. Value: `%s`.', prop.name, value ) ); + } + if ( value !== this[ prop.private ] ) { + debug( 'Current value: %s. New value: %s.', this[ prop.private ], value ); + this[ prop.private ] = value; + this.emit( 'change', changeEvent( prop.name ) ); + } +} + + +// EXPORTS // + +module.exports = set; diff --git a/lib/node_modules/@stdlib/plot/vega/title/ctor/lib/subtitle-font-style/get.js b/lib/node_modules/@stdlib/plot/vega/title/ctor/lib/subtitle-font-style/get.js new file mode 100644 index 000000000000..7182e9603e4e --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/title/ctor/lib/subtitle-font-style/get.js @@ -0,0 +1,43 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable no-invalid-this */ + +'use strict'; + +// MODULES // + +var prop = require( './properties.js' ); + + +// MAIN // + +/** +* Returns the font style of the subtitle text. +* +* @private +* @returns {(string|void)} font style +*/ +function get() { + return this[ prop.private ]; +} + + +// EXPORTS // + +module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/vega/title/ctor/lib/subtitle-font-style/properties.js b/lib/node_modules/@stdlib/plot/vega/title/ctor/lib/subtitle-font-style/properties.js new file mode 100644 index 000000000000..c6185de8fcf1 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/title/ctor/lib/subtitle-font-style/properties.js @@ -0,0 +1,33 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var property2object = require( '@stdlib/plot/vega/base/property2object' ); + + +// MAIN // + +var obj = property2object( 'subtitleFontStyle' ); + + +// EXPORTS // + +module.exports = obj; diff --git a/lib/node_modules/@stdlib/plot/vega/title/ctor/lib/subtitle-font-style/set.js b/lib/node_modules/@stdlib/plot/vega/title/ctor/lib/subtitle-font-style/set.js new file mode 100644 index 000000000000..f6d18aea7c0f --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/title/ctor/lib/subtitle-font-style/set.js @@ -0,0 +1,66 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable no-invalid-this */ + +'use strict'; + +// MODULES // + +var logger = require( 'debug' ); +var isString = require( '@stdlib/assert/is-string' ).isPrimitive; +var isUndefined = require( '@stdlib/assert/is-undefined' ); +var format = require( '@stdlib/string/format' ); +var changeEvent = require( './../change_event.js' ); +var prop = require( './properties.js' ); + + +// VARIABLES // + +var debug = logger( 'vega:title:set:'+prop.name ); + + +// MAIN // + +/** +* Sets the font style of the subtitle text. +* +* ## Notes +* +* - Providing `undefined` "unsets" the configured value. +* +* @private +* @param {(string|void)} value - input value +* @throws {TypeError} must be a string +* @returns {void} +*/ +function set( value ) { + if ( !isString( value ) && !isUndefined( value ) ) { + throw new TypeError( format( 'invalid assignment. `%s` must be a string. Value: `%s`.', prop.name, value ) ); + } + if ( value !== this[ prop.private ] ) { + debug( 'Current value: %s. New value: %s.', this[ prop.private ], value ); + this[ prop.private ] = value; + this.emit( 'change', changeEvent( prop.name ) ); + } +} + + +// EXPORTS // + +module.exports = set; diff --git a/lib/node_modules/@stdlib/plot/vega/title/ctor/lib/subtitle-font-weight/get.js b/lib/node_modules/@stdlib/plot/vega/title/ctor/lib/subtitle-font-weight/get.js new file mode 100644 index 000000000000..21e5685df0ac --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/title/ctor/lib/subtitle-font-weight/get.js @@ -0,0 +1,43 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable no-invalid-this */ + +'use strict'; + +// MODULES // + +var prop = require( './properties.js' ); + + +// MAIN // + +/** +* Returns the font weight of subtitle text. +* +* @private +* @returns {(number|string|void)} font weight +*/ +function get() { + return this[ prop.private ]; +} + + +// EXPORTS // + +module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/vega/title/ctor/lib/subtitle-font-weight/properties.js b/lib/node_modules/@stdlib/plot/vega/title/ctor/lib/subtitle-font-weight/properties.js new file mode 100644 index 000000000000..6281c2b0ec57 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/title/ctor/lib/subtitle-font-weight/properties.js @@ -0,0 +1,33 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var property2object = require( '@stdlib/plot/vega/base/property2object' ); + + +// MAIN // + +var obj = property2object( 'subtitleFontWeight' ); + + +// EXPORTS // + +module.exports = obj; diff --git a/lib/node_modules/@stdlib/plot/vega/title/ctor/lib/subtitle-font-weight/set.js b/lib/node_modules/@stdlib/plot/vega/title/ctor/lib/subtitle-font-weight/set.js new file mode 100644 index 000000000000..3f845ce85ef8 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/title/ctor/lib/subtitle-font-weight/set.js @@ -0,0 +1,67 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable no-invalid-this */ + +'use strict'; + +// MODULES // + +var logger = require( 'debug' ); +var isNumber = require( '@stdlib/assert/is-number' ).isPrimitive; +var isString = require( '@stdlib/assert/is-string' ).isPrimitive; +var isUndefined = require( '@stdlib/assert/is-undefined' ); +var format = require( '@stdlib/string/format' ); +var changeEvent = require( './../change_event.js' ); +var prop = require( './properties.js' ); + + +// VARIABLES // + +var debug = logger( 'vega:title:set:'+prop.name ); + + +// MAIN // + +/** +* Sets the font weight of subtitle text. +* +* ## Notes +* +* - Providing `undefined` "unsets" the configured value. +* +* @private +* @param {(number|string|void)} value - input value +* @throws {TypeError} must be a number or string +* @returns {void} +*/ +function set( value ) { + if ( !isNumber( value ) && !isString( value ) && !isUndefined( value ) ) { + throw new TypeError( format( 'invalid assignment. `%s` must be a number or string. Value: `%s`.', prop.name, value ) ); + } + if ( value !== this[ prop.private ] ) { + debug( 'Current value: %s. New value: %s.', this[ prop.private ], value ); + this[ prop.private ] = value; + this.emit( 'change', changeEvent( prop.name ) ); + } +} + + +// EXPORTS // + +module.exports = set; diff --git a/lib/node_modules/@stdlib/plot/vega/title/ctor/lib/subtitle-font/get.js b/lib/node_modules/@stdlib/plot/vega/title/ctor/lib/subtitle-font/get.js new file mode 100644 index 000000000000..6ee2f02054fb --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/title/ctor/lib/subtitle-font/get.js @@ -0,0 +1,43 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable no-invalid-this */ + +'use strict'; + +// MODULES // + +var prop = require( './properties.js' ); + + +// MAIN // + +/** +* Returns the font name of the subtitle text. +* +* @private +* @returns {(string|void)} font name +*/ +function get() { + return this[ prop.private ]; +} + + +// EXPORTS // + +module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/vega/title/ctor/lib/subtitle-font/properties.js b/lib/node_modules/@stdlib/plot/vega/title/ctor/lib/subtitle-font/properties.js new file mode 100644 index 000000000000..7d18135f20d6 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/title/ctor/lib/subtitle-font/properties.js @@ -0,0 +1,33 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var property2object = require( '@stdlib/plot/vega/base/property2object' ); + + +// MAIN // + +var obj = property2object( 'subtitleFont' ); + + +// EXPORTS // + +module.exports = obj; diff --git a/lib/node_modules/@stdlib/plot/vega/title/ctor/lib/subtitle-font/set.js b/lib/node_modules/@stdlib/plot/vega/title/ctor/lib/subtitle-font/set.js new file mode 100644 index 000000000000..fc7b3ef22323 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/title/ctor/lib/subtitle-font/set.js @@ -0,0 +1,66 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable no-invalid-this */ + +'use strict'; + +// MODULES // + +var logger = require( 'debug' ); +var isString = require( '@stdlib/assert/is-string' ).isPrimitive; +var isUndefined = require( '@stdlib/assert/is-undefined' ); +var format = require( '@stdlib/string/format' ); +var changeEvent = require( './../change_event.js' ); +var prop = require( './properties.js' ); + + +// VARIABLES // + +var debug = logger( 'vega:title:set:'+prop.name ); + + +// MAIN // + +/** +* Sets the font name of the subtitle text. +* +* ## Notes +* +* - Providing `undefined` "unsets" the configured value. +* +* @private +* @param {(string|void)} value - input value +* @throws {TypeError} must be a string +* @returns {void} +*/ +function set( value ) { + if ( !isString( value ) && !isUndefined( value ) ) { + throw new TypeError( format( 'invalid assignment. `%s` must be a string. Value: `%s`.', prop.name, value ) ); + } + if ( value !== this[ prop.private ] ) { + debug( 'Current value: %s. New value: %s.', this[ prop.private ], value ); + this[ prop.private ] = value; + this.emit( 'change', changeEvent( prop.name ) ); + } +} + + +// EXPORTS // + +module.exports = set; diff --git a/lib/node_modules/@stdlib/plot/vega/title/ctor/lib/subtitle-line-height/get.js b/lib/node_modules/@stdlib/plot/vega/title/ctor/lib/subtitle-line-height/get.js new file mode 100644 index 000000000000..e0f169c832f4 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/title/ctor/lib/subtitle-line-height/get.js @@ -0,0 +1,43 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable no-invalid-this */ + +'use strict'; + +// MODULES // + +var prop = require( './properties.js' ); + + +// MAIN // + +/** +* Returns the line height (in pixels) for multi-line subtitle text. +* +* @private +* @returns {(number|void)} line height +*/ +function get() { + return this[ prop.private ]; +} + + +// EXPORTS // + +module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/vega/title/ctor/lib/subtitle-line-height/properties.js b/lib/node_modules/@stdlib/plot/vega/title/ctor/lib/subtitle-line-height/properties.js new file mode 100644 index 000000000000..cc162d5d771e --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/title/ctor/lib/subtitle-line-height/properties.js @@ -0,0 +1,33 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var property2object = require( '@stdlib/plot/vega/base/property2object' ); + + +// MAIN // + +var obj = property2object( 'subtitleLineHeight' ); + + +// EXPORTS // + +module.exports = obj; diff --git a/lib/node_modules/@stdlib/plot/vega/title/ctor/lib/subtitle-line-height/set.js b/lib/node_modules/@stdlib/plot/vega/title/ctor/lib/subtitle-line-height/set.js new file mode 100644 index 000000000000..eb721c8a353f --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/title/ctor/lib/subtitle-line-height/set.js @@ -0,0 +1,66 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable no-invalid-this */ + +'use strict'; + +// MODULES // + +var logger = require( 'debug' ); +var isNumber = require( '@stdlib/assert/is-number' ).isPrimitive; +var isUndefined = require( '@stdlib/assert/is-undefined' ); +var format = require( '@stdlib/string/format' ); +var changeEvent = require( './../change_event.js' ); +var prop = require( './properties.js' ); + + +// VARIABLES // + +var debug = logger( 'vega:title:set:'+prop.name ); + + +// MAIN // + +/** +* Sets the line height (in pixels) of multi-line subtitle text. +* +* ## Notes +* +* - Providing `undefined` "unsets" the configured value. +* +* @private +* @param {(number|void)} value - input value +* @throws {TypeError} must be a number +* @returns {void} +*/ +function set( value ) { + if ( !isNumber( value ) && !isUndefined( value ) ) { + throw new TypeError( format( 'invalid assignment. `%s` must be a number. Value: `%s`.', prop.name, value ) ); + } + if ( value !== this[ prop.private ] ) { + debug( 'Current value: %s. New value: %s.', this[ prop.private ], value ); + this[ prop.private ] = value; + this.emit( 'change', changeEvent( prop.name ) ); + } +} + + +// EXPORTS // + +module.exports = set; diff --git a/lib/node_modules/@stdlib/plot/vega/title/ctor/lib/subtitle-padding/get.js b/lib/node_modules/@stdlib/plot/vega/title/ctor/lib/subtitle-padding/get.js new file mode 100644 index 000000000000..073fc7abd24a --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/title/ctor/lib/subtitle-padding/get.js @@ -0,0 +1,43 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable no-invalid-this */ + +'use strict'; + +// MODULES // + +var prop = require( './properties.js' ); + + +// MAIN // + +/** +* Returns the padding (in pixels) between title and subtitle text. +* +* @private +* @returns {(number|void)} padding +*/ +function get() { + return this[ prop.private ]; +} + + +// EXPORTS // + +module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/vega/title/ctor/lib/subtitle-padding/properties.js b/lib/node_modules/@stdlib/plot/vega/title/ctor/lib/subtitle-padding/properties.js new file mode 100644 index 000000000000..80e02960ba85 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/title/ctor/lib/subtitle-padding/properties.js @@ -0,0 +1,33 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var property2object = require( '@stdlib/plot/vega/base/property2object' ); + + +// MAIN // + +var obj = property2object( 'subtitlePadding' ); + + +// EXPORTS // + +module.exports = obj; diff --git a/lib/node_modules/@stdlib/plot/vega/title/ctor/lib/subtitle-padding/set.js b/lib/node_modules/@stdlib/plot/vega/title/ctor/lib/subtitle-padding/set.js new file mode 100644 index 000000000000..34a026214530 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/title/ctor/lib/subtitle-padding/set.js @@ -0,0 +1,66 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable no-invalid-this */ + +'use strict'; + +// MODULES // + +var logger = require( 'debug' ); +var isNumber = require( '@stdlib/assert/is-number' ).isPrimitive; +var isUndefined = require( '@stdlib/assert/is-undefined' ); +var format = require( '@stdlib/string/format' ); +var changeEvent = require( './../change_event.js' ); +var prop = require( './properties.js' ); + + +// VARIABLES // + +var debug = logger( 'vega:title:set:'+prop.name ); + + +// MAIN // + +/** +* Sets the padding (in pixels) between title and subtitle text. +* +* ## Notes +* +* - Providing `undefined` "unsets" the configured value. +* +* @private +* @param {(number|void)} value - input value +* @throws {TypeError} must be a number +* @returns {void} +*/ +function set( value ) { + if ( !isNumber( value ) && !isUndefined( value ) ) { + throw new TypeError( format( 'invalid assignment. `%s` must be a number. Value: `%s`.', prop.name, value ) ); + } + if ( value !== this[ prop.private ] ) { + debug( 'Current value: %s. New value: %s.', this[ prop.private ], value ); + this[ prop.private ] = value; + this.emit( 'change', changeEvent( prop.name ) ); + } +} + + +// EXPORTS // + +module.exports = set; diff --git a/lib/node_modules/@stdlib/plot/vega/title/ctor/lib/subtitle/get.js b/lib/node_modules/@stdlib/plot/vega/title/ctor/lib/subtitle/get.js new file mode 100644 index 000000000000..350ca5902edc --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/title/ctor/lib/subtitle/get.js @@ -0,0 +1,44 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable no-invalid-this */ + +'use strict'; + +// MODULES // + +var copy = require( '@stdlib/array/base/copy-indexed' ); +var prop = require( './properties.js' ); + + +// MAIN // + +/** +* Returns the subtitle text. +* +* @private +* @returns {(Array<string>|void)} subtitle text +*/ +function get() { + return ( this[ prop.private ] ) ? copy( this[ prop.private ] ) : this[ prop.private ]; // eslint-disable-line max-len +} + + +// EXPORTS // + +module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/vega/title/ctor/lib/subtitle/properties.js b/lib/node_modules/@stdlib/plot/vega/title/ctor/lib/subtitle/properties.js new file mode 100644 index 000000000000..e822374c59f7 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/title/ctor/lib/subtitle/properties.js @@ -0,0 +1,33 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var property2object = require( '@stdlib/plot/vega/base/property2object' ); + + +// MAIN // + +var obj = property2object( 'subtitle' ); + + +// EXPORTS // + +module.exports = obj; diff --git a/lib/node_modules/@stdlib/plot/vega/title/ctor/lib/subtitle/set.js b/lib/node_modules/@stdlib/plot/vega/title/ctor/lib/subtitle/set.js new file mode 100644 index 000000000000..141c8273022b --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/title/ctor/lib/subtitle/set.js @@ -0,0 +1,97 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable no-invalid-this */ + +'use strict'; + +// MODULES // + +var logger = require( 'debug' ); +var isUndefined = require( '@stdlib/assert/is-undefined' ); +var isString = require( '@stdlib/assert/is-string' ).isPrimitive; +var isStringArray = require( '@stdlib/assert/is-string-array' ).primitives; +var hasEqualValues = require( '@stdlib/array/base/assert/has-equal-values' ); +var copy = require( '@stdlib/array/base/copy' ); +var join = require( '@stdlib/array/base/join' ); +var format = require( '@stdlib/string/format' ); +var changeEvent = require( './../change_event.js' ); +var prop = require( './properties.js' ); + + +// VARIABLES // + +var debug = logger( 'vega:title:set:'+prop.name ); + + +// MAIN // + +/** +* Sets the subtitle text. +* +* ## Notes +* +* - Providing `undefined` "unsets" the configured value. +* +* @private +* @param {(string|Array<string>|void)} value - input value +* @throws {TypeError} must be a string or an array of strings +* @returns {void} +*/ +function set( value ) { + var isVoid; + var isStr; + + isStr = isString( value ); + if ( !isStr ) { + isVoid = isUndefined( value ); + if ( !isVoid && !isStringArray( value ) ) { + throw new TypeError( format( 'invalid assignment. `%s` must be a string or an array of strings. Value: `%s`.', prop.name, value ) ); + } + } + if ( isVoid ) { + if ( value === this[ prop.private ] ) { + return; + } + debug( 'Current value: ["%s"]. New value: %s.', join( this[ prop.private ], '", "' ), value ); + this[ prop.private ] = value; + this.emit( 'change', changeEvent( prop.name ) ); + return; + } + if ( isStr ) { + value = [ value ]; + } else { + value = copy( value ); + } + if ( isUndefined( this[ prop.private ] ) ) { + debug( 'Current value: %s. New value: ["%s"].', this[ prop.private ], join( value, '", "' ) ); + this[ prop.private ] = value; + this.emit( 'change', changeEvent( prop.name ) ); + return; + } + if ( !hasEqualValues( value, this[ prop.private ] ) ) { + debug( 'Current value: ["%s"]. New value: ["%s"].', join( this[ prop.private ], '", "' ), join( value, '", "' ) ); + this[ prop.private ] = value; + this.emit( 'change', changeEvent( prop.name ) ); + } +} + + +// EXPORTS // + +module.exports = set; diff --git a/lib/node_modules/@stdlib/plot/vega/title/ctor/lib/text/get.js b/lib/node_modules/@stdlib/plot/vega/title/ctor/lib/text/get.js new file mode 100644 index 000000000000..c57e05869a83 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/title/ctor/lib/text/get.js @@ -0,0 +1,44 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable no-invalid-this */ + +'use strict'; + +// MODULES // + +var copy = require( '@stdlib/array/base/copy-indexed' ); +var prop = require( './properties.js' ); + + +// MAIN // + +/** +* Returns the title text. +* +* @private +* @returns {Array<string>} title text +*/ +function get() { + return copy( this[ prop.private ] ); +} + + +// EXPORTS // + +module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/vega/title/ctor/lib/text/properties.js b/lib/node_modules/@stdlib/plot/vega/title/ctor/lib/text/properties.js new file mode 100644 index 000000000000..504f4b3e3a6b --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/title/ctor/lib/text/properties.js @@ -0,0 +1,33 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var property2object = require( '@stdlib/plot/vega/base/property2object' ); + + +// MAIN // + +var obj = property2object( 'text' ); + + +// EXPORTS // + +module.exports = obj; diff --git a/lib/node_modules/@stdlib/plot/vega/title/ctor/lib/text/set.js b/lib/node_modules/@stdlib/plot/vega/title/ctor/lib/text/set.js new file mode 100644 index 000000000000..b65f067fb3bc --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/title/ctor/lib/text/set.js @@ -0,0 +1,72 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable no-invalid-this */ + +'use strict'; + +// MODULES // + +var logger = require( 'debug' ); +var isString = require( '@stdlib/assert/is-string' ).isPrimitive; +var isStringArray = require( '@stdlib/assert/is-string-array' ).primitives; +var isEmptyArrayLikeObject = require( '@stdlib/assert/is-empty-array-like-object' ); +var hasEqualValues = require( '@stdlib/array/base/assert/has-equal-values' ); +var copy = require( '@stdlib/array/base/copy' ); +var join = require( '@stdlib/array/base/join' ); +var format = require( '@stdlib/string/format' ); +var changeEvent = require( './../change_event.js' ); +var prop = require( './properties.js' ); + + +// VARIABLES // + +var debug = logger( 'vega:title:set:'+prop.name ); + + +// MAIN // + +/** +* Sets the title text. +* +* @private +* @param {(string|Array<string>)} value - input value +* @throws {TypeError} must be a string or an array of strings +* @returns {void} +*/ +function set( value ) { + var isStr = isString( value ); + if ( !isStr && !isStringArray( value ) && !isEmptyArrayLikeObject( value ) ) { // eslint-disable-line max-len + throw new TypeError( format( 'invalid assignment. `%s` must be a string or an array of strings. Value: `%s`.', prop.name, value ) ); + } + if ( isStr ) { + value = [ value ]; + } else { + value = copy( value ); + } + if ( !hasEqualValues( value, this[ prop.private ] ) ) { + debug( 'Current value: ["%s"]. New value: ["%s"].', join( this[ prop.private ], '", "' ), join( value, '", "' ) ); + this[ prop.private ] = value; + this.emit( 'change', changeEvent( prop.name ) ); + } +} + + +// EXPORTS // + +module.exports = set; diff --git a/lib/node_modules/@stdlib/plot/vega/title/ctor/lib/zindex/get.js b/lib/node_modules/@stdlib/plot/vega/title/ctor/lib/zindex/get.js new file mode 100644 index 000000000000..968764fcedba --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/title/ctor/lib/zindex/get.js @@ -0,0 +1,43 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable no-invalid-this */ + +'use strict'; + +// MODULES // + +var prop = require( './properties.js' ); + + +// MAIN // + +/** +* Returns the integer z-index indicating the layering of the title group relative to other axis, mark, and legend groups. +* +* @private +* @returns {number} z-index +*/ +function get() { + return this[ prop.private ]; +} + + +// EXPORTS // + +module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/vega/title/ctor/lib/zindex/properties.js b/lib/node_modules/@stdlib/plot/vega/title/ctor/lib/zindex/properties.js new file mode 100644 index 000000000000..4640b5d43e8c --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/title/ctor/lib/zindex/properties.js @@ -0,0 +1,33 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var property2object = require( '@stdlib/plot/vega/base/property2object' ); + + +// MAIN // + +var obj = property2object( 'zindex' ); + + +// EXPORTS // + +module.exports = obj; diff --git a/lib/node_modules/@stdlib/plot/vega/title/ctor/lib/zindex/set.js b/lib/node_modules/@stdlib/plot/vega/title/ctor/lib/zindex/set.js new file mode 100644 index 000000000000..fb4f09058236 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/title/ctor/lib/zindex/set.js @@ -0,0 +1,61 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable no-invalid-this */ + +'use strict'; + +// MODULES // + +var logger = require( 'debug' ); +var isNumber = require( '@stdlib/assert/is-number' ).isPrimitive; +var format = require( '@stdlib/string/format' ); +var changeEvent = require( './../change_event.js' ); +var prop = require( './properties.js' ); + + +// VARIABLES // + +var debug = logger( 'vega:title:set:'+prop.name ); + + +// MAIN // + +/** +* Sets the integer z-index indicating the layering of the title group relative to other axis, mark, and legend groups. +* +* @private +* @param {number} value - input value +* @throws {TypeError} must be a number +* @returns {void} +*/ +function set( value ) { + if ( !isNumber( value ) ) { + throw new TypeError( format( 'invalid assignment. `%s` must be a number. Value: `%s`.', prop.name, value ) ); + } + if ( value !== this[ prop.private ] ) { + debug( 'Current value: %s. New value: %s.', this[ prop.private ], value ); + this[ prop.private ] = value; + this.emit( 'change', changeEvent( prop.name ) ); + } +} + + +// EXPORTS // + +module.exports = set; diff --git a/lib/node_modules/@stdlib/plot/vega/title/ctor/package.json b/lib/node_modules/@stdlib/plot/vega/title/ctor/package.json new file mode 100644 index 000000000000..a4fd127841ae --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/title/ctor/package.json @@ -0,0 +1,60 @@ +{ + "name": "@stdlib/plot/vega/title/ctor", + "version": "0.0.0", + "description": "Title constructor.", + "license": "Apache-2.0", + "author": { + "name": "The Stdlib Authors", + "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" + }, + "contributors": [ + { + "name": "The Stdlib Authors", + "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" + } + ], + "main": "./lib", + "directories": { + "benchmark": "./benchmark", + "doc": "./docs", + "example": "./examples", + "lib": "./lib", + "test": "./test" + }, + "types": "./docs/types", + "scripts": {}, + "homepage": "https://github.com/stdlib-js/stdlib", + "repository": { + "type": "git", + "url": "git://github.com/stdlib-js/stdlib.git" + }, + "bugs": { + "url": "https://github.com/stdlib-js/stdlib/issues" + }, + "dependencies": {}, + "devDependencies": {}, + "engines": { + "node": ">=0.10.0", + "npm": ">2.7.0" + }, + "os": [ + "aix", + "darwin", + "freebsd", + "linux", + "macos", + "openbsd", + "sunos", + "win32", + "windows" + ], + "keywords": [ + "stdlib", + "plot", + "vega", + "title", + "constructor", + "ctor" + ], + "__stdlib__": {} +} diff --git a/lib/node_modules/@stdlib/plot/vega/title/orientations/README.md b/lib/node_modules/@stdlib/plot/vega/title/orientations/README.md new file mode 100644 index 000000000000..df8117abc216 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/title/orientations/README.md @@ -0,0 +1,117 @@ +<!-- + +@license Apache-2.0 + +Copyright (c) 2025 The Stdlib Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + +--> + +# titleOrientations + +> List of supported Vega title orientations. + +<!-- Section to include introductory text. Make sure to keep an empty line after the intro `section` element and another before the `/section` close. --> + +<section class="intro"> + +</section> + +<!-- /.intro --> + +<!-- Package usage documentation. --> + +<section class="usage"> + +## Usage + +```javascript +var titleOrientations = require( '@stdlib/plot/vega/title/orientations' ); +``` + +#### titleOrientations() + +Returns a list of title orientations. + +```javascript +var out = titleOrientations(); +// returns [ 'left', 'right', 'top', 'bottom' ] +``` + +</section> + +<!-- /.usage --> + +<!-- Package usage notes. Make sure to keep an empty line after the `section` element and another before the `/section` close. --> + +<section class="notes"> + +</section> + +<!-- /.notes --> + +<!-- Package usage examples. --> + +<section class="examples"> + +## Examples + +<!-- eslint no-undef: "error" --> + +```javascript +var contains = require( '@stdlib/array/base/assert/contains' ).factory; +var titleOrientations = require( '@stdlib/plot/vega/title/orientations' ); + +var isTitleOrientation = contains( titleOrientations() ); + +var bool = isTitleOrientation( 'right' ); +// returns true + +bool = isTitleOrientation( 'top' ); +// returns true + +bool = isTitleOrientation( 'beep' ); +// returns false + +bool = isTitleOrientation( 'boop' ); +// returns false +``` + +</section> + +<!-- /.examples --> + +<!-- Section to include cited references. If references are included, add a horizontal rule *before* the section. Make sure to keep an empty line after the `section` element and another before the `/section` close. --> + +<section class="references"> + +</section> + +<!-- /.references --> + +<!-- Section for related `stdlib` packages. Do not manually edit this section, as it is automatically populated. --> + +<section class="related"> + +</section> + +<!-- /.related --> + +<!-- Section for all links. Make sure to keep an empty line after the `section` element and another before the `/section` close. --> + +<section class="links"> + +</section> + +<!-- /.links --> diff --git a/lib/node_modules/@stdlib/plot/vega/title/orientations/benchmark/benchmark.js b/lib/node_modules/@stdlib/plot/vega/title/orientations/benchmark/benchmark.js new file mode 100644 index 000000000000..b466014ce555 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/title/orientations/benchmark/benchmark.js @@ -0,0 +1,48 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var bench = require( '@stdlib/bench' ); +var isStringArray = require( '@stdlib/assert/is-string-array' ).primitives; +var pkg = require( './../package.json' ).name; +var titleOrientations = require( './../lib' ); + + +// MAIN // + +bench( pkg, function benchmark( b ) { + var out; + var i; + + b.tic(); + for ( i = 0; i < b.iterations; i++ ) { + out = titleOrientations(); + if ( out.length < 2 ) { + b.fail( 'should return an array' ); + } + } + b.toc(); + if ( !isStringArray( out ) ) { + b.fail( 'should return an array of strings' ); + } + b.pass( 'benchmark finished' ); + b.end(); +}); diff --git a/lib/node_modules/@stdlib/plot/vega/title/orientations/docs/repl.txt b/lib/node_modules/@stdlib/plot/vega/title/orientations/docs/repl.txt new file mode 100644 index 000000000000..5f221f62b2b6 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/title/orientations/docs/repl.txt @@ -0,0 +1,17 @@ + +{{alias}}() + Returns a list of title orientations. + + Returns + ------- + out: Array<string> + List of title orientations. + + Examples + -------- + > var out = {{alias}}() + [ 'left', 'right', 'top', 'bottom' ] + + See Also + -------- + diff --git a/lib/node_modules/@stdlib/plot/vega/title/orientations/docs/types/index.d.ts b/lib/node_modules/@stdlib/plot/vega/title/orientations/docs/types/index.d.ts new file mode 100644 index 000000000000..f736b08ed0f0 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/title/orientations/docs/types/index.d.ts @@ -0,0 +1,35 @@ +/* +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +// TypeScript Version: 4.1 + +/** +* Returns a list of title orientations. +* +* @returns list of title orientations +* +* @example +* var list = titleOrientations(); +* // returns [ 'left', 'right', 'top', 'bottom' ] +*/ +declare function titleOrientations(): Array<string>; + + +// EXPORTS // + +export = titleOrientations; diff --git a/lib/node_modules/@stdlib/plot/vega/title/orientations/docs/types/test.ts b/lib/node_modules/@stdlib/plot/vega/title/orientations/docs/types/test.ts new file mode 100644 index 000000000000..aa3b02a38a25 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/title/orientations/docs/types/test.ts @@ -0,0 +1,32 @@ +/* +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +import titleOrientations = require( './index' ); + + +// TESTS // + +// The function returns an array of strings... +{ + titleOrientations(); // $ExpectType string[] +} + +// The compiler throws an error if the function is provided any arguments... +{ + titleOrientations( 9 ); // $ExpectError +} diff --git a/lib/node_modules/@stdlib/plot/vega/title/orientations/examples/index.js b/lib/node_modules/@stdlib/plot/vega/title/orientations/examples/index.js new file mode 100644 index 000000000000..e37116a83595 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/title/orientations/examples/index.js @@ -0,0 +1,40 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +var contains = require( '@stdlib/array/base/assert/contains' ).factory; +var titleOrientations = require( './../lib' ); + +var isTitleOrientation = contains( titleOrientations() ); + +var bool = isTitleOrientation( 'right' ); +console.log( bool ); +// => true + +bool = isTitleOrientation( 'top' ); +console.log( bool ); +// => true + +bool = isTitleOrientation( 'beep' ); +console.log( bool ); +// => false + +bool = isTitleOrientation( 'boop' ); +console.log( bool ); +// => false diff --git a/lib/node_modules/@stdlib/plot/vega/title/orientations/lib/data.json b/lib/node_modules/@stdlib/plot/vega/title/orientations/lib/data.json new file mode 100644 index 000000000000..d4d3e778b2ba --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/title/orientations/lib/data.json @@ -0,0 +1,6 @@ +[ + "left", + "right", + "top", + "bottom" +] diff --git a/lib/node_modules/@stdlib/plot/vega/title/orientations/lib/index.js b/lib/node_modules/@stdlib/plot/vega/title/orientations/lib/index.js new file mode 100644 index 000000000000..213e95f1f1f3 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/title/orientations/lib/index.js @@ -0,0 +1,40 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +/** +* Return a list of title orientations. +* +* @module @stdlib/plot/vega/title/orientations +* +* @example +* var titleOrientations = require( '@stdlib/plot/vega/title/orientations' ); +* +* var out = titleOrientations(); +* // returns [ 'left', 'right', 'top', 'bottom' ] +*/ + +// MODULES // + +var main = require( './main.js' ); + + +// EXPORTS // + +module.exports = main; diff --git a/lib/node_modules/@stdlib/plot/vega/title/orientations/lib/main.js b/lib/node_modules/@stdlib/plot/vega/title/orientations/lib/main.js new file mode 100644 index 000000000000..c88316dbb900 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/title/orientations/lib/main.js @@ -0,0 +1,44 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var DATA = require( './data.json' ); + + +// MAIN // + +/** +* Returns a list of title orientations. +* +* @returns {StringArray} list of title orientations +* +* @example +* var out = orientations(); +* // returns [ 'left', 'right', 'top', 'bottom' ] +*/ +function orientations() { + return DATA.slice(); +} + + +// EXPORTS // + +module.exports = orientations; diff --git a/lib/node_modules/@stdlib/plot/vega/title/orientations/package.json b/lib/node_modules/@stdlib/plot/vega/title/orientations/package.json new file mode 100644 index 000000000000..e0ef99826ecb --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/title/orientations/package.json @@ -0,0 +1,64 @@ +{ + "name": "@stdlib/plot/vega/title/orientations", + "version": "0.0.0", + "description": "List of supported Vega title orientations.", + "license": "Apache-2.0", + "author": { + "name": "The Stdlib Authors", + "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" + }, + "contributors": [ + { + "name": "The Stdlib Authors", + "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" + } + ], + "main": "./lib", + "directories": { + "benchmark": "./benchmark", + "doc": "./docs", + "example": "./examples", + "lib": "./lib", + "test": "./test" + }, + "types": "./docs/types", + "scripts": {}, + "homepage": "https://github.com/stdlib-js/stdlib", + "repository": { + "type": "git", + "url": "git://github.com/stdlib-js/stdlib.git" + }, + "bugs": { + "url": "https://github.com/stdlib-js/stdlib/issues" + }, + "dependencies": {}, + "devDependencies": {}, + "engines": { + "node": ">=0.10.0", + "npm": ">2.7.0" + }, + "os": [ + "aix", + "darwin", + "freebsd", + "linux", + "macos", + "openbsd", + "sunos", + "win32", + "windows" + ], + "keywords": [ + "stdlib", + "plot", + "vega", + "title", + "orient", + "orientations", + "utilities", + "utility", + "utils", + "util" + ], + "__stdlib__": {} +} diff --git a/lib/node_modules/@stdlib/plot/vega/title/orientations/test/test.js b/lib/node_modules/@stdlib/plot/vega/title/orientations/test/test.js new file mode 100644 index 000000000000..51c38292dee0 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/title/orientations/test/test.js @@ -0,0 +1,49 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var tape = require( 'tape' ); +var titleOrientations = require( './../lib' ); + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof titleOrientations, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'the function returns a list of title orientations', function test( t ) { + var expected; + var actual; + + expected = [ + 'left', + 'right', + 'top', + 'bottom' + ]; + actual = titleOrientations(); + + t.deepEqual( actual, expected, 'returns expected value' ); + t.end(); +}); diff --git a/lib/node_modules/@stdlib/plot/vega/trigger/base/ctor/examples/index.js b/lib/node_modules/@stdlib/plot/vega/trigger/base/ctor/examples/index.js new file mode 100644 index 000000000000..2b6d73493cf2 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/trigger/base/ctor/examples/index.js @@ -0,0 +1,27 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +var Trigger = require( './../lib' ); + +var trigger = new Trigger({ + 'trigger': '!shift' +}); + +console.log( trigger.toJSON() ); diff --git a/lib/node_modules/@stdlib/plot/vega/trigger/base/ctor/lib/change_event.js b/lib/node_modules/@stdlib/plot/vega/trigger/base/ctor/lib/change_event.js new file mode 100644 index 000000000000..d9c8c1f845fa --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/trigger/base/ctor/lib/change_event.js @@ -0,0 +1,41 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MAIN // + +/** +* Returns a new change event object. +* +* @private +* @param {string} property - property name +* @returns {Object} event object +*/ +function event( property ) { // eslint-disable-line stdlib/no-redeclare + return { + 'type': 'update', + 'source': 'trigger', + 'property': property + }; +} + + +// EXPORTS // + +module.exports = event; diff --git a/lib/node_modules/@stdlib/plot/vega/trigger/base/ctor/lib/index.js b/lib/node_modules/@stdlib/plot/vega/trigger/base/ctor/lib/index.js new file mode 100644 index 000000000000..36d97e7dcbd6 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/trigger/base/ctor/lib/index.js @@ -0,0 +1,42 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +/** +* Trigger constructor. +* +* @module @stdlib/plot/vega/trigger/base/ctor +* +* @example +* var Trigger = require( '@stdlib/plot/vega/trigger/base/ctor' ); +* +* var trigger = new Trigger({ +* 'trigger': '!shift' +* }); +* // returns <Trigger> +*/ + +// MODULES // + +var main = require( './main.js' ); + + +// EXPORTS // + +module.exports = main; diff --git a/lib/node_modules/@stdlib/plot/vega/trigger/base/ctor/lib/main.js b/lib/node_modules/@stdlib/plot/vega/trigger/base/ctor/lib/main.js new file mode 100644 index 000000000000..6231971cc162 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/trigger/base/ctor/lib/main.js @@ -0,0 +1,207 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable no-restricted-syntax, no-invalid-this */ + +'use strict'; + +// MODULES // + +var EventEmitter = require( 'events' ).EventEmitter; +var logger = require( 'debug' ); +var isObject = require( '@stdlib/assert/is-object' ); +var setNonEnumerableReadOnly = require( '@stdlib/utils/define-nonenumerable-read-only-property' ); +var setReadWriteAccessor = require( '@stdlib/utils/define-read-write-accessor' ); +var hasProp = require( '@stdlib/assert/has-property' ); +var inherit = require( '@stdlib/utils/inherit' ); +var transformErrorMessage = require( '@stdlib/plot/vega/base/transform-validation-message' ); +var instance2json = require( '@stdlib/plot/vega/base/to-json' ); +var format = require( '@stdlib/string/format' ); +var properties = require( './properties.json' ); + +// Note: keep the following in alphabetical order according to the `require` path... +var getModify = require( './modify/get.js' ); +var setModify = require( './modify/set.js' ); + +var getTrigger = require( './trigger/get.js' ); +var setTrigger = require( './trigger/set.js' ); + +var getValues = require( './values/get.js' ); +var setValues = require( './values/set.js' ); + + +// VARIABLES // + +var debug = logger( 'vega:trigger:main' ); + + +// MAIN // + +/** +* Trigger constructor. +* +* @constructor +* @param {Options} options - constructor options +* @param {string} options.trigger - trigger condition +* @param {string} [options.modify] - expression which returns data objects to modify +* @param {string} [options.values] - expression which returns the field values which should be updated for the data objects returned by the modify expression +* @throws {TypeError} options argument must be an object +* @throws {Error} must provide valid options +* @returns {Trigger} trigger instance +* +* @example +* var trigger = new Trigger({ +* 'trigger': '!shift' +* }); +* // returns <Trigger> +*/ +function Trigger( options ) { + var v; + var k; + var i; + if ( !( this instanceof Trigger ) ) { + return new Trigger( options ); + } + EventEmitter.call( this ); + if ( !isObject( options ) ) { + throw new TypeError( format( 'invalid argument. Options argument must be an object. Value: `%s`.', options ) ); + } + // Check for required properties... + if ( !hasProp( options, 'trigger' ) ) { + throw new TypeError( 'invalid argument. Options argument must specify the trigger condition.' ); + } + // Validate provided options by attempting to assign option values to corresponding fields... + for ( i = 0; i < properties.length; i++ ) { + k = properties[ i ]; + if ( !hasProp( options, k ) ) { + continue; + } + v = options[ k ]; + try { + this[ k ] = v; + } catch ( err ) { + debug( 'Encountered an error. Error: %s', err.message ); + + // FIXME: retain thrown error type + throw new Error( transformErrorMessage( err.message ) ); + } + } + return this; +} + +/* +* Inherit from the `EventEmitter` prototype. +*/ +inherit( Trigger, EventEmitter ); + +/** +* Constructor name. +* +* @private +* @name name +* @memberof Trigger +* @readonly +* @type {string} +*/ +setNonEnumerableReadOnly( Trigger, 'name', 'Trigger' ); + +/** +* Expression which returns data objects to modify. +* +* @name modify +* @memberof Trigger.prototype +* @type {(string|void)} +* +* @example +* var trigger = new Trigger({ +* 'trigger': '!shift', +* 'modify': 'dragged' +* }); +* +* var v = trigger.modify; +* // returns 'dragged' +*/ +setReadWriteAccessor( Trigger.prototype, 'modify', getModify, setModify ); + +/** +* Trigger name. +* +* @name trigger +* @memberof Trigger.prototype +* @type {string} +* +* @example +* var trigger = new Trigger({ +* 'trigger': '!shift' +* }); +* +* var v = trigger.trigger; +* // returns '!shift' +*/ +setReadWriteAccessor( Trigger.prototype, 'trigger', getTrigger, setTrigger ); + +/** +* Expression which returns the field values which should be updated for the data objects returned by the modify expression. +* +* @name values +* @memberof Trigger.prototype +* @type {(string|void)} +* +* @example +* var trigger = new Trigger({ +* 'trigger': '!shift', +* 'values': '{fx: x(), fy: y()}' +* }); +* +* var v = trigger.values; +* // returns '{fx: x(), fy: y()}' +*/ +setReadWriteAccessor( Trigger.prototype, 'values', getValues, setValues ); + +/** +* Serializes an instance to a JSON object. +* +* ## Notes +* +* - This method is implicitly invoked by `JSON.stringify`. +* +* @name toJSON +* @memberof Trigger.prototype +* @type {Function} +* @throws {Error} invalid configuration +* @returns {Object} JSON object +* +* @example +* var trigger = new Trigger({ +* 'trigger': '!shift' +* }); +* +* var v = trigger.toJSON(); +* // returns {...} +*/ +setNonEnumerableReadOnly( Trigger.prototype, 'toJSON', function toJSON() { + if ( this._modify && !this._values ) { + throw new Error( 'invalid operation. Current configuration is invalid. A trigger having a `modify` expression must also have a `values` expression.' ); + } + return instance2json( this, properties ); +}); + + +// EXPORTS // + +module.exports = Trigger; diff --git a/lib/node_modules/@stdlib/plot/vega/trigger/base/ctor/lib/modify/get.js b/lib/node_modules/@stdlib/plot/vega/trigger/base/ctor/lib/modify/get.js new file mode 100644 index 000000000000..a4aecb6f8967 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/trigger/base/ctor/lib/modify/get.js @@ -0,0 +1,43 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable no-invalid-this */ + +'use strict'; + +// MODULES // + +var prop = require( './properties.js' ); + + +// MAIN // + +/** +* Returns an expression which returns one or more data objects to modify. +* +* @private +* @returns {(string|void)} expression +*/ +function get() { + return this[ prop.private ]; +} + + +// EXPORTS // + +module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/vega/trigger/base/ctor/lib/modify/properties.js b/lib/node_modules/@stdlib/plot/vega/trigger/base/ctor/lib/modify/properties.js new file mode 100644 index 000000000000..618d150d39f4 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/trigger/base/ctor/lib/modify/properties.js @@ -0,0 +1,33 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var property2object = require( '@stdlib/plot/vega/base/property2object' ); + + +// MAIN // + +var obj = property2object( 'modify' ); + + +// EXPORTS // + +module.exports = obj; diff --git a/lib/node_modules/@stdlib/plot/vega/trigger/base/ctor/lib/modify/set.js b/lib/node_modules/@stdlib/plot/vega/trigger/base/ctor/lib/modify/set.js new file mode 100644 index 000000000000..699d94672ab7 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/trigger/base/ctor/lib/modify/set.js @@ -0,0 +1,66 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable no-invalid-this */ + +'use strict'; + +// MODULES // + +var logger = require( 'debug' ); +var isString = require( '@stdlib/assert/is-string' ).isPrimitive; +var isUndefined = require( '@stdlib/assert/is-undefined' ); +var format = require( '@stdlib/string/format' ); +var changeEvent = require( './../change_event.js' ); +var prop = require( './properties.js' ); + + +// VARIABLES // + +var debug = logger( 'vega:trigger:set:'+prop.name ); + + +// MAIN // + +/** +* Sets an expression which returns one or more data objects to modify. +* +* ## Notes +* +* - Providing `undefined` "unsets" the configured value. +* +* @private +* @param {(string|void)} value - input value +* @throws {TypeError} must be a string +* @returns {void} +*/ +function set( value ) { + if ( !isString( value ) && !isUndefined( value ) ) { + throw new TypeError( format( 'invalid assignment. `%s` must be a string. Value: `%s`.', prop.name, value ) ); + } + if ( value !== this[ prop.private ] ) { + debug( 'Current value: %s. New value: %s.', this[ prop.private ], value ); + this[ prop.private ] = value; + this.emit( 'change', changeEvent( prop.name ) ); + } +} + + +// EXPORTS // + +module.exports = set; diff --git a/lib/node_modules/@stdlib/plot/vega/trigger/base/ctor/lib/properties.json b/lib/node_modules/@stdlib/plot/vega/trigger/base/ctor/lib/properties.json new file mode 100644 index 000000000000..f43375d73001 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/trigger/base/ctor/lib/properties.json @@ -0,0 +1,5 @@ +[ + "modify", + "trigger", + "values" +] diff --git a/lib/node_modules/@stdlib/plot/vega/trigger/base/ctor/lib/trigger/get.js b/lib/node_modules/@stdlib/plot/vega/trigger/base/ctor/lib/trigger/get.js new file mode 100644 index 000000000000..a0e6b9bc0eeb --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/trigger/base/ctor/lib/trigger/get.js @@ -0,0 +1,43 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable no-invalid-this */ + +'use strict'; + +// MODULES // + +var prop = require( './properties.js' ); + + +// MAIN // + +/** +* Returns the trigger condition. +* +* @private +* @returns {string} trigger condition +*/ +function get() { + return this[ prop.private ]; +} + + +// EXPORTS // + +module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/vega/trigger/base/ctor/lib/trigger/properties.js b/lib/node_modules/@stdlib/plot/vega/trigger/base/ctor/lib/trigger/properties.js new file mode 100644 index 000000000000..f5bab02ff779 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/trigger/base/ctor/lib/trigger/properties.js @@ -0,0 +1,33 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var property2object = require( '@stdlib/plot/vega/base/property2object' ); + + +// MAIN // + +var obj = property2object( 'trigger' ); + + +// EXPORTS // + +module.exports = obj; diff --git a/lib/node_modules/@stdlib/plot/vega/trigger/base/ctor/lib/trigger/set.js b/lib/node_modules/@stdlib/plot/vega/trigger/base/ctor/lib/trigger/set.js new file mode 100644 index 000000000000..9c34161e39b2 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/trigger/base/ctor/lib/trigger/set.js @@ -0,0 +1,61 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable no-invalid-this */ + +'use strict'; + +// MODULES // + +var logger = require( 'debug' ); +var isString = require( '@stdlib/assert/is-string' ).isPrimitive; +var format = require( '@stdlib/string/format' ); +var changeEvent = require( './../change_event.js' ); +var prop = require( './properties.js' ); + + +// VARIABLES // + +var debug = logger( 'vega:trigger:set:'+prop.name ); + + +// MAIN // + +/** +* Sets the trigger condition. +* +* @private +* @param {string} value - input value +* @throws {TypeError} must be a string +* @returns {void} +*/ +function set( value ) { + if ( !isString( value ) ) { + throw new TypeError( format( 'invalid assignment. `%s` must be a string. Value: `%s`.', prop.name, value ) ); + } + if ( value !== this[ prop.private ] ) { + debug( 'Current value: %s. New value: %s.', this[ prop.private ], value ); + this[ prop.private ] = value; + this.emit( 'change', changeEvent( prop.name ) ); + } +} + + +// EXPORTS // + +module.exports = set; diff --git a/lib/node_modules/@stdlib/plot/vega/trigger/base/ctor/lib/values/get.js b/lib/node_modules/@stdlib/plot/vega/trigger/base/ctor/lib/values/get.js new file mode 100644 index 000000000000..62217213b5c7 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/trigger/base/ctor/lib/values/get.js @@ -0,0 +1,43 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable no-invalid-this */ + +'use strict'; + +// MODULES // + +var prop = require( './properties.js' ); + + +// MAIN // + +/** +* Returns an expression which returns the field values which should be updated for the data objects returned by the modify expression. +* +* @private +* @returns {(string|void)} expression +*/ +function get() { + return this[ prop.private ]; +} + + +// EXPORTS // + +module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/vega/trigger/base/ctor/lib/values/properties.js b/lib/node_modules/@stdlib/plot/vega/trigger/base/ctor/lib/values/properties.js new file mode 100644 index 000000000000..518d28563e40 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/trigger/base/ctor/lib/values/properties.js @@ -0,0 +1,33 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var property2object = require( '@stdlib/plot/vega/base/property2object' ); + + +// MAIN // + +var obj = property2object( 'values' ); + + +// EXPORTS // + +module.exports = obj; diff --git a/lib/node_modules/@stdlib/plot/vega/trigger/base/ctor/lib/values/set.js b/lib/node_modules/@stdlib/plot/vega/trigger/base/ctor/lib/values/set.js new file mode 100644 index 000000000000..06c94ef104fa --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/trigger/base/ctor/lib/values/set.js @@ -0,0 +1,66 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable no-invalid-this */ + +'use strict'; + +// MODULES // + +var logger = require( 'debug' ); +var isString = require( '@stdlib/assert/is-string' ).isPrimitive; +var isUndefined = require( '@stdlib/assert/is-undefined' ); +var format = require( '@stdlib/string/format' ); +var changeEvent = require( './../change_event.js' ); +var prop = require( './properties.js' ); + + +// VARIABLES // + +var debug = logger( 'vega:trigger:set:'+prop.name ); + + +// MAIN // + +/** +* Sets an expression which returns the field values which should be updated for the data objects returned by the modify expression. +* +* ## Notes +* +* - Providing `undefined` "unsets" the configured value. +* +* @private +* @param {(string|void)} value - input value +* @throws {TypeError} must be a string +* @returns {void} +*/ +function set( value ) { + if ( !isString( value ) && !isUndefined( value ) ) { + throw new TypeError( format( 'invalid assignment. `%s` must be a string. Value: `%s`.', prop.name, value ) ); + } + if ( value !== this[ prop.private ] ) { + debug( 'Current value: %s. New value: %s.', this[ prop.private ], value ); + this[ prop.private ] = value; + this.emit( 'change', changeEvent( prop.name ) ); + } +} + + +// EXPORTS // + +module.exports = set; diff --git a/lib/node_modules/@stdlib/plot/vega/trigger/base/ctor/package.json b/lib/node_modules/@stdlib/plot/vega/trigger/base/ctor/package.json new file mode 100644 index 000000000000..9c9faca1c400 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/trigger/base/ctor/package.json @@ -0,0 +1,60 @@ +{ + "name": "@stdlib/plot/vega/trigger/base/ctor", + "version": "0.0.0", + "description": "Trigger constructor.", + "license": "Apache-2.0", + "author": { + "name": "The Stdlib Authors", + "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" + }, + "contributors": [ + { + "name": "The Stdlib Authors", + "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" + } + ], + "main": "./lib", + "directories": { + "benchmark": "./benchmark", + "doc": "./docs", + "example": "./examples", + "lib": "./lib", + "test": "./test" + }, + "types": "./docs/types", + "scripts": {}, + "homepage": "https://github.com/stdlib-js/stdlib", + "repository": { + "type": "git", + "url": "git://github.com/stdlib-js/stdlib.git" + }, + "bugs": { + "url": "https://github.com/stdlib-js/stdlib/issues" + }, + "dependencies": {}, + "devDependencies": {}, + "engines": { + "node": ">=0.10.0", + "npm": ">2.7.0" + }, + "os": [ + "aix", + "darwin", + "freebsd", + "linux", + "macos", + "openbsd", + "sunos", + "win32", + "windows" + ], + "keywords": [ + "stdlib", + "plot", + "vega", + "trigger", + "constructor", + "ctor" + ], + "__stdlib__": {} +} diff --git a/lib/node_modules/@stdlib/plot/vega/vendored/lib/index.js b/lib/node_modules/@stdlib/plot/vega/vendored/lib/index.js new file mode 100644 index 000000000000..ad51c0e6f301 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/vendored/lib/index.js @@ -0,0 +1,39 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +/** +* Vendored Vega. +* +* @module @stdlib/plot/vega/vendored +* +* @example +* var vega = require( '@stdlib/plot/vega/vendored' ); +* +* // TODO +*/ + +// MODULES // + +var main = require( './main.js' ); + + +// EXPORTS // + +module.exports = main; diff --git a/lib/node_modules/@stdlib/plot/vega/vendored/lib/main.js b/lib/node_modules/@stdlib/plot/vega/vendored/lib/main.js new file mode 100644 index 000000000000..d779835ec7af --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/vendored/lib/main.js @@ -0,0 +1,4199 @@ +/* eslint-disable */ + +/* editorconfig-checker-disable-file */ + +"use strict";var _templateObject,_templateObject2,_templateObject3,_templateObject4,_templateObject5,_templateObject6,_templateObject7,_templateObject8,_templateObject9,_templateObject0,_templateObject1,_templateObject10,_templateObject11,_templateObject12,_templateObject13,_templateObject14,_templateObject15,_templateObject16;function ownKeys(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);r&&(o=o.filter(function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable;})),t.push.apply(t,o);}return t;}function _objectSpread(e){for(var r=1;r<arguments.length;r++){var t=null!=arguments[r]?arguments[r]:{};r%2?ownKeys(Object(t),!0).forEach(function(r){_defineProperty(e,r,t[r]);}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):ownKeys(Object(t)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r));});}return e;}function _readOnlyError(r){throw new TypeError('"'+r+'" is read-only');}function _taggedTemplateLiteral(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}));}function _toConsumableArray(r){return _arrayWithoutHoles(r)||_iterableToArray(r)||_unsupportedIterableToArray(r)||_nonIterableSpread();}function _nonIterableSpread(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");}function _iterableToArray(r){if("undefined"!=typeof Symbol&&null!=r[Symbol.iterator]||null!=r["@@iterator"])return Array.from(r);}function _arrayWithoutHoles(r){if(Array.isArray(r))return _arrayLikeToArray(r);}function asyncGeneratorStep(n,t,e,r,o,a,c){try{var i=n[a](c),u=i.value;}catch(n){return void e(n);}i.done?t(u):Promise.resolve(u).then(r,o);}function _asyncToGenerator(n){return function(){var t=this,e=arguments;return new Promise(function(r,o){var a=n.apply(t,e);function _next(n){asyncGeneratorStep(a,r,o,_next,_throw,"next",n);}function _throw(n){asyncGeneratorStep(a,r,o,_next,_throw,"throw",n);}_next(void 0);});};}function _defineProperty(e,r,t){return(r=_toPropertyKey(r))in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e;}function _regeneratorValues(e){if(null!=e){var t=e["function"==typeof Symbol&&Symbol.iterator||"@@iterator"],r=0;if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length))return{next:function next(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e};}};}throw new TypeError(_typeof(e)+" is not iterable");}function _slicedToArray(r,e){return _arrayWithHoles(r)||_iterableToArrayLimit(r,e)||_unsupportedIterableToArray(r,e)||_nonIterableRest();}function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");}function _iterableToArrayLimit(r,l){var t=null==r?null:"undefined"!=typeof Symbol&&r[Symbol.iterator]||r["@@iterator"];if(null!=t){var e,n,i,u,a=[],f=!0,o=!1;try{if(i=(t=t.call(r)).next,0===l){if(Object(t)!==t)return;f=!1;}else for(;!(f=(e=i.call(t)).done)&&(a.push(e.value),a.length!==l);f=!0);}catch(r){o=!0,n=r;}finally{try{if(!f&&null!=t["return"]&&(u=t["return"](),Object(u)!==u))return;}finally{if(o)throw n;}}return a;}}function _arrayWithHoles(r){if(Array.isArray(r))return r;}function _callSuper(t,o,e){return o=_getPrototypeOf(o),_possibleConstructorReturn(t,_isNativeReflectConstruct()?Reflect.construct(o,e||[],_getPrototypeOf(t).constructor):o.apply(t,e));}function _possibleConstructorReturn(t,e){if(e&&("object"==_typeof(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return _assertThisInitialized(t);}function _assertThisInitialized(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e;}function _superPropGet(t,o,e,r){var p=_get3(_getPrototypeOf(1&r?t.prototype:t),o,e);return 2&r&&"function"==typeof p?function(t){return p.apply(e,t);}:p;}function _get3(){return _get3="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(e,t,r){var p=_superPropBase(e,t);if(p){var n=Object.getOwnPropertyDescriptor(p,t);return n.get?n.get.call(arguments.length<3?e:r):n.value;}},_get3.apply(null,arguments);}function _superPropBase(t,o){for(;!{}.hasOwnProperty.call(t,o)&&null!==(t=_getPrototypeOf(t)););return t;}function _inherits(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&_setPrototypeOf(t,e);}function _wrapNativeSuper(t){var r="function"==typeof Map?new Map():void 0;return _wrapNativeSuper=function _wrapNativeSuper(t){if(null===t||!_isNativeFunction(t))return t;if("function"!=typeof t)throw new TypeError("Super expression must either be null or a function");if(void 0!==r){if(r.has(t))return r.get(t);r.set(t,Wrapper);}function Wrapper(){return _construct(t,arguments,_getPrototypeOf(this).constructor);}return Wrapper.prototype=Object.create(t.prototype,{constructor:{value:Wrapper,enumerable:!1,writable:!0,configurable:!0}}),_setPrototypeOf(Wrapper,t);},_wrapNativeSuper(t);}function _construct(t,e,r){if(_isNativeReflectConstruct())return Reflect.construct.apply(null,arguments);var o=[null];o.push.apply(o,e);var p=new(t.bind.apply(t,o))();return r&&_setPrototypeOf(p,r.prototype),p;}function _isNativeReflectConstruct(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}));}catch(t){}return(_isNativeReflectConstruct=function _isNativeReflectConstruct(){return!!t;})();}function _isNativeFunction(t){try{return-1!==Function.toString.call(t).indexOf("[native code]");}catch(n){return"function"==typeof t;}}function _setPrototypeOf(t,e){return _setPrototypeOf=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t;},_setPrototypeOf(t,e);}function _getPrototypeOf(t){return _getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t);},_getPrototypeOf(t);}function _classCallCheck(a,n){if(!(a instanceof n))throw new TypeError("Cannot call a class as a function");}function _defineProperties(e,r){for(var t=0;t<r.length;t++){var o=r[t];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,_toPropertyKey(o.key),o);}}function _createClass(e,r,t){return r&&_defineProperties(e.prototype,r),t&&_defineProperties(e,t),Object.defineProperty(e,"prototype",{writable:!1}),e;}function _toPropertyKey(t){var i=_toPrimitive(t,"string");return"symbol"==_typeof(i)?i:i+"";}function _toPrimitive(t,r){if("object"!=_typeof(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var i=e.call(t,r||"default");if("object"!=_typeof(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.");}return("string"===r?String:Number)(t);}function _regenerator(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */var e,t,r="function"==typeof Symbol?Symbol:{},n=r.iterator||"@@iterator",o=r.toStringTag||"@@toStringTag";function i(r,n,o,i){var c=n&&n.prototype instanceof Generator?n:Generator,u=Object.create(c.prototype);return _regeneratorDefine2(u,"_invoke",function(r,n,o){var i,c,u,f=0,p=o||[],y=!1,G={p:0,n:0,v:e,a:d,f:d.bind(e,4),d:function d(t,r){return i=t,c=0,u=e,G.n=r,a;}};function d(r,n){for(c=r,u=n,t=0;!y&&f&&!o&&t<p.length;t++){var o,i=p[t],d=G.p,l=i[2];r>3?(o=l===n)&&(u=i[(c=i[4])?5:(c=3,3)],i[4]=i[5]=e):i[0]<=d&&((o=r<2&&d<i[1])?(c=0,G.v=n,G.n=i[1]):d<l&&(o=r<3||i[0]>n||n>l)&&(i[4]=r,i[5]=n,G.n=l,c=0));}if(o||r>1)return a;throw y=!0,n;}return function(o,p,l){if(f>1)throw TypeError("Generator is already running");for(y&&1===p&&d(p,l),c=p,u=l;(t=c<2?e:u)||!y;){i||(c?c<3?(c>1&&(G.n=-1),d(c,u)):G.n=u:G.v=u);try{if(f=2,i){if(c||(o="next"),t=i[o]){if(!(t=t.call(i,u)))throw TypeError("iterator result is not an object");if(!t.done)return t;u=t.value,c<2&&(c=0);}else 1===c&&(t=i["return"])&&t.call(i),c<2&&(u=TypeError("The iterator does not provide a '"+o+"' method"),c=1);i=e;}else if((t=(y=G.n<0)?u:r.call(n,G))!==a)break;}catch(t){i=e,c=1,u=t;}finally{f=1;}}return{value:t,done:y};};}(r,o,i),!0),u;}var a={};function Generator(){}function GeneratorFunction(){}function GeneratorFunctionPrototype(){}t=Object.getPrototypeOf;var c=[][n]?t(t([][n]())):(_regeneratorDefine2(t={},n,function(){return this;}),t),u=GeneratorFunctionPrototype.prototype=Generator.prototype=Object.create(c);function f(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,GeneratorFunctionPrototype):(e.__proto__=GeneratorFunctionPrototype,_regeneratorDefine2(e,o,"GeneratorFunction")),e.prototype=Object.create(u),e;}return GeneratorFunction.prototype=GeneratorFunctionPrototype,_regeneratorDefine2(u,"constructor",GeneratorFunctionPrototype),_regeneratorDefine2(GeneratorFunctionPrototype,"constructor",GeneratorFunction),GeneratorFunction.displayName="GeneratorFunction",_regeneratorDefine2(GeneratorFunctionPrototype,o,"GeneratorFunction"),_regeneratorDefine2(u),_regeneratorDefine2(u,o,"Generator"),_regeneratorDefine2(u,n,function(){return this;}),_regeneratorDefine2(u,"toString",function(){return"[object Generator]";}),(_regenerator=function _regenerator(){return{w:i,m:f};})();}function _regeneratorDefine2(e,r,n,t){var i=Object.defineProperty;try{i({},"",{});}catch(e){i=0;}_regeneratorDefine2=function _regeneratorDefine(e,r,n,t){if(r)i?i(e,r,{value:n,enumerable:!t,configurable:!t,writable:!t}):e[r]=n;else{var o=function o(r,n){_regeneratorDefine2(e,r,function(e){return this._invoke(r,n,e);});};o("next",0),o("throw",1),o("return",2);}},_regeneratorDefine2(e,r,n,t);}function _createForOfIteratorHelper(r,e){var t="undefined"!=typeof Symbol&&r[Symbol.iterator]||r["@@iterator"];if(!t){if(Array.isArray(r)||(t=_unsupportedIterableToArray(r))||e&&r&&"number"==typeof r.length){t&&(r=t);var _n6=0,F=function F(){};return{s:F,n:function n(){return _n6>=r.length?{done:!0}:{done:!1,value:r[_n6++]};},e:function e(r){throw r;},f:F};}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");}var o,a=!0,u=!1;return{s:function s(){t=t.call(r);},n:function n(){var r=t.next();return a=r.done,r;},e:function e(r){u=!0,o=r;},f:function f(){try{a||null==t["return"]||t["return"]();}finally{if(u)throw o;}}};}function _unsupportedIterableToArray(r,a){if(r){if("string"==typeof r)return _arrayLikeToArray(r,a);var t={}.toString.call(r).slice(8,-1);return"Object"===t&&r.constructor&&(t=r.constructor.name),"Map"===t||"Set"===t?Array.from(r):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?_arrayLikeToArray(r,a):void 0;}}function _arrayLikeToArray(r,a){(null==a||a>r.length)&&(a=r.length);for(var e=0,n=Array(a);e<a;e++)n[e]=r[e];return n;}function _typeof(o){"@babel/helpers - typeof";return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(o){return typeof o;}:function(o){return o&&"function"==typeof Symbol&&o.constructor===Symbol&&o!==Symbol.prototype?"symbol":typeof o;},_typeof(o);}(function(global,factory){(typeof exports==="undefined"?"undefined":_typeof(exports))==='object'&&typeof module!=='undefined'?factory(exports):typeof define==='function'&&define.amd?define(['exports'],factory):(global=typeof globalThis!=='undefined'?globalThis:global||self,factory(global.vega={}));})(void 0,function(exports){'use strict';var _defaultSpecifiers,_localGet,_utcGet,_timeIntervals,_utcIntervals;var _marked=/*#__PURE__*/_regenerator().m(numbers$2),_marked2=/*#__PURE__*/_regenerator().m(flatten),_marked3=/*#__PURE__*/_regenerator().m(numbers$1),_marked4=/*#__PURE__*/_regenerator().m(node_iterator),_marked5=/*#__PURE__*/_regenerator().m(flatIterable);function accessor(fn,fields,name){fn.fields=fields||[];fn.fname=name;return fn;}function accessorName(fn){return fn==null?null:fn.fname;}function accessorFields(fn){return fn==null?null:fn.fields;}function getter$1(path){return path.length===1?get1(path[0]):getN(path);}var get1=function get1(field){return function(obj){return obj[field];};};var getN=function getN(path){var len=path.length;return function(obj){for(var i=0;i<len;++i){obj=obj[path[i]];}return obj;};};function error(message){throw Error(message);}function splitAccessPath(p){var path=[],n=p.length;var q=null,b=0,s='',i,j,c;p=p+'';function push(){path.push(s+p.substring(i,j));s='';i=j+1;}for(i=j=0;j<n;++j){c=p[j];if(c==='\\'){s+=p.substring(i,j++);i=j;}else if(c===q){push();q=null;b=-1;}else if(q){continue;}else if(i===b&&c==='"'){i=j+1;q=c;}else if(i===b&&c==="'"){i=j+1;q=c;}else if(c==='.'&&!b){if(j>i){push();}else{i=j+1;}}else if(c==='['){if(j>i)push();b=i=j+1;}else if(c===']'){if(!b)error('Access path missing open bracket: '+p);if(b>0)push();b=0;i=j+1;}}if(b)error('Access path missing closing bracket: '+p);if(q)error('Access path missing closing quote: '+p);if(j>i){j++;push();}return path;}function field$1(field,name,opt){var path=splitAccessPath(field);field=path.length===1?path[0]:field;return accessor((opt&&opt.get||getter$1)(path),[field],name||field);}var id=field$1('id');var identity$6=accessor(function(_){return _;},[],'identity');var zero$3=accessor(function(){return 0;},[],'zero');var one$2=accessor(function(){return 1;},[],'one');var truthy=accessor(function(){return true;},[],'true');var falsy=accessor(function(){return false;},[],'false');function log$1$1(method,level,input){var args=[level].concat([].slice.call(input));console[method].apply(console,args);// eslint-disable-line no-console +}var None$2=0;var Error$1=1;var Warn=2;var Info=3;var Debug=4;function logger(_,method){var handler=arguments.length>2&&arguments[2]!==undefined?arguments[2]:log$1$1;var _level=_||None$2;return{level:function level(_){if(arguments.length){_level=+_;return this;}else{return _level;}},error:function error(){if(_level>=Error$1)handler(method||'error','ERROR',arguments);return this;},warn:function warn(){if(_level>=Warn)handler(method||'warn','WARN',arguments);return this;},info:function info(){if(_level>=Info)handler(method||'log','INFO',arguments);return this;},debug:function debug(){if(_level>=Debug)handler(method||'log','DEBUG',arguments);return this;}};}var isArray=Array.isArray;function isObject(_){return _===Object(_);}var isLegalKey=function isLegalKey(key){return key!=='__proto__';};function mergeConfig(){for(var _len=arguments.length,configs=new Array(_len),_key=0;_key<_len;_key++){configs[_key]=arguments[_key];}return configs.reduce(function(out,source){for(var _key5 in source){if(_key5==='signals'){// for signals, we merge the signals arrays +// source signals take precedence over +// existing signals with the same name +out.signals=mergeNamed(out.signals,source.signals);}else{// otherwise, merge objects subject to recursion constraints +// for legend block, recurse for the layout entry only +// for style block, recurse for all properties +// otherwise, no recursion: objects overwrite, no merging +var r=_key5==='legend'?{layout:1}:_key5==='style'?true:null;writeConfig(out,_key5,source[_key5],r);}}return out;},{});}function writeConfig(output,key,value,recurse){if(!isLegalKey(key))return;var k,o;if(isObject(value)&&!isArray(value)){o=isObject(output[key])?output[key]:output[key]={};for(k in value){if(recurse&&(recurse===true||recurse[k])){writeConfig(o,k,value[k]);}else if(isLegalKey(k)){o[k]=value[k];}}}else{output[key]=value;}}function mergeNamed(a,b){if(a==null)return b;var map={},out=[];function add(_){if(!map[_.name]){map[_.name]=1;out.push(_);}}b.forEach(add);a.forEach(add);return out;}function peek$1(array){return array[array.length-1];}function toNumber(_){return _==null||_===''?null:+_;}var exp$2=function exp$2(sign){return function(x){return sign*Math.exp(x);};};var log$4=function log$4(sign){return function(x){return Math.log(sign*x);};};var symlog$1=function symlog$1(c){return function(x){return Math.sign(x)*Math.log1p(Math.abs(x/c));};};var symexp=function symexp(c){return function(x){return Math.sign(x)*Math.expm1(Math.abs(x))*c;};};var pow$4=function pow$4(exponent){return function(x){return x<0?-Math.pow(-x,exponent):Math.pow(x,exponent);};};function pan(domain,delta,lift,ground){var d0=lift(domain[0]),d1=lift(peek$1(domain)),dd=(d1-d0)*delta;return[ground(d0-dd),ground(d1-dd)];}function panLinear(domain,delta){return pan(domain,delta,toNumber,identity$6);}function panLog(domain,delta){var sign=Math.sign(domain[0]);return pan(domain,delta,log$4(sign),exp$2(sign));}function panPow(domain,delta,exponent){return pan(domain,delta,pow$4(exponent),pow$4(1/exponent));}function panSymlog(domain,delta,constant){return pan(domain,delta,symlog$1(constant),symexp(constant));}function zoom$1(domain,anchor,scale,lift,ground){var d0=lift(domain[0]),d1=lift(peek$1(domain)),da=anchor!=null?lift(anchor):(d0+d1)/2;return[ground(da+(d0-da)*scale),ground(da+(d1-da)*scale)];}function zoomLinear(domain,anchor,scale){return zoom$1(domain,anchor,scale,toNumber,identity$6);}function zoomLog(domain,anchor,scale){var sign=Math.sign(domain[0]);return zoom$1(domain,anchor,scale,log$4(sign),exp$2(sign));}function zoomPow(domain,anchor,scale,exponent){return zoom$1(domain,anchor,scale,pow$4(exponent),pow$4(1/exponent));}function zoomSymlog(domain,anchor,scale,constant){return zoom$1(domain,anchor,scale,symlog$1(constant),symexp(constant));}function quarter(date){return 1+~~(new Date(date).getMonth()/3);}function utcquarter(date){return 1+~~(new Date(date).getUTCMonth()/3);}function array$5(_){return _!=null?isArray(_)?_:[_]:[];}/** + * Span-preserving range clamp. If the span of the input range is less + * than (max - min) and an endpoint exceeds either the min or max value, + * the range is translated such that the span is preserved and one + * endpoint touches the boundary of the min/max range. + * If the span exceeds (max - min), the range [min, max] is returned. + */function clampRange(range,min,max){var lo=range[0],hi=range[1],span;if(hi<lo){span=hi;hi=lo;lo=span;}span=hi-lo;return span>=max-min?[min,max]:[lo=Math.min(Math.max(lo,min),max-span),lo+span];}function isFunction(_){return typeof _==='function';}var DESCENDING='descending';function compare$1(fields,orders,opt){opt=opt||{};orders=array$5(orders)||[];var ord=[],get=[],fmap={},gen=opt.comparator||comparator;array$5(fields).forEach(function(f,i){if(f==null)return;ord.push(orders[i]===DESCENDING?-1:1);get.push(f=isFunction(f)?f:field$1(f,null,opt));(accessorFields(f)||[]).forEach(function(_){return fmap[_]=1;});});return get.length===0?null:accessor(gen(get,ord),Object.keys(fmap));}var ascending$2=function ascending$2(u,v){return(u<v||u==null)&&v!=null?-1:(u>v||v==null)&&u!=null?1:(v=v instanceof Date?+v:v,u=u instanceof Date?+u:u)!==u&&v===v?-1:v!==v&&u===u?1:0;};var comparator=function comparator(fields,orders){return fields.length===1?compare1(fields[0],orders[0]):compareN(fields,orders,fields.length);};var compare1=function compare1(field,order){return function(a,b){return ascending$2(field(a),field(b))*order;};};var compareN=function compareN(fields,orders,n){orders.push(0);// pad zero for convenient lookup +return function(a,b){var f,c=0,i=-1;while(c===0&&++i<n){f=fields[i];c=ascending$2(f(a),f(b));}return c*orders[i];};};function constant$5(_){return isFunction(_)?_:function(){return _;};}function _debounce(delay,handler){var tid;return function(e){if(tid)clearTimeout(tid);tid=setTimeout(function(){return handler(e),tid=null;},delay);};}function extend$1(_){for(var _x3,k,i=1,len=arguments.length;i<len;++i){_x3=arguments[i];for(k in _x3){_[k]=_x3[k];}}return _;}/** + * Return an array with minimum and maximum values, in the + * form [min, max]. Ignores null, undefined, and NaN values. + */function _extent(array,f){var i=0,n,v,min,max;if(array&&(n=array.length)){if(f==null){// find first valid value +for(v=array[i];i<n&&(v==null||v!==v);v=array[++i]);min=max=v;// visit all other values +for(;i<n;++i){v=array[i];// skip null/undefined; NaN will fail all comparisons +if(v!=null){if(v<min)min=v;if(v>max)max=v;}}}else{// find first valid value +for(v=f(array[i]);i<n&&(v==null||v!==v);v=f(array[++i]));min=max=v;// visit all other values +for(;i<n;++i){v=f(array[i]);// skip null/undefined; NaN will fail all comparisons +if(v!=null){if(v<min)min=v;if(v>max)max=v;}}}}return[min,max];}function extentIndex(array,f){var n=array.length;var i=-1,a,b,c,u,v;if(f==null){while(++i<n){b=array[i];if(b!=null&&b>=b){a=c=b;break;}}if(i===n)return[-1,-1];u=v=i;while(++i<n){b=array[i];if(b!=null){if(a>b){a=b;u=i;}if(c<b){c=b;v=i;}}}}else{while(++i<n){b=f(array[i],i,array);if(b!=null&&b>=b){a=c=b;break;}}if(i===n)return[-1,-1];u=v=i;while(++i<n){b=f(array[i],i,array);if(b!=null){if(a>b){a=b;u=i;}if(c<b){c=b;v=i;}}}}return[u,v];}function has$1(object,property){return Object.hasOwn(object,property);}var NULL={};function fastmap(input){var obj={},_test;function has$1$1(key){return has$1(obj,key)&&obj[key]!==NULL;}var map={size:0,empty:0,object:obj,has:has$1$1,get:function get(key){return has$1$1(key)?obj[key]:undefined;},set:function set(key,value){if(!has$1$1(key)){++map.size;if(obj[key]===NULL)--map.empty;}obj[key]=value;return this;},"delete":function _delete(key){if(has$1$1(key)){--map.size;++map.empty;obj[key]=NULL;}return this;},clear:function clear(){map.size=map.empty=0;map.object=obj={};},test:function test(_){if(arguments.length){_test=_;return map;}else{return _test;}},clean:function clean(){var next={};var size=0;for(var _key6 in obj){var _value=obj[_key6];if(_value!==NULL&&(!_test||!_test(_value))){next[_key6]=_value;++size;}}map.size=size;map.empty=0;map.object=obj=next;}};if(input)Object.keys(input).forEach(function(key){map.set(key,input[key]);});return map;}function flush(range,value,threshold,left,right,center){if(!threshold&&threshold!==0)return center;var t=+threshold;var a=range[0],b=peek$1(range),l;// swap endpoints if range is reversed +if(b<a){l=a;a=b;b=l;}// compare value to endpoints +l=Math.abs(value-a);var r=Math.abs(b-value);// adjust if value is within threshold distance of endpoint +return l<r&&l<=t?left:r<=t?right:center;}function inherits(child,parent,members){var proto=child.prototype=Object.create(parent.prototype);Object.defineProperty(proto,'constructor',{value:child,writable:true,enumerable:true,configurable:true});return extend$1(proto,members);}/** + * Predicate that returns true if the value lies within the span + * of the given range. The left and right flags control the use + * of inclusive (true) or exclusive (false) comparisons. + */function inrange(value,range,left,right){var r0=range[0],r1=range[range.length-1],t;if(r0>r1){t=r0;r0=r1;r1=t;}left=left===undefined||left;right=right===undefined||right;return(left?r0<=value:r0<value)&&(right?value<=r1:value<r1);}function isBoolean$1(_){return typeof _==='boolean';}function isDate$1(_){return Object.prototype.toString.call(_)==='[object Date]';}function isIterable(_){return _&&isFunction(_[Symbol.iterator]);}function isNumber$1(_){return typeof _==='number';}function isRegExp(_){return Object.prototype.toString.call(_)==='[object RegExp]';}function isString(_){return typeof _==='string';}function key(fields,flat,opt){if(fields){fields=flat?array$5(fields).map(function(f){return f.replace(/\\(.)/g,'$1');}):array$5(fields);}var len=fields&&fields.length,gen=opt&&opt.get||getter$1,map=function map(f){return gen(flat?[f]:splitAccessPath(f));};var fn;if(!len){fn=function fn(){return'';};}else if(len===1){var _get=map(fields[0]);fn=function fn(_){return''+_get(_);};}else{var _get2=fields.map(map);fn=function fn(_){var s=''+_get2[0](_),i=0;while(++i<len)s+='|'+_get2[i](_);return s;};}return accessor(fn,fields,'key');}function lerp(array,frac){var lo=array[0],hi=peek$1(array),f=+frac;return!f?lo:f===1?hi:lo+f*(hi-lo);}var DEFAULT_MAX_SIZE=10000;// adapted from https://github.com/dominictarr/hashlru/ (MIT License) +function lruCache(maxsize){maxsize=+maxsize||DEFAULT_MAX_SIZE;var curr,prev,size;var clear=function clear(){curr={};prev={};size=0;};var update=function update(key,value){if(++size>maxsize){prev=curr;curr={};size=1;}return curr[key]=value;};clear();return{clear:clear,has:function has(key){return has$1(curr,key)||has$1(prev,key);},get:function get(key){return has$1(curr,key)?curr[key]:has$1(prev,key)?update(key,prev[key]):undefined;},set:function set(key,value){return has$1(curr,key)?curr[key]=value:update(key,value);}};}function merge$3(compare,array0,array1,output){var n0=array0.length,n1=array1.length;if(!n1)return array0;if(!n0)return array1;var merged=output||new array0.constructor(n0+n1);var i0=0,i1=0,i=0;for(;i0<n0&&i1<n1;++i){merged[i]=compare(array0[i0],array1[i1])>0?array1[i1++]:array0[i0++];}for(;i0<n0;++i0,++i){merged[i]=array0[i0];}for(;i1<n1;++i1,++i){merged[i]=array1[i1];}return merged;}function repeat(str,reps){var s='';while(--reps>=0)s+=str;return s;}function pad$2(str,length,padchar,align){var c=padchar||' ',s=str+'',n=length-s.length;return n<=0?s:align==='left'?repeat(c,n)+s:align==='center'?repeat(c,~~(n/2))+s+repeat(c,Math.ceil(n/2)):s+repeat(c,n);}/** + * Return the numerical span of an array: the difference between + * the last and first values. + */function span(array){return array&&peek$1(array)-array[0]||0;}function $(x){return isArray(x)?'['+x.map($)+']':isObject(x)||isString(x)?// Output valid JSON and JS source strings. +// See http://timelessrepo.com/json-isnt-a-javascript-subset +JSON.stringify(x).replace("\u2028","\\u2028").replace("\u2029","\\u2029"):x;}function toBoolean(_){return _==null||_===''?null:!_||_==='false'||_==='0'?false:!!_;}var defaultParser=function defaultParser(_){return isNumber$1(_)?_:isDate$1(_)?_:Date.parse(_);};function _toDate(_,parser){parser=parser||defaultParser;return _==null||_===''?null:parser(_);}function toString(_){return _==null||_===''?null:_+'';}function toSet(_){var s={},n=_.length;for(var i=0;i<n;++i)s[_[i]]=true;return s;}function truncate$1(str,length,align,ellipsis){var e=ellipsis!=null?ellipsis:"\u2026",s=str+'',n=s.length,l=Math.max(0,length-e.length);return n<=length?s:align==='left'?e+s.slice(n-l):align==='center'?s.slice(0,Math.ceil(l/2))+e+s.slice(n-~~(l/2)):s.slice(0,l)+e;}function visitArray(array,filter,visitor){if(array){if(filter){var n=array.length;for(var i=0;i<n;++i){var t=filter(array[i]);if(t)visitor(t,i,array);}}else{array.forEach(visitor);}}}var EOL={},EOF={},QUOTE=34,NEWLINE=10,RETURN=13;function objectConverter(columns){return new Function("d","return {"+columns.map(function(name,i){return JSON.stringify(name)+": d["+i+"] || \"\"";}).join(",")+"}");}function customConverter(columns,f){var object=objectConverter(columns);return function(row,i){return f(object(row),i,columns);};}// Compute unique columns in order of discovery. +function inferColumns(rows){var columnSet=Object.create(null),columns=[];rows.forEach(function(row){for(var column in row){if(!(column in columnSet)){columns.push(columnSet[column]=column);}}});return columns;}function pad$1(value,width){var s=value+"",length=s.length;return length<width?new Array(width-length+1).join(0)+s:s;}function formatYear$1(year){return year<0?"-"+pad$1(-year,6):year>9999?"+"+pad$1(year,6):pad$1(year,4);}function formatDate(date){var hours=date.getUTCHours(),minutes=date.getUTCMinutes(),seconds=date.getUTCSeconds(),milliseconds=date.getUTCMilliseconds();return isNaN(date)?"Invalid Date":formatYear$1(date.getUTCFullYear())+"-"+pad$1(date.getUTCMonth()+1,2)+"-"+pad$1(date.getUTCDate(),2)+(milliseconds?"T"+pad$1(hours,2)+":"+pad$1(minutes,2)+":"+pad$1(seconds,2)+"."+pad$1(milliseconds,3)+"Z":seconds?"T"+pad$1(hours,2)+":"+pad$1(minutes,2)+":"+pad$1(seconds,2)+"Z":minutes||hours?"T"+pad$1(hours,2)+":"+pad$1(minutes,2)+"Z":"");}function dsvFormat(delimiter){var reFormat=new RegExp("[\""+delimiter+"\n\r]"),DELIMITER=delimiter.charCodeAt(0);function parse(text,f){var convert,columns,rows=parseRows(text,function(row,i){if(convert)return convert(row,i-1);columns=row,convert=f?customConverter(row,f):objectConverter(row);});rows.columns=columns||[];return rows;}function parseRows(text,f){var rows=[],// output rows +N=text.length,I=0,// current character index +n=0,// current line number +t,// current token +eof=N<=0,// current token followed by EOF? +eol=false;// current token followed by EOL? +// Strip the trailing newline. +if(text.charCodeAt(N-1)===NEWLINE)--N;if(text.charCodeAt(N-1)===RETURN)--N;function token(){if(eof)return EOF;if(eol)return eol=false,EOL;// Unescape quotes. +var i,j=I,c;if(text.charCodeAt(j)===QUOTE){while(I++<N&&text.charCodeAt(I)!==QUOTE||text.charCodeAt(++I)===QUOTE);if((i=I)>=N)eof=true;else if((c=text.charCodeAt(I++))===NEWLINE)eol=true;else if(c===RETURN){eol=true;if(text.charCodeAt(I)===NEWLINE)++I;}return text.slice(j+1,i-1).replace(/""/g,"\"");}// Find next delimiter or newline. +while(I<N){if((c=text.charCodeAt(i=I++))===NEWLINE)eol=true;else if(c===RETURN){eol=true;if(text.charCodeAt(I)===NEWLINE)++I;}else if(c!==DELIMITER)continue;return text.slice(j,i);}// Return last token before EOF. +return eof=true,text.slice(j,N);}while((t=token())!==EOF){var row=[];while(t!==EOL&&t!==EOF)row.push(t),t=token();if(f&&(row=f(row,n++))==null)continue;rows.push(row);}return rows;}function preformatBody(rows,columns){return rows.map(function(row){return columns.map(function(column){return formatValue(row[column]);}).join(delimiter);});}function format(rows,columns){if(columns==null)columns=inferColumns(rows);return[columns.map(formatValue).join(delimiter)].concat(preformatBody(rows,columns)).join("\n");}function formatBody(rows,columns){if(columns==null)columns=inferColumns(rows);return preformatBody(rows,columns).join("\n");}function formatRows(rows){return rows.map(formatRow).join("\n");}function formatRow(row){return row.map(formatValue).join(delimiter);}function formatValue(value){return value==null?"":value instanceof Date?formatDate(value):reFormat.test(value+="")?"\""+value.replace(/"/g,"\"\"")+"\"":value;}return{parse:parse,parseRows:parseRows,format:format,formatBody:formatBody,formatRows:formatRows,formatRow:formatRow,formatValue:formatValue};}function identity$5(x){return x;}function transform$3(transform){if(transform==null)return identity$5;var x0,y0,kx=transform.scale[0],ky=transform.scale[1],dx=transform.translate[0],dy=transform.translate[1];return function(input,i){if(!i)x0=y0=0;var j=2,n=input.length,output=new Array(n);output[0]=(x0+=input[0])*kx+dx;output[1]=(y0+=input[1])*ky+dy;while(j<n)output[j]=input[j],++j;return output;};}function reverse$1(array,n){var t,j=array.length,i=j-n;while(i<--j)t=array[i],array[i++]=array[j],array[j]=t;}function feature(topology,o){if(typeof o==="string")o=topology.objects[o];return o.type==="GeometryCollection"?{type:"FeatureCollection",features:o.geometries.map(function(o){return feature$1(topology,o);})}:feature$1(topology,o);}function feature$1(topology,o){var id=o.id,bbox=o.bbox,properties=o.properties==null?{}:o.properties,geometry=object$1(topology,o);return id==null&&bbox==null?{type:"Feature",properties:properties,geometry:geometry}:bbox==null?{type:"Feature",id:id,properties:properties,geometry:geometry}:{type:"Feature",id:id,bbox:bbox,properties:properties,geometry:geometry};}function object$1(topology,o){var transformPoint=transform$3(topology.transform),arcs=topology.arcs;function arc(i,points){if(points.length)points.pop();for(var a=arcs[i<0?~i:i],k=0,n=a.length;k<n;++k){points.push(transformPoint(a[k],k));}if(i<0)reverse$1(points,n);}function point(p){return transformPoint(p);}function line(arcs){var points=[];for(var i=0,n=arcs.length;i<n;++i)arc(arcs[i],points);if(points.length<2)points.push(points[0]);// This should never happen per the specification. +return points;}function ring(arcs){var points=line(arcs);while(points.length<4)points.push(points[0]);// This may happen if an arc has only two points. +return points;}function polygon(arcs){return arcs.map(ring);}function geometry(o){var type=o.type,coordinates;switch(type){case"GeometryCollection":return{type:type,geometries:o.geometries.map(geometry)};case"Point":coordinates=point(o.coordinates);break;case"MultiPoint":coordinates=o.coordinates.map(point);break;case"LineString":coordinates=line(o.arcs);break;case"MultiLineString":coordinates=o.arcs.map(line);break;case"Polygon":coordinates=polygon(o.arcs);break;case"MultiPolygon":coordinates=o.arcs.map(polygon);break;default:return null;}return{type:type,coordinates:coordinates};}return geometry(o);}function stitch(topology,arcs){var stitchedArcs={},fragmentByStart={},fragmentByEnd={},fragments=[],emptyIndex=-1;// Stitch empty arcs first, since they may be subsumed by other arcs. +arcs.forEach(function(i,j){var arc=topology.arcs[i<0?~i:i],t;if(arc.length<3&&!arc[1][0]&&!arc[1][1]){t=arcs[++emptyIndex],arcs[emptyIndex]=i,arcs[j]=t;}});arcs.forEach(function(i){var e=ends(i),start=e[0],end=e[1],f,g;if(f=fragmentByEnd[start]){delete fragmentByEnd[f.end];f.push(i);f.end=end;if(g=fragmentByStart[end]){delete fragmentByStart[g.start];var fg=g===f?f:f.concat(g);fragmentByStart[fg.start=f.start]=fragmentByEnd[fg.end=g.end]=fg;}else{fragmentByStart[f.start]=fragmentByEnd[f.end]=f;}}else if(f=fragmentByStart[end]){delete fragmentByStart[f.start];f.unshift(i);f.start=start;if(g=fragmentByEnd[start]){delete fragmentByEnd[g.end];var gf=g===f?f:g.concat(f);fragmentByStart[gf.start=g.start]=fragmentByEnd[gf.end=f.end]=gf;}else{fragmentByStart[f.start]=fragmentByEnd[f.end]=f;}}else{f=[i];fragmentByStart[f.start=start]=fragmentByEnd[f.end=end]=f;}});function ends(i){var arc=topology.arcs[i<0?~i:i],p0=arc[0],p1;if(topology.transform)p1=[0,0],arc.forEach(function(dp){p1[0]+=dp[0],p1[1]+=dp[1];});else p1=arc[arc.length-1];return i<0?[p1,p0]:[p0,p1];}function flush(fragmentByEnd,fragmentByStart){for(var k in fragmentByEnd){var f=fragmentByEnd[k];delete fragmentByStart[f.start];delete f.start;delete f.end;f.forEach(function(i){stitchedArcs[i<0?~i:i]=1;});fragments.push(f);}}flush(fragmentByEnd,fragmentByStart);flush(fragmentByStart,fragmentByEnd);arcs.forEach(function(i){if(!stitchedArcs[i<0?~i:i])fragments.push([i]);});return fragments;}function mesh(topology){return object$1(topology,meshArcs.apply(this,arguments));}function meshArcs(topology,object,filter){var arcs,i,n;if(arguments.length>1)arcs=extractArcs(topology,object,filter);else for(i=0,arcs=new Array(n=topology.arcs.length);i<n;++i)arcs[i]=i;return{type:"MultiLineString",arcs:stitch(topology,arcs)};}function extractArcs(topology,object,filter){var arcs=[],geomsByArc=[],geom;function extract0(i){var j=i<0?~i:i;(geomsByArc[j]||(geomsByArc[j]=[])).push({i:i,g:geom});}function extract1(arcs){arcs.forEach(extract0);}function extract2(arcs){arcs.forEach(extract1);}function extract3(arcs){arcs.forEach(extract2);}function geometry(o){switch(geom=o,o.type){case"GeometryCollection":o.geometries.forEach(geometry);break;case"LineString":extract1(o.arcs);break;case"MultiLineString":case"Polygon":extract2(o.arcs);break;case"MultiPolygon":extract3(o.arcs);break;}}geometry(object);geomsByArc.forEach(filter==null?function(geoms){arcs.push(geoms[0].i);}:function(geoms){if(filter(geoms[0].g,geoms[geoms.length-1].g))arcs.push(geoms[0].i);});return arcs;}function ascending$1(a,b){return a==null||b==null?NaN:a<b?-1:a>b?1:a>=b?0:NaN;}function descending$1(a,b){return a==null||b==null?NaN:b<a?-1:b>a?1:b>=a?0:NaN;}function bisector(f){var compare1,compare2,delta;// If an accessor is specified, promote it to a comparator. In this case we +// can test whether the search value is (self-) comparable. We can’t do this +// for a comparator (except for specific, known comparators) because we can’t +// tell if the comparator is symmetric, and an asymmetric comparator can’t be +// used to test whether a single value is comparable. +if(f.length!==2){compare1=ascending$1;compare2=function compare2(d,x){return ascending$1(f(d),x);};delta=function delta(d,x){return f(d)-x;};}else{compare1=f===ascending$1||f===descending$1?f:zero$2;compare2=f;delta=f;}function left(a,x){var lo=arguments.length>2&&arguments[2]!==undefined?arguments[2]:0;var hi=arguments.length>3&&arguments[3]!==undefined?arguments[3]:a.length;if(lo<hi){if(compare1(x,x)!==0)return hi;do{var mid=lo+hi>>>1;if(compare2(a[mid],x)<0)lo=mid+1;else hi=mid;}while(lo<hi);}return lo;}function right(a,x){var lo=arguments.length>2&&arguments[2]!==undefined?arguments[2]:0;var hi=arguments.length>3&&arguments[3]!==undefined?arguments[3]:a.length;if(lo<hi){if(compare1(x,x)!==0)return hi;do{var mid=lo+hi>>>1;if(compare2(a[mid],x)<=0)lo=mid+1;else hi=mid;}while(lo<hi);}return lo;}function center(a,x){var lo=arguments.length>2&&arguments[2]!==undefined?arguments[2]:0;var hi=arguments.length>3&&arguments[3]!==undefined?arguments[3]:a.length;var i=left(a,x,lo,hi-1);return i>lo&&delta(a[i-1],x)>-delta(a[i],x)?i-1:i;}return{left:left,center:center,right:right};}function zero$2(){return 0;}function number$6(x){return x===null?NaN:+x;}function numbers$2(values,valueof){var _iterator,_step,_value2,_index,_iterator2,_step2,_value3,_t,_t2;return _regenerator().w(function(_context){while(1)switch(_context.p=_context.n){case 0:if(!(valueof===undefined)){_context.n=8;break;}_iterator=_createForOfIteratorHelper(values);_context.p=1;_iterator.s();case 2:if((_step=_iterator.n()).done){_context.n=4;break;}_value2=_step.value;if(!(_value2!=null&&(_value2=+_value2)>=_value2)){_context.n=3;break;}_context.n=3;return _value2;case 3:_context.n=2;break;case 4:_context.n=6;break;case 5:_context.p=5;_t=_context.v;_iterator.e(_t);case 6:_context.p=6;_iterator.f();return _context.f(6);case 7:_context.n=15;break;case 8:_index=-1;_iterator2=_createForOfIteratorHelper(values);_context.p=9;_iterator2.s();case 10:if((_step2=_iterator2.n()).done){_context.n=12;break;}_value3=_step2.value;if(!((_value3=valueof(_value3,++_index,values))!=null&&(_value3=+_value3)>=_value3)){_context.n=11;break;}_context.n=11;return _value3;case 11:_context.n=10;break;case 12:_context.n=14;break;case 13:_context.p=13;_t2=_context.v;_iterator2.e(_t2);case 14:_context.p=14;_iterator2.f();return _context.f(14);case 15:return _context.a(2);}},_marked,null,[[9,13,14,15],[1,5,6,7]]);}var ascendingBisect=bisector(ascending$1);var bisectRight$1=ascendingBisect.right;var bisectLeft$1=ascendingBisect.left;bisector(number$6).center;function variance(values,valueof){var count=0;var delta;var mean=0;var sum=0;if(valueof===undefined){var _iterator3=_createForOfIteratorHelper(values),_step3;try{for(_iterator3.s();!(_step3=_iterator3.n()).done;){var _value4=_step3.value;if(_value4!=null&&(_value4=+_value4)>=_value4){delta=_value4-mean;mean+=delta/++count;sum+=delta*(_value4-mean);}}}catch(err){_iterator3.e(err);}finally{_iterator3.f();}}else{var _index2=-1;var _iterator4=_createForOfIteratorHelper(values),_step4;try{for(_iterator4.s();!(_step4=_iterator4.n()).done;){var _value5=_step4.value;if((_value5=valueof(_value5,++_index2,values))!=null&&(_value5=+_value5)>=_value5){delta=_value5-mean;mean+=delta/++count;sum+=delta*(_value5-mean);}}}catch(err){_iterator4.e(err);}finally{_iterator4.f();}}if(count>1)return sum/(count-1);}function deviation(values,valueof){var v=variance(values,valueof);return v?Math.sqrt(v):v;}// https://github.com/python/cpython/blob/a74eea238f5baba15797e2e8b570d153bc8690a7/Modules/mathmodule.c#L1423 +var Adder=/*#__PURE__*/function(){function Adder(){_classCallCheck(this,Adder);this._partials=new Float64Array(32);this._n=0;}return _createClass(Adder,[{key:"add",value:function add(x){var p=this._partials;var i=0;for(var j=0;j<this._n&&j<32;j++){var _y3=p[j],hi=x+_y3,lo=Math.abs(x)<Math.abs(_y3)?x-(hi-_y3):_y3-(hi-x);if(lo)p[i++]=lo;x=hi;}p[i]=x;this._n=i+1;return this;}},{key:"valueOf",value:function valueOf(){var p=this._partials;var n=this._n,x,y,lo,hi=0;if(n>0){hi=p[--n];while(n>0){x=hi;y=p[--n];hi=x+y;lo=y-(hi-x);if(lo)break;}if(n>0&&(lo<0&&p[n-1]<0||lo>0&&p[n-1]>0)){y=lo*2;x=hi+y;if(y==x-hi)hi=x;}}return hi;}}]);}();var InternMap=/*#__PURE__*/function(_Map){function InternMap(entries){var _this;_classCallCheck(this,InternMap);var key=arguments.length>1&&arguments[1]!==undefined?arguments[1]:keyof;_this=_callSuper(this,InternMap);Object.defineProperties(_this,{_intern:{value:new Map()},_key:{value:key}});if(entries!=null){var _iterator5=_createForOfIteratorHelper(entries),_step5;try{for(_iterator5.s();!(_step5=_iterator5.n()).done;){var _step5$value=_slicedToArray(_step5.value,2),_key7=_step5$value[0],_value6=_step5$value[1];_this.set(_key7,_value6);}}catch(err){_iterator5.e(err);}finally{_iterator5.f();}}return _this;}_inherits(InternMap,_Map);return _createClass(InternMap,[{key:"get",value:function get(key){return _superPropGet(InternMap,"get",this,3)([intern_get(this,key)]);}},{key:"has",value:function has(key){return _superPropGet(InternMap,"has",this,3)([intern_get(this,key)]);}},{key:"set",value:function set(key,value){return _superPropGet(InternMap,"set",this,3)([intern_set(this,key),value]);}},{key:"delete",value:function _delete(key){return _superPropGet(InternMap,"delete",this,3)([intern_delete(this,key)]);}}]);}(/*#__PURE__*/_wrapNativeSuper(Map));var InternSet=/*#__PURE__*/function(_Set){function InternSet(values){var _this2;_classCallCheck(this,InternSet);var key=arguments.length>1&&arguments[1]!==undefined?arguments[1]:keyof;_this2=_callSuper(this,InternSet);Object.defineProperties(_this2,{_intern:{value:new Map()},_key:{value:key}});if(values!=null){var _iterator6=_createForOfIteratorHelper(values),_step6;try{for(_iterator6.s();!(_step6=_iterator6.n()).done;){var _value7=_step6.value;_this2.add(_value7);}}catch(err){_iterator6.e(err);}finally{_iterator6.f();}}return _this2;}_inherits(InternSet,_Set);return _createClass(InternSet,[{key:"has",value:function has(value){return _superPropGet(InternSet,"has",this,3)([intern_get(this,value)]);}},{key:"add",value:function add(value){return _superPropGet(InternSet,"add",this,3)([intern_set(this,value)]);}},{key:"delete",value:function _delete(value){return _superPropGet(InternSet,"delete",this,3)([intern_delete(this,value)]);}}]);}(/*#__PURE__*/_wrapNativeSuper(Set));function intern_get(_ref,value){var _intern=_ref._intern,_key=_ref._key;var key=_key(value);return _intern.has(key)?_intern.get(key):value;}function intern_set(_ref2,value){var _intern=_ref2._intern,_key=_ref2._key;var key=_key(value);if(_intern.has(key))return _intern.get(key);_intern.set(key,value);return value;}function intern_delete(_ref3,value){var _intern=_ref3._intern,_key=_ref3._key;var key=_key(value);if(_intern.has(key)){value=_intern.get(key);_intern["delete"](key);}return value;}function keyof(value){return value!==null&&_typeof(value)==="object"?value.valueOf():value;}function permute(source,keys){return Array.from(keys,function(key){return source[key];});}function compareDefined(){var compare=arguments.length>0&&arguments[0]!==undefined?arguments[0]:ascending$1;if(compare===ascending$1)return ascendingDefined;if(typeof compare!=="function")throw new TypeError("compare is not a function");return function(a,b){var x=compare(a,b);if(x||x===0)return x;return(compare(b,b)===0)-(compare(a,a)===0);};}function ascendingDefined(a,b){return(a==null||!(a>=a))-(b==null||!(b>=b))||(a<b?-1:a>b?1:0);}var e10=Math.sqrt(50),e5=Math.sqrt(10),e2=Math.sqrt(2);function tickSpec(start,stop,count){var step=(stop-start)/Math.max(0,count),power=Math.floor(Math.log10(step)),error=step/Math.pow(10,power),factor=error>=e10?10:error>=e5?5:error>=e2?2:1;var i1,i2,inc;if(power<0){inc=Math.pow(10,-power)/factor;i1=Math.round(start*inc);i2=Math.round(stop*inc);if(i1/inc<start)++i1;if(i2/inc>stop)--i2;inc=-inc;}else{inc=Math.pow(10,power)*factor;i1=Math.round(start/inc);i2=Math.round(stop/inc);if(i1*inc<start)++i1;if(i2*inc>stop)--i2;}if(i2<i1&&0.5<=count&&count<2)return tickSpec(start,stop,count*2);return[i1,i2,inc];}function ticks(start,stop,count){stop=+stop,start=+start,count=+count;if(!(count>0))return[];if(start===stop)return[start];var reverse=stop<start,_ref4=reverse?tickSpec(stop,start,count):tickSpec(start,stop,count),_ref5=_slicedToArray(_ref4,3),i1=_ref5[0],i2=_ref5[1],inc=_ref5[2];if(!(i2>=i1))return[];var n=i2-i1+1,ticks=new Array(n);if(reverse){if(inc<0)for(var i=0;i<n;++i)ticks[i]=(i2-i)/-inc;else for(var _i2=0;_i2<n;++_i2)ticks[_i2]=(i2-_i2)*inc;}else{if(inc<0)for(var _i3=0;_i3<n;++_i3)ticks[_i3]=(i1+_i3)/-inc;else for(var _i4=0;_i4<n;++_i4)ticks[_i4]=(i1+_i4)*inc;}return ticks;}function tickIncrement(start,stop,count){stop=+stop,start=+start,count=+count;return tickSpec(start,stop,count)[2];}function tickStep(start,stop,count){stop=+stop,start=+start,count=+count;var reverse=stop<start,inc=reverse?tickIncrement(stop,start,count):tickIncrement(start,stop,count);return(reverse?-1:1)*(inc<0?1/-inc:inc);}function max$2(values,valueof){var max;if(valueof===undefined){var _iterator7=_createForOfIteratorHelper(values),_step7;try{for(_iterator7.s();!(_step7=_iterator7.n()).done;){var _value8=_step7.value;if(_value8!=null&&(max<_value8||max===undefined&&_value8>=_value8)){max=_value8;}}}catch(err){_iterator7.e(err);}finally{_iterator7.f();}}else{var _index3=-1;var _iterator8=_createForOfIteratorHelper(values),_step8;try{for(_iterator8.s();!(_step8=_iterator8.n()).done;){var _value9=_step8.value;if((_value9=valueof(_value9,++_index3,values))!=null&&(max<_value9||max===undefined&&_value9>=_value9)){max=_value9;}}}catch(err){_iterator8.e(err);}finally{_iterator8.f();}}return max;}function min$2(values,valueof){var min;if(valueof===undefined){var _iterator9=_createForOfIteratorHelper(values),_step9;try{for(_iterator9.s();!(_step9=_iterator9.n()).done;){var _value0=_step9.value;if(_value0!=null&&(min>_value0||min===undefined&&_value0>=_value0)){min=_value0;}}}catch(err){_iterator9.e(err);}finally{_iterator9.f();}}else{var _index4=-1;var _iterator0=_createForOfIteratorHelper(values),_step0;try{for(_iterator0.s();!(_step0=_iterator0.n()).done;){var _value1=_step0.value;if((_value1=valueof(_value1,++_index4,values))!=null&&(min>_value1||min===undefined&&_value1>=_value1)){min=_value1;}}}catch(err){_iterator0.e(err);}finally{_iterator0.f();}}return min;}// Based on https://github.com/mourner/quickselect +// ISC license, Copyright 2018 Vladimir Agafonkin. +function quickselect(array,k){var left=arguments.length>2&&arguments[2]!==undefined?arguments[2]:0;var right=arguments.length>3&&arguments[3]!==undefined?arguments[3]:Infinity;var compare=arguments.length>4?arguments[4]:undefined;k=Math.floor(k);left=Math.floor(Math.max(0,left));right=Math.floor(Math.min(array.length-1,right));if(!(left<=k&&k<=right))return array;compare=compare===undefined?ascendingDefined:compareDefined(compare);while(right>left){if(right-left>600){var n=right-left+1;var _m=k-left+1;var z=Math.log(n);var s=0.5*Math.exp(2*z/3);var sd=0.5*Math.sqrt(z*s*(n-s)/n)*(_m-n/2<0?-1:1);var newLeft=Math.max(left,Math.floor(k-_m*s/n+sd));var newRight=Math.min(right,Math.floor(k+(n-_m)*s/n+sd));quickselect(array,k,newLeft,newRight,compare);}var t=array[k];var i=left;var j=right;swap$1(array,left,k);if(compare(array[right],t)>0)swap$1(array,left,right);while(i<j){swap$1(array,i,j),++i,--j;while(compare(array[i],t)<0)++i;while(compare(array[j],t)>0)--j;}if(compare(array[left],t)===0)swap$1(array,left,j);else++j,swap$1(array,j,right);if(j<=k)left=j+1;if(k<=j)right=j-1;}return array;}function swap$1(array,i,j){var t=array[i];array[i]=array[j];array[j]=t;}function quantile$1(values,p,valueof){values=Float64Array.from(numbers$2(values,valueof));if(!(n=values.length)||isNaN(p=+p))return;if(p<=0||n<2)return min$2(values);if(p>=1)return max$2(values);var n,i=(n-1)*p,i0=Math.floor(i),value0=max$2(quickselect(values,i0).subarray(0,i0+1)),value1=min$2(values.subarray(i0+1));return value0+(value1-value0)*(i-i0);}function quantileSorted(values,p){var valueof=arguments.length>2&&arguments[2]!==undefined?arguments[2]:number$6;if(!(n=values.length)||isNaN(p=+p))return;if(p<=0||n<2)return+valueof(values[0],0,values);if(p>=1)return+valueof(values[n-1],n-1,values);var n,i=(n-1)*p,i0=Math.floor(i),value0=+valueof(values[i0],i0,values),value1=+valueof(values[i0+1],i0+1,values);return value0+(value1-value0)*(i-i0);}function mean(values,valueof){var count=0;var sum=0;if(valueof===undefined){var _iterator1=_createForOfIteratorHelper(values),_step1;try{for(_iterator1.s();!(_step1=_iterator1.n()).done;){var _value10=_step1.value;if(_value10!=null&&(_value10=+_value10)>=_value10){++count,sum+=_value10;}}}catch(err){_iterator1.e(err);}finally{_iterator1.f();}}else{var _index5=-1;var _iterator10=_createForOfIteratorHelper(values),_step10;try{for(_iterator10.s();!(_step10=_iterator10.n()).done;){var _value11=_step10.value;if((_value11=valueof(_value11,++_index5,values))!=null&&(_value11=+_value11)>=_value11){++count,sum+=_value11;}}}catch(err){_iterator10.e(err);}finally{_iterator10.f();}}if(count)return sum/count;}function median(values,valueof){return quantile$1(values,0.5,valueof);}function flatten(arrays){var _iterator11,_step11,_array,_t3;return _regenerator().w(function(_context2){while(1)switch(_context2.p=_context2.n){case 0:_iterator11=_createForOfIteratorHelper(arrays);_context2.p=1;_iterator11.s();case 2:if((_step11=_iterator11.n()).done){_context2.n=4;break;}_array=_step11.value;return _context2.d(_regeneratorValues(_array),3);case 3:_context2.n=2;break;case 4:_context2.n=6;break;case 5:_context2.p=5;_t3=_context2.v;_iterator11.e(_t3);case 6:_context2.p=6;_iterator11.f();return _context2.f(6);case 7:return _context2.a(2);}},_marked2,null,[[1,5,6,7]]);}function merge$2(arrays){return Array.from(flatten(arrays));}function range$3(start,stop,step){start=+start,stop=+stop,step=(n=arguments.length)<2?(stop=start,start=0,1):n<3?1:+step;var i=-1,n=Math.max(0,Math.ceil((stop-start)/step))|0,range=new Array(n);while(++i<n){range[i]=start+i*step;}return range;}function sum$1(values,valueof){var sum=0;{var _iterator12=_createForOfIteratorHelper(values),_step12;try{for(_iterator12.s();!(_step12=_iterator12.n()).done;){var _value12=_step12.value;if(_value12=+_value12){sum+=_value12;}}}catch(err){_iterator12.e(err);}finally{_iterator12.f();}}return sum;}function intersection(values){for(var _len=arguments.length,others=new Array(_len>1?_len-1:0),_key=1;_key<_len;_key++){others[_key-1]=arguments[_key];}values=new InternSet(values);others=others.map(set$4);var _iterator13=_createForOfIteratorHelper(values),_step13;try{out:for(_iterator13.s();!(_step13=_iterator13.n()).done;){var _value13=_step13.value;var _iterator14=_createForOfIteratorHelper(others),_step14;try{for(_iterator14.s();!(_step14=_iterator14.n()).done;){var other=_step14.value;if(!other.has(_value13)){values["delete"](_value13);continue out;}}}catch(err){_iterator14.e(err);}finally{_iterator14.f();}}}catch(err){_iterator13.e(err);}finally{_iterator13.f();}return values;}function set$4(values){return values instanceof InternSet?values:new InternSet(values);}function union(){var set=new InternSet();for(var _len=arguments.length,others=new Array(_len),_key=0;_key<_len;_key++){others[_key]=arguments[_key];}for(var _i5=0,_others=others;_i5<_others.length;_i5++){var other=_others[_i5];var _iterator15=_createForOfIteratorHelper(other),_step15;try{for(_iterator15.s();!(_step15=_iterator15.n()).done;){var o=_step15.value;set.add(o);}}catch(err){_iterator15.e(err);}finally{_iterator15.f();}}return set;}function formatDecimal(x){return Math.abs(x=Math.round(x))>=1e21?x.toLocaleString("en").replace(/,/g,""):x.toString(10);}// Computes the decimal coefficient and exponent of the specified number x with +// significant digits p, where x is positive and p is in [1, 21] or undefined. +// For example, formatDecimalParts(1.23) returns ["123", 0]. +function formatDecimalParts(x,p){if((i=(x=p?x.toExponential(p-1):x.toExponential()).indexOf("e"))<0)return null;// NaN, ±Infinity +var i,coefficient=x.slice(0,i);// The string returned by toExponential either has the form \d\.\d+e[-+]\d+ +// (e.g., 1.2e+3) or the form \de[-+]\d+ (e.g., 1e+3). +return[coefficient.length>1?coefficient[0]+coefficient.slice(2):coefficient,+x.slice(i+1)];}function exponent(x){return x=formatDecimalParts(Math.abs(x)),x?x[1]:NaN;}function formatGroup(grouping,thousands){return function(value,width){var i=value.length,t=[],j=0,g=grouping[0],length=0;while(i>0&&g>0){if(length+g+1>width)g=Math.max(1,width-length);t.push(value.substring(i-=g,i+g));if((length+=g+1)>width)break;g=grouping[j=(j+1)%grouping.length];}return t.reverse().join(thousands);};}function formatNumerals(numerals){return function(value){return value.replace(/[0-9]/g,function(i){return numerals[+i];});};}// [[fill]align][sign][symbol][0][width][,][.precision][~][type] +var re=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function formatSpecifier(specifier){if(!(match=re.exec(specifier)))throw new Error("invalid format: "+specifier);var match;return new FormatSpecifier({fill:match[1],align:match[2],sign:match[3],symbol:match[4],zero:match[5],width:match[6],comma:match[7],precision:match[8]&&match[8].slice(1),trim:match[9],type:match[10]});}formatSpecifier.prototype=FormatSpecifier.prototype;// instanceof +function FormatSpecifier(specifier){this.fill=specifier.fill===undefined?" ":specifier.fill+"";this.align=specifier.align===undefined?">":specifier.align+"";this.sign=specifier.sign===undefined?"-":specifier.sign+"";this.symbol=specifier.symbol===undefined?"":specifier.symbol+"";this.zero=!!specifier.zero;this.width=specifier.width===undefined?undefined:+specifier.width;this.comma=!!specifier.comma;this.precision=specifier.precision===undefined?undefined:+specifier.precision;this.trim=!!specifier.trim;this.type=specifier.type===undefined?"":specifier.type+"";}FormatSpecifier.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(this.width===undefined?"":Math.max(1,this.width|0))+(this.comma?",":"")+(this.precision===undefined?"":"."+Math.max(0,this.precision|0))+(this.trim?"~":"")+this.type;};// Trims insignificant zeros, e.g., replaces 1.2000k with 1.2k. +function formatTrim(s){out:for(var n=s.length,i=1,i0=-1,i1;i<n;++i){switch(s[i]){case".":i0=i1=i;break;case"0":if(i0===0)i0=i;i1=i;break;default:if(!+s[i])break out;if(i0>0)i0=0;break;}}return i0>0?s.slice(0,i0)+s.slice(i1+1):s;}var prefixExponent;function formatPrefixAuto(x,p){var d=formatDecimalParts(x,p);if(!d)return x+"";var coefficient=d[0],exponent=d[1],i=exponent-(prefixExponent=Math.max(-8,Math.min(8,Math.floor(exponent/3)))*3)+1,n=coefficient.length;return i===n?coefficient:i>n?coefficient+new Array(i-n+1).join("0"):i>0?coefficient.slice(0,i)+"."+coefficient.slice(i):"0."+new Array(1-i).join("0")+formatDecimalParts(x,Math.max(0,p+i-1))[0];// less than 1y! +}function formatRounded(x,p){var d=formatDecimalParts(x,p);if(!d)return x+"";var coefficient=d[0],exponent=d[1];return exponent<0?"0."+new Array(-exponent).join("0")+coefficient:coefficient.length>exponent+1?coefficient.slice(0,exponent+1)+"."+coefficient.slice(exponent+1):coefficient+new Array(exponent-coefficient.length+2).join("0");}var formatTypes={"%":function _(x,p){return(x*100).toFixed(p);},"b":function b(x){return Math.round(x).toString(2);},"c":function c(x){return x+"";},"d":formatDecimal,"e":function e(x,p){return x.toExponential(p);},"f":function f(x,p){return x.toFixed(p);},"g":function g(x,p){return x.toPrecision(p);},"o":function o(x){return Math.round(x).toString(8);},"p":function p(x,_p){return formatRounded(x*100,_p);},"r":formatRounded,"s":formatPrefixAuto,"X":function X(x){return Math.round(x).toString(16).toUpperCase();},"x":function x(_x4){return Math.round(_x4).toString(16);}};function identity$4(x){return x;}var map$1=Array.prototype.map,prefixes=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function formatLocale$1(locale){var group=locale.grouping===undefined||locale.thousands===undefined?identity$4:formatGroup(map$1.call(locale.grouping,Number),locale.thousands+""),currencyPrefix=locale.currency===undefined?"":locale.currency[0]+"",currencySuffix=locale.currency===undefined?"":locale.currency[1]+"",decimal=locale.decimal===undefined?".":locale.decimal+"",numerals=locale.numerals===undefined?identity$4:formatNumerals(map$1.call(locale.numerals,String)),percent=locale.percent===undefined?"%":locale.percent+"",minus=locale.minus===undefined?"−":locale.minus+"",nan=locale.nan===undefined?"NaN":locale.nan+"";function newFormat(specifier){specifier=formatSpecifier(specifier);var fill=specifier.fill,align=specifier.align,sign=specifier.sign,symbol=specifier.symbol,zero=specifier.zero,width=specifier.width,comma=specifier.comma,precision=specifier.precision,trim=specifier.trim,type=specifier.type;// The "n" type is an alias for ",g". +if(type==="n")comma=true,type="g";// The "" type, and any invalid type, is an alias for ".12~g". +else if(!formatTypes[type])precision===undefined&&(precision=12),trim=true,type="g";// If zero fill is specified, padding goes after sign and before digits. +if(zero||fill==="0"&&align==="=")zero=true,fill="0",align="=";// Compute the prefix and suffix. +// For SI-prefix, the suffix is lazily computed. +var prefix=symbol==="$"?currencyPrefix:symbol==="#"&&/[boxX]/.test(type)?"0"+type.toLowerCase():"",suffix=symbol==="$"?currencySuffix:/[%p]/.test(type)?percent:"";// What format function should we use? +// Is this an integer type? +// Can this type generate exponential notation? +var formatType=formatTypes[type],maybeSuffix=/[defgprs%]/.test(type);// Set the default precision if not specified, +// or clamp the specified precision to the supported range. +// For significant precision, it must be in [1, 21]. +// For fixed precision, it must be in [0, 20]. +precision=precision===undefined?6:/[gprs]/.test(type)?Math.max(1,Math.min(21,precision)):Math.max(0,Math.min(20,precision));function format(value){var valuePrefix=prefix,valueSuffix=suffix,i,n,c;if(type==="c"){valueSuffix=formatType(value)+valueSuffix;value="";}else{value=+value;// Determine the sign. -0 is not less than 0, but 1 / -0 is! +var valueNegative=value<0||1/value<0;// Perform the initial formatting. +value=isNaN(value)?nan:formatType(Math.abs(value),precision);// Trim insignificant zeros. +if(trim)value=formatTrim(value);// If a negative value rounds to zero after formatting, and no explicit positive sign is requested, hide the sign. +if(valueNegative&&+value===0&&sign!=="+")valueNegative=false;// Compute the prefix and suffix. +valuePrefix=(valueNegative?sign==="("?sign:minus:sign==="-"||sign==="("?"":sign)+valuePrefix;valueSuffix=(type==="s"?prefixes[8+prefixExponent/3]:"")+valueSuffix+(valueNegative&&sign==="("?")":"");// Break the formatted value into the integer “value” part that can be +// grouped, and fractional or exponential “suffix” part that is not. +if(maybeSuffix){i=-1,n=value.length;while(++i<n){if(c=value.charCodeAt(i),48>c||c>57){valueSuffix=(c===46?decimal+value.slice(i+1):value.slice(i))+valueSuffix;value=value.slice(0,i);break;}}}}// If the fill character is not "0", grouping is applied before padding. +if(comma&&!zero)value=group(value,Infinity);// Compute the padding. +var length=valuePrefix.length+value.length+valueSuffix.length,padding=length<width?new Array(width-length+1).join(fill):"";// If the fill character is "0", grouping is applied after padding. +if(comma&&zero)value=group(padding+value,padding.length?width-valueSuffix.length:Infinity),padding="";// Reconstruct the final output based on the desired alignment. +switch(align){case"<":value=valuePrefix+value+valueSuffix+padding;break;case"=":value=valuePrefix+padding+value+valueSuffix;break;case"^":value=padding.slice(0,length=padding.length>>1)+valuePrefix+value+valueSuffix+padding.slice(length);break;default:value=padding+valuePrefix+value+valueSuffix;break;}return numerals(value);}format.toString=function(){return specifier+"";};return format;}function formatPrefix(specifier,value){var f=newFormat((specifier=formatSpecifier(specifier),specifier.type="f",specifier)),e=Math.max(-8,Math.min(8,Math.floor(exponent(value)/3)))*3,k=Math.pow(10,-e),prefix=prefixes[8+e/3];return function(value){return f(k*value)+prefix;};}return{format:newFormat,formatPrefix:formatPrefix};}var locale$2;var format$3;var formatPrefix;defaultLocale$2({thousands:",",grouping:[3],currency:["$",""]});function defaultLocale$2(definition){locale$2=formatLocale$1(definition);format$3=locale$2.format;formatPrefix=locale$2.formatPrefix;return locale$2;}function precisionFixed(step){return Math.max(0,-exponent(Math.abs(step)));}function precisionPrefix(step,value){return Math.max(0,Math.max(-8,Math.min(8,Math.floor(exponent(value)/3)))*3-exponent(Math.abs(step)));}function precisionRound(step,max){step=Math.abs(step),max=Math.abs(max)-step;return Math.max(0,exponent(max)-exponent(step))+1;}var t0$2=new Date(),t1$1=new Date();function timeInterval$1(floori,offseti,count,field){function interval(date){return floori(date=arguments.length===0?new Date():new Date(+date)),date;}interval.floor=function(date){return floori(date=new Date(+date)),date;};interval.ceil=function(date){return floori(date=new Date(date-1)),offseti(date,1),floori(date),date;};interval.round=function(date){var d0=interval(date),d1=interval.ceil(date);return date-d0<d1-date?d0:d1;};interval.offset=function(date,step){return offseti(date=new Date(+date),step==null?1:Math.floor(step)),date;};interval.range=function(start,stop,step){var range=[];start=interval.ceil(start);step=step==null?1:Math.floor(step);if(!(start<stop)||!(step>0))return range;// also handles Invalid Date +var previous;do range.push(previous=new Date(+start)),offseti(start,step),floori(start);while(previous<start&&start<stop);return range;};interval.filter=function(test){return timeInterval$1(function(date){if(date>=date)while(floori(date),!test(date))date.setTime(date-1);},function(date,step){if(date>=date){if(step<0)while(++step<=0){while(offseti(date,-1),!test(date)){}// eslint-disable-line no-empty +}else while(--step>=0){while(offseti(date,1),!test(date)){}// eslint-disable-line no-empty +}}});};if(count){interval.count=function(start,end){t0$2.setTime(+start),t1$1.setTime(+end);floori(t0$2),floori(t1$1);return Math.floor(count(t0$2,t1$1));};interval.every=function(step){step=Math.floor(step);return!isFinite(step)||!(step>0)?null:!(step>1)?interval:interval.filter(field?function(d){return field(d)%step===0;}:function(d){return interval.count(0,d)%step===0;});};}return interval;}var millisecond=timeInterval$1(function(){// noop +},function(date,step){date.setTime(+date+step);},function(start,end){return end-start;});// An optimized implementation for this simple case. +millisecond.every=function(k){k=Math.floor(k);if(!isFinite(k)||!(k>0))return null;if(!(k>1))return millisecond;return timeInterval$1(function(date){date.setTime(Math.floor(date/k)*k);},function(date,step){date.setTime(+date+step*k);},function(start,end){return(end-start)/k;});};millisecond.range;var durationSecond$1=1000;var durationMinute$1=durationSecond$1*60;var durationHour$1=durationMinute$1*60;var durationDay$1=durationHour$1*24;var durationWeek$1=durationDay$1*7;var durationMonth$1=durationDay$1*30;var durationYear$1=durationDay$1*365;var second=timeInterval$1(function(date){date.setTime(date-date.getMilliseconds());},function(date,step){date.setTime(+date+step*durationSecond$1);},function(start,end){return(end-start)/durationSecond$1;},function(date){return date.getUTCSeconds();});second.range;var timeMinute=timeInterval$1(function(date){date.setTime(date-date.getMilliseconds()-date.getSeconds()*durationSecond$1);},function(date,step){date.setTime(+date+step*durationMinute$1);},function(start,end){return(end-start)/durationMinute$1;},function(date){return date.getMinutes();});timeMinute.range;var utcMinute=timeInterval$1(function(date){date.setUTCSeconds(0,0);},function(date,step){date.setTime(+date+step*durationMinute$1);},function(start,end){return(end-start)/durationMinute$1;},function(date){return date.getUTCMinutes();});utcMinute.range;var timeHour=timeInterval$1(function(date){date.setTime(date-date.getMilliseconds()-date.getSeconds()*durationSecond$1-date.getMinutes()*durationMinute$1);},function(date,step){date.setTime(+date+step*durationHour$1);},function(start,end){return(end-start)/durationHour$1;},function(date){return date.getHours();});timeHour.range;var utcHour=timeInterval$1(function(date){date.setUTCMinutes(0,0,0);},function(date,step){date.setTime(+date+step*durationHour$1);},function(start,end){return(end-start)/durationHour$1;},function(date){return date.getUTCHours();});utcHour.range;var timeDay=timeInterval$1(function(date){return date.setHours(0,0,0,0);},function(date,step){return date.setDate(date.getDate()+step);},function(start,end){return(end-start-(end.getTimezoneOffset()-start.getTimezoneOffset())*durationMinute$1)/durationDay$1;},function(date){return date.getDate()-1;});timeDay.range;var utcDay=timeInterval$1(function(date){date.setUTCHours(0,0,0,0);},function(date,step){date.setUTCDate(date.getUTCDate()+step);},function(start,end){return(end-start)/durationDay$1;},function(date){return date.getUTCDate()-1;});utcDay.range;var unixDay=timeInterval$1(function(date){date.setUTCHours(0,0,0,0);},function(date,step){date.setUTCDate(date.getUTCDate()+step);},function(start,end){return(end-start)/durationDay$1;},function(date){return Math.floor(date/durationDay$1);});unixDay.range;function timeWeekday(i){return timeInterval$1(function(date){date.setDate(date.getDate()-(date.getDay()+7-i)%7);date.setHours(0,0,0,0);},function(date,step){date.setDate(date.getDate()+step*7);},function(start,end){return(end-start-(end.getTimezoneOffset()-start.getTimezoneOffset())*durationMinute$1)/durationWeek$1;});}var timeSunday=timeWeekday(0);var timeMonday=timeWeekday(1);var timeTuesday=timeWeekday(2);var timeWednesday=timeWeekday(3);var timeThursday=timeWeekday(4);var timeFriday=timeWeekday(5);var timeSaturday=timeWeekday(6);timeSunday.range;timeMonday.range;timeTuesday.range;timeWednesday.range;timeThursday.range;timeFriday.range;timeSaturday.range;function utcWeekday(i){return timeInterval$1(function(date){date.setUTCDate(date.getUTCDate()-(date.getUTCDay()+7-i)%7);date.setUTCHours(0,0,0,0);},function(date,step){date.setUTCDate(date.getUTCDate()+step*7);},function(start,end){return(end-start)/durationWeek$1;});}var utcSunday=utcWeekday(0);var utcMonday=utcWeekday(1);var utcTuesday=utcWeekday(2);var utcWednesday=utcWeekday(3);var utcThursday=utcWeekday(4);var utcFriday=utcWeekday(5);var utcSaturday=utcWeekday(6);utcSunday.range;utcMonday.range;utcTuesday.range;utcWednesday.range;utcThursday.range;utcFriday.range;utcSaturday.range;var timeMonth=timeInterval$1(function(date){date.setDate(1);date.setHours(0,0,0,0);},function(date,step){date.setMonth(date.getMonth()+step);},function(start,end){return end.getMonth()-start.getMonth()+(end.getFullYear()-start.getFullYear())*12;},function(date){return date.getMonth();});timeMonth.range;var utcMonth=timeInterval$1(function(date){date.setUTCDate(1);date.setUTCHours(0,0,0,0);},function(date,step){date.setUTCMonth(date.getUTCMonth()+step);},function(start,end){return end.getUTCMonth()-start.getUTCMonth()+(end.getUTCFullYear()-start.getUTCFullYear())*12;},function(date){return date.getUTCMonth();});utcMonth.range;var timeYear=timeInterval$1(function(date){date.setMonth(0,1);date.setHours(0,0,0,0);},function(date,step){date.setFullYear(date.getFullYear()+step);},function(start,end){return end.getFullYear()-start.getFullYear();},function(date){return date.getFullYear();});// An optimized implementation for this simple case. +timeYear.every=function(k){return!isFinite(k=Math.floor(k))||!(k>0)?null:timeInterval$1(function(date){date.setFullYear(Math.floor(date.getFullYear()/k)*k);date.setMonth(0,1);date.setHours(0,0,0,0);},function(date,step){date.setFullYear(date.getFullYear()+step*k);});};timeYear.range;var utcYear=timeInterval$1(function(date){date.setUTCMonth(0,1);date.setUTCHours(0,0,0,0);},function(date,step){date.setUTCFullYear(date.getUTCFullYear()+step);},function(start,end){return end.getUTCFullYear()-start.getUTCFullYear();},function(date){return date.getUTCFullYear();});// An optimized implementation for this simple case. +utcYear.every=function(k){return!isFinite(k=Math.floor(k))||!(k>0)?null:timeInterval$1(function(date){date.setUTCFullYear(Math.floor(date.getUTCFullYear()/k)*k);date.setUTCMonth(0,1);date.setUTCHours(0,0,0,0);},function(date,step){date.setUTCFullYear(date.getUTCFullYear()+step*k);});};utcYear.range;function ticker(year,month,week,day,hour,minute){var tickIntervals=[[second,1,durationSecond$1],[second,5,5*durationSecond$1],[second,15,15*durationSecond$1],[second,30,30*durationSecond$1],[minute,1,durationMinute$1],[minute,5,5*durationMinute$1],[minute,15,15*durationMinute$1],[minute,30,30*durationMinute$1],[hour,1,durationHour$1],[hour,3,3*durationHour$1],[hour,6,6*durationHour$1],[hour,12,12*durationHour$1],[day,1,durationDay$1],[day,2,2*durationDay$1],[week,1,durationWeek$1],[month,1,durationMonth$1],[month,3,3*durationMonth$1],[year,1,durationYear$1]];function ticks(start,stop,count){var reverse=stop<start;if(reverse){var _ref6=[stop,start];start=_ref6[0];stop=_ref6[1];}var interval=count&&typeof count.range==="function"?count:tickInterval(start,stop,count);var ticks=interval?interval.range(start,+stop+1):[];// inclusive stop +return reverse?ticks.reverse():ticks;}function tickInterval(start,stop,count){var target=Math.abs(stop-start)/count;var i=bisector(function(_ref){var _ref7=_slicedToArray(_ref,3),step=_ref7[2];return step;}).right(tickIntervals,target);if(i===tickIntervals.length)return year.every(tickStep(start/durationYear$1,stop/durationYear$1,count));if(i===0)return millisecond.every(Math.max(tickStep(start,stop,count),1));var _tickIntervals=_slicedToArray(tickIntervals[target/tickIntervals[i-1][2]<tickIntervals[i][2]/target?i-1:i],2),t=_tickIntervals[0],step=_tickIntervals[1];return t.every(step);}return[ticks,tickInterval];}var _ticker=ticker(utcYear,utcMonth,utcSunday,unixDay,utcHour,utcMinute),_ticker2=_slicedToArray(_ticker,2),utcTicks=_ticker2[0],utcTickInterval=_ticker2[1];var _ticker3=ticker(timeYear,timeMonth,timeSunday,timeDay,timeHour,timeMinute),_ticker4=_slicedToArray(_ticker3,2),timeTicks=_ticker4[0],timeTickInterval=_ticker4[1];var YEAR='year';var QUARTER='quarter';var MONTH='month';var WEEK='week';var DATE='date';var DAY='day';var DAYOFYEAR='dayofyear';var HOURS='hours';var MINUTES='minutes';var SECONDS='seconds';var MILLISECONDS='milliseconds';var TIME_UNITS=[YEAR,QUARTER,MONTH,WEEK,DATE,DAY,DAYOFYEAR,HOURS,MINUTES,SECONDS,MILLISECONDS];var UNITS=TIME_UNITS.reduce(function(o,u,i){return o[u]=1+i,o;},{});function timeUnits(units){var u=array$5(units).slice(),m={};// check validity +if(!u.length)error('Missing time unit.');u.forEach(function(unit){if(has$1(UNITS,unit)){m[unit]=1;}else{error("Invalid time unit: ".concat(unit,"."));}});var numTypes=(m[WEEK]||m[DAY]?1:0)+(m[QUARTER]||m[MONTH]||m[DATE]?1:0)+(m[DAYOFYEAR]?1:0);if(numTypes>1){error("Incompatible time units: ".concat(units));}// ensure proper sort order +u.sort(function(a,b){return UNITS[a]-UNITS[b];});return u;}var defaultSpecifiers=(_defaultSpecifiers={},_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defaultSpecifiers,YEAR,'%Y '),QUARTER,'Q%q '),MONTH,'%b '),DATE,'%d '),WEEK,'W%U '),DAY,'%a '),DAYOFYEAR,'%j '),HOURS,'%H:00'),MINUTES,'00:%M'),SECONDS,':%S'),_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defaultSpecifiers,MILLISECONDS,'.%L'),"".concat(YEAR,"-").concat(MONTH),'%Y-%m '),"".concat(YEAR,"-").concat(MONTH,"-").concat(DATE),'%Y-%m-%d '),"".concat(HOURS,"-").concat(MINUTES),'%H:%M'));function timeUnitSpecifier(units,specifiers){var s=extend$1({},defaultSpecifiers,specifiers),u=timeUnits(units),n=u.length;var fmt='',start=0,end,key;for(start=0;start<n;){for(end=u.length;end>start;--end){key=u.slice(start,end).join('-');if(s[key]!=null){fmt+=s[key];start=end;break;}}}return fmt.trim();}var t0$1=new Date();function localYear(y){t0$1.setFullYear(y);t0$1.setMonth(0);t0$1.setDate(1);t0$1.setHours(0,0,0,0);return t0$1;}function dayofyear(d){return localDayOfYear(new Date(d));}function week(d){return localWeekNum(new Date(d));}function localDayOfYear(d){return timeDay.count(localYear(d.getFullYear())-1,d);}function localWeekNum(d){return timeSunday.count(localYear(d.getFullYear())-1,d);}function localFirst(y){return localYear(y).getDay();}function localDate$1(y,m,d,H,M,S,L){if(0<=y&&y<100){var _date=new Date(-1,m,d,H,M,S,L);_date.setFullYear(y);return _date;}return new Date(y,m,d,H,M,S,L);}function utcdayofyear(d){return utcDayOfYear(new Date(d));}function utcweek(d){return utcWeekNum(new Date(d));}function utcDayOfYear(d){var y=Date.UTC(d.getUTCFullYear(),0,1);return utcDay.count(y-1,d);}function utcWeekNum(d){var y=Date.UTC(d.getUTCFullYear(),0,1);return utcSunday.count(y-1,d);}function utcFirst(y){t0$1.setTime(Date.UTC(y,0,1));return t0$1.getUTCDay();}function utcDate$1(y,m,d,H,M,S,L){if(0<=y&&y<100){var _date2=new Date(Date.UTC(-1,m,d,H,M,S,L));_date2.setUTCFullYear(d.y);return _date2;}return new Date(Date.UTC(y,m,d,H,M,S,L));}function floor(units,step,get,inv,newDate){var s=step||1,b=peek$1(units),_=function _(unit,p,key){key=key||unit;return getUnit(get[key],inv[key],unit===b&&s,p);};var t=new Date(),u=toSet(units),y=u[YEAR]?_(YEAR):constant$5(2012),m=u[MONTH]?_(MONTH):u[QUARTER]?_(QUARTER):zero$3,d=u[WEEK]&&u[DAY]?_(DAY,1,WEEK+DAY):u[WEEK]?_(WEEK,1):u[DAY]?_(DAY,1):u[DATE]?_(DATE,1):u[DAYOFYEAR]?_(DAYOFYEAR,1):one$2,H=u[HOURS]?_(HOURS):zero$3,M=u[MINUTES]?_(MINUTES):zero$3,S=u[SECONDS]?_(SECONDS):zero$3,L=u[MILLISECONDS]?_(MILLISECONDS):zero$3;return function(v){t.setTime(+v);var year=y(t);return newDate(year,m(t),d(t,year),H(t),M(t),S(t),L(t));};}function getUnit(f,inv,step,phase){var u=step<=1?f:phase?function(d,y){return phase+step*Math.floor((f(d,y)-phase)/step);}:function(d,y){return step*Math.floor(f(d,y)/step);};return inv?function(d,y){return inv(u(d,y),y);}:u;}// returns the day of the year based on week number, day of week, +// and the day of the week for the first day of the year +function weekday(week,day,firstDay){return day+week*7-(firstDay+6)%7;}// -- LOCAL TIME -- +var localGet=(_localGet={},_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_localGet,YEAR,function(d){return d.getFullYear();}),QUARTER,function(d){return Math.floor(d.getMonth()/3);}),MONTH,function(d){return d.getMonth();}),DATE,function(d){return d.getDate();}),HOURS,function(d){return d.getHours();}),MINUTES,function(d){return d.getMinutes();}),SECONDS,function(d){return d.getSeconds();}),MILLISECONDS,function(d){return d.getMilliseconds();}),DAYOFYEAR,function(d){return localDayOfYear(d);}),WEEK,function(d){return localWeekNum(d);}),_defineProperty(_defineProperty(_localGet,WEEK+DAY,function(d,y){return weekday(localWeekNum(d),d.getDay(),localFirst(y));}),DAY,function(d,y){return weekday(1,d.getDay(),localFirst(y));}));var localInv=_defineProperty(_defineProperty({},QUARTER,function(q){return 3*q;}),WEEK,function(w,y){return weekday(w,0,localFirst(y));});function timeFloor(units,step){return floor(units,step||1,localGet,localInv,localDate$1);}// -- UTC TIME -- +var utcGet=(_utcGet={},_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_utcGet,YEAR,function(d){return d.getUTCFullYear();}),QUARTER,function(d){return Math.floor(d.getUTCMonth()/3);}),MONTH,function(d){return d.getUTCMonth();}),DATE,function(d){return d.getUTCDate();}),HOURS,function(d){return d.getUTCHours();}),MINUTES,function(d){return d.getUTCMinutes();}),SECONDS,function(d){return d.getUTCSeconds();}),MILLISECONDS,function(d){return d.getUTCMilliseconds();}),DAYOFYEAR,function(d){return utcDayOfYear(d);}),WEEK,function(d){return utcWeekNum(d);}),_defineProperty(_defineProperty(_utcGet,DAY,function(d,y){return weekday(1,d.getUTCDay(),utcFirst(y));}),WEEK+DAY,function(d,y){return weekday(utcWeekNum(d),d.getUTCDay(),utcFirst(y));}));var utcInv=_defineProperty(_defineProperty({},QUARTER,function(q){return 3*q;}),WEEK,function(w,y){return weekday(w,0,utcFirst(y));});function utcFloor(units,step){return floor(units,step||1,utcGet,utcInv,utcDate$1);}var timeIntervals=(_timeIntervals={},_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_timeIntervals,YEAR,timeYear),QUARTER,timeMonth.every(3)),MONTH,timeMonth),WEEK,timeSunday),DATE,timeDay),DAY,timeDay),DAYOFYEAR,timeDay),HOURS,timeHour),MINUTES,timeMinute),SECONDS,second),_defineProperty(_timeIntervals,MILLISECONDS,millisecond));var utcIntervals=(_utcIntervals={},_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_utcIntervals,YEAR,utcYear),QUARTER,utcMonth.every(3)),MONTH,utcMonth),WEEK,utcSunday),DATE,utcDay),DAY,utcDay),DAYOFYEAR,utcDay),HOURS,utcHour),MINUTES,utcMinute),SECONDS,second),_defineProperty(_utcIntervals,MILLISECONDS,millisecond));function timeInterval(unit){return timeIntervals[unit];}function utcInterval(unit){return utcIntervals[unit];}function offset$3(ival,date,step){return ival?ival.offset(date,step):undefined;}function timeOffset(unit,date,step){return offset$3(timeInterval(unit),date,step);}function utcOffset(unit,date,step){return offset$3(utcInterval(unit),date,step);}function sequence$1(ival,start,stop,step){return ival?ival.range(start,stop,step):undefined;}function timeSequence(unit,start,stop,step){return sequence$1(timeInterval(unit),start,stop,step);}function utcSequence(unit,start,stop,step){return sequence$1(utcInterval(unit),start,stop,step);}var durationSecond=1000,durationMinute=durationSecond*60,durationHour=durationMinute*60,durationDay=durationHour*24,durationWeek=durationDay*7,durationMonth=durationDay*30,durationYear=durationDay*365;var Milli=[YEAR,MONTH,DATE,HOURS,MINUTES,SECONDS,MILLISECONDS],Seconds=Milli.slice(0,-1),Minutes=Seconds.slice(0,-1),Hours=Minutes.slice(0,-1),Day=Hours.slice(0,-1),Week=[YEAR,WEEK],Month=[YEAR,MONTH],Year=[YEAR];var intervals=[[Seconds,1,durationSecond],[Seconds,5,5*durationSecond],[Seconds,15,15*durationSecond],[Seconds,30,30*durationSecond],[Minutes,1,durationMinute],[Minutes,5,5*durationMinute],[Minutes,15,15*durationMinute],[Minutes,30,30*durationMinute],[Hours,1,durationHour],[Hours,3,3*durationHour],[Hours,6,6*durationHour],[Hours,12,12*durationHour],[Day,1,durationDay],[Week,1,durationWeek],[Month,1,durationMonth],[Month,3,3*durationMonth],[Year,1,durationYear]];function bin$1(opt){var ext=opt.extent,max=opt.maxbins||40,target=Math.abs(span(ext))/max;var i=bisector(function(i){return i[2];}).right(intervals,target),units,step;if(i===intervals.length){units=Year,step=tickStep(ext[0]/durationYear,ext[1]/durationYear,max);}else if(i){i=intervals[target/intervals[i-1][2]<intervals[i][2]/target?i-1:i];units=i[0];step=i[1];}else{units=Milli;step=Math.max(tickStep(ext[0],ext[1],max),1);}return{units:units,step:step};}function localDate(d){if(0<=d.y&&d.y<100){var date=new Date(-1,d.m,d.d,d.H,d.M,d.S,d.L);date.setFullYear(d.y);return date;}return new Date(d.y,d.m,d.d,d.H,d.M,d.S,d.L);}function utcDate(d){if(0<=d.y&&d.y<100){var date=new Date(Date.UTC(-1,d.m,d.d,d.H,d.M,d.S,d.L));date.setUTCFullYear(d.y);return date;}return new Date(Date.UTC(d.y,d.m,d.d,d.H,d.M,d.S,d.L));}function newDate(y,m,d){return{y:y,m:m,d:d,H:0,M:0,S:0,L:0};}function formatLocale(locale){var locale_dateTime=locale.dateTime,locale_date=locale.date,locale_time=locale.time,locale_periods=locale.periods,locale_weekdays=locale.days,locale_shortWeekdays=locale.shortDays,locale_months=locale.months,locale_shortMonths=locale.shortMonths;var periodRe=formatRe(locale_periods),periodLookup=formatLookup(locale_periods),weekdayRe=formatRe(locale_weekdays),weekdayLookup=formatLookup(locale_weekdays),shortWeekdayRe=formatRe(locale_shortWeekdays),shortWeekdayLookup=formatLookup(locale_shortWeekdays),monthRe=formatRe(locale_months),monthLookup=formatLookup(locale_months),shortMonthRe=formatRe(locale_shortMonths),shortMonthLookup=formatLookup(locale_shortMonths);var formats={"a":formatShortWeekday,"A":formatWeekday,"b":formatShortMonth,"B":formatMonth,"c":null,"d":formatDayOfMonth,"e":formatDayOfMonth,"f":formatMicroseconds,"g":formatYearISO,"G":formatFullYearISO,"H":formatHour24,"I":formatHour12,"j":formatDayOfYear,"L":formatMilliseconds,"m":formatMonthNumber,"M":formatMinutes,"p":formatPeriod,"q":formatQuarter,"Q":formatUnixTimestamp,"s":formatUnixTimestampSeconds,"S":formatSeconds,"u":formatWeekdayNumberMonday,"U":formatWeekNumberSunday,"V":formatWeekNumberISO,"w":formatWeekdayNumberSunday,"W":formatWeekNumberMonday,"x":null,"X":null,"y":formatYear,"Y":formatFullYear,"Z":formatZone,"%":formatLiteralPercent};var utcFormats={"a":formatUTCShortWeekday,"A":formatUTCWeekday,"b":formatUTCShortMonth,"B":formatUTCMonth,"c":null,"d":formatUTCDayOfMonth,"e":formatUTCDayOfMonth,"f":formatUTCMicroseconds,"g":formatUTCYearISO,"G":formatUTCFullYearISO,"H":formatUTCHour24,"I":formatUTCHour12,"j":formatUTCDayOfYear,"L":formatUTCMilliseconds,"m":formatUTCMonthNumber,"M":formatUTCMinutes,"p":formatUTCPeriod,"q":formatUTCQuarter,"Q":formatUnixTimestamp,"s":formatUnixTimestampSeconds,"S":formatUTCSeconds,"u":formatUTCWeekdayNumberMonday,"U":formatUTCWeekNumberSunday,"V":formatUTCWeekNumberISO,"w":formatUTCWeekdayNumberSunday,"W":formatUTCWeekNumberMonday,"x":null,"X":null,"y":formatUTCYear,"Y":formatUTCFullYear,"Z":formatUTCZone,"%":formatLiteralPercent};var parses={"a":parseShortWeekday,"A":parseWeekday,"b":parseShortMonth,"B":parseMonth,"c":parseLocaleDateTime,"d":parseDayOfMonth,"e":parseDayOfMonth,"f":parseMicroseconds,"g":parseYear,"G":parseFullYear,"H":parseHour24,"I":parseHour24,"j":parseDayOfYear,"L":parseMilliseconds,"m":parseMonthNumber,"M":parseMinutes,"p":parsePeriod,"q":parseQuarter,"Q":parseUnixTimestamp,"s":parseUnixTimestampSeconds,"S":parseSeconds,"u":parseWeekdayNumberMonday,"U":parseWeekNumberSunday,"V":parseWeekNumberISO,"w":parseWeekdayNumberSunday,"W":parseWeekNumberMonday,"x":parseLocaleDate,"X":parseLocaleTime,"y":parseYear,"Y":parseFullYear,"Z":parseZone,"%":parseLiteralPercent};// These recursive directive definitions must be deferred. +formats.x=newFormat(locale_date,formats);formats.X=newFormat(locale_time,formats);formats.c=newFormat(locale_dateTime,formats);utcFormats.x=newFormat(locale_date,utcFormats);utcFormats.X=newFormat(locale_time,utcFormats);utcFormats.c=newFormat(locale_dateTime,utcFormats);function newFormat(specifier,formats){return function(date){var string=[],i=-1,j=0,n=specifier.length,c,pad,format;if(!(date instanceof Date))date=new Date(+date);while(++i<n){if(specifier.charCodeAt(i)===37){string.push(specifier.slice(j,i));if((pad=pads[c=specifier.charAt(++i)])!=null)c=specifier.charAt(++i);else pad=c==="e"?" ":"0";if(format=formats[c])c=format(date,pad);string.push(c);j=i+1;}}string.push(specifier.slice(j,i));return string.join("");};}function newParse(specifier,Z){return function(string){var d=newDate(1900,undefined,1),i=parseSpecifier(d,specifier,string+="",0),week,day;if(i!=string.length)return null;// If a UNIX timestamp is specified, return it. +if("Q"in d)return new Date(d.Q);if("s"in d)return new Date(d.s*1000+("L"in d?d.L:0));// If this is utcParse, never use the local timezone. +if(Z&&!("Z"in d))d.Z=0;// The am-pm flag is 0 for AM, and 1 for PM. +if("p"in d)d.H=d.H%12+d.p*12;// If the month was not specified, inherit from the quarter. +if(d.m===undefined)d.m="q"in d?d.q:0;// Convert day-of-week and week-of-year to day-of-year. +if("V"in d){if(d.V<1||d.V>53)return null;if(!("w"in d))d.w=1;if("Z"in d){week=utcDate(newDate(d.y,0,1)),day=week.getUTCDay();week=day>4||day===0?utcMonday.ceil(week):utcMonday(week);week=utcDay.offset(week,(d.V-1)*7);d.y=week.getUTCFullYear();d.m=week.getUTCMonth();d.d=week.getUTCDate()+(d.w+6)%7;}else{week=localDate(newDate(d.y,0,1)),day=week.getDay();week=day>4||day===0?timeMonday.ceil(week):timeMonday(week);week=timeDay.offset(week,(d.V-1)*7);d.y=week.getFullYear();d.m=week.getMonth();d.d=week.getDate()+(d.w+6)%7;}}else if("W"in d||"U"in d){if(!("w"in d))d.w="u"in d?d.u%7:"W"in d?1:0;day="Z"in d?utcDate(newDate(d.y,0,1)).getUTCDay():localDate(newDate(d.y,0,1)).getDay();d.m=0;d.d="W"in d?(d.w+6)%7+d.W*7-(day+5)%7:d.w+d.U*7-(day+6)%7;}// If a time zone is specified, all fields are interpreted as UTC and then +// offset according to the specified time zone. +if("Z"in d){d.H+=d.Z/100|0;d.M+=d.Z%100;return utcDate(d);}// Otherwise, all fields are in local time. +return localDate(d);};}function parseSpecifier(d,specifier,string,j){var i=0,n=specifier.length,m=string.length,c,parse;while(i<n){if(j>=m)return-1;c=specifier.charCodeAt(i++);if(c===37){c=specifier.charAt(i++);parse=parses[c in pads?specifier.charAt(i++):c];if(!parse||(j=parse(d,string,j))<0)return-1;}else if(c!=string.charCodeAt(j++)){return-1;}}return j;}function parsePeriod(d,string,i){var n=periodRe.exec(string.slice(i));return n?(d.p=periodLookup.get(n[0].toLowerCase()),i+n[0].length):-1;}function parseShortWeekday(d,string,i){var n=shortWeekdayRe.exec(string.slice(i));return n?(d.w=shortWeekdayLookup.get(n[0].toLowerCase()),i+n[0].length):-1;}function parseWeekday(d,string,i){var n=weekdayRe.exec(string.slice(i));return n?(d.w=weekdayLookup.get(n[0].toLowerCase()),i+n[0].length):-1;}function parseShortMonth(d,string,i){var n=shortMonthRe.exec(string.slice(i));return n?(d.m=shortMonthLookup.get(n[0].toLowerCase()),i+n[0].length):-1;}function parseMonth(d,string,i){var n=monthRe.exec(string.slice(i));return n?(d.m=monthLookup.get(n[0].toLowerCase()),i+n[0].length):-1;}function parseLocaleDateTime(d,string,i){return parseSpecifier(d,locale_dateTime,string,i);}function parseLocaleDate(d,string,i){return parseSpecifier(d,locale_date,string,i);}function parseLocaleTime(d,string,i){return parseSpecifier(d,locale_time,string,i);}function formatShortWeekday(d){return locale_shortWeekdays[d.getDay()];}function formatWeekday(d){return locale_weekdays[d.getDay()];}function formatShortMonth(d){return locale_shortMonths[d.getMonth()];}function formatMonth(d){return locale_months[d.getMonth()];}function formatPeriod(d){return locale_periods[+(d.getHours()>=12)];}function formatQuarter(d){return 1+~~(d.getMonth()/3);}function formatUTCShortWeekday(d){return locale_shortWeekdays[d.getUTCDay()];}function formatUTCWeekday(d){return locale_weekdays[d.getUTCDay()];}function formatUTCShortMonth(d){return locale_shortMonths[d.getUTCMonth()];}function formatUTCMonth(d){return locale_months[d.getUTCMonth()];}function formatUTCPeriod(d){return locale_periods[+(d.getUTCHours()>=12)];}function formatUTCQuarter(d){return 1+~~(d.getUTCMonth()/3);}return{format:function format(specifier){var f=newFormat(specifier+="",formats);f.toString=function(){return specifier;};return f;},parse:function parse(specifier){var p=newParse(specifier+="",false);p.toString=function(){return specifier;};return p;},utcFormat:function utcFormat(specifier){var f=newFormat(specifier+="",utcFormats);f.toString=function(){return specifier;};return f;},utcParse:function utcParse(specifier){var p=newParse(specifier+="",true);p.toString=function(){return specifier;};return p;}};}var pads={"-":"","_":" ","0":"0"},numberRe=/^\s*\d+/,// note: ignores next directive +percentRe=/^%/,requoteRe=/[\\^$*+?|[\]().{}]/g;function pad(value,fill,width){var sign=value<0?"-":"",string=(sign?-value:value)+"",length=string.length;return sign+(length<width?new Array(width-length+1).join(fill)+string:string);}function requote(s){return s.replace(requoteRe,"\\$&");}function formatRe(names){return new RegExp("^(?:"+names.map(requote).join("|")+")","i");}function formatLookup(names){return new Map(names.map(function(name,i){return[name.toLowerCase(),i];}));}function parseWeekdayNumberSunday(d,string,i){var n=numberRe.exec(string.slice(i,i+1));return n?(d.w=+n[0],i+n[0].length):-1;}function parseWeekdayNumberMonday(d,string,i){var n=numberRe.exec(string.slice(i,i+1));return n?(d.u=+n[0],i+n[0].length):-1;}function parseWeekNumberSunday(d,string,i){var n=numberRe.exec(string.slice(i,i+2));return n?(d.U=+n[0],i+n[0].length):-1;}function parseWeekNumberISO(d,string,i){var n=numberRe.exec(string.slice(i,i+2));return n?(d.V=+n[0],i+n[0].length):-1;}function parseWeekNumberMonday(d,string,i){var n=numberRe.exec(string.slice(i,i+2));return n?(d.W=+n[0],i+n[0].length):-1;}function parseFullYear(d,string,i){var n=numberRe.exec(string.slice(i,i+4));return n?(d.y=+n[0],i+n[0].length):-1;}function parseYear(d,string,i){var n=numberRe.exec(string.slice(i,i+2));return n?(d.y=+n[0]+(+n[0]>68?1900:2000),i+n[0].length):-1;}function parseZone(d,string,i){var n=/^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(string.slice(i,i+6));return n?(d.Z=n[1]?0:-(n[2]+(n[3]||"00")),i+n[0].length):-1;}function parseQuarter(d,string,i){var n=numberRe.exec(string.slice(i,i+1));return n?(d.q=n[0]*3-3,i+n[0].length):-1;}function parseMonthNumber(d,string,i){var n=numberRe.exec(string.slice(i,i+2));return n?(d.m=n[0]-1,i+n[0].length):-1;}function parseDayOfMonth(d,string,i){var n=numberRe.exec(string.slice(i,i+2));return n?(d.d=+n[0],i+n[0].length):-1;}function parseDayOfYear(d,string,i){var n=numberRe.exec(string.slice(i,i+3));return n?(d.m=0,d.d=+n[0],i+n[0].length):-1;}function parseHour24(d,string,i){var n=numberRe.exec(string.slice(i,i+2));return n?(d.H=+n[0],i+n[0].length):-1;}function parseMinutes(d,string,i){var n=numberRe.exec(string.slice(i,i+2));return n?(d.M=+n[0],i+n[0].length):-1;}function parseSeconds(d,string,i){var n=numberRe.exec(string.slice(i,i+2));return n?(d.S=+n[0],i+n[0].length):-1;}function parseMilliseconds(d,string,i){var n=numberRe.exec(string.slice(i,i+3));return n?(d.L=+n[0],i+n[0].length):-1;}function parseMicroseconds(d,string,i){var n=numberRe.exec(string.slice(i,i+6));return n?(d.L=Math.floor(n[0]/1000),i+n[0].length):-1;}function parseLiteralPercent(d,string,i){var n=percentRe.exec(string.slice(i,i+1));return n?i+n[0].length:-1;}function parseUnixTimestamp(d,string,i){var n=numberRe.exec(string.slice(i));return n?(d.Q=+n[0],i+n[0].length):-1;}function parseUnixTimestampSeconds(d,string,i){var n=numberRe.exec(string.slice(i));return n?(d.s=+n[0],i+n[0].length):-1;}function formatDayOfMonth(d,p){return pad(d.getDate(),p,2);}function formatHour24(d,p){return pad(d.getHours(),p,2);}function formatHour12(d,p){return pad(d.getHours()%12||12,p,2);}function formatDayOfYear(d,p){return pad(1+timeDay.count(timeYear(d),d),p,3);}function formatMilliseconds(d,p){return pad(d.getMilliseconds(),p,3);}function formatMicroseconds(d,p){return formatMilliseconds(d,p)+"000";}function formatMonthNumber(d,p){return pad(d.getMonth()+1,p,2);}function formatMinutes(d,p){return pad(d.getMinutes(),p,2);}function formatSeconds(d,p){return pad(d.getSeconds(),p,2);}function formatWeekdayNumberMonday(d){var day=d.getDay();return day===0?7:day;}function formatWeekNumberSunday(d,p){return pad(timeSunday.count(timeYear(d)-1,d),p,2);}function dISO(d){var day=d.getDay();return day>=4||day===0?timeThursday(d):timeThursday.ceil(d);}function formatWeekNumberISO(d,p){d=dISO(d);return pad(timeThursday.count(timeYear(d),d)+(timeYear(d).getDay()===4),p,2);}function formatWeekdayNumberSunday(d){return d.getDay();}function formatWeekNumberMonday(d,p){return pad(timeMonday.count(timeYear(d)-1,d),p,2);}function formatYear(d,p){return pad(d.getFullYear()%100,p,2);}function formatYearISO(d,p){d=dISO(d);return pad(d.getFullYear()%100,p,2);}function formatFullYear(d,p){return pad(d.getFullYear()%10000,p,4);}function formatFullYearISO(d,p){var day=d.getDay();d=day>=4||day===0?timeThursday(d):timeThursday.ceil(d);return pad(d.getFullYear()%10000,p,4);}function formatZone(d){var z=d.getTimezoneOffset();return(z>0?"-":(z*=-1,"+"))+pad(z/60|0,"0",2)+pad(z%60,"0",2);}function formatUTCDayOfMonth(d,p){return pad(d.getUTCDate(),p,2);}function formatUTCHour24(d,p){return pad(d.getUTCHours(),p,2);}function formatUTCHour12(d,p){return pad(d.getUTCHours()%12||12,p,2);}function formatUTCDayOfYear(d,p){return pad(1+utcDay.count(utcYear(d),d),p,3);}function formatUTCMilliseconds(d,p){return pad(d.getUTCMilliseconds(),p,3);}function formatUTCMicroseconds(d,p){return formatUTCMilliseconds(d,p)+"000";}function formatUTCMonthNumber(d,p){return pad(d.getUTCMonth()+1,p,2);}function formatUTCMinutes(d,p){return pad(d.getUTCMinutes(),p,2);}function formatUTCSeconds(d,p){return pad(d.getUTCSeconds(),p,2);}function formatUTCWeekdayNumberMonday(d){var dow=d.getUTCDay();return dow===0?7:dow;}function formatUTCWeekNumberSunday(d,p){return pad(utcSunday.count(utcYear(d)-1,d),p,2);}function UTCdISO(d){var day=d.getUTCDay();return day>=4||day===0?utcThursday(d):utcThursday.ceil(d);}function formatUTCWeekNumberISO(d,p){d=UTCdISO(d);return pad(utcThursday.count(utcYear(d),d)+(utcYear(d).getUTCDay()===4),p,2);}function formatUTCWeekdayNumberSunday(d){return d.getUTCDay();}function formatUTCWeekNumberMonday(d,p){return pad(utcMonday.count(utcYear(d)-1,d),p,2);}function formatUTCYear(d,p){return pad(d.getUTCFullYear()%100,p,2);}function formatUTCYearISO(d,p){d=UTCdISO(d);return pad(d.getUTCFullYear()%100,p,2);}function formatUTCFullYear(d,p){return pad(d.getUTCFullYear()%10000,p,4);}function formatUTCFullYearISO(d,p){var day=d.getUTCDay();d=day>=4||day===0?utcThursday(d):utcThursday.ceil(d);return pad(d.getUTCFullYear()%10000,p,4);}function formatUTCZone(){return"+0000";}function formatLiteralPercent(){return"%";}function formatUnixTimestamp(d){return+d;}function formatUnixTimestampSeconds(d){return Math.floor(+d/1000);}var locale$1;var timeFormat$1;var timeParse$1;var utcFormat$1;var utcParse$1;defaultLocale$1({dateTime:"%x, %X",date:"%-m/%-d/%Y",time:"%-I:%M:%S %p",periods:["AM","PM"],days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],shortDays:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],shortMonths:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]});function defaultLocale$1(definition){locale$1=formatLocale(definition);timeFormat$1=locale$1.format;timeParse$1=locale$1.parse;utcFormat$1=locale$1.utcFormat;utcParse$1=locale$1.utcParse;return locale$1;}function memoize(method){var cache={};return function(spec){return cache[spec]||(cache[spec]=method(spec));};}function trimZeroes(numberFormat,decimalChar){return function(x){var str=numberFormat(x),dec=str.indexOf(decimalChar);if(dec<0)return str;var idx=rightmostDigit(str,dec);var end=idx<str.length?str.slice(idx):'';while(--idx>dec)if(str[idx]!=='0'){++idx;break;}return str.slice(0,idx)+end;};}function rightmostDigit(str,dec){var i=str.lastIndexOf('e'),c;if(i>0)return i;for(i=str.length;--i>dec;){c=str.charCodeAt(i);if(c>=48&&c<=57)return i+1;// is digit +}}function numberLocale(locale){var format=memoize(locale.format),formatPrefix=locale.formatPrefix;return{format:format,formatPrefix:formatPrefix,formatFloat:function formatFloat(spec){var s=formatSpecifier(spec||',');if(s.precision==null){s.precision=12;switch(s.type){case'%':s.precision-=2;break;case'e':s.precision-=1;break;}return trimZeroes(format(s),// number format +format('.1f')(1)[1]// decimal point character +);}else{return format(s);}},formatSpan:function formatSpan(start,stop,count,specifier){specifier=formatSpecifier(specifier==null?',f':specifier);var step=tickStep(start,stop,count),value=Math.max(Math.abs(start),Math.abs(stop));var precision;if(specifier.precision==null){switch(specifier.type){case's':{if(!isNaN(precision=precisionPrefix(step,value))){specifier.precision=precision;}return formatPrefix(specifier,value);}case'':case'e':case'g':case'p':case'r':{if(!isNaN(precision=precisionRound(step,value))){specifier.precision=precision-(specifier.type==='e');}break;}case'f':case'%':{if(!isNaN(precision=precisionFixed(step))){specifier.precision=precision-(specifier.type==='%')*2;}break;}}}return format(specifier);}};}var defaultNumberLocale;resetNumberFormatDefaultLocale();function resetNumberFormatDefaultLocale(){return defaultNumberLocale=numberLocale({format:format$3,formatPrefix:formatPrefix});}function numberFormatLocale(definition){return numberLocale(formatLocale$1(definition));}function numberFormatDefaultLocale(definition){return arguments.length?defaultNumberLocale=numberFormatLocale(definition):defaultNumberLocale;}function timeMultiFormat(format,interval,spec){spec=spec||{};if(!isObject(spec)){error("Invalid time multi-format specifier: ".concat(spec));}var second=interval(SECONDS),minute=interval(MINUTES),hour=interval(HOURS),day=interval(DATE),week=interval(WEEK),month=interval(MONTH),quarter=interval(QUARTER),year=interval(YEAR),L=format(spec[MILLISECONDS]||'.%L'),S=format(spec[SECONDS]||':%S'),M=format(spec[MINUTES]||'%I:%M'),H=format(spec[HOURS]||'%I %p'),d=format(spec[DATE]||spec[DAY]||'%a %d'),w=format(spec[WEEK]||'%b %d'),m=format(spec[MONTH]||'%B'),q=format(spec[QUARTER]||'%B'),y=format(spec[YEAR]||'%Y');return function(date){return(second(date)<date?L:minute(date)<date?S:hour(date)<date?M:day(date)<date?H:month(date)<date?week(date)<date?d:w:year(date)<date?quarter(date)<date?m:q:y)(date);};}function timeLocale(locale){var _timeFormat=memoize(locale.format),_utcFormat=memoize(locale.utcFormat);return{timeFormat:function timeFormat(spec){return isString(spec)?_timeFormat(spec):timeMultiFormat(_timeFormat,timeInterval,spec);},utcFormat:function utcFormat(spec){return isString(spec)?_utcFormat(spec):timeMultiFormat(_utcFormat,utcInterval,spec);},timeParse:memoize(locale.parse),utcParse:memoize(locale.utcParse)};}var defaultTimeLocale;resetTimeFormatDefaultLocale();function resetTimeFormatDefaultLocale(){return defaultTimeLocale=timeLocale({format:timeFormat$1,parse:timeParse$1,utcFormat:utcFormat$1,utcParse:utcParse$1});}function timeFormatLocale(definition){return timeLocale(formatLocale(definition));}function timeFormatDefaultLocale(definition){return arguments.length?defaultTimeLocale=timeFormatLocale(definition):defaultTimeLocale;}var createLocale=function createLocale(number,time){return extend$1({},number,time);};function locale(numberSpec,timeSpec){var number=numberSpec?numberFormatLocale(numberSpec):numberFormatDefaultLocale();var time=timeSpec?timeFormatLocale(timeSpec):timeFormatDefaultLocale();return createLocale(number,time);}function defaultLocale(numberSpec,timeSpec){var args=arguments.length;if(args&&args!==2){error('defaultLocale expects either zero or two arguments.');}return args?createLocale(numberFormatDefaultLocale(numberSpec),timeFormatDefaultLocale(timeSpec)):createLocale(numberFormatDefaultLocale(),timeFormatDefaultLocale());}function resetDefaultLocale(){resetNumberFormatDefaultLocale();resetTimeFormatDefaultLocale();return defaultLocale();}// Matches absolute URLs with optional protocol +// https://... file://... //... +var protocol_re=/^(data:|([A-Za-z]+:)?\/\/)/;// Matches allowed URIs. From https://github.com/cure53/DOMPurify/blob/master/src/regexp.js with added file:// +var allowed_re=/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|cid|xmpp|file|data):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i;// eslint-disable-line no-useless-escape +var whitespace_re=/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205f\u3000]/g;// eslint-disable-line no-control-regex +// Special treatment in node.js for the file: protocol +var fileProtocol='file://';/** + * Factory for a loader constructor that provides methods for requesting + * files from either the network or disk, and for sanitizing request URIs. + * @param {function} fetch - The Fetch API for HTTP network requests. + * If null or undefined, HTTP loading will be disabled. + * @param {object} fs - The file system interface for file loading. + * If null or undefined, local file loading will be disabled. + * @return {function} A loader constructor with the following signature: + * param {object} [options] - Optional default loading options to use. + * return {object} - A new loader instance. + */function loaderFactory(fetch,fs){return function(options){return{options:options||{},sanitize:sanitize,load:load$1,fileAccess:false,file:fileLoader(),http:httpLoader(fetch)};};}/** + * Load an external resource, typically either from the web or from the local + * filesystem. This function uses {@link sanitize} to first sanitize the uri, + * then calls either {@link http} (for web requests) or {@link file} (for + * filesystem loading). + * @param {string} uri - The resource indicator (e.g., URL or filename). + * @param {object} [options] - Optional loading options. These options will + * override any existing default options. + * @return {Promise} - A promise that resolves to the loaded content. + */function load$1(_x5,_x6){return _load$.apply(this,arguments);}/** + * URI sanitizer function. + * @param {string} uri - The uri (url or filename) to check. + * @param {object} options - An options hash. + * @return {Promise} - A promise that resolves to an object containing + * sanitized uri data, or rejects it the input uri is deemed invalid. + * The properties of the resolved object are assumed to be + * valid attributes for an HTML 'a' tag. The sanitized uri *must* be + * provided by the 'href' property of the returned object. + */function _load$(){_load$=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee3(uri,options){var opt,url;return _regenerator().w(function(_context10){while(1)switch(_context10.n){case 0:_context10.n=1;return this.sanitize(uri,options);case 1:opt=_context10.v;url=opt.href;return _context10.a(2,opt.localFile?this.file(url):this.http(url,options));}},_callee3,this);}));return _load$.apply(this,arguments);}function sanitize(_x7,_x8){return _sanitize.apply(this,arguments);}/** + * File system loader factory. + * @param {object} fs - The file system interface. + * @return {function} - A file loader with the following signature: + * param {string} filename - The file system path to load. + * param {string} filename - The file system path to load. + * return {Promise} A promise that resolves to the file contents. + */function _sanitize(){_sanitize=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee4(uri,options){var fileAccess,result,isFile,loadFile,base,isAllowed,hasProtocol;return _regenerator().w(function(_context11){while(1)switch(_context11.n){case 0:options=extend$1({},this.options,options);fileAccess=this.fileAccess,result={href:null};isAllowed=allowed_re.test(uri.replace(whitespace_re,''));if(uri==null||typeof uri!=='string'||!isAllowed){error('Sanitize failure, invalid URI: '+$(uri));}hasProtocol=protocol_re.test(uri);// if relative url (no protocol/host), prepend baseURL +if((base=options.baseURL)&&!hasProtocol){// Ensure that there is a slash between the baseURL (e.g. hostname) and url +if(!uri.startsWith('/')&&!base.endsWith('/')){uri='/'+uri;}uri=base+uri;}// should we load from file system? +loadFile=(isFile=uri.startsWith(fileProtocol))||options.mode==='file'||options.mode!=='http'&&!hasProtocol&&fileAccess;if(isFile){// strip file protocol +uri=uri.slice(fileProtocol.length);}else if(uri.startsWith('//')){if(options.defaultProtocol==='file'){// if is file, strip protocol and set loadFile flag +uri=uri.slice(2);loadFile=true;}else{// if relative protocol (starts with '//'), prepend default protocol +uri=(options.defaultProtocol||'http')+':'+uri;}}// set non-enumerable mode flag to indicate local file load +Object.defineProperty(result,'localFile',{value:!!loadFile});// set uri +result.href=uri;// set default result target, if specified +if(options.target){result.target=options.target+'';}// set default result rel, if specified (#1542) +if(options.rel){result.rel=options.rel+'';}// provide control over cross-origin image handling (#2238) +// https://developer.mozilla.org/en-US/docs/Web/HTML/CORS_enabled_image +if(options.context==='image'&&options.crossOrigin){result.crossOrigin=options.crossOrigin+'';}// return +return _context11.a(2,result);}},_callee4,this);}));return _sanitize.apply(this,arguments);}function fileLoader(fs){return fileReject;}/** + * Default file system loader that simply rejects. + */function fileReject(){return _fileReject.apply(this,arguments);}/** + * HTTP request handler factory. + * @param {function} fetch - The Fetch API method. + * @return {function} - An http loader with the following signature: + * param {string} url - The url to request. + * param {object} options - An options hash. + * return {Promise} - A promise that resolves to the file contents. + */function _fileReject(){_fileReject=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee5(){return _regenerator().w(function(_context12){while(1)switch(_context12.n){case 0:error('No file system access.');case 1:return _context12.a(2);}},_callee5);}));return _fileReject.apply(this,arguments);}function httpLoader(fetch){return fetch?(/*#__PURE__*/function(){var _ref8=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(url,options){var opt,type,response;return _regenerator().w(function(_context3){while(1)switch(_context3.n){case 0:opt=extend$1({},this.options.http,options);type=options&&options.response;_context3.n=1;return fetch(url,opt);case 1:response=_context3.v;return _context3.a(2,!response.ok?error(response.status+''+response.statusText):isFunction(response[type])?response[type]():response.text());}},_callee,this);}));return function(_x9,_x0){return _ref8.apply(this,arguments);};}()):httpReject;}/** + * Default http request handler that simply rejects. + */function httpReject(){return _httpReject.apply(this,arguments);}function _httpReject(){_httpReject=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee6(){return _regenerator().w(function(_context13){while(1)switch(_context13.n){case 0:error('No HTTP fetch method available.');case 1:return _context13.a(2);}},_callee6);}));return _httpReject.apply(this,arguments);}var isValid=function isValid(_){return _!=null&&_===_;};var isBoolean=function isBoolean(_){return _==='true'||_==='false'||_===true||_===false;};var isDate=function isDate(_){return!Number.isNaN(Date.parse(_));};var isNumber=function isNumber(_){return!Number.isNaN(+_)&&!(_ instanceof Date);};var isInteger=function isInteger(_){return isNumber(_)&&Number.isInteger(+_);};var typeParsers={"boolean":toBoolean,integer:toNumber,number:toNumber,date:_toDate,string:toString,unknown:identity$6};var typeTests=[isBoolean,isInteger,isNumber,isDate];var typeList=['boolean','integer','number','date'];function inferType(values,field){if(!values||!values.length)return'unknown';var n=values.length,m=typeTests.length,a=typeTests.map(function(_,i){return i+1;});for(var i=0,t=0,j,_value14;i<n;++i){_value14=field?values[i][field]:values[i];for(j=0;j<m;++j){if(a[j]&&isValid(_value14)&&!typeTests[j](_value14)){a[j]=0;++t;if(t===typeTests.length)return'string';}}}return typeList[a.reduce(function(u,v){return u===0?v:u;},0)-1];}function inferTypes(data,fields){return fields.reduce(function(types,field){types[field]=inferType(data,field);return types;},{});}function delimitedFormat(delimiter){var parse=function parse(data,format){var delim={delimiter:delimiter};return dsv(data,format?extend$1(format,delim):delim);};parse.responseType='text';return parse;}function dsv(data,format){if(format.header){data=format.header.map($).join(format.delimiter)+'\n'+data;}return dsvFormat(format.delimiter).parse(data+'');}dsv.responseType='text';function isBuffer(_){return typeof Buffer==='function'&&isFunction(Buffer.isBuffer)?Buffer.isBuffer(_):false;}function json(data,format){var prop=format&&format.property?field$1(format.property):identity$6;return isObject(data)&&!isBuffer(data)?parseJSON(prop(data),format):prop(JSON.parse(data));}json.responseType='json';function parseJSON(data,format){if(!isArray(data)&&isIterable(data)){data=_toConsumableArray(data);}return format&&format.copy?JSON.parse(JSON.stringify(data)):data;}var filters={interior:function interior(a,b){return a!==b;},exterior:function exterior(a,b){return a===b;}};function topojson(data,format){var method,object,property,filter;data=json(data,format);if(format&&format.feature){method=feature;property=format.feature;}else if(format&&format.mesh){method=mesh;property=format.mesh;filter=filters[format.filter];}else{error('Missing TopoJSON feature or mesh parameter.');}object=(object=data.objects[property])?method(data,object,filter):error('Invalid TopoJSON object: '+property);return object&&object.features||[object];}topojson.responseType='json';var format$2={dsv:dsv,csv:delimitedFormat(','),tsv:delimitedFormat('\t'),json:json,topojson:topojson};function formats$1(name,reader){if(arguments.length>1){format$2[name]=reader;return this;}else{return has$1(format$2,name)?format$2[name]:null;}}function responseType(type){var f=formats$1(type);return f&&f.responseType||'text';}function read(data,schema,timeParser,utcParser){schema=schema||{};var reader=formats$1(schema.type||'json');if(!reader)error('Unknown data format type: '+schema.type);data=reader(data,schema);if(schema.parse)parse$6(data,schema.parse,timeParser,utcParser);if(has$1(data,'columns'))delete data.columns;return data;}function parse$6(data,types,timeParser,utcParser){if(!data.length)return;// early exit for empty data +var locale=timeFormatDefaultLocale();timeParser=timeParser||locale.timeParse;utcParser=utcParser||locale.utcParse;var fields=data.columns||Object.keys(data[0]),datum,field,i,j,n,m;if(types==='auto')types=inferTypes(data,fields);fields=Object.keys(types);var parsers=fields.map(function(field){var type=types[field];var parts,pattern;if(type&&(type.startsWith('date:')||type.startsWith('utc:'))){parts=type.split(/:(.+)?/,2);// split on first : +pattern=parts[1];if(pattern[0]==='\''&&pattern[pattern.length-1]==='\''||pattern[0]==='"'&&pattern[pattern.length-1]==='"'){pattern=pattern.slice(1,-1);}var _parse=parts[0]==='utc'?utcParser:timeParser;return _parse(pattern);}if(!typeParsers[type]){throw Error('Illegal format pattern: '+field+':'+type);}return typeParsers[type];});for(i=0,n=data.length,m=fields.length;i<n;++i){datum=data[i];for(j=0;j<m;++j){field=fields[j];datum[field]=parsers[j](datum[field]);}}}var loader=loaderFactory(typeof fetch!=='undefined'&&fetch);function UniqueList(idFunc){var $=idFunc||identity$6,list=[],ids={};list.add=function(_){var id=$(_);if(!ids[id]){ids[id]=1;list.push(_);}return list;};list.remove=function(_){var id=$(_);if(ids[id]){ids[id]=0;var idx=list.indexOf(_);if(idx>=0)list.splice(idx,1);}return list;};return list;}/** + * Invoke and await a potentially async callback function. If + * an error occurs, trap it and route to Dataflow.error. + * @param {Dataflow} df - The dataflow instance + * @param {function} callback - A callback function to invoke + * and then await. The dataflow will be passed as the single + * argument to the function. + */function asyncCallback(_x10,_x11){return _asyncCallback.apply(this,arguments);}function _asyncCallback(){_asyncCallback=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee7(df,callback){var _t10;return _regenerator().w(function(_context14){while(1)switch(_context14.p=_context14.n){case 0:_context14.p=0;_context14.n=1;return callback(df);case 1:_context14.n=3;break;case 2:_context14.p=2;_t10=_context14.v;df.error(_t10);case 3:return _context14.a(2);}},_callee7,null,[[0,2]]);}));return _asyncCallback.apply(this,arguments);}var TUPLE_ID_KEY=Symbol('vega_id');var TUPLE_ID=1;/** + * Checks if an input value is a registered tuple. + * @param {*} t - The value to check. + * @return {boolean} True if the input is a tuple, false otherwise. + */function isTuple(t){return!!(t&&tupleid(t));}/** + * Returns the id of a tuple. + * @param {object} t - The input tuple. + * @return {*} the tuple id. + */function tupleid(t){return t[TUPLE_ID_KEY];}/** + * Sets the id of a tuple. + * @param {object} t - The input tuple. + * @param {*} id - The id value to set. + * @return {object} the input tuple. + */function setid(t,id){t[TUPLE_ID_KEY]=id;return t;}/** + * Ingest an object or value as a data tuple. + * If the input value is an object, an id field will be added to it. For + * efficiency, the input object is modified directly. A copy is not made. + * If the input value is a literal, it will be wrapped in a new object + * instance, with the value accessible as the 'data' property. + * @param datum - The value to ingest. + * @return {object} The ingested data tuple. + */function ingest$1(datum){var t=datum===Object(datum)?datum:{data:datum};return tupleid(t)?t:setid(t,TUPLE_ID++);}/** + * Given a source tuple, return a derived copy. + * @param {object} t - The source tuple. + * @return {object} The derived tuple. + */function derive(t){return rederive(t,ingest$1({}));}/** + * Rederive a derived tuple by copying values from the source tuple. + * @param {object} t - The source tuple. + * @param {object} d - The derived tuple. + * @return {object} The derived tuple. + */function rederive(t,d){for(var k in t)d[k]=t[k];return d;}/** + * Replace an existing tuple with a new tuple. + * @param {object} t - The existing data tuple. + * @param {object} d - The new tuple that replaces the old. + * @return {object} The new tuple. + */function replace$1(t,d){return setid(d,tupleid(t));}/** + * Generate an augmented comparator function that provides stable + * sorting by tuple id when the given comparator produces ties. + * @param {function} cmp - The comparator to augment. + * @param {function} [f] - Optional tuple accessor function. + * @return {function} An augmented comparator function. + */function stableCompare(cmp,f){return!cmp?null:f?function(a,b){return cmp(a,b)||tupleid(f(a))-tupleid(f(b));}:function(a,b){return cmp(a,b)||tupleid(a)-tupleid(b);};}function isChangeSet(v){return v&&v.constructor===changeset;}function changeset(){var add=[],// insert tuples +rem=[],// remove tuples +mod=[],// modify tuples +remp=[],// remove by predicate +modp=[];// modify by predicate +var _clean=null,_reflow=false;return{constructor:changeset,insert:function insert(t){var d=array$5(t),n=d.length;for(var i=0;i<n;++i)add.push(d[i]);return this;},remove:function remove(t){var a=isFunction(t)?remp:rem,d=array$5(t),n=d.length;for(var i=0;i<n;++i)a.push(d[i]);return this;},modify:function modify(t,field,value){var m={field:field,value:constant$5(value)};if(isFunction(t)){m.filter=t;modp.push(m);}else{m.tuple=t;mod.push(m);}return this;},encode:function encode(t,set){if(isFunction(t))modp.push({filter:t,field:set});else mod.push({tuple:t,field:set});return this;},clean:function clean(value){_clean=value;return this;},reflow:function reflow(){_reflow=true;return this;},pulse:function pulse(_pulse,tuples){var cur={},out={};var i,n,m,f,t,id;// build lookup table of current tuples +for(i=0,n=tuples.length;i<n;++i){cur[tupleid(tuples[i])]=1;}// process individual tuples to remove +for(i=0,n=rem.length;i<n;++i){t=rem[i];cur[tupleid(t)]=-1;}// process predicate-based removals +for(i=0,n=remp.length;i<n;++i){f=remp[i];tuples.forEach(function(t){if(f(t))cur[tupleid(t)]=-1;});}// process all add tuples +for(i=0,n=add.length;i<n;++i){t=add[i];id=tupleid(t);if(cur[id]){// tuple already resides in dataset +// if flagged for both add and remove, cancel +cur[id]=1;}else{// tuple does not reside in dataset, add +_pulse.add.push(ingest$1(add[i]));}}// populate pulse rem list +for(i=0,n=tuples.length;i<n;++i){t=tuples[i];if(cur[tupleid(t)]<0)_pulse.rem.push(t);}// modify helper method +function modify(t,f,v){if(v){t[f]=v(t);}else{_pulse.encode=f;}if(!_reflow)out[tupleid(t)]=t;}// process individual tuples to modify +for(i=0,n=mod.length;i<n;++i){m=mod[i];t=m.tuple;f=m.field;id=cur[tupleid(t)];if(id>0){modify(t,f,m.value);_pulse.modifies(f);}}// process predicate-based modifications +for(i=0,n=modp.length;i<n;++i){m=modp[i];f=m.filter;tuples.forEach(function(t){if(f(t)&&cur[tupleid(t)]>0){modify(t,m.field,m.value);}});_pulse.modifies(m.field);}// upon reflow request, populate mod with all non-removed tuples +// otherwise, populate mod with modified tuples only +if(_reflow){_pulse.mod=rem.length||remp.length?tuples.filter(function(t){return cur[tupleid(t)]>0;}):tuples.slice();}else{for(id in out)_pulse.mod.push(out[id]);}// set pulse garbage collection request +if(_clean||_clean==null&&(rem.length||remp.length)){_pulse.clean(true);}return _pulse;}};}var CACHE='_:mod:_';/** + * Hash that tracks modifications to assigned values. + * Callers *must* use the set method to update values. + */function Parameters(){Object.defineProperty(this,CACHE,{writable:true,value:{}});}Parameters.prototype={/** + * Set a parameter value. If the parameter value changes, the parameter + * will be recorded as modified. + * @param {string} name - The parameter name. + * @param {number} index - The index into an array-value parameter. Ignored if + * the argument is undefined, null or less than zero. + * @param {*} value - The parameter value to set. + * @param {boolean} [force=false] - If true, records the parameter as modified + * even if the value is unchanged. + * @return {Parameters} - This parameter object. + */set:function set(name,index,value,force){var o=this,v=o[name],mod=o[CACHE];if(index!=null&&index>=0){if(v[index]!==value||force){v[index]=value;mod[index+':'+name]=-1;mod[name]=-1;}}else if(v!==value||force){o[name]=value;mod[name]=isArray(value)?1+value.length:-1;}return o;},/** + * Tests if one or more parameters has been modified. If invoked with no + * arguments, returns true if any parameter value has changed. If the first + * argument is array, returns trues if any parameter name in the array has + * changed. Otherwise, tests if the given name and optional array index has + * changed. + * @param {string} name - The parameter name to test. + * @param {number} [index=undefined] - The parameter array index to test. + * @return {boolean} - Returns true if a queried parameter was modified. + */modified:function modified(name,index){var mod=this[CACHE];if(!arguments.length){for(var k in mod){if(mod[k])return true;}return false;}else if(isArray(name)){for(var _k=0;_k<name.length;++_k){if(mod[name[_k]])return true;}return false;}return index!=null&&index>=0?index+1<mod[name]||!!mod[index+':'+name]:!!mod[name];},/** + * Clears the modification records. After calling this method, + * all parameters are considered unmodified. + */clear:function clear(){this[CACHE]={};return this;}};var OP_ID=0;var PULSE='pulse',NO_PARAMS=new Parameters();// Boolean Flags +var SKIP$1$1=1,MODIFIED=2;/** + * An Operator is a processing node in a dataflow graph. + * Each operator stores a value and an optional value update function. + * Operators can accept a hash of named parameters. Parameter values can + * either be direct (JavaScript literals, arrays, objects) or indirect + * (other operators whose values will be pulled dynamically). Operators + * included as parameters will have this operator added as a dependency. + * @constructor + * @param {*} [init] - The initial value for this operator. + * @param {function(object, Pulse)} [update] - An update function. Upon + * evaluation of this operator, the update function will be invoked and the + * return value will be used as the new value of this operator. + * @param {object} [params] - The parameters for this operator. + * @param {boolean} [react=true] - Flag indicating if this operator should + * listen for changes to upstream operators included as parameters. + * @see parameters + */function Operator(init,update,params,react){this.id=++OP_ID;this.value=init;this.stamp=-1;this.rank=-1;this.qrank=-1;this.flags=0;if(update){this._update=update;}if(params)this.parameters(params,react);}function flag(bit){return function(state){var f=this.flags;if(arguments.length===0)return!!(f&bit);this.flags=state?f|bit:f&~bit;return this;};}Operator.prototype={/** + * Returns a list of target operators dependent on this operator. + * If this list does not exist, it is created and then returned. + * @return {UniqueList} + */targets:function targets(){return this._targets||(this._targets=UniqueList(id));},/** + * Sets the value of this operator. + * @param {*} value - the value to set. + * @return {Number} Returns 1 if the operator value has changed + * according to strict equality, returns 0 otherwise. + */set:function set(value){if(this.value!==value){this.value=value;return 1;}else{return 0;}},/** + * Indicates that operator evaluation should be skipped on the next pulse. + * This operator will still propagate incoming pulses, but its update function + * will not be invoked. The skip flag is reset after every pulse, so calling + * this method will affect processing of the next pulse only. + */skip:flag(SKIP$1$1),/** + * Indicates that this operator's value has been modified on its most recent + * pulse. Normally modification is checked via strict equality; however, in + * some cases it is more efficient to update the internal state of an object. + * In those cases, the modified flag can be used to trigger propagation. Once + * set, the modification flag persists across pulses until unset. The flag can + * be used with the last timestamp to test if a modification is recent. + */modified:flag(MODIFIED),/** + * Sets the parameters for this operator. The parameter values are analyzed for + * operator instances. If found, this operator will be added as a dependency + * of the parameterizing operator. Operator values are dynamically marshalled + * from each operator parameter prior to evaluation. If a parameter value is + * an array, the array will also be searched for Operator instances. However, + * the search does not recurse into sub-arrays or object properties. + * @param {object} params - A hash of operator parameters. + * @param {boolean} [react=true] - A flag indicating if this operator should + * automatically update (react) when parameter values change. In other words, + * this flag determines if the operator registers itself as a listener on + * any upstream operators included in the parameters. + * @param {boolean} [initonly=false] - A flag indicating if this operator + * should calculate an update only upon its initial evaluation, then + * deregister dependencies and suppress all future update invocations. + * @return {Operator[]} - An array of upstream dependencies. + */parameters:function parameters(params,react,initonly){var _this3=this;react=react!==false;var argval=this._argval=this._argval||new Parameters(),argops=this._argops=this._argops||[],deps=[];var name,value,n,i;var add=function add(name,index,value){if(value instanceof Operator){if(value!==_this3){if(react)value.targets().add(_this3);deps.push(value);}argops.push({op:value,name:name,index:index});}else{argval.set(name,index,value);}};for(name in params){value=params[name];if(name===PULSE){array$5(value).forEach(function(op){if(!(op instanceof Operator)){error('Pulse parameters must be operator instances.');}else if(op!==_this3){op.targets().add(_this3);deps.push(op);}});this.source=value;}else if(isArray(value)){argval.set(name,-1,Array(n=value.length));for(i=0;i<n;++i)add(name,i,value[i]);}else{add(name,-1,value);}}this.marshall().clear();// initialize values +if(initonly)argops.initonly=true;return deps;},/** + * Internal method for marshalling parameter values. + * Visits each operator dependency to pull the latest value. + * @return {Parameters} A Parameters object to pass to the update function. + */marshall:function marshall(stamp){var argval=this._argval||NO_PARAMS,argops=this._argops;var item,i,op,mod;if(argops){var n=argops.length;for(i=0;i<n;++i){item=argops[i];op=item.op;mod=op.modified()&&op.stamp===stamp;argval.set(item.name,item.index,op.value,mod);}if(argops.initonly){for(i=0;i<n;++i){item=argops[i];item.op.targets().remove(this);}this._argops=null;this._update=null;}}return argval;},/** + * Detach this operator from the dataflow. + * Unregisters listeners on upstream dependencies. + */detach:function detach(){var argops=this._argops;var i,n,item,op;if(argops){for(i=0,n=argops.length;i<n;++i){item=argops[i];op=item.op;if(op._targets){op._targets.remove(this);}}}// remove references to the source and pulse object, +// if present, to prevent memory leaks of old data. +this.pulse=null;this.source=null;},/** + * Delegate method to perform operator processing. + * Subclasses can override this method to perform custom processing. + * By default, it marshalls parameters and calls the update function + * if that function is defined. If the update function does not + * change the operator value then StopPropagation is returned. + * If no update function is defined, this method does nothing. + * @param {Pulse} pulse - the current dataflow pulse. + * @return The output pulse or StopPropagation. A falsy return value + * (including undefined) will let the input pulse pass through. + */evaluate:function evaluate(pulse){var update=this._update;if(update){var _params=this.marshall(pulse.stamp),v=update.call(this,_params,pulse);_params.clear();if(v!==this.value){this.value=v;}else if(!this.modified()){return pulse.StopPropagation;}}},/** + * Run this operator for the current pulse. If this operator has already + * been run at (or after) the pulse timestamp, returns StopPropagation. + * Internally, this method calls {@link evaluate} to perform processing. + * If {@link evaluate} returns a falsy value, the input pulse is returned. + * This method should NOT be overridden, instead overrride {@link evaluate}. + * @param {Pulse} pulse - the current dataflow pulse. + * @return the output pulse for this operator (or StopPropagation) + */run:function run(pulse){if(pulse.stamp<this.stamp)return pulse.StopPropagation;var rv;if(this.skip()){this.skip(false);rv=0;}else{rv=this.evaluate(pulse);}return this.pulse=rv||pulse;}};/** + * Add an operator to the dataflow graph. This function accepts a + * variety of input argument types. The basic signature supports an + * initial value, update function and parameters. If the first parameter + * is an Operator instance, it will be added directly. If it is a + * constructor for an Operator subclass, a new instance will be instantiated. + * Otherwise, if the first parameter is a function instance, it will be used + * as the update function and a null initial value is assumed. + * @param {*} init - One of: the operator to add, the initial value of + * the operator, an operator class to instantiate, or an update function. + * @param {function} [update] - The operator update function. + * @param {object} [params] - The operator parameters. + * @param {boolean} [react=true] - Flag indicating if this operator should + * listen for changes to upstream operators included as parameters. + * @return {Operator} - The added operator. + */function add$3(init,update,params,react){var shift=1,op;if(init instanceof Operator){op=init;}else if(init&&init.prototype instanceof Operator){op=new init();}else if(isFunction(init)){op=new Operator(null,init);}else{shift=0;op=new Operator(init,update);}this.rank(op);if(shift){react=params;params=update;}if(params)this.connect(op,op.parameters(params,react));this.touch(op);return op;}/** + * Connect a target operator as a dependent of source operators. + * If necessary, this method will rerank the target operator and its + * dependents to ensure propagation proceeds in a topologically sorted order. + * @param {Operator} target - The target operator. + * @param {Array<Operator>} - The source operators that should propagate + * to the target operator. + */function connect(target,sources){var targetRank=target.rank,n=sources.length;for(var i=0;i<n;++i){if(targetRank<sources[i].rank){this.rerank(target);return;}}}var STREAM_ID=0;/** + * Models an event stream. + * @constructor + * @param {function(Object, number): boolean} [filter] - Filter predicate. + * Events pass through when truthy, events are suppressed when falsy. + * @param {function(Object): *} [apply] - Applied to input events to produce + * new event values. + * @param {function(Object)} [receive] - Event callback function to invoke + * upon receipt of a new event. Use to override standard event processing. + */function EventStream(filter,apply,receive){this.id=++STREAM_ID;this.value=null;if(receive)this.receive=receive;if(filter)this._filter=filter;if(apply)this._apply=apply;}/** + * Creates a new event stream instance with the provided + * (optional) filter, apply and receive functions. + * @param {function(Object, number): boolean} [filter] - Filter predicate. + * Events pass through when truthy, events are suppressed when falsy. + * @param {function(Object): *} [apply] - Applied to input events to produce + * new event values. + * @see EventStream + */function stream(filter,apply,receive){return new EventStream(filter,apply,receive);}EventStream.prototype={_filter:truthy,_apply:identity$6,targets:function targets(){return this._targets||(this._targets=UniqueList(id));},consume:function consume(_){if(!arguments.length)return!!this._consume;this._consume=!!_;return this;},receive:function receive(evt){if(this._filter(evt)){var val=this.value=this._apply(evt),trg=this._targets,n=trg?trg.length:0;for(var i=0;i<n;++i)trg[i].receive(val);if(this._consume){evt.preventDefault();evt.stopPropagation();}}},filter:function filter(_filter){var s=stream(_filter);this.targets().add(s);return s;},apply:function apply(_apply){var s=stream(null,_apply);this.targets().add(s);return s;},merge:function merge(){var s=stream();this.targets().add(s);for(var i=0,n=arguments.length;i<n;++i){arguments[i].targets().add(s);}return s;},throttle:function throttle(pause){var t=-1;return this.filter(function(){var now=Date.now();if(now-t>pause){t=now;return 1;}else{return 0;}});},debounce:function debounce(delay){var s=stream();this.targets().add(stream(null,null,_debounce(delay,function(e){var df=e.dataflow;s.receive(e);if(df&&df.run)df.run();})));return s;},between:function between(a,b){var active=false;a.targets().add(stream(null,null,function(){return active=true;}));b.targets().add(stream(null,null,function(){return active=false;}));return this.filter(function(){return active;});},detach:function detach(){// ensures compatibility with operators (#2753) +// remove references to other streams and filter functions that may +// be bound to subcontexts that need to be garbage collected. +this._filter=truthy;this._targets=null;}};/** + * Create a new event stream from an event source. + * @param {object} source - The event source to monitor. The input must + * support the addEventListener method. + * @param {string} type - The event type. + * @param {function(object): boolean} [filter] - Event filter function. + * @param {function(object): *} [apply] - Event application function. + * If provided, this function will be invoked and the result will be + * used as the downstream event value. + * @return {EventStream} + */function events$1(source,type,filter,apply){var df=this,s=stream(filter,apply),send=function send(e){e.dataflow=df;try{s.receive(e);}catch(error){df.error(error);}finally{df.run();}};var sources;if(typeof source==='string'&&typeof document!=='undefined'){sources=document.querySelectorAll(source);}else{sources=array$5(source);}var n=sources.length;for(var i=0;i<n;++i){sources[i].addEventListener(type,send);}return s;}function parse$5(data,format){var locale=this.locale();return read(data,format,locale.timeParse,locale.utcParse);}/** + * Ingests new data into the dataflow. First parses the data using the + * vega-loader read method, then pulses a changeset to the target operator. + * @param {Operator} target - The Operator to target with ingested data, + * typically a Collect transform instance. + * @param {*} data - The input data, prior to parsing. For JSON this may + * be a string or an object. For CSV, TSV, etc should be a string. + * @param {object} format - The data format description for parsing + * loaded data. This object is passed to the vega-loader read method. + * @returns {Dataflow} + */function ingest(target,data,format){data=this.parse(data,format);return this.pulse(target,this.changeset().insert(data));}/** + * Request data from an external source, parse it, and return a Promise. + * @param {string} url - The URL from which to load the data. This string + * is passed to the vega-loader load method. + * @param {object} [format] - The data format description for parsing + * loaded data. This object is passed to the vega-loader read method. + * @return {Promise} A Promise that resolves upon completion of the request. + * The resolved object contains the following properties: + * - data: an array of parsed data (or null upon error) + * - status: a code for success (0), load fail (-1), or parse fail (-2) + */function request(_x12,_x13){return _request.apply(this,arguments);}function _request(){_request=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee8(url,format){var df,status,data,_t11;return _regenerator().w(function(_context15){while(1)switch(_context15.p=_context15.n){case 0:df=this;status=0;_context15.p=1;_context15.n=2;return df.loader().load(url,{context:'dataflow',response:responseType(format&&format.type)});case 2:data=_context15.v;try{data=df.parse(data,format);}catch(err){status=-2;df.warn('Data ingestion failed',url,err);}_context15.n=4;break;case 3:_context15.p=3;_t11=_context15.v;status=-1;df.warn('Loading failed',url,_t11);case 4:return _context15.a(2,{data:data,status:status});}},_callee8,this,[[1,3]]);}));return _request.apply(this,arguments);}function preload(_x14,_x15,_x16){return _preload.apply(this,arguments);}function _preload(){_preload=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee9(target,url,format){var df,pending,res;return _regenerator().w(function(_context16){while(1)switch(_context16.n){case 0:df=this,pending=df._pending||loadPending(df);pending.requests+=1;_context16.n=1;return df.request(url,format);case 1:res=_context16.v;df.pulse(target,df.changeset().remove(truthy).insert(res.data||[]));pending.done();return _context16.a(2,res);}},_callee9,this);}));return _preload.apply(this,arguments);}function loadPending(df){var accept;var pending=new Promise(function(a){return accept=a;});pending.requests=0;pending.done=function(){if(--pending.requests===0){df._pending=null;accept(df);}};return df._pending=pending;}var SKIP$2={skip:true};/** + * Perform operator updates in response to events. Applies an + * update function to compute a new operator value. If the update function + * returns a {@link ChangeSet}, the operator will be pulsed with those tuple + * changes. Otherwise, the operator value will be updated to the return value. + * @param {EventStream|Operator} source - The event source to react to. + * This argument can be either an EventStream or an Operator. + * @param {Operator|function(object):Operator} target - The operator to update. + * This argument can either be an Operator instance or (if the source + * argument is an EventStream), a function that accepts an event object as + * input and returns an Operator to target. + * @param {function(Parameters,Event): *} [update] - Optional update function + * to compute the new operator value, or a literal value to set. Update + * functions expect to receive a parameter object and event as arguments. + * This function can either return a new operator value or (if the source + * argument is an EventStream) a {@link ChangeSet} instance to pulse + * the target operator with tuple changes. + * @param {object} [params] - The update function parameters. + * @param {object} [options] - Additional options hash. If not overridden, + * updated operators will be skipped by default. + * @param {boolean} [options.skip] - If true, the operator will + * be skipped: it will not be evaluated, but its dependents will be. + * @param {boolean} [options.force] - If true, the operator will + * be re-evaluated even if its value has not changed. + * @return {Dataflow} + */function on(source,target,update,params,options){var fn=source instanceof Operator?onOperator:onStream;fn(this,source,target,update,params,options);return this;}function onStream(df,stream,target,update,params,options){var opt=extend$1({},options,SKIP$2);var func,op;if(!isFunction(target))target=constant$5(target);if(update===undefined){func=function func(e){return df.touch(target(e));};}else if(isFunction(update)){op=new Operator(null,update,params,false);func=function func(e){op.evaluate(e);var t=target(e),v=op.value;isChangeSet(v)?df.pulse(t,v,options):df.update(t,v,opt);};}else{func=function func(e){return df.update(target(e),update,opt);};}stream.apply(func);}function onOperator(df,source,target,update,params,options){if(update===undefined){source.targets().add(target);}else{var opt=options||{},op=new Operator(null,updater(target,update),params,false);op.modified(opt.force);op.rank=source.rank;// immediately follow source +source.targets().add(op);// add dependency +if(target){op.skip(true);// skip first invocation +op.value=target.value;// initialize value +op.targets().add(target);// chain dependencies +df.connect(target,[op]);// rerank as needed, #1672 +}}}function updater(target,update){update=isFunction(update)?update:constant$5(update);return target?function(_,pulse){var value=update(_,pulse);if(!target.skip()){target.skip(value!==this.value).value=value;}return value;}:update;}/** + * Assigns a rank to an operator. Ranks are assigned in increasing order + * by incrementing an internal rank counter. + * @param {Operator} op - The operator to assign a rank. + */function rank(op){op.rank=++this._rank;}/** + * Re-ranks an operator and all downstream target dependencies. This + * is necessary when upstream dependencies of higher rank are added to + * a target operator. + * @param {Operator} op - The operator to re-rank. + */function rerank(op){var queue=[op];var cur,list,i;while(queue.length){this.rank(cur=queue.pop());if(list=cur._targets){for(i=list.length;--i>=0;){queue.push(cur=list[i]);if(cur===op)error('Cycle detected in dataflow graph.');}}}}/** + * Sentinel value indicating pulse propagation should stop. + */var StopPropagation={};// Pulse visit type flags +var ADD=1<<0,REM=1<<1,MOD$1=1<<2,ADD_REM=ADD|REM,ADD_MOD=ADD|MOD$1,ALL=ADD|REM|MOD$1,REFLOW=1<<3,SOURCE=1<<4,NO_SOURCE=1<<5,NO_FIELDS=1<<6;/** + * A Pulse enables inter-operator communication during a run of the + * dataflow graph. In addition to the current timestamp, a pulse may also + * contain a change-set of added, removed or modified data tuples, as well as + * a pointer to a full backing data source. Tuple change sets may not + * be fully materialized; for example, to prevent needless array creation + * a change set may include larger arrays and corresponding filter functions. + * The pulse provides a {@link visit} method to enable proper and efficient + * iteration over requested data tuples. + * + * In addition, each pulse can track modification flags for data tuple fields. + * Responsible transform operators should call the {@link modifies} method to + * indicate changes to data fields. The {@link modified} method enables + * querying of this modification state. + * + * @constructor + * @param {Dataflow} dataflow - The backing dataflow instance. + * @param {number} stamp - The current propagation timestamp. + * @param {string} [encode] - An optional encoding set name, which is then + * accessible as Pulse.encode. Operators can respond to (or ignore) this + * setting as appropriate. This parameter can be used in conjunction with + * the Encode transform in the vega-encode module. + */function Pulse(dataflow,stamp,encode){this.dataflow=dataflow;this.stamp=stamp==null?-1:stamp;this.add=[];this.rem=[];this.mod=[];this.fields=null;this.encode=encode||null;}function _materialize(data,filter){var out=[];visitArray(data,filter,function(_){return out.push(_);});return out;}function filter$1(pulse,flags){var map={};pulse.visit(flags,function(t){map[tupleid(t)]=1;});return function(t){return map[tupleid(t)]?null:t;};}function addFilter(a,b){return a?function(t,i){return a(t,i)&&b(t,i);}:b;}Pulse.prototype={/** + * Sentinel value indicating pulse propagation should stop. + */StopPropagation:StopPropagation,/** + * Boolean flag indicating ADD (added) tuples. + */ADD:ADD,/** + * Boolean flag indicating REM (removed) tuples. + */REM:REM,/** + * Boolean flag indicating MOD (modified) tuples. + */MOD:MOD$1,/** + * Boolean flag indicating ADD (added) and REM (removed) tuples. + */ADD_REM:ADD_REM,/** + * Boolean flag indicating ADD (added) and MOD (modified) tuples. + */ADD_MOD:ADD_MOD,/** + * Boolean flag indicating ADD, REM and MOD tuples. + */ALL:ALL,/** + * Boolean flag indicating all tuples in a data source + * except for the ADD, REM and MOD tuples. + */REFLOW:REFLOW,/** + * Boolean flag indicating a 'pass-through' to a + * backing data source, ignoring ADD, REM and MOD tuples. + */SOURCE:SOURCE,/** + * Boolean flag indicating that source data should be + * suppressed when creating a forked pulse. + */NO_SOURCE:NO_SOURCE,/** + * Boolean flag indicating that field modifications should be + * suppressed when creating a forked pulse. + */NO_FIELDS:NO_FIELDS,/** + * Creates a new pulse based on the values of this pulse. + * The dataflow, time stamp and field modification values are copied over. + * By default, new empty ADD, REM and MOD arrays are created. + * @param {number} flags - Integer of boolean flags indicating which (if any) + * tuple arrays should be copied to the new pulse. The supported flag values + * are ADD, REM and MOD. Array references are copied directly: new array + * instances are not created. + * @return {Pulse} - The forked pulse instance. + * @see init + */fork:function fork(flags){return new Pulse(this.dataflow).init(this,flags);},/** + * Creates a copy of this pulse with new materialized array + * instances for the ADD, REM, MOD, and SOURCE arrays. + * The dataflow, time stamp and field modification values are copied over. + * @return {Pulse} - The cloned pulse instance. + * @see init + */clone:function clone(){var p=this.fork(ALL);p.add=p.add.slice();p.rem=p.rem.slice();p.mod=p.mod.slice();if(p.source)p.source=p.source.slice();return p.materialize(ALL|SOURCE);},/** + * Returns a pulse that adds all tuples from a backing source. This is + * useful for cases where operators are added to a dataflow after an + * upstream data pipeline has already been processed, ensuring that + * new operators can observe all tuples within a stream. + * @return {Pulse} - A pulse instance with all source tuples included + * in the add array. If the current pulse already has all source + * tuples in its add array, it is returned directly. If the current + * pulse does not have a backing source, it is returned directly. + */addAll:function addAll(){var p=this;var reuse=!p.source||p.add===p.rem// special case for indexed set (e.g., crossfilter) +||!p.rem.length&&p.source.length===p.add.length;if(reuse){return p;}else{p=new Pulse(this.dataflow).init(this);p.add=p.source;p.rem=[];// new operators can ignore rem #2769 +return p;}},/** + * Initialize this pulse based on the values of another pulse. This method + * is used internally by {@link fork} to initialize a new forked tuple. + * The dataflow, time stamp and field modification values are copied over. + * By default, new empty ADD, REM and MOD arrays are created. + * @param {Pulse} src - The source pulse to copy from. + * @param {number} flags - Integer of boolean flags indicating which (if any) + * tuple arrays should be copied to the new pulse. The supported flag values + * are ADD, REM and MOD. Array references are copied directly: new array + * instances are not created. By default, source data arrays are copied + * to the new pulse. Use the NO_SOURCE flag to enforce a null source. + * @return {Pulse} - Returns this Pulse instance. + */init:function init(src,flags){var p=this;p.stamp=src.stamp;p.encode=src.encode;if(src.fields&&!(flags&NO_FIELDS)){p.fields=src.fields;}if(flags&ADD){p.addF=src.addF;p.add=src.add;}else{p.addF=null;p.add=[];}if(flags&REM){p.remF=src.remF;p.rem=src.rem;}else{p.remF=null;p.rem=[];}if(flags&MOD$1){p.modF=src.modF;p.mod=src.mod;}else{p.modF=null;p.mod=[];}if(flags&NO_SOURCE){p.srcF=null;p.source=null;}else{p.srcF=src.srcF;p.source=src.source;if(src.cleans)p.cleans=src.cleans;}return p;},/** + * Schedules a function to run after pulse propagation completes. + * @param {function} func - The function to run. + */runAfter:function runAfter(func){this.dataflow.runAfter(func);},/** + * Indicates if tuples have been added, removed or modified. + * @param {number} [flags] - The tuple types (ADD, REM or MOD) to query. + * Defaults to ALL, returning true if any tuple type has changed. + * @return {boolean} - Returns true if one or more queried tuple types have + * changed, false otherwise. + */changed:function changed(flags){var f=flags||ALL;return f&ADD&&this.add.length||f&REM&&this.rem.length||f&MOD$1&&this.mod.length;},/** + * Forces a "reflow" of tuple values, such that all tuples in the backing + * source are added to the MOD set, unless already present in the ADD set. + * @param {boolean} [fork=false] - If true, returns a forked copy of this + * pulse, and invokes reflow on that derived pulse. + * @return {Pulse} - The reflowed pulse instance. + */reflow:function reflow(fork){if(fork)return this.fork(ALL).reflow();var len=this.add.length,src=this.source&&this.source.length;if(src&&src!==len){this.mod=this.source;if(len)this.filter(MOD$1,filter$1(this,ADD));}return this;},/** + * Get/set metadata to pulse requesting garbage collection + * to reclaim currently unused resources. + */clean:function clean(value){if(arguments.length){this.cleans=!!value;return this;}else{return this.cleans;}},/** + * Marks one or more data field names as modified to assist dependency + * tracking and incremental processing by transform operators. + * @param {string|Array<string>} _ - The field(s) to mark as modified. + * @return {Pulse} - This pulse instance. + */modifies:function modifies(_){var hash=this.fields||(this.fields={});if(isArray(_)){_.forEach(function(f){return hash[f]=true;});}else{hash[_]=true;}return this;},/** + * Checks if one or more data fields have been modified during this pulse + * propagation timestamp. + * @param {string|Array<string>} _ - The field(s) to check for modified. + * @param {boolean} nomod - If true, will check the modified flag even if + * no mod tuples exist. If false (default), mod tuples must be present. + * @return {boolean} - Returns true if any of the provided fields has been + * marked as modified, false otherwise. + */modified:function modified(_,nomod){var fields=this.fields;return!((nomod||this.mod.length)&&fields)?false:!arguments.length?!!fields:isArray(_)?_.some(function(f){return fields[f];}):fields[_];},/** + * Adds a filter function to one more tuple sets. Filters are applied to + * backing tuple arrays, to determine the actual set of tuples considered + * added, removed or modified. They can be used to delay materialization of + * a tuple set in order to avoid expensive array copies. In addition, the + * filter functions can serve as value transformers: unlike standard predicate + * function (which return boolean values), Pulse filters should return the + * actual tuple value to process. If a tuple set is already filtered, the + * new filter function will be appended into a conjuntive ('and') query. + * @param {number} flags - Flags indicating the tuple set(s) to filter. + * @param {function(*):object} filter - Filter function that will be applied + * to the tuple set array, and should return a data tuple if the value + * should be included in the tuple set, and falsy (or null) otherwise. + * @return {Pulse} - Returns this pulse instance. + */filter:function filter(flags,_filter2){var p=this;if(flags&ADD)p.addF=addFilter(p.addF,_filter2);if(flags&REM)p.remF=addFilter(p.remF,_filter2);if(flags&MOD$1)p.modF=addFilter(p.modF,_filter2);if(flags&SOURCE)p.srcF=addFilter(p.srcF,_filter2);return p;},/** + * Materialize one or more tuple sets in this pulse. If the tuple set(s) have + * a registered filter function, it will be applied and the tuple set(s) will + * be replaced with materialized tuple arrays. + * @param {number} flags - Flags indicating the tuple set(s) to materialize. + * @return {Pulse} - Returns this pulse instance. + */materialize:function materialize(flags){flags=flags||ALL;var p=this;if(flags&ADD&&p.addF){p.add=_materialize(p.add,p.addF);p.addF=null;}if(flags&REM&&p.remF){p.rem=_materialize(p.rem,p.remF);p.remF=null;}if(flags&MOD$1&&p.modF){p.mod=_materialize(p.mod,p.modF);p.modF=null;}if(flags&SOURCE&&p.srcF){p.source=p.source.filter(p.srcF);p.srcF=null;}return p;},/** + * Visit one or more tuple sets in this pulse. + * @param {number} flags - Flags indicating the tuple set(s) to visit. + * Legal values are ADD, REM, MOD and SOURCE (if a backing data source + * has been set). + * @param {function(object):*} - Visitor function invoked per-tuple. + * @return {Pulse} - Returns this pulse instance. + */visit:function visit(flags,visitor){var p=this,v=visitor;if(flags&SOURCE){visitArray(p.source,p.srcF,v);return p;}if(flags&ADD)visitArray(p.add,p.addF,v);if(flags&REM)visitArray(p.rem,p.remF,v);if(flags&MOD$1)visitArray(p.mod,p.modF,v);var src=p.source;if(flags&REFLOW&&src){var _sum=p.add.length+p.mod.length;if(_sum===src.length);else if(_sum){visitArray(src,filter$1(p,ADD_MOD),v);}else{// if no add/rem/mod tuples, visit source +visitArray(src,p.srcF,v);}}return p;}};/** + * Represents a set of multiple pulses. Used as input for operators + * that accept multiple pulses at a time. Contained pulses are + * accessible via the public "pulses" array property. This pulse doe + * not carry added, removed or modified tuples directly. However, + * the visit method can be used to traverse all such tuples contained + * in sub-pulses with a timestamp matching this parent multi-pulse. + * @constructor + * @param {Dataflow} dataflow - The backing dataflow instance. + * @param {number} stamp - The timestamp. + * @param {Array<Pulse>} pulses - The sub-pulses for this multi-pulse. + */function MultiPulse(dataflow,stamp,pulses,encode){var p=this;var c=0;this.dataflow=dataflow;this.stamp=stamp;this.fields=null;this.encode=encode||null;this.pulses=pulses;var _iterator16=_createForOfIteratorHelper(pulses),_step16;try{for(_iterator16.s();!(_step16=_iterator16.n()).done;){var _pulse2=_step16.value;if(_pulse2.stamp!==stamp)continue;if(_pulse2.fields){var hash=p.fields||(p.fields={});for(var f in _pulse2.fields){hash[f]=1;}}if(_pulse2.changed(p.ADD))c|=p.ADD;if(_pulse2.changed(p.REM))c|=p.REM;if(_pulse2.changed(p.MOD))c|=p.MOD;}}catch(err){_iterator16.e(err);}finally{_iterator16.f();}this.changes=c;}inherits(MultiPulse,Pulse,{/** + * Creates a new pulse based on the values of this pulse. + * The dataflow, time stamp and field modification values are copied over. + * @return {Pulse} + */fork:function fork(flags){var p=new Pulse(this.dataflow).init(this,flags&this.NO_FIELDS);if(flags!==undefined){if(flags&p.ADD)this.visit(p.ADD,function(t){return p.add.push(t);});if(flags&p.REM)this.visit(p.REM,function(t){return p.rem.push(t);});if(flags&p.MOD)this.visit(p.MOD,function(t){return p.mod.push(t);});}return p;},changed:function changed(flags){return this.changes&flags;},modified:function modified(_){var p=this,fields=p.fields;return!(fields&&p.changes&p.MOD)?0:isArray(_)?_.some(function(f){return fields[f];}):fields[_];},filter:function filter(){error('MultiPulse does not support filtering.');},materialize:function materialize(){error('MultiPulse does not support materialization.');},visit:function visit(flags,visitor){var p=this,pulses=p.pulses,n=pulses.length;var i=0;if(flags&p.SOURCE){for(;i<n;++i){pulses[i].visit(flags,visitor);}}else{for(;i<n;++i){if(pulses[i].stamp===p.stamp){pulses[i].visit(flags,visitor);}}}return p;}});/** + * Evaluates the dataflow and returns a Promise that resolves when pulse + * propagation completes. This method will increment the current timestamp + * and process all updated, pulsed and touched operators. When invoked for + * the first time, all registered operators will be processed. This method + * should not be invoked by third-party clients, use {@link runAsync} or + * {@link run} instead. + * @param {string} [encode] - The name of an encoding set to invoke during + * propagation. This value is added to generated Pulse instances; + * operators can then respond to (or ignore) this setting as appropriate. + * This parameter can be used in conjunction with the Encode transform in + * the vega-encode package. + * @param {function} [prerun] - An optional callback function to invoke + * immediately before dataflow evaluation commences. + * @param {function} [postrun] - An optional callback function to invoke + * after dataflow evaluation completes. The callback will be invoked + * after those registered via {@link runAfter}. + * @return {Promise} - A promise that resolves to this dataflow after + * evaluation completes. + */function evaluate(_x17,_x18,_x19){return _evaluate.apply(this,arguments);}/** + * Queues dataflow evaluation to run once any other queued evaluations have + * completed and returns a Promise that resolves when the queued pulse + * propagation completes. If provided, a callback function will be invoked + * immediately before evaluation commences. This method will ensure a + * separate evaluation is invoked for each time it is called. + * @param {string} [encode] - The name of an encoding set to invoke during + * propagation. This value is added to generated Pulse instances; + * operators can then respond to (or ignore) this setting as appropriate. + * This parameter can be used in conjunction with the Encode transform in + * the vega-encode package. + * @param {function} [prerun] - An optional callback function to invoke + * immediately before dataflow evaluation commences. + * @param {function} [postrun] - An optional callback function to invoke + * after dataflow evaluation completes. The callback will be invoked + * after those registered via {@link runAfter}. + * @return {Promise} - A promise that resolves to this dataflow after + * evaluation completes. + */function _evaluate(){_evaluate=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee0(encode,prerun,postrun){var df,async,stamp,count,op,next,error,pr,_i72,_t12;return _regenerator().w(function(_context17){while(1)switch(_context17.p=_context17.n){case 0:df=this,async=[];// if the pulse value is set, this is a re-entrant call +if(!df._pulse){_context17.n=1;break;}return _context17.a(2,reentrant(df));case 1:if(!df._pending){_context17.n=2;break;}_context17.n=2;return df._pending;case 2:if(!prerun){_context17.n=3;break;}_context17.n=3;return asyncCallback(df,prerun);case 3:if(df._touched.length){_context17.n=4;break;}df.debug('Dataflow invoked, but nothing to do.');return _context17.a(2,df);case 4:// increment timestamp clock +stamp=++df._clock;// set the current pulse +df._pulse=new Pulse(df,stamp,encode);// initialize priority queue, reset touched operators +df._touched.forEach(function(op){return df._enqueue(op,true);});df._touched=UniqueList(id);count=0;_context17.p=5;case 6:if(!(df._heap.size()>0)){_context17.n=11;break;}// dequeue operator with highest priority +op=df._heap.pop();// re-queue if rank changed +if(!(op.rank!==op.qrank)){_context17.n=7;break;}df._enqueue(op,true);return _context17.a(3,6);case 7:// otherwise, evaluate the operator +next=op.run(df._getPulse(op,encode));if(!next.then){_context17.n=9;break;}_context17.n=8;return next;case 8:next=_context17.v;_context17.n=10;break;case 9:if(next.async){// queue parallel asynchronous execution +async.push(next.async);next=StopPropagation;}case 10:// propagate evaluation, enqueue dependent operators +if(next!==StopPropagation){if(op._targets)op._targets.forEach(function(op){return df._enqueue(op);});}// increment visit counter +++count;_context17.n=6;break;case 11:_context17.n=13;break;case 12:_context17.p=12;_t12=_context17.v;df._heap.clear();error=_t12;case 13:// reset pulse map +df._input={};df._pulse=null;df.debug("Pulse ".concat(stamp,": ").concat(count," operators"));if(error){df._postrun=[];df.error(error);}// invoke callbacks queued via runAfter +if(!df._postrun.length){_context17.n=16;break;}pr=df._postrun.sort(function(a,b){return b.priority-a.priority;});df._postrun=[];_i72=0;case 14:if(!(_i72<pr.length)){_context17.n=16;break;}_context17.n=15;return asyncCallback(df,pr[_i72].callback);case 15:++_i72;_context17.n=14;break;case 16:if(!postrun){_context17.n=17;break;}_context17.n=17;return asyncCallback(df,postrun);case 17:// handle non-blocking asynchronous callbacks +if(async.length){Promise.all(async).then(function(cb){return df.runAsync(null,function(){cb.forEach(function(f){try{f(df);}catch(err){df.error(err);}});});});}return _context17.a(2,df);}},_callee0,this,[[5,12]]);}));return _evaluate.apply(this,arguments);}function runAsync(_x20,_x21,_x22){return _runAsync.apply(this,arguments);}/** + * Requests dataflow evaluation and the immediately returns this dataflow + * instance. If there are pending data loading or other asynchronous + * operations, the dataflow will evaluate asynchronously after this method + * has been invoked. To track when dataflow evaluation completes, use the + * {@link runAsync} method instead. This method will raise an error if + * invoked while the dataflow is already in the midst of evaluation. + * @param {string} [encode] - The name of an encoding set to invoke during + * propagation. This value is added to generated Pulse instances; + * operators can then respond to (or ignore) this setting as appropriate. + * This parameter can be used in conjunction with the Encode transform in + * the vega-encode module. + * @param {function} [prerun] - An optional callback function to invoke + * immediately before dataflow evaluation commences. + * @param {function} [postrun] - An optional callback function to invoke + * after dataflow evaluation completes. The callback will be invoked + * after those registered via {@link runAfter}. + * @return {Dataflow} - This dataflow instance. + */function _runAsync(){_runAsync=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee1(encode,prerun,postrun){var _this29=this;var clear;return _regenerator().w(function(_context18){while(1)switch(_context18.n){case 0:if(!this._running){_context18.n=2;break;}_context18.n=1;return this._running;case 1:_context18.n=0;break;case 2:// run dataflow, manage running promise +clear=function clear(){return _this29._running=null;};(this._running=this.evaluate(encode,prerun,postrun)).then(clear,clear);return _context18.a(2,this._running);}},_callee1,this);}));return _runAsync.apply(this,arguments);}function run(encode,prerun,postrun){return this._pulse?reentrant(this):(this.evaluate(encode,prerun,postrun),this);}/** + * Schedules a callback function to be invoked after the current pulse + * propagation completes. If no propagation is currently occurring, + * the function is invoked immediately. Callbacks scheduled via runAfter + * are invoked immediately upon completion of the current cycle, before + * any request queued via runAsync. This method is primarily intended for + * internal use. Third-party callers using runAfter to schedule a callback + * that invokes {@link run} or {@link runAsync} should not use this method, + * but instead use {@link runAsync} with prerun or postrun arguments. + * @param {function(Dataflow)} callback - The callback function to run. + * The callback will be invoked with this Dataflow instance as its + * sole argument. + * @param {boolean} enqueue - A boolean flag indicating that the + * callback should be queued up to run after the next propagation + * cycle, suppressing immediate invocation when propagation is not + * currently occurring. + * @param {number} [priority] - A priority value used to sort registered + * callbacks to determine execution order. This argument is intended + * for internal Vega use only. + */function runAfter(callback,enqueue,priority){if(this._pulse||enqueue){// pulse propagation is currently running, queue to run after +this._postrun.push({priority:priority||0,callback:callback});}else{// pulse propagation already complete, invoke immediately +try{callback(this);}catch(err){this.error(err);}}}/** + * Raise an error for re-entrant dataflow evaluation. + */function reentrant(df){df.error('Dataflow already running. Use runAsync() to chain invocations.');return df;}/** + * Enqueue an operator into the priority queue for evaluation. The operator + * will be enqueued if it has no registered pulse for the current cycle, or if + * the force argument is true. Upon enqueue, this method also sets the + * operator's qrank to the current rank value. + * @param {Operator} op - The operator to enqueue. + * @param {boolean} [force] - A flag indicating if the operator should be + * forceably added to the queue, even if it has already been previously + * enqueued during the current pulse propagation. This is useful when the + * dataflow graph is dynamically modified and the operator rank changes. + */function enqueue(op,force){var q=op.stamp<this._clock;if(q)op.stamp=this._clock;if(q||force){op.qrank=op.rank;this._heap.push(op);}}/** + * Provide a correct pulse for evaluating an operator. If the operator has an + * explicit source operator, we will try to pull the pulse(s) from it. + * If there is an array of source operators, we build a multi-pulse. + * Otherwise, we return a current pulse with correct source data. + * If the pulse is the pulse map has an explicit target set, we use that. + * Else if the pulse on the upstream source operator is current, we use that. + * Else we use the pulse from the pulse map, but copy the source tuple array. + * @param {Operator} op - The operator for which to get an input pulse. + * @param {string} [encode] - An (optional) encoding set name with which to + * annotate the returned pulse. See {@link run} for more information. + */function getPulse(op,encode){var s=op.source,stamp=this._clock;return s&&isArray(s)?new MultiPulse(this,stamp,s.map(function(_){return _.pulse;}),encode):this._input[op.id]||singlePulse(this._pulse,s&&s.pulse);}function singlePulse(p,s){if(s&&s.stamp===p.stamp){return s;}p=p.fork();if(s&&s!==StopPropagation){p.source=s.source;}return p;}var NO_OPT={skip:false,force:false};/** + * Touches an operator, scheduling it to be evaluated. If invoked outside of + * a pulse propagation, the operator will be evaluated the next time this + * dataflow is run. If invoked in the midst of pulse propagation, the operator + * will be queued for evaluation if and only if the operator has not yet been + * evaluated on the current propagation timestamp. + * @param {Operator} op - The operator to touch. + * @param {object} [options] - Additional options hash. + * @param {boolean} [options.skip] - If true, the operator will + * be skipped: it will not be evaluated, but its dependents will be. + * @return {Dataflow} + */function touch(op,options){var opt=options||NO_OPT;if(this._pulse){// if in midst of propagation, add to priority queue +this._enqueue(op);}else{// otherwise, queue for next propagation +this._touched.add(op);}if(opt.skip)op.skip(true);return this;}/** + * Updates the value of the given operator. + * @param {Operator} op - The operator to update. + * @param {*} value - The value to set. + * @param {object} [options] - Additional options hash. + * @param {boolean} [options.force] - If true, the operator will + * be re-evaluated even if its value has not changed. + * @param {boolean} [options.skip] - If true, the operator will + * be skipped: it will not be evaluated, but its dependents will be. + * @return {Dataflow} + */function update$6(op,value,options){var opt=options||NO_OPT;if(op.set(value)||opt.force){this.touch(op,opt);}return this;}/** + * Pulses an operator with a changeset of tuples. If invoked outside of + * a pulse propagation, the pulse will be applied the next time this + * dataflow is run. If invoked in the midst of pulse propagation, the pulse + * will be added to the set of active pulses and will be applied if and + * only if the target operator has not yet been evaluated on the current + * propagation timestamp. + * @param {Operator} op - The operator to pulse. + * @param {ChangeSet} value - The tuple changeset to apply. + * @param {object} [options] - Additional options hash. + * @param {boolean} [options.skip] - If true, the operator will + * be skipped: it will not be evaluated, but its dependents will be. + * @return {Dataflow} + */function pulse(op,changeset,options){this.touch(op,options||NO_OPT);var p=new Pulse(this,this._clock+(this._pulse?0:1)),t=op.pulse&&op.pulse.source||[];p.target=op;this._input[op.id]=changeset.pulse(p,t);return this;}function Heap(cmp){var nodes=[];return{clear:function clear(){return nodes=[];},size:function size(){return nodes.length;},peek:function peek(){return nodes[0];},push:function push(x){nodes.push(x);return siftdown(nodes,0,nodes.length-1,cmp);},pop:function pop(){var last=nodes.pop();var item;if(nodes.length){item=nodes[0];nodes[0]=last;siftup(nodes,0,cmp);}else{item=last;}return item;}};}function siftdown(array,start,idx,cmp){var parent,pidx;var item=array[idx];while(idx>start){pidx=idx-1>>1;parent=array[pidx];if(cmp(item,parent)<0){array[idx]=parent;idx=pidx;continue;}break;}return array[idx]=item;}function siftup(array,idx,cmp){var start=idx,end=array.length,item=array[idx];var cidx=(idx<<1)+1,ridx;while(cidx<end){ridx=cidx+1;if(ridx<end&&cmp(array[cidx],array[ridx])>=0){cidx=ridx;}array[idx]=array[cidx];idx=cidx;cidx=(idx<<1)+1;}array[idx]=item;return siftdown(array,start,idx,cmp);}/** + * A dataflow graph for reactive processing of data streams. + * @constructor + */function Dataflow(){this.logger(logger());this.logLevel(Error$1);this._clock=0;this._rank=0;this._locale=defaultLocale();try{this._loader=loader();}catch(e){// do nothing if loader module is unavailable +}this._touched=UniqueList(id);this._input={};this._pulse=null;this._heap=Heap(function(a,b){return a.qrank-b.qrank;});this._postrun=[];}function logMethod(method){return function(){return this._log[method].apply(this,arguments);};}Dataflow.prototype={/** + * The current timestamp of this dataflow. This value reflects the + * timestamp of the previous dataflow run. The dataflow is initialized + * with a stamp value of 0. The initial run of the dataflow will have + * a timestap of 1, and so on. This value will match the + * {@link Pulse.stamp} property. + * @return {number} - The current timestamp value. + */stamp:function stamp(){return this._clock;},/** + * Gets or sets the loader instance to use for data file loading. A + * loader object must provide a "load" method for loading files and a + * "sanitize" method for checking URL/filename validity. Both methods + * should accept a URI and options hash as arguments, and return a Promise + * that resolves to the loaded file contents (load) or a hash containing + * sanitized URI data with the sanitized url assigned to the "href" property + * (sanitize). + * @param {object} _ - The loader instance to use. + * @return {object|Dataflow} - If no arguments are provided, returns + * the current loader instance. Otherwise returns this Dataflow instance. + */loader:function loader(_){if(arguments.length){this._loader=_;return this;}else{return this._loader;}},/** + * Gets or sets the locale instance to use for formatting and parsing + * string values. The locale object should be provided by the + * vega-format library, and include methods such as format, timeFormat, + * utcFormat, timeParse, and utcParse. + * @param {object} _ - The locale instance to use. + * @return {object|Dataflow} - If no arguments are provided, returns + * the current locale instance. Otherwise returns this Dataflow instance. + */locale:function locale(_){if(arguments.length){this._locale=_;return this;}else{return this._locale;}},/** + * Get or set the logger instance used to log messages. If no arguments are + * provided, returns the current logger instance. Otherwise, sets the logger + * and return this Dataflow instance. Provided loggers must support the full + * API of logger objects generated by the vega-util logger method. Note that + * by default the log level of the new logger will be used; use the logLevel + * method to adjust the log level as needed. + */logger:function logger(_logger){if(arguments.length){this._log=_logger;return this;}else{return this._log;}},/** + * Logs an error message. By default, logged messages are written to console + * output. The message will only be logged if the current log level is high + * enough to permit error messages. + */error:logMethod('error'),/** + * Logs a warning message. By default, logged messages are written to console + * output. The message will only be logged if the current log level is high + * enough to permit warning messages. + */warn:logMethod('warn'),/** + * Logs a information message. By default, logged messages are written to + * console output. The message will only be logged if the current log level is + * high enough to permit information messages. + */info:logMethod('info'),/** + * Logs a debug message. By default, logged messages are written to console + * output. The message will only be logged if the current log level is high + * enough to permit debug messages. + */debug:logMethod('debug'),/** + * Get or set the current log level. If an argument is provided, it + * will be used as the new log level. + * @param {number} [level] - Should be one of None, Warn, Info + * @return {number} - The current log level. + */logLevel:logMethod('level'),/** + * Empty entry threshold for garbage cleaning. Map data structures will + * perform cleaning once the number of empty entries exceeds this value. + */cleanThreshold:1e4,// OPERATOR REGISTRATION +add:add$3,connect:connect,rank:rank,rerank:rerank,// OPERATOR UPDATES +pulse:pulse,touch:touch,update:update$6,changeset:changeset,// DATA LOADING +ingest:ingest,parse:parse$5,preload:preload,request:request,// EVENT HANDLING +events:events$1,on:on,// PULSE PROPAGATION +evaluate:evaluate,run:run,runAsync:runAsync,runAfter:runAfter,_enqueue:enqueue,_getPulse:getPulse};/** + * Abstract class for operators that process data tuples. + * Subclasses must provide a {@link transform} method for operator processing. + * @constructor + * @param {*} [init] - The initial value for this operator. + * @param {object} [params] - The parameters for this operator. + * @param {Operator} [source] - The operator from which to receive pulses. + */function Transform(init,params){Operator.call(this,init,null,params);}inherits(Transform,Operator,{/** + * Overrides {@link Operator.evaluate} for transform operators. + * Internally, this method calls {@link evaluate} to perform processing. + * If {@link evaluate} returns a falsy value, the input pulse is returned. + * This method should NOT be overridden, instead overrride {@link evaluate}. + * @param {Pulse} pulse - the current dataflow pulse. + * @return the output pulse for this operator (or StopPropagation) + */run:function run(pulse){var _this4=this;if(pulse.stamp<this.stamp)return pulse.StopPropagation;var rv;if(this.skip()){this.skip(false);}else{rv=this.evaluate(pulse);}rv=rv||pulse;if(rv.then){rv=rv.then(function(_){return _this4.pulse=_;});}else if(rv!==pulse.StopPropagation){this.pulse=rv;}return rv;},/** + * Overrides {@link Operator.evaluate} for transform operators. + * Marshalls parameter values and then invokes {@link transform}. + * @param {Pulse} pulse - the current dataflow pulse. + * @return {Pulse} The output pulse (or StopPropagation). A falsy return + value (including undefined) will let the input pulse pass through. + */evaluate:function evaluate(pulse){var params=this.marshall(pulse.stamp),out=this.transform(params,pulse);params.clear();return out;},/** + * Process incoming pulses. + * Subclasses should override this method to implement transforms. + * @param {Parameters} _ - The operator parameter values. + * @param {Pulse} pulse - The current dataflow pulse. + * @return {Pulse} The output pulse (or StopPropagation). A falsy return + * value (including undefined) will let the input pulse pass through. + */transform:function transform(){}});var transforms={};function definition$1(type){var t=transform$2(type);return t&&t.Definition||null;}function transform$2(type){type=type&&type.toLowerCase();return has$1(transforms,type)?transforms[type]:null;}function numbers$1(values,valueof){var _iterator17,_step17,_value15,_index6,_iterator18,_step18,_value16,_t4,_t5;return _regenerator().w(function(_context4){while(1)switch(_context4.p=_context4.n){case 0:if(!(valueof==null)){_context4.n=8;break;}_iterator17=_createForOfIteratorHelper(values);_context4.p=1;_iterator17.s();case 2:if((_step17=_iterator17.n()).done){_context4.n=4;break;}_value15=_step17.value;if(!(_value15!=null&&_value15!==''&&(_value15=+_value15)>=_value15)){_context4.n=3;break;}_context4.n=3;return _value15;case 3:_context4.n=2;break;case 4:_context4.n=6;break;case 5:_context4.p=5;_t4=_context4.v;_iterator17.e(_t4);case 6:_context4.p=6;_iterator17.f();return _context4.f(6);case 7:_context4.n=15;break;case 8:_index6=-1;_iterator18=_createForOfIteratorHelper(values);_context4.p=9;_iterator18.s();case 10:if((_step18=_iterator18.n()).done){_context4.n=12;break;}_value16=_step18.value;_value16=valueof(_value16,++_index6,values);if(!(_value16!=null&&_value16!==''&&(_value16=+_value16)>=_value16)){_context4.n=11;break;}_context4.n=11;return _value16;case 11:_context4.n=10;break;case 12:_context4.n=14;break;case 13:_context4.p=13;_t5=_context4.v;_iterator18.e(_t5);case 14:_context4.p=14;_iterator18.f();return _context4.f(14);case 15:return _context4.a(2);}},_marked3,null,[[9,13,14,15],[1,5,6,7]]);}function quantiles(array,p,f){var values=Float64Array.from(numbers$1(array,f));// don't depend on return value from typed array sort call +// protects against undefined sort results in Safari (vega/vega-lite#4964) +values.sort(ascending$1);return p.map(function(_){return quantileSorted(values,_);});}function quartiles(array,f){return quantiles(array,[0.25,0.50,0.75],f);}// Scott, D. W. (1992) Multivariate Density Estimation: +// Theory, Practice, and Visualization. Wiley. +function estimateBandwidth(array,f){var n=array.length,d=deviation(array,f),q=quartiles(array,f),h=(q[2]-q[0])/1.34,v=Math.min(d,h)||d||Math.abs(q[0])||1;return 1.06*v*Math.pow(n,-0.2);}function bin(_){// determine range +var maxb=_.maxbins||20,base=_.base||10,logb=Math.log(base),div=_.divide||[5,2];var min=_.extent[0],max=_.extent[1],step,level,minstep,v,i,n;var span=_.span||max-min||Math.abs(min)||1;if(_.step){// if step size is explicitly given, use that +step=_.step;}else if(_.steps){// if provided, limit choice to acceptable step sizes +v=span/maxb;for(i=0,n=_.steps.length;i<n&&_.steps[i]<v;++i);step=_.steps[Math.max(0,i-1)];}else{// else use span to determine step size +level=Math.ceil(Math.log(maxb)/logb);minstep=_.minstep||0;step=Math.max(minstep,Math.pow(base,Math.round(Math.log(span)/logb)-level));// increase step size if too many bins +while(Math.ceil(span/step)>maxb){step*=base;}// decrease step size if allowed +for(i=0,n=div.length;i<n;++i){v=step/div[i];if(v>=minstep&&span/v<=maxb)step=v;}}// update precision, min and max +v=Math.log(step);var precision=v>=0?0:~~(-v/logb)+1,eps=Math.pow(base,-precision-1);if(_.nice||_.nice===undefined){v=Math.floor(min/step+eps)*step;min=min<v?v-step:v;max=Math.ceil(max/step)*step;}return{start:min,stop:max===min?min+step:max,step:step};}exports.random=Math.random;function setRandom(r){exports.random=r;}function bootstrapCI(array,samples,alpha,f){if(!array.length)return[undefined,undefined];var values=Float64Array.from(numbers$1(array,f)),n=values.length,m=samples;var a,i,j,mu;for(j=0,mu=Array(m);j<m;++j){for(a=0,i=0;i<n;++i){a+=values[~~(exports.random()*n)];}mu[j]=a/n;}mu.sort(ascending$1);return[quantile$1(mu,alpha/2),quantile$1(mu,1-alpha/2)];}// Dot density binning for dot plot construction. +// Based on Leland Wilkinson, Dot Plots, The American Statistician, 1999. +// https://www.cs.uic.edu/~wilkinson/Publications/dotplots.pdf +function dotbin(array,step,smooth,f){f=f||function(_){return _;};var n=array.length,v=new Float64Array(n);var i=0,j=1,a=f(array[0]),b=a,w=a+step,x;for(;j<n;++j){x=f(array[j]);if(x>=w){b=(a+b)/2;for(;i<j;++i)v[i]=b;w=x+step;a=x;}b=x;}b=(a+b)/2;for(;i<j;++i)v[i]=b;return smooth?smoothing(v,step+step/4):v;}// perform smoothing to reduce variance +// swap points between "adjacent" stacks +// Wilkinson defines adjacent as within step/4 units +function smoothing(v,thresh){var n=v.length;var a=0,b=1,c,d;// get left stack +while(v[a]===v[b])++b;while(b<n){// get right stack +c=b+1;while(v[b]===v[c])++c;// are stacks adjacent? +// if so, compare sizes and swap as needed +if(v[b]-v[b-1]<thresh){d=b+(a+c-b-b>>1);while(d<b)v[d++]=v[b];while(d>b)v[d--]=v[a];}// update left stack indices +a=b;b=c;}return v;}function lcg$2(seed){// Random numbers using a Linear Congruential Generator with seed value +// Uses glibc values from https://en.wikipedia.org/wiki/Linear_congruential_generator +return function(){seed=(1103515245*seed+12345)%2147483647;return seed/2147483647;};}function integer(min,max){if(max==null){max=min;min=0;}var a,b,d;var dist={min:function min(_){if(arguments.length){a=_||0;d=b-a;return dist;}else{return a;}},max:function max(_){if(arguments.length){b=_||0;d=b-a;return dist;}else{return b;}},sample:function sample(){return a+Math.floor(d*exports.random());},pdf:function pdf(x){return x===Math.floor(x)&&x>=a&&x<b?1/d:0;},cdf:function cdf(x){var v=Math.floor(x);return v<a?0:v>=b?1:(v-a+1)/d;},icdf:function icdf(p){return p>=0&&p<=1?a-1+Math.floor(p*d):NaN;}};return dist.min(min).max(max);}var SQRT2PI=Math.sqrt(2*Math.PI);var SQRT2=Math.SQRT2;var nextSample=NaN;function sampleNormal(mean,stdev){mean=mean||0;stdev=stdev==null?1:stdev;var x=0,y=0,rds,c;if(nextSample===nextSample){x=nextSample;nextSample=NaN;}else{do{x=exports.random()*2-1;y=exports.random()*2-1;rds=x*x+y*y;}while(rds===0||rds>1);c=Math.sqrt(-2*Math.log(rds)/rds);// Box-Muller transform +x*=c;nextSample=y*c;}return mean+x*stdev;}function densityNormal(value,mean,stdev){stdev=stdev==null?1:stdev;var z=(value-(mean||0))/stdev;return Math.exp(-0.5*z*z)/(stdev*SQRT2PI);}// Approximation from West (2009) +// Better Approximations to Cumulative Normal Functions +function cumulativeNormal(value,mean,stdev){mean=mean||0;stdev=stdev==null?1:stdev;var z=(value-mean)/stdev,Z=Math.abs(z);var cd;if(Z>37){cd=0;}else{var _exp=Math.exp(-Z*Z/2);var _sum2;if(Z<7.07106781186547){_sum2=3.52624965998911e-02*Z+0.700383064443688;_sum2=_sum2*Z+6.37396220353165;_sum2=_sum2*Z+33.912866078383;_sum2=_sum2*Z+112.079291497871;_sum2=_sum2*Z+221.213596169931;_sum2=_sum2*Z+220.206867912376;cd=_exp*_sum2;_sum2=8.83883476483184e-02*Z+1.75566716318264;_sum2=_sum2*Z+16.064177579207;_sum2=_sum2*Z+86.7807322029461;_sum2=_sum2*Z+296.564248779674;_sum2=_sum2*Z+637.333633378831;_sum2=_sum2*Z+793.826512519948;_sum2=_sum2*Z+440.413735824752;cd=cd/_sum2;}else{_sum2=Z+0.65;_sum2=Z+4/_sum2;_sum2=Z+3/_sum2;_sum2=Z+2/_sum2;_sum2=Z+1/_sum2;cd=_exp/_sum2/2.506628274631;}}return z>0?1-cd:cd;}// Approximation of Probit function using inverse error function. +function quantileNormal(p,mean,stdev){if(p<0||p>1)return NaN;return(mean||0)+(stdev==null?1:stdev)*SQRT2*erfinv(2*p-1);}// Approximate inverse error function. Implementation from "Approximating +// the erfinv function" by Mike Giles, GPU Computing Gems, volume 2, 2010. +// Ported from Apache Commons Math, http://www.apache.org/licenses/LICENSE-2.0 +function erfinv(x){// beware that the logarithm argument must be +// commputed as (1.0 - x) * (1.0 + x), +// it must NOT be simplified as 1.0 - x * x as this +// would induce rounding errors near the boundaries +/-1 +var w=-Math.log((1-x)*(1+x)),p;if(w<6.25){w-=3.125;p=-364441206401782e-35;p=-16850591381820166e-35+p*w;p=1.2858480715256400167e-18+p*w;p=1.115787767802518096e-17+p*w;p=-1333171662854621e-31+p*w;p=2.0972767875968561637e-17+p*w;p=6.6376381343583238325e-15+p*w;p=-4054566272975207e-29+p*w;p=-8151934197605472e-29+p*w;p=2.6335093153082322977e-12+p*w;p=-12975133253453532e-27+p*w;p=-5415412054294628e-26+p*w;p=1.051212273321532285e-09+p*w;p=-4.112633980346984e-9+p*w;p=-2.9070369957882005e-8+p*w;p=4.2347877827932403518e-07+p*w;p=-13654692000834679e-22+p*w;p=-13882523362786469e-21+p*w;p=0.0001867342080340571352+p*w;p=-740702534166267e-18+p*w;p=-0.006033670871430149+p*w;p=0.24015818242558961693+p*w;p=1.6536545626831027356+p*w;}else if(w<16.0){w=Math.sqrt(w)-3.25;p=2.2137376921775787049e-09;p=9.0756561938885390979e-08+p*w;p=-2.7517406297064545e-7+p*w;p=1.8239629214389227755e-08+p*w;p=1.5027403968909827627e-06+p*w;p=-4013867526981546e-21+p*w;p=2.9234449089955446044e-06+p*w;p=1.2475304481671778723e-05+p*w;p=-47318229009055734e-21+p*w;p=6.8284851459573175448e-05+p*w;p=2.4031110387097893999e-05+p*w;p=-3550375203628475e-19+p*w;p=0.00095328937973738049703+p*w;p=-0.0016882755560235047+p*w;p=0.0024914420961078508066+p*w;p=-0.003751208507569241+p*w;p=0.005370914553590063617+p*w;p=1.0052589676941592334+p*w;p=3.0838856104922207635+p*w;}else if(Number.isFinite(w)){w=Math.sqrt(w)-5.0;p=-27109920616438573e-27;p=-2555641816996525e-25+p*w;p=1.5076572693500548083e-09+p*w;p=-3.789465440126737e-9+p*w;p=7.6157012080783393804e-09+p*w;p=-1.496002662714924e-8+p*w;p=2.9147953450901080826e-08+p*w;p=-6.771199775845234e-8+p*w;p=2.2900482228026654717e-07+p*w;p=-9.9298272942317e-7+p*w;p=4.5260625972231537039e-06+p*w;p=-1968177810553167e-20+p*w;p=7.5995277030017761139e-05+p*w;p=-21503011930044477e-20+p*w;p=-13871931833623122e-20+p*w;p=1.0103004648645343977+p*w;p=4.8499064014085844221+p*w;}else{p=Infinity;}return p*x;}function gaussian(mean,stdev){var mu,sigma;var dist={mean:function mean(_){if(arguments.length){mu=_||0;return dist;}else{return mu;}},stdev:function stdev(_){if(arguments.length){sigma=_==null?1:_;return dist;}else{return sigma;}},sample:function sample(){return sampleNormal(mu,sigma);},pdf:function pdf(value){return densityNormal(value,mu,sigma);},cdf:function cdf(value){return cumulativeNormal(value,mu,sigma);},icdf:function icdf(p){return quantileNormal(p,mu,sigma);}};return dist.mean(mean).stdev(stdev);}function kde(support,_bandwidth){var kernel=gaussian();var n=0;var dist={data:function data(_){if(arguments.length){support=_;n=_?_.length:0;return dist.bandwidth(_bandwidth);}else{return support;}},bandwidth:function bandwidth(_){if(!arguments.length)return _bandwidth;_bandwidth=_;if(!_bandwidth&&support)_bandwidth=estimateBandwidth(support);return dist;},sample:function sample(){return support[~~(exports.random()*n)]+_bandwidth*kernel.sample();},pdf:function pdf(x){var y=0,i=0;for(;i<n;++i){y+=kernel.pdf((x-support[i])/_bandwidth);}return y/_bandwidth/n;},cdf:function cdf(x){var y=0,i=0;for(;i<n;++i){y+=kernel.cdf((x-support[i])/_bandwidth);}return y/n;},icdf:function icdf(){throw Error('KDE icdf not supported.');}};return dist.data(support);}function sampleLogNormal(mean,stdev){mean=mean||0;stdev=stdev==null?1:stdev;return Math.exp(mean+sampleNormal()*stdev);}function densityLogNormal(value,mean,stdev){if(value<=0)return 0;mean=mean||0;stdev=stdev==null?1:stdev;var z=(Math.log(value)-mean)/stdev;return Math.exp(-0.5*z*z)/(stdev*SQRT2PI*value);}function cumulativeLogNormal(value,mean,stdev){return cumulativeNormal(Math.log(value),mean,stdev);}function quantileLogNormal(p,mean,stdev){return Math.exp(quantileNormal(p,mean,stdev));}function lognormal(mean,stdev){var mu,sigma;var dist={mean:function mean(_){if(arguments.length){mu=_||0;return dist;}else{return mu;}},stdev:function stdev(_){if(arguments.length){sigma=_==null?1:_;return dist;}else{return sigma;}},sample:function sample(){return sampleLogNormal(mu,sigma);},pdf:function pdf(value){return densityLogNormal(value,mu,sigma);},cdf:function cdf(value){return cumulativeLogNormal(value,mu,sigma);},icdf:function icdf(p){return quantileLogNormal(p,mu,sigma);}};return dist.mean(mean).stdev(stdev);}function mixture$1(dists,_weights){var m=0,w;function normalize(x){var w=[];var sum=0,i;for(i=0;i<m;++i){sum+=w[i]=x[i]==null?1:+x[i];}for(i=0;i<m;++i){w[i]/=sum;}return w;}var dist={weights:function weights(_){if(arguments.length){w=normalize(_weights=_||[]);return dist;}return _weights;},distributions:function distributions(_){if(arguments.length){if(_){m=_.length;dists=_;}else{m=0;dists=[];}return dist.weights(_weights);}return dists;},sample:function sample(){var r=exports.random();var d=dists[m-1],v=w[0],i=0;// first select distribution +for(;i<m-1;v+=w[++i]){if(r<v){d=dists[i];break;}}// then sample from it +return d.sample();},pdf:function pdf(x){var p=0,i=0;for(;i<m;++i){p+=w[i]*dists[i].pdf(x);}return p;},cdf:function cdf(x){var p=0,i=0;for(;i<m;++i){p+=w[i]*dists[i].cdf(x);}return p;},icdf:function icdf(){throw Error('Mixture icdf not supported.');}};return dist.distributions(dists).weights(_weights);}function sampleUniform(min,max){if(max==null){max=min==null?1:min;min=0;}return min+(max-min)*exports.random();}function densityUniform(value,min,max){if(max==null){max=min==null?1:min;min=0;}return value>=min&&value<=max?1/(max-min):0;}function cumulativeUniform(value,min,max){if(max==null){max=min==null?1:min;min=0;}return value<min?0:value>max?1:(value-min)/(max-min);}function quantileUniform(p,min,max){if(max==null){max=min==null?1:min;min=0;}return p>=0&&p<=1?min+p*(max-min):NaN;}function uniform(min,max){var a,b;var dist={min:function min(_){if(arguments.length){a=_||0;return dist;}else{return a;}},max:function max(_){if(arguments.length){b=_==null?1:_;return dist;}else{return b;}},sample:function sample(){return sampleUniform(a,b);},pdf:function pdf(value){return densityUniform(value,a,b);},cdf:function cdf(value){return cumulativeUniform(value,a,b);},icdf:function icdf(p){return quantileUniform(p,a,b);}};if(max==null){max=min==null?1:min;min=0;}return dist.min(min).max(max);}function constant$4(data,x,y){var mean=0,n=0;var _iterator19=_createForOfIteratorHelper(data),_step19;try{for(_iterator19.s();!(_step19=_iterator19.n()).done;){var d=_step19.value;var val=y(d);if(x(d)==null||val==null||isNaN(val))continue;mean+=(val-mean)/++n;}}catch(err){_iterator19.e(err);}finally{_iterator19.f();}return{coef:[mean],predict:function predict(){return mean;},rSquared:0};}// Ordinary Least Squares +function ols(uX,uY,uXY,uX2){var delta=uX2-uX*uX,slope=Math.abs(delta)<1e-24?0:(uXY-uX*uY)/delta,intercept=uY-slope*uX;return[intercept,slope];}function points(data,x,y,sort){data=data.filter(function(d){var u=x(d),v=y(d);return u!=null&&(u=+u)>=u&&v!=null&&(v=+v)>=v;});if(sort){data.sort(function(a,b){return x(a)-x(b);});}var n=data.length,X=new Float64Array(n),Y=new Float64Array(n);// extract values, calculate means +var i=0,ux=0,uy=0,xv,yv,d;var _iterator20=_createForOfIteratorHelper(data),_step20;try{for(_iterator20.s();!(_step20=_iterator20.n()).done;){d=_step20.value;X[i]=xv=+x(d);Y[i]=yv=+y(d);++i;ux+=(xv-ux)/i;uy+=(yv-uy)/i;}// mean center the data +}catch(err){_iterator20.e(err);}finally{_iterator20.f();}for(i=0;i<n;++i){X[i]-=ux;Y[i]-=uy;}return[X,Y,ux,uy];}function visitPoints(data,x,y,callback){var i=-1,u,v;var _iterator21=_createForOfIteratorHelper(data),_step21;try{for(_iterator21.s();!(_step21=_iterator21.n()).done;){var d=_step21.value;u=x(d);v=y(d);if(u!=null&&(u=+u)>=u&&v!=null&&(v=+v)>=v){callback(u,v,++i);}}}catch(err){_iterator21.e(err);}finally{_iterator21.f();}}// Adapted from d3-regression by Harry Stevens +// License: https://github.com/HarryStevens/d3-regression/blob/master/LICENSE +function rSquared(data,x,y,uY,predict){var SSE=0,SST=0;visitPoints(data,x,y,function(dx,dy){var sse=dy-predict(dx),sst=dy-uY;SSE+=sse*sse;SST+=sst*sst;});return 1-SSE/SST;}// Adapted from d3-regression by Harry Stevens +// License: https://github.com/HarryStevens/d3-regression/blob/master/LICENSE +function linear$2(data,x,y){var X=0,Y=0,XY=0,X2=0,n=0;visitPoints(data,x,y,function(dx,dy){++n;X+=(dx-X)/n;Y+=(dy-Y)/n;XY+=(dx*dy-XY)/n;X2+=(dx*dx-X2)/n;});var coef=ols(X,Y,XY,X2),predict=function predict(x){return coef[0]+coef[1]*x;};return{coef:coef,predict:predict,rSquared:rSquared(data,x,y,Y,predict)};}// Adapted from d3-regression by Harry Stevens +// License: https://github.com/HarryStevens/d3-regression/blob/master/LICENSE +function log$3(data,x,y){var X=0,Y=0,XY=0,X2=0,n=0;visitPoints(data,x,y,function(dx,dy){++n;dx=Math.log(dx);X+=(dx-X)/n;Y+=(dy-Y)/n;XY+=(dx*dy-XY)/n;X2+=(dx*dx-X2)/n;});var coef=ols(X,Y,XY,X2),predict=function predict(x){return coef[0]+coef[1]*Math.log(x);};return{coef:coef,predict:predict,rSquared:rSquared(data,x,y,Y,predict)};}function exp$1(data,x,y){var _points=points(data,x,y),_points2=_slicedToArray(_points,4),xv=_points2[0],yv=_points2[1],ux=_points2[2],uy=_points2[3];var YL=0,XY=0,XYL=0,X2Y=0,n=0,dx,ly,xy;visitPoints(data,x,y,function(_,dy){dx=xv[n++];ly=Math.log(dy);xy=dx*dy;YL+=(dy*ly-YL)/n;XY+=(xy-XY)/n;XYL+=(xy*ly-XYL)/n;X2Y+=(dx*xy-X2Y)/n;});var _ols=ols(XY/uy,YL/uy,XYL/uy,X2Y/uy),_ols2=_slicedToArray(_ols,2),c0=_ols2[0],c1=_ols2[1],predict=function predict(x){return Math.exp(c0+c1*(x-ux));};return{coef:[Math.exp(c0-c1*ux),c1],predict:predict,rSquared:rSquared(data,x,y,uy,predict)};}// Adapted from d3-regression by Harry Stevens +// License: https://github.com/HarryStevens/d3-regression/blob/master/LICENSE +function pow$3(data,x,y){var X=0,Y=0,XY=0,X2=0,YS=0,n=0;visitPoints(data,x,y,function(dx,dy){var lx=Math.log(dx),ly=Math.log(dy);++n;X+=(lx-X)/n;Y+=(ly-Y)/n;XY+=(lx*ly-XY)/n;X2+=(lx*lx-X2)/n;YS+=(dy-YS)/n;});var coef=ols(X,Y,XY,X2),predict=function predict(x){return coef[0]*Math.pow(x,coef[1]);};coef[0]=Math.exp(coef[0]);return{coef:coef,predict:predict,rSquared:rSquared(data,x,y,YS,predict)};}function quad(data,x,y){var _points3=points(data,x,y),_points4=_slicedToArray(_points3,4),xv=_points4[0],yv=_points4[1],ux=_points4[2],uy=_points4[3],n=xv.length;var X2=0,X3=0,X4=0,XY=0,X2Y=0,i,dx,dy,x2;for(i=0;i<n;){dx=xv[i];dy=yv[i++];x2=dx*dx;X2+=(x2-X2)/i;X3+=(x2*dx-X3)/i;X4+=(x2*x2-X4)/i;XY+=(dx*dy-XY)/i;X2Y+=(x2*dy-X2Y)/i;}var X2X2=X4-X2*X2,d=X2*X2X2-X3*X3,a=(X2Y*X2-XY*X3)/d,b=(XY*X2X2-X2Y*X3)/d,c=-a*X2,predict=function predict(x){x=x-ux;return a*x*x+b*x+c+uy;};// transform coefficients back from mean-centered space +return{coef:[c-b*ux+a*ux*ux+uy,b-2*a*ux,a],predict:predict,rSquared:rSquared(data,x,y,uy,predict)};}// Adapted from d3-regression by Harry Stevens +// License: https://github.com/HarryStevens/d3-regression/blob/master/LICENSE +// ... which was adapted from regression-js by Tom Alexander +// Source: https://github.com/Tom-Alexander/regression-js/blob/master/src/regression.js#L246 +// License: https://github.com/Tom-Alexander/regression-js/blob/master/LICENSE +function poly(data,x,y,order){// use more efficient methods for lower orders +if(order===0)return constant$4(data,x,y);if(order===1)return linear$2(data,x,y);if(order===2)return quad(data,x,y);var _points5=points(data,x,y),_points6=_slicedToArray(_points5,4),xv=_points6[0],yv=_points6[1],ux=_points6[2],uy=_points6[3],n=xv.length,lhs=[],rhs=[],k=order+1;var i,j,l,v,c;for(i=0;i<k;++i){for(l=0,v=0;l<n;++l){v+=Math.pow(xv[l],i)*yv[l];}lhs.push(v);c=new Float64Array(k);for(j=0;j<k;++j){for(l=0,v=0;l<n;++l){v+=Math.pow(xv[l],i+j);}c[j]=v;}rhs.push(c);}rhs.push(lhs);var coef=gaussianElimination(rhs),predict=function predict(x){x-=ux;var y=uy+coef[0]+coef[1]*x+coef[2]*x*x;for(i=3;i<k;++i)y+=coef[i]*Math.pow(x,i);return y;};return{coef:uncenter(k,coef,-ux,uy),predict:predict,rSquared:rSquared(data,x,y,uy,predict)};}function uncenter(k,a,x,y){var z=Array(k);var i,j,v,c;// initialize to zero +for(i=0;i<k;++i)z[i]=0;// polynomial expansion +for(i=k-1;i>=0;--i){v=a[i];c=1;z[i]+=v;for(j=1;j<=i;++j){c*=(i+1-j)/j;// binomial coefficent +z[i-j]+=v*Math.pow(x,j)*c;}}// bias term +z[0]+=y;return z;}// Given an array for a two-dimensional matrix and the polynomial order, +// solve A * x = b using Gaussian elimination. +function gaussianElimination(matrix){var n=matrix.length-1,coef=[];var i,j,k,r,t;for(i=0;i<n;++i){r=i;// max row +for(j=i+1;j<n;++j){if(Math.abs(matrix[i][j])>Math.abs(matrix[i][r])){r=j;}}for(k=i;k<n+1;++k){t=matrix[k][i];matrix[k][i]=matrix[k][r];matrix[k][r]=t;}for(j=i+1;j<n;++j){for(k=n;k>=i;k--){matrix[k][j]-=matrix[k][i]*matrix[i][j]/matrix[i][i];}}}for(j=n-1;j>=0;--j){t=0;for(k=j+1;k<n;++k){t+=matrix[k][j]*coef[k];}coef[j]=(matrix[n][j]-t)/matrix[j][j];}return coef;}var maxiters=2,epsilon$6=1e-12;// Adapted from science.js by Jason Davies +// Source: https://github.com/jasondavies/science.js/blob/master/src/stats/loess.js +// License: https://github.com/jasondavies/science.js/blob/master/LICENSE +function loess(data,x,y,bandwidth){var _points7=points(data,x,y,true),_points8=_slicedToArray(_points7,4),xv=_points8[0],yv=_points8[1],ux=_points8[2],uy=_points8[3],n=xv.length,bw=Math.max(2,~~(bandwidth*n)),yhat=new Float64Array(n),residuals=new Float64Array(n),robustWeights=new Float64Array(n).fill(1);for(var iter=-1;++iter<=maxiters;){var _interval=[0,bw-1];for(var i=0;i<n;++i){var dx=xv[i],i0=_interval[0],i1=_interval[1],edge=dx-xv[i0]>xv[i1]-dx?i0:i1;var W=0,_X=0,_Y=0,XY=0,_X2=0;var denom=1/Math.abs(xv[edge]-dx||1);// avoid singularity! +for(var k=i0;k<=i1;++k){var xk=xv[k],yk=yv[k],_w=tricube(Math.abs(dx-xk)*denom)*robustWeights[k],xkw=xk*_w;W+=_w;_X+=xkw;_Y+=yk*_w;XY+=yk*xkw;_X2+=xk*xkw;}// linear regression fit +var _ols3=ols(_X/W,_Y/W,XY/W,_X2/W),_ols4=_slicedToArray(_ols3,2),_a=_ols4[0],_b=_ols4[1];yhat[i]=_a+_b*dx;residuals[i]=Math.abs(yv[i]-yhat[i]);updateInterval(xv,i+1,_interval);}if(iter===maxiters){break;}var medianResidual=median(residuals);if(Math.abs(medianResidual)<epsilon$6)break;for(var _i6=0,arg,_w2;_i6<n;++_i6){arg=residuals[_i6]/(6*medianResidual);// default to epsilon (rather than zero) for large deviations +// keeping weights tiny but non-zero prevents singularites +robustWeights[_i6]=arg>=1?epsilon$6:(_w2=1-arg*arg)*_w2;}}return output$1(xv,yhat,ux,uy);}// weighting kernel for local regression +function tricube(x){return(x=1-x*x*x)*x*x;}// advance sliding window interval of nearest neighbors +function updateInterval(xv,i,interval){var val=xv[i];var left=interval[0],right=interval[1]+1;if(right>=xv.length)return;// step right if distance to new right edge is <= distance to old left edge +// step when distance is equal to ensure movement over duplicate x values +while(i>left&&xv[right]-val<=val-xv[left]){interval[0]=++left;interval[1]=right;++right;}}// generate smoothed output points +// average points with repeated x values +function output$1(xv,yhat,ux,uy){var n=xv.length,out=[];var i=0,cnt=0,prev=[],v;for(;i<n;++i){v=xv[i]+ux;if(prev[0]===v){// average output values via online update +prev[1]+=(yhat[i]-prev[1])/++cnt;}else{// add new output point +cnt=0;prev[1]+=uy;prev=[v,yhat[i]];out.push(prev);}}prev[1]+=uy;return out;}// subdivide up to accuracy of 0.5 degrees +var MIN_RADIANS=0.5*Math.PI/180;// Adaptively sample an interpolated function over a domain extent +function sampleCurve(f,extent,minSteps,maxSteps){minSteps=minSteps||25;maxSteps=Math.max(minSteps,maxSteps||200);var point=function point(x){return[x,f(x)];},minX=extent[0],maxX=extent[1],span=maxX-minX,stop=span/maxSteps,prev=[point(minX)],next=[];if(minSteps===maxSteps){// no adaptation, sample uniform grid directly and return +for(var i=1;i<maxSteps;++i){prev.push(point(minX+i/minSteps*span));}prev.push(point(maxX));return prev;}else{// sample minimum points on uniform grid +// then move on to perform adaptive refinement +next.push(point(maxX));for(var _i7=minSteps;--_i7>0;){next.push(point(minX+_i7/minSteps*span));}}var p0=prev[0];var p1=next[next.length-1];var sx=1/span;var sy=scaleY(p0[1],next);while(p1){// midpoint for potential curve subdivision +var pm=point((p0[0]+p1[0])/2);var dx=pm[0]-p0[0]>=stop;if(dx&&angleDelta(p0,pm,p1,sx,sy)>MIN_RADIANS){// maximum resolution has not yet been met, and +// subdivision midpoint is sufficiently different from endpoint +// save subdivision, push midpoint onto the visitation stack +next.push(pm);}else{// subdivision midpoint sufficiently similar to endpoint +// skip subdivision, store endpoint, move to next point on the stack +p0=p1;prev.push(p1);next.pop();}p1=next[next.length-1];}return prev;}function scaleY(init,points){var ymin=init;var ymax=init;var n=points.length;for(var i=0;i<n;++i){var _y4=points[i][1];if(_y4<ymin)ymin=_y4;if(_y4>ymax)ymax=_y4;}return 1/(ymax-ymin);}function angleDelta(p,q,r,sx,sy){var a0=Math.atan2(sy*(r[1]-p[1]),sx*(r[0]-p[0])),a1=Math.atan2(sy*(q[1]-p[1]),sx*(q[0]-p[0]));return Math.abs(a0-a1);}function multikey(f){return function(x){var n=f.length;var i=1,k=String(f[0](x));for(;i<n;++i){k+='|'+f[i](x);}return k;};}function groupkey(fields){return!fields||!fields.length?function(){return'';}:fields.length===1?fields[0]:multikey(fields);}function measureName(op,field,as){return as||op+(!field?'':'_'+field);}var noop$4=function noop$4(){};var base_op={init:noop$4,add:noop$4,rem:noop$4,idx:0};var AggregateOps={values:{init:function init(m){return m.cell.store=true;},value:function value(m){return m.cell.data.values();},idx:-1},count:{value:function value(m){return m.cell.num;}},__count__:{value:function value(m){return m.missing+m.valid;}},missing:{value:function value(m){return m.missing;}},valid:{value:function value(m){return m.valid;}},sum:{init:function init(m){return m.sum=0;},value:function value(m){return m.valid?m.sum:undefined;},add:function add(m,v){return m.sum+=+v;},rem:function rem(m,v){return m.sum-=v;}},product:{init:function init(m){return m.product=1;},value:function value(m){return m.valid?m.product:undefined;},add:function add(m,v){return m.product*=v;},rem:function rem(m,v){return m.product/=v;}},mean:{init:function init(m){return m.mean=0;},value:function value(m){return m.valid?m.mean:undefined;},add:function add(m,v){return m.mean_d=v-m.mean,m.mean+=m.mean_d/m.valid;},rem:function rem(m,v){return m.mean_d=v-m.mean,m.mean-=m.valid?m.mean_d/m.valid:m.mean;}},average:{value:function value(m){return m.valid?m.mean:undefined;},req:['mean'],idx:1},variance:{init:function init(m){return m.dev=0;},value:function value(m){return m.valid>1?m.dev/(m.valid-1):undefined;},add:function add(m,v){return m.dev+=m.mean_d*(v-m.mean);},rem:function rem(m,v){return m.dev-=m.mean_d*(v-m.mean);},req:['mean'],idx:1},variancep:{value:function value(m){return m.valid>1?m.dev/m.valid:undefined;},req:['variance'],idx:2},stdev:{value:function value(m){return m.valid>1?Math.sqrt(m.dev/(m.valid-1)):undefined;},req:['variance'],idx:2},stdevp:{value:function value(m){return m.valid>1?Math.sqrt(m.dev/m.valid):undefined;},req:['variance'],idx:2},stderr:{value:function value(m){return m.valid>1?Math.sqrt(m.dev/(m.valid*(m.valid-1))):undefined;},req:['variance'],idx:2},distinct:{value:function value(m){return m.cell.data.distinct(m.get);},req:['values'],idx:3},ci0:{value:function value(m){return m.cell.data.ci0(m.get);},req:['values'],idx:3},ci1:{value:function value(m){return m.cell.data.ci1(m.get);},req:['values'],idx:3},median:{value:function value(m){return m.cell.data.q2(m.get);},req:['values'],idx:3},q1:{value:function value(m){return m.cell.data.q1(m.get);},req:['values'],idx:3},q3:{value:function value(m){return m.cell.data.q3(m.get);},req:['values'],idx:3},min:{init:function init(m){return m.min=undefined;},value:function value(m){return m.min=Number.isNaN(m.min)?m.cell.data.min(m.get):m.min;},add:function add(m,v){if(v<m.min||m.min===undefined)m.min=v;},rem:function rem(m,v){if(v<=m.min)m.min=NaN;},req:['values'],idx:4},max:{init:function init(m){return m.max=undefined;},value:function value(m){return m.max=Number.isNaN(m.max)?m.cell.data.max(m.get):m.max;},add:function add(m,v){if(v>m.max||m.max===undefined)m.max=v;},rem:function rem(m,v){if(v>=m.max)m.max=NaN;},req:['values'],idx:4},argmin:{init:function init(m){return m.argmin=undefined;},value:function value(m){return m.argmin||m.cell.data.argmin(m.get);},add:function add(m,v,t){if(v<m.min)m.argmin=t;},rem:function rem(m,v){if(v<=m.min)m.argmin=undefined;},req:['min','values'],idx:3},argmax:{init:function init(m){return m.argmax=undefined;},value:function value(m){return m.argmax||m.cell.data.argmax(m.get);},add:function add(m,v,t){if(v>m.max)m.argmax=t;},rem:function rem(m,v){if(v>=m.max)m.argmax=undefined;},req:['max','values'],idx:3},exponential:{init:function init(m,r){m.exp=0;m.exp_r=r;},value:function value(m){return m.valid?m.exp*(1-m.exp_r)/(1-Math.pow(m.exp_r,m.valid)):undefined;},add:function add(m,v){return m.exp=m.exp_r*m.exp+v;},rem:function rem(m,v){return m.exp=(m.exp-v/Math.pow(m.exp_r,m.valid-1))/m.exp_r;}},exponentialb:{value:function value(m){return m.valid?m.exp*(1-m.exp_r):undefined;},req:['exponential'],idx:1}};var ValidAggregateOps=Object.keys(AggregateOps).filter(function(d){return d!=='__count__';});function measure(key,value){return function(out,aggregate_param){return extend$1({name:key,aggregate_param:aggregate_param,out:out||key},base_op,value);};}[].concat(_toConsumableArray(ValidAggregateOps),['__count__']).forEach(function(key){AggregateOps[key]=measure(key,AggregateOps[key]);});function createMeasure(op,param,name){return AggregateOps[op](name,param);}function compareIndex(a,b){return a.idx-b.idx;}function resolve(agg){var map={};agg.forEach(function(a){return map[a.name]=a;});var _getreqs=function getreqs(a){if(!a.req)return;a.req.forEach(function(key){if(!map[key])_getreqs(map[key]=AggregateOps[key]());});};agg.forEach(_getreqs);return Object.values(map).sort(compareIndex);}function init(){var _this5=this;this.valid=0;this.missing=0;this._ops.forEach(function(op){return op.aggregate_param==null?op.init(_this5):op.init(_this5,op.aggregate_param);});}function add$2(v,t){var _this6=this;if(v==null||v===''){++this.missing;return;}if(v!==v)return;++this.valid;this._ops.forEach(function(op){return op.add(_this6,v,t);});}function rem(v,t){var _this7=this;if(v==null||v===''){--this.missing;return;}if(v!==v)return;--this.valid;this._ops.forEach(function(op){return op.rem(_this7,v,t);});}function set$3(t){var _this8=this;this._out.forEach(function(op){return t[op.out]=op.value(_this8);});return t;}function compileMeasures(agg,field){var get=field||identity$6,ops=resolve(agg),out=agg.slice().sort(compareIndex);function ctr(cell){this._ops=ops;this._out=out;this.cell=cell;this.init();}ctr.prototype.init=init;ctr.prototype.add=add$2;ctr.prototype.rem=rem;ctr.prototype.set=set$3;ctr.prototype.get=get;ctr.fields=agg.map(function(op){return op.out;});return ctr;}function TupleStore(key){this._key=key?field$1(key):tupleid;this.reset();}var prototype$1=TupleStore.prototype;prototype$1.reset=function(){this._add=[];this._rem=[];this._ext=null;this._get=null;this._q=null;};prototype$1.add=function(v){this._add.push(v);};prototype$1.rem=function(v){this._rem.push(v);};prototype$1.values=function(){this._get=null;if(this._rem.length===0)return this._add;var a=this._add,r=this._rem,k=this._key,n=a.length,m=r.length,x=Array(n-m),map={};var i,j,v;// use unique key field to clear removed values +for(i=0;i<m;++i){map[k(r[i])]=1;}for(i=0,j=0;i<n;++i){if(map[k(v=a[i])]){map[k(v)]=0;}else{x[j++]=v;}}this._rem=[];return this._add=x;};// memoizing statistics methods +prototype$1.distinct=function(get){var v=this.values(),map={};var n=v.length,count=0,s;while(--n>=0){s=get(v[n])+'';if(!has$1(map,s)){map[s]=1;++count;}}return count;};prototype$1.extent=function(get){if(this._get!==get||!this._ext){var v=this.values(),i=extentIndex(v,get);this._ext=[v[i[0]],v[i[1]]];this._get=get;}return this._ext;};prototype$1.argmin=function(get){return this.extent(get)[0]||{};};prototype$1.argmax=function(get){return this.extent(get)[1]||{};};prototype$1.min=function(get){var m=this.extent(get)[0];return m!=null?get(m):undefined;};prototype$1.max=function(get){var m=this.extent(get)[1];return m!=null?get(m):undefined;};prototype$1.quartile=function(get){if(this._get!==get||!this._q){this._q=quartiles(this.values(),get);this._get=get;}return this._q;};prototype$1.q1=function(get){return this.quartile(get)[0];};prototype$1.q2=function(get){return this.quartile(get)[1];};prototype$1.q3=function(get){return this.quartile(get)[2];};prototype$1.ci=function(get){if(this._get!==get||!this._ci){this._ci=bootstrapCI(this.values(),1000,0.05,get);this._get=get;}return this._ci;};prototype$1.ci0=function(get){return this.ci(get)[0];};prototype$1.ci1=function(get){return this.ci(get)[1];};/** + * Group-by aggregation operator. + * @constructor + * @param {object} params - The parameters for this operator. + * @param {Array<function(object): *>} [params.groupby] - An array of accessors to groupby. + * @param {Array<function(object): *>} [params.fields] - An array of accessors to aggregate. + * @param {Array<string>} [params.ops] - An array of strings indicating aggregation operations. + * @param {Array<number>} [params.aggregate_params] - An optional array of parameters for aggregation operations. + * @param {Array<string>} [params.as] - An array of output field names for aggregated values. + * @param {boolean} [params.cross=false] - A flag indicating that the full + * cross-product of groupby values should be generated, including empty cells. + * If true, the drop parameter is ignored and empty cells are retained. + * @param {boolean} [params.drop=true] - A flag indicating if empty cells should be removed. + */function Aggregate$1(params){Transform.call(this,null,params);this._adds=[];// array of added output tuples +this._mods=[];// array of modified output tuples +this._alen=0;// number of active added tuples +this._mlen=0;// number of active modified tuples +this._drop=true;// should empty aggregation cells be removed +this._cross=false;// produce full cross-product of group-by values +this._dims=[];// group-by dimension accessors +this._dnames=[];// group-by dimension names +this._measures=[];// collection of aggregation monoids +this._countOnly=false;// flag indicating only count aggregation +this._counts=null;// collection of count fields +this._prev=null;// previous aggregation cells +this._inputs=null;// array of dependent input tuple field names +this._outputs=null;// array of output tuple field names +}Aggregate$1.Definition={'type':'Aggregate','metadata':{'generates':true,'changes':true},'params':[{'name':'groupby','type':'field','array':true},{'name':'ops','type':'enum','array':true,'values':ValidAggregateOps},{'name':'aggregate_params','type':'number','null':true,'array':true},{'name':'fields','type':'field','null':true,'array':true},{'name':'as','type':'string','null':true,'array':true},{'name':'drop','type':'boolean','default':true},{'name':'cross','type':'boolean','default':false},{'name':'key','type':'field'}]};inherits(Aggregate$1,Transform,{transform:function transform(_,pulse){var _this9=this;var aggr=this,out=pulse.fork(pulse.NO_SOURCE|pulse.NO_FIELDS),mod=_.modified();aggr.stamp=out.stamp;if(aggr.value&&(mod||pulse.modified(aggr._inputs,true))){aggr._prev=aggr.value;aggr.value=mod?aggr.init(_):Object.create(null);pulse.visit(pulse.SOURCE,function(t){return aggr.add(t);});}else{aggr.value=aggr.value||aggr.init(_);pulse.visit(pulse.REM,function(t){return aggr.rem(t);});pulse.visit(pulse.ADD,function(t){return aggr.add(t);});}// Indicate output fields and return aggregate tuples. +out.modifies(aggr._outputs);// Should empty cells be dropped? +aggr._drop=_.drop!==false;// If domain cross-product requested, generate empty cells as needed +// and ensure that empty cells are not dropped +if(_.cross&&aggr._dims.length>1){aggr._drop=false;aggr.cross();}if(pulse.clean()&&aggr._drop){out.clean(true).runAfter(function(){return _this9.clean();});}return aggr.changes(out);},cross:function cross(){var aggr=this,curr=aggr.value,dims=aggr._dnames,vals=dims.map(function(){return{};}),n=dims.length;// collect all group-by domain values +function collect(cells){var key,i,t,v;for(key in cells){t=cells[key].tuple;for(i=0;i<n;++i){vals[i][v=t[dims[i]]]=v;}}}collect(aggr._prev);collect(curr);// iterate over key cross-product, create cells as needed +function generate(base,tuple,index){var name=dims[index],v=vals[index++];for(var k in v){var _key8=base?base+'|'+k:k;tuple[name]=v[k];if(index<n)generate(_key8,tuple,index);else if(!curr[_key8])aggr.cell(_key8,tuple);}}generate('',{},0);},init:function init(_){// initialize input and output fields +var inputs=this._inputs=[],outputs=this._outputs=[],inputMap={};function inputVisit(get){var fields=array$5(accessorFields(get)),n=fields.length;var i=0,f;for(;i<n;++i){if(!inputMap[f=fields[i]]){inputMap[f]=1;inputs.push(f);}}}// initialize group-by dimensions +this._dims=array$5(_.groupby);this._dnames=this._dims.map(function(d){var dname=accessorName(d);inputVisit(d);outputs.push(dname);return dname;});this.cellkey=_.key?_.key:groupkey(this._dims);// initialize aggregate measures +this._countOnly=true;this._counts=[];this._measures=[];var fields=_.fields||[null],ops=_.ops||['count'],aggregate_params=_.aggregate_params||[null],as=_.as||[],n=fields.length,map={};var field,op,aggregate_param,m,mname,outname,i;if(n!==ops.length){error('Unmatched number of fields and aggregate ops.');}for(i=0;i<n;++i){field=fields[i];op=ops[i];aggregate_param=aggregate_params[i]||null;if(field==null&&op!=='count'){error('Null aggregate field specified.');}mname=accessorName(field);outname=measureName(op,mname,as[i]);outputs.push(outname);if(op==='count'){this._counts.push(outname);continue;}m=map[mname];if(!m){inputVisit(field);m=map[mname]=[];m.field=field;this._measures.push(m);}if(op!=='count')this._countOnly=false;m.push(createMeasure(op,aggregate_param,outname));}this._measures=this._measures.map(function(m){return compileMeasures(m,m.field);});return Object.create(null);// aggregation cells (this.value) +},// -- Cell Management ----- +cellkey:groupkey(),cell:function cell(key,t){var cell=this.value[key];if(!cell){cell=this.value[key]=this.newcell(key,t);this._adds[this._alen++]=cell;}else if(cell.num===0&&this._drop&&cell.stamp<this.stamp){cell.stamp=this.stamp;this._adds[this._alen++]=cell;}else if(cell.stamp<this.stamp){cell.stamp=this.stamp;this._mods[this._mlen++]=cell;}return cell;},newcell:function newcell(key,t){var cell={key:key,num:0,agg:null,tuple:this.newtuple(t,this._prev&&this._prev[key]),stamp:this.stamp,store:false};if(!this._countOnly){var measures=this._measures,n=measures.length;cell.agg=Array(n);for(var i=0;i<n;++i){cell.agg[i]=new measures[i](cell);}}if(cell.store){cell.data=new TupleStore();}return cell;},newtuple:function newtuple(t,p){var names=this._dnames,dims=this._dims,n=dims.length,x={};for(var i=0;i<n;++i){x[names[i]]=dims[i](t);}return p?replace$1(p.tuple,x):ingest$1(x);},clean:function clean(){var cells=this.value;for(var _key9 in cells){if(cells[_key9].num===0){delete cells[_key9];}}},// -- Process Tuples ----- +add:function add(t){var key=this.cellkey(t),cell=this.cell(key,t);cell.num+=1;if(this._countOnly)return;if(cell.store)cell.data.add(t);var agg=cell.agg;for(var i=0,n=agg.length;i<n;++i){agg[i].add(agg[i].get(t),t);}},rem:function rem(t){var key=this.cellkey(t),cell=this.cell(key,t);cell.num-=1;if(this._countOnly)return;if(cell.store)cell.data.rem(t);var agg=cell.agg;for(var i=0,n=agg.length;i<n;++i){agg[i].rem(agg[i].get(t),t);}},celltuple:function celltuple(cell){var tuple=cell.tuple,counts=this._counts;// consolidate stored values +if(cell.store){cell.data.values();}// update tuple properties +for(var i=0,n=counts.length;i<n;++i){tuple[counts[i]]=cell.num;}if(!this._countOnly){var agg=cell.agg;for(var _i8=0,_n=agg.length;_i8<_n;++_i8){agg[_i8].set(tuple);}}return tuple;},changes:function changes(out){var adds=this._adds,mods=this._mods,prev=this._prev,drop=this._drop,add=out.add,rem=out.rem,mod=out.mod;var cell,key,i,n;if(prev)for(key in prev){cell=prev[key];if(!drop||cell.num)rem.push(cell.tuple);}for(i=0,n=this._alen;i<n;++i){add.push(this.celltuple(adds[i]));adds[i]=null;// for garbage collection +}for(i=0,n=this._mlen;i<n;++i){cell=mods[i];(cell.num===0&&drop?rem:mod).push(this.celltuple(cell));mods[i]=null;// for garbage collection +}this._alen=this._mlen=0;// reset list of active cells +this._prev=null;return out;}});// epsilon bias to offset floating point error (#1737) +var EPSILON$1=1e-14;/** + * Generates a binning function for discretizing data. + * @constructor + * @param {object} params - The parameters for this operator. The + * provided values should be valid options for the {@link bin} function. + * @param {function(object): *} params.field - The data field to bin. + */function Bin(params){Transform.call(this,null,params);}Bin.Definition={'type':'Bin','metadata':{'modifies':true},'params':[{'name':'field','type':'field','required':true},{'name':'interval','type':'boolean','default':true},{'name':'anchor','type':'number'},{'name':'maxbins','type':'number','default':20},{'name':'base','type':'number','default':10},{'name':'divide','type':'number','array':true,'default':[5,2]},{'name':'extent','type':'number','array':true,'length':2,'required':true},{'name':'span','type':'number'},{'name':'step','type':'number'},{'name':'steps','type':'number','array':true},{'name':'minstep','type':'number','default':0},{'name':'nice','type':'boolean','default':true},{'name':'name','type':'string'},{'name':'as','type':'string','array':true,'length':2,'default':['bin0','bin1']}]};inherits(Bin,Transform,{transform:function transform(_,pulse){var band=_.interval!==false,bins=this._bins(_),start=bins.start,step=bins.step,as=_.as||['bin0','bin1'],b0=as[0],b1=as[1];var flag;if(_.modified()){pulse=pulse.reflow(true);flag=pulse.SOURCE;}else{flag=pulse.modified(accessorFields(_.field))?pulse.ADD_MOD:pulse.ADD;}pulse.visit(flag,band?function(t){var v=bins(t);// minimum bin value (inclusive) +t[b0]=v;// maximum bin value (exclusive) +// use convoluted math for better floating point agreement +// see https://github.com/vega/vega/issues/830 +// infinite values propagate through this formula! #2227 +t[b1]=v==null?null:start+step*(1+(v-start)/step);}:function(t){return t[b0]=bins(t);});return pulse.modifies(band?as:b0);},_bins:function _bins(_){if(this.value&&!_.modified()){return this.value;}var field=_.field,bins=bin(_),step=bins.step;var start=bins.start,stop=start+Math.ceil((bins.stop-start)/step)*step,a,d;if((a=_.anchor)!=null){d=a-(start+step*Math.floor((a-start)/step));start+=d;stop+=d;}var f=function f(t){var v=toNumber(field(t));return v==null?null:v<start?-Infinity:v>stop?+Infinity:(v=Math.max(start,Math.min(v,stop-step)),start+step*Math.floor(EPSILON$1+(v-start)/step));};f.start=start;f.stop=bins.stop;f.step=step;return this.value=accessor(f,accessorFields(field),_.name||'bin_'+accessorName(field));}});function SortedList(idFunc,source,input){var $=idFunc;var _data=source||[],_add=input||[],rem={},cnt=0;return{add:function add(t){return _add.push(t);},remove:function remove(t){return rem[$(t)]=++cnt;},size:function size(){return _data.length;},data:function data(compare,resort){if(cnt){_data=_data.filter(function(t){return!rem[$(t)];});rem={};cnt=0;}if(resort&&compare){_data.sort(compare);}if(_add.length){_data=compare?merge$3(compare,_data,_add.sort(compare)):_data.concat(_add);_add=[];}return _data;}};}/** + * Collects all data tuples that pass through this operator. + * @constructor + * @param {object} params - The parameters for this operator. + * @param {function(*,*): number} [params.sort] - An optional + * comparator function for additionally sorting the collected tuples. + */function Collect$1(params){Transform.call(this,[],params);}Collect$1.Definition={'type':'Collect','metadata':{'source':true},'params':[{'name':'sort','type':'compare'}]};inherits(Collect$1,Transform,{transform:function transform(_,pulse){var out=pulse.fork(pulse.ALL),list=SortedList(tupleid,this.value,out.materialize(out.ADD).add),sort=_.sort,mod=pulse.changed()||sort&&(_.modified('sort')||pulse.modified(sort.fields));out.visit(out.REM,list.remove);this.modified(mod);this.value=out.source=list.data(stableCompare(sort),mod);// propagate tree root if defined +if(pulse.source&&pulse.source.root){this.value.root=pulse.source.root;}return out;}});/** + * Generates a comparator function. + * @constructor + * @param {object} params - The parameters for this operator. + * @param {Array<string|function>} params.fields - The fields to compare. + * @param {Array<string>} [params.orders] - The sort orders. + * Each entry should be one of "ascending" (default) or "descending". + */function Compare$1(params){Operator.call(this,null,update$5,params);}inherits(Compare$1,Operator);function update$5(_){return this.value&&!_.modified()?this.value:compare$1(_.fields,_.orders);}/** + * Count regexp-defined pattern occurrences in a text field. + * @constructor + * @param {object} params - The parameters for this operator. + * @param {function(object): *} params.field - An accessor for the text field. + * @param {string} [params.pattern] - RegExp string defining the text pattern. + * @param {string} [params.case] - One of 'lower', 'upper' or null (mixed) case. + * @param {string} [params.stopwords] - RegExp string of words to ignore. + */function CountPattern(params){Transform.call(this,null,params);}CountPattern.Definition={'type':'CountPattern','metadata':{'generates':true,'changes':true},'params':[{'name':'field','type':'field','required':true},{'name':'case','type':'enum','values':['upper','lower','mixed'],'default':'mixed'},{'name':'pattern','type':'string','default':'[\\w"]+'},{'name':'stopwords','type':'string','default':''},{'name':'as','type':'string','array':true,'length':2,'default':['text','count']}]};function tokenize(text,tcase,match){switch(tcase){case'upper':text=text.toUpperCase();break;case'lower':text=text.toLowerCase();break;}return text.match(match);}inherits(CountPattern,Transform,{transform:function transform(_,pulse){var process=function process(update){return function(tuple){var tokens=tokenize(get(tuple),_["case"],match)||[],t;for(var i=0,n=tokens.length;i<n;++i){if(!stop.test(t=tokens[i]))update(t);}};};var init=this._parameterCheck(_,pulse),counts=this._counts,match=this._match,stop=this._stop,get=_.field,as=_.as||['text','count'],add=process(function(t){return counts[t]=1+(counts[t]||0);}),rem=process(function(t){return counts[t]-=1;});if(init){pulse.visit(pulse.SOURCE,add);}else{pulse.visit(pulse.ADD,add);pulse.visit(pulse.REM,rem);}return this._finish(pulse,as);// generate output tuples +},_parameterCheck:function _parameterCheck(_,pulse){var init=false;if(_.modified('stopwords')||!this._stop){this._stop=new RegExp('^'+(_.stopwords||'')+'$','i');init=true;}if(_.modified('pattern')||!this._match){this._match=new RegExp(_.pattern||'[\\w\']+','g');init=true;}if(_.modified('field')||pulse.modified(_.field.fields)){init=true;}if(init)this._counts={};return init;},_finish:function _finish(pulse,as){var counts=this._counts,tuples=this._tuples||(this._tuples={}),text=as[0],count=as[1],out=pulse.fork(pulse.NO_SOURCE|pulse.NO_FIELDS);var w,t,c;for(w in counts){t=tuples[w];c=counts[w]||0;if(!t&&c){tuples[w]=t=ingest$1({});t[text]=w;t[count]=c;out.add.push(t);}else if(c===0){if(t)out.rem.push(t);counts[w]=null;tuples[w]=null;}else if(t[count]!==c){t[count]=c;out.mod.push(t);}}return out.modifies(as);}});/** + * Perform a cross-product of a tuple stream with itself. + * @constructor + * @param {object} params - The parameters for this operator. + * @param {function(object):boolean} [params.filter] - An optional filter + * function for selectively including tuples in the cross product. + * @param {Array<string>} [params.as] - The names of the output fields. + */function Cross(params){Transform.call(this,null,params);}Cross.Definition={'type':'Cross','metadata':{'generates':true},'params':[{'name':'filter','type':'expr'},{'name':'as','type':'string','array':true,'length':2,'default':['a','b']}]};inherits(Cross,Transform,{transform:function transform(_,pulse){var out=pulse.fork(pulse.NO_SOURCE),as=_.as||['a','b'],a=as[0],b=as[1],reset=!this.value||pulse.changed(pulse.ADD_REM)||_.modified('as')||_.modified('filter');var data=this.value;if(reset){if(data)out.rem=data;data=pulse.materialize(pulse.SOURCE).source;out.add=this.value=cross(data,a,b,_.filter||truthy);}else{out.mod=data;}out.source=this.value;return out.modifies(as);}});function cross(input,a,b,filter){var data=[],t={},n=input.length,i=0,j,left;for(;i<n;++i){t[a]=left=input[i];for(j=0;j<n;++j){t[b]=input[j];if(filter(t)){data.push(ingest$1(t));t={};t[a]=left;}}}return data;}var Distributions={kde:kde,mixture:mixture$1,normal:gaussian,lognormal:lognormal,uniform:uniform};var DISTRIBUTIONS='distributions',FUNCTION='function',FIELD='field';/** + * Parse a parameter object for a probability distribution. + * @param {object} def - The distribution parameter object. + * @param {function():Array<object>} - A method for requesting + * source data. Used for distributions (such as KDE) that + * require sample data points. This method will only be + * invoked if the 'from' parameter for a target data source + * is not provided. Typically this method returns backing + * source data for a Pulse object. + * @return {object} - The output distribution object. + */function parse$4(def,data){var func=def[FUNCTION];if(!has$1(Distributions,func)){error('Unknown distribution function: '+func);}var d=Distributions[func]();for(var name in def){// if data field, extract values +if(name===FIELD){d.data((def.from||data()).map(def[name]));}// if distribution mixture, recurse to parse each definition +else if(name===DISTRIBUTIONS){d[name](def[name].map(function(_){return parse$4(_,data);}));}// otherwise, simply set the parameter +else if(_typeof(d[name])===FUNCTION){d[name](def[name]);}}return d;}/** + * Grid sample points for a probability density. Given a distribution and + * a sampling extent, will generate points suitable for plotting either + * PDF (probability density function) or CDF (cumulative distribution + * function) curves. + * @constructor + * @param {object} params - The parameters for this operator. + * @param {object} params.distribution - The probability distribution. This + * is an object parameter dependent on the distribution type. + * @param {string} [params.method='pdf'] - The distribution method to sample. + * One of 'pdf' or 'cdf'. + * @param {Array<number>} [params.extent] - The [min, max] extent over which + * to sample the distribution. This argument is required in most cases, but + * can be omitted if the distribution (e.g., 'kde') supports a 'data' method + * that returns numerical sample points from which the extent can be deduced. + * @param {number} [params.minsteps=25] - The minimum number of curve samples + * for plotting the density. + * @param {number} [params.maxsteps=200] - The maximum number of curve samples + * for plotting the density. + * @param {number} [params.steps] - The exact number of curve samples for + * plotting the density. If specified, overrides both minsteps and maxsteps + * to set an exact number of uniform samples. Useful in conjunction with + * a fixed extent to ensure consistent sample points for stacked densities. + */function Density(params){Transform.call(this,null,params);}var distributions=[{'key':{'function':'normal'},'params':[{'name':'mean','type':'number','default':0},{'name':'stdev','type':'number','default':1}]},{'key':{'function':'lognormal'},'params':[{'name':'mean','type':'number','default':0},{'name':'stdev','type':'number','default':1}]},{'key':{'function':'uniform'},'params':[{'name':'min','type':'number','default':0},{'name':'max','type':'number','default':1}]},{'key':{'function':'kde'},'params':[{'name':'field','type':'field','required':true},{'name':'from','type':'data'},{'name':'bandwidth','type':'number','default':0}]}];var mixture={'key':{'function':'mixture'},'params':[{'name':'distributions','type':'param','array':true,'params':distributions},{'name':'weights','type':'number','array':true}]};Density.Definition={'type':'Density','metadata':{'generates':true},'params':[{'name':'extent','type':'number','array':true,'length':2},{'name':'steps','type':'number'},{'name':'minsteps','type':'number','default':25},{'name':'maxsteps','type':'number','default':200},{'name':'method','type':'string','default':'pdf','values':['pdf','cdf']},{'name':'distribution','type':'param','params':distributions.concat(mixture)},{'name':'as','type':'string','array':true,'default':['value','density']}]};inherits(Density,Transform,{transform:function transform(_,pulse){var out=pulse.fork(pulse.NO_SOURCE|pulse.NO_FIELDS);if(!this.value||pulse.changed()||_.modified()){var _dist=parse$4(_.distribution,source$1(pulse)),minsteps=_.steps||_.minsteps||25,maxsteps=_.steps||_.maxsteps||200;var _method=_.method||'pdf';if(_method!=='pdf'&&_method!=='cdf'){error('Invalid density method: '+_method);}if(!_.extent&&!_dist.data){error('Missing density extent parameter.');}_method=_dist[_method];var as=_.as||['value','density'],_domain=_.extent||_extent(_dist.data()),_values=sampleCurve(_method,_domain,minsteps,maxsteps).map(function(v){var tuple={};tuple[as[0]]=v[0];tuple[as[1]]=v[1];return ingest$1(tuple);});if(this.value)out.rem=this.value;this.value=out.add=out.source=_values;}return out;}});function source$1(pulse){return function(){return pulse.materialize(pulse.SOURCE).source;};}// use either provided alias or accessor field name +function fieldNames(fields,as){if(!fields)return null;return fields.map(function(f,i){return as[i]||accessorName(f);});}function partition$1$1(data,groupby,field){var groups=[],get=function get(f){return f(t);};var map,i,n,t,k,g;// partition data points into groups +if(groupby==null){groups.push(data.map(field));}else{for(map={},i=0,n=data.length;i<n;++i){t=data[i];k=groupby.map(get);g=map[k];if(!g){map[k]=g=[];g.dims=k;groups.push(g);}g.push(field(t));}}return groups;}var Output$5='bin';/** + * Dot density binning for dot plot construction. + * Based on Leland Wilkinson, Dot Plots, The American Statistician, 1999. + * https://www.cs.uic.edu/~wilkinson/Publications/dotplots.pdf + * @constructor + * @param {object} params - The parameters for this operator. + * @param {function(object): *} params.field - The value field to bin. + * @param {Array<function(object): *>} [params.groupby] - An array of accessors to groupby. + * @param {number} [params.step] - The step size (bin width) within which dots should be + * stacked. Defaults to 1/30 of the extent of the data *field*. + * @param {boolean} [params.smooth=false] - A boolean flag indicating if dot density + * stacks should be smoothed to reduce variance. + */function DotBin(params){Transform.call(this,null,params);}DotBin.Definition={'type':'DotBin','metadata':{'modifies':true},'params':[{'name':'field','type':'field','required':true},{'name':'groupby','type':'field','array':true},{'name':'step','type':'number'},{'name':'smooth','type':'boolean','default':false},{'name':'as','type':'string','default':Output$5}]};var autostep=function autostep(data,field){return span(_extent(data,field))/30;};inherits(DotBin,Transform,{transform:function transform(_,pulse){if(this.value&&!(_.modified()||pulse.changed())){return pulse;// early exit +}var source=pulse.materialize(pulse.SOURCE).source,groups=partition$1$1(pulse.source,_.groupby,identity$6),smooth=_.smooth||false,field=_.field,step=_.step||autostep(source,field),sort=stableCompare(function(a,b){return field(a)-field(b);}),as=_.as||Output$5,n=groups.length;// compute dotplot bins per group +var min=Infinity,max=-Infinity,i=0,j;for(;i<n;++i){var g=groups[i].sort(sort);j=-1;var _iterator22=_createForOfIteratorHelper(dotbin(g,step,smooth,field)),_step22;try{for(_iterator22.s();!(_step22=_iterator22.n()).done;){var v=_step22.value;if(v<min)min=v;if(v>max)max=v;g[++j][as]=v;}}catch(err){_iterator22.e(err);}finally{_iterator22.f();}}this.value={start:min,stop:max,step:step};return pulse.reflow(true).modifies(as);}});/** + * Wraps an expression function with access to external parameters. + * @constructor + * @param {object} params - The parameters for this operator. + * @param {function} params.expr - The expression function. The + * function should accept both a datum and a parameter object. + * This operator's value will be a new function that wraps the + * expression function with access to this operator's parameters. + */function Expression$1(params){Operator.call(this,null,update$4,params);this.modified(true);}inherits(Expression$1,Operator);function update$4(_){var expr=_.expr;return this.value&&!_.modified('expr')?this.value:accessor(function(datum){return expr(datum,_);},accessorFields(expr),accessorName(expr));}/** + * Computes extents (min/max) for a data field. + * @constructor + * @param {object} params - The parameters for this operator. + * @param {function(object): *} params.field - The field over which to compute extends. + */function Extent(params){Transform.call(this,[undefined,undefined],params);}Extent.Definition={'type':'Extent','metadata':{},'params':[{'name':'field','type':'field','required':true}]};inherits(Extent,Transform,{transform:function transform(_,pulse){var extent=this.value,field=_.field,mod=pulse.changed()||pulse.modified(field.fields)||_.modified('field');var min=extent[0],max=extent[1];if(mod||min==null){min=+Infinity;max=-Infinity;}pulse.visit(mod?pulse.SOURCE:pulse.ADD,function(t){var v=toNumber(field(t));if(v!=null){// NaNs will fail all comparisons! +if(v<min)min=v;if(v>max)max=v;}});if(!Number.isFinite(min)||!Number.isFinite(max)){var name=accessorName(field);if(name)name=" for field \"".concat(name,"\"");pulse.dataflow.warn("Infinite extent".concat(name,": [").concat(min,", ").concat(max,"]"));min=max=undefined;}this.value=[min,max];}});/** + * Provides a bridge between a parent transform and a target subflow that + * consumes only a subset of the tuples that pass through the parent. + * @constructor + * @param {Pulse} pulse - A pulse to use as the value of this operator. + * @param {Transform} parent - The parent transform (typically a Facet instance). + */function Subflow(pulse,parent){Operator.call(this,pulse);this.parent=parent;this.count=0;}inherits(Subflow,Operator,{/** + * Routes pulses from this subflow to a target transform. + * @param {Transform} target - A transform that receives the subflow of tuples. + */connect:function connect(target){this.detachSubflow=target.detachSubflow;this.targets().add(target);return target.source=this;},/** + * Add an 'add' tuple to the subflow pulse. + * @param {Tuple} t - The tuple being added. + */add:function add(t){this.count+=1;this.value.add.push(t);},/** + * Add a 'rem' tuple to the subflow pulse. + * @param {Tuple} t - The tuple being removed. + */rem:function rem(t){this.count-=1;this.value.rem.push(t);},/** + * Add a 'mod' tuple to the subflow pulse. + * @param {Tuple} t - The tuple being modified. + */mod:function mod(t){this.value.mod.push(t);},/** + * Re-initialize this operator's pulse value. + * @param {Pulse} pulse - The pulse to copy from. + * @see Pulse.init + */init:function init(pulse){this.value.init(pulse,pulse.NO_SOURCE);},/** + * Evaluate this operator. This method overrides the + * default behavior to simply return the contained pulse value. + * @return {Pulse} + */evaluate:function evaluate(){// assert: this.value.stamp === pulse.stamp +return this.value;}});/** + * Facets a dataflow into a set of subflows based on a key. + * @constructor + * @param {object} params - The parameters for this operator. + * @param {function(Dataflow, string): Operator} params.subflow - A function + * that generates a subflow of operators and returns its root operator. + * @param {function(object): *} params.key - The key field to facet by. + */function Facet$1(params){Transform.call(this,{},params);this._keys=fastmap();// cache previously calculated key values +// keep track of active subflows, use as targets array for listeners +// this allows us to limit propagation to only updated subflows +var a=this._targets=[];a.active=0;a.forEach=function(f){for(var i=0,n=a.active;i<n;++i){f(a[i],i,a);}};}inherits(Facet$1,Transform,{activate:function activate(flow){this._targets[this._targets.active++]=flow;},// parent argument provided by PreFacet subclass +subflow:function subflow(key,flow,pulse,parent){var flows=this.value;var sf=has$1(flows,key)&&flows[key],df,p;if(!sf){p=parent||(p=this._group[key])&&p.tuple;df=pulse.dataflow;sf=new Subflow(pulse.fork(pulse.NO_SOURCE),this);df.add(sf).connect(flow(df,key,p));flows[key]=sf;this.activate(sf);}else if(sf.value.stamp<pulse.stamp){sf.init(pulse);this.activate(sf);}return sf;},clean:function clean(){var flows=this.value;var detached=0;for(var _key0 in flows){if(flows[_key0].count===0){var detach=flows[_key0].detachSubflow;if(detach)detach();delete flows[_key0];++detached;}}// remove inactive targets from the active targets array +if(detached){var active=this._targets.filter(function(sf){return sf&&sf.count>0;});this.initTargets(active);}},initTargets:function initTargets(act){var a=this._targets,n=a.length,m=act?act.length:0;var i=0;for(;i<m;++i){a[i]=act[i];}for(;i<n&&a[i]!=null;++i){a[i]=null;// ensure old flows can be garbage collected +}a.active=m;},transform:function transform(_,pulse){var _this0=this;var df=pulse.dataflow,key=_.key,flow=_.subflow,cache=this._keys,rekey=_.modified('key'),subflow=function subflow(key){return _this0.subflow(key,flow,pulse);};this._group=_.group||{};this.initTargets();// reset list of active subflows +pulse.visit(pulse.REM,function(t){var id=tupleid(t),k=cache.get(id);if(k!==undefined){cache["delete"](id);subflow(k).rem(t);}});pulse.visit(pulse.ADD,function(t){var k=key(t);cache.set(tupleid(t),k);subflow(k).add(t);});if(rekey||pulse.modified(key.fields)){pulse.visit(pulse.MOD,function(t){var id=tupleid(t),k0=cache.get(id),k1=key(t);if(k0===k1){subflow(k1).mod(t);}else{cache.set(id,k1);subflow(k0).rem(t);subflow(k1).add(t);}});}else if(pulse.changed(pulse.MOD)){pulse.visit(pulse.MOD,function(t){subflow(cache.get(tupleid(t))).mod(t);});}if(rekey){pulse.visit(pulse.REFLOW,function(t){var id=tupleid(t),k0=cache.get(id),k1=key(t);if(k0!==k1){cache.set(id,k1);subflow(k0).rem(t);subflow(k1).add(t);}});}if(pulse.clean()){df.runAfter(function(){_this0.clean();cache.clean();});}else if(cache.empty>df.cleanThreshold){df.runAfter(cache.clean);}return pulse;}});/** + * Generates one or more field accessor functions. + * If the 'name' parameter is an array, an array of field accessors + * will be created and the 'as' parameter will be ignored. + * @constructor + * @param {object} params - The parameters for this operator. + * @param {string} params.name - The field name(s) to access. + * @param {string} params.as - The accessor function name. + */function Field$1(params){Operator.call(this,null,update$3,params);}inherits(Field$1,Operator);function update$3(_){return this.value&&!_.modified()?this.value:isArray(_.name)?array$5(_.name).map(function(f){return field$1(f);}):field$1(_.name,_.as);}/** + * Filters data tuples according to a predicate function. + * @constructor + * @param {object} params - The parameters for this operator. + * @param {function(object): *} params.expr - The predicate expression function + * that determines a tuple's filter status. Truthy values pass the filter. + */function Filter(params){Transform.call(this,fastmap(),params);}Filter.Definition={'type':'Filter','metadata':{'changes':true},'params':[{'name':'expr','type':'expr','required':true}]};inherits(Filter,Transform,{transform:function transform(_,pulse){var df=pulse.dataflow,cache=this.value,// cache ids of filtered tuples +output=pulse.fork(),add=output.add,rem=output.rem,mod=output.mod,test=_.expr;var isMod=true;pulse.visit(pulse.REM,function(t){var id=tupleid(t);if(!cache.has(id))rem.push(t);else cache["delete"](id);});pulse.visit(pulse.ADD,function(t){if(test(t,_))add.push(t);else cache.set(tupleid(t),1);});function revisit(t){var id=tupleid(t),b=test(t,_),s=cache.get(id);if(b&&s){cache["delete"](id);add.push(t);}else if(!b&&!s){cache.set(id,1);rem.push(t);}else if(isMod&&b&&!s){mod.push(t);}}pulse.visit(pulse.MOD,revisit);if(_.modified()){isMod=false;pulse.visit(pulse.REFLOW,revisit);}if(cache.empty>df.cleanThreshold)df.runAfter(cache.clean);return output;}});/** + * Flattens array-typed field values into new data objects. + * If multiple fields are specified, they are treated as parallel arrays, + * with output values included for each matching index (or null if missing). + * @constructor + * @param {object} params - The parameters for this operator. + * @param {Array<function(object): *>} params.fields - An array of field + * accessors for the tuple fields that should be flattened. + * @param {string} [params.index] - Optional output field name for index + * value. If unspecified, no index field is included in the output. + * @param {Array<string>} [params.as] - Output field names for flattened + * array fields. Any unspecified fields will use the field name provided + * by the fields accessors. + */function Flatten(params){Transform.call(this,[],params);}Flatten.Definition={'type':'Flatten','metadata':{'generates':true},'params':[{'name':'fields','type':'field','array':true,'required':true},{'name':'index','type':'string'},{'name':'as','type':'string','array':true}]};inherits(Flatten,Transform,{transform:function transform(_,pulse){var out=pulse.fork(pulse.NO_SOURCE),fields=_.fields,as=fieldNames(fields,_.as||[]),index=_.index||null,m=as.length;// remove any previous results +out.rem=this.value;// generate flattened tuples +pulse.visit(pulse.SOURCE,function(t){var arrays=fields.map(function(f){return f(t);}),maxlen=arrays.reduce(function(l,a){return Math.max(l,a.length);},0);var i=0,j,d,v;for(;i<maxlen;++i){d=derive(t);for(j=0;j<m;++j){d[as[j]]=(v=arrays[j][i])==null?null:v;}if(index){d[index]=i;}out.add.push(d);}});this.value=out.source=out.add;if(index)out.modifies(index);return out.modifies(as);}});/** + * Folds one more tuple fields into multiple tuples in which the field + * name and values are available under new 'key' and 'value' fields. + * @constructor + * @param {object} params - The parameters for this operator. + * @param {function(object): *} params.fields - An array of field accessors + * for the tuple fields that should be folded. + * @param {Array<string>} [params.as] - Output field names for folded key + * and value fields, defaults to ['key', 'value']. + */function Fold(params){Transform.call(this,[],params);}Fold.Definition={'type':'Fold','metadata':{'generates':true},'params':[{'name':'fields','type':'field','array':true,'required':true},{'name':'as','type':'string','array':true,'length':2,'default':['key','value']}]};inherits(Fold,Transform,{transform:function transform(_,pulse){var out=pulse.fork(pulse.NO_SOURCE),fields=_.fields,fnames=fields.map(accessorName),as=_.as||['key','value'],k=as[0],v=as[1],n=fields.length;out.rem=this.value;pulse.visit(pulse.SOURCE,function(t){for(var i=0,d;i<n;++i){d=derive(t);d[k]=fnames[i];d[v]=fields[i](t);out.add.push(d);}});this.value=out.source=out.add;return out.modifies(as);}});/** + * Invokes a function for each data tuple and saves the results as a new field. + * @constructor + * @param {object} params - The parameters for this operator. + * @param {function(object): *} params.expr - The formula function to invoke for each tuple. + * @param {string} params.as - The field name under which to save the result. + * @param {boolean} [params.initonly=false] - If true, the formula is applied to + * added tuples only, and does not update in response to modifications. + */function Formula(params){Transform.call(this,null,params);}Formula.Definition={'type':'Formula','metadata':{'modifies':true},'params':[{'name':'expr','type':'expr','required':true},{'name':'as','type':'string','required':true},{'name':'initonly','type':'boolean'}]};inherits(Formula,Transform,{transform:function transform(_,pulse){var func=_.expr,as=_.as,mod=_.modified(),flag=_.initonly?pulse.ADD:mod?pulse.SOURCE:pulse.modified(func.fields)||pulse.modified(as)?pulse.ADD_MOD:pulse.ADD;if(mod){// parameters updated, need to reflow +pulse=pulse.materialize().reflow(true);}if(!_.initonly){pulse.modifies(as);}return pulse.visit(flag,function(t){return t[as]=func(t,_);});}});/** + * Generates data tuples using a provided generator function. + * @constructor + * @param {object} params - The parameters for this operator. + * @param {function(Parameters): object} params.generator - A tuple generator + * function. This function is given the operator parameters as input. + * Changes to any additional parameters will not trigger re-calculation + * of previously generated tuples. Only future tuples are affected. + * @param {number} params.size - The number of tuples to produce. + */function Generate(params){Transform.call(this,[],params);}inherits(Generate,Transform,{transform:function transform(_,pulse){var out=pulse.fork(pulse.ALL),gen=_.generator;var data=this.value,num=_.size-data.length,add,rem,t;if(num>0){// need more tuples, generate and add +for(add=[];--num>=0;){add.push(t=ingest$1(gen(_)));data.push(t);}out.add=out.add.length?out.materialize(out.ADD).add.concat(add):add;}else{// need fewer tuples, remove +rem=data.slice(0,-num);out.rem=out.rem.length?out.materialize(out.REM).rem.concat(rem):rem;data=data.slice(-num);}out.source=this.value=data;return out;}});var Methods$1={value:'value',median:median,mean:mean,min:min$2,max:max$2};var Empty$1=[];/** + * Impute missing values. + * @constructor + * @param {object} params - The parameters for this operator. + * @param {function(object): *} params.field - The value field to impute. + * @param {Array<function(object): *>} [params.groupby] - An array of + * accessors to determine series within which to perform imputation. + * @param {function(object): *} params.key - An accessor for a key value. + * Each key value should be unique within a group. New tuples will be + * imputed for any key values that are not found within a group. + * @param {Array<*>} [params.keyvals] - Optional array of required key + * values. New tuples will be imputed for any key values that are not + * found within a group. In addition, these values will be automatically + * augmented with the key values observed in the input data. + * @param {string} [method='value'] - The imputation method to use. One of + * 'value', 'mean', 'median', 'max', 'min'. + * @param {*} [value=0] - The constant value to use for imputation + * when using method 'value'. + */function Impute(params){Transform.call(this,[],params);}Impute.Definition={'type':'Impute','metadata':{'changes':true},'params':[{'name':'field','type':'field','required':true},{'name':'key','type':'field','required':true},{'name':'keyvals','array':true},{'name':'groupby','type':'field','array':true},{'name':'method','type':'enum','default':'value','values':['value','mean','median','max','min']},{'name':'value','default':0}]};function getValue(_){var m=_.method||Methods$1.value,v;if(Methods$1[m]==null){error('Unrecognized imputation method: '+m);}else if(m===Methods$1.value){v=_.value!==undefined?_.value:0;return function(){return v;};}else{return Methods$1[m];}}function getField$1(_){var f=_.field;return function(t){return t?f(t):NaN;};}inherits(Impute,Transform,{transform:function transform(_,pulse){var out=pulse.fork(pulse.ALL),impute=getValue(_),field=getField$1(_),fName=accessorName(_.field),kName=accessorName(_.key),gNames=(_.groupby||[]).map(accessorName),groups=partition$4(pulse.source,_.groupby,_.key,_.keyvals),curr=[],prev=this.value,m=groups.domain.length,group,value,gVals,kVal,g,i,j,l,n,t;for(g=0,l=groups.length;g<l;++g){group=groups[g];gVals=group.values;value=NaN;// add tuples for missing values +for(j=0;j<m;++j){if(group[j]!=null)continue;kVal=groups.domain[j];t={_impute:true};for(i=0,n=gVals.length;i<n;++i)t[gNames[i]]=gVals[i];t[kName]=kVal;t[fName]=Number.isNaN(value)?value=impute(group,field):value;curr.push(ingest$1(t));}}// update pulse with imputed tuples +if(curr.length)out.add=out.materialize(out.ADD).add.concat(curr);if(prev.length)out.rem=out.materialize(out.REM).rem.concat(prev);this.value=curr;return out;}});function partition$4(data,groupby,key,keyvals){var get=function get(f){return f(t);},groups=[],domain=keyvals?keyvals.slice():[],kMap={},gMap={},gVals,gKey,group,i,j,k,n,t;domain.forEach(function(k,i){return kMap[k]=i+1;});for(i=0,n=data.length;i<n;++i){t=data[i];k=key(t);j=kMap[k]||(kMap[k]=domain.push(k));gKey=(gVals=groupby?groupby.map(get):Empty$1)+'';if(!(group=gMap[gKey])){group=gMap[gKey]=[];groups.push(group);group.values=gVals;}group[j-1]=t;}groups.domain=domain;return groups;}/** + * Extend input tuples with aggregate values. + * Calcuates aggregate values and joins them with the input stream. + * @constructor + */function JoinAggregate(params){Aggregate$1.call(this,params);}JoinAggregate.Definition={'type':'JoinAggregate','metadata':{'modifies':true},'params':[{'name':'groupby','type':'field','array':true},{'name':'fields','type':'field','null':true,'array':true},{'name':'ops','type':'enum','array':true,'values':ValidAggregateOps},{'name':'as','type':'string','null':true,'array':true},{'name':'key','type':'field'}]};inherits(JoinAggregate,Aggregate$1,{transform:function transform(_,pulse){var aggr=this,mod=_.modified();var cells;// process all input tuples to calculate aggregates +if(aggr.value&&(mod||pulse.modified(aggr._inputs,true))){cells=aggr.value=mod?aggr.init(_):{};pulse.visit(pulse.SOURCE,function(t){return aggr.add(t);});}else{cells=aggr.value=aggr.value||this.init(_);pulse.visit(pulse.REM,function(t){return aggr.rem(t);});pulse.visit(pulse.ADD,function(t){return aggr.add(t);});}// update aggregation cells +aggr.changes();// write aggregate values to input tuples +pulse.visit(pulse.SOURCE,function(t){extend$1(t,cells[aggr.cellkey(t)].tuple);});return pulse.reflow(mod).modifies(this._outputs);},changes:function changes(){var adds=this._adds,mods=this._mods;var i,n;for(i=0,n=this._alen;i<n;++i){this.celltuple(adds[i]);adds[i]=null;// for garbage collection +}for(i=0,n=this._mlen;i<n;++i){this.celltuple(mods[i]);mods[i]=null;// for garbage collection +}this._alen=this._mlen=0;// reset list of active cells +}});/** + * Compute kernel density estimates (KDE) for one or more data groups. + * @constructor + * @param {object} params - The parameters for this operator. + * @param {Array<function(object): *>} [params.groupby] - An array of accessors + * to groupby. + * @param {function(object): *} params.field - An accessor for the data field + * to estimate. + * @param {number} [params.bandwidth=0] - The KDE kernel bandwidth. + * If zero or unspecified, the bandwidth is automatically determined. + * @param {boolean} [params.counts=false] - A boolean flag indicating if the + * output values should be probability estimates (false, default) or + * smoothed counts (true). + * @param {string} [params.cumulative=false] - A boolean flag indicating if a + * density (false) or cumulative distribution (true) should be generated. + * @param {Array<number>} [params.extent] - The domain extent over which to + * plot the density. If unspecified, the [min, max] data extent is used. + * @param {string} [params.resolve='independent'] - Indicates how parameters for + * multiple densities should be resolved. If "independent" (the default), each + * density may have its own domain extent and dynamic number of curve sample + * steps. If "shared", the KDE transform will ensure that all densities are + * defined over a shared domain and curve steps, enabling stacking. + * @param {number} [params.minsteps=25] - The minimum number of curve samples + * for plotting the density. + * @param {number} [params.maxsteps=200] - The maximum number of curve samples + * for plotting the density. + * @param {number} [params.steps] - The exact number of curve samples for + * plotting the density. If specified, overrides both minsteps and maxsteps + * to set an exact number of uniform samples. Useful in conjunction with + * a fixed extent to ensure consistent sample points for stacked densities. + */function KDE(params){Transform.call(this,null,params);}KDE.Definition={'type':'KDE','metadata':{'generates':true},'params':[{'name':'groupby','type':'field','array':true},{'name':'field','type':'field','required':true},{'name':'cumulative','type':'boolean','default':false},{'name':'counts','type':'boolean','default':false},{'name':'bandwidth','type':'number','default':0},{'name':'extent','type':'number','array':true,'length':2},{'name':'resolve','type':'enum','values':['shared','independent'],'default':'independent'},{'name':'steps','type':'number'},{'name':'minsteps','type':'number','default':25},{'name':'maxsteps','type':'number','default':200},{'name':'as','type':'string','array':true,'default':['value','density']}]};inherits(KDE,Transform,{transform:function transform(_,pulse){var out=pulse.fork(pulse.NO_SOURCE|pulse.NO_FIELDS);if(!this.value||pulse.changed()||_.modified()){var _source=pulse.materialize(pulse.SOURCE).source,groups=partition$1$1(_source,_.groupby,_.field),names=(_.groupby||[]).map(accessorName),_bandwidth2=_.bandwidth,_method2=_.cumulative?'cdf':'pdf',as=_.as||['value','density'],_values2=[];var _domain2=_.extent,minsteps=_.steps||_.minsteps||25,maxsteps=_.steps||_.maxsteps||200;if(_method2!=='pdf'&&_method2!=='cdf'){error('Invalid density method: '+_method2);}if(_.resolve==='shared'){if(!_domain2)_domain2=_extent(_source,_.field);minsteps=maxsteps=_.steps||maxsteps;}groups.forEach(function(g){var density=kde(g,_bandwidth2)[_method2],scale=_.counts?g.length:1,local=_domain2||_extent(g);sampleCurve(density,local,minsteps,maxsteps).forEach(function(v){var t={};for(var i=0;i<names.length;++i){t[names[i]]=g.dims[i];}t[as[0]]=v[0];t[as[1]]=v[1]*scale;_values2.push(ingest$1(t));});});if(this.value)out.rem=this.value;this.value=out.add=out.source=_values2;}return out;}});/** + * Generates a key function. + * @constructor + * @param {object} params - The parameters for this operator. + * @param {Array<string>} params.fields - The field name(s) for the key function. + * @param {boolean} params.flat - A boolean flag indicating if the field names + * should be treated as flat property names, side-stepping nested field + * lookups normally indicated by dot or bracket notation. + */function Key$1(params){Operator.call(this,null,update$2,params);}inherits(Key$1,Operator);function update$2(_){return this.value&&!_.modified()?this.value:key(_.fields,_.flat);}/** + * Load and parse data from an external source. Marshalls parameter + * values and then invokes the Dataflow request method. + * @constructor + * @param {object} params - The parameters for this operator. + * @param {string} params.url - The URL to load from. + * @param {object} params.format - The data format options. + */function Load$1(params){Transform.call(this,[],params);this._pending=null;}inherits(Load$1,Transform,{transform:function transform(_,pulse){var _this1=this;var df=pulse.dataflow;if(this._pending){// update state and return pulse +return output(this,pulse,this._pending);}if(stop(_))return pulse.StopPropagation;if(_.values){// parse and ingest values, return output pulse +return output(this,pulse,df.parse(_.values,_.format));}else if(_.async){// return promise for non-blocking async loading +var p=df.request(_.url,_.format).then(function(res){_this1._pending=array$5(res.data);return function(df){return df.touch(_this1);};});return{async:p};}else{// return promise for synchronous loading +return df.request(_.url,_.format).then(function(res){return output(_this1,pulse,array$5(res.data));});}}});function stop(_){return _.modified('async')&&!(_.modified('values')||_.modified('url')||_.modified('format'));}function output(op,pulse,data){data.forEach(ingest$1);var out=pulse.fork(pulse.NO_FIELDS&pulse.NO_SOURCE);out.rem=op.value;op.value=out.source=out.add=data;op._pending=null;if(out.rem.length)out.clean(true);return out;}/** + * Extend tuples by joining them with values from a lookup table. + * @constructor + * @param {object} params - The parameters for this operator. + * @param {Map} params.index - The lookup table map. + * @param {Array<function(object): *} params.fields - The fields to lookup. + * @param {Array<string>} params.as - Output field names for each lookup value. + * @param {*} [params.default] - A default value to use if lookup fails. + */function Lookup(params){Transform.call(this,{},params);}Lookup.Definition={'type':'Lookup','metadata':{'modifies':true},'params':[{'name':'index','type':'index','params':[{'name':'from','type':'data','required':true},{'name':'key','type':'field','required':true}]},{'name':'values','type':'field','array':true},{'name':'fields','type':'field','array':true,'required':true},{'name':'as','type':'string','array':true},{'name':'default','default':null}]};inherits(Lookup,Transform,{transform:function transform(_,pulse){var keys=_.fields,index=_.index,values=_.values,defaultValue=_["default"]==null?null:_["default"],reset=_.modified(),n=keys.length;var flag=reset?pulse.SOURCE:pulse.ADD,out=pulse,as=_.as,set,m,mods;if(values){m=values.length;if(n>1&&!as){error('Multi-field lookup requires explicit "as" parameter.');}if(as&&as.length!==n*m){error('The "as" parameter has too few output field names.');}as=as||values.map(accessorName);set=function set(t){for(var i=0,k=0,j,v;i<n;++i){v=index.get(keys[i](t));if(v==null)for(j=0;j<m;++j,++k)t[as[k]]=defaultValue;else for(j=0;j<m;++j,++k)t[as[k]]=values[j](v);}};}else{if(!as){error('Missing output field names.');}set=function set(t){for(var i=0,v;i<n;++i){v=index.get(keys[i](t));t[as[i]]=v==null?defaultValue:v;}};}if(reset){out=pulse.reflow(true);}else{mods=keys.some(function(k){return pulse.modified(k.fields);});flag|=mods?pulse.MOD:0;}pulse.visit(flag,set);return out.modifies(as);}});/** + * Computes global min/max extents over a collection of extents. + * @constructor + * @param {object} params - The parameters for this operator. + * @param {Array<Array<number>>} params.extents - The input extents. + */function MultiExtent$1(params){Operator.call(this,null,update$1,params);}inherits(MultiExtent$1,Operator);function update$1(_){if(this.value&&!_.modified()){return this.value;}var ext=_.extents,n=ext.length;var min=+Infinity,max=-Infinity,i,e;for(i=0;i<n;++i){e=ext[i];if(e[0]<min)min=e[0];if(e[1]>max)max=e[1];}return[min,max];}/** + * Merge a collection of value arrays. + * @constructor + * @param {object} params - The parameters for this operator. + * @param {Array<Array<*>>} params.values - The input value arrrays. + */function MultiValues$1(params){Operator.call(this,null,update,params);}inherits(MultiValues$1,Operator);function update(_){return this.value&&!_.modified()?this.value:_.values.reduce(function(data,_){return data.concat(_);},[]);}/** + * Operator whose value is simply its parameter hash. This operator is + * useful for enabling reactive updates to values of nested objects. + * @constructor + * @param {object} params - The parameters for this operator. + */function Params$2(params){Transform.call(this,null,params);}inherits(Params$2,Transform,{transform:function transform(_,pulse){this.modified(_.modified());this.value=_;return pulse.fork(pulse.NO_SOURCE|pulse.NO_FIELDS);// do not pass tuples +}});/** + * Aggregate and pivot selected field values to become new fields. + * This operator is useful to construction cross-tabulations. + * @constructor + * @param {Array<function(object): *>} [params.groupby] - An array of accessors + * to groupby. These fields act just like groupby fields of an Aggregate transform. + * @param {function(object): *} params.field - The field to pivot on. The unique + * values of this field become new field names in the output stream. + * @param {function(object): *} params.value - The field to populate pivoted fields. + * The aggregate values of this field become the values of the new pivoted fields. + * @param {string} [params.op] - The aggregation operation for the value field, + * applied per cell in the output stream. The default is "sum". + * @param {number} [params.limit] - An optional parameter indicating the maximum + * number of pivoted fields to generate. The pivoted field names are sorted in + * ascending order prior to enforcing the limit. + */function Pivot(params){Aggregate$1.call(this,params);}Pivot.Definition={'type':'Pivot','metadata':{'generates':true,'changes':true},'params':[{'name':'groupby','type':'field','array':true},{'name':'field','type':'field','required':true},{'name':'value','type':'field','required':true},{'name':'op','type':'enum','values':ValidAggregateOps,'default':'sum'},{'name':'limit','type':'number','default':0},{'name':'key','type':'field'}]};inherits(Pivot,Aggregate$1,{_transform:Aggregate$1.prototype.transform,transform:function transform(_,pulse){return this._transform(aggregateParams(_,pulse),pulse);}});// Shoehorn a pivot transform into an aggregate transform! +// First collect all unique pivot field values. +// Then generate aggregate fields for each output pivot field. +function aggregateParams(_,pulse){var key=_.field,value=_.value,op=(_.op==='count'?'__count__':_.op)||'sum',fields=accessorFields(key).concat(accessorFields(value)),keys=pivotKeys(key,_.limit||0,pulse);// if data stream content changes, pivot fields may change +// flag parameter modification to ensure re-initialization +if(pulse.changed())_.set('__pivot__',null,null,true);return{key:_.key,groupby:_.groupby,ops:keys.map(function(){return op;}),fields:keys.map(function(k){return get$4(k,key,value,fields);}),as:keys.map(function(k){return k+'';}),modified:_.modified.bind(_)};}// Generate aggregate field accessor. +// Output NaN for non-existent values; aggregator will ignore! +function get$4(k,key,value,fields){return accessor(function(d){return key(d)===k?value(d):NaN;},fields,k+'');}// Collect (and optionally limit) all unique pivot values. +function pivotKeys(key,limit,pulse){var map={},list=[];pulse.visit(pulse.SOURCE,function(t){var k=key(t);if(!map[k]){map[k]=1;list.push(k);}});list.sort(ascending$2);return limit?list.slice(0,limit):list;}/** + * Partitions pre-faceted data into tuple subflows. + * @constructor + * @param {object} params - The parameters for this operator. + * @param {function(Dataflow, string): Operator} params.subflow - A function + * that generates a subflow of operators and returns its root operator. + * @param {function(object): Array<object>} params.field - The field + * accessor for an array of subflow tuple objects. + */function PreFacet$1(params){Facet$1.call(this,params);}inherits(PreFacet$1,Facet$1,{transform:function transform(_,pulse){var _this10=this;var flow=_.subflow,field=_.field,subflow=function subflow(t){return _this10.subflow(tupleid(t),flow,pulse,t);};if(_.modified('field')||field&&pulse.modified(accessorFields(field))){error('PreFacet does not support field modification.');}this.initTargets();// reset list of active subflows +if(field){pulse.visit(pulse.MOD,function(t){var sf=subflow(t);field(t).forEach(function(_){return sf.mod(_);});});pulse.visit(pulse.ADD,function(t){var sf=subflow(t);field(t).forEach(function(_){return sf.add(ingest$1(_));});});pulse.visit(pulse.REM,function(t){var sf=subflow(t);field(t).forEach(function(_){return sf.rem(_);});});}else{pulse.visit(pulse.MOD,function(t){return subflow(t).mod(t);});pulse.visit(pulse.ADD,function(t){return subflow(t).add(t);});pulse.visit(pulse.REM,function(t){return subflow(t).rem(t);});}if(pulse.clean()){pulse.runAfter(function(){return _this10.clean();});}return pulse;}});/** + * Performs a relational projection, copying selected fields from source + * tuples to a new set of derived tuples. + * @constructor + * @param {object} params - The parameters for this operator. + * @param {Array<function(object): *} params.fields - The fields to project, + * as an array of field accessors. If unspecified, all fields will be + * copied with names unchanged. + * @param {Array<string>} [params.as] - Output field names for each projected + * field. Any unspecified fields will use the field name provided by + * the field accessor. + */function Project(params){Transform.call(this,null,params);}Project.Definition={'type':'Project','metadata':{'generates':true,'changes':true},'params':[{'name':'fields','type':'field','array':true},{'name':'as','type':'string','null':true,'array':true}]};inherits(Project,Transform,{transform:function transform(_,pulse){var out=pulse.fork(pulse.NO_SOURCE),fields=_.fields,as=fieldNames(_.fields,_.as||[]),derive=fields?function(s,t){return project(s,t,fields,as);}:rederive;var lut;if(this.value){lut=this.value;}else{pulse=pulse.addAll();lut=this.value={};}pulse.visit(pulse.REM,function(t){var id=tupleid(t);out.rem.push(lut[id]);lut[id]=null;});pulse.visit(pulse.ADD,function(t){var dt=derive(t,ingest$1({}));lut[tupleid(t)]=dt;out.add.push(dt);});pulse.visit(pulse.MOD,function(t){out.mod.push(derive(t,lut[tupleid(t)]));});return out;}});function project(s,t,fields,as){for(var i=0,n=fields.length;i<n;++i){t[as[i]]=fields[i](s);}return t;}/** + * Proxy the value of another operator as a pure signal value. + * Ensures no tuples are propagated. + * @constructor + * @param {object} params - The parameters for this operator. + * @param {*} params.value - The value to proxy, becomes the value of this operator. + */function Proxy$1(params){Transform.call(this,null,params);}inherits(Proxy$1,Transform,{transform:function transform(_,pulse){this.value=_.value;return _.modified('value')?pulse.fork(pulse.NO_SOURCE|pulse.NO_FIELDS):pulse.StopPropagation;}});/** + * Generates sample quantile values from an input data stream. + * @constructor + * @param {object} params - The parameters for this operator. + * @param {function(object): *} params.field - An accessor for the data field + * over which to calculate quantile values. + * @param {Array<function(object): *>} [params.groupby] - An array of accessors + * to groupby. + * @param {Array<number>} [params.probs] - An array of probabilities in + * the range (0, 1) for which to compute quantile values. If not specified, + * the *step* parameter will be used. + * @param {Array<number>} [params.step=0.01] - A probability step size for + * sampling quantile values. All values from one-half the step size up to + * 1 (exclusive) will be sampled. This parameter is only used if the + * *quantiles* parameter is not provided. + */function Quantile$1(params){Transform.call(this,null,params);}Quantile$1.Definition={'type':'Quantile','metadata':{'generates':true,'changes':true},'params':[{'name':'groupby','type':'field','array':true},{'name':'field','type':'field','required':true},{'name':'probs','type':'number','array':true},{'name':'step','type':'number','default':0.01},{'name':'as','type':'string','array':true,'default':['prob','value']}]};var EPSILON$2=1e-14;inherits(Quantile$1,Transform,{transform:function transform(_,pulse){var out=pulse.fork(pulse.NO_SOURCE|pulse.NO_FIELDS),as=_.as||['prob','value'];if(this.value&&!_.modified()&&!pulse.changed()){out.source=this.value;return out;}var source=pulse.materialize(pulse.SOURCE).source,groups=partition$1$1(source,_.groupby,_.field),names=(_.groupby||[]).map(accessorName),values=[],step=_.step||0.01,p=_.probs||range$3(step/2,1-EPSILON$2,step),n=p.length;groups.forEach(function(g){var q=quantiles(g,p);for(var i=0;i<n;++i){var t={};for(var _i9=0;_i9<names.length;++_i9){t[names[_i9]]=g.dims[_i9];}t[as[0]]=p[i];t[as[1]]=q[i];values.push(ingest$1(t));}});if(this.value)out.rem=this.value;this.value=out.add=out.source=values;return out;}});/** + * Relays a data stream between data processing pipelines. + * If the derive parameter is set, this transform will create derived + * copies of observed tuples. This provides derived data streams in which + * modifications to the tuples do not pollute an upstream data source. + * @param {object} params - The parameters for this operator. + * @param {number} [params.derive=false] - Boolean flag indicating if + * the transform should make derived copies of incoming tuples. + * @constructor + */function Relay$1(params){Transform.call(this,null,params);}inherits(Relay$1,Transform,{transform:function transform(_,pulse){var out,lut;if(this.value){lut=this.value;}else{out=pulse=pulse.addAll();lut=this.value={};}if(_.derive){out=pulse.fork(pulse.NO_SOURCE);pulse.visit(pulse.REM,function(t){var id=tupleid(t);out.rem.push(lut[id]);lut[id]=null;});pulse.visit(pulse.ADD,function(t){var dt=derive(t);lut[tupleid(t)]=dt;out.add.push(dt);});pulse.visit(pulse.MOD,function(t){var dt=lut[tupleid(t)];for(var k in t){dt[k]=t[k];// down stream writes may overwrite re-derived tuples +// conservatively mark all source fields as modified +out.modifies(k);}out.mod.push(dt);});}return out;}});/** + * Samples tuples passing through this operator. + * Uses reservoir sampling to maintain a representative sample. + * @constructor + * @param {object} params - The parameters for this operator. + * @param {number} [params.size=1000] - The maximum number of samples. + */function Sample(params){Transform.call(this,[],params);this.count=0;}Sample.Definition={'type':'Sample','metadata':{},'params':[{'name':'size','type':'number','default':1000}]};inherits(Sample,Transform,{transform:function transform(_,pulse){var out=pulse.fork(pulse.NO_SOURCE),mod=_.modified('size'),num=_.size,map=this.value.reduce(function(m,t){return m[tupleid(t)]=1,m;},{});var res=this.value,cnt=this.count,cap=0;// sample reservoir update function +function update(t){var p,idx;if(res.length<num){res.push(t);}else{idx=~~((cnt+1)*exports.random());if(idx<res.length&&idx>=cap){p=res[idx];if(map[tupleid(p)])out.rem.push(p);// eviction +res[idx]=t;}}++cnt;}if(pulse.rem.length){// find all tuples that should be removed, add to output +pulse.visit(pulse.REM,function(t){var id=tupleid(t);if(map[id]){map[id]=-1;out.rem.push(t);}--cnt;});// filter removed tuples out of the sample reservoir +res=res.filter(function(t){return map[tupleid(t)]!==-1;});}if((pulse.rem.length||mod)&&res.length<num&&pulse.source){// replenish sample if backing data source is available +cap=cnt=res.length;pulse.visit(pulse.SOURCE,function(t){// update, but skip previously sampled tuples +if(!map[tupleid(t)])update(t);});cap=-1;}if(mod&&res.length>num){var n=res.length-num;for(var i=0;i<n;++i){map[tupleid(res[i])]=-1;out.rem.push(res[i]);}res=res.slice(n);}if(pulse.mod.length){// propagate modified tuples in the sample reservoir +pulse.visit(pulse.MOD,function(t){if(map[tupleid(t)])out.mod.push(t);});}if(pulse.add.length){// update sample reservoir +pulse.visit(pulse.ADD,update);}if(pulse.add.length||cap<0){// output newly added tuples +out.add=res.filter(function(t){return!map[tupleid(t)];});}this.count=cnt;this.value=out.source=res;return out;}});/** + * Generates data tuples for a specified sequence range of numbers. + * @constructor + * @param {object} params - The parameters for this operator. + * @param {number} params.start - The first number in the sequence. + * @param {number} params.stop - The last number (exclusive) in the sequence. + * @param {number} [params.step=1] - The step size between numbers in the sequence. + */function Sequence(params){Transform.call(this,null,params);}Sequence.Definition={'type':'Sequence','metadata':{'generates':true,'changes':true},'params':[{'name':'start','type':'number','required':true},{'name':'stop','type':'number','required':true},{'name':'step','type':'number','default':1},{'name':'as','type':'string','default':'data'}]};inherits(Sequence,Transform,{transform:function transform(_,pulse){if(this.value&&!_.modified())return;var out=pulse.materialize().fork(pulse.MOD),as=_.as||'data';out.rem=this.value?pulse.rem.concat(this.value):pulse.rem;this.value=range$3(_.start,_.stop,_.step||1).map(function(v){var t={};t[as]=v;return ingest$1(t);});out.add=pulse.add.concat(this.value);return out;}});/** + * Propagates a new pulse without any tuples so long as the input + * pulse contains some added, removed or modified tuples. + * @param {object} params - The parameters for this operator. + * @constructor + */function Sieve$1(params){Transform.call(this,null,params);this.modified(true);// always treat as modified +}inherits(Sieve$1,Transform,{transform:function transform(_,pulse){this.value=pulse.source;return pulse.changed()?pulse.fork(pulse.NO_SOURCE|pulse.NO_FIELDS):pulse.StopPropagation;}});/** + * Discretize dates to specific time units. + * @constructor + * @param {object} params - The parameters for this operator. + * @param {function(object): *} params.field - The data field containing date/time values. + */function TimeUnit(params){Transform.call(this,null,params);}var OUTPUT=['unit0','unit1'];TimeUnit.Definition={'type':'TimeUnit','metadata':{'modifies':true},'params':[{'name':'field','type':'field','required':true},{'name':'interval','type':'boolean','default':true},{'name':'units','type':'enum','values':TIME_UNITS,'array':true},{'name':'step','type':'number','default':1},{'name':'maxbins','type':'number','default':40},{'name':'extent','type':'date','array':true},{'name':'timezone','type':'enum','default':'local','values':['local','utc']},{'name':'as','type':'string','array':true,'length':2,'default':OUTPUT}]};inherits(TimeUnit,Transform,{transform:function transform(_,pulse){var field=_.field,band=_.interval!==false,utc=_.timezone==='utc',floor=this._floor(_,pulse),offset=(utc?utcInterval:timeInterval)(floor.unit).offset,as=_.as||OUTPUT,u0=as[0],u1=as[1],step=floor.step;var min=floor.start||Infinity,max=floor.stop||-Infinity,flag=pulse.ADD;if(_.modified()||pulse.changed(pulse.REM)||pulse.modified(accessorFields(field))){pulse=pulse.reflow(true);flag=pulse.SOURCE;min=Infinity;max=-Infinity;}pulse.visit(flag,function(t){var v=field(t);var a,b;if(v==null){t[u0]=null;if(band)t[u1]=null;}else{t[u0]=a=b=floor(v);if(band)t[u1]=b=offset(a,step);if(a<min)min=a;if(b>max)max=b;}});floor.start=min;floor.stop=max;return pulse.modifies(band?as:u0);},_floor:function _floor(_,pulse){var utc=_.timezone==='utc';// get parameters +var _ref9=_.units?{units:_.units,step:_.step||1}:bin$1({extent:_.extent||_extent(pulse.materialize(pulse.SOURCE).source,_.field),maxbins:_.maxbins}),units=_ref9.units,step=_ref9.step;// check / standardize time units +var tunits=timeUnits(units),prev=this.value||{},floor=(utc?utcFloor:timeFloor)(tunits,step);floor.unit=peek$1(tunits);floor.units=tunits;floor.step=step;floor.start=prev.start;floor.stop=prev.stop;return this.value=floor;}});/** + * An index that maps from unique, string-coerced, field values to tuples. + * Assumes that the field serves as a unique key with no duplicate values. + * @constructor + * @param {object} params - The parameters for this operator. + * @param {function(object): *} params.field - The field accessor to index. + */function TupleIndex(params){Transform.call(this,fastmap(),params);}inherits(TupleIndex,Transform,{transform:function transform(_,pulse){var df=pulse.dataflow,field=_.field,index=this.value,set=function set(t){return index.set(field(t),t);};var mod=true;if(_.modified('field')||pulse.modified(field.fields)){index.clear();pulse.visit(pulse.SOURCE,set);}else if(pulse.changed()){pulse.visit(pulse.REM,function(t){return index["delete"](field(t));});pulse.visit(pulse.ADD,set);}else{mod=false;}this.modified(mod);if(index.empty>df.cleanThreshold)df.runAfter(index.clean);return pulse.fork();}});/** + * Extracts an array of values. Assumes the source data has already been + * reduced as needed (e.g., by an upstream Aggregate transform). + * @constructor + * @param {object} params - The parameters for this operator. + * @param {function(object): *} params.field - The domain field to extract. + * @param {function(*,*): number} [params.sort] - An optional + * comparator function for sorting the values. The comparator will be + * applied to backing tuples prior to value extraction. + */function Values$1(params){Transform.call(this,null,params);}inherits(Values$1,Transform,{transform:function transform(_,pulse){var run=!this.value||_.modified('field')||_.modified('sort')||pulse.changed()||_.sort&&pulse.modified(_.sort.fields);if(run){this.value=(_.sort?pulse.source.slice().sort(stableCompare(_.sort)):pulse.source).map(_.field);}}});function WindowOp(op,field,param,as){var fn=WindowOps[op](field,param);return{init:fn.init||zero$3,update:function update(w,t){t[as]=fn.next(w);}};}var WindowOps={row_number:function row_number(){return{next:function next(w){return w.index+1;}};},rank:function rank(){var rank;return{init:function init(){return rank=1;},next:function next(w){var i=w.index,data=w.data;return i&&w.compare(data[i-1],data[i])?rank=i+1:rank;}};},dense_rank:function dense_rank(){var drank;return{init:function init(){return drank=1;},next:function next(w){var i=w.index,d=w.data;return i&&w.compare(d[i-1],d[i])?++drank:drank;}};},percent_rank:function percent_rank(){var rank=WindowOps.rank(),_next2=rank.next;return{init:rank.init,next:function next(w){return(_next2(w)-1)/(w.data.length-1);}};},cume_dist:function cume_dist(){var cume;return{init:function init(){return cume=0;},next:function next(w){var d=w.data,c=w.compare;var i=w.index;if(cume<i){while(i+1<d.length&&!c(d[i],d[i+1]))++i;cume=i;}return(1+cume)/d.length;}};},ntile:function ntile(field,num){num=+num;if(!(num>0))error('ntile num must be greater than zero.');var cume=WindowOps.cume_dist(),_next3=cume.next;return{init:cume.init,next:function next(w){return Math.ceil(num*_next3(w));}};},lag:function lag(field,offset){offset=+offset||1;return{next:function next(w){var i=w.index-offset;return i>=0?field(w.data[i]):null;}};},lead:function lead(field,offset){offset=+offset||1;return{next:function next(w){var i=w.index+offset,d=w.data;return i<d.length?field(d[i]):null;}};},first_value:function first_value(field){return{next:function next(w){return field(w.data[w.i0]);}};},last_value:function last_value(field){return{next:function next(w){return field(w.data[w.i1-1]);}};},nth_value:function nth_value(field,nth){nth=+nth;if(!(nth>0))error('nth_value nth must be greater than zero.');return{next:function next(w){var i=w.i0+(nth-1);return i<w.i1?field(w.data[i]):null;}};},prev_value:function prev_value(field){var prev;return{init:function init(){return prev=null;},next:function next(w){var v=field(w.data[w.index]);return v!=null?prev=v:prev;}};},next_value:function next_value(field){var v,i;return{init:function init(){return v=null,i=-1;},next:function next(w){var d=w.data;return w.index<=i?v:(i=find$2(field,d,w.index))<0?(i=d.length,v=null):v=field(d[i]);}};}};function find$2(field,data,index){for(var n=data.length;index<n;++index){var v=field(data[index]);if(v!=null)return index;}return-1;}var ValidWindowOps=Object.keys(WindowOps);function WindowState(_){var ops=array$5(_.ops),fields=array$5(_.fields),params=array$5(_.params),aggregate_params=array$5(_.aggregate_params),as=array$5(_.as),outputs=this.outputs=[],windows=this.windows=[],inputs={},map={},counts=[],measures=[];var countOnly=true;function visitInputs(f){array$5(accessorFields(f)).forEach(function(_){return inputs[_]=1;});}visitInputs(_.sort);ops.forEach(function(op,i){var field=fields[i],param=params[i],aggregate_param=aggregate_params[i]||null,mname=accessorName(field),name=measureName(op,mname,as[i]);visitInputs(field);outputs.push(name);// Window operation +if(has$1(WindowOps,op)){windows.push(WindowOp(op,field,param,name));}// Aggregate operation +else{if(field==null&&op!=='count'){error('Null aggregate field specified.');}if(op==='count'){counts.push(name);return;}countOnly=false;var _m2=map[mname];if(!_m2){_m2=map[mname]=[];_m2.field=field;measures.push(_m2);}_m2.push(createMeasure(op,aggregate_param,name));}});if(counts.length||measures.length){this.cell=cell(measures,counts,countOnly);}this.inputs=Object.keys(inputs);}var prototype=WindowState.prototype;prototype.init=function(){this.windows.forEach(function(_){return _.init();});if(this.cell)this.cell.init();};prototype.update=function(w,t){var cell=this.cell,wind=this.windows,data=w.data,m=wind&&wind.length;var j;if(cell){for(j=w.p0;j<w.i0;++j)cell.rem(data[j]);for(j=w.p1;j<w.i1;++j)cell.add(data[j]);cell.set(t);}for(j=0;j<m;++j)wind[j].update(w,t);};function cell(measures,counts,countOnly){measures=measures.map(function(m){return compileMeasures(m,m.field);});var cell={num:0,agg:null,store:false,count:counts};if(!countOnly){var n=measures.length,a=cell.agg=Array(n),i=0;for(;i<n;++i)a[i]=new measures[i](cell);}if(cell.store){var store=cell.data=new TupleStore();}cell.add=function(t){cell.num+=1;if(countOnly)return;if(store)store.add(t);for(var _i0=0;_i0<n;++_i0){a[_i0].add(a[_i0].get(t),t);}};cell.rem=function(t){cell.num-=1;if(countOnly)return;if(store)store.rem(t);for(var _i1=0;_i1<n;++_i1){a[_i1].rem(a[_i1].get(t),t);}};cell.set=function(t){var i,n;// consolidate stored values +if(store)store.values();// update tuple properties +for(i=0,n=counts.length;i<n;++i)t[counts[i]]=cell.num;if(!countOnly)for(i=0,n=a.length;i<n;++i)a[i].set(t);};cell.init=function(){cell.num=0;if(store)store.reset();for(var _i10=0;_i10<n;++_i10)a[_i10].init();};return cell;}/** + * Perform window calculations and write results to the input stream. + * @constructor + * @param {object} params - The parameters for this operator. + * @param {function(*,*): number} [params.sort] - A comparator function for sorting tuples within a window. + * @param {Array<function(object): *>} [params.groupby] - An array of accessors by which to partition tuples into separate windows. + * @param {Array<string>} params.ops - An array of strings indicating window operations to perform. + * @param {Array<function(object): *>} [params.fields] - An array of accessors + * for data fields to use as inputs to window operations. + * @param {Array<*>} [params.params] - An array of parameter values for window operations. + * @param {Array<number>} [params.aggregate_params] - An optional array of parameter values for aggregation operations. + * @param {Array<string>} [params.as] - An array of output field names for window operations. + * @param {Array<number>} [params.frame] - Window frame definition as two-element array. + * @param {boolean} [params.ignorePeers=false] - If true, base window frame boundaries on row + * number alone, ignoring peers with identical sort values. If false (default), + * the window boundaries will be adjusted to include peer values. + */function Window(params){Transform.call(this,{},params);this._mlen=0;this._mods=[];}Window.Definition={'type':'Window','metadata':{'modifies':true},'params':[{'name':'sort','type':'compare'},{'name':'groupby','type':'field','array':true},{'name':'ops','type':'enum','array':true,'values':ValidWindowOps.concat(ValidAggregateOps)},{'name':'params','type':'number','null':true,'array':true},{'name':'aggregate_params','type':'number','null':true,'array':true},{'name':'fields','type':'field','null':true,'array':true},{'name':'as','type':'string','null':true,'array':true},{'name':'frame','type':'number','null':true,'array':true,'length':2,'default':[null,0]},{'name':'ignorePeers','type':'boolean','default':false}]};inherits(Window,Transform,{transform:function transform(_,pulse){var _this11=this;this.stamp=pulse.stamp;var mod=_.modified(),cmp=stableCompare(_.sort),key=groupkey(_.groupby),group=function group(t){return _this11.group(key(t));};// initialize window state +var state=this.state;if(!state||mod){state=this.state=new WindowState(_);}// partition input tuples +if(mod||pulse.modified(state.inputs)){this.value={};pulse.visit(pulse.SOURCE,function(t){return group(t).add(t);});}else{pulse.visit(pulse.REM,function(t){return group(t).remove(t);});pulse.visit(pulse.ADD,function(t){return group(t).add(t);});}// perform window calculations for each modified partition +for(var i=0,n=this._mlen;i<n;++i){processPartition(this._mods[i],state,cmp,_);}this._mlen=0;this._mods=[];// TODO don't reflow everything? +return pulse.reflow(mod).modifies(state.outputs);},group:function group(key){var group=this.value[key];if(!group){group=this.value[key]=SortedList(tupleid);group.stamp=-1;}if(group.stamp<this.stamp){group.stamp=this.stamp;this._mods[this._mlen++]=group;}return group;}});function processPartition(list,state,cmp,_){var sort=_.sort,range=sort&&!_.ignorePeers,frame=_.frame||[null,0],data=list.data(cmp),// use cmp for stable sort +n=data.length,b=range?bisector(sort):null,w={i0:0,i1:0,p0:0,p1:0,index:0,data:data,compare:sort||constant$5(-1)};state.init();for(var i=0;i<n;++i){setWindow(w,frame,i,n);if(range)adjustRange(w,b);state.update(w,data[i]);}}function setWindow(w,f,i,n){w.p0=w.i0;w.p1=w.i1;w.i0=f[0]==null?0:Math.max(0,i-Math.abs(f[0]));w.i1=f[1]==null?n:Math.min(n,i+Math.abs(f[1])+1);w.index=i;}// if frame type is 'range', adjust window for peer values +function adjustRange(w,bisect){var r0=w.i0,r1=w.i1-1,c=w.compare,d=w.data,n=d.length-1;if(r0>0&&!c(d[r0],d[r0-1]))w.i0=bisect.left(d,d[r0]);if(r1<n&&!c(d[r1],d[r1+1]))w.i1=bisect.right(d,d[r1]);}var tx=/*#__PURE__*/Object.freeze({__proto__:null,aggregate:Aggregate$1,bin:Bin,collect:Collect$1,compare:Compare$1,countpattern:CountPattern,cross:Cross,density:Density,dotbin:DotBin,expression:Expression$1,extent:Extent,facet:Facet$1,field:Field$1,filter:Filter,flatten:Flatten,fold:Fold,formula:Formula,generate:Generate,impute:Impute,joinaggregate:JoinAggregate,kde:KDE,key:Key$1,load:Load$1,lookup:Lookup,multiextent:MultiExtent$1,multivalues:MultiValues$1,params:Params$2,pivot:Pivot,prefacet:PreFacet$1,project:Project,proxy:Proxy$1,quantile:Quantile$1,relay:Relay$1,sample:Sample,sequence:Sequence,sieve:Sieve$1,subflow:Subflow,timeunit:TimeUnit,tupleindex:TupleIndex,values:Values$1,window:Window});function constant$3(x){return function constant(){return x;};}var abs$2=Math.abs;var atan2$1=Math.atan2;var cos$2=Math.cos;var max$1=Math.max;var min$1=Math.min;var sin$2=Math.sin;var sqrt$3=Math.sqrt;var epsilon$5=1e-12;var pi$3=Math.PI;var halfPi$2=pi$3/2;var tau$3=2*pi$3;function acos$1(x){return x>1?0:x<-1?pi$3:Math.acos(x);}function asin$2(x){return x>=1?halfPi$2:x<=-1?-halfPi$2:Math.asin(x);}var pi$2=Math.PI,tau$2=2*pi$2,epsilon$4=1e-6,tauEpsilon=tau$2-epsilon$4;function append$1(strings){this._+=strings[0];for(var i=1,n=strings.length;i<n;++i){this._+=arguments[i]+strings[i];}}function appendRound$1(digits){var d=Math.floor(digits);if(!(d>=0))throw new Error("invalid digits: ".concat(digits));if(d>15)return append$1;var k=Math.pow(10,d);return function(strings){this._+=strings[0];for(var i=1,n=strings.length;i<n;++i){this._+=Math.round(arguments[i]*k)/k+strings[i];}};}var Path$1=/*#__PURE__*/function(){function Path(digits){_classCallCheck(this,Path);this._x0=this._y0=// start of current subpath +this._x1=this._y1=null;// end of current subpath +this._="";this._append=digits==null?append$1:appendRound$1(digits);}return _createClass(Path,[{key:"moveTo",value:function moveTo(x,y){this._append(_templateObject||(_templateObject=_taggedTemplateLiteral(["M",",",""])),this._x0=this._x1=+x,this._y0=this._y1=+y);}},{key:"closePath",value:function closePath(){if(this._x1!==null){this._x1=this._x0,this._y1=this._y0;this._append(_templateObject2||(_templateObject2=_taggedTemplateLiteral(["Z"])));}}},{key:"lineTo",value:function lineTo(x,y){this._append(_templateObject3||(_templateObject3=_taggedTemplateLiteral(["L",",",""])),this._x1=+x,this._y1=+y);}},{key:"quadraticCurveTo",value:function quadraticCurveTo(x1,y1,x,y){this._append(_templateObject4||(_templateObject4=_taggedTemplateLiteral(["Q",",",",",",",""])),+x1,+y1,this._x1=+x,this._y1=+y);}},{key:"bezierCurveTo",value:function bezierCurveTo(x1,y1,x2,y2,x,y){this._append(_templateObject5||(_templateObject5=_taggedTemplateLiteral(["C",",",",",",",",",",",""])),+x1,+y1,+x2,+y2,this._x1=+x,this._y1=+y);}},{key:"arcTo",value:function arcTo(x1,y1,x2,y2,r){x1=+x1,y1=+y1,x2=+x2,y2=+y2,r=+r;// Is the radius negative? Error. +if(r<0)throw new Error("negative radius: ".concat(r));var x0=this._x1,y0=this._y1,x21=x2-x1,y21=y2-y1,x01=x0-x1,y01=y0-y1,l01_2=x01*x01+y01*y01;// Is this path empty? Move to (x1,y1). +if(this._x1===null){this._append(_templateObject6||(_templateObject6=_taggedTemplateLiteral(["M",",",""])),this._x1=x1,this._y1=y1);}// Or, is (x1,y1) coincident with (x0,y0)? Do nothing. +else if(!(l01_2>epsilon$4));// Or, are (x0,y0), (x1,y1) and (x2,y2) collinear? +// Equivalently, is (x1,y1) coincident with (x2,y2)? +// Or, is the radius zero? Line to (x1,y1). +else if(!(Math.abs(y01*x21-y21*x01)>epsilon$4)||!r){this._append(_templateObject7||(_templateObject7=_taggedTemplateLiteral(["L",",",""])),this._x1=x1,this._y1=y1);}// Otherwise, draw an arc! +else{var x20=x2-x0,y20=y2-y0,l21_2=x21*x21+y21*y21,l20_2=x20*x20+y20*y20,l21=Math.sqrt(l21_2),l01=Math.sqrt(l01_2),l=r*Math.tan((pi$2-Math.acos((l21_2+l01_2-l20_2)/(2*l21*l01)))/2),t01=l/l01,t21=l/l21;// If the start tangent is not coincident with (x0,y0), line to. +if(Math.abs(t01-1)>epsilon$4){this._append(_templateObject8||(_templateObject8=_taggedTemplateLiteral(["L",",",""])),x1+t01*x01,y1+t01*y01);}this._append(_templateObject9||(_templateObject9=_taggedTemplateLiteral(["A",",",",0,0,",",",",",""])),r,r,+(y01*x20>x01*y20),this._x1=x1+t21*x21,this._y1=y1+t21*y21);}}},{key:"arc",value:function arc(x,y,r,a0,a1,ccw){x=+x,y=+y,r=+r,ccw=!!ccw;// Is the radius negative? Error. +if(r<0)throw new Error("negative radius: ".concat(r));var dx=r*Math.cos(a0),dy=r*Math.sin(a0),x0=x+dx,y0=y+dy,cw=1^ccw,da=ccw?a0-a1:a1-a0;// Is this path empty? Move to (x0,y0). +if(this._x1===null){this._append(_templateObject0||(_templateObject0=_taggedTemplateLiteral(["M",",",""])),x0,y0);}// Or, is (x0,y0) not coincident with the previous point? Line to (x0,y0). +else if(Math.abs(this._x1-x0)>epsilon$4||Math.abs(this._y1-y0)>epsilon$4){this._append(_templateObject1||(_templateObject1=_taggedTemplateLiteral(["L",",",""])),x0,y0);}// Is this arc empty? We’re done. +if(!r)return;// Does the angle go the wrong way? Flip the direction. +if(da<0)da=da%tau$2+tau$2;// Is this a complete circle? Draw two arcs to complete the circle. +if(da>tauEpsilon){this._append(_templateObject10||(_templateObject10=_taggedTemplateLiteral(["A",",",",0,1,",",",",","A",",",",0,1,",",",",",""])),r,r,cw,x-dx,y-dy,r,r,cw,this._x1=x0,this._y1=y0);}// Is this arc non-empty? Draw an arc! +else if(da>epsilon$4){this._append(_templateObject11||(_templateObject11=_taggedTemplateLiteral(["A",",",",0,",",",",",",",""])),r,r,+(da>=pi$2),cw,this._x1=x+r*Math.cos(a1),this._y1=y+r*Math.sin(a1));}}},{key:"rect",value:function rect(x,y,w,h){this._append(_templateObject12||(_templateObject12=_taggedTemplateLiteral(["M",",","h","v","h","Z"])),this._x0=this._x1=+x,this._y0=this._y1=+y,w=+w,+h,-w);}},{key:"toString",value:function toString(){return this._;}}]);}();function path$3(){return new Path$1();}// Allow instanceof d3.path +path$3.prototype=Path$1.prototype;function withPath(shape){var digits=3;shape.digits=function(_){if(!arguments.length)return digits;if(_==null){digits=null;}else{var d=Math.floor(_);if(!(d>=0))throw new RangeError("invalid digits: ".concat(_));digits=d;}return shape;};return function(){return new Path$1(digits);};}function arcInnerRadius(d){return d.innerRadius;}function arcOuterRadius(d){return d.outerRadius;}function arcStartAngle(d){return d.startAngle;}function arcEndAngle(d){return d.endAngle;}function arcPadAngle(d){return d&&d.padAngle;// Note: optional! +}function intersect$3(x0,y0,x1,y1,x2,y2,x3,y3){var x10=x1-x0,y10=y1-y0,x32=x3-x2,y32=y3-y2,t=y32*x10-x32*y10;if(t*t<epsilon$5)return;t=(x32*(y0-y2)-y32*(x0-x2))/t;return[x0+t*x10,y0+t*y10];}// Compute perpendicular offset line of length rc. +// http://mathworld.wolfram.com/Circle-LineIntersection.html +function cornerTangents(x0,y0,x1,y1,r1,rc,cw){var x01=x0-x1,y01=y0-y1,lo=(cw?rc:-rc)/sqrt$3(x01*x01+y01*y01),ox=lo*y01,oy=-lo*x01,x11=x0+ox,y11=y0+oy,x10=x1+ox,y10=y1+oy,x00=(x11+x10)/2,y00=(y11+y10)/2,dx=x10-x11,dy=y10-y11,d2=dx*dx+dy*dy,r=r1-rc,D=x11*y10-x10*y11,d=(dy<0?-1:1)*sqrt$3(max$1(0,r*r*d2-D*D)),cx0=(D*dy-dx*d)/d2,cy0=(-D*dx-dy*d)/d2,cx1=(D*dy+dx*d)/d2,cy1=(-D*dx+dy*d)/d2,dx0=cx0-x00,dy0=cy0-y00,dx1=cx1-x00,dy1=cy1-y00;// Pick the closer of the two intersection points. +// TODO Is there a faster way to determine which intersection to use? +if(dx0*dx0+dy0*dy0>dx1*dx1+dy1*dy1)cx0=cx1,cy0=cy1;return{cx:cx0,cy:cy0,x01:-ox,y01:-oy,x11:cx0*(r1/r-1),y11:cy0*(r1/r-1)};}function arc$2$1(){var innerRadius=arcInnerRadius,outerRadius=arcOuterRadius,cornerRadius=constant$3(0),padRadius=null,startAngle=arcStartAngle,endAngle=arcEndAngle,padAngle=arcPadAngle,context=null,path=withPath(arc);function arc(){var buffer,r,r0=+innerRadius.apply(this,arguments),r1=+outerRadius.apply(this,arguments),a0=startAngle.apply(this,arguments)-halfPi$2,a1=endAngle.apply(this,arguments)-halfPi$2,da=abs$2(a1-a0),cw=a1>a0;if(!context)context=buffer=path();// Ensure that the outer radius is always larger than the inner radius. +if(r1<r0)r=r1,r1=r0,r0=r;// Is it a point? +if(!(r1>epsilon$5))context.moveTo(0,0);// Or is it a circle or annulus? +else if(da>tau$3-epsilon$5){context.moveTo(r1*cos$2(a0),r1*sin$2(a0));context.arc(0,0,r1,a0,a1,!cw);if(r0>epsilon$5){context.moveTo(r0*cos$2(a1),r0*sin$2(a1));context.arc(0,0,r0,a1,a0,cw);}}// Or is it a circular or annular sector? +else{var a01=a0,a11=a1,a00=a0,a10=a1,da0=da,da1=da,ap=padAngle.apply(this,arguments)/2,rp=ap>epsilon$5&&(padRadius?+padRadius.apply(this,arguments):sqrt$3(r0*r0+r1*r1)),rc=min$1(abs$2(r1-r0)/2,+cornerRadius.apply(this,arguments)),rc0=rc,rc1=rc,t0,t1;// Apply padding? Note that since r1 ≥ r0, da1 ≥ da0. +if(rp>epsilon$5){var p0=asin$2(rp/r0*sin$2(ap)),p1=asin$2(rp/r1*sin$2(ap));if((da0-=p0*2)>epsilon$5)p0*=cw?1:-1,a00+=p0,a10-=p0;else da0=0,a00=a10=(a0+a1)/2;if((da1-=p1*2)>epsilon$5)p1*=cw?1:-1,a01+=p1,a11-=p1;else da1=0,a01=a11=(a0+a1)/2;}var x01=r1*cos$2(a01),y01=r1*sin$2(a01),x10=r0*cos$2(a10),y10=r0*sin$2(a10);// Apply rounded corners? +if(rc>epsilon$5){var x11=r1*cos$2(a11),y11=r1*sin$2(a11),x00=r0*cos$2(a00),y00=r0*sin$2(a00),oc;// Restrict the corner radius according to the sector angle. If this +// intersection fails, it’s probably because the arc is too small, so +// disable the corner radius entirely. +if(da<pi$3){if(oc=intersect$3(x01,y01,x00,y00,x11,y11,x10,y10)){var ax=x01-oc[0],ay=y01-oc[1],bx=x11-oc[0],by=y11-oc[1],kc=1/sin$2(acos$1((ax*bx+ay*by)/(sqrt$3(ax*ax+ay*ay)*sqrt$3(bx*bx+by*by)))/2),lc=sqrt$3(oc[0]*oc[0]+oc[1]*oc[1]);rc0=min$1(rc,(r0-lc)/(kc-1));rc1=min$1(rc,(r1-lc)/(kc+1));}else{rc0=rc1=0;}}}// Is the sector collapsed to a line? +if(!(da1>epsilon$5))context.moveTo(x01,y01);// Does the sector’s outer ring have rounded corners? +else if(rc1>epsilon$5){t0=cornerTangents(x00,y00,x01,y01,r1,rc1,cw);t1=cornerTangents(x11,y11,x10,y10,r1,rc1,cw);context.moveTo(t0.cx+t0.x01,t0.cy+t0.y01);// Have the corners merged? +if(rc1<rc)context.arc(t0.cx,t0.cy,rc1,atan2$1(t0.y01,t0.x01),atan2$1(t1.y01,t1.x01),!cw);// Otherwise, draw the two corners and the ring. +else{context.arc(t0.cx,t0.cy,rc1,atan2$1(t0.y01,t0.x01),atan2$1(t0.y11,t0.x11),!cw);context.arc(0,0,r1,atan2$1(t0.cy+t0.y11,t0.cx+t0.x11),atan2$1(t1.cy+t1.y11,t1.cx+t1.x11),!cw);context.arc(t1.cx,t1.cy,rc1,atan2$1(t1.y11,t1.x11),atan2$1(t1.y01,t1.x01),!cw);}}// Or is the outer ring just a circular arc? +else context.moveTo(x01,y01),context.arc(0,0,r1,a01,a11,!cw);// Is there no inner ring, and it’s a circular sector? +// Or perhaps it’s an annular sector collapsed due to padding? +if(!(r0>epsilon$5)||!(da0>epsilon$5))context.lineTo(x10,y10);// Does the sector’s inner ring (or point) have rounded corners? +else if(rc0>epsilon$5){t0=cornerTangents(x10,y10,x11,y11,r0,-rc0,cw);t1=cornerTangents(x01,y01,x00,y00,r0,-rc0,cw);context.lineTo(t0.cx+t0.x01,t0.cy+t0.y01);// Have the corners merged? +if(rc0<rc)context.arc(t0.cx,t0.cy,rc0,atan2$1(t0.y01,t0.x01),atan2$1(t1.y01,t1.x01),!cw);// Otherwise, draw the two corners and the ring. +else{context.arc(t0.cx,t0.cy,rc0,atan2$1(t0.y01,t0.x01),atan2$1(t0.y11,t0.x11),!cw);context.arc(0,0,r0,atan2$1(t0.cy+t0.y11,t0.cx+t0.x11),atan2$1(t1.cy+t1.y11,t1.cx+t1.x11),cw);context.arc(t1.cx,t1.cy,rc0,atan2$1(t1.y11,t1.x11),atan2$1(t1.y01,t1.x01),!cw);}}// Or is the inner ring just a circular arc? +else context.arc(0,0,r0,a10,a00,cw);}context.closePath();if(buffer)return context=null,buffer+""||null;}arc.centroid=function(){var r=(+innerRadius.apply(this,arguments)+ +outerRadius.apply(this,arguments))/2,a=(+startAngle.apply(this,arguments)+ +endAngle.apply(this,arguments))/2-pi$3/2;return[cos$2(a)*r,sin$2(a)*r];};arc.innerRadius=function(_){return arguments.length?(innerRadius=typeof _==="function"?_:constant$3(+_),arc):innerRadius;};arc.outerRadius=function(_){return arguments.length?(outerRadius=typeof _==="function"?_:constant$3(+_),arc):outerRadius;};arc.cornerRadius=function(_){return arguments.length?(cornerRadius=typeof _==="function"?_:constant$3(+_),arc):cornerRadius;};arc.padRadius=function(_){return arguments.length?(padRadius=_==null?null:typeof _==="function"?_:constant$3(+_),arc):padRadius;};arc.startAngle=function(_){return arguments.length?(startAngle=typeof _==="function"?_:constant$3(+_),arc):startAngle;};arc.endAngle=function(_){return arguments.length?(endAngle=typeof _==="function"?_:constant$3(+_),arc):endAngle;};arc.padAngle=function(_){return arguments.length?(padAngle=typeof _==="function"?_:constant$3(+_),arc):padAngle;};arc.context=function(_){return arguments.length?(context=_==null?null:_,arc):context;};return arc;}function array$4(x){return _typeof(x)==="object"&&"length"in x?x// Array, TypedArray, NodeList, array-like +:Array.from(x);// Map, Set, iterable, string, or anything else +}function Linear$1(context){this._context=context;}Linear$1.prototype={areaStart:function areaStart(){this._line=0;},areaEnd:function areaEnd(){this._line=NaN;},lineStart:function lineStart(){this._point=0;},lineEnd:function lineEnd(){if(this._line||this._line!==0&&this._point===1)this._context.closePath();this._line=1-this._line;},point:function point(x,y){x=+x,y=+y;switch(this._point){case 0:this._point=1;this._line?this._context.lineTo(x,y):this._context.moveTo(x,y);break;case 1:this._point=2;// falls through +default:this._context.lineTo(x,y);break;}}};function curveLinear(context){return new Linear$1(context);}function x$3(p){return p[0];}function y$3(p){return p[1];}function line$2$1(x,y){var defined=constant$3(true),context=null,curve=curveLinear,output=null,path=withPath(line);x=typeof x==="function"?x:x===undefined?x$3:constant$3(x);y=typeof y==="function"?y:y===undefined?y$3:constant$3(y);function line(data){var i,n=(data=array$4(data)).length,d,defined0=false,buffer;if(context==null)output=curve(buffer=path());for(i=0;i<=n;++i){if(!(i<n&&defined(d=data[i],i,data))===defined0){if(defined0=!defined0)output.lineStart();else output.lineEnd();}if(defined0)output.point(+x(d,i,data),+y(d,i,data));}if(buffer)return output=null,buffer+""||null;}line.x=function(_){return arguments.length?(x=typeof _==="function"?_:constant$3(+_),line):x;};line.y=function(_){return arguments.length?(y=typeof _==="function"?_:constant$3(+_),line):y;};line.defined=function(_){return arguments.length?(defined=typeof _==="function"?_:constant$3(!!_),line):defined;};line.curve=function(_){return arguments.length?(curve=_,context!=null&&(output=curve(context)),line):curve;};line.context=function(_){return arguments.length?(_==null?context=output=null:output=curve(context=_),line):context;};return line;}function area$2$1(x0,y0,y1){var x1=null,defined=constant$3(true),context=null,curve=curveLinear,output=null,path=withPath(area);x0=typeof x0==="function"?x0:x0===undefined?x$3:constant$3(+x0);y0=typeof y0==="function"?y0:y0===undefined?constant$3(0):constant$3(+y0);y1=typeof y1==="function"?y1:y1===undefined?y$3:constant$3(+y1);function area(data){var i,j,k,n=(data=array$4(data)).length,d,defined0=false,buffer,x0z=new Array(n),y0z=new Array(n);if(context==null)output=curve(buffer=path());for(i=0;i<=n;++i){if(!(i<n&&defined(d=data[i],i,data))===defined0){if(defined0=!defined0){j=i;output.areaStart();output.lineStart();}else{output.lineEnd();output.lineStart();for(k=i-1;k>=j;--k){output.point(x0z[k],y0z[k]);}output.lineEnd();output.areaEnd();}}if(defined0){x0z[i]=+x0(d,i,data),y0z[i]=+y0(d,i,data);output.point(x1?+x1(d,i,data):x0z[i],y1?+y1(d,i,data):y0z[i]);}}if(buffer)return output=null,buffer+""||null;}function arealine(){return line$2$1().defined(defined).curve(curve).context(context);}area.x=function(_){return arguments.length?(x0=typeof _==="function"?_:constant$3(+_),x1=null,area):x0;};area.x0=function(_){return arguments.length?(x0=typeof _==="function"?_:constant$3(+_),area):x0;};area.x1=function(_){return arguments.length?(x1=_==null?null:typeof _==="function"?_:constant$3(+_),area):x1;};area.y=function(_){return arguments.length?(y0=typeof _==="function"?_:constant$3(+_),y1=null,area):y0;};area.y0=function(_){return arguments.length?(y0=typeof _==="function"?_:constant$3(+_),area):y0;};area.y1=function(_){return arguments.length?(y1=_==null?null:typeof _==="function"?_:constant$3(+_),area):y1;};area.lineX0=area.lineY0=function(){return arealine().x(x0).y(y0);};area.lineY1=function(){return arealine().x(x0).y(y1);};area.lineX1=function(){return arealine().x(x1).y(y0);};area.defined=function(_){return arguments.length?(defined=typeof _==="function"?_:constant$3(!!_),area):defined;};area.curve=function(_){return arguments.length?(curve=_,context!=null&&(output=curve(context)),area):curve;};area.context=function(_){return arguments.length?(_==null?context=output=null:output=curve(context=_),area):context;};return area;}var circle={draw:function draw(context,size){var r=sqrt$3(size/pi$3);context.moveTo(r,0);context.arc(0,0,r,0,tau$3);}};function Symbol$1(type,size){var context=null,path=withPath(symbol);type=typeof type==="function"?type:constant$3(type||circle);size=typeof size==="function"?size:constant$3(size===undefined?64:+size);function symbol(){var buffer;if(!context)context=buffer=path();type.apply(this,arguments).draw(context,+size.apply(this,arguments));if(buffer)return context=null,buffer+""||null;}symbol.type=function(_){return arguments.length?(type=typeof _==="function"?_:constant$3(_),symbol):type;};symbol.size=function(_){return arguments.length?(size=typeof _==="function"?_:constant$3(+_),symbol):size;};symbol.context=function(_){return arguments.length?(context=_==null?null:_,symbol):context;};return symbol;}function noop$3(){}function point$5(that,x,y){that._context.bezierCurveTo((2*that._x0+that._x1)/3,(2*that._y0+that._y1)/3,(that._x0+2*that._x1)/3,(that._y0+2*that._y1)/3,(that._x0+4*that._x1+x)/6,(that._y0+4*that._y1+y)/6);}function Basis(context){this._context=context;}Basis.prototype={areaStart:function areaStart(){this._line=0;},areaEnd:function areaEnd(){this._line=NaN;},lineStart:function lineStart(){this._x0=this._x1=this._y0=this._y1=NaN;this._point=0;},lineEnd:function lineEnd(){switch(this._point){case 3:point$5(this,this._x1,this._y1);// falls through +case 2:this._context.lineTo(this._x1,this._y1);break;}if(this._line||this._line!==0&&this._point===1)this._context.closePath();this._line=1-this._line;},point:function point(x,y){x=+x,y=+y;switch(this._point){case 0:this._point=1;this._line?this._context.lineTo(x,y):this._context.moveTo(x,y);break;case 1:this._point=2;break;case 2:this._point=3;this._context.lineTo((5*this._x0+this._x1)/6,(5*this._y0+this._y1)/6);// falls through +default:point$5(this,x,y);break;}this._x0=this._x1,this._x1=x;this._y0=this._y1,this._y1=y;}};function curveBasis(context){return new Basis(context);}function BasisClosed(context){this._context=context;}BasisClosed.prototype={areaStart:noop$3,areaEnd:noop$3,lineStart:function lineStart(){this._x0=this._x1=this._x2=this._x3=this._x4=this._y0=this._y1=this._y2=this._y3=this._y4=NaN;this._point=0;},lineEnd:function lineEnd(){switch(this._point){case 1:{this._context.moveTo(this._x2,this._y2);this._context.closePath();break;}case 2:{this._context.moveTo((this._x2+2*this._x3)/3,(this._y2+2*this._y3)/3);this._context.lineTo((this._x3+2*this._x2)/3,(this._y3+2*this._y2)/3);this._context.closePath();break;}case 3:{this.point(this._x2,this._y2);this.point(this._x3,this._y3);this.point(this._x4,this._y4);break;}}},point:function point(x,y){x=+x,y=+y;switch(this._point){case 0:this._point=1;this._x2=x,this._y2=y;break;case 1:this._point=2;this._x3=x,this._y3=y;break;case 2:this._point=3;this._x4=x,this._y4=y;this._context.moveTo((this._x0+4*this._x1+x)/6,(this._y0+4*this._y1+y)/6);break;default:point$5(this,x,y);break;}this._x0=this._x1,this._x1=x;this._y0=this._y1,this._y1=y;}};function curveBasisClosed(context){return new BasisClosed(context);}function BasisOpen(context){this._context=context;}BasisOpen.prototype={areaStart:function areaStart(){this._line=0;},areaEnd:function areaEnd(){this._line=NaN;},lineStart:function lineStart(){this._x0=this._x1=this._y0=this._y1=NaN;this._point=0;},lineEnd:function lineEnd(){if(this._line||this._line!==0&&this._point===3)this._context.closePath();this._line=1-this._line;},point:function point(x,y){x=+x,y=+y;switch(this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3;var x0=(this._x0+4*this._x1+x)/6,y0=(this._y0+4*this._y1+y)/6;this._line?this._context.lineTo(x0,y0):this._context.moveTo(x0,y0);break;case 3:this._point=4;// falls through +default:point$5(this,x,y);break;}this._x0=this._x1,this._x1=x;this._y0=this._y1,this._y1=y;}};function curveBasisOpen(context){return new BasisOpen(context);}function Bundle(context,beta){this._basis=new Basis(context);this._beta=beta;}Bundle.prototype={lineStart:function lineStart(){this._x=[];this._y=[];this._basis.lineStart();},lineEnd:function lineEnd(){var x=this._x,y=this._y,j=x.length-1;if(j>0){var x0=x[0],y0=y[0],dx=x[j]-x0,dy=y[j]-y0,i=-1,t;while(++i<=j){t=i/j;this._basis.point(this._beta*x[i]+(1-this._beta)*(x0+t*dx),this._beta*y[i]+(1-this._beta)*(y0+t*dy));}}this._x=this._y=null;this._basis.lineEnd();},point:function point(x,y){this._x.push(+x);this._y.push(+y);}};var curveBundle=function custom(beta){function bundle(context){return beta===1?new Basis(context):new Bundle(context,beta);}bundle.beta=function(beta){return custom(+beta);};return bundle;}(0.85);function point$4(that,x,y){that._context.bezierCurveTo(that._x1+that._k*(that._x2-that._x0),that._y1+that._k*(that._y2-that._y0),that._x2+that._k*(that._x1-x),that._y2+that._k*(that._y1-y),that._x2,that._y2);}function Cardinal(context,tension){this._context=context;this._k=(1-tension)/6;}Cardinal.prototype={areaStart:function areaStart(){this._line=0;},areaEnd:function areaEnd(){this._line=NaN;},lineStart:function lineStart(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN;this._point=0;},lineEnd:function lineEnd(){switch(this._point){case 2:this._context.lineTo(this._x2,this._y2);break;case 3:point$4(this,this._x1,this._y1);break;}if(this._line||this._line!==0&&this._point===1)this._context.closePath();this._line=1-this._line;},point:function point(x,y){x=+x,y=+y;switch(this._point){case 0:this._point=1;this._line?this._context.lineTo(x,y):this._context.moveTo(x,y);break;case 1:this._point=2;this._x1=x,this._y1=y;break;case 2:this._point=3;// falls through +default:point$4(this,x,y);break;}this._x0=this._x1,this._x1=this._x2,this._x2=x;this._y0=this._y1,this._y1=this._y2,this._y2=y;}};var curveCardinal=function custom(tension){function cardinal(context){return new Cardinal(context,tension);}cardinal.tension=function(tension){return custom(+tension);};return cardinal;}(0);function CardinalClosed(context,tension){this._context=context;this._k=(1-tension)/6;}CardinalClosed.prototype={areaStart:noop$3,areaEnd:noop$3,lineStart:function lineStart(){this._x0=this._x1=this._x2=this._x3=this._x4=this._x5=this._y0=this._y1=this._y2=this._y3=this._y4=this._y5=NaN;this._point=0;},lineEnd:function lineEnd(){switch(this._point){case 1:{this._context.moveTo(this._x3,this._y3);this._context.closePath();break;}case 2:{this._context.lineTo(this._x3,this._y3);this._context.closePath();break;}case 3:{this.point(this._x3,this._y3);this.point(this._x4,this._y4);this.point(this._x5,this._y5);break;}}},point:function point(x,y){x=+x,y=+y;switch(this._point){case 0:this._point=1;this._x3=x,this._y3=y;break;case 1:this._point=2;this._context.moveTo(this._x4=x,this._y4=y);break;case 2:this._point=3;this._x5=x,this._y5=y;break;default:point$4(this,x,y);break;}this._x0=this._x1,this._x1=this._x2,this._x2=x;this._y0=this._y1,this._y1=this._y2,this._y2=y;}};var curveCardinalClosed=function custom(tension){function cardinal(context){return new CardinalClosed(context,tension);}cardinal.tension=function(tension){return custom(+tension);};return cardinal;}(0);function CardinalOpen(context,tension){this._context=context;this._k=(1-tension)/6;}CardinalOpen.prototype={areaStart:function areaStart(){this._line=0;},areaEnd:function areaEnd(){this._line=NaN;},lineStart:function lineStart(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN;this._point=0;},lineEnd:function lineEnd(){if(this._line||this._line!==0&&this._point===3)this._context.closePath();this._line=1-this._line;},point:function point(x,y){x=+x,y=+y;switch(this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3;this._line?this._context.lineTo(this._x2,this._y2):this._context.moveTo(this._x2,this._y2);break;case 3:this._point=4;// falls through +default:point$4(this,x,y);break;}this._x0=this._x1,this._x1=this._x2,this._x2=x;this._y0=this._y1,this._y1=this._y2,this._y2=y;}};var curveCardinalOpen=function custom(tension){function cardinal(context){return new CardinalOpen(context,tension);}cardinal.tension=function(tension){return custom(+tension);};return cardinal;}(0);function point$3(that,x,y){var x1=that._x1,y1=that._y1,x2=that._x2,y2=that._y2;if(that._l01_a>epsilon$5){var a=2*that._l01_2a+3*that._l01_a*that._l12_a+that._l12_2a,n=3*that._l01_a*(that._l01_a+that._l12_a);x1=(x1*a-that._x0*that._l12_2a+that._x2*that._l01_2a)/n;y1=(y1*a-that._y0*that._l12_2a+that._y2*that._l01_2a)/n;}if(that._l23_a>epsilon$5){var b=2*that._l23_2a+3*that._l23_a*that._l12_a+that._l12_2a,m=3*that._l23_a*(that._l23_a+that._l12_a);x2=(x2*b+that._x1*that._l23_2a-x*that._l12_2a)/m;y2=(y2*b+that._y1*that._l23_2a-y*that._l12_2a)/m;}that._context.bezierCurveTo(x1,y1,x2,y2,that._x2,that._y2);}function CatmullRom(context,alpha){this._context=context;this._alpha=alpha;}CatmullRom.prototype={areaStart:function areaStart(){this._line=0;},areaEnd:function areaEnd(){this._line=NaN;},lineStart:function lineStart(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN;this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0;},lineEnd:function lineEnd(){switch(this._point){case 2:this._context.lineTo(this._x2,this._y2);break;case 3:this.point(this._x2,this._y2);break;}if(this._line||this._line!==0&&this._point===1)this._context.closePath();this._line=1-this._line;},point:function point(x,y){x=+x,y=+y;if(this._point){var x23=this._x2-x,y23=this._y2-y;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(x23*x23+y23*y23,this._alpha));}switch(this._point){case 0:this._point=1;this._line?this._context.lineTo(x,y):this._context.moveTo(x,y);break;case 1:this._point=2;break;case 2:this._point=3;// falls through +default:point$3(this,x,y);break;}this._l01_a=this._l12_a,this._l12_a=this._l23_a;this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a;this._x0=this._x1,this._x1=this._x2,this._x2=x;this._y0=this._y1,this._y1=this._y2,this._y2=y;}};var curveCatmullRom=function custom(alpha){function catmullRom(context){return alpha?new CatmullRom(context,alpha):new Cardinal(context,0);}catmullRom.alpha=function(alpha){return custom(+alpha);};return catmullRom;}(0.5);function CatmullRomClosed(context,alpha){this._context=context;this._alpha=alpha;}CatmullRomClosed.prototype={areaStart:noop$3,areaEnd:noop$3,lineStart:function lineStart(){this._x0=this._x1=this._x2=this._x3=this._x4=this._x5=this._y0=this._y1=this._y2=this._y3=this._y4=this._y5=NaN;this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0;},lineEnd:function lineEnd(){switch(this._point){case 1:{this._context.moveTo(this._x3,this._y3);this._context.closePath();break;}case 2:{this._context.lineTo(this._x3,this._y3);this._context.closePath();break;}case 3:{this.point(this._x3,this._y3);this.point(this._x4,this._y4);this.point(this._x5,this._y5);break;}}},point:function point(x,y){x=+x,y=+y;if(this._point){var x23=this._x2-x,y23=this._y2-y;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(x23*x23+y23*y23,this._alpha));}switch(this._point){case 0:this._point=1;this._x3=x,this._y3=y;break;case 1:this._point=2;this._context.moveTo(this._x4=x,this._y4=y);break;case 2:this._point=3;this._x5=x,this._y5=y;break;default:point$3(this,x,y);break;}this._l01_a=this._l12_a,this._l12_a=this._l23_a;this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a;this._x0=this._x1,this._x1=this._x2,this._x2=x;this._y0=this._y1,this._y1=this._y2,this._y2=y;}};var curveCatmullRomClosed=function custom(alpha){function catmullRom(context){return alpha?new CatmullRomClosed(context,alpha):new CardinalClosed(context,0);}catmullRom.alpha=function(alpha){return custom(+alpha);};return catmullRom;}(0.5);function CatmullRomOpen(context,alpha){this._context=context;this._alpha=alpha;}CatmullRomOpen.prototype={areaStart:function areaStart(){this._line=0;},areaEnd:function areaEnd(){this._line=NaN;},lineStart:function lineStart(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN;this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0;},lineEnd:function lineEnd(){if(this._line||this._line!==0&&this._point===3)this._context.closePath();this._line=1-this._line;},point:function point(x,y){x=+x,y=+y;if(this._point){var x23=this._x2-x,y23=this._y2-y;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(x23*x23+y23*y23,this._alpha));}switch(this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3;this._line?this._context.lineTo(this._x2,this._y2):this._context.moveTo(this._x2,this._y2);break;case 3:this._point=4;// falls through +default:point$3(this,x,y);break;}this._l01_a=this._l12_a,this._l12_a=this._l23_a;this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a;this._x0=this._x1,this._x1=this._x2,this._x2=x;this._y0=this._y1,this._y1=this._y2,this._y2=y;}};var curveCatmullRomOpen=function custom(alpha){function catmullRom(context){return alpha?new CatmullRomOpen(context,alpha):new CardinalOpen(context,0);}catmullRom.alpha=function(alpha){return custom(+alpha);};return catmullRom;}(0.5);function LinearClosed(context){this._context=context;}LinearClosed.prototype={areaStart:noop$3,areaEnd:noop$3,lineStart:function lineStart(){this._point=0;},lineEnd:function lineEnd(){if(this._point)this._context.closePath();},point:function point(x,y){x=+x,y=+y;if(this._point)this._context.lineTo(x,y);else this._point=1,this._context.moveTo(x,y);}};function curveLinearClosed(context){return new LinearClosed(context);}function sign$1(x){return x<0?-1:1;}// Calculate the slopes of the tangents (Hermite-type interpolation) based on +// the following paper: Steffen, M. 1990. A Simple Method for Monotonic +// Interpolation in One Dimension. Astronomy and Astrophysics, Vol. 239, NO. +// NOV(II), P. 443, 1990. +function slope3(that,x2,y2){var h0=that._x1-that._x0,h1=x2-that._x1,s0=(that._y1-that._y0)/(h0||h1<0&&-0),s1=(y2-that._y1)/(h1||h0<0&&-0),p=(s0*h1+s1*h0)/(h0+h1);return(sign$1(s0)+sign$1(s1))*Math.min(Math.abs(s0),Math.abs(s1),0.5*Math.abs(p))||0;}// Calculate a one-sided slope. +function slope2(that,t){var h=that._x1-that._x0;return h?(3*(that._y1-that._y0)/h-t)/2:t;}// According to https://en.wikipedia.org/wiki/Cubic_Hermite_spline#Representations +// "you can express cubic Hermite interpolation in terms of cubic Bézier curves +// with respect to the four values p0, p0 + m0 / 3, p1 - m1 / 3, p1". +function point$2(that,t0,t1){var x0=that._x0,y0=that._y0,x1=that._x1,y1=that._y1,dx=(x1-x0)/3;that._context.bezierCurveTo(x0+dx,y0+dx*t0,x1-dx,y1-dx*t1,x1,y1);}function MonotoneX(context){this._context=context;}MonotoneX.prototype={areaStart:function areaStart(){this._line=0;},areaEnd:function areaEnd(){this._line=NaN;},lineStart:function lineStart(){this._x0=this._x1=this._y0=this._y1=this._t0=NaN;this._point=0;},lineEnd:function lineEnd(){switch(this._point){case 2:this._context.lineTo(this._x1,this._y1);break;case 3:point$2(this,this._t0,slope2(this,this._t0));break;}if(this._line||this._line!==0&&this._point===1)this._context.closePath();this._line=1-this._line;},point:function point(x,y){var t1=NaN;x=+x,y=+y;if(x===this._x1&&y===this._y1)return;// Ignore coincident points. +switch(this._point){case 0:this._point=1;this._line?this._context.lineTo(x,y):this._context.moveTo(x,y);break;case 1:this._point=2;break;case 2:this._point=3;point$2(this,slope2(this,t1=slope3(this,x,y)),t1);break;default:point$2(this,this._t0,t1=slope3(this,x,y));break;}this._x0=this._x1,this._x1=x;this._y0=this._y1,this._y1=y;this._t0=t1;}};function MonotoneY(context){this._context=new ReflectContext(context);}(MonotoneY.prototype=Object.create(MonotoneX.prototype)).point=function(x,y){MonotoneX.prototype.point.call(this,y,x);};function ReflectContext(context){this._context=context;}ReflectContext.prototype={moveTo:function moveTo(x,y){this._context.moveTo(y,x);},closePath:function closePath(){this._context.closePath();},lineTo:function lineTo(x,y){this._context.lineTo(y,x);},bezierCurveTo:function bezierCurveTo(x1,y1,x2,y2,x,y){this._context.bezierCurveTo(y1,x1,y2,x2,y,x);}};function monotoneX(context){return new MonotoneX(context);}function monotoneY(context){return new MonotoneY(context);}function Natural(context){this._context=context;}Natural.prototype={areaStart:function areaStart(){this._line=0;},areaEnd:function areaEnd(){this._line=NaN;},lineStart:function lineStart(){this._x=[];this._y=[];},lineEnd:function lineEnd(){var x=this._x,y=this._y,n=x.length;if(n){this._line?this._context.lineTo(x[0],y[0]):this._context.moveTo(x[0],y[0]);if(n===2){this._context.lineTo(x[1],y[1]);}else{var px=controlPoints(x),py=controlPoints(y);for(var i0=0,i1=1;i1<n;++i0,++i1){this._context.bezierCurveTo(px[0][i0],py[0][i0],px[1][i0],py[1][i0],x[i1],y[i1]);}}}if(this._line||this._line!==0&&n===1)this._context.closePath();this._line=1-this._line;this._x=this._y=null;},point:function point(x,y){this._x.push(+x);this._y.push(+y);}};// See https://www.particleincell.com/2012/bezier-splines/ for derivation. +function controlPoints(x){var i,n=x.length-1,m,a=new Array(n),b=new Array(n),r=new Array(n);a[0]=0,b[0]=2,r[0]=x[0]+2*x[1];for(i=1;i<n-1;++i)a[i]=1,b[i]=4,r[i]=4*x[i]+2*x[i+1];a[n-1]=2,b[n-1]=7,r[n-1]=8*x[n-1]+x[n];for(i=1;i<n;++i)m=a[i]/b[i-1],b[i]-=m,r[i]-=m*r[i-1];a[n-1]=r[n-1]/b[n-1];for(i=n-2;i>=0;--i)a[i]=(r[i]-a[i+1])/b[i];b[n-1]=(x[n]+a[n-1])/2;for(i=0;i<n-1;++i)b[i]=2*x[i+1]-a[i+1];return[a,b];}function curveNatural(context){return new Natural(context);}function Step(context,t){this._context=context;this._t=t;}Step.prototype={areaStart:function areaStart(){this._line=0;},areaEnd:function areaEnd(){this._line=NaN;},lineStart:function lineStart(){this._x=this._y=NaN;this._point=0;},lineEnd:function lineEnd(){if(0<this._t&&this._t<1&&this._point===2)this._context.lineTo(this._x,this._y);if(this._line||this._line!==0&&this._point===1)this._context.closePath();if(this._line>=0)this._t=1-this._t,this._line=1-this._line;},point:function point(x,y){x=+x,y=+y;switch(this._point){case 0:this._point=1;this._line?this._context.lineTo(x,y):this._context.moveTo(x,y);break;case 1:this._point=2;// falls through +default:{if(this._t<=0){this._context.lineTo(this._x,y);this._context.lineTo(x,y);}else{var x1=this._x*(1-this._t)+x*this._t;this._context.lineTo(x1,this._y);this._context.lineTo(x1,y);}break;}}this._x=x,this._y=y;}};function curveStep(context){return new Step(context,0.5);}function stepBefore(context){return new Step(context,0);}function stepAfter(context){return new Step(context,1);}function domCanvas(w,h){if(typeof document!=='undefined'&&document.createElement){var _c=document.createElement('canvas');if(_c&&_c.getContext){_c.width=w;_c.height=h;return _c;}}return null;}var domImage=function domImage(){return typeof Image!=='undefined'?Image:null;};function initRange(domain,range){switch(arguments.length){case 0:break;case 1:this.range(domain);break;default:this.range(range).domain(domain);break;}return this;}function initInterpolator(domain,interpolator){switch(arguments.length){case 0:break;case 1:{if(typeof domain==="function")this.interpolator(domain);else this.range(domain);break;}default:{this.domain(domain);if(typeof interpolator==="function")this.interpolator(interpolator);else this.range(interpolator);break;}}return this;}var implicit=Symbol("implicit");function ordinal(){var index=new InternMap(),domain=[],range=[],unknown=implicit;function scale(d){var i=index.get(d);if(i===undefined){if(unknown!==implicit)return unknown;index.set(d,i=domain.push(d)-1);}return range[i%range.length];}scale.domain=function(_){if(!arguments.length)return domain.slice();domain=[],index=new InternMap();var _iterator23=_createForOfIteratorHelper(_),_step23;try{for(_iterator23.s();!(_step23=_iterator23.n()).done;){var _value17=_step23.value;if(index.has(_value17))continue;index.set(_value17,domain.push(_value17)-1);}}catch(err){_iterator23.e(err);}finally{_iterator23.f();}return scale;};scale.range=function(_){return arguments.length?(range=Array.from(_),scale):range.slice();};scale.unknown=function(_){return arguments.length?(unknown=_,scale):unknown;};scale.copy=function(){return ordinal(domain,range).unknown(unknown);};initRange.apply(scale,arguments);return scale;}function define(constructor,factory,prototype){constructor.prototype=factory.prototype=prototype;prototype.constructor=constructor;}function extend(parent,definition){var prototype=Object.create(parent.prototype);for(var key in definition)prototype[key]=definition[key];return prototype;}function Color(){}var _darker=0.7;var _brighter=1/_darker;var reI="\\s*([+-]?\\d+)\\s*",reN="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",reP="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",reHex=/^#([0-9a-f]{3,8})$/,reRgbInteger=new RegExp("^rgb\\(".concat(reI,",").concat(reI,",").concat(reI,"\\)$")),reRgbPercent=new RegExp("^rgb\\(".concat(reP,",").concat(reP,",").concat(reP,"\\)$")),reRgbaInteger=new RegExp("^rgba\\(".concat(reI,",").concat(reI,",").concat(reI,",").concat(reN,"\\)$")),reRgbaPercent=new RegExp("^rgba\\(".concat(reP,",").concat(reP,",").concat(reP,",").concat(reN,"\\)$")),reHslPercent=new RegExp("^hsl\\(".concat(reN,",").concat(reP,",").concat(reP,"\\)$")),reHslaPercent=new RegExp("^hsla\\(".concat(reN,",").concat(reP,",").concat(reP,",").concat(reN,"\\)$"));var named={aliceblue:0xf0f8ff,antiquewhite:0xfaebd7,aqua:0x00ffff,aquamarine:0x7fffd4,azure:0xf0ffff,beige:0xf5f5dc,bisque:0xffe4c4,black:0x000000,blanchedalmond:0xffebcd,blue:0x0000ff,blueviolet:0x8a2be2,brown:0xa52a2a,burlywood:0xdeb887,cadetblue:0x5f9ea0,chartreuse:0x7fff00,chocolate:0xd2691e,coral:0xff7f50,cornflowerblue:0x6495ed,cornsilk:0xfff8dc,crimson:0xdc143c,cyan:0x00ffff,darkblue:0x00008b,darkcyan:0x008b8b,darkgoldenrod:0xb8860b,darkgray:0xa9a9a9,darkgreen:0x006400,darkgrey:0xa9a9a9,darkkhaki:0xbdb76b,darkmagenta:0x8b008b,darkolivegreen:0x556b2f,darkorange:0xff8c00,darkorchid:0x9932cc,darkred:0x8b0000,darksalmon:0xe9967a,darkseagreen:0x8fbc8f,darkslateblue:0x483d8b,darkslategray:0x2f4f4f,darkslategrey:0x2f4f4f,darkturquoise:0x00ced1,darkviolet:0x9400d3,deeppink:0xff1493,deepskyblue:0x00bfff,dimgray:0x696969,dimgrey:0x696969,dodgerblue:0x1e90ff,firebrick:0xb22222,floralwhite:0xfffaf0,forestgreen:0x228b22,fuchsia:0xff00ff,gainsboro:0xdcdcdc,ghostwhite:0xf8f8ff,gold:0xffd700,goldenrod:0xdaa520,gray:0x808080,green:0x008000,greenyellow:0xadff2f,grey:0x808080,honeydew:0xf0fff0,hotpink:0xff69b4,indianred:0xcd5c5c,indigo:0x4b0082,ivory:0xfffff0,khaki:0xf0e68c,lavender:0xe6e6fa,lavenderblush:0xfff0f5,lawngreen:0x7cfc00,lemonchiffon:0xfffacd,lightblue:0xadd8e6,lightcoral:0xf08080,lightcyan:0xe0ffff,lightgoldenrodyellow:0xfafad2,lightgray:0xd3d3d3,lightgreen:0x90ee90,lightgrey:0xd3d3d3,lightpink:0xffb6c1,lightsalmon:0xffa07a,lightseagreen:0x20b2aa,lightskyblue:0x87cefa,lightslategray:0x778899,lightslategrey:0x778899,lightsteelblue:0xb0c4de,lightyellow:0xffffe0,lime:0x00ff00,limegreen:0x32cd32,linen:0xfaf0e6,magenta:0xff00ff,maroon:0x800000,mediumaquamarine:0x66cdaa,mediumblue:0x0000cd,mediumorchid:0xba55d3,mediumpurple:0x9370db,mediumseagreen:0x3cb371,mediumslateblue:0x7b68ee,mediumspringgreen:0x00fa9a,mediumturquoise:0x48d1cc,mediumvioletred:0xc71585,midnightblue:0x191970,mintcream:0xf5fffa,mistyrose:0xffe4e1,moccasin:0xffe4b5,navajowhite:0xffdead,navy:0x000080,oldlace:0xfdf5e6,olive:0x808000,olivedrab:0x6b8e23,orange:0xffa500,orangered:0xff4500,orchid:0xda70d6,palegoldenrod:0xeee8aa,palegreen:0x98fb98,paleturquoise:0xafeeee,palevioletred:0xdb7093,papayawhip:0xffefd5,peachpuff:0xffdab9,peru:0xcd853f,pink:0xffc0cb,plum:0xdda0dd,powderblue:0xb0e0e6,purple:0x800080,rebeccapurple:0x663399,red:0xff0000,rosybrown:0xbc8f8f,royalblue:0x4169e1,saddlebrown:0x8b4513,salmon:0xfa8072,sandybrown:0xf4a460,seagreen:0x2e8b57,seashell:0xfff5ee,sienna:0xa0522d,silver:0xc0c0c0,skyblue:0x87ceeb,slateblue:0x6a5acd,slategray:0x708090,slategrey:0x708090,snow:0xfffafa,springgreen:0x00ff7f,steelblue:0x4682b4,tan:0xd2b48c,teal:0x008080,thistle:0xd8bfd8,tomato:0xff6347,turquoise:0x40e0d0,violet:0xee82ee,wheat:0xf5deb3,white:0xffffff,whitesmoke:0xf5f5f5,yellow:0xffff00,yellowgreen:0x9acd32};define(Color,color$2,{copy:function copy(channels){return Object.assign(new this.constructor(),this,channels);},displayable:function displayable(){return this.rgb().displayable();},hex:color_formatHex,// Deprecated! Use color.formatHex. +formatHex:color_formatHex,formatHex8:color_formatHex8,formatHsl:color_formatHsl,formatRgb:color_formatRgb,toString:color_formatRgb});function color_formatHex(){return this.rgb().formatHex();}function color_formatHex8(){return this.rgb().formatHex8();}function color_formatHsl(){return hslConvert(this).formatHsl();}function color_formatRgb(){return this.rgb().formatRgb();}function color$2(format){var m,l;format=(format+"").trim().toLowerCase();return(m=reHex.exec(format))?(l=m[1].length,m=parseInt(m[1],16),l===6?rgbn(m)// #ff0000 +:l===3?new Rgb(m>>8&0xf|m>>4&0xf0,m>>4&0xf|m&0xf0,(m&0xf)<<4|m&0xf,1)// #f00 +:l===8?rgba(m>>24&0xff,m>>16&0xff,m>>8&0xff,(m&0xff)/0xff)// #ff000000 +:l===4?rgba(m>>12&0xf|m>>8&0xf0,m>>8&0xf|m>>4&0xf0,m>>4&0xf|m&0xf0,((m&0xf)<<4|m&0xf)/0xff)// #f000 +:null// invalid hex +):(m=reRgbInteger.exec(format))?new Rgb(m[1],m[2],m[3],1)// rgb(255, 0, 0) +:(m=reRgbPercent.exec(format))?new Rgb(m[1]*255/100,m[2]*255/100,m[3]*255/100,1)// rgb(100%, 0%, 0%) +:(m=reRgbaInteger.exec(format))?rgba(m[1],m[2],m[3],m[4])// rgba(255, 0, 0, 1) +:(m=reRgbaPercent.exec(format))?rgba(m[1]*255/100,m[2]*255/100,m[3]*255/100,m[4])// rgb(100%, 0%, 0%, 1) +:(m=reHslPercent.exec(format))?hsla(m[1],m[2]/100,m[3]/100,1)// hsl(120, 50%, 50%) +:(m=reHslaPercent.exec(format))?hsla(m[1],m[2]/100,m[3]/100,m[4])// hsla(120, 50%, 50%, 1) +:named.hasOwnProperty(format)?rgbn(named[format])// eslint-disable-line no-prototype-builtins +:format==="transparent"?new Rgb(NaN,NaN,NaN,0):null;}function rgbn(n){return new Rgb(n>>16&0xff,n>>8&0xff,n&0xff,1);}function rgba(r,g,b,a){if(a<=0)r=g=b=NaN;return new Rgb(r,g,b,a);}function rgbConvert(o){if(!(o instanceof Color))o=color$2(o);if(!o)return new Rgb();o=o.rgb();return new Rgb(o.r,o.g,o.b,o.opacity);}function rgb$1(r,g,b,opacity){return arguments.length===1?rgbConvert(r):new Rgb(r,g,b,opacity==null?1:opacity);}function Rgb(r,g,b,opacity){this.r=+r;this.g=+g;this.b=+b;this.opacity=+opacity;}define(Rgb,rgb$1,extend(Color,{brighter:function brighter(k){k=k==null?_brighter:Math.pow(_brighter,k);return new Rgb(this.r*k,this.g*k,this.b*k,this.opacity);},darker:function darker(k){k=k==null?_darker:Math.pow(_darker,k);return new Rgb(this.r*k,this.g*k,this.b*k,this.opacity);},rgb:function rgb(){return this;},clamp:function clamp(){return new Rgb(clampi(this.r),clampi(this.g),clampi(this.b),clampa(this.opacity));},displayable:function displayable(){return-0.5<=this.r&&this.r<255.5&&-0.5<=this.g&&this.g<255.5&&-0.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1;},hex:rgb_formatHex,// Deprecated! Use color.formatHex. +formatHex:rgb_formatHex,formatHex8:rgb_formatHex8,formatRgb:rgb_formatRgb,toString:rgb_formatRgb}));function rgb_formatHex(){return"#".concat(hex(this.r)).concat(hex(this.g)).concat(hex(this.b));}function rgb_formatHex8(){return"#".concat(hex(this.r)).concat(hex(this.g)).concat(hex(this.b)).concat(hex((isNaN(this.opacity)?1:this.opacity)*255));}function rgb_formatRgb(){var a=clampa(this.opacity);return"".concat(a===1?"rgb(":"rgba(").concat(clampi(this.r),", ").concat(clampi(this.g),", ").concat(clampi(this.b)).concat(a===1?")":", ".concat(a,")"));}function clampa(opacity){return isNaN(opacity)?1:Math.max(0,Math.min(1,opacity));}function clampi(value){return Math.max(0,Math.min(255,Math.round(value)||0));}function hex(value){value=clampi(value);return(value<16?"0":"")+value.toString(16);}function hsla(h,s,l,a){if(a<=0)h=s=l=NaN;else if(l<=0||l>=1)h=s=NaN;else if(s<=0)h=NaN;return new Hsl(h,s,l,a);}function hslConvert(o){if(o instanceof Hsl)return new Hsl(o.h,o.s,o.l,o.opacity);if(!(o instanceof Color))o=color$2(o);if(!o)return new Hsl();if(o instanceof Hsl)return o;o=o.rgb();var r=o.r/255,g=o.g/255,b=o.b/255,min=Math.min(r,g,b),max=Math.max(r,g,b),h=NaN,s=max-min,l=(max+min)/2;if(s){if(r===max)h=(g-b)/s+(g<b)*6;else if(g===max)h=(b-r)/s+2;else h=(r-g)/s+4;s/=l<0.5?max+min:2-max-min;h*=60;}else{s=l>0&&l<1?0:h;}return new Hsl(h,s,l,o.opacity);}function hsl$2(h,s,l,opacity){return arguments.length===1?hslConvert(h):new Hsl(h,s,l,opacity==null?1:opacity);}function Hsl(h,s,l,opacity){this.h=+h;this.s=+s;this.l=+l;this.opacity=+opacity;}define(Hsl,hsl$2,extend(Color,{brighter:function brighter(k){k=k==null?_brighter:Math.pow(_brighter,k);return new Hsl(this.h,this.s,this.l*k,this.opacity);},darker:function darker(k){k=k==null?_darker:Math.pow(_darker,k);return new Hsl(this.h,this.s,this.l*k,this.opacity);},rgb:function rgb(){var h=this.h%360+(this.h<0)*360,s=isNaN(h)||isNaN(this.s)?0:this.s,l=this.l,m2=l+(l<0.5?l:1-l)*s,m1=2*l-m2;return new Rgb(hsl2rgb(h>=240?h-240:h+120,m1,m2),hsl2rgb(h,m1,m2),hsl2rgb(h<120?h+240:h-120,m1,m2),this.opacity);},clamp:function clamp(){return new Hsl(clamph(this.h),clampt(this.s),clampt(this.l),clampa(this.opacity));},displayable:function displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1;},formatHsl:function formatHsl(){var a=clampa(this.opacity);return"".concat(a===1?"hsl(":"hsla(").concat(clamph(this.h),", ").concat(clampt(this.s)*100,"%, ").concat(clampt(this.l)*100,"%").concat(a===1?")":", ".concat(a,")"));}}));function clamph(value){value=(value||0)%360;return value<0?value+360:value;}function clampt(value){return Math.max(0,Math.min(1,value||0));}/* From FvD 13.37, CSS Color Module Level 3 */function hsl2rgb(h,m1,m2){return(h<60?m1+(m2-m1)*h/60:h<180?m2:h<240?m1+(m2-m1)*(240-h)/60:m1)*255;}var radians$1=Math.PI/180;var degrees$2=180/Math.PI;// https://observablehq.com/@mbostock/lab-and-rgb +var K=18,Xn=0.96422,Yn=1,Zn=0.82521,t0=4/29,t1=6/29,t2=3*t1*t1,t3=t1*t1*t1;function labConvert(o){if(o instanceof Lab)return new Lab(o.l,o.a,o.b,o.opacity);if(o instanceof Hcl)return hcl2lab(o);if(!(o instanceof Rgb))o=rgbConvert(o);var r=rgb2lrgb(o.r),g=rgb2lrgb(o.g),b=rgb2lrgb(o.b),y=xyz2lab((0.2225045*r+0.7168786*g+0.0606169*b)/Yn),x,z;if(r===g&&g===b)x=z=y;else{x=xyz2lab((0.4360747*r+0.3850649*g+0.1430804*b)/Xn);z=xyz2lab((0.0139322*r+0.0971045*g+0.7141733*b)/Zn);}return new Lab(116*y-16,500*(x-y),200*(y-z),o.opacity);}function lab$1(l,a,b,opacity){return arguments.length===1?labConvert(l):new Lab(l,a,b,opacity==null?1:opacity);}function Lab(l,a,b,opacity){this.l=+l;this.a=+a;this.b=+b;this.opacity=+opacity;}define(Lab,lab$1,extend(Color,{brighter:function brighter(k){return new Lab(this.l+K*(k==null?1:k),this.a,this.b,this.opacity);},darker:function darker(k){return new Lab(this.l-K*(k==null?1:k),this.a,this.b,this.opacity);},rgb:function rgb(){var y=(this.l+16)/116,x=isNaN(this.a)?y:y+this.a/500,z=isNaN(this.b)?y:y-this.b/200;x=Xn*lab2xyz(x);y=Yn*lab2xyz(y);z=Zn*lab2xyz(z);return new Rgb(lrgb2rgb(3.1338561*x-1.6168667*y-0.4906146*z),lrgb2rgb(-0.9787684*x+1.9161415*y+0.0334540*z),lrgb2rgb(0.0719453*x-0.2289914*y+1.4052427*z),this.opacity);}}));function xyz2lab(t){return t>t3?Math.pow(t,1/3):t/t2+t0;}function lab2xyz(t){return t>t1?t*t*t:t2*(t-t0);}function lrgb2rgb(x){return 255*(x<=0.0031308?12.92*x:1.055*Math.pow(x,1/2.4)-0.055);}function rgb2lrgb(x){return(x/=255)<=0.04045?x/12.92:Math.pow((x+0.055)/1.055,2.4);}function hclConvert(o){if(o instanceof Hcl)return new Hcl(o.h,o.c,o.l,o.opacity);if(!(o instanceof Lab))o=labConvert(o);if(o.a===0&&o.b===0)return new Hcl(NaN,0<o.l&&o.l<100?0:NaN,o.l,o.opacity);var h=Math.atan2(o.b,o.a)*degrees$2;return new Hcl(h<0?h+360:h,Math.sqrt(o.a*o.a+o.b*o.b),o.l,o.opacity);}function hcl$2(h,c,l,opacity){return arguments.length===1?hclConvert(h):new Hcl(h,c,l,opacity==null?1:opacity);}function Hcl(h,c,l,opacity){this.h=+h;this.c=+c;this.l=+l;this.opacity=+opacity;}function hcl2lab(o){if(isNaN(o.h))return new Lab(o.l,0,0,o.opacity);var h=o.h*radians$1;return new Lab(o.l,Math.cos(h)*o.c,Math.sin(h)*o.c,o.opacity);}define(Hcl,hcl$2,extend(Color,{brighter:function brighter(k){return new Hcl(this.h,this.c,this.l+K*(k==null?1:k),this.opacity);},darker:function darker(k){return new Hcl(this.h,this.c,this.l-K*(k==null?1:k),this.opacity);},rgb:function rgb(){return hcl2lab(this).rgb();}}));var A=-0.14861,B$1=1.78277,C$1=-0.29227,D$1=-0.90649,E=1.97294,ED=E*D$1,EB=E*B$1,BC_DA=B$1*C$1-D$1*A;function cubehelixConvert(o){if(o instanceof Cubehelix)return new Cubehelix(o.h,o.s,o.l,o.opacity);if(!(o instanceof Rgb))o=rgbConvert(o);var r=o.r/255,g=o.g/255,b=o.b/255,l=(BC_DA*b+ED*r-EB*g)/(BC_DA+ED-EB),bl=b-l,k=(E*(g-l)-C$1*bl)/D$1,s=Math.sqrt(k*k+bl*bl)/(E*l*(1-l)),// NaN if l=0 or l=1 +h=s?Math.atan2(k,bl)*degrees$2-120:NaN;return new Cubehelix(h<0?h+360:h,s,l,o.opacity);}function cubehelix$2(h,s,l,opacity){return arguments.length===1?cubehelixConvert(h):new Cubehelix(h,s,l,opacity==null?1:opacity);}function Cubehelix(h,s,l,opacity){this.h=+h;this.s=+s;this.l=+l;this.opacity=+opacity;}define(Cubehelix,cubehelix$2,extend(Color,{brighter:function brighter(k){k=k==null?_brighter:Math.pow(_brighter,k);return new Cubehelix(this.h,this.s,this.l*k,this.opacity);},darker:function darker(k){k=k==null?_darker:Math.pow(_darker,k);return new Cubehelix(this.h,this.s,this.l*k,this.opacity);},rgb:function rgb(){var h=isNaN(this.h)?0:(this.h+120)*radians$1,l=+this.l,a=isNaN(this.s)?0:this.s*l*(1-l),cosh=Math.cos(h),sinh=Math.sin(h);return new Rgb(255*(l+a*(A*cosh+B$1*sinh)),255*(l+a*(C$1*cosh+D$1*sinh)),255*(l+a*(E*cosh)),this.opacity);}}));function basis(t1,v0,v1,v2,v3){var t2=t1*t1,t3=t2*t1;return((1-3*t1+3*t2-t3)*v0+(4-6*t2+3*t3)*v1+(1+3*t1+3*t2-3*t3)*v2+t3*v3)/6;}function basis$1(values){var n=values.length-1;return function(t){var i=t<=0?t=0:t>=1?(t=1,n-1):Math.floor(t*n),v1=values[i],v2=values[i+1],v0=i>0?values[i-1]:2*v1-v2,v3=i<n-1?values[i+2]:2*v2-v1;return basis((t-i/n)*n,v0,v1,v2,v3);};}function basisClosed(values){var n=values.length;return function(t){var i=Math.floor(((t%=1)<0?++t:t)*n),v0=values[(i+n-1)%n],v1=values[i%n],v2=values[(i+1)%n],v3=values[(i+2)%n];return basis((t-i/n)*n,v0,v1,v2,v3);};}var constant$2=function constant$2(x){return function(){return x;};};function linear$1(a,d){return function(t){return a+t*d;};}function exponential(a,b,y){return a=Math.pow(a,y),b=Math.pow(b,y)-a,y=1/y,function(t){return Math.pow(a+t*b,y);};}function hue$1(a,b){var d=b-a;return d?linear$1(a,d>180||d<-180?d-360*Math.round(d/360):d):constant$2(isNaN(a)?b:a);}function gamma(y){return(y=+y)===1?nogamma:function(a,b){return b-a?exponential(a,b,y):constant$2(isNaN(a)?b:a);};}function nogamma(a,b){var d=b-a;return d?linear$1(a,d):constant$2(isNaN(a)?b:a);}var rgb=function rgbGamma(y){var color=gamma(y);function rgb(start,end){var r=color((start=rgb$1(start)).r,(end=rgb$1(end)).r),g=color(start.g,end.g),b=color(start.b,end.b),opacity=nogamma(start.opacity,end.opacity);return function(t){start.r=r(t);start.g=g(t);start.b=b(t);start.opacity=opacity(t);return start+"";};}rgb.gamma=rgbGamma;return rgb;}(1);function rgbSpline(spline){return function(colors){var n=colors.length,r=new Array(n),g=new Array(n),b=new Array(n),i,color;for(i=0;i<n;++i){color=rgb$1(colors[i]);r[i]=color.r||0;g[i]=color.g||0;b[i]=color.b||0;}r=spline(r);g=spline(g);b=spline(b);color.opacity=1;return function(t){color.r=r(t);color.g=g(t);color.b=b(t);return color+"";};};}var rgbBasis=rgbSpline(basis$1);var rgbBasisClosed=rgbSpline(basisClosed);function numberArray(a,b){if(!b)b=[];var n=a?Math.min(b.length,a.length):0,c=b.slice(),i;return function(t){for(i=0;i<n;++i)c[i]=a[i]*(1-t)+b[i]*t;return c;};}function isNumberArray(x){return ArrayBuffer.isView(x)&&!(x instanceof DataView);}function array$3(a,b){return(isNumberArray(b)?numberArray:genericArray)(a,b);}function genericArray(a,b){var nb=b?b.length:0,na=a?Math.min(nb,a.length):0,x=new Array(na),c=new Array(nb),i;for(i=0;i<na;++i)x[i]=interpolate$1(a[i],b[i]);for(;i<nb;++i)c[i]=b[i];return function(t){for(i=0;i<na;++i)c[i]=x[i](t);return c;};}function date$1(a,b){var d=new Date();return a=+a,b=+b,function(t){return d.setTime(a*(1-t)+b*t),d;};}function interpolateNumber(a,b){return a=+a,b=+b,function(t){return a*(1-t)+b*t;};}function object(a,b){var i={},c={},k;if(a===null||_typeof(a)!=="object")a={};if(b===null||_typeof(b)!=="object")b={};for(k in b){if(k in a){i[k]=interpolate$1(a[k],b[k]);}else{c[k]=b[k];}}return function(t){for(k in i)c[k]=i[k](t);return c;};}var reA=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,reB=new RegExp(reA.source,"g");function zero$1(b){return function(){return b;};}function one$1(b){return function(t){return b(t)+"";};}function string(a,b){var bi=reA.lastIndex=reB.lastIndex=0,// scan index for next number in b +am,// current match in a +bm,// current match in b +bs,// string preceding current number in b, if any +i=-1,// index in s +s=[],// string constants and placeholders +q=[];// number interpolators +// Coerce inputs to strings. +a=a+"",b=b+"";// Interpolate pairs of numbers in a & b. +while((am=reA.exec(a))&&(bm=reB.exec(b))){if((bs=bm.index)>bi){// a string precedes the next number in b +bs=b.slice(bi,bs);if(s[i])s[i]+=bs;// coalesce with previous string +else s[++i]=bs;}if((am=am[0])===(bm=bm[0])){// numbers in a & b match +if(s[i])s[i]+=bm;// coalesce with previous string +else s[++i]=bm;}else{// interpolate non-matching numbers +s[++i]=null;q.push({i:i,x:interpolateNumber(am,bm)});}bi=reB.lastIndex;}// Add remains of b. +if(bi<b.length){bs=b.slice(bi);if(s[i])s[i]+=bs;// coalesce with previous string +else s[++i]=bs;}// Special optimization for only a single match. +// Otherwise, interpolate each of the numbers and rejoin the string. +return s.length<2?q[0]?one$1(q[0].x):zero$1(b):(b=q.length,function(t){for(var i=0,o;i<b;++i)s[(o=q[i]).i]=o.x(t);return s.join("");});}function interpolate$1(a,b){var t=_typeof(b),c;return b==null||t==="boolean"?constant$2(b):(t==="number"?interpolateNumber:t==="string"?(c=color$2(b))?(b=c,rgb):string:b instanceof color$2?rgb:b instanceof Date?date$1:isNumberArray(b)?numberArray:Array.isArray(b)?genericArray:typeof b.valueOf!=="function"&&typeof b.toString!=="function"||isNaN(b)?object:interpolateNumber)(a,b);}function discrete$1(range){var n=range.length;return function(t){return range[Math.max(0,Math.min(n-1,Math.floor(t*n)))];};}function hue(a,b){var i=hue$1(+a,+b);return function(t){var x=i(t);return x-360*Math.floor(x/360);};}function interpolateRound(a,b){return a=+a,b=+b,function(t){return Math.round(a*(1-t)+b*t);};}var degrees$1=180/Math.PI;var identity$3={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function decompose(a,b,c,d,e,f){var scaleX,scaleY,skewX;if(scaleX=Math.sqrt(a*a+b*b))a/=scaleX,b/=scaleX;if(skewX=a*c+b*d)c-=a*skewX,d-=b*skewX;if(scaleY=Math.sqrt(c*c+d*d))c/=scaleY,d/=scaleY,skewX/=scaleY;if(a*d<b*c)a=-a,b=-b,skewX=-skewX,scaleX=-scaleX;return{translateX:e,translateY:f,rotate:Math.atan2(b,a)*degrees$1,skewX:Math.atan(skewX)*degrees$1,scaleX:scaleX,scaleY:scaleY};}var svgNode;/* eslint-disable no-undef */function parseCss(value){var m=new(typeof DOMMatrix==="function"?DOMMatrix:WebKitCSSMatrix)(value+"");return m.isIdentity?identity$3:decompose(m.a,m.b,m.c,m.d,m.e,m.f);}function parseSvg(value){if(value==null)return identity$3;if(!svgNode)svgNode=document.createElementNS("http://www.w3.org/2000/svg","g");svgNode.setAttribute("transform",value);if(!(value=svgNode.transform.baseVal.consolidate()))return identity$3;value=value.matrix;return decompose(value.a,value.b,value.c,value.d,value.e,value.f);}function interpolateTransform(parse,pxComma,pxParen,degParen){function pop(s){return s.length?s.pop()+" ":"";}function translate(xa,ya,xb,yb,s,q){if(xa!==xb||ya!==yb){var i=s.push("translate(",null,pxComma,null,pxParen);q.push({i:i-4,x:interpolateNumber(xa,xb)},{i:i-2,x:interpolateNumber(ya,yb)});}else if(xb||yb){s.push("translate("+xb+pxComma+yb+pxParen);}}function rotate(a,b,s,q){if(a!==b){if(a-b>180)b+=360;else if(b-a>180)a+=360;// shortest path +q.push({i:s.push(pop(s)+"rotate(",null,degParen)-2,x:interpolateNumber(a,b)});}else if(b){s.push(pop(s)+"rotate("+b+degParen);}}function skewX(a,b,s,q){if(a!==b){q.push({i:s.push(pop(s)+"skewX(",null,degParen)-2,x:interpolateNumber(a,b)});}else if(b){s.push(pop(s)+"skewX("+b+degParen);}}function scale(xa,ya,xb,yb,s,q){if(xa!==xb||ya!==yb){var i=s.push(pop(s)+"scale(",null,",",null,")");q.push({i:i-4,x:interpolateNumber(xa,xb)},{i:i-2,x:interpolateNumber(ya,yb)});}else if(xb!==1||yb!==1){s.push(pop(s)+"scale("+xb+","+yb+")");}}return function(a,b){var s=[],// string constants and placeholders +q=[];// number interpolators +a=parse(a),b=parse(b);translate(a.translateX,a.translateY,b.translateX,b.translateY,s,q);rotate(a.rotate,b.rotate,s,q);skewX(a.skewX,b.skewX,s,q);scale(a.scaleX,a.scaleY,b.scaleX,b.scaleY,s,q);a=b=null;// gc +return function(t){var i=-1,n=q.length,o;while(++i<n)s[(o=q[i]).i]=o.x(t);return s.join("");};};}var interpolateTransformCss=interpolateTransform(parseCss,"px, ","px)","deg)");var interpolateTransformSvg=interpolateTransform(parseSvg,", ",")",")");var epsilon2$1=1e-12;function cosh(x){return((x=Math.exp(x))+1/x)/2;}function sinh(x){return((x=Math.exp(x))-1/x)/2;}function tanh(x){return((x=Math.exp(2*x))-1)/(x+1);}var zoom=function zoomRho(rho,rho2,rho4){// p0 = [ux0, uy0, w0] +// p1 = [ux1, uy1, w1] +function zoom(p0,p1){var ux0=p0[0],uy0=p0[1],w0=p0[2],ux1=p1[0],uy1=p1[1],w1=p1[2],dx=ux1-ux0,dy=uy1-uy0,d2=dx*dx+dy*dy,i,S;// Special case for u0 ≅ u1. +if(d2<epsilon2$1){S=Math.log(w1/w0)/rho;i=function i(t){return[ux0+t*dx,uy0+t*dy,w0*Math.exp(rho*t*S)];};}// General case. +else{var d1=Math.sqrt(d2),b0=(w1*w1-w0*w0+rho4*d2)/(2*w0*rho2*d1),b1=(w1*w1-w0*w0-rho4*d2)/(2*w1*rho2*d1),r0=Math.log(Math.sqrt(b0*b0+1)-b0),r1=Math.log(Math.sqrt(b1*b1+1)-b1);S=(r1-r0)/rho;i=function i(t){var s=t*S,coshr0=cosh(r0),u=w0/(rho2*d1)*(coshr0*tanh(rho*s+r0)-sinh(r0));return[ux0+u*dx,uy0+u*dy,w0*coshr0/cosh(rho*s+r0)];};}i.duration=S*1000*rho/Math.SQRT2;return i;}zoom.rho=function(_){var _1=Math.max(1e-3,+_),_2=_1*_1,_4=_2*_2;return zoomRho(_1,_2,_4);};return zoom;}(Math.SQRT2,2,4);function hsl(hue){return function(start,end){var h=hue((start=hsl$2(start)).h,(end=hsl$2(end)).h),s=nogamma(start.s,end.s),l=nogamma(start.l,end.l),opacity=nogamma(start.opacity,end.opacity);return function(t){start.h=h(t);start.s=s(t);start.l=l(t);start.opacity=opacity(t);return start+"";};};}var hsl$1=hsl(hue$1);var hslLong=hsl(nogamma);function lab(start,end){var l=nogamma((start=lab$1(start)).l,(end=lab$1(end)).l),a=nogamma(start.a,end.a),b=nogamma(start.b,end.b),opacity=nogamma(start.opacity,end.opacity);return function(t){start.l=l(t);start.a=a(t);start.b=b(t);start.opacity=opacity(t);return start+"";};}function hcl(hue){return function(start,end){var h=hue((start=hcl$2(start)).h,(end=hcl$2(end)).h),c=nogamma(start.c,end.c),l=nogamma(start.l,end.l),opacity=nogamma(start.opacity,end.opacity);return function(t){start.h=h(t);start.c=c(t);start.l=l(t);start.opacity=opacity(t);return start+"";};};}var hcl$1=hcl(hue$1);var hclLong=hcl(nogamma);function cubehelix(hue){return function cubehelixGamma(y){y=+y;function cubehelix(start,end){var h=hue((start=cubehelix$2(start)).h,(end=cubehelix$2(end)).h),s=nogamma(start.s,end.s),l=nogamma(start.l,end.l),opacity=nogamma(start.opacity,end.opacity);return function(t){start.h=h(t);start.s=s(t);start.l=l(Math.pow(t,y));start.opacity=opacity(t);return start+"";};}cubehelix.gamma=cubehelixGamma;return cubehelix;}(1);}var cubehelix$1=cubehelix(hue$1);var cubehelixLong=cubehelix(nogamma);function piecewise(interpolate,values){if(values===undefined)values=interpolate,interpolate=interpolate$1;var i=0,n=values.length-1,v=values[0],I=new Array(n<0?0:n);while(i<n)I[i]=interpolate(v,v=values[++i]);return function(t){var i=Math.max(0,Math.min(n-1,Math.floor(t*=n)));return I[i](t-i);};}function quantize$2(interpolator,n){var samples=new Array(n);for(var i=0;i<n;++i)samples[i]=interpolator(i/(n-1));return samples;}var $$1=/*#__PURE__*/Object.freeze({__proto__:null,interpolate:interpolate$1,interpolateArray:array$3,interpolateBasis:basis$1,interpolateBasisClosed:basisClosed,interpolateCubehelix:cubehelix$1,interpolateCubehelixLong:cubehelixLong,interpolateDate:date$1,interpolateDiscrete:discrete$1,interpolateHcl:hcl$1,interpolateHclLong:hclLong,interpolateHsl:hsl$1,interpolateHslLong:hslLong,interpolateHue:hue,interpolateLab:lab,interpolateNumber:interpolateNumber,interpolateNumberArray:numberArray,interpolateObject:object,interpolateRgb:rgb,interpolateRgbBasis:rgbBasis,interpolateRgbBasisClosed:rgbBasisClosed,interpolateRound:interpolateRound,interpolateString:string,interpolateTransformCss:interpolateTransformCss,interpolateTransformSvg:interpolateTransformSvg,interpolateZoom:zoom,piecewise:piecewise,quantize:quantize$2});function constants(x){return function(){return x;};}function number$5(x){return+x;}var unit=[0,1];function identity$2(x){return x;}function normalize$1(a,b){return(b-=a=+a)?function(x){return(x-a)/b;}:constants(isNaN(b)?NaN:0.5);}function clamper(a,b){var t;if(a>b)t=a,a=b,b=t;return function(x){return Math.max(a,Math.min(b,x));};}// normalize(a, b)(x) takes a domain value x in [a,b] and returns the corresponding parameter t in [0,1]. +// interpolate(a, b)(t) takes a parameter t in [0,1] and returns the corresponding range value x in [a,b]. +function bimap(domain,range,interpolate){var d0=domain[0],d1=domain[1],r0=range[0],r1=range[1];if(d1<d0)d0=normalize$1(d1,d0),r0=interpolate(r1,r0);else d0=normalize$1(d0,d1),r0=interpolate(r0,r1);return function(x){return r0(d0(x));};}function polymap(domain,range,interpolate){var j=Math.min(domain.length,range.length)-1,d=new Array(j),r=new Array(j),i=-1;// Reverse descending domains. +if(domain[j]<domain[0]){domain=domain.slice().reverse();range=range.slice().reverse();}while(++i<j){d[i]=normalize$1(domain[i],domain[i+1]);r[i]=interpolate(range[i],range[i+1]);}return function(x){var i=bisectRight$1(domain,x,1,j)-1;return r[i](d[i](x));};}function copy$2(source,target){return target.domain(source.domain()).range(source.range()).interpolate(source.interpolate()).clamp(source.clamp()).unknown(source.unknown());}function transformer$3(){var domain=unit,range=unit,interpolate=interpolate$1,transform,untransform,unknown,clamp=identity$2,piecewise,output,input;function rescale(){var n=Math.min(domain.length,range.length);if(clamp!==identity$2)clamp=clamper(domain[0],domain[n-1]);piecewise=n>2?polymap:bimap;output=input=null;return scale;}function scale(x){return x==null||isNaN(x=+x)?unknown:(output||(output=piecewise(domain.map(transform),range,interpolate)))(transform(clamp(x)));}scale.invert=function(y){return clamp(untransform((input||(input=piecewise(range,domain.map(transform),interpolateNumber)))(y)));};scale.domain=function(_){return arguments.length?(domain=Array.from(_,number$5),rescale()):domain.slice();};scale.range=function(_){return arguments.length?(range=Array.from(_),rescale()):range.slice();};scale.rangeRound=function(_){return range=Array.from(_),interpolate=interpolateRound,rescale();};scale.clamp=function(_){return arguments.length?(clamp=_?true:identity$2,rescale()):clamp!==identity$2;};scale.interpolate=function(_){return arguments.length?(interpolate=_,rescale()):interpolate;};scale.unknown=function(_){return arguments.length?(unknown=_,scale):unknown;};return function(t,u){transform=t,untransform=u;return rescale();};}function continuous$1(){return transformer$3()(identity$2,identity$2);}function tickFormat$1(start,stop,count,specifier){var step=tickStep(start,stop,count),precision;specifier=formatSpecifier(specifier==null?",f":specifier);switch(specifier.type){case"s":{var value=Math.max(Math.abs(start),Math.abs(stop));if(specifier.precision==null&&!isNaN(precision=precisionPrefix(step,value)))specifier.precision=precision;return formatPrefix(specifier,value);}case"":case"e":case"g":case"p":case"r":{if(specifier.precision==null&&!isNaN(precision=precisionRound(step,Math.max(Math.abs(start),Math.abs(stop)))))specifier.precision=precision-(specifier.type==="e");break;}case"f":case"%":{if(specifier.precision==null&&!isNaN(precision=precisionFixed(step)))specifier.precision=precision-(specifier.type==="%")*2;break;}}return format$3(specifier);}function linearish(scale){var domain=scale.domain;scale.ticks=function(count){var d=domain();return ticks(d[0],d[d.length-1],count==null?10:count);};scale.tickFormat=function(count,specifier){var d=domain();return tickFormat$1(d[0],d[d.length-1],count==null?10:count,specifier);};scale.nice=function(count){if(count==null)count=10;var d=domain();var i0=0;var i1=d.length-1;var start=d[i0];var stop=d[i1];var prestep;var step;var maxIter=10;if(stop<start){step=start,start=stop,stop=step;step=i0,i0=i1,i1=step;}while(maxIter-->0){step=tickIncrement(start,stop,count);if(step===prestep){d[i0]=start;d[i1]=stop;return domain(d);}else if(step>0){start=Math.floor(start/step)*step;stop=Math.ceil(stop/step)*step;}else if(step<0){start=Math.ceil(start*step)/step;stop=Math.floor(stop*step)/step;}else{break;}prestep=step;}return scale;};return scale;}function linear(){var scale=continuous$1();scale.copy=function(){return copy$2(scale,linear());};initRange.apply(scale,arguments);return linearish(scale);}function identity$1(domain){var unknown;function scale(x){return x==null||isNaN(x=+x)?unknown:x;}scale.invert=scale;scale.domain=scale.range=function(_){return arguments.length?(domain=Array.from(_,number$5),scale):domain.slice();};scale.unknown=function(_){return arguments.length?(unknown=_,scale):unknown;};scale.copy=function(){return identity$1(domain).unknown(unknown);};domain=arguments.length?Array.from(domain,number$5):[0,1];return linearish(scale);}function nice(domain,interval){domain=domain.slice();var i0=0,i1=domain.length-1,x0=domain[i0],x1=domain[i1],t;if(x1<x0){t=i0,i0=i1,i1=t;t=x0,x0=x1,x1=t;}domain[i0]=interval.floor(x0);domain[i1]=interval.ceil(x1);return domain;}function transformLog(x){return Math.log(x);}function transformExp(x){return Math.exp(x);}function transformLogn(x){return-Math.log(-x);}function transformExpn(x){return-Math.exp(-x);}function pow10(x){return isFinite(x)?+("1e"+x):x<0?0:x;}function powp(base){return base===10?pow10:base===Math.E?Math.exp:function(x){return Math.pow(base,x);};}function logp(base){return base===Math.E?Math.log:base===10&&Math.log10||base===2&&Math.log2||(base=Math.log(base),function(x){return Math.log(x)/base;});}function reflect(f){return function(x,k){return-f(-x,k);};}function loggish(transform){var scale=transform(transformLog,transformExp);var domain=scale.domain;var base=10;var logs;var pows;function rescale(){logs=logp(base),pows=powp(base);if(domain()[0]<0){logs=reflect(logs),pows=reflect(pows);transform(transformLogn,transformExpn);}else{transform(transformLog,transformExp);}return scale;}scale.base=function(_){return arguments.length?(base=+_,rescale()):base;};scale.domain=function(_){return arguments.length?(domain(_),rescale()):domain();};scale.ticks=function(count){var d=domain();var u=d[0];var v=d[d.length-1];var r=v<u;if(r){var _ref0=[v,u];u=_ref0[0];v=_ref0[1];}var i=logs(u);var j=logs(v);var k;var t;var n=count==null?10:+count;var z=[];if(!(base%1)&&j-i<n){i=Math.floor(i),j=Math.ceil(j);if(u>0)for(;i<=j;++i){for(k=1;k<base;++k){t=i<0?k/pows(-i):k*pows(i);if(t<u)continue;if(t>v)break;z.push(t);}}else for(;i<=j;++i){for(k=base-1;k>=1;--k){t=i>0?k/pows(-i):k*pows(i);if(t<u)continue;if(t>v)break;z.push(t);}}if(z.length*2<n)z=ticks(u,v,n);}else{z=ticks(i,j,Math.min(j-i,n)).map(pows);}return r?z.reverse():z;};scale.tickFormat=function(count,specifier){if(count==null)count=10;if(specifier==null)specifier=base===10?"s":",";if(typeof specifier!=="function"){if(!(base%1)&&(specifier=formatSpecifier(specifier)).precision==null)specifier.trim=true;specifier=format$3(specifier);}if(count===Infinity)return specifier;var k=Math.max(1,base*count/scale.ticks().length);// TODO fast estimate? +return function(d){var i=d/pows(Math.round(logs(d)));if(i*base<base-0.5)i*=base;return i<=k?specifier(d):"";};};scale.nice=function(){return domain(nice(domain(),{floor:function floor(x){return pows(Math.floor(logs(x)));},ceil:function ceil(x){return pows(Math.ceil(logs(x)));}}));};return scale;}function log$2(){var scale=loggish(transformer$3()).domain([1,10]);scale.copy=function(){return copy$2(scale,log$2()).base(scale.base());};initRange.apply(scale,arguments);return scale;}function transformSymlog(c){return function(x){return Math.sign(x)*Math.log1p(Math.abs(x/c));};}function transformSymexp(c){return function(x){return Math.sign(x)*Math.expm1(Math.abs(x))*c;};}function symlogish(transform){var c=1,scale=transform(transformSymlog(c),transformSymexp(c));scale.constant=function(_){return arguments.length?transform(transformSymlog(c=+_),transformSymexp(c)):c;};return linearish(scale);}function symlog(){var scale=symlogish(transformer$3());scale.copy=function(){return copy$2(scale,symlog()).constant(scale.constant());};return initRange.apply(scale,arguments);}function transformPow(exponent){return function(x){return x<0?-Math.pow(-x,exponent):Math.pow(x,exponent);};}function transformSqrt(x){return x<0?-Math.sqrt(-x):Math.sqrt(x);}function transformSquare(x){return x<0?-x*x:x*x;}function powish(transform){var scale=transform(identity$2,identity$2),exponent=1;function rescale(){return exponent===1?transform(identity$2,identity$2):exponent===0.5?transform(transformSqrt,transformSquare):transform(transformPow(exponent),transformPow(1/exponent));}scale.exponent=function(_){return arguments.length?(exponent=+_,rescale()):exponent;};return linearish(scale);}function pow$2(){var scale=powish(transformer$3());scale.copy=function(){return copy$2(scale,pow$2()).exponent(scale.exponent());};initRange.apply(scale,arguments);return scale;}function sqrt$2(){return pow$2.apply(null,arguments).exponent(0.5);}function quantile(){var domain=[],range=[],thresholds=[],unknown;function rescale(){var i=0,n=Math.max(1,range.length);thresholds=new Array(n-1);while(++i<n)thresholds[i-1]=quantileSorted(domain,i/n);return scale;}function scale(x){return x==null||isNaN(x=+x)?unknown:range[bisectRight$1(thresholds,x)];}scale.invertExtent=function(y){var i=range.indexOf(y);return i<0?[NaN,NaN]:[i>0?thresholds[i-1]:domain[0],i<thresholds.length?thresholds[i]:domain[domain.length-1]];};scale.domain=function(_){if(!arguments.length)return domain.slice();domain=[];var _iterator24=_createForOfIteratorHelper(_),_step24;try{for(_iterator24.s();!(_step24=_iterator24.n()).done;){var d=_step24.value;if(d!=null&&!isNaN(d=+d))domain.push(d);}}catch(err){_iterator24.e(err);}finally{_iterator24.f();}domain.sort(ascending$1);return rescale();};scale.range=function(_){return arguments.length?(range=Array.from(_),rescale()):range.slice();};scale.unknown=function(_){return arguments.length?(unknown=_,scale):unknown;};scale.quantiles=function(){return thresholds.slice();};scale.copy=function(){return quantile().domain(domain).range(range).unknown(unknown);};return initRange.apply(scale,arguments);}function quantize$1(){var x0=0,x1=1,n=1,domain=[0.5],range=[0,1],unknown;function scale(x){return x!=null&&x<=x?range[bisectRight$1(domain,x,0,n)]:unknown;}function rescale(){var i=-1;domain=new Array(n);while(++i<n)domain[i]=((i+1)*x1-(i-n)*x0)/(n+1);return scale;}scale.domain=function(_){var _ref1;return arguments.length?(_ref1=_slicedToArray(_,2),x0=_ref1[0],x1=_ref1[1],x0=+x0,x1=+x1,rescale()):[x0,x1];};scale.range=function(_){return arguments.length?(n=(range=Array.from(_)).length-1,rescale()):range.slice();};scale.invertExtent=function(y){var i=range.indexOf(y);return i<0?[NaN,NaN]:i<1?[x0,domain[0]]:i>=n?[domain[n-1],x1]:[domain[i-1],domain[i]];};scale.unknown=function(_){return arguments.length?(unknown=_,scale):scale;};scale.thresholds=function(){return domain.slice();};scale.copy=function(){return quantize$1().domain([x0,x1]).range(range).unknown(unknown);};return initRange.apply(linearish(scale),arguments);}function threshold(){var domain=[0.5],range=[0,1],unknown,n=1;function scale(x){return x!=null&&x<=x?range[bisectRight$1(domain,x,0,n)]:unknown;}scale.domain=function(_){return arguments.length?(domain=Array.from(_),n=Math.min(domain.length,range.length-1),scale):domain.slice();};scale.range=function(_){return arguments.length?(range=Array.from(_),n=Math.min(domain.length,range.length-1),scale):range.slice();};scale.invertExtent=function(y){var i=range.indexOf(y);return[domain[i-1],domain[i]];};scale.unknown=function(_){return arguments.length?(unknown=_,scale):unknown;};scale.copy=function(){return threshold().domain(domain).range(range).unknown(unknown);};return initRange.apply(scale,arguments);}function date(t){return new Date(t);}function number$4(t){return t instanceof Date?+t:+new Date(+t);}function calendar(ticks,tickInterval,year,month,week,day,hour,minute,second,format){var scale=continuous$1(),invert=scale.invert,domain=scale.domain;var formatMillisecond=format(".%L"),formatSecond=format(":%S"),formatMinute=format("%I:%M"),formatHour=format("%I %p"),formatDay=format("%a %d"),formatWeek=format("%b %d"),formatMonth=format("%B"),formatYear=format("%Y");function tickFormat(date){return(second(date)<date?formatMillisecond:minute(date)<date?formatSecond:hour(date)<date?formatMinute:day(date)<date?formatHour:month(date)<date?week(date)<date?formatDay:formatWeek:year(date)<date?formatMonth:formatYear)(date);}scale.invert=function(y){return new Date(invert(y));};scale.domain=function(_){return arguments.length?domain(Array.from(_,number$4)):domain().map(date);};scale.ticks=function(interval){var d=domain();return ticks(d[0],d[d.length-1],interval==null?10:interval);};scale.tickFormat=function(count,specifier){return specifier==null?tickFormat:format(specifier);};scale.nice=function(interval){var d=domain();if(!interval||typeof interval.range!=="function")interval=tickInterval(d[0],d[d.length-1],interval==null?10:interval);return interval?domain(nice(d,interval)):scale;};scale.copy=function(){return copy$2(scale,calendar(ticks,tickInterval,year,month,week,day,hour,minute,second,format));};return scale;}function time$1(){return initRange.apply(calendar(timeTicks,timeTickInterval,timeYear,timeMonth,timeSunday,timeDay,timeHour,timeMinute,second,timeFormat$1).domain([new Date(2000,0,1),new Date(2000,0,2)]),arguments);}function utcTime(){return initRange.apply(calendar(utcTicks,utcTickInterval,utcYear,utcMonth,utcSunday,utcDay,utcHour,utcMinute,second,utcFormat$1).domain([Date.UTC(2000,0,1),Date.UTC(2000,0,2)]),arguments);}function transformer$2(){var x0=0,x1=1,t0,t1,k10,transform,interpolator=identity$2,clamp=false,unknown;function scale(x){return x==null||isNaN(x=+x)?unknown:interpolator(k10===0?0.5:(x=(transform(x)-t0)*k10,clamp?Math.max(0,Math.min(1,x)):x));}scale.domain=function(_){var _ref10;return arguments.length?(_ref10=_slicedToArray(_,2),x0=_ref10[0],x1=_ref10[1],t0=transform(x0=+x0),t1=transform(x1=+x1),k10=t0===t1?0:1/(t1-t0),scale):[x0,x1];};scale.clamp=function(_){return arguments.length?(clamp=!!_,scale):clamp;};scale.interpolator=function(_){return arguments.length?(interpolator=_,scale):interpolator;};function range(interpolate){return function(_){var _ref11;var r0,r1;return arguments.length?(_ref11=_slicedToArray(_,2),r0=_ref11[0],r1=_ref11[1],interpolator=interpolate(r0,r1),scale):[interpolator(0),interpolator(1)];};}scale.range=range(interpolate$1);scale.rangeRound=range(interpolateRound);scale.unknown=function(_){return arguments.length?(unknown=_,scale):unknown;};return function(t){transform=t,t0=t(x0),t1=t(x1),k10=t0===t1?0:1/(t1-t0);return scale;};}function copy$1(source,target){return target.domain(source.domain()).interpolator(source.interpolator()).clamp(source.clamp()).unknown(source.unknown());}function sequential(){var scale=linearish(transformer$2()(identity$2));scale.copy=function(){return copy$1(scale,sequential());};return initInterpolator.apply(scale,arguments);}function sequentialLog(){var scale=loggish(transformer$2()).domain([1,10]);scale.copy=function(){return copy$1(scale,sequentialLog()).base(scale.base());};return initInterpolator.apply(scale,arguments);}function sequentialSymlog(){var scale=symlogish(transformer$2());scale.copy=function(){return copy$1(scale,sequentialSymlog()).constant(scale.constant());};return initInterpolator.apply(scale,arguments);}function sequentialPow(){var scale=powish(transformer$2());scale.copy=function(){return copy$1(scale,sequentialPow()).exponent(scale.exponent());};return initInterpolator.apply(scale,arguments);}function sequentialSqrt(){return sequentialPow.apply(null,arguments).exponent(0.5);}function transformer$1(){var x0=0,x1=0.5,x2=1,s=1,t0,t1,t2,k10,k21,interpolator=identity$2,transform,clamp=false,unknown;function scale(x){return isNaN(x=+x)?unknown:(x=0.5+((x=+transform(x))-t1)*(s*x<s*t1?k10:k21),interpolator(clamp?Math.max(0,Math.min(1,x)):x));}scale.domain=function(_){var _ref12;return arguments.length?(_ref12=_slicedToArray(_,3),x0=_ref12[0],x1=_ref12[1],x2=_ref12[2],t0=transform(x0=+x0),t1=transform(x1=+x1),t2=transform(x2=+x2),k10=t0===t1?0:0.5/(t1-t0),k21=t1===t2?0:0.5/(t2-t1),s=t1<t0?-1:1,scale):[x0,x1,x2];};scale.clamp=function(_){return arguments.length?(clamp=!!_,scale):clamp;};scale.interpolator=function(_){return arguments.length?(interpolator=_,scale):interpolator;};function range(interpolate){return function(_){var _ref13;var r0,r1,r2;return arguments.length?(_ref13=_slicedToArray(_,3),r0=_ref13[0],r1=_ref13[1],r2=_ref13[2],interpolator=piecewise(interpolate,[r0,r1,r2]),scale):[interpolator(0),interpolator(0.5),interpolator(1)];};}scale.range=range(interpolate$1);scale.rangeRound=range(interpolateRound);scale.unknown=function(_){return arguments.length?(unknown=_,scale):unknown;};return function(t){transform=t,t0=t(x0),t1=t(x1),t2=t(x2),k10=t0===t1?0:0.5/(t1-t0),k21=t1===t2?0:0.5/(t2-t1),s=t1<t0?-1:1;return scale;};}function diverging(){var scale=linearish(transformer$1()(identity$2));scale.copy=function(){return copy$1(scale,diverging());};return initInterpolator.apply(scale,arguments);}function divergingLog(){var scale=loggish(transformer$1()).domain([0.1,1,10]);scale.copy=function(){return copy$1(scale,divergingLog()).base(scale.base());};return initInterpolator.apply(scale,arguments);}function divergingSymlog(){var scale=symlogish(transformer$1());scale.copy=function(){return copy$1(scale,divergingSymlog()).constant(scale.constant());};return initInterpolator.apply(scale,arguments);}function divergingPow(){var scale=powish(transformer$1());scale.copy=function(){return copy$1(scale,divergingPow()).exponent(scale.exponent());};return initInterpolator.apply(scale,arguments);}function divergingSqrt(){return divergingPow.apply(null,arguments).exponent(0.5);}function colors$1(specifier){var n=specifier.length/6|0,colors=new Array(n),i=0;while(i<n)colors[i]="#"+specifier.slice(i*6,++i*6);return colors;}var schemeCategory10=colors$1("1f77b4ff7f0e2ca02cd627289467bd8c564be377c27f7f7fbcbd2217becf");var schemeAccent=colors$1("7fc97fbeaed4fdc086ffff99386cb0f0027fbf5b17666666");var schemeDark2=colors$1("1b9e77d95f027570b3e7298a66a61ee6ab02a6761d666666");var schemeObservable10=colors$1("4269d0efb118ff725c6cc5b03ca951ff8ab7a463f297bbf59c6b4e9498a0");var schemePaired=colors$1("a6cee31f78b4b2df8a33a02cfb9a99e31a1cfdbf6fff7f00cab2d66a3d9affff99b15928");var schemePastel1=colors$1("fbb4aeb3cde3ccebc5decbe4fed9a6ffffcce5d8bdfddaecf2f2f2");var schemePastel2=colors$1("b3e2cdfdcdaccbd5e8f4cae4e6f5c9fff2aef1e2cccccccc");var schemeSet1=colors$1("e41a1c377eb84daf4a984ea3ff7f00ffff33a65628f781bf999999");var schemeSet2=colors$1("66c2a5fc8d628da0cbe78ac3a6d854ffd92fe5c494b3b3b3");var schemeSet3=colors$1("8dd3c7ffffb3bebadafb807280b1d3fdb462b3de69fccde5d9d9d9bc80bdccebc5ffed6f");function bandSpace(count,paddingInner,paddingOuter){var space=count-paddingInner+paddingOuter*2;return count?space>0?space:1:0;}var Identity='identity';var Linear='linear';var Log='log';var Pow='pow';var Sqrt='sqrt';var Symlog='symlog';var Time='time';var UTC='utc';var Sequential='sequential';var Diverging='diverging';var Quantile='quantile';var Quantize='quantize';var Threshold='threshold';var Ordinal='ordinal';var Point='point';var Band='band';var BinOrdinal='bin-ordinal';// categories +var Continuous='continuous';var Discrete$1='discrete';var Discretizing='discretizing';var Interpolating='interpolating';var Temporal='temporal';function invertRange(scale){return function(_){var lo=_[0],hi=_[1],t;if(hi<lo){t=lo;lo=hi;hi=t;}return[scale.invert(lo),scale.invert(hi)];};}function invertRangeExtent(scale){return function(_){var range=scale.range();var lo=_[0],hi=_[1],min=-1,max,t,i,n;if(hi<lo){t=lo;lo=hi;hi=t;}for(i=0,n=range.length;i<n;++i){if(range[i]>=lo&&range[i]<=hi){if(min<0)min=i;max=i;}}if(min<0)return undefined;lo=scale.invertExtent(range[min]);hi=scale.invertExtent(range[max]);return[lo[0]===undefined?lo[1]:lo[0],hi[1]===undefined?hi[0]:hi[1]];};}function band(){var scale=ordinal().unknown(undefined),domain=scale.domain,ordinalRange=scale.range;var range$1=[0,1],step,bandwidth,round=false,paddingInner=0,paddingOuter=0,align=0.5;delete scale.unknown;function rescale(){var n=domain().length,reverse=range$1[1]<range$1[0],stop=range$1[1-reverse],space=bandSpace(n,paddingInner,paddingOuter);var start=range$1[reverse-0];step=(stop-start)/(space||1);if(round){step=Math.floor(step);}start+=(stop-start-step*(n-paddingInner))*align;bandwidth=step*(1-paddingInner);if(round){start=Math.round(start);bandwidth=Math.round(bandwidth);}var values=range$3(n).map(function(i){return start+step*i;});return ordinalRange(reverse?values.reverse():values);}scale.domain=function(_){if(arguments.length){domain(_);return rescale();}else{return domain();}};scale.range=function(_){if(arguments.length){range$1=[+_[0],+_[1]];return rescale();}else{return range$1.slice();}};scale.rangeRound=function(_){range$1=[+_[0],+_[1]];round=true;return rescale();};scale.bandwidth=function(){return bandwidth;};scale.step=function(){return step;};scale.round=function(_){if(arguments.length){round=!!_;return rescale();}else{return round;}};scale.padding=function(_){if(arguments.length){paddingOuter=Math.max(0,Math.min(1,_));paddingInner=paddingOuter;return rescale();}else{return paddingInner;}};scale.paddingInner=function(_){if(arguments.length){paddingInner=Math.max(0,Math.min(1,_));return rescale();}else{return paddingInner;}};scale.paddingOuter=function(_){if(arguments.length){paddingOuter=Math.max(0,Math.min(1,_));return rescale();}else{return paddingOuter;}};scale.align=function(_){if(arguments.length){align=Math.max(0,Math.min(1,_));return rescale();}else{return align;}};scale.invertRange=function(_){// bail if range has null or undefined values +if(_[0]==null||_[1]==null)return;var reverse=range$1[1]<range$1[0],values=reverse?ordinalRange().reverse():ordinalRange(),n=values.length-1;var lo=+_[0],hi=+_[1],a,b,t;// bail if either range endpoint is invalid +if(lo!==lo||hi!==hi)return;// order range inputs, bail if outside of scale range +if(hi<lo){t=lo;lo=hi;hi=t;}if(hi<values[0]||lo>range$1[1-reverse])return;// binary search to index into scale range +a=Math.max(0,bisectRight$1(values,lo)-1);b=lo===hi?a:bisectRight$1(values,hi)-1;// increment index a if lo is within padding gap +if(lo-values[a]>bandwidth+1e-10)++a;if(reverse){// map + swap +t=a;a=n-b;b=n-t;}return a>b?undefined:domain().slice(a,b+1);};scale.invert=function(_){var value=scale.invertRange([_,_]);return value?value[0]:value;};scale.copy=function(){return band().domain(domain()).range(range$1).round(round).paddingInner(paddingInner).paddingOuter(paddingOuter).align(align);};return rescale();}function pointish(scale){var copy=scale.copy;scale.padding=scale.paddingOuter;delete scale.paddingInner;scale.copy=function(){return pointish(copy());};return scale;}function point$1(){return pointish(band().paddingInner(1));}var map=Array.prototype.map;function numbers(_){return map.call(_,toNumber);}var slice$1=Array.prototype.slice;function scaleBinOrdinal(){var domain=[],range=[];function scale(x){return x==null||x!==x?undefined:range[(bisectRight$1(domain,x)-1)%range.length];}scale.domain=function(_){if(arguments.length){domain=numbers(_);return scale;}else{return domain.slice();}};scale.range=function(_){if(arguments.length){range=slice$1.call(_);return scale;}else{return range.slice();}};scale.tickFormat=function(count,specifier){return tickFormat$1(domain[0],peek$1(domain),count==null?10:count,specifier);};scale.copy=function(){return scaleBinOrdinal().domain(scale.domain()).range(scale.range());};return scale;}/** Private scale registry: should not be exported */var scales=new Map();var VEGA_SCALE=Symbol('vega_scale');function registerScale(scale){scale[VEGA_SCALE]=true;return scale;}/** + * Return true if object was created by a constructor from the vega-scale `scale` function. + */function isRegisteredScale(scale){return scale&&scale[VEGA_SCALE]===true;}/** + * Augment scales with their type and needed inverse methods. + */function create$2(type,constructor,metadata){var ctr=function scale(){var s=constructor();if(!s.invertRange){s.invertRange=s.invert?invertRange(s):s.invertExtent?invertRangeExtent(s):undefined;}s.type=type;return registerScale(s);};ctr.metadata=toSet(array$5(metadata));return ctr;}/** + * Registry function for adding and accessing scale constructor functions. + * The *type* argument is a String indicating the name of the scale type. + * + * If the *scale* argument is not specified, this method returns the matching scale constructor in the registry, or `null` if not found. + * If the *scale* argument is provided, it must be a scale constructor function to add to the registry under the given *type* name. + * The *metadata* argument provides additional information to guide appropriate use of scales within Vega. + * + * *metadata* can be either a string or string array. The valid string values are: + * - `"continuous"` - the scale is defined over a continuous-valued domain. + * - `"discrete"` - the scale is defined over a discrete domain and range. + * - `"discretizing"` - the scale discretizes a continuous domain to a discrete range. + * - `"interpolating"` - the scale range is defined using a color interpolator. + * - `"log"` - the scale performs a logarithmic transform of the continuous domain. + * - `"temporal"` - the scale domain is defined over date-time values. + */function scale$4(type,scale,metadata){if(arguments.length>1){scales.set(type,create$2(type,scale,metadata));return this;}else{return isValidScaleType(type)?scales.get(type):undefined;}}// identity scale +scale$4(Identity,identity$1);// continuous scales +scale$4(Linear,linear,Continuous);scale$4(Log,log$2,[Continuous,Log]);scale$4(Pow,pow$2,Continuous);scale$4(Sqrt,sqrt$2,Continuous);scale$4(Symlog,symlog,Continuous);scale$4(Time,time$1,[Continuous,Temporal]);scale$4(UTC,utcTime,[Continuous,Temporal]);// sequential scales +scale$4(Sequential,sequential,[Continuous,Interpolating]);// backwards compat +scale$4("".concat(Sequential,"-").concat(Linear),sequential,[Continuous,Interpolating]);scale$4("".concat(Sequential,"-").concat(Log),sequentialLog,[Continuous,Interpolating,Log]);scale$4("".concat(Sequential,"-").concat(Pow),sequentialPow,[Continuous,Interpolating]);scale$4("".concat(Sequential,"-").concat(Sqrt),sequentialSqrt,[Continuous,Interpolating]);scale$4("".concat(Sequential,"-").concat(Symlog),sequentialSymlog,[Continuous,Interpolating]);// diverging scales +scale$4("".concat(Diverging,"-").concat(Linear),diverging,[Continuous,Interpolating]);scale$4("".concat(Diverging,"-").concat(Log),divergingLog,[Continuous,Interpolating,Log]);scale$4("".concat(Diverging,"-").concat(Pow),divergingPow,[Continuous,Interpolating]);scale$4("".concat(Diverging,"-").concat(Sqrt),divergingSqrt,[Continuous,Interpolating]);scale$4("".concat(Diverging,"-").concat(Symlog),divergingSymlog,[Continuous,Interpolating]);// discretizing scales +scale$4(Quantile,quantile,[Discretizing,Quantile]);scale$4(Quantize,quantize$1,Discretizing);scale$4(Threshold,threshold,Discretizing);// discrete scales +scale$4(BinOrdinal,scaleBinOrdinal,[Discrete$1,Discretizing]);scale$4(Ordinal,ordinal,Discrete$1);scale$4(Band,band,Discrete$1);scale$4(Point,point$1,Discrete$1);function isValidScaleType(type){return scales.has(type);}function hasType(key,type){var s=scales.get(key);return s&&s.metadata[type];}function isContinuous(key){return hasType(key,Continuous);}function isDiscrete(key){return hasType(key,Discrete$1);}function isDiscretizing(key){return hasType(key,Discretizing);}function isLogarithmic(key){return hasType(key,Log);}function isTemporal(key){return hasType(key,Temporal);}function isInterpolating(key){return hasType(key,Interpolating);}function isQuantile(key){return hasType(key,Quantile);}var scaleProps=['clamp','base','constant','exponent'];function interpolateRange(interpolator,range){var start=range[0],span=peek$1(range)-start;return function(i){return interpolator(start+i*span);};}function interpolateColors(colors,type,gamma){return piecewise(interpolate(type||'rgb',gamma),colors);}function quantizeInterpolator(interpolator,count){var samples=new Array(count),n=count+1;for(var i=0;i<count;)samples[i]=interpolator(++i/n);return samples;}function scaleFraction(scale$1,min,max){var delta=max-min;var i,t,s;if(!delta||!Number.isFinite(delta)){return constant$5(0.5);}else{i=(t=scale$1.type).indexOf('-');t=i<0?t:t.slice(i+1);s=scale$4(t)().domain([min,max]).range([0,1]);scaleProps.forEach(function(m){return scale$1[m]?s[m](scale$1[m]()):0;});return s;}}function interpolate(type,gamma){var interp=$$1[method(type)];return gamma!=null&&interp&&interp.gamma?interp.gamma(gamma):interp;}function method(type){return'interpolate'+type.toLowerCase().split('-').map(function(s){return s[0].toUpperCase()+s.slice(1);}).join('');}var continuous={blues:'cfe1f2bed8eca8cee58fc1de74b2d75ba3cf4592c63181bd206fb2125ca40a4a90',greens:'d3eecdc0e6baabdda594d3917bc77d60ba6c46ab5e329a512089430e7735036429',greys:'e2e2e2d4d4d4c4c4c4b1b1b19d9d9d8888887575756262624d4d4d3535351e1e1e',oranges:'fdd8b3fdc998fdb87bfda55efc9244f87f2cf06b18e4580bd14904b93d029f3303',purples:'e2e1efd4d4e8c4c5e0b4b3d6a3a0cc928ec3827cb97566ae684ea25c3696501f8c',reds:'fdc9b4fcb49afc9e80fc8767fa7051f6573fec3f2fdc2a25c81b1db21218970b13',blueGreen:'d5efedc1e8e0a7ddd18bd2be70c6a958ba9144ad77319c5d2089460e7736036429',bluePurple:'ccddecbad0e4a8c2dd9ab0d4919cc98d85be8b6db28a55a6873c99822287730f71',greenBlue:'d3eecec5e8c3b1e1bb9bd8bb82cec269c2ca51b2cd3c9fc7288abd1675b10b60a1',orangeRed:'fddcaffdcf9bfdc18afdad77fb9562f67d53ee6545e24932d32d1ebf130da70403',purpleBlue:'dbdaebc8cee4b1c3de97b7d87bacd15b9fc93a90c01e7fb70b70ab056199045281',purpleBlueGreen:'dbd8eac8cee4b0c3de93b7d872acd1549fc83892bb1c88a3097f8702736b016353',purpleRed:'dcc9e2d3b3d7ce9eccd186c0da6bb2e14da0e23189d91e6fc61159ab07498f023a',redPurple:'fccfccfcbec0faa9b8f98faff571a5ec539ddb3695c41b8aa908808d0179700174',yellowGreen:'e4f4acd1eca0b9e2949ed68880c97c62bb6e47aa5e3297502083440e723b036034',yellowOrangeBrown:'feeaa1fedd84fecc63feb746fca031f68921eb7215db5e0bc54c05ab3d038f3204',yellowOrangeRed:'fee087fed16ffebd59fea849fd903efc7335f9522bee3423de1b20ca0b22af0225',blueOrange:'134b852f78b35da2cb9dcae1d2e5eff2f0ebfce0bafbbf74e8932fc5690d994a07',brownBlueGreen:'704108a0651ac79548e3c78af3e6c6eef1eac9e9e48ed1c74da79e187a72025147',purpleGreen:'5b1667834792a67fb6c9aed3e6d6e8eff0efd9efd5aedda971bb75368e490e5e29',purpleOrange:'4114696647968f83b7b9b4d6dadbebf3eeeafce0bafbbf74e8932fc5690d994a07',redBlue:'8c0d25bf363adf745ef4ae91fbdbc9f2efeed2e5ef9dcae15da2cb2f78b3134b85',redGrey:'8c0d25bf363adf745ef4ae91fcdccbfaf4f1e2e2e2c0c0c0969696646464343434',yellowGreenBlue:'eff9bddbf1b4bde5b594d5b969c5be45b4c22c9ec02182b82163aa23479c1c3185',redYellowBlue:'a50026d4322cf16e43fcac64fedd90faf8c1dcf1ecabd6e875abd04a74b4313695',redYellowGreen:'a50026d4322cf16e43fcac63fedd8df9f7aed7ee8ea4d86e64bc6122964f006837',pinkYellowGreen:'8e0152c0267edd72adf0b3d6faddedf5f3efe1f2cab6de8780bb474f9125276419',spectral:'9e0142d13c4bf0704afcac63fedd8dfbf8b0e0f3a1a9dda269bda94288b55e4fa2',viridis:'440154470e61481a6c482575472f7d443a834144873d4e8a39568c35608d31688e2d708e2a788e27818e23888e21918d1f988b1fa08822a8842ab07f35b77943bf7154c56866cc5d7ad1518fd744a5db36bcdf27d2e21be9e51afde725',magma:'0000040404130b0924150e3720114b2c11603b0f704a107957157e651a80721f817f24828c29819a2e80a8327db6377ac43c75d1426fde4968e95462f1605df76f5cfa7f5efc8f65fe9f6dfeaf78febf84fece91fddea0fcedaffcfdbf',inferno:'0000040403130c0826170c3b240c4f330a5f420a68500d6c5d126e6b176e781c6d86216b932667a12b62ae305cbb3755c73e4cd24644dd513ae65c30ed6925f3771af8850ffb9506fca50afcb519fac62df6d645f2e661f3f484fcffa4',plasma:'0d088723069033059742039d5002a25d01a66a00a87801a88405a7900da49c179ea72198b12a90ba3488c33d80cb4779d35171da5a69e16462e76e5bed7953f2834cf68f44fa9a3dfca636fdb32ffec029fcce25f9dc24f5ea27f0f921',cividis:'00205100235800265d002961012b65042e670831690d346b11366c16396d1c3c6e213f6e26426e2c456e31476e374a6e3c4d6e42506e47536d4c566d51586e555b6e5a5e6e5e616e62646f66676f6a6a706e6d717270717573727976737c79747f7c75827f758682768985778c8877908b78938e789691789a94789e9778a19b78a59e77a9a177aea575b2a874b6ab73bbaf71c0b26fc5b66dc9b96acebd68d3c065d8c462ddc85fe2cb5ce7cf58ebd355f0d652f3da4ff7de4cfae249fce647',rainbow:'6e40aa883eb1a43db3bf3cafd83fa4ee4395fe4b83ff576eff6659ff7847ff8c38f3a130e2b72fcfcc36bee044aff05b8ff4576ff65b52f6673af27828ea8d1ddfa319d0b81cbecb23abd82f96e03d82e14c6edb5a5dd0664dbf6e40aa',sinebow:'ff4040fc582af47218e78d0bd5a703bfbf00a7d5038de70b72f41858fc2a40ff402afc5818f4720be78d03d5a700bfbf03a7d50b8de71872f42a58fc4040ff582afc7218f48d0be7a703d5bf00bfd503a7e70b8df41872fc2a58ff4040',turbo:'23171b32204a3e2a71453493493eae4b49c54a53d7485ee44569ee4074f53c7ff8378af93295f72e9ff42ba9ef28b3e926bce125c5d925cdcf27d5c629dcbc2de3b232e9a738ee9d3ff39347f68950f9805afc7765fd6e70fe667cfd5e88fc5795fb51a1f84badf545b9f140c5ec3cd0e637dae034e4d931ecd12ef4c92bfac029ffb626ffad24ffa223ff9821ff8d1fff821dff771cfd6c1af76118f05616e84b14df4111d5380fcb2f0dc0260ab61f07ac1805a313029b0f00950c00910b00',browns:'eedbbdecca96e9b97ae4a865dc9856d18954c7784cc0673fb85536ad44339f3632',tealBlues:'bce4d89dd3d181c3cb65b3c245a2b9368fae347da0306a932c5985',teals:'bbdfdfa2d4d58ac9c975bcbb61b0af4da5a43799982b8b8c1e7f7f127273006667',warmGreys:'dcd4d0cec5c1c0b8b4b3aaa7a59c9998908c8b827f7e7673726866665c5a59504e',goldGreen:'f4d166d5ca60b6c35c98bb597cb25760a6564b9c533f8f4f33834a257740146c36',goldOrange:'f4d166f8be5cf8aa4cf5983bf3852aef701be2621fd65322c54923b142239e3a26',goldRed:'f4d166f6be59f9aa51fc964ef6834bee734ae56249db5247cf4244c43141b71d3e',lightGreyRed:'efe9e6e1dad7d5cbc8c8bdb9bbaea9cd967ddc7b43e15f19df4011dc000b',lightGreyTeal:'e4eaead6dcddc8ced2b7c2c7a6b4bc64b0bf22a6c32295c11f85be1876bc',lightMulti:'e0f1f2c4e9d0b0de9fd0e181f6e072f6c053f3993ef77440ef4a3c',lightOrange:'f2e7daf7d5baf9c499fab184fa9c73f68967ef7860e8645bde515bd43d5b',lightTealBlue:'e3e9e0c0dccf9aceca7abfc859afc0389fb9328dad2f7ca0276b95255988',darkBlue:'3232322d46681a5c930074af008cbf05a7ce25c0dd38daed50f3faffffff',darkGold:'3c3c3c584b37725e348c7631ae8b2bcfa424ecc31ef9de30fff184ffffff',darkGreen:'3a3a3a215748006f4d048942489e4276b340a6c63dd2d836ffeb2cffffaa',darkMulti:'3737371f5287197d8c29a86995ce3fffe800ffffff',darkRed:'3434347036339e3c38cc4037e75d1eec8620eeab29f0ce32ffeb2c'};var discrete={accent:schemeAccent,category10:schemeCategory10,category20:'1f77b4aec7e8ff7f0effbb782ca02c98df8ad62728ff98969467bdc5b0d58c564bc49c94e377c2f7b6d27f7f7fc7c7c7bcbd22dbdb8d17becf9edae5',category20b:'393b795254a36b6ecf9c9ede6379398ca252b5cf6bcedb9c8c6d31bd9e39e7ba52e7cb94843c39ad494ad6616be7969c7b4173a55194ce6dbdde9ed6',category20c:'3182bd6baed69ecae1c6dbefe6550dfd8d3cfdae6bfdd0a231a35474c476a1d99bc7e9c0756bb19e9ac8bcbddcdadaeb636363969696bdbdbdd9d9d9',dark2:schemeDark2,observable10:schemeObservable10,paired:schemePaired,pastel1:schemePastel1,pastel2:schemePastel2,set1:schemeSet1,set2:schemeSet2,set3:schemeSet3,tableau10:'4c78a8f58518e4575672b7b254a24beeca3bb279a2ff9da69d755dbab0ac',tableau20:'4c78a89ecae9f58518ffbf7954a24b88d27ab79a20f2cf5b43989483bcb6e45756ff9d9879706ebab0acd67195fcbfd2b279a2d6a5c99e765fd8b5a5'};function colors(palette){if(isArray(palette))return palette;var n=palette.length/6|0,c=new Array(n);for(var i=0;i<n;){c[i]='#'+palette.slice(i*6,++i*6);}return c;}function apply(_,f){for(var k in _)scheme(k,f(_[k]));}var schemes={};apply(discrete,colors);apply(continuous,function(_){return interpolateColors(colors(_));});function scheme(name,scheme){name=name&&name.toLowerCase();if(arguments.length>1){schemes[name]=scheme;return this;}else{return schemes[name];}}var SymbolLegend='symbol';var DiscreteLegend='discrete';var GradientLegend='gradient';var defaultFormatter=function defaultFormatter(value){return isArray(value)?value.map(function(v){return String(v);}):String(value);};var ascending=function ascending(a,b){return a[1]-b[1];};var descending=function descending(a,b){return b[1]-a[1];};/** + * Determine the tick count or interval function. + * @param {Scale} scale - The scale for which to generate tick values. + * @param {*} count - The desired tick count or interval specifier. + * @param {number} minStep - The desired minimum step between tick values. + * @return {*} - The tick count or interval function. + */function tickCount(scale,count,minStep){var step;if(isNumber$1(count)){if(scale.bins){count=Math.max(count,scale.bins.length);}if(minStep!=null){count=Math.min(count,Math.floor(span(scale.domain())/minStep||1)+1);}}if(isObject(count)){step=count.step;count=count.interval;}if(isString(count)){count=scale.type===Time?timeInterval(count):scale.type==UTC?utcInterval(count):error('Only time and utc scales accept interval strings.');if(step)count=count.every(step);}return count;}/** + * Filter a set of candidate tick values, ensuring that only tick values + * that lie within the scale range are included. + * @param {Scale} scale - The scale for which to generate tick values. + * @param {Array<*>} ticks - The candidate tick values. + * @param {*} count - The tick count or interval function. + * @return {Array<*>} - The filtered tick values. + */function validTicks(scale,ticks,count){var range=scale.range(),lo=range[0],hi=peek$1(range),cmp=ascending;if(lo>hi){range=hi;hi=lo;lo=range;cmp=descending;}lo=Math.floor(lo);hi=Math.ceil(hi);// filter ticks to valid values within the range +// additionally sort ticks in range order (#2579) +ticks=ticks.map(function(v){return[v,scale(v)];}).filter(function(_){return lo<=_[1]&&_[1]<=hi;}).sort(cmp).map(function(_){return _[0];});if(count>0&&ticks.length>1){var endpoints=[ticks[0],peek$1(ticks)];while(ticks.length>count&&ticks.length>=3){ticks=ticks.filter(function(_,i){return!(i%2);});}if(ticks.length<3){ticks=endpoints;}}return ticks;}/** + * Generate tick values for the given scale and approximate tick count or + * interval value. If the scale has a 'ticks' method, it will be used to + * generate the ticks, with the count argument passed as a parameter. If the + * scale lacks a 'ticks' method, the full scale domain will be returned. + * @param {Scale} scale - The scale for which to generate tick values. + * @param {*} [count] - The approximate number of desired ticks. + * @return {Array<*>} - The generated tick values. + */function tickValues(scale,count){return scale.bins?validTicks(scale,scale.bins,count):scale.ticks?scale.ticks(count):scale.domain();}/** + * Generate a label format function for a scale. If the scale has a + * 'tickFormat' method, it will be used to generate the formatter, with the + * count and specifier arguments passed as parameters. If the scale lacks a + * 'tickFormat' method, the returned formatter performs simple string coercion. + * If the input scale is a logarithmic scale and the format specifier does not + * indicate a desired decimal precision, a special variable precision formatter + * that automatically trims trailing zeroes will be generated. + * @param {Scale} scale - The scale for which to generate the label formatter. + * @param {*} [count] - The approximate number of desired ticks. + * @param {string} [specifier] - The format specifier. Must be a legal d3 + * specifier string (see https://github.com/d3/d3-format#formatSpecifier) or + * time multi-format specifier object. + * @return {function(*):string} - The generated label formatter. + */function tickFormat(locale,scale,count,specifier,formatType,noSkip){var type=scale.type;var format=defaultFormatter;if(type===Time||formatType===Time){format=locale.timeFormat(specifier);}else if(type===UTC||formatType===UTC){format=locale.utcFormat(specifier);}else if(isLogarithmic(type)){var varfmt=locale.formatFloat(specifier);if(noSkip||scale.bins){format=varfmt;}else{var _test2=tickLog(scale,count,false);format=function format(_){return _test2(_)?varfmt(_):'';};}}else if(scale.tickFormat){// if d3 scale has tickFormat, it must be continuous +var d=scale.domain();format=locale.formatSpan(d[0],d[d.length-1],count,specifier);}else if(specifier){format=locale.format(specifier);}return format;}function tickLog(scale,count,values){var ticks=tickValues(scale,count),base=scale.base(),logb=Math.log(base),k=Math.max(1,base*count/ticks.length);// apply d3-scale's log format filter criteria +var test=function test(d){var i=d/Math.pow(base,Math.round(Math.log(d)/logb));if(i*base<base-0.5)i*=base;return i<=k;};return values?ticks.filter(test):test;}var symbols$1=_defineProperty(_defineProperty(_defineProperty({},Quantile,'quantiles'),Quantize,'thresholds'),Threshold,'domain');var formats=_defineProperty(_defineProperty({},Quantile,'quantiles'),Quantize,'domain');function labelValues(scale,count){return scale.bins?binValues(scale.bins):scale.type===Log?tickLog(scale,count,true):symbols$1[scale.type]?thresholdValues(scale[symbols$1[scale.type]]()):tickValues(scale,count);}function thresholdFormat(locale,scale,specifier){var _=scale[formats[scale.type]](),n=_.length;var d=n>1?_[1]-_[0]:_[0],i;for(i=1;i<n;++i){d=Math.min(d,_[i]-_[i-1]);}// tickCount = 3 ticks times 10 for increased resolution +return locale.formatSpan(0,d,3*10,specifier);}function thresholdValues(thresholds){var values=[-Infinity].concat(thresholds);values.max=+Infinity;return values;}function binValues(bins){var values=bins.slice(0,-1);values.max=peek$1(bins);return values;}var isDiscreteRange=function isDiscreteRange(scale){return symbols$1[scale.type]||scale.bins;};function labelFormat(locale,scale,count,type,specifier,formatType,noSkip){var format=formats[scale.type]&&formatType!==Time&&formatType!==UTC?thresholdFormat(locale,scale,specifier):tickFormat(locale,scale,count,specifier,formatType,noSkip);return type===SymbolLegend&&isDiscreteRange(scale)?formatRange(format):type===DiscreteLegend?formatDiscrete(format):formatPoint(format);}var formatRange=function formatRange(format){return function(value,index,array){var limit=get$3(array[index+1],get$3(array.max,+Infinity)),lo=formatValue$1(value,format),hi=formatValue$1(limit,format);return lo&&hi?lo+" \u2013 "+hi:hi?'< '+hi:"\u2265 "+lo;};};var get$3=function get$3(value,dflt){return value!=null?value:dflt;};var formatDiscrete=function formatDiscrete(format){return function(value,index){return index?format(value):null;};};var formatPoint=function formatPoint(format){return function(value){return format(value);};};var formatValue$1=function formatValue$1(value,format){return Number.isFinite(value)?format(value):null;};function labelFraction(scale){var domain=scale.domain(),count=domain.length-1;var lo=+domain[0],hi=+peek$1(domain),span=hi-lo;if(scale.type===Threshold){var adjust=count?span/count:0.1;lo-=adjust;hi+=adjust;span=hi-lo;}return function(value){return(value-lo)/span;};}function format$1(locale,scale,specifier,formatType){var type=formatType||scale.type;// replace abbreviated time specifiers to improve screen reader experience +if(isString(specifier)&&isTemporal(type)){specifier=specifier.replace(/%a/g,'%A').replace(/%b/g,'%B');}return!specifier&&type===Time?locale.timeFormat('%A, %d %B %Y, %X'):!specifier&&type===UTC?locale.utcFormat('%A, %d %B %Y, %X UTC'):labelFormat(locale,scale,5,null,specifier,formatType,true);}function domainCaption(locale,scale,opt){opt=opt||{};var max=Math.max(3,opt.maxlen||7),fmt=format$1(locale,scale,opt.format,opt.formatType);// if scale breaks domain into bins, describe boundaries +if(isDiscretizing(scale.type)){var v=labelValues(scale).slice(1).map(fmt),n=v.length;return"".concat(n," boundar").concat(n===1?'y':'ies',": ").concat(v.join(', '));}// if scale domain is discrete, list values +else if(isDiscrete(scale.type)){var d=scale.domain(),_n2=d.length,_v=_n2>max?d.slice(0,max-2).map(fmt).join(', ')+', ending with '+d.slice(-1).map(fmt):d.map(fmt).join(', ');return"".concat(_n2," value").concat(_n2===1?'':'s',": ").concat(_v);}// if scale domain is continuous, describe value range +else{var _d=scale.domain();return"values from ".concat(fmt(_d[0])," to ").concat(fmt(peek$1(_d)));}}var gradient_id=0;function resetSVGGradientId(){gradient_id=0;}var patternPrefix='p_';function isGradient(value){return value&&value.gradient;}function gradientRef(g,defs,base){var type=g.gradient;var id=g.id,prefix=type==='radial'?patternPrefix:'';// check id, assign default values as needed +if(!id){id=g.id='gradient_'+gradient_id++;if(type==='radial'){g.x1=get$2(g.x1,0.5);g.y1=get$2(g.y1,0.5);g.r1=get$2(g.r1,0);g.x2=get$2(g.x2,0.5);g.y2=get$2(g.y2,0.5);g.r2=get$2(g.r2,0.5);prefix=patternPrefix;}else{g.x1=get$2(g.x1,0);g.y1=get$2(g.y1,0);g.x2=get$2(g.x2,1);g.y2=get$2(g.y2,0);}}// register definition +defs[id]=g;// return url reference +return'url('+(base||'')+'#'+prefix+id+')';}function get$2(val,def){return val!=null?val:def;}function Gradient$1(p0,p1){var stops=[],gradient;return gradient={gradient:'linear',x1:p0?p0[0]:0,y1:p0?p0[1]:0,x2:p1?p1[0]:1,y2:p1?p1[1]:0,stops:stops,stop:function stop(offset,color){stops.push({offset:offset,color:color});return gradient;}};}var lookup$4={'basis':{curve:curveBasis},'basis-closed':{curve:curveBasisClosed},'basis-open':{curve:curveBasisOpen},'bundle':{curve:curveBundle,tension:'beta',value:0.85},'cardinal':{curve:curveCardinal,tension:'tension',value:0},'cardinal-open':{curve:curveCardinalOpen,tension:'tension',value:0},'cardinal-closed':{curve:curveCardinalClosed,tension:'tension',value:0},'catmull-rom':{curve:curveCatmullRom,tension:'alpha',value:0.5},'catmull-rom-closed':{curve:curveCatmullRomClosed,tension:'alpha',value:0.5},'catmull-rom-open':{curve:curveCatmullRomOpen,tension:'alpha',value:0.5},'linear':{curve:curveLinear},'linear-closed':{curve:curveLinearClosed},'monotone':{horizontal:monotoneY,vertical:monotoneX},'natural':{curve:curveNatural},'step':{curve:curveStep},'step-after':{curve:stepAfter},'step-before':{curve:stepBefore}};function curves(type,orientation,tension){var entry=has$1(lookup$4,type)&&lookup$4[type],curve=null;if(entry){curve=entry.curve||entry[orientation||'vertical'];if(entry.tension&&tension!=null){curve=curve[entry.tension](tension);}}return curve;}var paramCounts={m:2,l:2,h:1,v:1,z:0,c:6,s:4,q:4,t:2,a:7};var commandPattern=/[mlhvzcsqta]([^mlhvzcsqta]+|$)/gi;var numberPattern=/^[+-]?(([0-9]*\.[0-9]+)|([0-9]+\.)|([0-9]+))([eE][+-]?[0-9]+)?/;var spacePattern=/^((\s+,?\s*)|(,\s*))/;var flagPattern=/^[01]/;function parse$3(path){var commands=[];var matches=path.match(commandPattern)||[];matches.forEach(function(str){var cmd=str[0];var type=cmd.toLowerCase();// parse parameters +var paramCount=paramCounts[type];var params=parseParams(type,paramCount,str.slice(1).trim());var count=params.length;// error checking based on parameter count +if(count<paramCount||count&&count%paramCount!==0){throw Error('Invalid SVG path, incorrect parameter count');}// register the command +commands.push([cmd].concat(_toConsumableArray(params.slice(0,paramCount))));// exit now if we're done, also handles zero-param 'z' +if(count===paramCount){return;}// handle implicit line-to +if(type==='m'){cmd=cmd==='M'?'L':'l';}// repeat command when given extended param list +for(var i=paramCount;i<count;i+=paramCount){commands.push([cmd].concat(_toConsumableArray(params.slice(i,i+paramCount))));}});return commands;}function parseParams(type,paramCount,segment){var params=[];for(var _index7=0;paramCount&&_index7<segment.length;){for(var i=0;i<paramCount;++i){var pattern=type==='a'&&(i===3||i===4)?flagPattern:numberPattern;var _match=segment.slice(_index7).match(pattern);if(_match===null){throw Error('Invalid SVG path, incorrect parameter type');}_index7+=_match[0].length;params.push(+_match[0]);var ws=segment.slice(_index7).match(spacePattern);if(ws!==null){_index7+=ws[0].length;}}}return params;}var DegToRad=Math.PI/180;var Epsilon=1e-14;var HalfPi=Math.PI/2;var Tau=Math.PI*2;var HalfSqrt3=Math.sqrt(3)/2;var segmentCache={};var bezierCache={};var join$1=[].join;// Copied from Inkscape svgtopdf, thanks! +function segments(x,y,rx,ry,large,sweep,rotateX,ox,oy){var key=join$1.call(arguments);if(segmentCache[key]){return segmentCache[key];}var th=rotateX*DegToRad;var sin_th=Math.sin(th);var cos_th=Math.cos(th);rx=Math.abs(rx);ry=Math.abs(ry);var px=cos_th*(ox-x)*0.5+sin_th*(oy-y)*0.5;var py=cos_th*(oy-y)*0.5-sin_th*(ox-x)*0.5;var pl=px*px/(rx*rx)+py*py/(ry*ry);if(pl>1){pl=Math.sqrt(pl);rx*=pl;ry*=pl;}var a00=cos_th/rx;var a01=sin_th/rx;var a10=-sin_th/ry;var a11=cos_th/ry;var x0=a00*ox+a01*oy;var y0=a10*ox+a11*oy;var x1=a00*x+a01*y;var y1=a10*x+a11*y;var d=(x1-x0)*(x1-x0)+(y1-y0)*(y1-y0);var sfactor_sq=1/d-0.25;if(sfactor_sq<0)sfactor_sq=0;var sfactor=Math.sqrt(sfactor_sq);if(sweep==large)sfactor=-sfactor;var xc=0.5*(x0+x1)-sfactor*(y1-y0);var yc=0.5*(y0+y1)+sfactor*(x1-x0);var th0=Math.atan2(y0-yc,x0-xc);var th1=Math.atan2(y1-yc,x1-xc);var th_arc=th1-th0;if(th_arc<0&&sweep===1){th_arc+=Tau;}else if(th_arc>0&&sweep===0){th_arc-=Tau;}var segs=Math.ceil(Math.abs(th_arc/(HalfPi+0.001)));var result=[];for(var i=0;i<segs;++i){var th2=th0+i*th_arc/segs;var th3=th0+(i+1)*th_arc/segs;result[i]=[xc,yc,th2,th3,rx,ry,sin_th,cos_th];}return segmentCache[key]=result;}function bezier(params){var key=join$1.call(params);if(bezierCache[key]){return bezierCache[key];}var cx=params[0],cy=params[1],th0=params[2],th1=params[3],rx=params[4],ry=params[5],sin_th=params[6],cos_th=params[7];var a00=cos_th*rx;var a01=-sin_th*ry;var a10=sin_th*rx;var a11=cos_th*ry;var cos_th0=Math.cos(th0);var sin_th0=Math.sin(th0);var cos_th1=Math.cos(th1);var sin_th1=Math.sin(th1);var th_half=0.5*(th1-th0);var sin_th_h2=Math.sin(th_half*0.5);var t=8/3*sin_th_h2*sin_th_h2/Math.sin(th_half);var x1=cx+cos_th0-t*sin_th0;var y1=cy+sin_th0+t*cos_th0;var x3=cx+cos_th1;var y3=cy+sin_th1;var x2=x3+t*sin_th1;var y2=y3-t*cos_th1;return bezierCache[key]=[a00*x1+a01*y1,a10*x1+a11*y1,a00*x2+a01*y2,a10*x2+a11*y2,a00*x3+a01*y3,a10*x3+a11*y3];}var temp=['l',0,0,0,0,0,0,0];function scale$1$1(current,sX,sY){var c=temp[0]=current[0];if(c==='a'||c==='A'){temp[1]=sX*current[1];temp[2]=sY*current[2];temp[3]=current[3];temp[4]=current[4];temp[5]=current[5];temp[6]=sX*current[6];temp[7]=sY*current[7];}else if(c==='h'||c==='H'){temp[1]=sX*current[1];}else if(c==='v'||c==='V'){temp[1]=sY*current[1];}else{for(var i=1,n=current.length;i<n;++i){temp[i]=(i%2==1?sX:sY)*current[i];}}return temp;}function pathRender(context,path,l,t,sX,sY){var current,// current instruction +previous=null,x=0,// current x +y=0,// current y +controlX=0,// current control point x +controlY=0,// current control point y +tempX,tempY,tempControlX,tempControlY,anchorX=0,anchorY=0;if(l==null)l=0;if(t==null)t=0;if(sX==null)sX=1;if(sY==null)sY=sX;if(context.beginPath)context.beginPath();for(var i=0,len=path.length;i<len;++i){current=path[i];if(sX!==1||sY!==1){current=scale$1$1(current,sX,sY);}switch(current[0]){// first letter +case'l':// lineto, relative +x+=current[1];y+=current[2];context.lineTo(x+l,y+t);break;case'L':// lineto, absolute +x=current[1];y=current[2];context.lineTo(x+l,y+t);break;case'h':// horizontal lineto, relative +x+=current[1];context.lineTo(x+l,y+t);break;case'H':// horizontal lineto, absolute +x=current[1];context.lineTo(x+l,y+t);break;case'v':// vertical lineto, relative +y+=current[1];context.lineTo(x+l,y+t);break;case'V':// verical lineto, absolute +y=current[1];context.lineTo(x+l,y+t);break;case'm':// moveTo, relative +x+=current[1];y+=current[2];anchorX=x;anchorY=y;context.moveTo(x+l,y+t);break;case'M':// moveTo, absolute +x=current[1];y=current[2];anchorX=x;anchorY=y;context.moveTo(x+l,y+t);break;case'c':// bezierCurveTo, relative +tempX=x+current[5];tempY=y+current[6];controlX=x+current[3];controlY=y+current[4];context.bezierCurveTo(x+current[1]+l,// x1 +y+current[2]+t,// y1 +controlX+l,// x2 +controlY+t,// y2 +tempX+l,tempY+t);x=tempX;y=tempY;break;case'C':// bezierCurveTo, absolute +x=current[5];y=current[6];controlX=current[3];controlY=current[4];context.bezierCurveTo(current[1]+l,current[2]+t,controlX+l,controlY+t,x+l,y+t);break;case's':// shorthand cubic bezierCurveTo, relative +// transform to absolute x,y +tempX=x+current[3];tempY=y+current[4];// calculate reflection of previous control points +controlX=2*x-controlX;controlY=2*y-controlY;context.bezierCurveTo(controlX+l,controlY+t,x+current[1]+l,y+current[2]+t,tempX+l,tempY+t);// set control point to 2nd one of this command +// the first control point is assumed to be the reflection of +// the second control point on the previous command relative +// to the current point. +controlX=x+current[1];controlY=y+current[2];x=tempX;y=tempY;break;case'S':// shorthand cubic bezierCurveTo, absolute +tempX=current[3];tempY=current[4];// calculate reflection of previous control points +controlX=2*x-controlX;controlY=2*y-controlY;context.bezierCurveTo(controlX+l,controlY+t,current[1]+l,current[2]+t,tempX+l,tempY+t);x=tempX;y=tempY;// set control point to 2nd one of this command +// the first control point is assumed to be the reflection of +// the second control point on the previous command relative +// to the current point. +controlX=current[1];controlY=current[2];break;case'q':// quadraticCurveTo, relative +// transform to absolute x,y +tempX=x+current[3];tempY=y+current[4];controlX=x+current[1];controlY=y+current[2];context.quadraticCurveTo(controlX+l,controlY+t,tempX+l,tempY+t);x=tempX;y=tempY;break;case'Q':// quadraticCurveTo, absolute +tempX=current[3];tempY=current[4];context.quadraticCurveTo(current[1]+l,current[2]+t,tempX+l,tempY+t);x=tempX;y=tempY;controlX=current[1];controlY=current[2];break;case't':// shorthand quadraticCurveTo, relative +// transform to absolute x,y +tempX=x+current[1];tempY=y+current[2];if(previous[0].match(/[QqTt]/)===null){// If there is no previous command or if the previous command was not a Q, q, T or t, +// assume the control point is coincident with the current point +controlX=x;controlY=y;}else if(previous[0]==='t'){// calculate reflection of previous control points for t +controlX=2*x-tempControlX;controlY=2*y-tempControlY;}else if(previous[0]==='q'){// calculate reflection of previous control points for q +controlX=2*x-controlX;controlY=2*y-controlY;}tempControlX=controlX;tempControlY=controlY;context.quadraticCurveTo(controlX+l,controlY+t,tempX+l,tempY+t);x=tempX;y=tempY;controlX=x+current[1];controlY=y+current[2];break;case'T':tempX=current[1];tempY=current[2];// calculate reflection of previous control points +controlX=2*x-controlX;controlY=2*y-controlY;context.quadraticCurveTo(controlX+l,controlY+t,tempX+l,tempY+t);x=tempX;y=tempY;break;case'a':drawArc(context,x+l,y+t,[current[1],current[2],current[3],current[4],current[5],current[6]+x+l,current[7]+y+t]);x+=current[6];y+=current[7];break;case'A':drawArc(context,x+l,y+t,[current[1],current[2],current[3],current[4],current[5],current[6]+l,current[7]+t]);x=current[6];y=current[7];break;case'z':case'Z':x=anchorX;y=anchorY;context.closePath();break;}previous=current;}}function drawArc(context,x,y,coords){var seg=segments(coords[5],// end x +coords[6],// end y +coords[0],// radius x +coords[1],// radius y +coords[3],// large flag +coords[4],// sweep flag +coords[2],// rotation +x,y);for(var i=0;i<seg.length;++i){var bez=bezier(seg[i]);context.bezierCurveTo(bez[0],bez[1],bez[2],bez[3],bez[4],bez[5]);}}var Tan30=0.5773502691896257;var builtins={'circle':{draw:function draw(context,size){var r=Math.sqrt(size)/2;context.moveTo(r,0);context.arc(0,0,r,0,Tau);}},'cross':{draw:function draw(context,size){var r=Math.sqrt(size)/2,s=r/2.5;context.moveTo(-r,-s);context.lineTo(-r,s);context.lineTo(-s,s);context.lineTo(-s,r);context.lineTo(s,r);context.lineTo(s,s);context.lineTo(r,s);context.lineTo(r,-s);context.lineTo(s,-s);context.lineTo(s,-r);context.lineTo(-s,-r);context.lineTo(-s,-s);context.closePath();}},'diamond':{draw:function draw(context,size){var r=Math.sqrt(size)/2;context.moveTo(-r,0);context.lineTo(0,-r);context.lineTo(r,0);context.lineTo(0,r);context.closePath();}},'square':{draw:function draw(context,size){var w=Math.sqrt(size),x=-w/2;context.rect(x,x,w,w);}},'arrow':{draw:function draw(context,size){var r=Math.sqrt(size)/2,s=r/7,t=r/2.5,v=r/8;context.moveTo(-s,r);context.lineTo(s,r);context.lineTo(s,-v);context.lineTo(t,-v);context.lineTo(0,-r);context.lineTo(-t,-v);context.lineTo(-s,-v);context.closePath();}},'wedge':{draw:function draw(context,size){var r=Math.sqrt(size)/2,h=HalfSqrt3*r,o=h-r*Tan30,b=r/4;context.moveTo(0,-h-o);context.lineTo(-b,h-o);context.lineTo(b,h-o);context.closePath();}},'triangle':{draw:function draw(context,size){var r=Math.sqrt(size)/2,h=HalfSqrt3*r,o=h-r*Tan30;context.moveTo(0,-h-o);context.lineTo(-r,h-o);context.lineTo(r,h-o);context.closePath();}},'triangle-up':{draw:function draw(context,size){var r=Math.sqrt(size)/2,h=HalfSqrt3*r;context.moveTo(0,-h);context.lineTo(-r,h);context.lineTo(r,h);context.closePath();}},'triangle-down':{draw:function draw(context,size){var r=Math.sqrt(size)/2,h=HalfSqrt3*r;context.moveTo(0,h);context.lineTo(-r,-h);context.lineTo(r,-h);context.closePath();}},'triangle-right':{draw:function draw(context,size){var r=Math.sqrt(size)/2,h=HalfSqrt3*r;context.moveTo(h,0);context.lineTo(-h,-r);context.lineTo(-h,r);context.closePath();}},'triangle-left':{draw:function draw(context,size){var r=Math.sqrt(size)/2,h=HalfSqrt3*r;context.moveTo(-h,0);context.lineTo(h,-r);context.lineTo(h,r);context.closePath();}},'stroke':{draw:function draw(context,size){var r=Math.sqrt(size)/2;context.moveTo(-r,0);context.lineTo(r,0);}}};function symbols(_){return has$1(builtins,_)?builtins[_]:customSymbol(_);}var custom={};function customSymbol(path){if(!has$1(custom,path)){var parsed=parse$3(path);custom[path]={draw:function draw(context,size){pathRender(context,parsed,0,0,Math.sqrt(size)/2);}};}return custom[path];}// See http://spencermortensen.com/articles/bezier-circle/ +var C=0.448084975506;// C = 1 - c +function rectangleX(d){return d.x;}function rectangleY(d){return d.y;}function rectangleWidth(d){return d.width;}function rectangleHeight(d){return d.height;}function number$3(_){return typeof _==='function'?_:function(){return+_;};}function clamp(value,min,max){return Math.max(min,Math.min(value,max));}function vg_rect(){var x=rectangleX,y=rectangleY,width=rectangleWidth,height=rectangleHeight,crTL=number$3(0),crTR=crTL,crBL=crTL,crBR=crTL,context=null;function rectangle(_,x0,y0){var buffer,x1=x0!=null?x0:+x.call(this,_),y1=y0!=null?y0:+y.call(this,_),w=+width.call(this,_),h=+height.call(this,_),s=Math.min(w,h)/2,tl=clamp(+crTL.call(this,_),0,s),tr=clamp(+crTR.call(this,_),0,s),bl=clamp(+crBL.call(this,_),0,s),br=clamp(+crBR.call(this,_),0,s);if(!context)context=buffer=path$3();if(tl<=0&&tr<=0&&bl<=0&&br<=0){context.rect(x1,y1,w,h);}else{var x2=x1+w,y2=y1+h;context.moveTo(x1+tl,y1);context.lineTo(x2-tr,y1);context.bezierCurveTo(x2-C*tr,y1,x2,y1+C*tr,x2,y1+tr);context.lineTo(x2,y2-br);context.bezierCurveTo(x2,y2-C*br,x2-C*br,y2,x2-br,y2);context.lineTo(x1+bl,y2);context.bezierCurveTo(x1+C*bl,y2,x1,y2-C*bl,x1,y2-bl);context.lineTo(x1,y1+tl);context.bezierCurveTo(x1,y1+C*tl,x1+C*tl,y1,x1+tl,y1);context.closePath();}if(buffer){context=null;return buffer+''||null;}}rectangle.x=function(_){if(arguments.length){x=number$3(_);return rectangle;}else{return x;}};rectangle.y=function(_){if(arguments.length){y=number$3(_);return rectangle;}else{return y;}};rectangle.width=function(_){if(arguments.length){width=number$3(_);return rectangle;}else{return width;}};rectangle.height=function(_){if(arguments.length){height=number$3(_);return rectangle;}else{return height;}};rectangle.cornerRadius=function(tl,tr,br,bl){if(arguments.length){crTL=number$3(tl);crTR=tr!=null?number$3(tr):crTL;crBR=br!=null?number$3(br):crTL;crBL=bl!=null?number$3(bl):crTR;return rectangle;}else{return crTL;}};rectangle.context=function(_){if(arguments.length){context=_==null?null:_;return rectangle;}else{return context;}};return rectangle;}function vg_trail(){var x,y,size,defined,context=null,ready,x1,y1,r1;function point(x2,y2,w2){var r2=w2/2;if(ready){var ux=y1-y2,uy=x2-x1;if(ux||uy){// get normal vector +var ud=Math.hypot(ux,uy),rx=(ux/=ud)*r1,ry=(uy/=ud)*r1,t=Math.atan2(uy,ux);// draw segment +context.moveTo(x1-rx,y1-ry);context.lineTo(x2-ux*r2,y2-uy*r2);context.arc(x2,y2,r2,t-Math.PI,t);context.lineTo(x1+rx,y1+ry);context.arc(x1,y1,r1,t,t+Math.PI);}else{context.arc(x2,y2,r2,0,Tau);}context.closePath();}else{ready=1;}x1=x2;y1=y2;r1=r2;}function trail(data){var i,n=data.length,d,defined0=false,buffer;if(context==null)context=buffer=path$3();for(i=0;i<=n;++i){if(!(i<n&&defined(d=data[i],i,data))===defined0){if(defined0=!defined0)ready=0;}if(defined0)point(+x(d,i,data),+y(d,i,data),+size(d,i,data));}if(buffer){context=null;return buffer+''||null;}}trail.x=function(_){if(arguments.length){x=_;return trail;}else{return x;}};trail.y=function(_){if(arguments.length){y=_;return trail;}else{return y;}};trail.size=function(_){if(arguments.length){size=_;return trail;}else{return size;}};trail.defined=function(_){if(arguments.length){defined=_;return trail;}else{return defined;}};trail.context=function(_){if(arguments.length){if(_==null){context=null;}else{context=_;}return trail;}else{return context;}};return trail;}function value$1(a,b){return a!=null?a:b;}var x$2=function x$2(item){return item.x||0;},y$2=function y$2(item){return item.y||0;},w=function w(item){return item.width||0;},h=function h(item){return item.height||0;},xw=function xw(item){return(item.x||0)+(item.width||0);},yh=function yh(item){return(item.y||0)+(item.height||0);},sa=function sa(item){return item.startAngle||0;},ea=function ea(item){return item.endAngle||0;},pa=function pa(item){return item.padAngle||0;},ir=function ir(item){return item.innerRadius||0;},or=function or(item){return item.outerRadius||0;},cr=function cr(item){return item.cornerRadius||0;},tl=function tl(item){return value$1(item.cornerRadiusTopLeft,item.cornerRadius)||0;},tr=function tr(item){return value$1(item.cornerRadiusTopRight,item.cornerRadius)||0;},br=function br(item){return value$1(item.cornerRadiusBottomRight,item.cornerRadius)||0;},bl=function bl(item){return value$1(item.cornerRadiusBottomLeft,item.cornerRadius)||0;},sz=function sz(item){return value$1(item.size,64);},ts=function ts(item){return item.size||1;},def=function def(item){return!(item.defined===false);},type=function type(item){return symbols(item.shape||'circle');};var arcShape=arc$2$1().startAngle(sa).endAngle(ea).padAngle(pa).innerRadius(ir).outerRadius(or).cornerRadius(cr),areavShape=area$2$1().x(x$2).y1(y$2).y0(yh).defined(def),areahShape=area$2$1().y(y$2).x1(x$2).x0(xw).defined(def),lineShape=line$2$1().x(x$2).y(y$2).defined(def),rectShape=vg_rect().x(x$2).y(y$2).width(w).height(h).cornerRadius(tl,tr,br,bl),symbolShape=Symbol$1().type(type).size(sz),trailShape=vg_trail().x(x$2).y(y$2).defined(def).size(ts);function hasCornerRadius(item){return item.cornerRadius||item.cornerRadiusTopLeft||item.cornerRadiusTopRight||item.cornerRadiusBottomRight||item.cornerRadiusBottomLeft;}function arc$1(context,item){return arcShape.context(context)(item);}function area$1(context,items){var item=items[0],interp=item.interpolate||'linear';return(item.orient==='horizontal'?areahShape:areavShape).curve(curves(interp,item.orient,item.tension)).context(context)(items);}function line$1(context,items){var item=items[0],interp=item.interpolate||'linear';return lineShape.curve(curves(interp,item.orient,item.tension)).context(context)(items);}function rectangle(context,item,x,y){return rectShape.context(context)(item,x,y);}function shape$1(context,item){return(item.mark.shape||item.shape).context(context)(item);}function symbol$1(context,item){return symbolShape.context(context)(item);}function trail$1(context,items){return trailShape.context(context)(items);}var clip_id=1;function resetSVGClipId(){clip_id=1;}function clip$1$1(renderer,item,size){var clip=item.clip,defs=renderer._defs,id=item.clip_id||(item.clip_id='clip'+clip_id++),c=defs.clipping[id]||(defs.clipping[id]={id:id});if(isFunction(clip)){c.path=clip(null);}else if(hasCornerRadius(size)){c.path=rectangle(null,size,0,0);}else{c.width=size.width||0;c.height=size.height||0;}return'url(#'+id+')';}function Bounds(b){this.clear();if(b)this.union(b);}Bounds.prototype={clone:function clone(){return new Bounds(this);},clear:function clear(){this.x1=+Number.MAX_VALUE;this.y1=+Number.MAX_VALUE;this.x2=-Number.MAX_VALUE;this.y2=-Number.MAX_VALUE;return this;},empty:function empty(){return this.x1===+Number.MAX_VALUE&&this.y1===+Number.MAX_VALUE&&this.x2===-Number.MAX_VALUE&&this.y2===-Number.MAX_VALUE;},equals:function equals(b){return this.x1===b.x1&&this.y1===b.y1&&this.x2===b.x2&&this.y2===b.y2;},set:function set(x1,y1,x2,y2){if(x2<x1){this.x2=x1;this.x1=x2;}else{this.x1=x1;this.x2=x2;}if(y2<y1){this.y2=y1;this.y1=y2;}else{this.y1=y1;this.y2=y2;}return this;},add:function add(x,y){if(x<this.x1)this.x1=x;if(y<this.y1)this.y1=y;if(x>this.x2)this.x2=x;if(y>this.y2)this.y2=y;return this;},expand:function expand(d){this.x1-=d;this.y1-=d;this.x2+=d;this.y2+=d;return this;},round:function round(){this.x1=Math.floor(this.x1);this.y1=Math.floor(this.y1);this.x2=Math.ceil(this.x2);this.y2=Math.ceil(this.y2);return this;},scale:function scale(s){this.x1*=s;this.y1*=s;this.x2*=s;this.y2*=s;return this;},translate:function translate(dx,dy){this.x1+=dx;this.x2+=dx;this.y1+=dy;this.y2+=dy;return this;},rotate:function rotate(angle,x,y){var p=this.rotatedPoints(angle,x,y);return this.clear().add(p[0],p[1]).add(p[2],p[3]).add(p[4],p[5]).add(p[6],p[7]);},rotatedPoints:function rotatedPoints(angle,x,y){var x1=this.x1,y1=this.y1,x2=this.x2,y2=this.y2,cos=Math.cos(angle),sin=Math.sin(angle),cx=x-x*cos+y*sin,cy=y-x*sin-y*cos;return[cos*x1-sin*y1+cx,sin*x1+cos*y1+cy,cos*x1-sin*y2+cx,sin*x1+cos*y2+cy,cos*x2-sin*y1+cx,sin*x2+cos*y1+cy,cos*x2-sin*y2+cx,sin*x2+cos*y2+cy];},union:function union(b){if(b.x1<this.x1)this.x1=b.x1;if(b.y1<this.y1)this.y1=b.y1;if(b.x2>this.x2)this.x2=b.x2;if(b.y2>this.y2)this.y2=b.y2;return this;},intersect:function intersect(b){if(b.x1>this.x1)this.x1=b.x1;if(b.y1>this.y1)this.y1=b.y1;if(b.x2<this.x2)this.x2=b.x2;if(b.y2<this.y2)this.y2=b.y2;return this;},encloses:function encloses(b){return b&&this.x1<=b.x1&&this.x2>=b.x2&&this.y1<=b.y1&&this.y2>=b.y2;},alignsWith:function alignsWith(b){return b&&(this.x1==b.x1||this.x2==b.x2||this.y1==b.y1||this.y2==b.y2);},intersects:function intersects(b){return b&&!(this.x2<b.x1||this.x1>b.x2||this.y2<b.y1||this.y1>b.y2);},contains:function contains(x,y){return!(x<this.x1||x>this.x2||y<this.y1||y>this.y2);},width:function width(){return this.x2-this.x1;},height:function height(){return this.y2-this.y1;}};function Item(mark){this.mark=mark;this.bounds=this.bounds||new Bounds();}function GroupItem(mark){Item.call(this,mark);this.items=this.items||[];}inherits(GroupItem,Item);var ResourceLoader=/*#__PURE__*/function(){function ResourceLoader(customLoader){_classCallCheck(this,ResourceLoader);this._pending=0;this._loader=customLoader||loader();}return _createClass(ResourceLoader,[{key:"pending",value:function pending(){return this._pending;}},{key:"sanitizeURL",value:function sanitizeURL(uri){var loader=this;increment(loader);return loader._loader.sanitize(uri,{context:'href'}).then(function(opt){decrement(loader);return opt;})["catch"](function(){decrement(loader);return null;});}},{key:"loadImage",value:function loadImage(uri){var loader=this,Image=domImage();increment(loader);return loader._loader.sanitize(uri,{context:'image'}).then(function(opt){var url=opt.href;if(!url||!Image)throw{url:url};var img=new Image();// set crossOrigin only if cors is defined; empty string sets anonymous mode +// https://developer.mozilla.org/en-US/docs/Web/API/HTMLImageElement/crossOrigin +var cors=has$1(opt,'crossOrigin')?opt.crossOrigin:'anonymous';if(cors!=null)img.crossOrigin=cors;// attempt to load image resource +img.onload=function(){return decrement(loader);};img.onerror=function(){return decrement(loader);};img.src=url;return img;})["catch"](function(e){decrement(loader);return{complete:false,width:0,height:0,src:e&&e.url||''};});}},{key:"ready",value:function ready(){var loader=this;return new Promise(function(accept){function poll(value){if(!loader.pending())accept(value);else setTimeout(function(){poll(true);},10);}poll(false);});}}]);}();function increment(loader){loader._pending+=1;}function decrement(loader){loader._pending-=1;}function boundStroke(bounds,item,miter){if(item.stroke&&item.opacity!==0&&item.strokeOpacity!==0){var sw=item.strokeWidth!=null?+item.strokeWidth:1;bounds.expand(sw+(miter?miterAdjustment(item,sw):0));}return bounds;}function miterAdjustment(item,strokeWidth){// TODO: more sophisticated adjustment? Or miter support in boundContext? +return item.strokeJoin&&item.strokeJoin!=='miter'?0:strokeWidth;}var circleThreshold=Tau-1e-8;var bounds,lx,ly,rot,ma,mb,mc,md;var add$1=function add$1(x,y){return bounds.add(x,y);};var addL=function addL(x,y){return add$1(lx=x,ly=y);};var addX=function addX(x){return add$1(x,bounds.y1);};var addY=function addY(y){return add$1(bounds.x1,y);};var px=function px(x,y){return ma*x+mc*y;};var py=function py(x,y){return mb*x+md*y;};var addp=function addp(x,y){return add$1(px(x,y),py(x,y));};var addpL=function addpL(x,y){return addL(px(x,y),py(x,y));};function boundContext(_,deg){bounds=_;if(deg){rot=deg*DegToRad;ma=md=Math.cos(rot);mb=Math.sin(rot);mc=-mb;}else{ma=md=1;rot=mb=mc=0;}return context$1;}var context$1={beginPath:function beginPath(){},closePath:function closePath(){},moveTo:addpL,lineTo:addpL,rect:function rect(x,y,w,h){if(rot){addp(x+w,y);addp(x+w,y+h);addp(x,y+h);addpL(x,y);}else{add$1(x+w,y+h);addL(x,y);}},quadraticCurveTo:function quadraticCurveTo(x1,y1,x2,y2){var px1=px(x1,y1),py1=py(x1,y1),px2=px(x2,y2),py2=py(x2,y2);quadExtrema(lx,px1,px2,addX);quadExtrema(ly,py1,py2,addY);addL(px2,py2);},bezierCurveTo:function bezierCurveTo(x1,y1,x2,y2,x3,y3){var px1=px(x1,y1),py1=py(x1,y1),px2=px(x2,y2),py2=py(x2,y2),px3=px(x3,y3),py3=py(x3,y3);cubicExtrema(lx,px1,px2,px3,addX);cubicExtrema(ly,py1,py2,py3,addY);addL(px3,py3);},arc:function arc(cx,cy,r,sa,ea,ccw){sa+=rot;ea+=rot;// store last point on path +lx=r*Math.cos(ea)+cx;ly=r*Math.sin(ea)+cy;if(Math.abs(ea-sa)>circleThreshold){// treat as full circle +add$1(cx-r,cy-r);add$1(cx+r,cy+r);}else{var _update=function _update(a){return add$1(r*Math.cos(a)+cx,r*Math.sin(a)+cy);};var s,i;// sample end points +_update(sa);_update(ea);// sample interior points aligned with 90 degrees +if(ea!==sa){sa=sa%Tau;if(sa<0)sa+=Tau;ea=ea%Tau;if(ea<0)ea+=Tau;if(ea<sa){ccw=!ccw;// flip direction +s=sa;sa=ea;ea=s;// swap end-points +}if(ccw){ea-=Tau;s=sa-sa%HalfPi;for(i=0;i<4&&s>ea;++i,s-=HalfPi)_update(s);}else{s=sa-sa%HalfPi+HalfPi;for(i=0;i<4&&s<ea;++i,s=s+HalfPi)_update(s);}}}}};function quadExtrema(x0,x1,x2,cb){var t=(x0-x1)/(x0+x2-2*x1);if(0<t&&t<1)cb(x0+(x1-x0)*t);}function cubicExtrema(x0,x1,x2,x3,cb){var a=x3-x0+3*x1-3*x2,b=x0+x2-2*x1,c=x0-x1;var t0=0,t1=0,r;// solve for parameter t +if(Math.abs(a)>Epsilon){// quadratic equation +r=b*b+c*a;if(r>=0){r=Math.sqrt(r);t0=(-b+r)/a;t1=(-b-r)/a;}}else{// linear equation +t0=0.5*c/b;}// calculate position +if(0<t0&&t0<1)cb(cubic(t0,x0,x1,x2,x3));if(0<t1&&t1<1)cb(cubic(t1,x0,x1,x2,x3));}function cubic(t,x0,x1,x2,x3){var s=1-t,s2=s*s,t2=t*t;return s2*s*x0+3*s2*t*x1+3*s*t2*x2+t2*t*x3;}var context$2=(context$2=domCanvas(1,1))?context$2.getContext('2d'):null;var b=new Bounds();function intersectPath(draw){return function(item,brush){// rely on (inaccurate) bounds intersection if no context +if(!context$2)return true;// add path to offscreen graphics context +draw(context$2,item);// get bounds intersection region +b.clear().union(item.bounds).intersect(brush).round();var x1=b.x1,y1=b.y1,x2=b.x2,y2=b.y2;// iterate over intersection region +// perform fine grained inclusion test +for(var _y5=y1;_y5<=y2;++_y5){for(var _x23=x1;_x23<=x2;++_x23){if(context$2.isPointInPath(_x23,_y5)){return true;}}}// false if no hits in intersection region +return false;};}function intersectPoint(item,box){return box.contains(item.x||0,item.y||0);}function intersectRect(item,box){var x=item.x||0,y=item.y||0,w=item.width||0,h=item.height||0;return box.intersects(b.set(x,y,x+w,y+h));}function intersectRule(item,box){var x=item.x||0,y=item.y||0,x2=item.x2!=null?item.x2:x,y2=item.y2!=null?item.y2:y;return intersectBoxLine(box,x,y,x2,y2);}function intersectBoxLine(box,x,y,u,v){var x1=box.x1,y1=box.y1,x2=box.x2,y2=box.y2,dx=u-x,dy=v-y;var t0=0,t1=1,p,q,r,e;for(e=0;e<4;++e){if(e===0){p=-dx;q=-(x1-x);}if(e===1){p=dx;q=x2-x;}if(e===2){p=-dy;q=-(y1-y);}if(e===3){p=dy;q=y2-y;}if(Math.abs(p)<1e-10&&q<0)return false;r=q/p;if(p<0){if(r>t1)return false;else if(r>t0)t0=r;}else if(p>0){if(r<t0)return false;else if(r<t1)t1=r;}}return true;}function blend(context,item){context.globalCompositeOperation=item.blend||'source-over';}function value$2(value,dflt){return value==null?dflt:value;}function addStops(gradient,stops){var n=stops.length;for(var i=0;i<n;++i){gradient.addColorStop(stops[i].offset,stops[i].color);}return gradient;}function gradient$1(context,spec,bounds){var w=bounds.width(),h=bounds.height();var gradient;if(spec.gradient==='radial'){gradient=context.createRadialGradient(bounds.x1+value$2(spec.x1,0.5)*w,bounds.y1+value$2(spec.y1,0.5)*h,Math.max(w,h)*value$2(spec.r1,0),bounds.x1+value$2(spec.x2,0.5)*w,bounds.y1+value$2(spec.y2,0.5)*h,Math.max(w,h)*value$2(spec.r2,0.5));}else{// linear gradient +var _x24=value$2(spec.x1,0),_y6=value$2(spec.y1,0),x2=value$2(spec.x2,1),y2=value$2(spec.y2,0);if(_x24===x2||_y6===y2||w===h){// axis aligned: use normal gradient +gradient=context.createLinearGradient(bounds.x1+_x24*w,bounds.y1+_y6*h,bounds.x1+x2*w,bounds.y1+y2*h);}else{// not axis aligned: render gradient into a pattern (#2365) +// this allows us to use normalized bounding box coordinates +var _image=domCanvas(Math.ceil(w),Math.ceil(h)),ictx=_image.getContext('2d');ictx.scale(w,h);ictx.fillStyle=addStops(ictx.createLinearGradient(_x24,_y6,x2,y2),spec.stops);ictx.fillRect(0,0,w,h);return context.createPattern(_image,'no-repeat');}}return addStops(gradient,spec.stops);}function color$1(context,item,value){return isGradient(value)?gradient$1(context,value,item.bounds):value;}function fill(context,item,opacity){opacity*=item.fillOpacity==null?1:item.fillOpacity;if(opacity>0){context.globalAlpha=opacity;context.fillStyle=color$1(context,item,item.fill);return true;}else{return false;}}var Empty=[];function stroke(context,item,opacity){var lw=(lw=item.strokeWidth)!=null?lw:1;if(lw<=0)return false;opacity*=item.strokeOpacity==null?1:item.strokeOpacity;if(opacity>0){context.globalAlpha=opacity;context.strokeStyle=color$1(context,item,item.stroke);context.lineWidth=lw;context.lineCap=item.strokeCap||'butt';context.lineJoin=item.strokeJoin||'miter';context.miterLimit=item.strokeMiterLimit||10;if(context.setLineDash){context.setLineDash(item.strokeDash||Empty);context.lineDashOffset=item.strokeDashOffset||0;}return true;}else{return false;}}function compare(a,b){return a.zindex-b.zindex||a.index-b.index;}function zorder(scene){if(!scene.zdirty)return scene.zitems;var items=scene.items,output=[],item,i,n;for(i=0,n=items.length;i<n;++i){item=items[i];item.index=i;if(item.zindex)output.push(item);}scene.zdirty=false;return scene.zitems=output.sort(compare);}function visit(scene,visitor){var items=scene.items,i,n;if(!items||!items.length)return;var zitems=zorder(scene);if(zitems&&zitems.length){for(i=0,n=items.length;i<n;++i){if(!items[i].zindex)visitor(items[i]);}items=zitems;}for(i=0,n=items.length;i<n;++i){visitor(items[i]);}}function pickVisit(scene,visitor){var items=scene.items,hit,i;if(!items||!items.length)return null;var zitems=zorder(scene);if(zitems&&zitems.length)items=zitems;for(i=items.length;--i>=0;){if(hit=visitor(items[i]))return hit;}if(items===zitems){for(items=scene.items,i=items.length;--i>=0;){if(!items[i].zindex){if(hit=visitor(items[i]))return hit;}}}return null;}function drawAll(path){return function(context,scene,bounds){visit(scene,function(item){if(!bounds||bounds.intersects(item.bounds)){drawPath(path,context,item,item);}});};}function drawOne(path){return function(context,scene,bounds){if(scene.items.length&&(!bounds||bounds.intersects(scene.bounds))){drawPath(path,context,scene.items[0],scene.items);}};}function drawPath(path,context,item,items){var opacity=item.opacity==null?1:item.opacity;if(opacity===0)return;if(path(context,items))return;blend(context,item);if(item.fill&&fill(context,item,opacity)){context.fill();}if(item.stroke&&stroke(context,item,opacity)){context.stroke();}}function pick$1(test){test=test||truthy;return function(context,scene,x,y,gx,gy){x*=context.pixelRatio;y*=context.pixelRatio;return pickVisit(scene,function(item){var b=item.bounds;// first hit test against bounding box +if(b&&!b.contains(gx,gy)||!b)return;// if in bounding box, perform more careful test +if(test(context,item,x,y,gx,gy))return item;});};}function hitPath(path,filled){return function(context,o,x,y){var item=Array.isArray(o)?o[0]:o,fill=filled==null?item.fill:filled,stroke=item.stroke&&context.isPointInStroke,lw,lc;if(stroke){lw=item.strokeWidth;lc=item.strokeCap;context.lineWidth=lw!=null?lw:1;context.lineCap=lc!=null?lc:'butt';}return path(context,o)?false:fill&&context.isPointInPath(x,y)||stroke&&context.isPointInStroke(x,y);};}function pickPath(path){return pick$1(hitPath(path));}function translate$1(x,y){return'translate('+x+','+y+')';}function rotate(a){return'rotate('+a+')';}function scale$3(scaleX,scaleY){return'scale('+scaleX+','+scaleY+')';}function translateItem(item){return translate$1(item.x||0,item.y||0);}function rotateItem(item){return translate$1(item.x||0,item.y||0)+(item.angle?' '+rotate(item.angle):'');}function transformItem(item){return translate$1(item.x||0,item.y||0)+(item.angle?' '+rotate(item.angle):'')+(item.scaleX||item.scaleY?' '+scale$3(item.scaleX||1,item.scaleY||1):'');}function markItemPath(type,shape,isect){function attr(emit,item){emit('transform',rotateItem(item));emit('d',shape(null,item));}function bound(bounds,item){shape(boundContext(bounds,item.angle),item);return boundStroke(bounds,item).translate(item.x||0,item.y||0);}function draw(context,item){var x=item.x||0,y=item.y||0,a=item.angle||0;context.translate(x,y);if(a)context.rotate(a*=DegToRad);context.beginPath();shape(context,item);if(a)context.rotate(-a);context.translate(-x,-y);}return{type:type,tag:'path',nested:false,attr:attr,bound:bound,draw:drawAll(draw),pick:pickPath(draw),isect:isect||intersectPath(draw)};}var arc$2=markItemPath('arc',arc$1);function pickArea(a,p){var v=a[0].orient==='horizontal'?p[1]:p[0],z=a[0].orient==='horizontal'?'y':'x',i=a.length,min=+Infinity,hit,d;while(--i>=0){if(a[i].defined===false)continue;d=Math.abs(a[i][z]-v);if(d<min){min=d;hit=a[i];}}return hit;}function pickLine(a,p){var t=Math.pow(a[0].strokeWidth||1,2),i=a.length,dx,dy,dd;while(--i>=0){if(a[i].defined===false)continue;dx=a[i].x-p[0];dy=a[i].y-p[1];dd=dx*dx+dy*dy;if(dd<t)return a[i];}return null;}function pickTrail(a,p){var i=a.length,dx,dy,dd;while(--i>=0){if(a[i].defined===false)continue;dx=a[i].x-p[0];dy=a[i].y-p[1];dd=dx*dx+dy*dy;dx=a[i].size||1;if(dd<dx*dx)return a[i];}return null;}function markMultiItemPath(type,shape,tip){function attr(emit,item){var items=item.mark.items;if(items.length)emit('d',shape(null,items));}function bound(bounds,mark){var items=mark.items;if(items.length===0){return bounds;}else{shape(boundContext(bounds),items);return boundStroke(bounds,items[0]);}}function draw(context,items){context.beginPath();shape(context,items);}var hit=hitPath(draw);function pick(context,scene,x,y,gx,gy){var items=scene.items,b=scene.bounds;if(!items||!items.length||b&&!b.contains(gx,gy)){return null;}x*=context.pixelRatio;y*=context.pixelRatio;return hit(context,items,x,y)?items[0]:null;}return{type:type,tag:'path',nested:true,attr:attr,bound:bound,draw:drawOne(draw),pick:pick,isect:intersectPoint,tip:tip};}var area$2=markMultiItemPath('area',area$1,pickArea);function clip$2(context,scene){var clip=scene.clip;context.save();if(isFunction(clip)){context.beginPath();clip(context);context.clip();}else{clipGroup(context,scene.group);}}function clipGroup(context,group){context.beginPath();hasCornerRadius(group)?rectangle(context,group,0,0):context.rect(0,0,group.width||0,group.height||0);context.clip();}function offset$1(item){var sw=value$2(item.strokeWidth,1);return item.strokeOffset!=null?item.strokeOffset:item.stroke&&sw>0.5&&sw<1.5?0.5-Math.abs(sw-1):0;}function attr$5(emit,item){emit('transform',translateItem(item));}function emitRectangle(emit,item){var off=offset$1(item);emit('d',rectangle(null,item,off,off));}function background$1(emit,item){emit('class','background');emit('aria-hidden',true);emitRectangle(emit,item);}function foreground(emit,item){emit('class','foreground');emit('aria-hidden',true);if(item.strokeForeground){emitRectangle(emit,item);}else{emit('d','');}}function content(emit,item,renderer){var url=item.clip?clip$1$1(renderer,item,item):null;emit('clip-path',url);}function bound$5(bounds,group){if(!group.clip&&group.items){var items=group.items,_m3=items.length;for(var j=0;j<_m3;++j){bounds.union(items[j].bounds);}}if((group.clip||group.width||group.height)&&!group.noBound){bounds.add(0,0).add(group.width||0,group.height||0);}boundStroke(bounds,group);return bounds.translate(group.x||0,group.y||0);}function rectanglePath(context,group,x,y){var off=offset$1(group);context.beginPath();rectangle(context,group,(x||0)+off,(y||0)+off);}var hitBackground=hitPath(rectanglePath);var hitForeground=hitPath(rectanglePath,false);var hitCorner=hitPath(rectanglePath,true);function draw$4(context,scene,bounds,markTypes){var _this12=this;visit(scene,function(group){var gx=group.x||0,gy=group.y||0,fore=group.strokeForeground,opacity=group.opacity==null?1:group.opacity;// draw group background +if((group.stroke||group.fill)&&opacity){rectanglePath(context,group,gx,gy);blend(context,group);if(group.fill&&fill(context,group,opacity)){context.fill();}if(group.stroke&&!fore&&stroke(context,group,opacity)){context.stroke();}}// setup graphics context, set clip and bounds +context.save();context.translate(gx,gy);if(group.clip)clipGroup(context,group);if(bounds)bounds.translate(-gx,-gy);// draw group contents +visit(group,function(item){if(item.marktype==='group'||markTypes==null||markTypes.includes(item.marktype)){_this12.draw(context,item,bounds,markTypes);}});// restore graphics context +if(bounds)bounds.translate(gx,gy);context.restore();// draw group foreground +if(fore&&group.stroke&&opacity){rectanglePath(context,group,gx,gy);blend(context,group);if(stroke(context,group,opacity)){context.stroke();}}});}function pick(context,scene,x,y,gx,gy){var _this13=this;if(scene.bounds&&!scene.bounds.contains(gx,gy)||!scene.items){return null;}var cx=x*context.pixelRatio,cy=y*context.pixelRatio;return pickVisit(scene,function(group){var hit,dx,dy;// first hit test bounding box +var b=group.bounds;if(b&&!b.contains(gx,gy))return;// passed bounds check, test rectangular clip +dx=group.x||0;dy=group.y||0;var dw=dx+(group.width||0),dh=dy+(group.height||0),c=group.clip;if(c&&(gx<dx||gx>dw||gy<dy||gy>dh))return;// adjust coordinate system +context.save();context.translate(dx,dy);dx=gx-dx;dy=gy-dy;// test background for rounded corner clip +if(c&&hasCornerRadius(group)&&!hitCorner(context,group,cx,cy)){context.restore();return null;}var fore=group.strokeForeground,ix=scene.interactive!==false;// hit test against group foreground +if(ix&&fore&&group.stroke&&hitForeground(context,group,cx,cy)){context.restore();return group;}// hit test against contained marks +hit=pickVisit(group,function(mark){return pickMark(mark,dx,dy)?_this13.pick(mark,x,y,dx,dy):null;});// hit test against group background +if(!hit&&ix&&(group.fill||!fore&&group.stroke)&&hitBackground(context,group,cx,cy)){hit=group;}// restore state and return +context.restore();return hit||null;});}function pickMark(mark,x,y){return(mark.interactive!==false||mark.marktype==='group')&&mark.bounds&&mark.bounds.contains(x,y);}var group={type:'group',tag:'g',nested:false,attr:attr$5,bound:bound$5,draw:draw$4,pick:pick,isect:intersectRect,content:content,background:background$1,foreground:foreground};var metadata={'xmlns':'http://www.w3.org/2000/svg','xmlns:xlink':'http://www.w3.org/1999/xlink','version':'1.1'};function getImage(item,renderer){var image=item.image;if(!image||item.url&&item.url!==image.url){image={complete:false,width:0,height:0};renderer.loadImage(item.url).then(function(image){item.image=image;item.image.url=item.url;});}return image;}function imageWidth(item,image){return item.width!=null?item.width:!image||!image.width?0:item.aspect!==false&&item.height?item.height*image.width/image.height:image.width;}function imageHeight(item,image){return item.height!=null?item.height:!image||!image.height?0:item.aspect!==false&&item.width?item.width*image.height/image.width:image.height;}function imageXOffset(align,w){return align==='center'?w/2:align==='right'?w:0;}function imageYOffset(baseline,h){return baseline==='middle'?h/2:baseline==='bottom'?h:0;}function attr$4(emit,item,renderer){var img=getImage(item,renderer),w=imageWidth(item,img),h=imageHeight(item,img),x=(item.x||0)-imageXOffset(item.align,w),y=(item.y||0)-imageYOffset(item.baseline,h),i=!img.src&&img.toDataURL?img.toDataURL():img.src||'';emit('href',i,metadata['xmlns:xlink'],'xlink:href');emit('transform',translate$1(x,y));emit('width',w);emit('height',h);emit('preserveAspectRatio',item.aspect===false?'none':'xMidYMid');}function bound$4(bounds,item){var img=item.image,w=imageWidth(item,img),h=imageHeight(item,img),x=(item.x||0)-imageXOffset(item.align,w),y=(item.y||0)-imageYOffset(item.baseline,h);return bounds.set(x,y,x+w,y+h);}function draw$3(context,scene,bounds){var _this14=this;visit(scene,function(item){if(bounds&&!bounds.intersects(item.bounds))return;// bounds check +var img=getImage(item,_this14);var w=imageWidth(item,img);var h=imageHeight(item,img);if(w===0||h===0)return;// early exit +var x=(item.x||0)-imageXOffset(item.align,w),y=(item.y||0)-imageYOffset(item.baseline,h),opacity,ar0,ar1,t;if(item.aspect!==false){ar0=img.width/img.height;ar1=item.width/item.height;if(ar0===ar0&&ar1===ar1&&ar0!==ar1){if(ar1<ar0){t=w/ar0;y+=(h-t)/2;h=t;}else{t=h*ar0;x+=(w-t)/2;w=t;}}}if(img.complete||img.toDataURL){blend(context,item);context.globalAlpha=(opacity=item.opacity)!=null?opacity:1;context.imageSmoothingEnabled=item.smooth!==false;context.drawImage(img,x,y,w,h);}});}var image={type:'image',tag:'image',nested:false,attr:attr$4,bound:bound$4,draw:draw$3,pick:pick$1(),isect:truthy,// bounds check is sufficient +get:getImage,xOffset:imageXOffset,yOffset:imageYOffset};var line$2=markMultiItemPath('line',line$1,pickLine);function attr$3(emit,item){var sx=item.scaleX||1,sy=item.scaleY||1;if(sx!==1||sy!==1){emit('vector-effect','non-scaling-stroke');}emit('transform',transformItem(item));emit('d',item.path);}function path$1(context,item){var path=item.path;if(path==null)return true;var x=item.x||0,y=item.y||0,sx=item.scaleX||1,sy=item.scaleY||1,a=(item.angle||0)*DegToRad,cache=item.pathCache;if(!cache||cache.path!==path){(item.pathCache=cache=parse$3(path)).path=path;}if(a&&context.rotate&&context.translate){context.translate(x,y);context.rotate(a);pathRender(context,cache,0,0,sx,sy);context.rotate(-a);context.translate(-x,-y);}else{pathRender(context,cache,x,y,sx,sy);}}function bound$3(bounds,item){return path$1(boundContext(bounds,item.angle),item)?bounds.set(0,0,0,0):boundStroke(bounds,item,true);}var path$2={type:'path',tag:'path',nested:false,attr:attr$3,bound:bound$3,draw:drawAll(path$1),pick:pickPath(path$1),isect:intersectPath(path$1)};function attr$2(emit,item){emit('d',rectangle(null,item));}function bound$2(bounds,item){var x,y;return boundStroke(bounds.set(x=item.x||0,y=item.y||0,x+item.width||0,y+item.height||0),item);}function draw$2(context,item){context.beginPath();rectangle(context,item);}var rect={type:'rect',tag:'path',nested:false,attr:attr$2,bound:bound$2,draw:drawAll(draw$2),pick:pickPath(draw$2),isect:intersectRect};function attr$1(emit,item){emit('transform',translateItem(item));emit('x2',item.x2!=null?item.x2-(item.x||0):0);emit('y2',item.y2!=null?item.y2-(item.y||0):0);}function bound$1(bounds,item){var x1,y1;return boundStroke(bounds.set(x1=item.x||0,y1=item.y||0,item.x2!=null?item.x2:x1,item.y2!=null?item.y2:y1),item);}function path(context,item,opacity){var x1,y1,x2,y2;if(item.stroke&&stroke(context,item,opacity)){x1=item.x||0;y1=item.y||0;x2=item.x2!=null?item.x2:x1;y2=item.y2!=null?item.y2:y1;context.beginPath();context.moveTo(x1,y1);context.lineTo(x2,y2);return true;}return false;}function draw$1(context,scene,bounds){visit(scene,function(item){if(bounds&&!bounds.intersects(item.bounds))return;// bounds check +var opacity=item.opacity==null?1:item.opacity;if(opacity&&path(context,item,opacity)){blend(context,item);context.stroke();}});}function hit$1(context,item,x,y){if(!context.isPointInStroke)return false;return path(context,item,1)&&context.isPointInStroke(x,y);}var rule$1={type:'rule',tag:'line',nested:false,attr:attr$1,bound:bound$1,draw:draw$1,pick:pick$1(hit$1),isect:intersectRule};var shape=markItemPath('shape',shape$1);var symbol=markItemPath('symbol',symbol$1,intersectPoint);// memoize text width measurement +var widthCache=lruCache();var textMetrics={height:fontSize,measureWidth:measureWidth,estimateWidth:estimateWidth,width:estimateWidth,canvas:useCanvas};useCanvas(true);function useCanvas(use){textMetrics.width=use&&context$2?measureWidth:estimateWidth;}// make simple estimate if no canvas is available +function estimateWidth(item,text){return _estimateWidth(textValue(item,text),fontSize(item));}function _estimateWidth(text,currentFontHeight){return~~(0.8*text.length*currentFontHeight);}// measure text width if canvas is available +function measureWidth(item,text){return fontSize(item)<=0||!(text=textValue(item,text))?0:_measureWidth(text,font(item));}function _measureWidth(text,currentFont){var key="(".concat(currentFont,") ").concat(text);var width=widthCache.get(key);if(width===undefined){context$2.font=currentFont;width=context$2.measureText(text).width;widthCache.set(key,width);}return width;}function fontSize(item){return item.fontSize!=null?+item.fontSize||0:11;}function lineHeight(item){return item.lineHeight!=null?item.lineHeight:fontSize(item)+2;}function lineArray(_){return isArray(_)?_.length>1?_:_[0]:_;}function textLines(item){return lineArray(item.lineBreak&&item.text&&!isArray(item.text)?item.text.split(item.lineBreak):item.text);}function multiLineOffset(item){var tl=textLines(item);return(isArray(tl)?tl.length-1:0)*lineHeight(item);}function textValue(item,line){var text=line==null?'':(line+'').trim();return item.limit>0&&text.length?truncate(item,text):text;}function widthGetter(item){if(textMetrics.width===measureWidth){// we are using canvas +var currentFont=font(item);return function(text){return _measureWidth(text,currentFont);};}else if(textMetrics.width===estimateWidth){// we are relying on estimates +var currentFontHeight=fontSize(item);return function(text){return _estimateWidth(text,currentFontHeight);};}else{// User defined textMetrics.width function in use (e.g. vl-convert) +return function(text){return textMetrics.width(item,text);};}}function truncate(item,text){var limit=+item.limit,width=widthGetter(item);if(width(text)<limit)return text;var ellipsis=item.ellipsis||"\u2026",rtl=item.dir==='rtl',lo=0,hi=text.length,mid;limit-=width(ellipsis);if(rtl){while(lo<hi){mid=lo+hi>>>1;if(width(text.slice(mid))>limit)lo=mid+1;else hi=mid;}return ellipsis+text.slice(lo);}else{while(lo<hi){mid=1+(lo+hi>>>1);if(width(text.slice(0,mid))<limit)lo=mid;else hi=mid-1;}return text.slice(0,lo)+ellipsis;}}function fontFamily(item,quote){var font=item.font;return(quote&&font?String(font).replace(/"/g,'\''):font)||'sans-serif';}function font(item,quote){return''+(item.fontStyle?item.fontStyle+' ':'')+(item.fontVariant?item.fontVariant+' ':'')+(item.fontWeight?item.fontWeight+' ':'')+fontSize(item)+'px '+fontFamily(item,quote);}function offset$2(item){// perform our own font baseline calculation +// why? not all browsers support SVG 1.1 'alignment-baseline' :( +// this also ensures consistent layout across renderers +var baseline=item.baseline,h=fontSize(item);return Math.round(baseline==='top'?0.79*h:baseline==='middle'?0.30*h:baseline==='bottom'?-0.21*h:baseline==='line-top'?0.29*h+0.5*lineHeight(item):baseline==='line-bottom'?0.29*h-0.5*lineHeight(item):0);}var textAlign={'left':'start','center':'middle','right':'end'};var tempBounds$1=new Bounds();function anchorPoint(item){var x=item.x||0,y=item.y||0,r=item.radius||0,t;if(r){t=(item.theta||0)-HalfPi;x+=r*Math.cos(t);y+=r*Math.sin(t);}tempBounds$1.x1=x;tempBounds$1.y1=y;return tempBounds$1;}function attr(emit,item){var dx=item.dx||0,dy=(item.dy||0)+offset$2(item),p=anchorPoint(item),x=p.x1,y=p.y1,a=item.angle||0,t;emit('text-anchor',textAlign[item.align]||'start');if(a){t=translate$1(x,y)+' '+rotate(a);if(dx||dy)t+=' '+translate$1(dx,dy);}else{t=translate$1(x+dx,y+dy);}emit('transform',t);}function bound(bounds,item,mode){var h=textMetrics.height(item),a=item.align,p=anchorPoint(item),x=p.x1,y=p.y1,dx=item.dx||0,dy=(item.dy||0)+offset$2(item)-Math.round(0.8*h),// use 4/5 offset +tl=textLines(item),w;// get dimensions +if(isArray(tl)){// multi-line text +h+=lineHeight(item)*(tl.length-1);w=tl.reduce(function(w,t){return Math.max(w,textMetrics.width(item,t));},0);}else{// single-line text +w=textMetrics.width(item,tl);}// horizontal alignment +if(a==='center'){dx-=w/2;}else if(a==='right'){dx-=w;}else;bounds.set(dx+=x,dy+=y,dx+w,dy+h);if(item.angle&&!mode){bounds.rotate(item.angle*DegToRad,x,y);}else if(mode===2){return bounds.rotatedPoints(item.angle*DegToRad,x,y);}return bounds;}function draw$5(context,scene,bounds){visit(scene,function(item){var opacity=item.opacity==null?1:item.opacity,p,x,y,i,lh,tl,str;if(bounds&&!bounds.intersects(item.bounds)||// bounds check +opacity===0||item.fontSize<=0||item.text==null||item.text.length===0)return;context.font=font(item);context.textAlign=item.align||'left';p=anchorPoint(item);x=p.x1,y=p.y1;if(item.angle){context.save();context.translate(x,y);context.rotate(item.angle*DegToRad);x=y=0;// reset x, y +}x+=item.dx||0;y+=(item.dy||0)+offset$2(item);tl=textLines(item);blend(context,item);if(isArray(tl)){lh=lineHeight(item);for(i=0;i<tl.length;++i){str=textValue(item,tl[i]);if(item.fill&&fill(context,item,opacity)){context.fillText(str,x,y);}if(item.stroke&&stroke(context,item,opacity)){context.strokeText(str,x,y);}y+=lh;}}else{str=textValue(item,tl);if(item.fill&&fill(context,item,opacity)){context.fillText(str,x,y);}if(item.stroke&&stroke(context,item,opacity)){context.strokeText(str,x,y);}}if(item.angle)context.restore();});}function hit(context,item,x,y,gx,gy){if(item.fontSize<=0)return false;if(!item.angle)return true;// bounds sufficient if no rotation +// project point into space of unrotated bounds +var p=anchorPoint(item),ax=p.x1,ay=p.y1,b=bound(tempBounds$1,item,1),a=-item.angle*DegToRad,cos=Math.cos(a),sin=Math.sin(a),px=cos*gx-sin*gy+(ax-cos*ax+sin*ay),py=sin*gx+cos*gy+(ay-sin*ax-cos*ay);return b.contains(px,py);}function intersectText(item,box){var p=bound(tempBounds$1,item,2);return intersectBoxLine(box,p[0],p[1],p[2],p[3])||intersectBoxLine(box,p[0],p[1],p[4],p[5])||intersectBoxLine(box,p[4],p[5],p[6],p[7])||intersectBoxLine(box,p[2],p[3],p[6],p[7]);}var text={type:'text',tag:'text',nested:false,attr:attr,bound:bound,draw:draw$5,pick:pick$1(hit),isect:intersectText};var trail=markMultiItemPath('trail',trail$1,pickTrail);var Marks={arc:arc$2,area:area$2,group:group,image:image,line:line$2,path:path$2,rect:rect,rule:rule$1,shape:shape,symbol:symbol,text:text,trail:trail};function boundItem$1(item,func,opt){var type=Marks[item.mark.marktype],bound=func||type.bound;if(type.nested)item=item.mark;return bound(item.bounds||(item.bounds=new Bounds()),item,opt);}var DUMMY={mark:null};function boundMark(mark,bounds,opt){var type=Marks[mark.marktype],bound=type.bound,items=mark.items,hasItems=items&&items.length,i,n,item,b;if(type.nested){if(hasItems){item=items[0];}else{// no items, fake it +DUMMY.mark=mark;item=DUMMY;}b=boundItem$1(item,bound,opt);bounds=bounds&&bounds.union(b)||b;return bounds;}bounds=bounds||mark.bounds&&mark.bounds.clear()||new Bounds();if(hasItems){for(i=0,n=items.length;i<n;++i){bounds.union(boundItem$1(items[i],bound,opt));}}return mark.bounds=bounds;}var keys$1=['marktype','name','role','interactive','clip','items','zindex','x','y','width','height','align','baseline',// layout +'fill','fillOpacity','opacity','blend',// fill +'stroke','strokeOpacity','strokeWidth','strokeCap',// stroke +'strokeDash','strokeDashOffset',// stroke dash +'strokeForeground','strokeOffset',// group +'startAngle','endAngle','innerRadius','outerRadius',// arc +'cornerRadius','padAngle',// arc, rect +'cornerRadiusTopLeft','cornerRadiusTopRight',// rect, group +'cornerRadiusBottomLeft','cornerRadiusBottomRight','interpolate','tension','orient','defined',// area, line +'url','aspect','smooth',// image +'path','scaleX','scaleY',// path +'x2','y2',// rule +'size','shape',// symbol +'text','angle','theta','radius','dir','dx','dy',// text +'ellipsis','limit','lineBreak','lineHeight','font','fontSize','fontWeight','fontStyle','fontVariant',// font +'description','aria','ariaRole','ariaRoleDescription'// aria +];function sceneToJSON(scene,indent){return JSON.stringify(scene,keys$1,indent);}function sceneFromJSON(json){var scene=typeof json==='string'?JSON.parse(json):json;return initialize$1(scene);}function initialize$1(scene){var type=scene.marktype,items=scene.items,parent,i,n;if(items){for(i=0,n=items.length;i<n;++i){parent=type?'mark':'group';items[i][parent]=scene;if(items[i].zindex)items[i][parent].zdirty=true;if('group'===(type||parent))initialize$1(items[i]);}}if(type)boundMark(scene);return scene;}var Scenegraph=/*#__PURE__*/function(){function Scenegraph(scene){_classCallCheck(this,Scenegraph);if(arguments.length){this.root=sceneFromJSON(scene);}else{this.root=createMark({marktype:'group',name:'root',role:'frame'});this.root.items=[new GroupItem(this.root)];}}return _createClass(Scenegraph,[{key:"toJSON",value:function toJSON(indent){return sceneToJSON(this.root,indent||0);}},{key:"mark",value:function mark(markdef,group,index){group=group||this.root.items[0];var mark=createMark(markdef,group);group.items[index]=mark;if(mark.zindex)mark.group.zdirty=true;return mark;}}]);}();function createMark(def,group){var mark={bounds:new Bounds(),clip:!!def.clip,group:group,interactive:def.interactive===false?false:true,items:[],marktype:def.marktype,name:def.name||undefined,role:def.role||undefined,zindex:def.zindex||0};// add accessibility properties if defined +if(def.aria!=null){mark.aria=def.aria;}if(def.description){mark.description=def.description;}return mark;}// create a new DOM element +function domCreate(doc,tag,ns){if(!doc&&typeof document!=='undefined'&&document.createElement){doc=document;}return doc?ns?doc.createElementNS(ns,tag):doc.createElement(tag):null;}// find first child element with matching tag +function domFind(el,tag){tag=tag.toLowerCase();var nodes=el.childNodes,i=0,n=nodes.length;for(;i<n;++i)if(nodes[i].tagName.toLowerCase()===tag){return nodes[i];}}// retrieve child element at given index +// create & insert if doesn't exist or if tags do not match +function domChild(el,index,tag,ns){var a=el.childNodes[index],b;if(!a||a.tagName.toLowerCase()!==tag.toLowerCase()){b=a||null;a=domCreate(el.ownerDocument,tag,ns);el.insertBefore(a,b);}return a;}// remove all child elements at or above the given index +function domClear(el,index){var nodes=el.childNodes,curr=nodes.length;while(curr>index)el.removeChild(nodes[--curr]);return el;}// generate css class name for mark +function cssClass(mark){return'mark-'+mark.marktype+(mark.role?' role-'+mark.role:'')+(mark.name?' '+mark.name:'');}function point(event,el){var rect=el.getBoundingClientRect();return[event.clientX-rect.left-(el.clientLeft||0),event.clientY-rect.top-(el.clientTop||0)];}function resolveItem(item,event,el,origin){var mark=item&&item.mark,mdef,p;if(mark&&(mdef=Marks[mark.marktype]).tip){p=point(event,el);p[0]-=origin[0];p[1]-=origin[1];while(item=item.mark.group){p[0]-=item.x||0;p[1]-=item.y||0;}item=mdef.tip(mark.items,p);}return item;}var Handler=/*#__PURE__*/function(){/** + * Create a new Handler instance. + * @param {object} [customLoader] - Optional loader instance for + * href URL sanitization. If not specified, a standard loader + * instance will be generated. + * @param {function} [customTooltip] - Optional tooltip handler + * function for custom tooltip display. + * @constructor + */function Handler(customLoader,customTooltip){_classCallCheck(this,Handler);this._active=null;this._handlers={};this._loader=customLoader||loader();this._tooltip=customTooltip||defaultTooltip$1;}/** + * Initialize a new Handler instance. + * @param {DOMElement} el - The containing DOM element for the display. + * @param {Array<number>} origin - The origin of the display, in pixels. + * The coordinate system will be translated to this point. + * @param {object} [obj] - Optional context object that should serve as + * the "this" context for event callbacks. + * @return {Handler} - This handler instance. + */return _createClass(Handler,[{key:"initialize",value:function initialize(el,origin,obj){this._el=el;this._obj=obj||null;return this.origin(origin);}/** + * Returns the parent container element for a visualization. + * @return {DOMElement} - The containing DOM element. + */},{key:"element",value:function element(){return this._el;}/** + * Returns the scene element (e.g., canvas or SVG) of the visualization + * Subclasses must override if the first child is not the scene element. + * @return {DOMElement} - The scene (e.g., canvas or SVG) element. + */},{key:"canvas",value:function canvas(){return this._el&&this._el.firstChild;}/** + * Get / set the origin coordinates of the visualization. + */},{key:"origin",value:function origin(_origin){if(arguments.length){this._origin=_origin||[0,0];return this;}else{return this._origin.slice();}}/** + * Get / set the scenegraph root. + */},{key:"scene",value:function scene(_scene){if(!arguments.length)return this._scene;this._scene=_scene;return this;}/** + * Add an event handler. Subclasses should override this method. + */},{key:"on",value:function on(/*type, handler*/){}/** + * Remove an event handler. Subclasses should override this method. + */},{key:"off",value:function off(/*type, handler*/){}/** + * Utility method for finding the array index of an event handler. + * @param {Array} h - An array of registered event handlers. + * @param {string} type - The event type. + * @param {function} handler - The event handler instance to find. + * @return {number} - The handler's array index or -1 if not registered. + */},{key:"_handlerIndex",value:function _handlerIndex(h,type,handler){for(var i=h?h.length:0;--i>=0;){if(h[i].type===type&&(!handler||h[i].handler===handler)){return i;}}return-1;}/** + * Returns an array with registered event handlers. + * @param {string} [type] - The event type to query. Any annotations + * are ignored; for example, for the argument "click.foo", ".foo" will + * be ignored and the method returns all "click" handlers. If type is + * null or unspecified, this method returns handlers for all types. + * @return {Array} - A new array containing all registered event handlers. + */},{key:"handlers",value:function handlers(type){var h=this._handlers,a=[];if(type){a.push.apply(a,_toConsumableArray(h[this.eventName(type)]));}else{for(var k in h){a.push.apply(a,_toConsumableArray(h[k]));}}return a;}/** + * Parses an event name string to return the specific event type. + * For example, given "click.foo" returns "click" + * @param {string} name - The input event type string. + * @return {string} - A string with the event type only. + */},{key:"eventName",value:function eventName(name){var i=name.indexOf('.');return i<0?name:name.slice(0,i);}/** + * Handle hyperlink navigation in response to an item.href value. + * @param {Event} event - The event triggering hyperlink navigation. + * @param {Item} item - The scenegraph item. + * @param {string} href - The URL to navigate to. + */},{key:"handleHref",value:function handleHref(event,item,href){this._loader.sanitize(href,{context:'href'}).then(function(opt){var e=new MouseEvent(event.type,event),a=domCreate(null,'a');for(var name in opt)a.setAttribute(name,opt[name]);a.dispatchEvent(e);})["catch"](function(){});}/** + * Handle tooltip display in response to an item.tooltip value. + * @param {Event} event - The event triggering tooltip display. + * @param {Item} item - The scenegraph item. + * @param {boolean} show - A boolean flag indicating whether + * to show or hide a tooltip for the given item. + */},{key:"handleTooltip",value:function handleTooltip(event,item,show){if(item&&item.tooltip!=null){item=resolveItem(item,event,this.canvas(),this._origin);var _value18=show&&item&&item.tooltip||null;this._tooltip.call(this._obj,this,event,item,_value18);}}/** + * Returns the size of a scenegraph item and its position relative + * to the viewport. + * @param {Item} item - The scenegraph item. + * @return {object} - A bounding box object (compatible with the + * DOMRect type) consisting of x, y, width, heigh, top, left, + * right, and bottom properties. + */},{key:"getItemBoundingClientRect",value:function getItemBoundingClientRect(item){var el=this.canvas();if(!el)return;var rect=el.getBoundingClientRect(),origin=this._origin,bounds=item.bounds,width=bounds.width(),height=bounds.height();var x=bounds.x1+origin[0]+rect.left,y=bounds.y1+origin[1]+rect.top;// translate coordinate for each parent group +while(item.mark&&(item=item.mark.group)){x+=item.x||0;y+=item.y||0;}// return DOMRect-compatible bounding box +return{x:x,y:y,width:width,height:height,left:x,top:y,right:x+width,bottom:y+height};}}]);}();// The default tooltip display handler. +// Sets the HTML title attribute on the visualization container. +function defaultTooltip$1(handler,event,item,value){handler.element().setAttribute('title',value||'');}var Renderer=/*#__PURE__*/function(){/** + * Create a new Renderer instance. + * @param {object} [loader] - Optional loader instance for + * image and href URL sanitization. If not specified, a + * standard loader instance will be generated. + * @constructor + */function Renderer(loader){_classCallCheck(this,Renderer);this._el=null;this._bgcolor=null;this._loader=new ResourceLoader(loader);}/** + * Initialize a new Renderer instance. + * @param {DOMElement} el - The containing DOM element for the display. + * @param {number} width - The coordinate width of the display, in pixels. + * @param {number} height - The coordinate height of the display, in pixels. + * @param {Array<number>} origin - The origin of the display, in pixels. + * The coordinate system will be translated to this point. + * @param {number} [scaleFactor=1] - Optional scaleFactor by which to multiply + * the width and height to determine the final pixel size. + * @return {Renderer} - This renderer instance. + */return _createClass(Renderer,[{key:"initialize",value:function initialize(el,width,height,origin,scaleFactor){this._el=el;return this.resize(width,height,origin,scaleFactor);}/** + * Returns the parent container element for a visualization. + * @return {DOMElement} - The containing DOM element. + */},{key:"element",value:function element(){return this._el;}/** + * Returns the scene element (e.g., canvas or SVG) of the visualization + * Subclasses must override if the first child is not the scene element. + * @return {DOMElement} - The scene (e.g., canvas or SVG) element. + */},{key:"canvas",value:function canvas(){return this._el&&this._el.firstChild;}/** + * Get / set the background color. + */},{key:"background",value:function background(bgcolor){if(arguments.length===0)return this._bgcolor;this._bgcolor=bgcolor;return this;}/** + * Resize the display. + * @param {number} width - The new coordinate width of the display, in pixels. + * @param {number} height - The new coordinate height of the display, in pixels. + * @param {Array<number>} origin - The new origin of the display, in pixels. + * The coordinate system will be translated to this point. + * @param {number} [scaleFactor=1] - Optional scaleFactor by which to multiply + * the width and height to determine the final pixel size. + * @return {Renderer} - This renderer instance; + */},{key:"resize",value:function resize(width,height,origin,scaleFactor){this._width=width;this._height=height;this._origin=origin||[0,0];this._scale=scaleFactor||1;return this;}/** + * Report a dirty item whose bounds should be redrawn. + * This base class method does nothing. Subclasses that perform + * incremental should implement this method. + * @param {Item} item - The dirty item whose bounds should be redrawn. + */},{key:"dirty",value:function dirty(/*item*/){}/** + * Render an input scenegraph, potentially with a set of dirty items. + * This method will perform an immediate rendering with available resources. + * The renderer may also need to perform image loading to perform a complete + * render. This process can lead to asynchronous re-rendering of the scene + * after this method returns. To receive notification when rendering is + * complete, use the renderAsync method instead. + * @param {object} scene - The root mark of a scenegraph to render. + * @param {Array} markTypes - Array of the mark types to render. + * If undefined, render all mark types + * @return {Renderer} - This renderer instance. + */},{key:"render",value:function render(scene,markTypes){var r=this;// bind arguments into a render call, and cache it +// this function may be subsequently called for async redraw +r._call=function(){r._render(scene,markTypes);};// invoke the renderer +r._call();// clear the cached call for garbage collection +// async redraws will stash their own copy +r._call=null;return r;}/** + * Internal rendering method. Renderer subclasses should override this + * method to actually perform rendering. + * @param {object} scene - The root mark of a scenegraph to render. + * @param {Array} markTypes - Array of the mark types to render. + * If undefined, render all mark types + */},{key:"_render",value:function _render(/*scene, markTypes*/){// subclasses to override +}/** + * Asynchronous rendering method. Similar to render, but returns a Promise + * that resolves when all rendering is completed. Sometimes a renderer must + * perform image loading to get a complete rendering. The returned + * Promise will not resolve until this process completes. + * @param {object} scene - The root mark of a scenegraph to render. + * @param {Array} markTypes - Array of the mark types to render. + * If undefined, render all mark types + * @return {Promise} - A Promise that resolves when rendering is complete. + */},{key:"renderAsync",value:function renderAsync(scene,markTypes){var r=this.render(scene,markTypes);return this._ready?this._ready.then(function(){return r;}):Promise.resolve(r);}/** + * Internal method for asynchronous resource loading. + * Proxies method calls to the ImageLoader, and tracks loading + * progress to invoke a re-render once complete. + * @param {string} method - The method name to invoke on the ImageLoader. + * @param {string} uri - The URI for the requested resource. + * @return {Promise} - A Promise that resolves to the requested resource. + */},{key:"_load",value:function _load(method,uri){var r=this,p=r._loader[method](uri);if(!r._ready){// re-render the scene when loading completes +var call=r._call;r._ready=r._loader.ready().then(function(redraw){if(redraw)call();r._ready=null;});}return p;}/** + * Sanitize a URL to include as a hyperlink in the rendered scene. + * This method proxies a call to ImageLoader.sanitizeURL, but also tracks + * image loading progress and invokes a re-render once complete. + * @param {string} uri - The URI string to sanitize. + * @return {Promise} - A Promise that resolves to the sanitized URL. + */},{key:"sanitizeURL",value:function sanitizeURL(uri){return this._load('sanitizeURL',uri);}/** + * Requests an image to include in the rendered scene. + * This method proxies a call to ImageLoader.loadImage, but also tracks + * image loading progress and invokes a re-render once complete. + * @param {string} uri - The URI string of the image. + * @return {Promise} - A Promise that resolves to the loaded Image. + */},{key:"loadImage",value:function loadImage(uri){return this._load('loadImage',uri);}}]);}();var KeyDownEvent='keydown';var KeyPressEvent='keypress';var KeyUpEvent='keyup';var DragEnterEvent='dragenter';var DragLeaveEvent='dragleave';var DragOverEvent='dragover';var PointerDownEvent='pointerdown';var PointerUpEvent='pointerup';var PointerMoveEvent='pointermove';var PointerOutEvent='pointerout';var PointerOverEvent='pointerover';var MouseDownEvent='mousedown';var MouseUpEvent='mouseup';var MouseMoveEvent='mousemove';var MouseOutEvent='mouseout';var MouseOverEvent='mouseover';var ClickEvent='click';var DoubleClickEvent='dblclick';var WheelEvent='wheel';var MouseWheelEvent='mousewheel';var TouchStartEvent='touchstart';var TouchMoveEvent='touchmove';var TouchEndEvent='touchend';var Events=[KeyDownEvent,KeyPressEvent,KeyUpEvent,DragEnterEvent,DragLeaveEvent,DragOverEvent,PointerDownEvent,PointerUpEvent,PointerMoveEvent,PointerOutEvent,PointerOverEvent,MouseDownEvent,MouseUpEvent,MouseMoveEvent,MouseOutEvent,MouseOverEvent,ClickEvent,DoubleClickEvent,WheelEvent,MouseWheelEvent,TouchStartEvent,TouchMoveEvent,TouchEndEvent];var TooltipShowEvent=PointerMoveEvent;var TooltipHideEvent=MouseOutEvent;var HrefEvent=ClickEvent;var CanvasHandler=/*#__PURE__*/function(_Handler){function CanvasHandler(loader,tooltip){var _this15;_classCallCheck(this,CanvasHandler);_this15=_callSuper(this,CanvasHandler,[loader,tooltip]);_this15._down=null;_this15._touch=null;_this15._first=true;_this15._events={};// supported events +_this15.events=Events;_this15.pointermove=move([PointerMoveEvent,MouseMoveEvent],[PointerOverEvent,MouseOverEvent],[PointerOutEvent,MouseOutEvent]);_this15.dragover=move([DragOverEvent],[DragEnterEvent],[DragLeaveEvent]),_this15.pointerout=inactive([PointerOutEvent,MouseOutEvent]);_this15.dragleave=inactive([DragLeaveEvent]);return _this15;}_inherits(CanvasHandler,_Handler);return _createClass(CanvasHandler,[{key:"initialize",value:function initialize(el,origin,obj){var _this16=this;this._canvas=el&&domFind(el,'canvas');// add minimal events required for proper state management +[ClickEvent,MouseDownEvent,PointerDownEvent,PointerMoveEvent,PointerOutEvent,DragLeaveEvent].forEach(function(type){return eventListenerCheck(_this16,type);});return _superPropGet(CanvasHandler,"initialize",this,3)([el,origin,obj]);}// return the backing canvas instance +},{key:"canvas",value:function canvas(){return this._canvas;}// retrieve the current canvas context +},{key:"context",value:function context(){return this._canvas.getContext('2d');}// to keep old versions of firefox happy +},{key:"DOMMouseScroll",value:function DOMMouseScroll(evt){this.fire(MouseWheelEvent,evt);}},{key:"pointerdown",value:function pointerdown(evt){this._down=this._active;this.fire(PointerDownEvent,evt);}},{key:"mousedown",value:function mousedown(evt){this._down=this._active;this.fire(MouseDownEvent,evt);}},{key:"click",value:function click(evt){if(this._down===this._active){this.fire(ClickEvent,evt);this._down=null;}}},{key:"touchstart",value:function touchstart(evt){this._touch=this.pickEvent(evt.changedTouches[0]);if(this._first){this._active=this._touch;this._first=false;}this.fire(TouchStartEvent,evt,true);}},{key:"touchmove",value:function touchmove(evt){this.fire(TouchMoveEvent,evt,true);}},{key:"touchend",value:function touchend(evt){this.fire(TouchEndEvent,evt,true);this._touch=null;}// fire an event +},{key:"fire",value:function fire(type,evt,touch){var a=touch?this._touch:this._active,h=this._handlers[type];// set event type relative to scenegraph items +evt.vegaType=type;// handle hyperlinks and tooltips first +if(type===HrefEvent&&a&&a.href){this.handleHref(evt,a,a.href);}else if(type===TooltipShowEvent||type===TooltipHideEvent){this.handleTooltip(evt,a,type!==TooltipHideEvent);}// invoke all registered handlers +if(h){for(var i=0,len=h.length;i<len;++i){h[i].handler.call(this._obj,evt,a);}}}// add an event handler +},{key:"on",value:function on(type,handler){var name=this.eventName(type),h=this._handlers,i=this._handlerIndex(h[name],type,handler);if(i<0){eventListenerCheck(this,type);(h[name]||(h[name]=[])).push({type:type,handler:handler});}return this;}// remove an event handler +},{key:"off",value:function off(type,handler){var name=this.eventName(type),h=this._handlers[name],i=this._handlerIndex(h,type,handler);if(i>=0){h.splice(i,1);}return this;}},{key:"pickEvent",value:function pickEvent(evt){var p=point(evt,this._canvas),o=this._origin;return this.pick(this._scene,p[0],p[1],p[0]-o[0],p[1]-o[1]);}// find the scenegraph item at the current pointer position +// x, y -- the absolute x, y pointer coordinates on the canvas element +// gx, gy -- the relative coordinates within the current group +},{key:"pick",value:function pick(scene,x,y,gx,gy){var g=this.context(),mark=Marks[scene.marktype];return mark.pick.call(this,g,scene,x,y,gx,gy);}}]);}(Handler);var eventBundle=function eventBundle(type){return type===TouchStartEvent||type===TouchMoveEvent||type===TouchEndEvent?[TouchStartEvent,TouchMoveEvent,TouchEndEvent]:[type];};// lazily add listeners to the canvas as needed +function eventListenerCheck(handler,type){eventBundle(type).forEach(function(_){return addEventListener(handler,_);});}function addEventListener(handler,type){var canvas=handler.canvas();if(canvas&&!handler._events[type]){handler._events[type]=1;canvas.addEventListener(type,handler[type]?function(evt){return handler[type](evt);}:function(evt){return handler.fire(type,evt);});}}function fireAll(handler,types,event){types.forEach(function(type){return handler.fire(type,event);});}function move(moveEvents,overEvents,outEvents){return function(evt){var a=this._active,p=this.pickEvent(evt);if(p===a){// active item and picked item are the same +fireAll(this,moveEvents,evt);// fire move +}else{// active item and picked item are different +if(!a||!a.exit){// fire out for prior active item +// suppress if active item was removed from scene +fireAll(this,outEvents,evt);}this._active=p;// set new active item +fireAll(this,overEvents,evt);// fire over for new active item +fireAll(this,moveEvents,evt);// fire move for new active item +}};}function inactive(types){return function(evt){fireAll(this,types,evt);this._active=null;};}function devicePixelRatio(){return typeof window!=='undefined'?window.devicePixelRatio||1:1;}function _resize(canvas,width,height,origin,scaleFactor,opt){var inDOM=typeof HTMLElement!=='undefined'&&canvas instanceof HTMLElement&&canvas.parentNode!=null,context=canvas.getContext('2d'),ratio=inDOM?devicePixelRatio():scaleFactor;canvas.width=width*ratio;canvas.height=height*ratio;for(var _key1 in opt){context[_key1]=opt[_key1];}if(inDOM&&ratio!==1){canvas.style.width=width+'px';canvas.style.height=height+'px';}context.pixelRatio=ratio;context.setTransform(ratio,0,0,ratio,ratio*origin[0],ratio*origin[1]);return canvas;}var CanvasRenderer=/*#__PURE__*/function(_Renderer){function CanvasRenderer(loader){var _this17;_classCallCheck(this,CanvasRenderer);_this17=_callSuper(this,CanvasRenderer,[loader]);_this17._options={};_this17._redraw=false;_this17._dirty=new Bounds();_this17._tempb=new Bounds();return _this17;}_inherits(CanvasRenderer,_Renderer);return _createClass(CanvasRenderer,[{key:"initialize",value:function initialize(el,width,height,origin,scaleFactor,options){this._options=options||{};this._canvas=this._options.externalContext?null:domCanvas(1,1,this._options.type);// instantiate a small canvas +if(el&&this._canvas){domClear(el,0).appendChild(this._canvas);this._canvas.setAttribute('class','marks');}// this method will invoke resize to size the canvas appropriately +return _superPropGet(CanvasRenderer,"initialize",this,3)([el,width,height,origin,scaleFactor]);}},{key:"resize",value:function resize(width,height,origin,scaleFactor){_superPropGet(CanvasRenderer,"resize",this,3)([width,height,origin,scaleFactor]);if(this._canvas){// configure canvas size and transform +_resize(this._canvas,this._width,this._height,this._origin,this._scale,this._options.context);}else{// external context needs to be scaled and positioned to origin +var ctx=this._options.externalContext;if(!ctx)error('CanvasRenderer is missing a valid canvas or context');ctx.scale(this._scale,this._scale);ctx.translate(this._origin[0],this._origin[1]);}this._redraw=true;return this;}},{key:"canvas",value:function canvas(){return this._canvas;}},{key:"context",value:function context(){return this._options.externalContext||(this._canvas?this._canvas.getContext('2d'):null);}},{key:"dirty",value:function dirty(item){var b=this._tempb.clear().union(item.bounds);var g=item.mark.group;while(g){b.translate(g.x||0,g.y||0);g=g.mark.group;}this._dirty.union(b);}},{key:"_render",value:function _render(scene,markTypes){var g=this.context(),o=this._origin,w=this._width,h=this._height,db=this._dirty,vb=viewBounds(o,w,h);// setup +g.save();var b=this._redraw||db.empty()?(this._redraw=false,vb.expand(1)):clipToBounds(g,vb.intersect(db),o);this.clear(-o[0],-o[1],w,h);// render +this.draw(g,scene,b,markTypes);// takedown +g.restore();db.clear();return this;}},{key:"draw",value:function draw(ctx,scene,bounds,markTypes){if(scene.marktype!=='group'&&markTypes!=null&&!markTypes.includes(scene.marktype)){return;}var mark=Marks[scene.marktype];if(scene.clip)clip$2(ctx,scene);mark.draw.call(this,ctx,scene,bounds,markTypes);if(scene.clip)ctx.restore();}},{key:"clear",value:function clear(x,y,w,h){var opt=this._options,g=this.context();if(opt.type!=='pdf'&&!opt.externalContext){// calling clear rect voids vector output in pdf mode +// and could remove external context content (#2615) +g.clearRect(x,y,w,h);}if(this._bgcolor!=null){g.fillStyle=this._bgcolor;g.fillRect(x,y,w,h);}}}]);}(Renderer);var viewBounds=function viewBounds(origin,width,height){return new Bounds().set(0,0,width,height).translate(-origin[0],-origin[1]);};function clipToBounds(g,b,origin){// expand bounds by 1 pixel, then round to pixel boundaries +b.expand(1).round();// align to base pixel grid in case of non-integer scaling (#2425) +if(g.pixelRatio%1){b.scale(g.pixelRatio).round().scale(1/g.pixelRatio);}// to avoid artifacts translate if origin has fractional pixels +b.translate(-(origin[0]%1),-(origin[1]%1));// set clip path +g.beginPath();g.rect(b.x1,b.y1,b.width(),b.height());g.clip();return b;}var SVGHandler=/*#__PURE__*/function(_Handler2){function SVGHandler(loader,tooltip){var _this18;_classCallCheck(this,SVGHandler);_this18=_callSuper(this,SVGHandler,[loader,tooltip]);var h=_this18;h._hrefHandler=listener(h,function(evt,item){if(item&&item.href)h.handleHref(evt,item,item.href);});h._tooltipHandler=listener(h,function(evt,item){h.handleTooltip(evt,item,evt.type!==TooltipHideEvent);});return _this18;}_inherits(SVGHandler,_Handler2);return _createClass(SVGHandler,[{key:"initialize",value:function initialize(el,origin,obj){var svg=this._svg;if(svg){svg.removeEventListener(HrefEvent,this._hrefHandler);svg.removeEventListener(TooltipShowEvent,this._tooltipHandler);svg.removeEventListener(TooltipHideEvent,this._tooltipHandler);}this._svg=svg=el&&domFind(el,'svg');if(svg){svg.addEventListener(HrefEvent,this._hrefHandler);svg.addEventListener(TooltipShowEvent,this._tooltipHandler);svg.addEventListener(TooltipHideEvent,this._tooltipHandler);}return _superPropGet(SVGHandler,"initialize",this,3)([el,origin,obj]);}},{key:"canvas",value:function canvas(){return this._svg;}// add an event handler +},{key:"on",value:function on(type,handler){var name=this.eventName(type),h=this._handlers,i=this._handlerIndex(h[name],type,handler);if(i<0){var _x25={type:type,handler:handler,listener:listener(this,handler)};(h[name]||(h[name]=[])).push(_x25);if(this._svg){this._svg.addEventListener(name,_x25.listener);}}return this;}// remove an event handler +},{key:"off",value:function off(type,handler){var name=this.eventName(type),h=this._handlers[name],i=this._handlerIndex(h,type,handler);if(i>=0){if(this._svg){this._svg.removeEventListener(name,h[i].listener);}h.splice(i,1);}return this;}}]);}(Handler);// wrap an event listener for the SVG DOM +var listener=function listener(context,handler){return function(evt){var item=evt.target.__data__;item=Array.isArray(item)?item[0]:item;evt.vegaType=evt.type;handler.call(context._obj,evt,item);};};var ARIA_HIDDEN='aria-hidden';var ARIA_LABEL='aria-label';var ARIA_ROLE='role';var ARIA_ROLEDESCRIPTION='aria-roledescription';var GRAPHICS_OBJECT='graphics-object';var GRAPHICS_SYMBOL='graphics-symbol';var bundle=function bundle(role,roledesc,label){return _defineProperty(_defineProperty(_defineProperty({},ARIA_ROLE,role),ARIA_ROLEDESCRIPTION,roledesc),ARIA_LABEL,label||undefined);};// these roles are covered by related roles +// we can ignore them, no need to generate attributes +var AriaIgnore=toSet(['axis-domain','axis-grid','axis-label','axis-tick','axis-title','legend-band','legend-entry','legend-gradient','legend-label','legend-title','legend-symbol','title']);// aria attribute generators for guide roles +var AriaGuides={'axis':{desc:'axis',caption:axisCaption},'legend':{desc:'legend',caption:legendCaption},'title-text':{desc:'title',caption:function caption(item){return"Title text '".concat(titleCaption(item),"'");}},'title-subtitle':{desc:'subtitle',caption:function caption(item){return"Subtitle text '".concat(titleCaption(item),"'");}}};// aria properties generated for mark item encoding channels +var AriaEncode={ariaRole:ARIA_ROLE,ariaRoleDescription:ARIA_ROLEDESCRIPTION,description:ARIA_LABEL};function ariaItemAttributes(emit,item){var hide=item.aria===false;emit(ARIA_HIDDEN,hide||undefined);if(hide||item.description==null){for(var prop in AriaEncode){emit(AriaEncode[prop],undefined);}}else{var _type=item.mark.marktype;emit(ARIA_LABEL,item.description);emit(ARIA_ROLE,item.ariaRole||(_type==='group'?GRAPHICS_OBJECT:GRAPHICS_SYMBOL));emit(ARIA_ROLEDESCRIPTION,item.ariaRoleDescription||"".concat(_type," mark"));}}function ariaMarkAttributes(mark){return mark.aria===false?_defineProperty({},ARIA_HIDDEN,true):AriaIgnore[mark.role]?null:AriaGuides[mark.role]?ariaGuide(mark,AriaGuides[mark.role]):ariaMark(mark);}function ariaMark(mark){var type=mark.marktype;var recurse=type==='group'||type==='text'||mark.items.some(function(_){return _.description!=null&&_.aria!==false;});return bundle(recurse?GRAPHICS_OBJECT:GRAPHICS_SYMBOL,"".concat(type," mark container"),mark.description);}function ariaGuide(mark,opt){try{var item=mark.items[0],caption=opt.caption||function(){return'';};return bundle(opt.role||GRAPHICS_SYMBOL,opt.desc,item.description||caption(item));}catch(err){return null;}}function titleCaption(item){return array$5(item.text).join(' ');}function axisCaption(item){var datum=item.datum,orient=item.orient,title=datum.title?extractTitle(item):null,ctx=item.context,scale=ctx.scales[datum.scale].value,locale=ctx.dataflow.locale(),type=scale.type,xy=orient==='left'||orient==='right'?'Y':'X';return"".concat(xy,"-axis")+(title?" titled '".concat(title,"'"):'')+" for a ".concat(isDiscrete(type)?'discrete':type," scale")+" with ".concat(domainCaption(locale,scale,item));}function legendCaption(item){var datum=item.datum,title=datum.title?extractTitle(item):null,type="".concat(datum.type||''," legend").trim(),scales=datum.scales,props=Object.keys(scales),ctx=item.context,scale=ctx.scales[scales[props[0]]].value,locale=ctx.dataflow.locale();return capitalize(type)+(title?" titled '".concat(title,"'"):'')+" for ".concat(channelCaption(props))+" with ".concat(domainCaption(locale,scale,item));}function extractTitle(item){try{return array$5(peek$1(item.items).items[0].text).join(' ');}catch(err){return null;}}function channelCaption(props){props=props.map(function(p){return p+(p==='fill'||p==='stroke'?' color':'');});return props.length<2?props[0]:props.slice(0,-1).join(', ')+' and '+peek$1(props);}function capitalize(s){return s.length?s[0].toUpperCase()+s.slice(1):s;}var innerText=function innerText(val){return(val+'').replace(/&/g,'&').replace(/</g,'<').replace(/>/g,'>');};var attrText=function attrText(val){return innerText(val).replace(/"/g,'"').replace(/\t/g,' ').replace(/\n/g,' ').replace(/\r/g,' ');};function markup(){var buf='',outer='',inner='';var stack=[],clear=function clear(){return outer=inner='';},push=function push(tag){if(outer){buf+="".concat(outer,">").concat(inner);clear();}stack.push(tag);},attr=function attr(name,value){if(value!=null)outer+=" ".concat(name,"=\"").concat(attrText(value),"\"");return m;},m={open:function open(tag){push(tag);outer='<'+tag;for(var _len=arguments.length,attrs=new Array(_len>1?_len-1:0),_key=1;_key<_len;_key++){attrs[_key-1]=arguments[_key];}for(var _i11=0,_attrs=attrs;_i11<_attrs.length;_i11++){var _set2=_attrs[_i11];for(var _key10 in _set2)attr(_key10,_set2[_key10]);}return m;},close:function close(){var tag=stack.pop();if(outer){buf+=outer+(inner?">".concat(inner,"</").concat(tag,">"):'/>');}else{buf+="</".concat(tag,">");}clear();return m;},attr:attr,text:function text(t){return inner+=innerText(t),m;},toString:function toString(){return buf;}};return m;}var serializeXML=function serializeXML(node){return _serialize(markup(),node)+'';};function _serialize(m,node){m.open(node.tagName);if(node.hasAttributes()){var attrs=node.attributes,n=attrs.length;for(var i=0;i<n;++i){m.attr(attrs[i].name,attrs[i].value);}}if(node.hasChildNodes()){var _children=node.childNodes;var _iterator25=_createForOfIteratorHelper(_children),_step25;try{for(_iterator25.s();!(_step25=_iterator25.n()).done;){var child=_step25.value;child.nodeType===3// text node +?m.text(child.nodeValue):_serialize(m,child);}}catch(err){_iterator25.e(err);}finally{_iterator25.f();}}return m.close();}var stylesAttr={fill:'fill',fillOpacity:'fill-opacity',stroke:'stroke',strokeOpacity:'stroke-opacity',strokeWidth:'stroke-width',strokeCap:'stroke-linecap',strokeJoin:'stroke-linejoin',strokeDash:'stroke-dasharray',strokeDashOffset:'stroke-dashoffset',strokeMiterLimit:'stroke-miterlimit',opacity:'opacity'};var stylesCss={blend:'mix-blend-mode'};// ensure miter limit default is consistent with canvas (#2498) +var rootAttributes={'fill':'none','stroke-miterlimit':10};var RootIndex=0,xmlns='http://www.w3.org/2000/xmlns/',svgns=metadata.xmlns;var SVGRenderer=/*#__PURE__*/function(_Renderer2){function SVGRenderer(loader){var _this19;_classCallCheck(this,SVGRenderer);_this19=_callSuper(this,SVGRenderer,[loader]);_this19._dirtyID=0;_this19._dirty=[];_this19._svg=null;_this19._root=null;_this19._defs=null;return _this19;}/** + * Initialize a new SVGRenderer instance. + * @param {DOMElement} el - The containing DOM element for the display. + * @param {number} width - The coordinate width of the display, in pixels. + * @param {number} height - The coordinate height of the display, in pixels. + * @param {Array<number>} origin - The origin of the display, in pixels. + * The coordinate system will be translated to this point. + * @param {number} [scaleFactor=1] - Optional scaleFactor by which to multiply + * the width and height to determine the final pixel size. + * @return {SVGRenderer} - This renderer instance. + */_inherits(SVGRenderer,_Renderer2);return _createClass(SVGRenderer,[{key:"initialize",value:function initialize(el,width,height,origin,scaleFactor){// create the svg definitions cache +this._defs={};this._clearDefs();if(el){this._svg=domChild(el,0,'svg',svgns);this._svg.setAttributeNS(xmlns,'xmlns',svgns);this._svg.setAttributeNS(xmlns,'xmlns:xlink',metadata['xmlns:xlink']);this._svg.setAttribute('version',metadata['version']);this._svg.setAttribute('class','marks');domClear(el,1);// set the svg root group +this._root=domChild(this._svg,RootIndex,'g',svgns);setAttributes(this._root,rootAttributes);// ensure no additional child elements +domClear(this._svg,RootIndex+1);}// set background color if defined +this.background(this._bgcolor);return _superPropGet(SVGRenderer,"initialize",this,3)([el,width,height,origin,scaleFactor]);}/** + * Get / set the background color. + */},{key:"background",value:function background(bgcolor){if(arguments.length&&this._svg){this._svg.style.setProperty('background-color',bgcolor);}return _superPropGet(SVGRenderer,"background",this,3)(arguments);}/** + * Resize the display. + * @param {number} width - The new coordinate width of the display, in pixels. + * @param {number} height - The new coordinate height of the display, in pixels. + * @param {Array<number>} origin - The new origin of the display, in pixels. + * The coordinate system will be translated to this point. + * @param {number} [scaleFactor=1] - Optional scaleFactor by which to multiply + * the width and height to determine the final pixel size. + * @return {SVGRenderer} - This renderer instance; + */},{key:"resize",value:function resize(width,height,origin,scaleFactor){_superPropGet(SVGRenderer,"resize",this,3)([width,height,origin,scaleFactor]);if(this._svg){setAttributes(this._svg,{width:this._width*this._scale,height:this._height*this._scale,viewBox:"0 0 ".concat(this._width," ").concat(this._height)});this._root.setAttribute('transform',"translate(".concat(this._origin,")"));}this._dirty=[];return this;}/** + * Returns the SVG element of the visualization. + * @return {DOMElement} - The SVG element. + */},{key:"canvas",value:function canvas(){return this._svg;}/** + * Returns an SVG text string for the rendered content, + * or null if this renderer is currently headless. + */},{key:"svg",value:function svg(){var svg=this._svg,bg=this._bgcolor;if(!svg)return null;var node;if(bg){svg.removeAttribute('style');node=domChild(svg,RootIndex,'rect',svgns);setAttributes(node,{width:this._width,height:this._height,fill:bg});}var text=serializeXML(svg);if(bg){svg.removeChild(node);this._svg.style.setProperty('background-color',bg);}return text;}/** + * Internal rendering method. + * @param {object} scene - The root mark of a scenegraph to render. + * @param {Array} markTypes - Array of the mark types to render. + * If undefined, render all mark types + */},{key:"_render",value:function _render(scene,markTypes){// perform spot updates and re-render markup +if(this._dirtyCheck()){if(this._dirtyAll)this._clearDefs();this.mark(this._root,scene,undefined,markTypes);domClear(this._root,1);}this.defs();this._dirty=[];++this._dirtyID;return this;}// -- Manage rendering of items marked as dirty -- +/** + * Flag a mark item as dirty. + * @param {Item} item - The mark item. + */},{key:"dirty",value:function dirty(item){if(item.dirty!==this._dirtyID){item.dirty=this._dirtyID;this._dirty.push(item);}}/** + * Check if a mark item is considered dirty. + * @param {Item} item - The mark item. + */},{key:"isDirty",value:function isDirty(item){return this._dirtyAll||!item._svg||!item._svg.ownerSVGElement||item.dirty===this._dirtyID;}/** + * Internal method to check dirty status and, if possible, + * make targetted updates without a full rendering pass. + */},{key:"_dirtyCheck",value:function _dirtyCheck(){this._dirtyAll=true;var items=this._dirty;if(!items.length||!this._dirtyID)return true;var id=++this._dirtyID;var item,mark,type,mdef,i,n,o;for(i=0,n=items.length;i<n;++i){item=items[i];mark=item.mark;if(mark.marktype!==type){// memoize mark instance lookup +type=mark.marktype;mdef=Marks[type];}if(mark.zdirty&&mark.dirty!==id){this._dirtyAll=false;dirtyParents(item,id);mark.items.forEach(function(i){i.dirty=id;});}if(mark.zdirty)continue;// handle in standard drawing pass +if(item.exit){// EXIT +if(mdef.nested&&mark.items.length){// if nested mark with remaining points, update instead +o=mark.items[0];if(o._svg)this._update(mdef,o._svg,o);}else if(item._svg){// otherwise remove from DOM +o=item._svg.parentNode;if(o)o.removeChild(item._svg);}item._svg=null;continue;}item=mdef.nested?mark.items[0]:item;if(item._update===id)continue;// already visited +if(!item._svg||!item._svg.ownerSVGElement){// ENTER +this._dirtyAll=false;dirtyParents(item,id);}else{// IN-PLACE UPDATE +this._update(mdef,item._svg,item);}item._update=id;}return!this._dirtyAll;}// -- Construct & maintain scenegraph to SVG mapping --- +/** + * Render a set of mark items. + * @param {SVGElement} el - The parent element in the SVG tree. + * @param {object} scene - The mark parent to render. + * @param {SVGElement} prev - The previous sibling in the SVG tree. + * @param {Array} markTypes - Array of the mark types to render. + * If undefined, render all mark types + */},{key:"mark",value:function mark(el,scene,prev,markTypes){var _this20=this;if(!this.isDirty(scene)){return scene._svg;}var svg=this._svg,markType=scene.marktype,mdef=Marks[markType],events=scene.interactive===false?'none':null,isGroup=mdef.tag==='g';var parent=bind$1(scene,el,prev,'g',svg);if(markType!=='group'&&markTypes!=null&&!markTypes.includes(markType)){domClear(parent,0);return scene._svg;}parent.setAttribute('class',cssClass(scene));// apply aria attributes to parent container element +var aria=ariaMarkAttributes(scene);for(var _key11 in aria)setAttribute(parent,_key11,aria[_key11]);if(!isGroup){setAttribute(parent,'pointer-events',events);}setAttribute(parent,'clip-path',scene.clip?clip$1$1(this,scene,scene.group):null);var sibling=null,i=0;var process=function process(item){var dirty=_this20.isDirty(item),node=bind$1(item,parent,sibling,mdef.tag,svg);if(dirty){_this20._update(mdef,node,item);if(isGroup)recurse(_this20,node,item,markTypes);}sibling=node;++i;};if(mdef.nested){if(scene.items.length)process(scene.items[0]);}else{visit(scene,process);}domClear(parent,i);return parent;}/** + * Update the attributes of an SVG element for a mark item. + * @param {object} mdef - The mark definition object + * @param {SVGElement} el - The SVG element. + * @param {Item} item - The mark item. + */},{key:"_update",value:function _update(mdef,el,item){// set dom element and values cache +// provides access to emit method +element$1=el;values=el.__values__;// apply aria-specific properties +ariaItemAttributes(emit,item);// apply svg attributes +mdef.attr(emit,item,this);// some marks need special treatment +var extra=mark_extras[mdef.type];if(extra)extra.call(this,mdef,el,item);// apply svg style attributes +// note: element state may have been modified by 'extra' method +if(element$1)this.style(element$1,item);}/** + * Update the presentation attributes of an SVG element for a mark item. + * @param {SVGElement} el - The SVG element. + * @param {Item} item - The mark item. + */},{key:"style",value:function style(el,item){if(item==null)return;for(var prop in stylesAttr){var _value19=prop==='font'?fontFamily(item):item[prop];if(_value19===values[prop])continue;var name=stylesAttr[prop];if(_value19==null){el.removeAttribute(name);}else{if(isGradient(_value19)){_value19=gradientRef(_value19,this._defs.gradient,href());}el.setAttribute(name,_value19+'');}values[prop]=_value19;}for(var _prop in stylesCss){setStyle(el,stylesCss[_prop],item[_prop]);}}/** + * Render SVG defs, as needed. + * Must be called *after* marks have been processed to ensure the + * collected state is current and accurate. + */},{key:"defs",value:function defs(){var svg=this._svg,defs=this._defs;var el=defs.el,index=0;for(var _id in defs.gradient){if(!el)defs.el=el=domChild(svg,RootIndex+1,'defs',svgns);index=updateGradient(el,defs.gradient[_id],index);}for(var _id2 in defs.clipping){if(!el)defs.el=el=domChild(svg,RootIndex+1,'defs',svgns);index=updateClipping(el,defs.clipping[_id2],index);}// clean-up +if(el){index===0?(svg.removeChild(el),defs.el=null):domClear(el,index);}}/** + * Clear defs caches. + */},{key:"_clearDefs",value:function _clearDefs(){var def=this._defs;def.gradient={};def.clipping={};}}]);}(Renderer);// mark ancestor chain with a dirty id +function dirtyParents(item,id){for(;item&&item.dirty!==id;item=item.mark.group){item.dirty=id;if(item.mark&&item.mark.dirty!==id){item.mark.dirty=id;}else return;}}// update gradient definitions +function updateGradient(el,grad,index){var i,n,stop;if(grad.gradient==='radial'){// SVG radial gradients automatically transform to normalized bbox +// coordinates, in a way that is cumbersome to replicate in canvas. +// We wrap the radial gradient in a pattern element, allowing us to +// maintain a circular gradient that matches what canvas provides. +var pt=domChild(el,index++,'pattern',svgns);setAttributes(pt,{id:patternPrefix+grad.id,viewBox:'0,0,1,1',width:'100%',height:'100%',preserveAspectRatio:'xMidYMid slice'});pt=domChild(pt,0,'rect',svgns);setAttributes(pt,{width:1,height:1,fill:"url(".concat(href(),"#").concat(grad.id,")")});el=domChild(el,index++,'radialGradient',svgns);setAttributes(el,{id:grad.id,fx:grad.x1,fy:grad.y1,fr:grad.r1,cx:grad.x2,cy:grad.y2,r:grad.r2});}else{el=domChild(el,index++,'linearGradient',svgns);setAttributes(el,{id:grad.id,x1:grad.x1,x2:grad.x2,y1:grad.y1,y2:grad.y2});}for(i=0,n=grad.stops.length;i<n;++i){stop=domChild(el,i,'stop',svgns);stop.setAttribute('offset',grad.stops[i].offset);stop.setAttribute('stop-color',grad.stops[i].color);}domClear(el,i);return index;}// update clipping path definitions +function updateClipping(el,clip,index){var mask;el=domChild(el,index,'clipPath',svgns);el.setAttribute('id',clip.id);if(clip.path){mask=domChild(el,0,'path',svgns);mask.setAttribute('d',clip.path);}else{mask=domChild(el,0,'rect',svgns);setAttributes(mask,{x:0,y:0,width:clip.width,height:clip.height});}domClear(el,1);return index+1;}// Recursively process group contents. +function recurse(renderer,el,group,markTypes){// child 'g' element is second to last among children (path, g, path) +// other children here are foreground and background path elements +el=el.lastChild.previousSibling;var prev,idx=0;visit(group,function(item){prev=renderer.mark(el,item,prev,markTypes);++idx;});// remove any extraneous DOM elements +domClear(el,1+idx);}// Bind a scenegraph item to an SVG DOM element. +// Create new SVG elements as needed. +function bind$1(item,el,sibling,tag,svg){var node=item._svg,doc;// create a new dom node if needed +if(!node){doc=el.ownerDocument;node=domCreate(doc,tag,svgns);item._svg=node;if(item.mark){node.__data__=item;node.__values__={fill:'default'};// if group, create background, content, and foreground elements +if(tag==='g'){var bg=domCreate(doc,'path',svgns);node.appendChild(bg);bg.__data__=item;var cg=domCreate(doc,'g',svgns);node.appendChild(cg);cg.__data__=item;var fg=domCreate(doc,'path',svgns);node.appendChild(fg);fg.__data__=item;fg.__values__={fill:'default'};}}}// (re-)insert if (a) not contained in SVG or (b) sibling order has changed +if(node.ownerSVGElement!==svg||siblingCheck(node,sibling)){el.insertBefore(node,sibling?sibling.nextSibling:el.firstChild);}return node;}// check if two nodes are ordered siblings +function siblingCheck(node,sibling){return node.parentNode&&node.parentNode.childNodes.length>1&&node.previousSibling!=sibling;// treat null/undefined the same +}// -- Set attributes & styles on SVG elements --- +var element$1=null,// temp var for current SVG element +values=null;// temp var for current values hash +// Extra configuration for certain mark types +var mark_extras={group:function group(mdef,el,item){var fg=element$1=el.childNodes[2];values=fg.__values__;mdef.foreground(emit,item,this);values=el.__values__;// use parent's values hash +element$1=el.childNodes[1];mdef.content(emit,item,this);var bg=element$1=el.childNodes[0];mdef.background(emit,item,this);var value=item.mark.interactive===false?'none':null;if(value!==values.events){setAttribute(fg,'pointer-events',value);setAttribute(bg,'pointer-events',value);values.events=value;}if(item.strokeForeground&&item.stroke){var _fill=item.fill;setAttribute(fg,'display',null);// set style of background +this.style(bg,item);setAttribute(bg,'stroke',null);// set style of foreground +if(_fill)item.fill=null;values=fg.__values__;this.style(fg,item);if(_fill)item.fill=_fill;// leave element null to prevent downstream styling +element$1=null;}else{// ensure foreground is ignored +setAttribute(fg,'display','none');}},image:function image(mdef,el,item){if(item.smooth===false){setStyle(el,'image-rendering','optimizeSpeed');setStyle(el,'image-rendering','pixelated');}else{setStyle(el,'image-rendering',null);}},text:function text(mdef,el,item){var tl=textLines(item);var key,value,doc,lh;if(isArray(tl)){// multi-line text +value=tl.map(function(_){return textValue(item,_);});key=value.join('\n');// content cache key +if(key!==values.text){domClear(el,0);doc=el.ownerDocument;lh=lineHeight(item);value.forEach(function(t,i){var ts=domCreate(doc,'tspan',svgns);ts.__data__=item;// data binding +ts.textContent=t;if(i){ts.setAttribute('x',0);ts.setAttribute('dy',lh);}el.appendChild(ts);});values.text=key;}}else{// single-line text +value=textValue(item,tl);if(value!==values.text){el.textContent=value;values.text=value;}}setAttribute(el,'font-family',fontFamily(item));setAttribute(el,'font-size',fontSize(item)+'px');setAttribute(el,'font-style',item.fontStyle);setAttribute(el,'font-variant',item.fontVariant);setAttribute(el,'font-weight',item.fontWeight);}};function emit(name,value,ns){// early exit if value is unchanged +if(value===values[name])return;// use appropriate method given namespace (ns) +if(ns){setAttributeNS(element$1,name,value,ns);}else{setAttribute(element$1,name,value);}// note current value for future comparison +values[name]=value;}function setStyle(el,name,value){if(value!==values[name]){if(value==null){el.style.removeProperty(name);}else{el.style.setProperty(name,value+'');}values[name]=value;}}function setAttributes(el,attrs){for(var _key12 in attrs){setAttribute(el,_key12,attrs[_key12]);}}function setAttribute(el,name,value){if(value!=null){// if value is provided, update DOM attribute +el.setAttribute(name,value);}else{// else remove DOM attribute +el.removeAttribute(name);}}function setAttributeNS(el,name,value,ns){if(value!=null){// if value is provided, update DOM attribute +el.setAttributeNS(ns,name,value);}else{// else remove DOM attribute +el.removeAttributeNS(ns,name);}}function href(){var loc;return typeof window==='undefined'?'':(loc=window.location).hash?loc.href.slice(0,-loc.hash.length):loc.href;}var SVGStringRenderer=/*#__PURE__*/function(_Renderer3){function SVGStringRenderer(loader){var _this21;_classCallCheck(this,SVGStringRenderer);_this21=_callSuper(this,SVGStringRenderer,[loader]);_this21._text=null;_this21._defs={gradient:{},clipping:{}};return _this21;}/** + * Returns the rendered SVG text string, + * or null if rendering has not yet occurred. + */_inherits(SVGStringRenderer,_Renderer3);return _createClass(SVGStringRenderer,[{key:"svg",value:function svg(){return this._text;}/** + * Internal rendering method. + * @param {object} scene - The root mark of a scenegraph to render. + */},{key:"_render",value:function _render(scene){var m=markup();// svg tag +m.open('svg',extend$1({},metadata,{"class":'marks',width:this._width*this._scale,height:this._height*this._scale,viewBox:"0 0 ".concat(this._width," ").concat(this._height)}));// background, if defined +var bg=this._bgcolor;if(bg&&bg!=='transparent'&&bg!=='none'){m.open('rect',{width:this._width,height:this._height,fill:bg}).close();}// root content group +m.open('g',rootAttributes,{transform:'translate('+this._origin+')'});this.mark(m,scene);m.close();// </g> +// defs +this.defs(m);// get SVG text string +this._text=m.close()+'';return this;}/** + * Render a set of mark items. + * @param {object} m - The markup context. + * @param {object} scene - The mark parent to render. + */},{key:"mark",value:function mark(m,scene){var _this22=this;var mdef=Marks[scene.marktype],tag=mdef.tag,attrList=[ariaItemAttributes,mdef.attr];// render opening group tag +m.open('g',{'class':cssClass(scene),'clip-path':scene.clip?clip$1$1(this,scene,scene.group):null},ariaMarkAttributes(scene),{'pointer-events':tag!=='g'&&scene.interactive===false?'none':null});// render contained elements +var process=function process(item){var href=_this22.href(item);if(href)m.open('a',href);m.open(tag,_this22.attr(scene,item,attrList,tag!=='g'?tag:null));if(tag==='text'){var _tl=textLines(item);if(isArray(_tl)){// multi-line text +var attrs={x:0,dy:lineHeight(item)};for(var i=0;i<_tl.length;++i){m.open('tspan',i?attrs:null).text(textValue(item,_tl[i])).close();}}else{// single-line text +m.text(textValue(item,_tl));}}else if(tag==='g'){var fore=item.strokeForeground,_fill2=item.fill,_stroke=item.stroke;if(fore&&_stroke){item.stroke=null;}m.open('path',_this22.attr(scene,item,mdef.background,'bgrect')).close();// recurse for group content +m.open('g',_this22.attr(scene,item,mdef.content));visit(item,function(scene){return _this22.mark(m,scene);});m.close();if(fore&&_stroke){if(_fill2)item.fill=null;item.stroke=_stroke;m.open('path',_this22.attr(scene,item,mdef.foreground,'bgrect')).close();if(_fill2)item.fill=_fill2;}else{m.open('path',_this22.attr(scene,item,mdef.foreground,'bgfore')).close();}}m.close();// </tag> +if(href)m.close();// </a> +};if(mdef.nested){if(scene.items&&scene.items.length)process(scene.items[0]);}else{visit(scene,process);}// render closing group tag +return m.close();// </g> +}/** + * Get href attributes for a hyperlinked mark item. + * @param {Item} item - The mark item. + */},{key:"href",value:function href(item){var _this23=this;var href=item.href;var attr;if(href){if(attr=this._hrefs&&this._hrefs[href]){return attr;}else{this.sanitizeURL(href).then(function(attr){// rewrite to use xlink namespace +attr['xlink:href']=attr.href;attr.href=null;(_this23._hrefs||(_this23._hrefs={}))[href]=attr;});}}return null;}/** + * Get an object of SVG attributes for a mark item. + * @param {object} scene - The mark parent. + * @param {Item} item - The mark item. + * @param {array|function} attrs - One or more attribute emitters. + * @param {string} tag - The tag being rendered. + */},{key:"attr",value:function attr(scene,item,attrs,tag){var _this24=this;var object={},emit=function emit(name,value,ns,prefixed){object[prefixed||name]=value;};// apply mark specific attributes +if(Array.isArray(attrs)){attrs.forEach(function(fn){return fn(emit,item,_this24);});}else{attrs(emit,item,this);}// apply style attributes +if(tag){style(object,item,scene,tag,this._defs);}return object;}/** + * Render SVG defs, as needed. + * Must be called *after* marks have been processed to ensure the + * collected state is current and accurate. + * @param {object} m - The markup context. + */},{key:"defs",value:function defs(m){var gradient=this._defs.gradient,clipping=this._defs.clipping,count=Object.keys(gradient).length+Object.keys(clipping).length;if(count===0)return;// nothing to do +m.open('defs');for(var _id3 in gradient){var _def=gradient[_id3],stops=_def.stops;if(_def.gradient==='radial'){// SVG radial gradients automatically transform to normalized bbox +// coordinates, in a way that is cumbersome to replicate in canvas. +// We wrap the radial gradient in a pattern element, allowing us to +// maintain a circular gradient that matches what canvas provides. +m.open('pattern',{id:patternPrefix+_id3,viewBox:'0,0,1,1',width:'100%',height:'100%',preserveAspectRatio:'xMidYMid slice'});m.open('rect',{width:'1',height:'1',fill:'url(#'+_id3+')'}).close();m.close();// </pattern> +m.open('radialGradient',{id:_id3,fx:_def.x1,fy:_def.y1,fr:_def.r1,cx:_def.x2,cy:_def.y2,r:_def.r2});}else{m.open('linearGradient',{id:_id3,x1:_def.x1,x2:_def.x2,y1:_def.y1,y2:_def.y2});}for(var i=0;i<stops.length;++i){m.open('stop',{offset:stops[i].offset,'stop-color':stops[i].color}).close();}m.close();}for(var _id4 in clipping){var _def2=clipping[_id4];m.open('clipPath',{id:_id4});if(_def2.path){m.open('path',{d:_def2.path}).close();}else{m.open('rect',{x:0,y:0,width:_def2.width,height:_def2.height}).close();}m.close();}m.close();}}]);}(Renderer);// Helper function for attr for style presentation attributes +function style(s,item,scene,tag,defs){var styleList;if(item==null)return s;if(tag==='bgrect'&&scene.interactive===false){s['pointer-events']='none';}if(tag==='bgfore'){if(scene.interactive===false){s['pointer-events']='none';}s.display='none';if(item.fill!==null)return s;}if(tag==='image'&&item.smooth===false){styleList=['image-rendering: optimizeSpeed;','image-rendering: pixelated;'];}if(tag==='text'){s['font-family']=fontFamily(item);s['font-size']=fontSize(item)+'px';s['font-style']=item.fontStyle;s['font-variant']=item.fontVariant;s['font-weight']=item.fontWeight;}for(var prop in stylesAttr){var _value20=item[prop];var name=stylesAttr[prop];if(_value20==='transparent'&&(name==='fill'||name==='stroke'));else if(_value20!=null){if(isGradient(_value20)){_value20=gradientRef(_value20,defs.gradient,'');}s[name]=_value20;}}for(var _prop2 in stylesCss){var _value21=item[_prop2];if(_value21!=null){styleList=styleList||[];styleList.push("".concat(stylesCss[_prop2],": ").concat(_value21,";"));}}if(styleList){s.style=styleList.join(' ');}return s;}/** + * @typedef {Object} HybridRendererOptions + * + * @property {string[]} [svgMarkTypes=['text']] - An array of SVG mark types to render + * in the SVG layer. All other mark types + * will be rendered in the Canvas layer. + * @property {boolean} [svgOnTop=true] - Flag to determine if SVG should be rendered on top. + * @property {boolean} [debug=false] - Flag to enable or disable debugging mode. When true, + * the top layer will be stacked below the bottom layer + * rather than overlaid on top. + *//** @type {HybridRendererOptions} */var OPTS={svgMarkTypes:['text'],svgOnTop:true,debug:false};/** + * Configure the HybridRenderer + * + * @param {HybridRendererOptions} options - HybridRenderer configuration options. + */function setHybridRendererOptions(options){var _options$svgMarkTypes,_options$svgOnTop,_options$debug;OPTS['svgMarkTypes']=(_options$svgMarkTypes=options.svgMarkTypes)!==null&&_options$svgMarkTypes!==void 0?_options$svgMarkTypes:['text'];OPTS['svgOnTop']=(_options$svgOnTop=options.svgOnTop)!==null&&_options$svgOnTop!==void 0?_options$svgOnTop:true;OPTS['debug']=(_options$debug=options.debug)!==null&&_options$debug!==void 0?_options$debug:false;}var HybridRenderer=/*#__PURE__*/function(_Renderer4){function HybridRenderer(loader){var _this25;_classCallCheck(this,HybridRenderer);_this25=_callSuper(this,HybridRenderer,[loader]);_this25._svgRenderer=new SVGRenderer(loader);_this25._canvasRenderer=new CanvasRenderer(loader);return _this25;}/** + * Initialize a new HybridRenderer instance. + * @param {DOMElement} el - The containing DOM element for the display. + * @param {number} width - The coordinate width of the display, in pixels. + * @param {number} height - The coordinate height of the display, in pixels. + * @param {Array<number>} origin - The origin of the display, in pixels. + * The coordinate system will be translated to this point. + * @param {number} [scaleFactor=1] - Optional scaleFactor by which to multiply + * the width and height to determine the final pixel size. + * @return {HybridRenderer} - This renderer instance. + */_inherits(HybridRenderer,_Renderer4);return _createClass(HybridRenderer,[{key:"initialize",value:function initialize(el,width,height,origin,scaleFactor){this._root_el=domChild(el,0,'div');var bottomEl=domChild(this._root_el,0,'div');var topEl=domChild(this._root_el,1,'div');this._root_el.style.position='relative';// Set position absolute to overlay svg on top of canvas +if(!OPTS.debug){bottomEl.style.height='100%';topEl.style.position='absolute';topEl.style.top='0';topEl.style.left='0';topEl.style.height='100%';topEl.style.width='100%';}this._svgEl=OPTS.svgOnTop?topEl:bottomEl;this._canvasEl=OPTS.svgOnTop?bottomEl:topEl;// pointer-events to none on SVG layer so that canvas gets all events +this._svgEl.style.pointerEvents='none';this._canvasRenderer.initialize(this._canvasEl,width,height,origin,scaleFactor);this._svgRenderer.initialize(this._svgEl,width,height,origin,scaleFactor);return _superPropGet(HybridRenderer,"initialize",this,3)([el,width,height,origin,scaleFactor]);}/** + * Flag a mark item as dirty. + * @param {Item} item - The mark item. + */},{key:"dirty",value:function dirty(item){if(OPTS.svgMarkTypes.includes(item.mark.marktype)){this._svgRenderer.dirty(item);}else{this._canvasRenderer.dirty(item);}return this;}/** + * Internal rendering method. + * @param {object} scene - The root mark of a scenegraph to render. + * @param {Array} markTypes - Array of the mark types to render. + * If undefined, render all mark types + */},{key:"_render",value:function _render(scene,markTypes){var allMarkTypes=markTypes!==null&&markTypes!==void 0?markTypes:['arc','area','image','line','path','rect','rule','shape','symbol','text','trail'];var canvasMarkTypes=allMarkTypes.filter(function(m){return!OPTS.svgMarkTypes.includes(m);});this._svgRenderer.render(scene,OPTS.svgMarkTypes);this._canvasRenderer.render(scene,canvasMarkTypes);}/** + * Resize the display. + * @param {number} width - The new coordinate width of the display, in pixels. + * @param {number} height - The new coordinate height of the display, in pixels. + * @param {Array<number>} origin - The new origin of the display, in pixels. + * The coordinate system will be translated to this point. + * @param {number} [scaleFactor=1] - Optional scaleFactor by which to multiply + * the width and height to determine the final pixel size. + * @return {SVGRenderer} - This renderer instance; + */},{key:"resize",value:function resize(width,height,origin,scaleFactor){_superPropGet(HybridRenderer,"resize",this,3)([width,height,origin,scaleFactor]);this._svgRenderer.resize(width,height,origin,scaleFactor);this._canvasRenderer.resize(width,height,origin,scaleFactor);return this;}},{key:"background",value:function background(bgcolor){// Propagate background color to lower canvas renderer +if(OPTS.svgOnTop){this._canvasRenderer.background(bgcolor);}else{this._svgRenderer.background(bgcolor);}return this;}}]);}(Renderer);var HybridHandler=/*#__PURE__*/function(_CanvasHandler){function HybridHandler(loader,tooltip){_classCallCheck(this,HybridHandler);return _callSuper(this,HybridHandler,[loader,tooltip]);}_inherits(HybridHandler,_CanvasHandler);return _createClass(HybridHandler,[{key:"initialize",value:function initialize(el,origin,obj){var canvas=domChild(domChild(el,0,'div'),OPTS.svgOnTop?0:1,'div');return _superPropGet(HybridHandler,"initialize",this,3)([canvas,origin,obj]);}}]);}(CanvasHandler);var Canvas='canvas';var Hybrid='hybrid';var PNG='png';var SVG='svg';var None$1='none';var RenderType={Canvas:Canvas,PNG:PNG,SVG:SVG,Hybrid:Hybrid,None:None$1};var modules={};modules[Canvas]=modules[PNG]={renderer:CanvasRenderer,headless:CanvasRenderer,handler:CanvasHandler};modules[SVG]={renderer:SVGRenderer,headless:SVGStringRenderer,handler:SVGHandler};modules[Hybrid]={renderer:HybridRenderer,headless:HybridRenderer,handler:HybridHandler};modules[None$1]={};function renderModule(name,_){name=String(name||'').toLowerCase();if(arguments.length>1){modules[name]=_;return this;}else{return modules[name];}}function intersect$2(scene,bounds,filter){var hits=[],// intersection results +box=new Bounds().union(bounds),// defensive copy +type=scene.marktype;return type?intersectMark(scene,box,filter,hits):type==='group'?intersectGroup(scene,box,filter,hits):error('Intersect scene must be mark node or group item.');}function intersectMark(mark,box,filter,hits){if(visitMark(mark,box,filter)){var items=mark.items,_type2=mark.marktype,n=items.length;var i=0;if(_type2==='group'){for(;i<n;++i){intersectGroup(items[i],box,filter,hits);}}else{for(var _test3=Marks[_type2].isect;i<n;++i){var item=items[i];if(intersectItem(item,box,_test3))hits.push(item);}}}return hits;}function visitMark(mark,box,filter){// process if bounds intersect and if +// (1) mark is a group mark (so we must recurse), or +// (2) mark is interactive and passes filter +return mark.bounds&&box.intersects(mark.bounds)&&(mark.marktype==='group'||mark.interactive!==false&&(!filter||filter(mark)));}function intersectGroup(group,box,filter,hits){// test intersect against group +// skip groups by default unless filter says otherwise +if(filter&&filter(group.mark)&&intersectItem(group,box,Marks.group.isect)){hits.push(group);}// recursively test children marks +// translate box to group coordinate space +var marks=group.items,n=marks&&marks.length;if(n){var _x26=group.x||0,_y7=group.y||0;box.translate(-_x26,-_y7);for(var i=0;i<n;++i){intersectMark(marks[i],box,filter,hits);}box.translate(_x26,_y7);}return hits;}function intersectItem(item,box,test){// test bounds enclosure, bounds intersection, then detailed test +var bounds=item.bounds;return box.encloses(bounds)||box.intersects(bounds)&&test(item,box);}var clipBounds=new Bounds();function boundClip(mark){var clip=mark.clip;if(isFunction(clip)){clip(boundContext(clipBounds.clear()));}else if(clip){clipBounds.set(0,0,mark.group.width,mark.group.height);}else return;mark.bounds.intersect(clipBounds);}var TOLERANCE=1e-9;function sceneEqual(a,b,key){return a===b?true:key==='path'?pathEqual(a,b):a instanceof Date&&b instanceof Date?+a===+b:isNumber$1(a)&&isNumber$1(b)?Math.abs(a-b)<=TOLERANCE:!a||!b||!isObject(a)&&!isObject(b)?a==b:objectEqual(a,b);}function pathEqual(a,b){return sceneEqual(parse$3(a),parse$3(b));}function objectEqual(a,b){var ka=Object.keys(a),kb=Object.keys(b),key,i;if(ka.length!==kb.length)return false;ka.sort();kb.sort();for(i=ka.length-1;i>=0;i--){if(ka[i]!=kb[i])return false;}for(i=ka.length-1;i>=0;i--){key=ka[i];if(!sceneEqual(a[key],b[key],key))return false;}return _typeof(a)===_typeof(b);}function resetSVGDefIds(){resetSVGClipId();resetSVGGradientId();}var Top$1='top';var Left$1='left';var Right$1='right';var Bottom$1='bottom';var TopLeft='top-left';var TopRight='top-right';var BottomLeft='bottom-left';var BottomRight='bottom-right';var Start$1='start';var Middle$1='middle';var End$1='end';var X='x';var Y='y';var Group='group';var AxisRole$1='axis';var TitleRole$1='title';var FrameRole$1='frame';var ScopeRole$1='scope';var LegendRole$1='legend';var RowHeader='row-header';var RowFooter='row-footer';var RowTitle='row-title';var ColHeader='column-header';var ColFooter='column-footer';var ColTitle='column-title';var Padding$1='padding';var Symbols$1='symbol';var Fit='fit';var FitX='fit-x';var FitY='fit-y';var Pad='pad';var None='none';var All='all';var Each='each';var Flush='flush';var Column='column';var Row='row';/** + * Calculate bounding boxes for scenegraph items. + * @constructor + * @param {object} params - The parameters for this operator. + * @param {object} params.mark - The scenegraph mark instance to bound. + */function Bound$1(params){Transform.call(this,null,params);}inherits(Bound$1,Transform,{transform:function transform(_,pulse){var view=pulse.dataflow,mark=_.mark,type=mark.marktype,entry=Marks[type],bound=entry.bound;var markBounds=mark.bounds,rebound;if(entry.nested){// multi-item marks have a single bounds instance +if(mark.items.length)view.dirty(mark.items[0]);markBounds=boundItem(mark,bound);mark.items.forEach(function(item){item.bounds.clear().union(markBounds);});}else if(type===Group||_.modified()){// operator parameters modified -> re-bound all items +// updates group bounds in response to modified group content +pulse.visit(pulse.MOD,function(item){return view.dirty(item);});markBounds.clear();mark.items.forEach(function(item){return markBounds.union(boundItem(item,bound));});// force reflow for axes/legends/titles to propagate any layout changes +switch(mark.role){case AxisRole$1:case LegendRole$1:case TitleRole$1:pulse.reflow();}}else{// incrementally update bounds, re-bound mark as needed +rebound=pulse.changed(pulse.REM);pulse.visit(pulse.ADD,function(item){markBounds.union(boundItem(item,bound));});pulse.visit(pulse.MOD,function(item){rebound=rebound||markBounds.alignsWith(item.bounds);view.dirty(item);markBounds.union(boundItem(item,bound));});if(rebound){markBounds.clear();mark.items.forEach(function(item){return markBounds.union(item.bounds);});}}// ensure mark bounds do not exceed any clipping region +boundClip(mark);return pulse.modifies('bounds');}});function boundItem(item,bound,opt){return bound(item.bounds.clear(),item,opt);}var COUNTER_NAME=':vega_identifier:';/** + * Adds a unique identifier to all added tuples. + * This transform creates a new signal that serves as an id counter. + * As a result, the id counter is shared across all instances of this + * transform, generating unique ids across multiple data streams. In + * addition, this signal value can be included in a snapshot of the + * dataflow state, enabling correct resumption of id allocation. + * @constructor + * @param {object} params - The parameters for this operator. + * @param {string} params.as - The field name for the generated identifier. + */function Identifier$1(params){Transform.call(this,0,params);}Identifier$1.Definition={'type':'Identifier','metadata':{'modifies':true},'params':[{'name':'as','type':'string','required':true}]};inherits(Identifier$1,Transform,{transform:function transform(_,pulse){var counter=getCounter(pulse.dataflow),as=_.as;var id=counter.value;pulse.visit(pulse.ADD,function(t){return t[as]=t[as]||++id;});counter.set(this.value=id);return pulse;}});function getCounter(view){return view._signals[COUNTER_NAME]||(view._signals[COUNTER_NAME]=view.add(0));}/** + * Bind scenegraph items to a scenegraph mark instance. + * @constructor + * @param {object} params - The parameters for this operator. + * @param {object} params.markdef - The mark definition for creating the mark. + * This is an object of legal scenegraph mark properties which *must* include + * the 'marktype' property. + */function Mark$1(params){Transform.call(this,null,params);}inherits(Mark$1,Transform,{transform:function transform(_,pulse){var mark=this.value;// acquire mark on first invocation, bind context and group +if(!mark){mark=pulse.dataflow.scenegraph().mark(_.markdef,lookup$1$1(_),_.index);mark.group.context=_.context;if(!_.context.group)_.context.group=mark.group;mark.source=this.source;// point to upstream collector +mark.clip=_.clip;mark.interactive=_.interactive;this.value=mark;}// initialize entering items +var Init=mark.marktype===Group?GroupItem:Item;pulse.visit(pulse.ADD,function(item){return Init.call(item,mark);});// update clipping and/or interactive status +if(_.modified('clip')||_.modified('interactive')){mark.clip=_.clip;mark.interactive=!!_.interactive;mark.zdirty=true;// force scenegraph re-eval +pulse.reflow();}// bind items array to scenegraph mark +mark.items=pulse.source;return pulse;}});function lookup$1$1(_){var g=_.groups,p=_.parent;return g&&g.size===1?g.get(Object.keys(g.object)[0]):g&&p?g.lookup(p):null;}/** + * Analyze items for overlap, changing opacity to hide items with + * overlapping bounding boxes. This transform will preserve at least + * two items (e.g., first and last) even if overlap persists. + * @param {object} params - The parameters for this operator. + * @param {function(*,*): number} [params.sort] - A comparator + * function for sorting items. + * @param {object} [params.method] - The overlap removal method to apply. + * One of 'parity' (default, hide every other item until there is no + * more overlap) or 'greedy' (sequentially scan and hide and items that + * overlap with the last visible item). + * @param {object} [params.boundScale] - A scale whose range should be used + * to bound the items. Items exceeding the bounds of the scale range + * will be treated as overlapping. If null or undefined, no bounds check + * will be applied. + * @param {object} [params.boundOrient] - The orientation of the scale + * (top, bottom, left, or right) used to bound items. This parameter is + * ignored if boundScale is null or undefined. + * @param {object} [params.boundTolerance] - The tolerance in pixels for + * bound inclusion testing (default 1). This specifies by how many pixels + * an item's bounds may exceed the scale range bounds and not be culled. + * @constructor + */function Overlap$1(params){Transform.call(this,null,params);}var methods={parity:function parity(items){return items.filter(function(item,i){return i%2?item.opacity=0:1;});},greedy:function greedy(items,sep){var a;return items.filter(function(b,i){return!i||!intersect$1(a.bounds,b.bounds,sep)?(a=b,1):b.opacity=0;});}};// compute bounding box intersection +// including padding pixels of separation +var intersect$1=function intersect$1(a,b,sep){return sep>Math.max(b.x1-a.x2,a.x1-b.x2,b.y1-a.y2,a.y1-b.y2);};var hasOverlap=function hasOverlap(items,pad){for(var i=1,n=items.length,a=items[0].bounds,b;i<n;a=b,++i){if(intersect$1(a,b=items[i].bounds,pad))return true;}};var hasBounds=function hasBounds(item){var b=item.bounds;return b.width()>1&&b.height()>1;};var boundTest=function boundTest(scale,orient,tolerance){var range=scale.range(),b=new Bounds();if(orient===Top$1||orient===Bottom$1){b.set(range[0],-Infinity,range[1],+Infinity);}else{b.set(-Infinity,range[0],+Infinity,range[1]);}b.expand(tolerance||1);return function(item){return b.encloses(item.bounds);};};// reset all items to be fully opaque +var reset=function reset(source){source.forEach(function(item){return item.opacity=1;});return source;};// add all tuples to mod, fork pulse if parameters were modified +// fork prevents cross-stream tuple pollution (e.g., pulse from scale) +var reflow=function reflow(pulse,_){return pulse.reflow(_.modified()).modifies('opacity');};inherits(Overlap$1,Transform,{transform:function transform(_,pulse){var reduce=methods[_.method]||methods.parity,sep=_.separation||0;var source=pulse.materialize(pulse.SOURCE).source,items,test;if(!source||!source.length)return;if(!_.method){// early exit if method is falsy +if(_.modified('method')){reset(source);pulse=reflow(pulse,_);}return pulse;}// skip labels with no content +source=source.filter(hasBounds);// early exit, nothing to do +if(!source.length)return;if(_.sort){source=source.slice().sort(_.sort);}items=reset(source);pulse=reflow(pulse,_);if(items.length>=3&&hasOverlap(items,sep)){do{items=reduce(items,sep);}while(items.length>=3&&hasOverlap(items,sep));if(items.length<3&&!peek$1(source).opacity){if(items.length>1)peek$1(items).opacity=0;peek$1(source).opacity=1;}}if(_.boundScale&&_.boundTolerance>=0){test=boundTest(_.boundScale,_.boundOrient,+_.boundTolerance);source.forEach(function(item){if(!test(item))item.opacity=0;});}// re-calculate mark bounds +var bounds=items[0].mark.bounds.clear();source.forEach(function(item){if(item.opacity)bounds.union(item.bounds);});return pulse;}});/** + * Queue modified scenegraph items for rendering. + * @constructor + */function Render$1(params){Transform.call(this,null,params);}inherits(Render$1,Transform,{transform:function transform(_,pulse){var view=pulse.dataflow;pulse.visit(pulse.ALL,function(item){return view.dirty(item);});// set z-index dirty flag as needed +if(pulse.fields&&pulse.fields['zindex']){var item=pulse.source&&pulse.source[0];if(item)item.mark.zdirty=true;}}});var tempBounds=new Bounds();function set$2(item,property,value){return item[property]===value?0:(item[property]=value,1);}function isYAxis(mark){var orient=mark.items[0].orient;return orient===Left$1||orient===Right$1;}function axisIndices(datum){var index=+datum.grid;return[datum.ticks?index++:-1,// ticks index +datum.labels?index++:-1,// labels index +index+ +datum.domain// title index +];}function axisLayout(view,axis,width,height){var item=axis.items[0],datum=item.datum,delta=item.translate!=null?item.translate:0.5,orient=item.orient,indices=axisIndices(datum),range=item.range,offset=item.offset,position=item.position,minExtent=item.minExtent,maxExtent=item.maxExtent,title=datum.title&&item.items[indices[2]].items[0],titlePadding=item.titlePadding,bounds=item.bounds,dl=title&&multiLineOffset(title),x=0,y=0,i,s;tempBounds.clear().union(bounds);bounds.clear();if((i=indices[0])>-1)bounds.union(item.items[i].bounds);if((i=indices[1])>-1)bounds.union(item.items[i].bounds);// position axis group and title +switch(orient){case Top$1:x=position||0;y=-offset;s=Math.max(minExtent,Math.min(maxExtent,-bounds.y1));bounds.add(0,-s).add(range,0);if(title)axisTitleLayout(view,title,s,titlePadding,dl,0,-1,bounds);break;case Left$1:x=-offset;y=position||0;s=Math.max(minExtent,Math.min(maxExtent,-bounds.x1));bounds.add(-s,0).add(0,range);if(title)axisTitleLayout(view,title,s,titlePadding,dl,1,-1,bounds);break;case Right$1:x=width+offset;y=position||0;s=Math.max(minExtent,Math.min(maxExtent,bounds.x2));bounds.add(0,0).add(s,range);if(title)axisTitleLayout(view,title,s,titlePadding,dl,1,1,bounds);break;case Bottom$1:x=position||0;y=height+offset;s=Math.max(minExtent,Math.min(maxExtent,bounds.y2));bounds.add(0,0).add(range,s);if(title)axisTitleLayout(view,title,s,titlePadding,0,0,1,bounds);break;default:x=item.x;y=item.y;}// update bounds +boundStroke(bounds.translate(x,y),item);if(set$2(item,'x',x+delta)|set$2(item,'y',y+delta)){item.bounds=tempBounds;view.dirty(item);item.bounds=bounds;view.dirty(item);}return item.mark.bounds.clear().union(bounds);}function axisTitleLayout(view,title,offset,pad,dl,isYAxis,sign,bounds){var b=title.bounds;if(title.auto){var v=sign*(offset+dl+pad);var dx=0,dy=0;view.dirty(title);isYAxis?dx=(title.x||0)-(title.x=v):dy=(title.y||0)-(title.y=v);title.mark.bounds.clear().union(b.translate(-dx,-dy));view.dirty(title);}bounds.union(b);}// aggregation functions for grid margin determination +var min=function min(a,b){return Math.floor(Math.min(a,b));};var max=function max(a,b){return Math.ceil(Math.max(a,b));};function gridLayoutGroups(group){var _views$rowheaders,_views$rowfooters,_views$colheaders,_views$colfooters,_views$marks;var groups=group.items,n=groups.length,i=0,mark,items;var views={marks:[],rowheaders:[],rowfooters:[],colheaders:[],colfooters:[],rowtitle:null,coltitle:null};// layout axes, gather legends, collect bounds +for(;i<n;++i){mark=groups[i];items=mark.items;if(mark.marktype===Group){switch(mark.role){case AxisRole$1:case LegendRole$1:case TitleRole$1:break;case RowHeader:(_views$rowheaders=views.rowheaders).push.apply(_views$rowheaders,_toConsumableArray(items));break;case RowFooter:(_views$rowfooters=views.rowfooters).push.apply(_views$rowfooters,_toConsumableArray(items));break;case ColHeader:(_views$colheaders=views.colheaders).push.apply(_views$colheaders,_toConsumableArray(items));break;case ColFooter:(_views$colfooters=views.colfooters).push.apply(_views$colfooters,_toConsumableArray(items));break;case RowTitle:views.rowtitle=items[0];break;case ColTitle:views.coltitle=items[0];break;default:(_views$marks=views.marks).push.apply(_views$marks,_toConsumableArray(items));}}}return views;}function bboxFlush(item){return new Bounds().set(0,0,item.width||0,item.height||0);}function bboxFull(item){var b=item.bounds.clone();return b.empty()?b.set(0,0,0,0):b.translate(-(item.x||0),-(item.y||0));}function get$1(opt,key,d){var v=isObject(opt)?opt[key]:opt;return v!=null?v:d!==undefined?d:0;}function offsetValue$1(v){return v<0?Math.ceil(-v):0;}function gridLayout(view,groups,opt){var dirty=!opt.nodirty,bbox=opt.bounds===Flush?bboxFlush:bboxFull,bounds=tempBounds.set(0,0,0,0),alignCol=get$1(opt.align,Column),alignRow=get$1(opt.align,Row),padCol=get$1(opt.padding,Column),padRow=get$1(opt.padding,Row),ncols=opt.columns||groups.length,nrows=ncols<=0?1:Math.ceil(groups.length/ncols),n=groups.length,xOffset=Array(n),xExtent=Array(ncols),xMax=0,yOffset=Array(n),yExtent=Array(nrows),yMax=0,dx=Array(n),dy=Array(n),boxes=Array(n),m,i,c,r,b,g,px,py,x,y,offset;for(i=0;i<ncols;++i)xExtent[i]=0;for(i=0;i<nrows;++i)yExtent[i]=0;// determine offsets for each group +for(i=0;i<n;++i){g=groups[i];b=boxes[i]=bbox(g);g.x=g.x||0;dx[i]=0;g.y=g.y||0;dy[i]=0;c=i%ncols;r=~~(i/ncols);xMax=Math.max(xMax,px=Math.ceil(b.x2));yMax=Math.max(yMax,py=Math.ceil(b.y2));xExtent[c]=Math.max(xExtent[c],px);yExtent[r]=Math.max(yExtent[r],py);xOffset[i]=padCol+offsetValue$1(b.x1);yOffset[i]=padRow+offsetValue$1(b.y1);if(dirty)view.dirty(groups[i]);}// set initial alignment offsets +for(i=0;i<n;++i){if(i%ncols===0)xOffset[i]=0;if(i<ncols)yOffset[i]=0;}// enforce column alignment constraints +if(alignCol===Each){for(c=1;c<ncols;++c){for(offset=0,i=c;i<n;i+=ncols){if(offset<xOffset[i])offset=xOffset[i];}for(i=c;i<n;i+=ncols){xOffset[i]=offset+xExtent[c-1];}}}else if(alignCol===All){for(offset=0,i=0;i<n;++i){if(i%ncols&&offset<xOffset[i])offset=xOffset[i];}for(i=0;i<n;++i){if(i%ncols)xOffset[i]=offset+xMax;}}else{for(alignCol=false,c=1;c<ncols;++c){for(i=c;i<n;i+=ncols){xOffset[i]+=xExtent[c-1];}}}// enforce row alignment constraints +if(alignRow===Each){for(r=1;r<nrows;++r){for(offset=0,i=r*ncols,m=i+ncols;i<m;++i){if(offset<yOffset[i])offset=yOffset[i];}for(i=r*ncols;i<m;++i){yOffset[i]=offset+yExtent[r-1];}}}else if(alignRow===All){for(offset=0,i=ncols;i<n;++i){if(offset<yOffset[i])offset=yOffset[i];}for(i=ncols;i<n;++i){yOffset[i]=offset+yMax;}}else{for(alignRow=false,r=1;r<nrows;++r){for(i=r*ncols,m=i+ncols;i<m;++i){yOffset[i]+=yExtent[r-1];}}}// perform horizontal grid layout +for(x=0,i=0;i<n;++i){x=xOffset[i]+(i%ncols?x:0);dx[i]+=x-groups[i].x;}// perform vertical grid layout +for(c=0;c<ncols;++c){for(y=0,i=c;i<n;i+=ncols){y+=yOffset[i];dy[i]+=y-groups[i].y;}}// perform horizontal centering +if(alignCol&&get$1(opt.center,Column)&&nrows>1){for(i=0;i<n;++i){b=alignCol===All?xMax:xExtent[i%ncols];x=b-boxes[i].x2-groups[i].x-dx[i];if(x>0)dx[i]+=x/2;}}// perform vertical centering +if(alignRow&&get$1(opt.center,Row)&&ncols!==1){for(i=0;i<n;++i){b=alignRow===All?yMax:yExtent[~~(i/ncols)];y=b-boxes[i].y2-groups[i].y-dy[i];if(y>0)dy[i]+=y/2;}}// position grid relative to anchor +for(i=0;i<n;++i){bounds.union(boxes[i].translate(dx[i],dy[i]));}x=get$1(opt.anchor,X);y=get$1(opt.anchor,Y);switch(get$1(opt.anchor,Column)){case End$1:x-=bounds.width();break;case Middle$1:x-=bounds.width()/2;}switch(get$1(opt.anchor,Row)){case End$1:y-=bounds.height();break;case Middle$1:y-=bounds.height()/2;}x=Math.round(x);y=Math.round(y);// update mark positions, bounds, dirty +bounds.clear();for(i=0;i<n;++i){groups[i].mark.bounds.clear();}for(i=0;i<n;++i){g=groups[i];g.x+=dx[i]+=x;g.y+=dy[i]+=y;bounds.union(g.mark.bounds.union(g.bounds.translate(dx[i],dy[i])));if(dirty)view.dirty(g);}return bounds;}function trellisLayout(view,group,opt){var views=gridLayoutGroups(group),groups=views.marks,bbox=opt.bounds===Flush?boundFlush:boundFull,off=opt.offset,ncols=opt.columns||groups.length,nrows=ncols<=0?1:Math.ceil(groups.length/ncols),cells=nrows*ncols,x,y,x2,y2,anchor,band,offset;// -- initial grid layout +var bounds=gridLayout(view,groups,opt);if(bounds.empty())bounds.set(0,0,0,0);// empty grid +// -- layout grid headers and footers -- +// perform row header layout +if(views.rowheaders){band=get$1(opt.headerBand,Row,null);x=layoutHeaders(view,views.rowheaders,groups,ncols,nrows,-get$1(off,'rowHeader'),min,0,bbox,'x1',0,ncols,1,band);}// perform column header layout +if(views.colheaders){band=get$1(opt.headerBand,Column,null);y=layoutHeaders(view,views.colheaders,groups,ncols,ncols,-get$1(off,'columnHeader'),min,1,bbox,'y1',0,1,ncols,band);}// perform row footer layout +if(views.rowfooters){band=get$1(opt.footerBand,Row,null);x2=layoutHeaders(view,views.rowfooters,groups,ncols,nrows,get$1(off,'rowFooter'),max,0,bbox,'x2',ncols-1,ncols,1,band);}// perform column footer layout +if(views.colfooters){band=get$1(opt.footerBand,Column,null);y2=layoutHeaders(view,views.colfooters,groups,ncols,ncols,get$1(off,'columnFooter'),max,1,bbox,'y2',cells-ncols,1,ncols,band);}// perform row title layout +if(views.rowtitle){anchor=get$1(opt.titleAnchor,Row);offset=get$1(off,'rowTitle');offset=anchor===End$1?x2+offset:x-offset;band=get$1(opt.titleBand,Row,0.5);layoutTitle(view,views.rowtitle,offset,0,bounds,band);}// perform column title layout +if(views.coltitle){anchor=get$1(opt.titleAnchor,Column);offset=get$1(off,'columnTitle');offset=anchor===End$1?y2+offset:y-offset;band=get$1(opt.titleBand,Column,0.5);layoutTitle(view,views.coltitle,offset,1,bounds,band);}}function boundFlush(item,field){return field==='x1'?item.x||0:field==='y1'?item.y||0:field==='x2'?(item.x||0)+(item.width||0):field==='y2'?(item.y||0)+(item.height||0):undefined;}function boundFull(item,field){return item.bounds[field];}function layoutHeaders(view,headers,groups,ncols,limit,offset,agg,isX,bound,bf,start,stride,back,band){var n=groups.length,init=0,edge=0,i,j,k,m,b,h,g,x,y;// if no groups, early exit and return 0 +if(!n)return init;// compute margin +for(i=start;i<n;i+=stride){if(groups[i])init=agg(init,bound(groups[i],bf));}// if no headers, return margin calculation +if(!headers.length)return init;// check if number of headers exceeds number of rows or columns +if(headers.length>limit){view.warn('Grid headers exceed limit: '+limit);headers=headers.slice(0,limit);}// apply offset +init+=offset;// clear mark bounds for all headers +for(j=0,m=headers.length;j<m;++j){view.dirty(headers[j]);headers[j].mark.bounds.clear();}// layout each header +for(i=start,j=0,m=headers.length;j<m;++j,i+=stride){h=headers[j];b=h.mark.bounds;// search for nearest group to align to +// necessary if table has empty cells +for(k=i;k>=0&&(g=groups[k])==null;k-=back);// assign coordinates and update bounds +if(isX){x=band==null?g.x:Math.round(g.bounds.x1+band*g.bounds.width());y=init;}else{x=init;y=band==null?g.y:Math.round(g.bounds.y1+band*g.bounds.height());}b.union(h.bounds.translate(x-(h.x||0),y-(h.y||0)));h.x=x;h.y=y;view.dirty(h);// update current edge of layout bounds +edge=agg(edge,b[bf]);}return edge;}function layoutTitle(view,g,offset,isX,bounds,band){if(!g)return;view.dirty(g);// compute title coordinates +var x=offset,y=offset;isX?x=Math.round(bounds.x1+band*bounds.width()):y=Math.round(bounds.y1+band*bounds.height());// assign coordinates and update bounds +g.bounds.translate(x-(g.x||0),y-(g.y||0));g.mark.bounds.clear().union(g.bounds);g.x=x;g.y=y;// queue title for redraw +view.dirty(g);}// utility for looking up legend layout configuration +function lookup$3(config,orient){var opt=config[orient]||{};return function(key,d){return opt[key]!=null?opt[key]:config[key]!=null?config[key]:d;};}// if legends specify offset directly, use the maximum specified value +function offsets(legends,value){var max=-Infinity;legends.forEach(function(item){if(item.offset!=null)max=Math.max(max,item.offset);});return max>-Infinity?max:value;}function legendParams(g,orient,config,xb,yb,w,h){var _=lookup$3(config,orient),offset=offsets(g,_('offset',0)),anchor=_('anchor',Start$1),mult=anchor===End$1?1:anchor===Middle$1?0.5:0;var p={align:Each,bounds:_('bounds',Flush),columns:_('direction')==='vertical'?1:g.length,padding:_('margin',8),center:_('center'),nodirty:true};switch(orient){case Left$1:p.anchor={x:Math.floor(xb.x1)-offset,column:End$1,y:mult*(h||xb.height()+2*xb.y1),row:anchor};break;case Right$1:p.anchor={x:Math.ceil(xb.x2)+offset,y:mult*(h||xb.height()+2*xb.y1),row:anchor};break;case Top$1:p.anchor={y:Math.floor(yb.y1)-offset,row:End$1,x:mult*(w||yb.width()+2*yb.x1),column:anchor};break;case Bottom$1:p.anchor={y:Math.ceil(yb.y2)+offset,x:mult*(w||yb.width()+2*yb.x1),column:anchor};break;case TopLeft:p.anchor={x:offset,y:offset};break;case TopRight:p.anchor={x:w-offset,y:offset,column:End$1};break;case BottomLeft:p.anchor={x:offset,y:h-offset,row:End$1};break;case BottomRight:p.anchor={x:w-offset,y:h-offset,column:End$1,row:End$1};break;}return p;}function legendLayout(view,legend){var item=legend.items[0],datum=item.datum,orient=item.orient,bounds=item.bounds,x=item.x,y=item.y,w,h;// cache current bounds for later comparison +item._bounds?item._bounds.clear().union(bounds):item._bounds=bounds.clone();bounds.clear();// adjust legend to accommodate padding and title +legendGroupLayout(view,item,item.items[0].items[0]);// aggregate bounds to determine size, and include origin +bounds=legendBounds(item,bounds);w=2*item.padding;h=2*item.padding;if(!bounds.empty()){w=Math.ceil(bounds.width()+w);h=Math.ceil(bounds.height()+h);}if(datum.type===Symbols$1){legendEntryLayout(item.items[0].items[0].items[0].items);}if(orient!==None){item.x=x=0;item.y=y=0;}item.width=w;item.height=h;boundStroke(bounds.set(x,y,x+w,y+h),item);item.mark.bounds.clear().union(bounds);return item;}function legendBounds(item,b){// aggregate item bounds +item.items.forEach(function(_){return b.union(_.bounds);});// anchor to legend origin +b.x1=item.padding;b.y1=item.padding;return b;}function legendGroupLayout(view,item,entry){var pad=item.padding,ex=pad-entry.x,ey=pad-entry.y;if(!item.datum.title){if(ex||ey)translate(view,entry,ex,ey);}else{var title=item.items[1].items[0],anchor=title.anchor,tpad=item.titlePadding||0,tx=pad-title.x,ty=pad-title.y;switch(title.orient){case Left$1:ex+=Math.ceil(title.bounds.width())+tpad;break;case Right$1:case Bottom$1:break;default:ey+=title.bounds.height()+tpad;}if(ex||ey)translate(view,entry,ex,ey);switch(title.orient){case Left$1:ty+=legendTitleOffset(item,entry,title,anchor,1,1);break;case Right$1:tx+=legendTitleOffset(item,entry,title,End$1,0,0)+tpad;ty+=legendTitleOffset(item,entry,title,anchor,1,1);break;case Bottom$1:tx+=legendTitleOffset(item,entry,title,anchor,0,0);ty+=legendTitleOffset(item,entry,title,End$1,-1,0,1)+tpad;break;default:tx+=legendTitleOffset(item,entry,title,anchor,0,0);}if(tx||ty)translate(view,title,tx,ty);// translate legend if title pushes into negative coordinates +if((tx=Math.round(title.bounds.x1-pad))<0){translate(view,entry,-tx,0);translate(view,title,-tx,0);}}}function legendTitleOffset(item,entry,title,anchor,y,lr,noBar){var grad=item.datum.type!=='symbol',vgrad=title.datum.vgrad,e=grad&&(lr||!vgrad)&&!noBar?entry.items[0]:entry,s=e.bounds[y?'y2':'x2']-item.padding,u=vgrad&&lr?s:0,v=vgrad&&lr?0:s,o=y<=0?0:multiLineOffset(title);return Math.round(anchor===Start$1?u:anchor===End$1?v-o:0.5*(s-o));}function translate(view,item,dx,dy){item.x+=dx;item.y+=dy;item.bounds.translate(dx,dy);item.mark.bounds.translate(dx,dy);view.dirty(item);}function legendEntryLayout(entries){// get max widths for each column +var widths=entries.reduce(function(w,g){w[g.column]=Math.max(g.bounds.x2-g.x,w[g.column]||0);return w;},{});// set dimensions of legend entry groups +entries.forEach(function(g){g.width=widths[g.column];g.height=g.bounds.y2-g.y;});}function titleLayout(view,mark,width,height,viewBounds){var group=mark.items[0],frame=group.frame,orient=group.orient,anchor=group.anchor,offset=group.offset,padding=group.padding,title=group.items[0].items[0],subtitle=group.items[1]&&group.items[1].items[0],end=orient===Left$1||orient===Right$1?height:width,start=0,x=0,y=0,sx=0,sy=0,pos;if(frame!==Group){orient===Left$1?(start=viewBounds.y2,end=viewBounds.y1):orient===Right$1?(start=viewBounds.y1,end=viewBounds.y2):(start=viewBounds.x1,end=viewBounds.x2);}else if(orient===Left$1){start=height,end=0;}pos=anchor===Start$1?start:anchor===End$1?end:(start+end)/2;if(subtitle&&subtitle.text){// position subtitle +switch(orient){case Top$1:case Bottom$1:sy=title.bounds.height()+padding;break;case Left$1:sx=title.bounds.width()+padding;break;case Right$1:sx=-title.bounds.width()-padding;break;}tempBounds.clear().union(subtitle.bounds);tempBounds.translate(sx-(subtitle.x||0),sy-(subtitle.y||0));if(set$2(subtitle,'x',sx)|set$2(subtitle,'y',sy)){view.dirty(subtitle);subtitle.bounds.clear().union(tempBounds);subtitle.mark.bounds.clear().union(tempBounds);view.dirty(subtitle);}tempBounds.clear().union(subtitle.bounds);}else{tempBounds.clear();}tempBounds.union(title.bounds);// position title group +switch(orient){case Top$1:x=pos;y=viewBounds.y1-tempBounds.height()-offset;break;case Left$1:x=viewBounds.x1-tempBounds.width()-offset;y=pos;break;case Right$1:x=viewBounds.x2+tempBounds.width()+offset;y=pos;break;case Bottom$1:x=pos;y=viewBounds.y2+offset;break;default:x=group.x;y=group.y;}if(set$2(group,'x',x)|set$2(group,'y',y)){tempBounds.translate(x,y);view.dirty(group);group.bounds.clear().union(tempBounds);mark.bounds.clear().union(tempBounds);view.dirty(group);}return group.bounds;}/** + * Layout view elements such as axes and legends. + * Also performs size adjustments. + * @constructor + * @param {object} params - The parameters for this operator. + * @param {object} params.mark - Scenegraph mark of groups to layout. + */function ViewLayout$1(params){Transform.call(this,null,params);}inherits(ViewLayout$1,Transform,{transform:function transform(_,pulse){var view=pulse.dataflow;_.mark.items.forEach(function(group){if(_.layout)trellisLayout(view,group,_.layout);layoutGroup(view,group,_);});return shouldReflow(_.mark.group)?pulse.reflow():pulse;}});function shouldReflow(group){// We typically should reflow if layout is invoked (#2568), as child items +// may have resized and reflow ensures group bounds are re-calculated. +// However, legend entries have a special exception to avoid instability. +// For example, if a selected legend symbol gains a stroke on hover, +// we don't want to re-position subsequent elements in the legend. +return group&&group.mark.role!=='legend-entry';}function layoutGroup(view,group,_){var items=group.items,width=Math.max(0,group.width||0),height=Math.max(0,group.height||0),viewBounds=new Bounds().set(0,0,width,height),xBounds=viewBounds.clone(),yBounds=viewBounds.clone(),legends=[],title,mark,orient,b,i,n;// layout axes, gather legends, collect bounds +for(i=0,n=items.length;i<n;++i){mark=items[i];switch(mark.role){case AxisRole$1:b=isYAxis(mark)?xBounds:yBounds;b.union(axisLayout(view,mark,width,height));break;case TitleRole$1:title=mark;break;case LegendRole$1:legends.push(legendLayout(view,mark));break;case FrameRole$1:case ScopeRole$1:case RowHeader:case RowFooter:case RowTitle:case ColHeader:case ColFooter:case ColTitle:xBounds.union(mark.bounds);yBounds.union(mark.bounds);break;default:viewBounds.union(mark.bounds);}}// layout legends, adjust viewBounds +if(legends.length){// group legends by orient +var l={};legends.forEach(function(item){orient=item.orient||Right$1;if(orient!==None)(l[orient]||(l[orient]=[])).push(item);});// perform grid layout for each orient group +for(var _orient in l){var g=l[_orient];gridLayout(view,g,legendParams(g,_orient,_.legends,xBounds,yBounds,width,height));}// update view bounds +legends.forEach(function(item){var b=item.bounds;if(!b.equals(item._bounds)){item.bounds=item._bounds;view.dirty(item);// dirty previous location +item.bounds=b;view.dirty(item);}if(_.autosize&&(_.autosize.type===Fit||_.autosize.type===FitX||_.autosize.type===FitY)){// For autosize fit, incorporate the orthogonal dimension only. +// Legends that overrun the chart area will then be clipped; +// otherwise the chart area gets reduced to nothing! +switch(item.orient){case Left$1:case Right$1:viewBounds.add(b.x1,0).add(b.x2,0);break;case Top$1:case Bottom$1:viewBounds.add(0,b.y1).add(0,b.y2);}}else{viewBounds.union(b);}});}// combine bounding boxes +viewBounds.union(xBounds).union(yBounds);// layout title, adjust bounds +if(title){viewBounds.union(titleLayout(view,title,width,height,viewBounds));}// override aggregated view bounds if content is clipped +if(group.clip){viewBounds.set(0,0,group.width||0,group.height||0);}// perform size adjustment +viewSizeLayout(view,group,viewBounds,_);}function viewSizeLayout(view,group,viewBounds,_){var auto=_.autosize||{},type=auto.type;if(view._autosize<1||!type)return;var viewWidth=view._width,viewHeight=view._height,width=Math.max(0,group.width||0),left=Math.max(0,Math.ceil(-viewBounds.x1)),height=Math.max(0,group.height||0),top=Math.max(0,Math.ceil(-viewBounds.y1));var right=Math.max(0,Math.ceil(viewBounds.x2-width)),bottom=Math.max(0,Math.ceil(viewBounds.y2-height));if(auto.contains===Padding$1){var _padding=view.padding();viewWidth-=_padding.left+_padding.right;viewHeight-=_padding.top+_padding.bottom;}if(type===None){left=0;top=0;width=viewWidth;height=viewHeight;}else if(type===Fit){width=Math.max(0,viewWidth-left-right);height=Math.max(0,viewHeight-top-bottom);}else if(type===FitX){width=Math.max(0,viewWidth-left-right);viewHeight=height+top+bottom;}else if(type===FitY){viewWidth=width+left+right;height=Math.max(0,viewHeight-top-bottom);}else if(type===Pad){viewWidth=width+left+right;viewHeight=height+top+bottom;}view._resizeView(viewWidth,viewHeight,width,height,[left,top],auto.resize);}var vtx=/*#__PURE__*/Object.freeze({__proto__:null,bound:Bound$1,identifier:Identifier$1,mark:Mark$1,overlap:Overlap$1,render:Render$1,viewlayout:ViewLayout$1});/** + * Generates axis ticks for visualizing a spatial scale. + * @constructor + * @param {object} params - The parameters for this operator. + * @param {Scale} params.scale - The scale to generate ticks for. + * @param {*} [params.count=10] - The approximate number of ticks, or + * desired tick interval, to use. + * @param {Array<*>} [params.values] - The exact tick values to use. + * These must be legal domain values for the provided scale. + * If provided, the count argument is ignored. + * @param {function(*):string} [params.formatSpecifier] - A format specifier + * to use in conjunction with scale.tickFormat. Legal values are + * any valid d3 4.0 format specifier. + * @param {function(*):string} [params.format] - The format function to use. + * If provided, the formatSpecifier argument is ignored. + */function AxisTicks$1(params){Transform.call(this,null,params);}inherits(AxisTicks$1,Transform,{transform:function transform(_,pulse){if(this.value&&!_.modified()){return pulse.StopPropagation;}var locale=pulse.dataflow.locale(),out=pulse.fork(pulse.NO_SOURCE|pulse.NO_FIELDS),ticks=this.value,scale=_.scale,tally=_.count==null?_.values?_.values.length:10:_.count,count=tickCount(scale,tally,_.minstep),format=_.format||tickFormat(locale,scale,count,_.formatSpecifier,_.formatType,!!_.values),values=_.values?validTicks(scale,_.values,count):tickValues(scale,count);if(ticks)out.rem=ticks;ticks=values.map(function(value,i){return ingest$1({index:i/(values.length-1||1),value:value,label:format(value)});});if(_.extra&&ticks.length){// add an extra tick pegged to the initial domain value +// this is used to generate axes with 'binned' domains +ticks.push(ingest$1({index:-1,extra:{value:ticks[0].value},label:''}));}out.source=ticks;out.add=ticks;this.value=ticks;return out;}});/** + * Joins a set of data elements against a set of visual items. + * @constructor + * @param {object} params - The parameters for this operator. + * @param {function(object): object} [params.item] - An item generator function. + * @param {function(object): *} [params.key] - The key field associating data and visual items. + */function DataJoin$1(params){Transform.call(this,null,params);}function defaultItemCreate(){return ingest$1({});}function newMap(key){var map=fastmap().test(function(t){return t.exit;});map.lookup=function(t){return map.get(key(t));};return map;}inherits(DataJoin$1,Transform,{transform:function transform(_,pulse){var df=pulse.dataflow,out=pulse.fork(pulse.NO_SOURCE|pulse.NO_FIELDS),item=_.item||defaultItemCreate,key=_.key||tupleid,map=this.value;// prevent transient (e.g., hover) requests from +// cascading across marks derived from marks +if(isArray(out.encode)){out.encode=null;}if(map&&(_.modified('key')||pulse.modified(key))){error('DataJoin does not support modified key function or fields.');}if(!map){pulse=pulse.addAll();this.value=map=newMap(key);}pulse.visit(pulse.ADD,function(t){var k=key(t);var x=map.get(k);if(x){if(x.exit){map.empty--;out.add.push(x);}else{out.mod.push(x);}}else{x=item(t);map.set(k,x);out.add.push(x);}x.datum=t;x.exit=false;});pulse.visit(pulse.MOD,function(t){var k=key(t),x=map.get(k);if(x){x.datum=t;out.mod.push(x);}});pulse.visit(pulse.REM,function(t){var k=key(t),x=map.get(k);if(t===x.datum&&!x.exit){out.rem.push(x);x.exit=true;++map.empty;}});if(pulse.changed(pulse.ADD_MOD))out.modifies('datum');if(pulse.clean()||_.clean&&map.empty>df.cleanThreshold){df.runAfter(map.clean);}return out;}});/** + * Invokes encoding functions for visual items. + * @constructor + * @param {object} params - The parameters to the encoding functions. This + * parameter object will be passed through to all invoked encoding functions. + * @param {object} [params.mod=false] - Flag indicating if tuples in the input + * mod set that are unmodified by encoders should be included in the output. + * @param {object} param.encoders - The encoding functions + * @param {function(object, object): boolean} [param.encoders.update] - Update encoding set + * @param {function(object, object): boolean} [param.encoders.enter] - Enter encoding set + * @param {function(object, object): boolean} [param.encoders.exit] - Exit encoding set + */function Encode$1(params){Transform.call(this,null,params);}inherits(Encode$1,Transform,{transform:function transform(_,pulse){var out=pulse.fork(pulse.ADD_REM),fmod=_.mod||false,encoders=_.encoders,encode=pulse.encode;// if an array, the encode directive includes additional sets +// that must be defined in order for the primary set to be invoked +// e.g., only run the update set if the hover set is defined +if(isArray(encode)){if(out.changed()||encode.every(function(e){return encoders[e];})){encode=encode[0];out.encode=null;// consume targeted encode directive +}else{return pulse.StopPropagation;}}// marshall encoder functions +var reenter=encode==='enter',update=encoders.update||falsy,enter=encoders.enter||falsy,exit=encoders.exit||falsy,set=(encode&&!reenter?encoders[encode]:update)||falsy;if(pulse.changed(pulse.ADD)){pulse.visit(pulse.ADD,function(t){enter(t,_);update(t,_);});out.modifies(enter.output);out.modifies(update.output);if(set!==falsy&&set!==update){pulse.visit(pulse.ADD,function(t){set(t,_);});out.modifies(set.output);}}if(pulse.changed(pulse.REM)&&exit!==falsy){pulse.visit(pulse.REM,function(t){exit(t,_);});out.modifies(exit.output);}if(reenter||set!==falsy){var _flag=pulse.MOD|(_.modified()?pulse.REFLOW:0);if(reenter){pulse.visit(_flag,function(t){var mod=enter(t,_)||fmod;if(set(t,_)||mod)out.mod.push(t);});if(out.mod.length)out.modifies(enter.output);}else{pulse.visit(_flag,function(t){if(set(t,_)||fmod)out.mod.push(t);});}if(out.mod.length)out.modifies(set.output);}return out.changed()?out:pulse.StopPropagation;}});/** + * Generates legend entries for visualizing a scale. + * @constructor + * @param {object} params - The parameters for this operator. + * @param {Scale} params.scale - The scale to generate items for. + * @param {*} [params.count=5] - The approximate number of items, or + * desired tick interval, to use. + * @param {*} [params.limit] - The maximum number of entries to + * include in a symbol legend. + * @param {Array<*>} [params.values] - The exact tick values to use. + * These must be legal domain values for the provided scale. + * If provided, the count argument is ignored. + * @param {string} [params.formatSpecifier] - A format specifier + * to use in conjunction with scale.tickFormat. Legal values are + * any valid D3 format specifier string. + * @param {function(*):string} [params.format] - The format function to use. + * If provided, the formatSpecifier argument is ignored. + */function LegendEntries$1(params){Transform.call(this,[],params);}inherits(LegendEntries$1,Transform,{transform:function transform(_,pulse){if(this.value!=null&&!_.modified()){return pulse.StopPropagation;}var locale=pulse.dataflow.locale(),out=pulse.fork(pulse.NO_SOURCE|pulse.NO_FIELDS),items=this.value,type=_.type||SymbolLegend,scale=_.scale,limit=+_.limit,count=tickCount(scale,_.count==null?5:_.count,_.minstep),lskip=!!_.values||type===SymbolLegend,format=_.format||labelFormat(locale,scale,count,type,_.formatSpecifier,_.formatType,lskip),values=_.values||labelValues(scale,count),domain,fraction,size,offset,ellipsis;if(items)out.rem=items;if(type===SymbolLegend){if(limit&&values.length>limit){pulse.dataflow.warn('Symbol legend count exceeds limit, filtering items.');items=values.slice(0,limit-1);ellipsis=true;}else{items=values;}if(isFunction(size=_.size)){// if first value maps to size zero, remove from list (vega#717) +if(!_.values&&scale(items[0])===0){items=items.slice(1);}// compute size offset for legend entries +offset=items.reduce(function(max,value){return Math.max(max,size(value,_));},0);}else{size=constant$5(offset=size||8);}items=items.map(function(value,index){return ingest$1({index:index,label:format(value,index,items),value:value,offset:offset,size:size(value,_)});});if(ellipsis){ellipsis=values[items.length];items.push(ingest$1({index:items.length,label:"\u2026".concat(values.length-items.length," entries"),value:ellipsis,offset:offset,size:size(ellipsis,_)}));}}else if(type===GradientLegend){domain=scale.domain(),fraction=scaleFraction(scale,domain[0],peek$1(domain));// if automatic label generation produces 2 or fewer values, +// use the domain end points instead (fixes vega/vega#1364) +if(values.length<3&&!_.values&&domain[0]!==peek$1(domain)){values=[domain[0],peek$1(domain)];}items=values.map(function(value,index){return ingest$1({index:index,label:format(value,index,values),value:value,perc:fraction(value)});});}else{size=values.length-1;fraction=labelFraction(scale);items=values.map(function(value,index){return ingest$1({index:index,label:format(value,index,values),value:value,perc:index?fraction(value):0,perc2:index===size?1:fraction(values[index+1])});});}out.source=items;out.add=items;this.value=items;return out;}});var sourceX=function sourceX(t){return t.source.x;};var sourceY=function sourceY(t){return t.source.y;};var targetX=function targetX(t){return t.target.x;};var targetY=function targetY(t){return t.target.y;};/** + * Layout paths linking source and target elements. + * @constructor + * @param {object} params - The parameters for this operator. + */function LinkPath(params){Transform.call(this,{},params);}LinkPath.Definition={'type':'LinkPath','metadata':{'modifies':true},'params':[{'name':'sourceX','type':'field','default':'source.x'},{'name':'sourceY','type':'field','default':'source.y'},{'name':'targetX','type':'field','default':'target.x'},{'name':'targetY','type':'field','default':'target.y'},{'name':'orient','type':'enum','default':'vertical','values':['horizontal','vertical','radial']},{'name':'shape','type':'enum','default':'line','values':['line','arc','curve','diagonal','orthogonal']},{'name':'require','type':'signal'},{'name':'as','type':'string','default':'path'}]};inherits(LinkPath,Transform,{transform:function transform(_,pulse){var sx=_.sourceX||sourceX,sy=_.sourceY||sourceY,tx=_.targetX||targetX,ty=_.targetY||targetY,as=_.as||'path',orient=_.orient||'vertical',shape=_.shape||'line',path=Paths.get(shape+'-'+orient)||Paths.get(shape);if(!path){error('LinkPath unsupported type: '+_.shape+(_.orient?'-'+_.orient:''));}pulse.visit(pulse.SOURCE,function(t){t[as]=path(sx(t),sy(t),tx(t),ty(t));});return pulse.reflow(_.modified()).modifies(as);}});var line=function line(sx,sy,tx,ty){return'M'+sx+','+sy+'L'+tx+','+ty;};var lineR=function lineR(sa,sr,ta,tr){return line(sr*Math.cos(sa),sr*Math.sin(sa),tr*Math.cos(ta),tr*Math.sin(ta));};var arc=function arc(sx,sy,tx,ty){var dx=tx-sx,dy=ty-sy,rr=Math.hypot(dx,dy)/2,ra=180*Math.atan2(dy,dx)/Math.PI;return'M'+sx+','+sy+'A'+rr+','+rr+' '+ra+' 0 1'+' '+tx+','+ty;};var arcR=function arcR(sa,sr,ta,tr){return arc(sr*Math.cos(sa),sr*Math.sin(sa),tr*Math.cos(ta),tr*Math.sin(ta));};var curve=function curve(sx,sy,tx,ty){var dx=tx-sx,dy=ty-sy,ix=0.2*(dx+dy),iy=0.2*(dy-dx);return'M'+sx+','+sy+'C'+(sx+ix)+','+(sy+iy)+' '+(tx+iy)+','+(ty-ix)+' '+tx+','+ty;};var curveR=function curveR(sa,sr,ta,tr){return curve(sr*Math.cos(sa),sr*Math.sin(sa),tr*Math.cos(ta),tr*Math.sin(ta));};var orthoX=function orthoX(sx,sy,tx,ty){return'M'+sx+','+sy+'V'+ty+'H'+tx;};var orthoY=function orthoY(sx,sy,tx,ty){return'M'+sx+','+sy+'H'+tx+'V'+ty;};var orthoR=function orthoR(sa,sr,ta,tr){var sc=Math.cos(sa),ss=Math.sin(sa),tc=Math.cos(ta),ts=Math.sin(ta),sf=Math.abs(ta-sa)>Math.PI?ta<=sa:ta>sa;return'M'+sr*sc+','+sr*ss+'A'+sr+','+sr+' 0 0,'+(sf?1:0)+' '+sr*tc+','+sr*ts+'L'+tr*tc+','+tr*ts;};var diagonalX=function diagonalX(sx,sy,tx,ty){var m=(sx+tx)/2;return'M'+sx+','+sy+'C'+m+','+sy+' '+m+','+ty+' '+tx+','+ty;};var diagonalY=function diagonalY(sx,sy,tx,ty){var m=(sy+ty)/2;return'M'+sx+','+sy+'C'+sx+','+m+' '+tx+','+m+' '+tx+','+ty;};var diagonalR=function diagonalR(sa,sr,ta,tr){var sc=Math.cos(sa),ss=Math.sin(sa),tc=Math.cos(ta),ts=Math.sin(ta),mr=(sr+tr)/2;return'M'+sr*sc+','+sr*ss+'C'+mr*sc+','+mr*ss+' '+mr*tc+','+mr*ts+' '+tr*tc+','+tr*ts;};var Paths=fastmap({'line':line,'line-radial':lineR,'arc':arc,'arc-radial':arcR,'curve':curve,'curve-radial':curveR,'orthogonal-horizontal':orthoX,'orthogonal-vertical':orthoY,'orthogonal-radial':orthoR,'diagonal-horizontal':diagonalX,'diagonal-vertical':diagonalY,'diagonal-radial':diagonalR});/** + * Pie and donut chart layout. + * @constructor + * @param {object} params - The parameters for this operator. + * @param {function(object): *} params.field - The value field to size pie segments. + * @param {number} [params.startAngle=0] - The start angle (in radians) of the layout. + * @param {number} [params.endAngle=2π] - The end angle (in radians) of the layout. + * @param {boolean} [params.sort] - Boolean flag for sorting sectors by value. + */function Pie(params){Transform.call(this,null,params);}Pie.Definition={'type':'Pie','metadata':{'modifies':true},'params':[{'name':'field','type':'field'},{'name':'startAngle','type':'number','default':0},{'name':'endAngle','type':'number','default':6.283185307179586},{'name':'sort','type':'boolean','default':false},{'name':'as','type':'string','array':true,'length':2,'default':['startAngle','endAngle']}]};inherits(Pie,Transform,{transform:function transform(_,pulse){var as=_.as||['startAngle','endAngle'],startAngle=as[0],endAngle=as[1],field=_.field||one$2,start=_.startAngle||0,stop=_.endAngle!=null?_.endAngle:2*Math.PI,data=pulse.source,values=data.map(field),n=values.length,a=start,k=(stop-start)/sum$1(values),index=range$3(n),i,t,v;if(_.sort){index.sort(function(a,b){return values[a]-values[b];});}for(i=0;i<n;++i){v=values[index[i]];t=data[index[i]];t[startAngle]=a;t[endAngle]=a+=v*k;}this.value=values;return pulse.reflow(_.modified()).modifies(as);}});var DEFAULT_COUNT=5;function includeZero(scale){var type=scale.type;return!scale.bins&&(type===Linear||type===Pow||type===Sqrt);}function includePad(type){return isContinuous(type)&&type!==Sequential;}var SKIP$1=toSet(['set','modified','clear','type','scheme','schemeExtent','schemeCount','domain','domainMin','domainMid','domainMax','domainRaw','domainImplicit','nice','zero','bins','range','rangeStep','round','reverse','interpolate','interpolateGamma']);/** + * Maintains a scale function mapping data values to visual channels. + * @constructor + * @param {object} params - The parameters for this operator. + */function Scale$1(params){Transform.call(this,null,params);this.modified(true);// always treat as modified +}inherits(Scale$1,Transform,{transform:function transform(_,pulse){var df=pulse.dataflow,scale$1=this.value,key=scaleKey(_);if(!scale$1||key!==scale$1.type){this.value=scale$1=scale$4(key)();}for(key in _)if(!SKIP$1[key]){// padding is a scale property for band/point but not others +if(key==='padding'&&includePad(scale$1.type))continue;// invoke scale property setter, raise warning if not found +isFunction(scale$1[key])?scale$1[key](_[key]):df.warn('Unsupported scale property: '+key);}configureRange(scale$1,_,configureBins(scale$1,_,configureDomain(scale$1,_,df)));return pulse.fork(pulse.NO_SOURCE|pulse.NO_FIELDS);}});function scaleKey(_){var t=_.type,d='',n;// backwards compatibility pre Vega 5. +if(t===Sequential)return Sequential+'-'+Linear;if(isContinuousColor(_)){n=_.rawDomain?_.rawDomain.length:_.domain?_.domain.length+ +(_.domainMid!=null):0;d=n===2?Sequential+'-':n===3?Diverging+'-':'';}return(d+t||Linear).toLowerCase();}function isContinuousColor(_){var t=_.type;return isContinuous(t)&&t!==Time&&t!==UTC&&(_.scheme||_.range&&_.range.length&&_.range.every(isString));}function configureDomain(scale,_,df){// check raw domain, if provided use that and exit early +var raw=rawDomain(scale,_.domainRaw,df);if(raw>-1)return raw;var domain=_.domain,type=scale.type,zero=_.zero||_.zero===undefined&&includeZero(scale),n,mid;if(!domain)return 0;// adjust domain based on zero, min, max settings +if(zero||_.domainMin!=null||_.domainMax!=null||_.domainMid!=null){n=(domain=domain.slice()).length-1||1;if(zero){if(domain[0]>0)domain[0]=0;if(domain[n]<0)domain[n]=0;}if(_.domainMin!=null)domain[0]=_.domainMin;if(_.domainMax!=null)domain[n]=_.domainMax;if(_.domainMid!=null){mid=_.domainMid;var i=mid>domain[n]?n+1:mid<domain[0]?0:n;if(i!==n)df.warn('Scale domainMid exceeds domain min or max.',mid);domain.splice(i,0,mid);}}// adjust continuous domain for minimum pixel padding +if(includePad(type)&&_.padding&&domain[0]!==peek$1(domain)){domain=padDomain(type,domain,_.range,_.padding,_.exponent,_.constant);}// set the scale domain +scale.domain(domainCheck(type,domain,df));// if ordinal scale domain is defined, prevent implicit +// domain construction as side-effect of scale lookup +if(type===Ordinal){scale.unknown(_.domainImplicit?implicit:undefined);}// perform 'nice' adjustment as requested +if(_.nice&&scale.nice){scale.nice(_.nice!==true&&tickCount(scale,_.nice)||null);}// return the cardinality of the domain +return domain.length;}function rawDomain(scale,raw,df){if(raw){scale.domain(domainCheck(scale.type,raw,df));return raw.length;}else{return-1;}}function padDomain(type,domain,range,pad,exponent,constant){var span=Math.abs(peek$1(range)-range[0]),frac=span/(span-2*pad),d=type===Log?zoomLog(domain,null,frac):type===Sqrt?zoomPow(domain,null,frac,0.5):type===Pow?zoomPow(domain,null,frac,exponent||1):type===Symlog?zoomSymlog(domain,null,frac,constant||1):zoomLinear(domain,null,frac);domain=domain.slice();domain[0]=d[0];domain[domain.length-1]=d[1];return domain;}function domainCheck(type,domain,df){if(isLogarithmic(type)){// sum signs of domain values +// if all pos or all neg, abs(sum) === domain.length +var s=Math.abs(domain.reduce(function(s,v){return s+(v<0?-1:v>0?1:0);},0));if(s!==domain.length){df.warn('Log scale domain includes zero: '+$(domain));}}return domain;}function configureBins(scale,_,count){var bins=_.bins;if(bins&&!isArray(bins)){// generate bin boundary array +var _domain3=scale.domain(),lo=_domain3[0],hi=peek$1(_domain3),step=bins.step;var start=bins.start==null?lo:bins.start,_stop=bins.stop==null?hi:bins.stop;if(!step)error('Scale bins parameter missing step property.');if(start<lo)start=step*Math.ceil(lo/step);if(_stop>hi)_stop=step*Math.floor(hi/step);bins=range$3(start,_stop+step/2,step);}if(bins){// assign bin boundaries to scale instance +scale.bins=bins;}else if(scale.bins){// no current bins, remove bins if previously set +delete scale.bins;}// special handling for bin-ordinal scales +if(scale.type===BinOrdinal){if(!bins){// the domain specifies the bins +scale.bins=scale.domain();}else if(!_.domain&&!_.domainRaw){// the bins specify the domain +scale.domain(bins);count=bins.length;}}// return domain cardinality +return count;}function configureRange(scale,_,count){var type=scale.type,round=_.round||false,range=_.range;// if range step specified, calculate full range extent +if(_.rangeStep!=null){range=configureRangeStep(type,_,count);}// else if a range scheme is defined, use that +else if(_.scheme){range=configureScheme(type,_,count);if(isFunction(range)){if(scale.interpolator){return scale.interpolator(range);}else{error("Scale type ".concat(type," does not support interpolating color schemes."));}}}// given a range array for an interpolating scale, convert to interpolator +if(range&&isInterpolating(type)){return scale.interpolator(interpolateColors(flip(range,_.reverse),_.interpolate,_.interpolateGamma));}// configure rounding / interpolation +if(range&&_.interpolate&&scale.interpolate){scale.interpolate(interpolate(_.interpolate,_.interpolateGamma));}else if(isFunction(scale.round)){scale.round(round);}else if(isFunction(scale.rangeRound)){scale.interpolate(round?interpolateRound:interpolate$1);}if(range)scale.range(flip(range,_.reverse));}function configureRangeStep(type,_,count){if(type!==Band&&type!==Point){error('Only band and point scales support rangeStep.');}// calculate full range based on requested step size and padding +var outer=(_.paddingOuter!=null?_.paddingOuter:_.padding)||0,inner=type===Point?1:(_.paddingInner!=null?_.paddingInner:_.padding)||0;return[0,_.rangeStep*bandSpace(count,inner,outer)];}function configureScheme(type,_,count){var extent=_.schemeExtent,name,scheme$1;if(isArray(_.scheme)){scheme$1=interpolateColors(_.scheme,_.interpolate,_.interpolateGamma);}else{name=_.scheme.toLowerCase();scheme$1=scheme(name);if(!scheme$1)error("Unrecognized scheme name: ".concat(_.scheme));}// determine size for potential discrete range +count=type===Threshold?count+1:type===BinOrdinal?count-1:type===Quantile||type===Quantize?+_.schemeCount||DEFAULT_COUNT:count;// adjust and/or quantize scheme as appropriate +return isInterpolating(type)?adjustScheme(scheme$1,extent,_.reverse):isFunction(scheme$1)?quantizeInterpolator(adjustScheme(scheme$1,extent),count):type===Ordinal?scheme$1:scheme$1.slice(0,count);}function adjustScheme(scheme,extent,reverse){return isFunction(scheme)&&(extent||reverse)?interpolateRange(scheme,flip(extent||[0,1],reverse)):scheme;}function flip(array,reverse){return reverse?array.slice().reverse():array;}/** + * Sorts scenegraph items in the pulse source array. + * @constructor + * @param {object} params - The parameters for this operator. + * @param {function(*,*): number} [params.sort] - A comparator + * function for sorting tuples. + */function SortItems$1(params){Transform.call(this,null,params);}inherits(SortItems$1,Transform,{transform:function transform(_,pulse){var mod=_.modified('sort')||pulse.changed(pulse.ADD)||pulse.modified(_.sort.fields)||pulse.modified('datum');if(mod)pulse.source.sort(stableCompare(_.sort));this.modified(mod);return pulse;}});var Zero='zero',Center$1='center',Normalize='normalize',DefOutput=['y0','y1'];/** + * Stack layout for visualization elements. + * @constructor + * @param {object} params - The parameters for this operator. + * @param {function(object): *} params.field - The value field to stack. + * @param {Array<function(object): *>} [params.groupby] - An array of accessors to groupby. + * @param {function(object,object): number} [params.sort] - A comparator for stack sorting. + * @param {string} [offset='zero'] - Stack baseline offset. One of 'zero', 'center', 'normalize'. + */function Stack(params){Transform.call(this,null,params);}Stack.Definition={'type':'Stack','metadata':{'modifies':true},'params':[{'name':'field','type':'field'},{'name':'groupby','type':'field','array':true},{'name':'sort','type':'compare'},{'name':'offset','type':'enum','default':Zero,'values':[Zero,Center$1,Normalize]},{'name':'as','type':'string','array':true,'length':2,'default':DefOutput}]};inherits(Stack,Transform,{transform:function transform(_,pulse){var as=_.as||DefOutput,y0=as[0],y1=as[1],sort=stableCompare(_.sort),field=_.field||one$2,stack=_.offset===Center$1?stackCenter:_.offset===Normalize?stackNormalize:stackZero,groups,i,n,max;// partition, sum, and sort the stack groups +groups=partition$3(pulse.source,_.groupby,sort,field);// compute stack layouts per group +for(i=0,n=groups.length,max=groups.max;i<n;++i){stack(groups[i],max,field,y0,y1);}return pulse.reflow(_.modified()).modifies(as);}});function stackCenter(group,max,field,y0,y1){var last=(max-group.sum)/2,m=group.length,j=0,t;for(;j<m;++j){t=group[j];t[y0]=last;t[y1]=last+=Math.abs(field(t));}}function stackNormalize(group,max,field,y0,y1){var scale=1/group.sum,last=0,m=group.length,j=0,v=0,t;for(;j<m;++j){t=group[j];t[y0]=last;t[y1]=last=scale*(v+=Math.abs(field(t)));}}function stackZero(group,max,field,y0,y1){var lastPos=0,lastNeg=0,m=group.length,j=0,v,t;for(;j<m;++j){t=group[j];v=+field(t);if(v<0){t[y0]=lastNeg;t[y1]=lastNeg+=v;}else{t[y0]=lastPos;t[y1]=lastPos+=v;}}}function partition$3(data,groupby,sort,field){var groups=[],get=function get(f){return f(t);},map,i,n,m,t,k,g,s,max;// partition data points into stack groups +if(groupby==null){groups.push(data.slice());}else{for(map={},i=0,n=data.length;i<n;++i){t=data[i];k=groupby.map(get);g=map[k];if(!g){map[k]=g=[];groups.push(g);}g.push(t);}}// compute sums of groups, sort groups as needed +for(k=0,max=0,m=groups.length;k<m;++k){g=groups[k];for(i=0,s=0,n=g.length;i<n;++i){s+=Math.abs(field(g[i]));}g.sum=s;if(s>max)max=s;if(sort)g.sort(sort);}groups.max=max;return groups;}var encode$1=/*#__PURE__*/Object.freeze({__proto__:null,axisticks:AxisTicks$1,datajoin:DataJoin$1,encode:Encode$1,legendentries:LegendEntries$1,linkpath:LinkPath,pie:Pie,scale:Scale$1,sortitems:SortItems$1,stack:Stack});var epsilon$3=1e-6;var epsilon2=1e-12;var pi$1=Math.PI;var halfPi$1=pi$1/2;var quarterPi=pi$1/4;var tau$1=pi$1*2;var degrees=180/pi$1;var radians=pi$1/180;var abs$1=Math.abs;var atan=Math.atan;var atan2=Math.atan2;var cos$1=Math.cos;var ceil=Math.ceil;var exp=Math.exp;var hypot=Math.hypot;var log$1=Math.log;var pow$1=Math.pow;var sin$1=Math.sin;var sign=Math.sign||function(x){return x>0?1:x<0?-1:0;};var sqrt$1=Math.sqrt;var tan=Math.tan;function acos(x){return x>1?0:x<-1?pi$1:Math.acos(x);}function asin$1(x){return x>1?halfPi$1:x<-1?-halfPi$1:Math.asin(x);}function noop$2(){}function streamGeometry(geometry,stream){if(geometry&&streamGeometryType.hasOwnProperty(geometry.type)){streamGeometryType[geometry.type](geometry,stream);}}var streamObjectType={Feature:function Feature(object,stream){streamGeometry(object.geometry,stream);},FeatureCollection:function FeatureCollection(object,stream){var features=object.features,i=-1,n=features.length;while(++i<n)streamGeometry(features[i].geometry,stream);}};var streamGeometryType={Sphere:function Sphere(object,stream){stream.sphere();},Point:function Point(object,stream){object=object.coordinates;stream.point(object[0],object[1],object[2]);},MultiPoint:function MultiPoint(object,stream){var coordinates=object.coordinates,i=-1,n=coordinates.length;while(++i<n)object=coordinates[i],stream.point(object[0],object[1],object[2]);},LineString:function LineString(object,stream){streamLine(object.coordinates,stream,0);},MultiLineString:function MultiLineString(object,stream){var coordinates=object.coordinates,i=-1,n=coordinates.length;while(++i<n)streamLine(coordinates[i],stream,0);},Polygon:function Polygon(object,stream){streamPolygon(object.coordinates,stream);},MultiPolygon:function MultiPolygon(object,stream){var coordinates=object.coordinates,i=-1,n=coordinates.length;while(++i<n)streamPolygon(coordinates[i],stream);},GeometryCollection:function GeometryCollection(object,stream){var geometries=object.geometries,i=-1,n=geometries.length;while(++i<n)streamGeometry(geometries[i],stream);}};function streamLine(coordinates,stream,closed){var i=-1,n=coordinates.length-closed,coordinate;stream.lineStart();while(++i<n)coordinate=coordinates[i],stream.point(coordinate[0],coordinate[1],coordinate[2]);stream.lineEnd();}function streamPolygon(coordinates,stream){var i=-1,n=coordinates.length;stream.polygonStart();while(++i<n)streamLine(coordinates[i],stream,1);stream.polygonEnd();}function geoStream(object,stream){if(object&&streamObjectType.hasOwnProperty(object.type)){streamObjectType[object.type](object,stream);}else{streamGeometry(object,stream);}}var areaRingSum$1=new Adder();// hello? +var areaSum$1=new Adder(),lambda00$2,phi00$2,lambda0$1,cosPhi0,sinPhi0;var areaStream$1={point:noop$2,lineStart:noop$2,lineEnd:noop$2,polygonStart:function polygonStart(){areaRingSum$1=new Adder();areaStream$1.lineStart=areaRingStart$1;areaStream$1.lineEnd=areaRingEnd$1;},polygonEnd:function polygonEnd(){var areaRing=+areaRingSum$1;areaSum$1.add(areaRing<0?tau$1+areaRing:areaRing);this.lineStart=this.lineEnd=this.point=noop$2;},sphere:function sphere(){areaSum$1.add(tau$1);}};function areaRingStart$1(){areaStream$1.point=areaPointFirst$1;}function areaRingEnd$1(){areaPoint$1(lambda00$2,phi00$2);}function areaPointFirst$1(lambda,phi){areaStream$1.point=areaPoint$1;lambda00$2=lambda,phi00$2=phi;lambda*=radians,phi*=radians;lambda0$1=lambda,cosPhi0=cos$1(phi=phi/2+quarterPi),sinPhi0=sin$1(phi);}function areaPoint$1(lambda,phi){lambda*=radians,phi*=radians;phi=phi/2+quarterPi;// half the angular distance from south pole +// Spherical excess E for a spherical triangle with vertices: south pole, +// previous point, current point. Uses a formula derived from Cagnoli’s +// theorem. See Todhunter, Spherical Trig. (1871), Sec. 103, Eq. (2). +var dLambda=lambda-lambda0$1,sdLambda=dLambda>=0?1:-1,adLambda=sdLambda*dLambda,cosPhi=cos$1(phi),sinPhi=sin$1(phi),k=sinPhi0*sinPhi,u=cosPhi0*cosPhi+k*cos$1(adLambda),v=k*sdLambda*sin$1(adLambda);areaRingSum$1.add(atan2(v,u));// Advance the previous points. +lambda0$1=lambda,cosPhi0=cosPhi,sinPhi0=sinPhi;}function geoArea$1(object){areaSum$1=new Adder();geoStream(object,areaStream$1);return areaSum$1*2;}function spherical(cartesian){return[atan2(cartesian[1],cartesian[0]),asin$1(cartesian[2])];}function cartesian(spherical){var lambda=spherical[0],phi=spherical[1],cosPhi=cos$1(phi);return[cosPhi*cos$1(lambda),cosPhi*sin$1(lambda),sin$1(phi)];}function cartesianDot(a,b){return a[0]*b[0]+a[1]*b[1]+a[2]*b[2];}function cartesianCross(a,b){return[a[1]*b[2]-a[2]*b[1],a[2]*b[0]-a[0]*b[2],a[0]*b[1]-a[1]*b[0]];}// TODO return a +function cartesianAddInPlace(a,b){a[0]+=b[0],a[1]+=b[1],a[2]+=b[2];}function cartesianScale(vector,k){return[vector[0]*k,vector[1]*k,vector[2]*k];}// TODO return d +function cartesianNormalizeInPlace(d){var l=sqrt$1(d[0]*d[0]+d[1]*d[1]+d[2]*d[2]);d[0]/=l,d[1]/=l,d[2]/=l;}var lambda0,phi0,lambda1,phi1,// bounds +lambda2,// previous lambda-coordinate +lambda00$1,phi00$1,// first point +p0,// previous 3D point +deltaSum,ranges,range$2;var boundsStream$1={point:boundsPoint$1,lineStart:boundsLineStart,lineEnd:boundsLineEnd,polygonStart:function polygonStart(){boundsStream$1.point=boundsRingPoint;boundsStream$1.lineStart=boundsRingStart;boundsStream$1.lineEnd=boundsRingEnd;deltaSum=new Adder();areaStream$1.polygonStart();},polygonEnd:function polygonEnd(){areaStream$1.polygonEnd();boundsStream$1.point=boundsPoint$1;boundsStream$1.lineStart=boundsLineStart;boundsStream$1.lineEnd=boundsLineEnd;if(areaRingSum$1<0)lambda0=-(lambda1=180),phi0=-(phi1=90);else if(deltaSum>epsilon$3)phi1=90;else if(deltaSum<-1e-6)phi0=-90;range$2[0]=lambda0,range$2[1]=lambda1;},sphere:function sphere(){lambda0=-(lambda1=180),phi0=-(phi1=90);}};function boundsPoint$1(lambda,phi){ranges.push(range$2=[lambda0=lambda,lambda1=lambda]);if(phi<phi0)phi0=phi;if(phi>phi1)phi1=phi;}function linePoint(lambda,phi){var p=cartesian([lambda*radians,phi*radians]);if(p0){var normal=cartesianCross(p0,p),equatorial=[normal[1],-normal[0],0],inflection=cartesianCross(equatorial,normal);cartesianNormalizeInPlace(inflection);inflection=spherical(inflection);var delta=lambda-lambda2,sign=delta>0?1:-1,lambdai=inflection[0]*degrees*sign,phii,antimeridian=abs$1(delta)>180;if(antimeridian^(sign*lambda2<lambdai&&lambdai<sign*lambda)){phii=inflection[1]*degrees;if(phii>phi1)phi1=phii;}else if(lambdai=(lambdai+360)%360-180,antimeridian^(sign*lambda2<lambdai&&lambdai<sign*lambda)){phii=-inflection[1]*degrees;if(phii<phi0)phi0=phii;}else{if(phi<phi0)phi0=phi;if(phi>phi1)phi1=phi;}if(antimeridian){if(lambda<lambda2){if(angle(lambda0,lambda)>angle(lambda0,lambda1))lambda1=lambda;}else{if(angle(lambda,lambda1)>angle(lambda0,lambda1))lambda0=lambda;}}else{if(lambda1>=lambda0){if(lambda<lambda0)lambda0=lambda;if(lambda>lambda1)lambda1=lambda;}else{if(lambda>lambda2){if(angle(lambda0,lambda)>angle(lambda0,lambda1))lambda1=lambda;}else{if(angle(lambda,lambda1)>angle(lambda0,lambda1))lambda0=lambda;}}}}else{ranges.push(range$2=[lambda0=lambda,lambda1=lambda]);}if(phi<phi0)phi0=phi;if(phi>phi1)phi1=phi;p0=p,lambda2=lambda;}function boundsLineStart(){boundsStream$1.point=linePoint;}function boundsLineEnd(){range$2[0]=lambda0,range$2[1]=lambda1;boundsStream$1.point=boundsPoint$1;p0=null;}function boundsRingPoint(lambda,phi){if(p0){var delta=lambda-lambda2;deltaSum.add(abs$1(delta)>180?delta+(delta>0?360:-360):delta);}else{lambda00$1=lambda,phi00$1=phi;}areaStream$1.point(lambda,phi);linePoint(lambda,phi);}function boundsRingStart(){areaStream$1.lineStart();}function boundsRingEnd(){boundsRingPoint(lambda00$1,phi00$1);areaStream$1.lineEnd();if(abs$1(deltaSum)>epsilon$3)lambda0=-(lambda1=180);range$2[0]=lambda0,range$2[1]=lambda1;p0=null;}// Finds the left-right distance between two longitudes. +// This is almost the same as (lambda1 - lambda0 + 360°) % 360°, except that we want +// the distance between ±180° to be 360°. +function angle(lambda0,lambda1){return(lambda1-=lambda0)<0?lambda1+360:lambda1;}function rangeCompare(a,b){return a[0]-b[0];}function rangeContains(range,x){return range[0]<=range[1]?range[0]<=x&&x<=range[1]:x<range[0]||range[1]<x;}function geoBounds$1(feature){var i,n,a,b,merged,deltaMax,delta;phi1=lambda1=-(lambda0=phi0=Infinity);ranges=[];geoStream(feature,boundsStream$1);// First, sort ranges by their minimum longitudes. +if(n=ranges.length){ranges.sort(rangeCompare);// Then, merge any ranges that overlap. +for(i=1,a=ranges[0],merged=[a];i<n;++i){b=ranges[i];if(rangeContains(a,b[0])||rangeContains(a,b[1])){if(angle(a[0],b[1])>angle(a[0],a[1]))a[1]=b[1];if(angle(b[0],a[1])>angle(a[0],a[1]))a[0]=b[0];}else{merged.push(a=b);}}// Finally, find the largest gap between the merged ranges. +// The final bounding box will be the inverse of this gap. +for(deltaMax=-Infinity,n=merged.length-1,i=0,a=merged[n];i<=n;a=b,++i){b=merged[i];if((delta=angle(a[1],b[0]))>deltaMax)deltaMax=delta,lambda0=b[0],lambda1=a[1];}}ranges=range$2=null;return lambda0===Infinity||phi0===Infinity?[[NaN,NaN],[NaN,NaN]]:[[lambda0,phi0],[lambda1,phi1]];}var W0,W1,X0$1,Y0$1,Z0$1,X1$1,Y1$1,Z1$1,X2$1,Y2$1,Z2$1,lambda00,phi00,// first point +x0$4,y0$4,z0;// previous point +var centroidStream$1={sphere:noop$2,point:centroidPoint$1,lineStart:centroidLineStart$1,lineEnd:centroidLineEnd$1,polygonStart:function polygonStart(){centroidStream$1.lineStart=centroidRingStart$1;centroidStream$1.lineEnd=centroidRingEnd$1;},polygonEnd:function polygonEnd(){centroidStream$1.lineStart=centroidLineStart$1;centroidStream$1.lineEnd=centroidLineEnd$1;}};// Arithmetic mean of Cartesian vectors. +function centroidPoint$1(lambda,phi){lambda*=radians,phi*=radians;var cosPhi=cos$1(phi);centroidPointCartesian(cosPhi*cos$1(lambda),cosPhi*sin$1(lambda),sin$1(phi));}function centroidPointCartesian(x,y,z){++W0;X0$1+=(x-X0$1)/W0;Y0$1+=(y-Y0$1)/W0;Z0$1+=(z-Z0$1)/W0;}function centroidLineStart$1(){centroidStream$1.point=centroidLinePointFirst;}function centroidLinePointFirst(lambda,phi){lambda*=radians,phi*=radians;var cosPhi=cos$1(phi);x0$4=cosPhi*cos$1(lambda);y0$4=cosPhi*sin$1(lambda);z0=sin$1(phi);centroidStream$1.point=centroidLinePoint;centroidPointCartesian(x0$4,y0$4,z0);}function centroidLinePoint(lambda,phi){lambda*=radians,phi*=radians;var cosPhi=cos$1(phi),x=cosPhi*cos$1(lambda),y=cosPhi*sin$1(lambda),z=sin$1(phi),w=atan2(sqrt$1((w=y0$4*z-z0*y)*w+(w=z0*x-x0$4*z)*w+(w=x0$4*y-y0$4*x)*w),x0$4*x+y0$4*y+z0*z);W1+=w;X1$1+=w*(x0$4+(x0$4=x));Y1$1+=w*(y0$4+(y0$4=y));Z1$1+=w*(z0+(z0=z));centroidPointCartesian(x0$4,y0$4,z0);}function centroidLineEnd$1(){centroidStream$1.point=centroidPoint$1;}// See J. E. Brock, The Inertia Tensor for a Spherical Triangle, +// J. Applied Mechanics 42, 239 (1975). +function centroidRingStart$1(){centroidStream$1.point=centroidRingPointFirst;}function centroidRingEnd$1(){centroidRingPoint(lambda00,phi00);centroidStream$1.point=centroidPoint$1;}function centroidRingPointFirst(lambda,phi){lambda00=lambda,phi00=phi;lambda*=radians,phi*=radians;centroidStream$1.point=centroidRingPoint;var cosPhi=cos$1(phi);x0$4=cosPhi*cos$1(lambda);y0$4=cosPhi*sin$1(lambda);z0=sin$1(phi);centroidPointCartesian(x0$4,y0$4,z0);}function centroidRingPoint(lambda,phi){lambda*=radians,phi*=radians;var cosPhi=cos$1(phi),x=cosPhi*cos$1(lambda),y=cosPhi*sin$1(lambda),z=sin$1(phi),cx=y0$4*z-z0*y,cy=z0*x-x0$4*z,cz=x0$4*y-y0$4*x,m=hypot(cx,cy,cz),w=asin$1(m),// line weight = angle +v=m&&-w/m;// area weight multiplier +X2$1.add(v*cx);Y2$1.add(v*cy);Z2$1.add(v*cz);W1+=w;X1$1+=w*(x0$4+(x0$4=x));Y1$1+=w*(y0$4+(y0$4=y));Z1$1+=w*(z0+(z0=z));centroidPointCartesian(x0$4,y0$4,z0);}function geoCentroid$1(object){W0=W1=X0$1=Y0$1=Z0$1=X1$1=Y1$1=Z1$1=0;X2$1=new Adder();Y2$1=new Adder();Z2$1=new Adder();geoStream(object,centroidStream$1);var x=+X2$1,y=+Y2$1,z=+Z2$1,m=hypot(x,y,z);// If the area-weighted ccentroid is undefined, fall back to length-weighted ccentroid. +if(m<epsilon2){x=X1$1,y=Y1$1,z=Z1$1;// If the feature has zero length, fall back to arithmetic mean of point vectors. +if(W1<epsilon$3)x=X0$1,y=Y0$1,z=Z0$1;m=hypot(x,y,z);// If the feature still has an undefined ccentroid, then return. +if(m<epsilon2)return[NaN,NaN];}return[atan2(y,x)*degrees,asin$1(z/m)*degrees];}function compose(a,b){function compose(x,y){return x=a(x,y),b(x[0],x[1]);}if(a.invert&&b.invert)compose.invert=function(x,y){return x=b.invert(x,y),x&&a.invert(x[0],x[1]);};return compose;}function rotationIdentity(lambda,phi){if(abs$1(lambda)>pi$1)lambda-=Math.round(lambda/tau$1)*tau$1;return[lambda,phi];}rotationIdentity.invert=rotationIdentity;function rotateRadians(deltaLambda,deltaPhi,deltaGamma){return(deltaLambda%=tau$1)?deltaPhi||deltaGamma?compose(rotationLambda(deltaLambda),rotationPhiGamma(deltaPhi,deltaGamma)):rotationLambda(deltaLambda):deltaPhi||deltaGamma?rotationPhiGamma(deltaPhi,deltaGamma):rotationIdentity;}function forwardRotationLambda(deltaLambda){return function(lambda,phi){lambda+=deltaLambda;if(abs$1(lambda)>pi$1)lambda-=Math.round(lambda/tau$1)*tau$1;return[lambda,phi];};}function rotationLambda(deltaLambda){var rotation=forwardRotationLambda(deltaLambda);rotation.invert=forwardRotationLambda(-deltaLambda);return rotation;}function rotationPhiGamma(deltaPhi,deltaGamma){var cosDeltaPhi=cos$1(deltaPhi),sinDeltaPhi=sin$1(deltaPhi),cosDeltaGamma=cos$1(deltaGamma),sinDeltaGamma=sin$1(deltaGamma);function rotation(lambda,phi){var cosPhi=cos$1(phi),x=cos$1(lambda)*cosPhi,y=sin$1(lambda)*cosPhi,z=sin$1(phi),k=z*cosDeltaPhi+x*sinDeltaPhi;return[atan2(y*cosDeltaGamma-k*sinDeltaGamma,x*cosDeltaPhi-z*sinDeltaPhi),asin$1(k*cosDeltaGamma+y*sinDeltaGamma)];}rotation.invert=function(lambda,phi){var cosPhi=cos$1(phi),x=cos$1(lambda)*cosPhi,y=sin$1(lambda)*cosPhi,z=sin$1(phi),k=z*cosDeltaGamma-y*sinDeltaGamma;return[atan2(y*cosDeltaGamma+z*sinDeltaGamma,x*cosDeltaPhi+k*sinDeltaPhi),asin$1(k*cosDeltaPhi-x*sinDeltaPhi)];};return rotation;}function rotation(rotate){rotate=rotateRadians(rotate[0]*radians,rotate[1]*radians,rotate.length>2?rotate[2]*radians:0);function forward(coordinates){coordinates=rotate(coordinates[0]*radians,coordinates[1]*radians);return coordinates[0]*=degrees,coordinates[1]*=degrees,coordinates;}forward.invert=function(coordinates){coordinates=rotate.invert(coordinates[0]*radians,coordinates[1]*radians);return coordinates[0]*=degrees,coordinates[1]*=degrees,coordinates;};return forward;}// Generates a circle centered at [0°, 0°], with a given radius and precision. +function circleStream(stream,radius,delta,direction,t0,t1){if(!delta)return;var cosRadius=cos$1(radius),sinRadius=sin$1(radius),step=direction*delta;if(t0==null){t0=radius+direction*tau$1;t1=radius-step/2;}else{t0=circleRadius(cosRadius,t0);t1=circleRadius(cosRadius,t1);if(direction>0?t0<t1:t0>t1)t0+=direction*tau$1;}for(var point,t=t0;direction>0?t>t1:t<t1;t-=step){point=spherical([cosRadius,-sinRadius*cos$1(t),-sinRadius*sin$1(t)]);stream.point(point[0],point[1]);}}// Returns the signed angle of a cartesian point relative to [cosRadius, 0, 0]. +function circleRadius(cosRadius,point){point=cartesian(point),point[0]-=cosRadius;cartesianNormalizeInPlace(point);var radius=acos(-point[1]);return((-point[2]<0?-radius:radius)+tau$1-epsilon$3)%tau$1;}function clipBuffer(){var lines=[],line;return{point:function point(x,y,m){line.push([x,y,m]);},lineStart:function lineStart(){lines.push(line=[]);},lineEnd:noop$2,rejoin:function rejoin(){if(lines.length>1)lines.push(lines.pop().concat(lines.shift()));},result:function result(){var result=lines;lines=[];line=null;return result;}};}function pointEqual(a,b){return abs$1(a[0]-b[0])<epsilon$3&&abs$1(a[1]-b[1])<epsilon$3;}function Intersection(point,points,other,entry){this.x=point;this.z=points;this.o=other;// another intersection +this.e=entry;// is an entry? +this.v=false;// visited +this.n=this.p=null;// next & previous +}// A generalized polygon clipping algorithm: given a polygon that has been cut +// into its visible line segments, and rejoins the segments by interpolating +// along the clip edge. +function clipRejoin(segments,compareIntersection,startInside,interpolate,stream){var subject=[],clip=[],i,n;segments.forEach(function(segment){if((n=segment.length-1)<=0)return;var n,p0=segment[0],p1=segment[n],x;if(pointEqual(p0,p1)){if(!p0[2]&&!p1[2]){stream.lineStart();for(i=0;i<n;++i)stream.point((p0=segment[i])[0],p0[1]);stream.lineEnd();return;}// handle degenerate cases by moving the point +p1[0]+=2*epsilon$3;}subject.push(x=new Intersection(p0,segment,null,true));clip.push(x.o=new Intersection(p0,null,x,false));subject.push(x=new Intersection(p1,segment,null,false));clip.push(x.o=new Intersection(p1,null,x,true));});if(!subject.length)return;clip.sort(compareIntersection);link(subject);link(clip);for(i=0,n=clip.length;i<n;++i){clip[i].e=startInside=!startInside;}var start=subject[0],points,point;while(1){// Find first unvisited intersection. +var current=start,isSubject=true;while(current.v)if((current=current.n)===start)return;points=current.z;stream.lineStart();do{current.v=current.o.v=true;if(current.e){if(isSubject){for(i=0,n=points.length;i<n;++i)stream.point((point=points[i])[0],point[1]);}else{interpolate(current.x,current.n.x,1,stream);}current=current.n;}else{if(isSubject){points=current.p.z;for(i=points.length-1;i>=0;--i)stream.point((point=points[i])[0],point[1]);}else{interpolate(current.x,current.p.x,-1,stream);}current=current.p;}current=current.o;points=current.z;isSubject=!isSubject;}while(!current.v);stream.lineEnd();}}function link(array){if(!(n=array.length))return;var n,i=0,a=array[0],b;while(++i<n){a.n=b=array[i];b.p=a;a=b;}a.n=b=array[0];b.p=a;}function longitude(point){return abs$1(point[0])<=pi$1?point[0]:sign(point[0])*((abs$1(point[0])+pi$1)%tau$1-pi$1);}function polygonContains(polygon,point){var lambda=longitude(point),phi=point[1],sinPhi=sin$1(phi),normal=[sin$1(lambda),-cos$1(lambda),0],angle=0,winding=0;var sum=new Adder();if(sinPhi===1)phi=halfPi$1+epsilon$3;else if(sinPhi===-1)phi=-halfPi$1-epsilon$3;for(var i=0,n=polygon.length;i<n;++i){if(!(m=(ring=polygon[i]).length))continue;var ring,m,point0=ring[m-1],lambda0=longitude(point0),phi0=point0[1]/2+quarterPi,sinPhi0=sin$1(phi0),cosPhi0=cos$1(phi0);for(var j=0;j<m;++j,lambda0=lambda1,sinPhi0=sinPhi1,cosPhi0=cosPhi1,point0=point1){var point1=ring[j],lambda1=longitude(point1),phi1=point1[1]/2+quarterPi,sinPhi1=sin$1(phi1),cosPhi1=cos$1(phi1),delta=lambda1-lambda0,sign=delta>=0?1:-1,absDelta=sign*delta,antimeridian=absDelta>pi$1,k=sinPhi0*sinPhi1;sum.add(atan2(k*sign*sin$1(absDelta),cosPhi0*cosPhi1+k*cos$1(absDelta)));angle+=antimeridian?delta+sign*tau$1:delta;// Are the longitudes either side of the point’s meridian (lambda), +// and are the latitudes smaller than the parallel (phi)? +if(antimeridian^lambda0>=lambda^lambda1>=lambda){var arc=cartesianCross(cartesian(point0),cartesian(point1));cartesianNormalizeInPlace(arc);var intersection=cartesianCross(normal,arc);cartesianNormalizeInPlace(intersection);var phiArc=(antimeridian^delta>=0?-1:1)*asin$1(intersection[2]);if(phi>phiArc||phi===phiArc&&(arc[0]||arc[1])){winding+=antimeridian^delta>=0?1:-1;}}}}// First, determine whether the South pole is inside or outside: +// +// It is inside if: +// * the polygon winds around it in a clockwise direction. +// * the polygon does not (cumulatively) wind around it, but has a negative +// (counter-clockwise) area. +// +// Second, count the (signed) number of times a segment crosses a lambda +// from the point to the South pole. If it is zero, then the point is the +// same side as the South pole. +return(angle<-1e-6||angle<epsilon$3&&sum<-1e-12)^winding&1;}function clip$1(pointVisible,clipLine,interpolate,start){return function(sink){var line=clipLine(sink),ringBuffer=clipBuffer(),ringSink=clipLine(ringBuffer),polygonStarted=false,polygon,segments,ring;var clip={point:point,lineStart:lineStart,lineEnd:lineEnd,polygonStart:function polygonStart(){clip.point=pointRing;clip.lineStart=ringStart;clip.lineEnd=ringEnd;segments=[];polygon=[];},polygonEnd:function polygonEnd(){clip.point=point;clip.lineStart=lineStart;clip.lineEnd=lineEnd;segments=merge$2(segments);var startInside=polygonContains(polygon,start);if(segments.length){if(!polygonStarted)sink.polygonStart(),polygonStarted=true;clipRejoin(segments,compareIntersection,startInside,interpolate,sink);}else if(startInside){if(!polygonStarted)sink.polygonStart(),polygonStarted=true;sink.lineStart();interpolate(null,null,1,sink);sink.lineEnd();}if(polygonStarted)sink.polygonEnd(),polygonStarted=false;segments=polygon=null;},sphere:function sphere(){sink.polygonStart();sink.lineStart();interpolate(null,null,1,sink);sink.lineEnd();sink.polygonEnd();}};function point(lambda,phi){if(pointVisible(lambda,phi))sink.point(lambda,phi);}function pointLine(lambda,phi){line.point(lambda,phi);}function lineStart(){clip.point=pointLine;line.lineStart();}function lineEnd(){clip.point=point;line.lineEnd();}function pointRing(lambda,phi){ring.push([lambda,phi]);ringSink.point(lambda,phi);}function ringStart(){ringSink.lineStart();ring=[];}function ringEnd(){pointRing(ring[0][0],ring[0][1]);ringSink.lineEnd();var clean=ringSink.clean(),ringSegments=ringBuffer.result(),i,n=ringSegments.length,m,segment,point;ring.pop();polygon.push(ring);ring=null;if(!n)return;// No intersections. +if(clean&1){segment=ringSegments[0];if((m=segment.length-1)>0){if(!polygonStarted)sink.polygonStart(),polygonStarted=true;sink.lineStart();for(i=0;i<m;++i)sink.point((point=segment[i])[0],point[1]);sink.lineEnd();}return;}// Rejoin connected segments. +// TODO reuse ringBuffer.rejoin()? +if(n>1&&clean&2)ringSegments.push(ringSegments.pop().concat(ringSegments.shift()));segments.push(ringSegments.filter(validSegment));}return clip;};}function validSegment(segment){return segment.length>1;}// Intersections are sorted along the clip edge. For both antimeridian cutting +// and circle clipping, the same comparison is used. +function compareIntersection(a,b){return((a=a.x)[0]<0?a[1]-halfPi$1-epsilon$3:halfPi$1-a[1])-((b=b.x)[0]<0?b[1]-halfPi$1-epsilon$3:halfPi$1-b[1]);}var clipAntimeridian=clip$1(function(){return true;},clipAntimeridianLine,clipAntimeridianInterpolate,[-pi$1,-halfPi$1]);// Takes a line and cuts into visible segments. Return values: 0 - there were +// intersections or the line was empty; 1 - no intersections; 2 - there were +// intersections, and the first and last segments should be rejoined. +function clipAntimeridianLine(stream){var lambda0=NaN,phi0=NaN,sign0=NaN,_clean2;// no intersections +return{lineStart:function lineStart(){stream.lineStart();_clean2=1;},point:function point(lambda1,phi1){var sign1=lambda1>0?pi$1:-pi$1,delta=abs$1(lambda1-lambda0);if(abs$1(delta-pi$1)<epsilon$3){// line crosses a pole +stream.point(lambda0,phi0=(phi0+phi1)/2>0?halfPi$1:-halfPi$1);stream.point(sign0,phi0);stream.lineEnd();stream.lineStart();stream.point(sign1,phi0);stream.point(lambda1,phi0);_clean2=0;}else if(sign0!==sign1&&delta>=pi$1){// line crosses antimeridian +if(abs$1(lambda0-sign0)<epsilon$3)lambda0-=sign0*epsilon$3;// handle degeneracies +if(abs$1(lambda1-sign1)<epsilon$3)lambda1-=sign1*epsilon$3;phi0=clipAntimeridianIntersect(lambda0,phi0,lambda1,phi1);stream.point(sign0,phi0);stream.lineEnd();stream.lineStart();stream.point(sign1,phi0);_clean2=0;}stream.point(lambda0=lambda1,phi0=phi1);sign0=sign1;},lineEnd:function lineEnd(){stream.lineEnd();lambda0=phi0=NaN;},clean:function clean(){return 2-_clean2;// if intersections, rejoin first and last segments +}};}function clipAntimeridianIntersect(lambda0,phi0,lambda1,phi1){var cosPhi0,cosPhi1,sinLambda0Lambda1=sin$1(lambda0-lambda1);return abs$1(sinLambda0Lambda1)>epsilon$3?atan((sin$1(phi0)*(cosPhi1=cos$1(phi1))*sin$1(lambda1)-sin$1(phi1)*(cosPhi0=cos$1(phi0))*sin$1(lambda0))/(cosPhi0*cosPhi1*sinLambda0Lambda1)):(phi0+phi1)/2;}function clipAntimeridianInterpolate(from,to,direction,stream){var phi;if(from==null){phi=direction*halfPi$1;stream.point(-pi$1,phi);stream.point(0,phi);stream.point(pi$1,phi);stream.point(pi$1,0);stream.point(pi$1,-phi);stream.point(0,-phi);stream.point(-pi$1,-phi);stream.point(-pi$1,0);stream.point(-pi$1,phi);}else if(abs$1(from[0]-to[0])>epsilon$3){var lambda=from[0]<to[0]?pi$1:-pi$1;phi=direction*lambda/2;stream.point(-lambda,phi);stream.point(0,phi);stream.point(lambda,phi);}else{stream.point(to[0],to[1]);}}function clipCircle(radius){var cr=cos$1(radius),delta=2*radians,smallRadius=cr>0,notHemisphere=abs$1(cr)>epsilon$3;// TODO optimise for this common case +function interpolate(from,to,direction,stream){circleStream(stream,radius,delta,direction,from,to);}function visible(lambda,phi){return cos$1(lambda)*cos$1(phi)>cr;}// Takes a line and cuts into visible segments. Return values used for polygon +// clipping: 0 - there were intersections or the line was empty; 1 - no +// intersections 2 - there were intersections, and the first and last segments +// should be rejoined. +function clipLine(stream){var point0,// previous point +c0,// code for previous point +v0,// visibility of previous point +v00,// visibility of first point +_clean3;// no intersections +return{lineStart:function lineStart(){v00=v0=false;_clean3=1;},point:function point(lambda,phi){var point1=[lambda,phi],point2,v=visible(lambda,phi),c=smallRadius?v?0:code(lambda,phi):v?code(lambda+(lambda<0?pi$1:-pi$1),phi):0;if(!point0&&(v00=v0=v))stream.lineStart();if(v!==v0){point2=intersect(point0,point1);if(!point2||pointEqual(point0,point2)||pointEqual(point1,point2))point1[2]=1;}if(v!==v0){_clean3=0;if(v){// outside going in +stream.lineStart();point2=intersect(point1,point0);stream.point(point2[0],point2[1]);}else{// inside going out +point2=intersect(point0,point1);stream.point(point2[0],point2[1],2);stream.lineEnd();}point0=point2;}else if(notHemisphere&&point0&&smallRadius^v){var t;// If the codes for two points are different, or are both zero, +// and there this segment intersects with the small circle. +if(!(c&c0)&&(t=intersect(point1,point0,true))){_clean3=0;if(smallRadius){stream.lineStart();stream.point(t[0][0],t[0][1]);stream.point(t[1][0],t[1][1]);stream.lineEnd();}else{stream.point(t[1][0],t[1][1]);stream.lineEnd();stream.lineStart();stream.point(t[0][0],t[0][1],3);}}}if(v&&(!point0||!pointEqual(point0,point1))){stream.point(point1[0],point1[1]);}point0=point1,v0=v,c0=c;},lineEnd:function lineEnd(){if(v0)stream.lineEnd();point0=null;},// Rejoin first and last segments if there were intersections and the first +// and last points were visible. +clean:function clean(){return _clean3|(v00&&v0)<<1;}};}// Intersects the great circle between a and b with the clip circle. +function intersect(a,b,two){var pa=cartesian(a),pb=cartesian(b);// We have two planes, n1.p = d1 and n2.p = d2. +// Find intersection line p(t) = c1 n1 + c2 n2 + t (n1 ⨯ n2). +var n1=[1,0,0],// normal +n2=cartesianCross(pa,pb),n2n2=cartesianDot(n2,n2),n1n2=n2[0],// cartesianDot(n1, n2), +determinant=n2n2-n1n2*n1n2;// Two polar points. +if(!determinant)return!two&&a;var c1=cr*n2n2/determinant,c2=-cr*n1n2/determinant,n1xn2=cartesianCross(n1,n2),A=cartesianScale(n1,c1),B=cartesianScale(n2,c2);cartesianAddInPlace(A,B);// Solve |p(t)|^2 = 1. +var u=n1xn2,w=cartesianDot(A,u),uu=cartesianDot(u,u),t2=w*w-uu*(cartesianDot(A,A)-1);if(t2<0)return;var t=sqrt$1(t2),q=cartesianScale(u,(-w-t)/uu);cartesianAddInPlace(q,A);q=spherical(q);if(!two)return q;// Two intersection points. +var lambda0=a[0],lambda1=b[0],phi0=a[1],phi1=b[1],z;if(lambda1<lambda0)z=lambda0,lambda0=lambda1,lambda1=z;var delta=lambda1-lambda0,polar=abs$1(delta-pi$1)<epsilon$3,meridian=polar||delta<epsilon$3;if(!polar&&phi1<phi0)z=phi0,phi0=phi1,phi1=z;// Check that the first point is between a and b. +if(meridian?polar?phi0+phi1>0^q[1]<(abs$1(q[0]-lambda0)<epsilon$3?phi0:phi1):phi0<=q[1]&&q[1]<=phi1:delta>pi$1^(lambda0<=q[0]&&q[0]<=lambda1)){var q1=cartesianScale(u,(-w+t)/uu);cartesianAddInPlace(q1,A);return[q,spherical(q1)];}}// Generates a 4-bit vector representing the location of a point relative to +// the small circle's bounding box. +function code(lambda,phi){var r=smallRadius?radius:pi$1-radius,code=0;if(lambda<-r)code|=1;// left +else if(lambda>r)code|=2;// right +if(phi<-r)code|=4;// below +else if(phi>r)code|=8;// above +return code;}return clip$1(visible,clipLine,interpolate,smallRadius?[0,-radius]:[-pi$1,radius-pi$1]);}function clipLine(a,b,x0,y0,x1,y1){var ax=a[0],ay=a[1],bx=b[0],by=b[1],t0=0,t1=1,dx=bx-ax,dy=by-ay,r;r=x0-ax;if(!dx&&r>0)return;r/=dx;if(dx<0){if(r<t0)return;if(r<t1)t1=r;}else if(dx>0){if(r>t1)return;if(r>t0)t0=r;}r=x1-ax;if(!dx&&r<0)return;r/=dx;if(dx<0){if(r>t1)return;if(r>t0)t0=r;}else if(dx>0){if(r<t0)return;if(r<t1)t1=r;}r=y0-ay;if(!dy&&r>0)return;r/=dy;if(dy<0){if(r<t0)return;if(r<t1)t1=r;}else if(dy>0){if(r>t1)return;if(r>t0)t0=r;}r=y1-ay;if(!dy&&r<0)return;r/=dy;if(dy<0){if(r>t1)return;if(r>t0)t0=r;}else if(dy>0){if(r<t0)return;if(r<t1)t1=r;}if(t0>0)a[0]=ax+t0*dx,a[1]=ay+t0*dy;if(t1<1)b[0]=ax+t1*dx,b[1]=ay+t1*dy;return true;}var clipMax=1e9,clipMin=-1e9;// TODO Use d3-polygon’s polygonContains here for the ring check? +// TODO Eliminate duplicate buffering in clipBuffer and polygon.push? +function clipRectangle(x0,y0,x1,y1){function visible(x,y){return x0<=x&&x<=x1&&y0<=y&&y<=y1;}function interpolate(from,to,direction,stream){var a=0,a1=0;if(from==null||(a=corner(from,direction))!==(a1=corner(to,direction))||comparePoint(from,to)<0^direction>0){do stream.point(a===0||a===3?x0:x1,a>1?y1:y0);while((a=(a+direction+4)%4)!==a1);}else{stream.point(to[0],to[1]);}}function corner(p,direction){return abs$1(p[0]-x0)<epsilon$3?direction>0?0:3:abs$1(p[0]-x1)<epsilon$3?direction>0?2:1:abs$1(p[1]-y0)<epsilon$3?direction>0?1:0:direction>0?3:2;// abs(p[1] - y1) < epsilon +}function compareIntersection(a,b){return comparePoint(a.x,b.x);}function comparePoint(a,b){var ca=corner(a,1),cb=corner(b,1);return ca!==cb?ca-cb:ca===0?b[1]-a[1]:ca===1?a[0]-b[0]:ca===2?a[1]-b[1]:b[0]-a[0];}return function(stream){var activeStream=stream,bufferStream=clipBuffer(),segments,polygon,ring,x__,y__,v__,// first point +x_,y_,v_,// previous point +first,clean;var clipStream={point:point,lineStart:lineStart,lineEnd:lineEnd,polygonStart:polygonStart,polygonEnd:polygonEnd};function point(x,y){if(visible(x,y))activeStream.point(x,y);}function polygonInside(){var winding=0;for(var i=0,n=polygon.length;i<n;++i){for(var ring=polygon[i],j=1,m=ring.length,point=ring[0],a0,a1,b0=point[0],b1=point[1];j<m;++j){a0=b0,a1=b1,point=ring[j],b0=point[0],b1=point[1];if(a1<=y1){if(b1>y1&&(b0-a0)*(y1-a1)>(b1-a1)*(x0-a0))++winding;}else{if(b1<=y1&&(b0-a0)*(y1-a1)<(b1-a1)*(x0-a0))--winding;}}}return winding;}// Buffer geometry within a polygon and then clip it en masse. +function polygonStart(){activeStream=bufferStream,segments=[],polygon=[],clean=true;}function polygonEnd(){var startInside=polygonInside(),cleanInside=clean&&startInside,visible=(segments=merge$2(segments)).length;if(cleanInside||visible){stream.polygonStart();if(cleanInside){stream.lineStart();interpolate(null,null,1,stream);stream.lineEnd();}if(visible){clipRejoin(segments,compareIntersection,startInside,interpolate,stream);}stream.polygonEnd();}activeStream=stream,segments=polygon=ring=null;}function lineStart(){clipStream.point=linePoint;if(polygon)polygon.push(ring=[]);first=true;v_=false;x_=y_=NaN;}// TODO rather than special-case polygons, simply handle them separately. +// Ideally, coincident intersection points should be jittered to avoid +// clipping issues. +function lineEnd(){if(segments){linePoint(x__,y__);if(v__&&v_)bufferStream.rejoin();segments.push(bufferStream.result());}clipStream.point=point;if(v_)activeStream.lineEnd();}function linePoint(x,y){var v=visible(x,y);if(polygon)ring.push([x,y]);if(first){x__=x,y__=y,v__=v;first=false;if(v){activeStream.lineStart();activeStream.point(x,y);}}else{if(v&&v_)activeStream.point(x,y);else{var a=[x_=Math.max(clipMin,Math.min(clipMax,x_)),y_=Math.max(clipMin,Math.min(clipMax,y_))],b=[x=Math.max(clipMin,Math.min(clipMax,x)),y=Math.max(clipMin,Math.min(clipMax,y))];if(clipLine(a,b,x0,y0,x1,y1)){if(!v_){activeStream.lineStart();activeStream.point(a[0],a[1]);}activeStream.point(b[0],b[1]);if(!v)activeStream.lineEnd();clean=false;}else if(v){activeStream.lineStart();activeStream.point(x,y);clean=false;}}}x_=x,y_=y,v_=v;}return clipStream;};}function graticuleX(y0,y1,dy){var y=range$3(y0,y1-epsilon$3,dy).concat(y1);return function(x){return y.map(function(y){return[x,y];});};}function graticuleY(x0,x1,dx){var x=range$3(x0,x1-epsilon$3,dx).concat(x1);return function(y){return x.map(function(x){return[x,y];});};}function graticule(){var x1,x0,X1,X0,y1,y0,Y1,Y0,dx=10,dy=dx,DX=90,DY=360,x,y,X,Y,precision=2.5;function graticule(){return{type:"MultiLineString",coordinates:lines()};}function lines(){return range$3(ceil(X0/DX)*DX,X1,DX).map(X).concat(range$3(ceil(Y0/DY)*DY,Y1,DY).map(Y)).concat(range$3(ceil(x0/dx)*dx,x1,dx).filter(function(x){return abs$1(x%DX)>epsilon$3;}).map(x)).concat(range$3(ceil(y0/dy)*dy,y1,dy).filter(function(y){return abs$1(y%DY)>epsilon$3;}).map(y));}graticule.lines=function(){return lines().map(function(coordinates){return{type:"LineString",coordinates:coordinates};});};graticule.outline=function(){return{type:"Polygon",coordinates:[X(X0).concat(Y(Y1).slice(1),X(X1).reverse().slice(1),Y(Y0).reverse().slice(1))]};};graticule.extent=function(_){if(!arguments.length)return graticule.extentMinor();return graticule.extentMajor(_).extentMinor(_);};graticule.extentMajor=function(_){if(!arguments.length)return[[X0,Y0],[X1,Y1]];X0=+_[0][0],X1=+_[1][0];Y0=+_[0][1],Y1=+_[1][1];if(X0>X1)_=X0,X0=X1,X1=_;if(Y0>Y1)_=Y0,Y0=Y1,Y1=_;return graticule.precision(precision);};graticule.extentMinor=function(_){if(!arguments.length)return[[x0,y0],[x1,y1]];x0=+_[0][0],x1=+_[1][0];y0=+_[0][1],y1=+_[1][1];if(x0>x1)_=x0,x0=x1,x1=_;if(y0>y1)_=y0,y0=y1,y1=_;return graticule.precision(precision);};graticule.step=function(_){if(!arguments.length)return graticule.stepMinor();return graticule.stepMajor(_).stepMinor(_);};graticule.stepMajor=function(_){if(!arguments.length)return[DX,DY];DX=+_[0],DY=+_[1];return graticule;};graticule.stepMinor=function(_){if(!arguments.length)return[dx,dy];dx=+_[0],dy=+_[1];return graticule;};graticule.precision=function(_){if(!arguments.length)return precision;precision=+_;x=graticuleX(y0,y1,90);y=graticuleY(x0,x1,precision);X=graticuleX(Y0,Y1,90);Y=graticuleY(X0,X1,precision);return graticule;};return graticule.extentMajor([[-180,-90+epsilon$3],[180,90-epsilon$3]]).extentMinor([[-180,-80-epsilon$3],[180,80+epsilon$3]]);}var identity=function identity(x){return x;};var areaSum=new Adder(),areaRingSum=new Adder(),x00$2,y00$2,x0$3,y0$3;var areaStream={point:noop$2,lineStart:noop$2,lineEnd:noop$2,polygonStart:function polygonStart(){areaStream.lineStart=areaRingStart;areaStream.lineEnd=areaRingEnd;},polygonEnd:function polygonEnd(){areaStream.lineStart=areaStream.lineEnd=areaStream.point=noop$2;areaSum.add(abs$1(areaRingSum));areaRingSum=new Adder();},result:function result(){var area=areaSum/2;areaSum=new Adder();return area;}};function areaRingStart(){areaStream.point=areaPointFirst;}function areaPointFirst(x,y){areaStream.point=areaPoint;x00$2=x0$3=x,y00$2=y0$3=y;}function areaPoint(x,y){areaRingSum.add(y0$3*x-x0$3*y);x0$3=x,y0$3=y;}function areaRingEnd(){areaPoint(x00$2,y00$2);}var x0$2=Infinity,y0$2=x0$2,x1=-x0$2,y1=x1;var boundsStream={point:boundsPoint,lineStart:noop$2,lineEnd:noop$2,polygonStart:noop$2,polygonEnd:noop$2,result:function result(){var bounds=[[x0$2,y0$2],[x1,y1]];x1=y1=-(y0$2=x0$2=Infinity);return bounds;}};function boundsPoint(x,y){if(x<x0$2)x0$2=x;if(x>x1)x1=x;if(y<y0$2)y0$2=y;if(y>y1)y1=y;}// TODO Enforce positive area for exterior, negative area for interior? +var X0=0,Y0=0,Z0=0,X1=0,Y1=0,Z1=0,X2=0,Y2=0,Z2=0,x00$1,y00$1,x0$1,y0$1;var centroidStream={point:centroidPoint,lineStart:centroidLineStart,lineEnd:centroidLineEnd,polygonStart:function polygonStart(){centroidStream.lineStart=centroidRingStart;centroidStream.lineEnd=centroidRingEnd;},polygonEnd:function polygonEnd(){centroidStream.point=centroidPoint;centroidStream.lineStart=centroidLineStart;centroidStream.lineEnd=centroidLineEnd;},result:function result(){var centroid=Z2?[X2/Z2,Y2/Z2]:Z1?[X1/Z1,Y1/Z1]:Z0?[X0/Z0,Y0/Z0]:[NaN,NaN];X0=Y0=Z0=X1=Y1=Z1=X2=Y2=Z2=0;return centroid;}};function centroidPoint(x,y){X0+=x;Y0+=y;++Z0;}function centroidLineStart(){centroidStream.point=centroidPointFirstLine;}function centroidPointFirstLine(x,y){centroidStream.point=centroidPointLine;centroidPoint(x0$1=x,y0$1=y);}function centroidPointLine(x,y){var dx=x-x0$1,dy=y-y0$1,z=sqrt$1(dx*dx+dy*dy);X1+=z*(x0$1+x)/2;Y1+=z*(y0$1+y)/2;Z1+=z;centroidPoint(x0$1=x,y0$1=y);}function centroidLineEnd(){centroidStream.point=centroidPoint;}function centroidRingStart(){centroidStream.point=centroidPointFirstRing;}function centroidRingEnd(){centroidPointRing(x00$1,y00$1);}function centroidPointFirstRing(x,y){centroidStream.point=centroidPointRing;centroidPoint(x00$1=x0$1=x,y00$1=y0$1=y);}function centroidPointRing(x,y){var dx=x-x0$1,dy=y-y0$1,z=sqrt$1(dx*dx+dy*dy);X1+=z*(x0$1+x)/2;Y1+=z*(y0$1+y)/2;Z1+=z;z=y0$1*x-x0$1*y;X2+=z*(x0$1+x);Y2+=z*(y0$1+y);Z2+=z*3;centroidPoint(x0$1=x,y0$1=y);}function PathContext(context){this._context=context;}PathContext.prototype={_radius:4.5,pointRadius:function pointRadius(_){return this._radius=_,this;},polygonStart:function polygonStart(){this._line=0;},polygonEnd:function polygonEnd(){this._line=NaN;},lineStart:function lineStart(){this._point=0;},lineEnd:function lineEnd(){if(this._line===0)this._context.closePath();this._point=NaN;},point:function point(x,y){switch(this._point){case 0:{this._context.moveTo(x,y);this._point=1;break;}case 1:{this._context.lineTo(x,y);break;}default:{this._context.moveTo(x+this._radius,y);this._context.arc(x,y,this._radius,0,tau$1);break;}}},result:noop$2};var lengthSum=new Adder(),lengthRing,x00,y00,x0,y0;var lengthStream={point:noop$2,lineStart:function lineStart(){lengthStream.point=lengthPointFirst;},lineEnd:function lineEnd(){if(lengthRing)lengthPoint(x00,y00);lengthStream.point=noop$2;},polygonStart:function polygonStart(){lengthRing=true;},polygonEnd:function polygonEnd(){lengthRing=null;},result:function result(){var length=+lengthSum;lengthSum=new Adder();return length;}};function lengthPointFirst(x,y){lengthStream.point=lengthPoint;x00=x0=x,y00=y0=y;}function lengthPoint(x,y){x0-=x,y0-=y;lengthSum.add(sqrt$1(x0*x0+y0*y0));x0=x,y0=y;}// Simple caching for constant-radius points. +var cacheDigits,cacheAppend,cacheRadius,cacheCircle;var PathString=/*#__PURE__*/function(){function PathString(digits){_classCallCheck(this,PathString);this._append=digits==null?append:appendRound(digits);this._radius=4.5;this._="";}return _createClass(PathString,[{key:"pointRadius",value:function pointRadius(_){this._radius=+_;return this;}},{key:"polygonStart",value:function polygonStart(){this._line=0;}},{key:"polygonEnd",value:function polygonEnd(){this._line=NaN;}},{key:"lineStart",value:function lineStart(){this._point=0;}},{key:"lineEnd",value:function lineEnd(){if(this._line===0)this._+="Z";this._point=NaN;}},{key:"point",value:function point(x,y){switch(this._point){case 0:{this._append(_templateObject13||(_templateObject13=_taggedTemplateLiteral(["M",",",""])),x,y);this._point=1;break;}case 1:{this._append(_templateObject14||(_templateObject14=_taggedTemplateLiteral(["L",",",""])),x,y);break;}default:{this._append(_templateObject15||(_templateObject15=_taggedTemplateLiteral(["M",",",""])),x,y);if(this._radius!==cacheRadius||this._append!==cacheAppend){var r=this._radius;var s=this._;this._="";// stash the old string so we can cache the circle path fragment +this._append(_templateObject16||(_templateObject16=_taggedTemplateLiteral(["m0,","a",","," 0 1,1 0,","a",","," 0 1,1 0,","z"])),r,r,r,-2*r,r,r,2*r);cacheRadius=r;cacheAppend=this._append;cacheCircle=this._;this._=s;}this._+=cacheCircle;break;}}}},{key:"result",value:function result(){var result=this._;this._="";return result.length?result:null;}}]);}();function append(strings){var i=1;this._+=strings[0];for(var j=strings.length;i<j;++i){this._+=arguments[i]+strings[i];}}function appendRound(digits){var d=Math.floor(digits);if(!(d>=0))throw new RangeError("invalid digits: ".concat(digits));if(d>15)return append;if(d!==cacheDigits){var k=Math.pow(10,d);cacheDigits=d;cacheAppend=function append(strings){var i=1;this._+=strings[0];for(var j=strings.length;i<j;++i){this._+=Math.round(arguments[i]*k)/k+strings[i];}};}return cacheAppend;}function geoPath(projection,context){var digits=3,pointRadius=4.5,projectionStream,contextStream;function path(object){if(object){if(typeof pointRadius==="function")contextStream.pointRadius(+pointRadius.apply(this,arguments));geoStream(object,projectionStream(contextStream));}return contextStream.result();}path.area=function(object){geoStream(object,projectionStream(areaStream));return areaStream.result();};path.measure=function(object){geoStream(object,projectionStream(lengthStream));return lengthStream.result();};path.bounds=function(object){geoStream(object,projectionStream(boundsStream));return boundsStream.result();};path.centroid=function(object){geoStream(object,projectionStream(centroidStream));return centroidStream.result();};path.projection=function(_){if(!arguments.length)return projection;projectionStream=_==null?(projection=null,identity):(projection=_).stream;return path;};path.context=function(_){if(!arguments.length)return context;contextStream=_==null?(context=null,new PathString(digits)):new PathContext(context=_);if(typeof pointRadius!=="function")contextStream.pointRadius(pointRadius);return path;};path.pointRadius=function(_){if(!arguments.length)return pointRadius;pointRadius=typeof _==="function"?_:(contextStream.pointRadius(+_),+_);return path;};path.digits=function(_){if(!arguments.length)return digits;if(_==null)digits=null;else{var d=Math.floor(_);if(!(d>=0))throw new RangeError("invalid digits: ".concat(_));digits=d;}if(context===null)contextStream=new PathString(digits);return path;};return path.projection(projection).digits(digits).context(context);}function transformer(methods){return function(stream){var s=new TransformStream();for(var key in methods)s[key]=methods[key];s.stream=stream;return s;};}function TransformStream(){}TransformStream.prototype={constructor:TransformStream,point:function point(x,y){this.stream.point(x,y);},sphere:function sphere(){this.stream.sphere();},lineStart:function lineStart(){this.stream.lineStart();},lineEnd:function lineEnd(){this.stream.lineEnd();},polygonStart:function polygonStart(){this.stream.polygonStart();},polygonEnd:function polygonEnd(){this.stream.polygonEnd();}};function fit$1(projection,fitBounds,object){var clip=projection.clipExtent&&projection.clipExtent();projection.scale(150).translate([0,0]);if(clip!=null)projection.clipExtent(null);geoStream(object,projection.stream(boundsStream));fitBounds(boundsStream.result());if(clip!=null)projection.clipExtent(clip);return projection;}function fitExtent(projection,extent,object){return fit$1(projection,function(b){var w=extent[1][0]-extent[0][0],h=extent[1][1]-extent[0][1],k=Math.min(w/(b[1][0]-b[0][0]),h/(b[1][1]-b[0][1])),x=+extent[0][0]+(w-k*(b[1][0]+b[0][0]))/2,y=+extent[0][1]+(h-k*(b[1][1]+b[0][1]))/2;projection.scale(150*k).translate([x,y]);},object);}function fitSize(projection,size,object){return fitExtent(projection,[[0,0],size],object);}function fitWidth(projection,width,object){return fit$1(projection,function(b){var w=+width,k=w/(b[1][0]-b[0][0]),x=(w-k*(b[1][0]+b[0][0]))/2,y=-k*b[0][1];projection.scale(150*k).translate([x,y]);},object);}function fitHeight(projection,height,object){return fit$1(projection,function(b){var h=+height,k=h/(b[1][1]-b[0][1]),x=-k*b[0][0],y=(h-k*(b[1][1]+b[0][1]))/2;projection.scale(150*k).translate([x,y]);},object);}var maxDepth=16,// maximum depth of subdivision +cosMinDistance=cos$1(30*radians);// cos(minimum angular distance) +function resample(project,delta2){return+delta2?resample$1(project,delta2):resampleNone(project);}function resampleNone(project){return transformer({point:function point(x,y){x=project(x,y);this.stream.point(x[0],x[1]);}});}function resample$1(project,delta2){function resampleLineTo(x0,y0,lambda0,a0,b0,c0,x1,y1,lambda1,a1,b1,c1,depth,stream){var dx=x1-x0,dy=y1-y0,d2=dx*dx+dy*dy;if(d2>4*delta2&&depth--){var a=a0+a1,b=b0+b1,c=c0+c1,m=sqrt$1(a*a+b*b+c*c),phi2=asin$1(c/=m),lambda2=abs$1(abs$1(c)-1)<epsilon$3||abs$1(lambda0-lambda1)<epsilon$3?(lambda0+lambda1)/2:atan2(b,a),p=project(lambda2,phi2),x2=p[0],y2=p[1],dx2=x2-x0,dy2=y2-y0,dz=dy*dx2-dx*dy2;if(dz*dz/d2>delta2// perpendicular projected distance +||abs$1((dx*dx2+dy*dy2)/d2-0.5)>0.3// midpoint close to an end +||a0*a1+b0*b1+c0*c1<cosMinDistance){// angular distance +resampleLineTo(x0,y0,lambda0,a0,b0,c0,x2,y2,lambda2,a/=m,b/=m,c,depth,stream);stream.point(x2,y2);resampleLineTo(x2,y2,lambda2,a,b,c,x1,y1,lambda1,a1,b1,c1,depth,stream);}}}return function(stream){var lambda00,x00,y00,a00,b00,c00,// first point +lambda0,x0,y0,a0,b0,c0;// previous point +var resampleStream={point:point,lineStart:lineStart,lineEnd:lineEnd,polygonStart:function polygonStart(){stream.polygonStart();resampleStream.lineStart=ringStart;},polygonEnd:function polygonEnd(){stream.polygonEnd();resampleStream.lineStart=lineStart;}};function point(x,y){x=project(x,y);stream.point(x[0],x[1]);}function lineStart(){x0=NaN;resampleStream.point=linePoint;stream.lineStart();}function linePoint(lambda,phi){var c=cartesian([lambda,phi]),p=project(lambda,phi);resampleLineTo(x0,y0,lambda0,a0,b0,c0,x0=p[0],y0=p[1],lambda0=lambda,a0=c[0],b0=c[1],c0=c[2],maxDepth,stream);stream.point(x0,y0);}function lineEnd(){resampleStream.point=point;stream.lineEnd();}function ringStart(){lineStart();resampleStream.point=ringPoint;resampleStream.lineEnd=ringEnd;}function ringPoint(lambda,phi){linePoint(lambda00=lambda,phi),x00=x0,y00=y0,a00=a0,b00=b0,c00=c0;resampleStream.point=linePoint;}function ringEnd(){resampleLineTo(x0,y0,lambda0,a0,b0,c0,x00,y00,lambda00,a00,b00,c00,maxDepth,stream);resampleStream.lineEnd=lineEnd;lineEnd();}return resampleStream;};}var transformRadians=transformer({point:function point(x,y){this.stream.point(x*radians,y*radians);}});function transformRotate(rotate){return transformer({point:function point(x,y){var r=rotate(x,y);return this.stream.point(r[0],r[1]);}});}function scaleTranslate(k,dx,dy,sx,sy){function transform(x,y){x*=sx;y*=sy;return[dx+k*x,dy-k*y];}transform.invert=function(x,y){return[(x-dx)/k*sx,(dy-y)/k*sy];};return transform;}function scaleTranslateRotate(k,dx,dy,sx,sy,alpha){if(!alpha)return scaleTranslate(k,dx,dy,sx,sy);var cosAlpha=cos$1(alpha),sinAlpha=sin$1(alpha),a=cosAlpha*k,b=sinAlpha*k,ai=cosAlpha/k,bi=sinAlpha/k,ci=(sinAlpha*dy-cosAlpha*dx)/k,fi=(sinAlpha*dx+cosAlpha*dy)/k;function transform(x,y){x*=sx;y*=sy;return[a*x-b*y+dx,dy-b*x-a*y];}transform.invert=function(x,y){return[sx*(ai*x-bi*y+ci),sy*(fi-bi*x-ai*y)];};return transform;}function projection$1(project){return projectionMutator(function(){return project;})();}function projectionMutator(projectAt){var project,k=150,// scale +x=480,y=250,// translate +lambda=0,phi=0,// center +deltaLambda=0,deltaPhi=0,deltaGamma=0,rotate,// pre-rotate +alpha=0,// post-rotate angle +sx=1,// reflectX +sy=1,// reflectX +theta=null,preclip=clipAntimeridian,// pre-clip angle +x0=null,y0,x1,y1,postclip=identity,// post-clip extent +delta2=0.5,// precision +projectResample,projectTransform,projectRotateTransform,cache,cacheStream;function projection(point){return projectRotateTransform(point[0]*radians,point[1]*radians);}function invert(point){point=projectRotateTransform.invert(point[0],point[1]);return point&&[point[0]*degrees,point[1]*degrees];}projection.stream=function(stream){return cache&&cacheStream===stream?cache:cache=transformRadians(transformRotate(rotate)(preclip(projectResample(postclip(cacheStream=stream)))));};projection.preclip=function(_){return arguments.length?(preclip=_,theta=undefined,reset()):preclip;};projection.postclip=function(_){return arguments.length?(postclip=_,x0=y0=x1=y1=null,reset()):postclip;};projection.clipAngle=function(_){return arguments.length?(preclip=+_?clipCircle(theta=_*radians):(theta=null,clipAntimeridian),reset()):theta*degrees;};projection.clipExtent=function(_){return arguments.length?(postclip=_==null?(x0=y0=x1=y1=null,identity):clipRectangle(x0=+_[0][0],y0=+_[0][1],x1=+_[1][0],y1=+_[1][1]),reset()):x0==null?null:[[x0,y0],[x1,y1]];};projection.scale=function(_){return arguments.length?(k=+_,recenter()):k;};projection.translate=function(_){return arguments.length?(x=+_[0],y=+_[1],recenter()):[x,y];};projection.center=function(_){return arguments.length?(lambda=_[0]%360*radians,phi=_[1]%360*radians,recenter()):[lambda*degrees,phi*degrees];};projection.rotate=function(_){return arguments.length?(deltaLambda=_[0]%360*radians,deltaPhi=_[1]%360*radians,deltaGamma=_.length>2?_[2]%360*radians:0,recenter()):[deltaLambda*degrees,deltaPhi*degrees,deltaGamma*degrees];};projection.angle=function(_){return arguments.length?(alpha=_%360*radians,recenter()):alpha*degrees;};projection.reflectX=function(_){return arguments.length?(sx=_?-1:1,recenter()):sx<0;};projection.reflectY=function(_){return arguments.length?(sy=_?-1:1,recenter()):sy<0;};projection.precision=function(_){return arguments.length?(projectResample=resample(projectTransform,delta2=_*_),reset()):sqrt$1(delta2);};projection.fitExtent=function(extent,object){return fitExtent(projection,extent,object);};projection.fitSize=function(size,object){return fitSize(projection,size,object);};projection.fitWidth=function(width,object){return fitWidth(projection,width,object);};projection.fitHeight=function(height,object){return fitHeight(projection,height,object);};function recenter(){var center=scaleTranslateRotate(k,0,0,sx,sy,alpha).apply(null,project(lambda,phi)),transform=scaleTranslateRotate(k,x-center[0],y-center[1],sx,sy,alpha);rotate=rotateRadians(deltaLambda,deltaPhi,deltaGamma);projectTransform=compose(project,transform);projectRotateTransform=compose(rotate,projectTransform);projectResample=resample(projectTransform,delta2);return reset();}function reset(){cache=cacheStream=null;return projection;}return function(){project=projectAt.apply(this,arguments);projection.invert=project.invert&&invert;return recenter();};}function conicProjection(projectAt){var phi0=0,phi1=pi$1/3,m=projectionMutator(projectAt),p=m(phi0,phi1);p.parallels=function(_){return arguments.length?m(phi0=_[0]*radians,phi1=_[1]*radians):[phi0*degrees,phi1*degrees];};return p;}function cylindricalEqualAreaRaw(phi0){var cosPhi0=cos$1(phi0);function forward(lambda,phi){return[lambda*cosPhi0,sin$1(phi)/cosPhi0];}forward.invert=function(x,y){return[x/cosPhi0,asin$1(y*cosPhi0)];};return forward;}function conicEqualAreaRaw(y0,y1){var sy0=sin$1(y0),n=(sy0+sin$1(y1))/2;// Are the parallels symmetrical around the Equator? +if(abs$1(n)<epsilon$3)return cylindricalEqualAreaRaw(y0);var c=1+sy0*(2*n-sy0),r0=sqrt$1(c)/n;function project(x,y){var r=sqrt$1(c-2*n*sin$1(y))/n;return[r*sin$1(x*=n),r0-r*cos$1(x)];}project.invert=function(x,y){var r0y=r0-y,l=atan2(x,abs$1(r0y))*sign(r0y);if(r0y*n<0)l-=pi$1*sign(x)*sign(r0y);return[l/n,asin$1((c-(x*x+r0y*r0y)*n*n)/(2*n))];};return project;}function geoConicEqualArea(){return conicProjection(conicEqualAreaRaw).scale(155.424).center([0,33.6442]);}function geoAlbers(){return geoConicEqualArea().parallels([29.5,45.5]).scale(1070).translate([480,250]).rotate([96,0]).center([-0.6,38.7]);}// The projections must have mutually exclusive clip regions on the sphere, +// as this will avoid emitting interleaving lines and polygons. +function multiplex(streams){var n=streams.length;return{point:function point(x,y){var i=-1;while(++i<n)streams[i].point(x,y);},sphere:function sphere(){var i=-1;while(++i<n)streams[i].sphere();},lineStart:function lineStart(){var i=-1;while(++i<n)streams[i].lineStart();},lineEnd:function lineEnd(){var i=-1;while(++i<n)streams[i].lineEnd();},polygonStart:function polygonStart(){var i=-1;while(++i<n)streams[i].polygonStart();},polygonEnd:function polygonEnd(){var i=-1;while(++i<n)streams[i].polygonEnd();}};}// A composite projection for the United States, configured by default for +// 960×500. The projection also works quite well at 960×600 if you change the +// scale to 1285 and adjust the translate accordingly. The set of standard +// parallels for each region comes from USGS, which is published here: +// http://egsc.usgs.gov/isb/pubs/MapProjections/projections.html#albers +function geoAlbersUsa(){var cache,cacheStream,lower48=geoAlbers(),lower48Point,alaska=geoConicEqualArea().rotate([154,0]).center([-2,58.5]).parallels([55,65]),alaskaPoint,// EPSG:3338 +hawaii=geoConicEqualArea().rotate([157,0]).center([-3,19.9]).parallels([8,18]),hawaiiPoint,// ESRI:102007 +_point,pointStream={point:function point(x,y){_point=[x,y];}};function albersUsa(coordinates){var x=coordinates[0],y=coordinates[1];return _point=null,(lower48Point.point(x,y),_point)||(alaskaPoint.point(x,y),_point)||(hawaiiPoint.point(x,y),_point);}albersUsa.invert=function(coordinates){var k=lower48.scale(),t=lower48.translate(),x=(coordinates[0]-t[0])/k,y=(coordinates[1]-t[1])/k;return(y>=0.120&&y<0.234&&x>=-0.425&&x<-0.214?alaska:y>=0.166&&y<0.234&&x>=-0.214&&x<-0.115?hawaii:lower48).invert(coordinates);};albersUsa.stream=function(stream){return cache&&cacheStream===stream?cache:cache=multiplex([lower48.stream(cacheStream=stream),alaska.stream(stream),hawaii.stream(stream)]);};albersUsa.precision=function(_){if(!arguments.length)return lower48.precision();lower48.precision(_),alaska.precision(_),hawaii.precision(_);return reset();};albersUsa.scale=function(_){if(!arguments.length)return lower48.scale();lower48.scale(_),alaska.scale(_*0.35),hawaii.scale(_);return albersUsa.translate(lower48.translate());};albersUsa.translate=function(_){if(!arguments.length)return lower48.translate();var k=lower48.scale(),x=+_[0],y=+_[1];lower48Point=lower48.translate(_).clipExtent([[x-0.455*k,y-0.238*k],[x+0.455*k,y+0.238*k]]).stream(pointStream);alaskaPoint=alaska.translate([x-0.307*k,y+0.201*k]).clipExtent([[x-0.425*k+epsilon$3,y+0.120*k+epsilon$3],[x-0.214*k-epsilon$3,y+0.234*k-epsilon$3]]).stream(pointStream);hawaiiPoint=hawaii.translate([x-0.205*k,y+0.212*k]).clipExtent([[x-0.214*k+epsilon$3,y+0.166*k+epsilon$3],[x-0.115*k-epsilon$3,y+0.234*k-epsilon$3]]).stream(pointStream);return reset();};albersUsa.fitExtent=function(extent,object){return fitExtent(albersUsa,extent,object);};albersUsa.fitSize=function(size,object){return fitSize(albersUsa,size,object);};albersUsa.fitWidth=function(width,object){return fitWidth(albersUsa,width,object);};albersUsa.fitHeight=function(height,object){return fitHeight(albersUsa,height,object);};function reset(){cache=cacheStream=null;return albersUsa;}return albersUsa.scale(1070);}function azimuthalRaw(scale){return function(x,y){var cx=cos$1(x),cy=cos$1(y),k=scale(cx*cy);if(k===Infinity)return[2,0];return[k*cy*sin$1(x),k*sin$1(y)];};}function azimuthalInvert(angle){return function(x,y){var z=sqrt$1(x*x+y*y),c=angle(z),sc=sin$1(c),cc=cos$1(c);return[atan2(x*sc,z*cc),asin$1(z&&y*sc/z)];};}var azimuthalEqualAreaRaw=azimuthalRaw(function(cxcy){return sqrt$1(2/(1+cxcy));});azimuthalEqualAreaRaw.invert=azimuthalInvert(function(z){return 2*asin$1(z/2);});function geoAzimuthalEqualArea(){return projection$1(azimuthalEqualAreaRaw).scale(124.75).clipAngle(180-1e-3);}var azimuthalEquidistantRaw=azimuthalRaw(function(c){return(c=acos(c))&&c/sin$1(c);});azimuthalEquidistantRaw.invert=azimuthalInvert(function(z){return z;});function geoAzimuthalEquidistant(){return projection$1(azimuthalEquidistantRaw).scale(79.4188).clipAngle(180-1e-3);}function mercatorRaw(lambda,phi){return[lambda,log$1(tan((halfPi$1+phi)/2))];}mercatorRaw.invert=function(x,y){return[x,2*atan(exp(y))-halfPi$1];};function geoMercator(){return mercatorProjection(mercatorRaw).scale(961/tau$1);}function mercatorProjection(project){var m=projection$1(project),center=m.center,scale=m.scale,translate=m.translate,clipExtent=m.clipExtent,x0=null,y0,x1,y1;// clip extent +m.scale=function(_){return arguments.length?(scale(_),reclip()):scale();};m.translate=function(_){return arguments.length?(translate(_),reclip()):translate();};m.center=function(_){return arguments.length?(center(_),reclip()):center();};m.clipExtent=function(_){return arguments.length?(_==null?x0=y0=x1=y1=null:(x0=+_[0][0],y0=+_[0][1],x1=+_[1][0],y1=+_[1][1]),reclip()):x0==null?null:[[x0,y0],[x1,y1]];};function reclip(){var k=pi$1*scale(),t=m(rotation(m.rotate()).invert([0,0]));return clipExtent(x0==null?[[t[0]-k,t[1]-k],[t[0]+k,t[1]+k]]:project===mercatorRaw?[[Math.max(t[0]-k,x0),y0],[Math.min(t[0]+k,x1),y1]]:[[x0,Math.max(t[1]-k,y0)],[x1,Math.min(t[1]+k,y1)]]);}return reclip();}function tany(y){return tan((halfPi$1+y)/2);}function conicConformalRaw(y0,y1){var cy0=cos$1(y0),n=y0===y1?sin$1(y0):log$1(cy0/cos$1(y1))/log$1(tany(y1)/tany(y0)),f=cy0*pow$1(tany(y0),n)/n;if(!n)return mercatorRaw;function project(x,y){if(f>0){if(y<-halfPi$1+epsilon$3)y=-halfPi$1+epsilon$3;}else{if(y>halfPi$1-epsilon$3)y=halfPi$1-epsilon$3;}var r=f/pow$1(tany(y),n);return[r*sin$1(n*x),f-r*cos$1(n*x)];}project.invert=function(x,y){var fy=f-y,r=sign(n)*sqrt$1(x*x+fy*fy),l=atan2(x,abs$1(fy))*sign(fy);if(fy*n<0)l-=pi$1*sign(x)*sign(fy);return[l/n,2*atan(pow$1(f/r,1/n))-halfPi$1];};return project;}function geoConicConformal(){return conicProjection(conicConformalRaw).scale(109.5).parallels([30,30]);}function equirectangularRaw(lambda,phi){return[lambda,phi];}equirectangularRaw.invert=equirectangularRaw;function geoEquirectangular(){return projection$1(equirectangularRaw).scale(152.63);}function conicEquidistantRaw(y0,y1){var cy0=cos$1(y0),n=y0===y1?sin$1(y0):(cy0-cos$1(y1))/(y1-y0),g=cy0/n+y0;if(abs$1(n)<epsilon$3)return equirectangularRaw;function project(x,y){var gy=g-y,nx=n*x;return[gy*sin$1(nx),g-gy*cos$1(nx)];}project.invert=function(x,y){var gy=g-y,l=atan2(x,abs$1(gy))*sign(gy);if(gy*n<0)l-=pi$1*sign(x)*sign(gy);return[l/n,g-sign(n)*sqrt$1(x*x+gy*gy)];};return project;}function geoConicEquidistant(){return conicProjection(conicEquidistantRaw).scale(131.154).center([0,13.9389]);}var A1=1.340264,A2=-0.081106,A3=0.000893,A4=0.003796,M=sqrt$1(3)/2,iterations=12;function equalEarthRaw(lambda,phi){var l=asin$1(M*sin$1(phi)),l2=l*l,l6=l2*l2*l2;return[lambda*cos$1(l)/(M*(A1+3*A2*l2+l6*(7*A3+9*A4*l2))),l*(A1+A2*l2+l6*(A3+A4*l2))];}equalEarthRaw.invert=function(x,y){var l=y,l2=l*l,l6=l2*l2*l2;for(var i=0,delta,fy,fpy;i<iterations;++i){fy=l*(A1+A2*l2+l6*(A3+A4*l2))-y;fpy=A1+3*A2*l2+l6*(7*A3+9*A4*l2);l-=delta=fy/fpy,l2=l*l,l6=l2*l2*l2;if(abs$1(delta)<epsilon2)break;}return[M*x*(A1+3*A2*l2+l6*(7*A3+9*A4*l2))/cos$1(l),asin$1(sin$1(l)/M)];};function geoEqualEarth(){return projection$1(equalEarthRaw).scale(177.158);}function gnomonicRaw(x,y){var cy=cos$1(y),k=cos$1(x)*cy;return[cy*sin$1(x)/k,sin$1(y)/k];}gnomonicRaw.invert=azimuthalInvert(atan);function geoGnomonic(){return projection$1(gnomonicRaw).scale(144.049).clipAngle(60);}function geoIdentity(){var k=1,tx=0,ty=0,sx=1,sy=1,// scale, translate and reflect +alpha=0,ca,sa,// angle +x0=null,y0,x1,y1,// clip extent +kx=1,ky=1,transform=transformer({point:function point(x,y){var p=projection([x,y]);this.stream.point(p[0],p[1]);}}),postclip=identity,cache,cacheStream;function reset(){kx=k*sx;ky=k*sy;cache=cacheStream=null;return projection;}function projection(p){var x=p[0]*kx,y=p[1]*ky;if(alpha){var t=y*ca-x*sa;x=x*ca+y*sa;y=t;}return[x+tx,y+ty];}projection.invert=function(p){var x=p[0]-tx,y=p[1]-ty;if(alpha){var t=y*ca+x*sa;x=x*ca-y*sa;y=t;}return[x/kx,y/ky];};projection.stream=function(stream){return cache&&cacheStream===stream?cache:cache=transform(postclip(cacheStream=stream));};projection.postclip=function(_){return arguments.length?(postclip=_,x0=y0=x1=y1=null,reset()):postclip;};projection.clipExtent=function(_){return arguments.length?(postclip=_==null?(x0=y0=x1=y1=null,identity):clipRectangle(x0=+_[0][0],y0=+_[0][1],x1=+_[1][0],y1=+_[1][1]),reset()):x0==null?null:[[x0,y0],[x1,y1]];};projection.scale=function(_){return arguments.length?(k=+_,reset()):k;};projection.translate=function(_){return arguments.length?(tx=+_[0],ty=+_[1],reset()):[tx,ty];};projection.angle=function(_){return arguments.length?(alpha=_%360*radians,sa=sin$1(alpha),ca=cos$1(alpha),reset()):alpha*degrees;};projection.reflectX=function(_){return arguments.length?(sx=_?-1:1,reset()):sx<0;};projection.reflectY=function(_){return arguments.length?(sy=_?-1:1,reset()):sy<0;};projection.fitExtent=function(extent,object){return fitExtent(projection,extent,object);};projection.fitSize=function(size,object){return fitSize(projection,size,object);};projection.fitWidth=function(width,object){return fitWidth(projection,width,object);};projection.fitHeight=function(height,object){return fitHeight(projection,height,object);};return projection;}function naturalEarth1Raw(lambda,phi){var phi2=phi*phi,phi4=phi2*phi2;return[lambda*(0.8707-0.131979*phi2+phi4*(-0.013791+phi4*(0.003971*phi2-0.001529*phi4))),phi*(1.007226+phi2*(0.015085+phi4*(-0.044475+0.028874*phi2-0.005916*phi4)))];}naturalEarth1Raw.invert=function(x,y){var phi=y,i=25,delta;do{var phi2=phi*phi,phi4=phi2*phi2;phi-=delta=(phi*(1.007226+phi2*(0.015085+phi4*(-0.044475+0.028874*phi2-0.005916*phi4)))-y)/(1.007226+phi2*(0.015085*3+phi4*(-0.044475*7+0.028874*9*phi2-0.005916*11*phi4)));}while(abs$1(delta)>epsilon$3&&--i>0);return[x/(0.8707+(phi2=phi*phi)*(-0.131979+phi2*(-0.013791+phi2*phi2*phi2*(0.003971-0.001529*phi2)))),phi];};function geoNaturalEarth1(){return projection$1(naturalEarth1Raw).scale(175.295);}function orthographicRaw(x,y){return[cos$1(y)*sin$1(x),sin$1(y)];}orthographicRaw.invert=azimuthalInvert(asin$1);function geoOrthographic(){return projection$1(orthographicRaw).scale(249.5).clipAngle(90+epsilon$3);}function stereographicRaw(x,y){var cy=cos$1(y),k=1+cos$1(x)*cy;return[cy*sin$1(x)/k,sin$1(y)/k];}stereographicRaw.invert=azimuthalInvert(function(z){return 2*atan(z);});function geoStereographic(){return projection$1(stereographicRaw).scale(250).clipAngle(142);}function transverseMercatorRaw(lambda,phi){return[log$1(tan((halfPi$1+phi)/2)),-lambda];}transverseMercatorRaw.invert=function(x,y){return[-y,2*atan(exp(x))-halfPi$1];};function geoTransverseMercator(){var m=mercatorProjection(transverseMercatorRaw),center=m.center,rotate=m.rotate;m.center=function(_){return arguments.length?center([-_[1],_[0]]):(_=center(),[_[1],-_[0]]);};m.rotate=function(_){return arguments.length?rotate([_[0],_[1],_.length>2?_[2]+90:90]):(_=rotate(),[_[0],_[1],_[2]-90]);};return rotate([0,0,90]).scale(159.155);}var abs=Math.abs;var cos=Math.cos;var sin=Math.sin;var epsilon$2=1e-6;var pi=Math.PI;var halfPi=pi/2;var sqrt2=sqrt(2);function asin(x){return x>1?halfPi:x<-1?-halfPi:Math.asin(x);}function sqrt(x){return x>0?Math.sqrt(x):0;}function mollweideBromleyTheta(cp,phi){var cpsinPhi=cp*sin(phi),i=30,delta;do phi-=delta=(phi+sin(phi)-cpsinPhi)/(1+cos(phi));while(abs(delta)>epsilon$2&&--i>0);return phi/2;}function mollweideBromleyRaw(cx,cy,cp){function forward(lambda,phi){return[cx*lambda*cos(phi=mollweideBromleyTheta(cp,phi)),cy*sin(phi)];}forward.invert=function(x,y){return y=asin(y/cy),[x/(cx*cos(y)),asin((2*y+sin(2*y))/cp)];};return forward;}var mollweideRaw=mollweideBromleyRaw(sqrt2/halfPi,sqrt2,pi);function geoMollweide(){return projection$1(mollweideRaw).scale(169.529);}var defaultPath=geoPath();var projectionProperties=[// standard properties in d3-geo +'clipAngle','clipExtent','scale','translate','center','rotate','parallels','precision','reflectX','reflectY',// extended properties in d3-geo-projections +'coefficient','distance','fraction','lobes','parallel','radius','ratio','spacing','tilt'];/** + * Augment projections with their type and a copy method. + */function create$1(type,constructor){return function projection(){var p=constructor();p.type=type;p.path=geoPath().projection(p);p.copy=p.copy||function(){var c=projection();projectionProperties.forEach(function(prop){if(p[prop])c[prop](p[prop]());});c.path.pointRadius(p.path.pointRadius());return c;};return registerScale(p);};}function projection(type,proj){if(!type||typeof type!=='string'){throw new Error('Projection type must be a name string.');}type=type.toLowerCase();if(arguments.length>1){projections[type]=create$1(type,proj);return this;}else{return projections[type]||null;}}function getProjectionPath(proj){return proj&&proj.path||defaultPath;}var projections={// base d3-geo projection types +albers:geoAlbers,albersusa:geoAlbersUsa,azimuthalequalarea:geoAzimuthalEqualArea,azimuthalequidistant:geoAzimuthalEquidistant,conicconformal:geoConicConformal,conicequalarea:geoConicEqualArea,conicequidistant:geoConicEquidistant,equalEarth:geoEqualEarth,equirectangular:geoEquirectangular,gnomonic:geoGnomonic,identity:geoIdentity,mercator:geoMercator,mollweide:geoMollweide,naturalEarth1:geoNaturalEarth1,orthographic:geoOrthographic,stereographic:geoStereographic,transversemercator:geoTransverseMercator};for(var _key13 in projections){projection(_key13,projections[_key13]);}function noop$1(){}var cases=[[],[[[1.0,1.5],[0.5,1.0]]],[[[1.5,1.0],[1.0,1.5]]],[[[1.5,1.0],[0.5,1.0]]],[[[1.0,0.5],[1.5,1.0]]],[[[1.0,1.5],[0.5,1.0]],[[1.0,0.5],[1.5,1.0]]],[[[1.0,0.5],[1.0,1.5]]],[[[1.0,0.5],[0.5,1.0]]],[[[0.5,1.0],[1.0,0.5]]],[[[1.0,1.5],[1.0,0.5]]],[[[0.5,1.0],[1.0,0.5]],[[1.5,1.0],[1.0,1.5]]],[[[1.5,1.0],[1.0,0.5]]],[[[0.5,1.0],[1.5,1.0]]],[[[1.0,1.5],[1.5,1.0]]],[[[0.5,1.0],[1.0,1.5]]],[]];// Implementation adapted from d3/d3-contour. Thanks! +function contours(){var dx=1,dy=1,smooth=smoothLinear;function contours(values,tz){return tz.map(function(value){return contour(values,value);});}// Accumulate, smooth contour rings, assign holes to exterior rings. +// Based on https://github.com/mbostock/shapefile/blob/v0.6.2/shp/polygon.js +function contour(values,value){var polygons=[],holes=[];isorings(values,value,function(ring){smooth(ring,values,value);if(area(ring)>0)polygons.push([ring]);else holes.push(ring);});holes.forEach(function(hole){for(var i=0,n=polygons.length,polygon;i<n;++i){if(contains((polygon=polygons[i])[0],hole)!==-1){polygon.push(hole);return;}}});return{type:'MultiPolygon',value:value,coordinates:polygons};}// Marching squares with isolines stitched into rings. +// Based on https://github.com/topojson/topojson-client/blob/v3.0.0/src/stitch.js +function isorings(values,value,callback){var fragmentByStart=[],fragmentByEnd=[],x,y,t0,t1,t2,t3;// Special case for the first row (y = -1, t2 = t3 = 0). +x=y=-1;t1=values[0]>=value;cases[t1<<1].forEach(stitch);while(++x<dx-1){t0=t1,t1=values[x+1]>=value;cases[t0|t1<<1].forEach(stitch);}cases[t1<<0].forEach(stitch);// General case for the intermediate rows. +while(++y<dy-1){x=-1;t1=values[y*dx+dx]>=value;t2=values[y*dx]>=value;cases[t1<<1|t2<<2].forEach(stitch);while(++x<dx-1){t0=t1,t1=values[y*dx+dx+x+1]>=value;t3=t2,t2=values[y*dx+x+1]>=value;cases[t0|t1<<1|t2<<2|t3<<3].forEach(stitch);}cases[t1|t2<<3].forEach(stitch);}// Special case for the last row (y = dy - 1, t0 = t1 = 0). +x=-1;t2=values[y*dx]>=value;cases[t2<<2].forEach(stitch);while(++x<dx-1){t3=t2,t2=values[y*dx+x+1]>=value;cases[t2<<2|t3<<3].forEach(stitch);}cases[t2<<3].forEach(stitch);function stitch(line){var start=[line[0][0]+x,line[0][1]+y],end=[line[1][0]+x,line[1][1]+y],startIndex=index(start),endIndex=index(end),f,g;if(f=fragmentByEnd[startIndex]){if(g=fragmentByStart[endIndex]){delete fragmentByEnd[f.end];delete fragmentByStart[g.start];if(f===g){f.ring.push(end);callback(f.ring);}else{fragmentByStart[f.start]=fragmentByEnd[g.end]={start:f.start,end:g.end,ring:f.ring.concat(g.ring)};}}else{delete fragmentByEnd[f.end];f.ring.push(end);fragmentByEnd[f.end=endIndex]=f;}}else if(f=fragmentByStart[endIndex]){if(g=fragmentByEnd[startIndex]){delete fragmentByStart[f.start];delete fragmentByEnd[g.end];if(f===g){f.ring.push(end);callback(f.ring);}else{fragmentByStart[g.start]=fragmentByEnd[f.end]={start:g.start,end:f.end,ring:g.ring.concat(f.ring)};}}else{delete fragmentByStart[f.start];f.ring.unshift(start);fragmentByStart[f.start=startIndex]=f;}}else{fragmentByStart[startIndex]=fragmentByEnd[endIndex]={start:startIndex,end:endIndex,ring:[start,end]};}}}function index(point){return point[0]*2+point[1]*(dx+1)*4;}function smoothLinear(ring,values,value){ring.forEach(function(point){var x=point[0],y=point[1],xt=x|0,yt=y|0,v0,v1=values[yt*dx+xt];if(x>0&&x<dx&&xt===x){v0=values[yt*dx+xt-1];point[0]=x+(value-v0)/(v1-v0)-0.5;}if(y>0&&y<dy&&yt===y){v0=values[(yt-1)*dx+xt];point[1]=y+(value-v0)/(v1-v0)-0.5;}});}contours.contour=contour;contours.size=function(_){if(!arguments.length)return[dx,dy];var _0=Math.floor(_[0]),_1=Math.floor(_[1]);if(!(_0>=0&&_1>=0))error('invalid size');return dx=_0,dy=_1,contours;};contours.smooth=function(_){return arguments.length?(smooth=_?smoothLinear:noop$1,contours):smooth===smoothLinear;};return contours;}function area(ring){var i=0,n=ring.length,area=ring[n-1][1]*ring[0][0]-ring[n-1][0]*ring[0][1];while(++i<n)area+=ring[i-1][1]*ring[i][0]-ring[i-1][0]*ring[i][1];return area;}function contains(ring,hole){var i=-1,n=hole.length,c;while(++i<n)if(c=ringContains(ring,hole[i]))return c;return 0;}function ringContains(ring,point){var x=point[0],y=point[1],contains=-1;for(var i=0,n=ring.length,j=n-1;i<n;j=i++){var pi=ring[i],xi=pi[0],yi=pi[1],pj=ring[j],xj=pj[0],yj=pj[1];if(segmentContains(pi,pj,point))return 0;if(yi>y!==yj>y&&x<(xj-xi)*(y-yi)/(yj-yi)+xi)contains=-contains;}return contains;}function segmentContains(a,b,c){var i;return collinear$1(a,b,c)&&within(a[i=+(a[0]===b[0])],c[i],b[i]);}function collinear$1(a,b,c){return(b[0]-a[0])*(c[1]-a[1])===(c[0]-a[0])*(b[1]-a[1]);}function within(p,q,r){return p<=q&&q<=r||r<=q&&q<=p;}function quantize(k,nice,zero){return function(values){var ex=_extent(values),start=zero?Math.min(ex[0],0):ex[0],stop=ex[1],span=stop-start,step=nice?tickStep(start,stop,k):span/(k+1);return range$3(start+step,stop,step);};}/** + * Generate isocontours (level sets) based on input raster grid data. + * @constructor + * @param {object} params - The parameters for this operator. + * @param {function(object): *} [params.field] - The field with raster grid + * data. If unspecified, the tuple itself is interpreted as a raster grid. + * @param {Array<number>} [params.thresholds] - Contour threshold array. If + * specified, the levels, nice, resolve, and zero parameters are ignored. + * @param {number} [params.levels] - The desired number of contour levels. + * @param {boolean} [params.nice] - Boolean flag indicating if the contour + * threshold values should be automatically aligned to "nice" + * human-friendly values. Setting this flag may cause the number of + * thresholds to deviate from the specified levels. + * @param {string} [params.resolve] - The method for resolving thresholds + * across multiple input grids. If 'independent' (the default), threshold + * calculation will be performed separately for each grid. If 'shared', a + * single set of threshold values will be used for all input grids. + * @param {boolean} [params.zero] - Boolean flag indicating if the contour + * threshold values should include zero. + * @param {boolean} [params.smooth] - Boolean flag indicating if the contour + * polygons should be smoothed using linear interpolation. The default is + * true. The parameter is ignored when using density estimation. + * @param {boolean} [params.scale] - Optional numerical value by which to + * scale the output isocontour coordinates. This parameter can be useful + * to scale the contours to match a desired output resolution. + * @param {string} [params.as='contour'] - The output field in which to store + * the generated isocontour data (default 'contour'). + */function Isocontour(params){Transform.call(this,null,params);}Isocontour.Definition={'type':'Isocontour','metadata':{'generates':true},'params':[{'name':'field','type':'field'},{'name':'thresholds','type':'number','array':true},{'name':'levels','type':'number'},{'name':'nice','type':'boolean','default':false},{'name':'resolve','type':'enum','values':['shared','independent'],'default':'independent'},{'name':'zero','type':'boolean','default':true},{'name':'smooth','type':'boolean','default':true},{'name':'scale','type':'number','expr':true},{'name':'translate','type':'number','array':true,'expr':true},{'name':'as','type':'string','null':true,'default':'contour'}]};inherits(Isocontour,Transform,{transform:function transform(_,pulse){if(this.value&&!pulse.changed()&&!_.modified()){return pulse.StopPropagation;}var out=pulse.fork(pulse.NO_SOURCE|pulse.NO_FIELDS),source=pulse.materialize(pulse.SOURCE).source,field=_.field||identity$6,contour=contours().smooth(_.smooth!==false),tz=_.thresholds||levels(source,field,_),as=_.as===null?null:_.as||'contour',values=[];source.forEach(function(t){var grid=field(t);// generate contour paths in GeoJSON format +var paths=contour.size([grid.width,grid.height])(grid.values,isArray(tz)?tz:tz(grid.values));// adjust contour path coordinates as needed +transformPaths(paths,grid,t,_);// ingest; copy source data properties to output +paths.forEach(function(p){values.push(rederive(t,ingest$1(as!=null?_defineProperty({},as,p):p)));});});if(this.value)out.rem=this.value;this.value=out.source=out.add=values;return out;}});function levels(values,f,_){var q=quantize(_.levels||10,_.nice,_.zero!==false);return _.resolve!=='shared'?q:q(values.map(function(t){return max$2(f(t).values);}));}function transformPaths(paths,grid,datum,_){var s=_.scale||grid.scale,t=_.translate||grid.translate;if(isFunction(s))s=s(datum,_);if(isFunction(t))t=t(datum,_);if((s===1||s==null)&&!t)return;var sx=(isNumber$1(s)?s:s[0])||1,sy=(isNumber$1(s)?s:s[1])||1,tx=t&&t[0]||0,ty=t&&t[1]||0;paths.forEach(transform$1(grid,sx,sy,tx,ty));}function transform$1(grid,sx,sy,tx,ty){var x1=grid.x1||0,y1=grid.y1||0,flip=sx*sy<0;function transformPolygon(coordinates){coordinates.forEach(transformRing);}function transformRing(coordinates){if(flip)coordinates.reverse();// maintain winding order +coordinates.forEach(transformPoint);}function transformPoint(coordinates){coordinates[0]=(coordinates[0]-x1)*sx+tx;coordinates[1]=(coordinates[1]-y1)*sy+ty;}return function(geometry){geometry.coordinates.forEach(transformPolygon);return geometry;};}function radius(bw,data,f){var v=bw>=0?bw:estimateBandwidth(data,f);return Math.round((Math.sqrt(4*v*v+1)-1)/2);}function number$2(_){return isFunction(_)?_:constant$5(+_);}// Implementation adapted from d3/d3-contour. Thanks! +function density2D(){var x=function x(d){return d[0];},y=function y(d){return d[1];},weight=one$2,bandwidth=[-1,-1],dx=960,dy=500,k=2;// log2(cellSize) +function density(data,counts){var rx=radius(bandwidth[0],data,x)>>k,// blur x-radius +ry=radius(bandwidth[1],data,y)>>k,// blur y-radius +ox=rx?rx+2:0,// x-offset padding for blur +oy=ry?ry+2:0,// y-offset padding for blur +n=2*ox+(dx>>k),// grid width +m=2*oy+(dy>>k),// grid height +values0=new Float32Array(n*m),values1=new Float32Array(n*m);var values=values0;data.forEach(function(d){var xi=ox+(+x(d)>>k),yi=oy+(+y(d)>>k);if(xi>=0&&xi<n&&yi>=0&&yi<m){values0[xi+yi*n]+=+weight(d);}});if(rx>0&&ry>0){blurX(n,m,values0,values1,rx);blurY(n,m,values1,values0,ry);blurX(n,m,values0,values1,rx);blurY(n,m,values1,values0,ry);blurX(n,m,values0,values1,rx);blurY(n,m,values1,values0,ry);}else if(rx>0){blurX(n,m,values0,values1,rx);blurX(n,m,values1,values0,rx);blurX(n,m,values0,values1,rx);values=values1;}else if(ry>0){blurY(n,m,values0,values1,ry);blurY(n,m,values1,values0,ry);blurY(n,m,values0,values1,ry);values=values1;}// scale density estimates +// density in points per square pixel or probability density +var s=counts?Math.pow(2,-2*k):1/sum$1(values);for(var i=0,_sz=n*m;i<_sz;++i)values[i]*=s;return{values:values,scale:1<<k,width:n,height:m,x1:ox,y1:oy,x2:ox+(dx>>k),y2:oy+(dy>>k)};}density.x=function(_){return arguments.length?(x=number$2(_),density):x;};density.y=function(_){return arguments.length?(y=number$2(_),density):y;};density.weight=function(_){return arguments.length?(weight=number$2(_),density):weight;};density.size=function(_){if(!arguments.length)return[dx,dy];var _0=+_[0],_1=+_[1];if(!(_0>=0&&_1>=0))error('invalid size');return dx=_0,dy=_1,density;};density.cellSize=function(_){if(!arguments.length)return 1<<k;if(!((_=+_)>=1))error('invalid cell size');k=Math.floor(Math.log(_)/Math.LN2);return density;};density.bandwidth=function(_){if(!arguments.length)return bandwidth;_=array$5(_);if(_.length===1)_=[+_[0],+_[0]];if(_.length!==2)error('invalid bandwidth');return bandwidth=_,density;};return density;}function blurX(n,m,source,target,r){var w=(r<<1)+1;for(var j=0;j<m;++j){for(var i=0,sr=0;i<n+r;++i){if(i<n){sr+=source[i+j*n];}if(i>=r){if(i>=w){sr-=source[i-w+j*n];}target[i-r+j*n]=sr/Math.min(i+1,n-1+w-i,w);}}}}function blurY(n,m,source,target,r){var w=(r<<1)+1;for(var i=0;i<n;++i){for(var j=0,sr=0;j<m+r;++j){if(j<m){sr+=source[i+j*n];}if(j>=r){if(j>=w){sr-=source[i+(j-w)*n];}target[i+(j-r)*n]=sr/Math.min(j+1,m-1+w-j,w);}}}}/** + * Perform 2D kernel-density estimation of point data. + * @constructor + * @param {object} params - The parameters for this operator. + * @param {Array<number>} params.size - The [width, height] extent (in + * units of input pixels) over which to perform density estimation. + * @param {function(object): number} params.x - The x-coordinate accessor. + * @param {function(object): number} params.y - The y-coordinate accessor. + * @param {function(object): number} [params.weight] - The weight accessor. + * @param {Array<function(object): *>} [params.groupby] - An array of accessors + * to groupby. + * @param {number} [params.cellSize] - Contour density calculation cell size. + * This parameter determines the level of spatial approximation. For example, + * the default value of 4 maps to 2x reductions in both x- and y- dimensions. + * A value of 1 will result in an output raster grid whose dimensions exactly + * matches the size parameter. + * @param {Array<number>} [params.bandwidth] - The KDE kernel bandwidths, + * in pixels. The input can be a two-element array specifying separate + * x and y bandwidths, or a single-element array specifying both. If the + * bandwidth is unspecified or less than zero, the bandwidth will be + * automatically determined. + * @param {boolean} [params.counts=false] - A boolean flag indicating if the + * output values should be probability estimates (false, default) or + * smoothed counts (true). + * @param {string} [params.as='grid'] - The output field in which to store + * the generated raster grid (default 'grid'). + */function KDE2D(params){Transform.call(this,null,params);}KDE2D.Definition={'type':'KDE2D','metadata':{'generates':true},'params':[{'name':'size','type':'number','array':true,'length':2,'required':true},{'name':'x','type':'field','required':true},{'name':'y','type':'field','required':true},{'name':'weight','type':'field'},{'name':'groupby','type':'field','array':true},{'name':'cellSize','type':'number'},{'name':'bandwidth','type':'number','array':true,'length':2},{'name':'counts','type':'boolean','default':false},{'name':'as','type':'string','default':'grid'}]};var PARAMS=['x','y','weight','size','cellSize','bandwidth'];function params(obj,_){PARAMS.forEach(function(param){return _[param]!=null?obj[param](_[param]):0;});return obj;}inherits(KDE2D,Transform,{transform:function transform(_,pulse){if(this.value&&!pulse.changed()&&!_.modified())return pulse.StopPropagation;var out=pulse.fork(pulse.NO_SOURCE|pulse.NO_FIELDS),source=pulse.materialize(pulse.SOURCE).source,groups=partition$2(source,_.groupby),names=(_.groupby||[]).map(accessorName),kde=params(density2D(),_),as=_.as||'grid',values=[];function set(t,vals){for(var i=0;i<names.length;++i)t[names[i]]=vals[i];return t;}// generate density raster grids +values=groups.map(function(g){return ingest$1(set(_defineProperty({},as,kde(g,_.counts)),g.dims));});if(this.value)out.rem=this.value;this.value=out.source=out.add=values;return out;}});function partition$2(data,groupby){var groups=[],get=function get(f){return f(t);},map,i,n,t,k,g;// partition data points into groups +if(groupby==null){groups.push(data);}else{for(map={},i=0,n=data.length;i<n;++i){t=data[i];k=groupby.map(get);g=map[k];if(!g){map[k]=g=[];g.dims=k;groups.push(g);}g.push(t);}}return groups;}/** + * Generate contours based on kernel-density estimation of point data. + * @constructor + * @param {object} params - The parameters for this operator. + * @param {Array<number>} params.size - The dimensions [width, height] over which to compute contours. + * If the values parameter is provided, this must be the dimensions of the input data. + * If density estimation is performed, this is the output view dimensions in pixels. + * @param {Array<number>} [params.values] - An array of numeric values representing an + * width x height grid of values over which to compute contours. If unspecified, this + * transform will instead attempt to compute contours for the kernel density estimate + * using values drawn from data tuples in the input pulse. + * @param {function(object): number} [params.x] - The pixel x-coordinate accessor for density estimation. + * @param {function(object): number} [params.y] - The pixel y-coordinate accessor for density estimation. + * @param {function(object): number} [params.weight] - The data point weight accessor for density estimation. + * @param {number} [params.cellSize] - Contour density calculation cell size. + * @param {number} [params.bandwidth] - Kernel density estimation bandwidth. + * @param {Array<number>} [params.thresholds] - Contour threshold array. If + * this parameter is set, the count and nice parameters will be ignored. + * @param {number} [params.count] - The desired number of contours. + * @param {boolean} [params.nice] - Boolean flag indicating if the contour + * threshold values should be automatically aligned to "nice" + * human-friendly values. Setting this flag may cause the number of + * thresholds to deviate from the specified count. + * @param {boolean} [params.smooth] - Boolean flag indicating if the contour + * polygons should be smoothed using linear interpolation. The default is + * true. The parameter is ignored when using density estimation. + */function Contour(params){Transform.call(this,null,params);}Contour.Definition={'type':'Contour','metadata':{'generates':true},'params':[{'name':'size','type':'number','array':true,'length':2,'required':true},{'name':'values','type':'number','array':true},{'name':'x','type':'field'},{'name':'y','type':'field'},{'name':'weight','type':'field'},{'name':'cellSize','type':'number'},{'name':'bandwidth','type':'number'},{'name':'count','type':'number'},{'name':'nice','type':'boolean','default':false},{'name':'thresholds','type':'number','array':true},{'name':'smooth','type':'boolean','default':true}]};inherits(Contour,Transform,{transform:function transform(_,pulse){if(this.value&&!pulse.changed()&&!_.modified()){return pulse.StopPropagation;}var out=pulse.fork(pulse.NO_SOURCE|pulse.NO_FIELDS),contour=contours().smooth(_.smooth!==false),values=_.values,thresh=_.thresholds||quantize(_.count||10,_.nice,!!values),size=_.size,grid,post;if(!values){values=pulse.materialize(pulse.SOURCE).source;grid=params(density2D(),_)(values,true);post=transform$1(grid,grid.scale||1,grid.scale||1,0,0);size=[grid.width,grid.height];values=grid.values;}thresh=isArray(thresh)?thresh:thresh(values);values=contour.size(size)(values,thresh);if(post)values.forEach(post);if(this.value)out.rem=this.value;this.value=out.source=out.add=(values||[]).map(ingest$1);return out;}});var Feature='Feature';var FeatureCollection='FeatureCollection';var MultiPoint='MultiPoint';/** + * Consolidate an array of [longitude, latitude] points or GeoJSON features + * into a combined GeoJSON object. This transform is particularly useful for + * combining geo data for a Projection's fit argument. The resulting GeoJSON + * data is available as this transform's value. Input pulses are unchanged. + * @constructor + * @param {object} params - The parameters for this operator. + * @param {Array<function(object): *>} [params.fields] - A two-element array + * of field accessors for the longitude and latitude values. + * @param {function(object): *} params.geojson - A field accessor for + * retrieving GeoJSON feature data. + */function GeoJSON(params){Transform.call(this,null,params);}GeoJSON.Definition={'type':'GeoJSON','metadata':{},'params':[{'name':'fields','type':'field','array':true,'length':2},{'name':'geojson','type':'field'}]};inherits(GeoJSON,Transform,{transform:function transform(_,pulse){var features=this._features,points=this._points,fields=_.fields,lon=fields&&fields[0],lat=fields&&fields[1],geojson=_.geojson||!fields&&identity$6,flag=pulse.ADD,mod;mod=_.modified()||pulse.changed(pulse.REM)||pulse.modified(accessorFields(geojson))||lon&&pulse.modified(accessorFields(lon))||lat&&pulse.modified(accessorFields(lat));if(!this.value||mod){flag=pulse.SOURCE;this._features=features=[];this._points=points=[];}if(geojson){pulse.visit(flag,function(t){return features.push(geojson(t));});}if(lon&&lat){pulse.visit(flag,function(t){var x=lon(t),y=lat(t);if(x!=null&&y!=null&&(x=+x)===x&&(y=+y)===y){points.push([x,y]);}});features=features.concat({type:Feature,geometry:{type:MultiPoint,coordinates:points}});}this.value={type:FeatureCollection,features:features};}});/** + * Map GeoJSON data to an SVG path string. + * @constructor + * @param {object} params - The parameters for this operator. + * @param {function(number, number): *} params.projection - The cartographic + * projection to apply. + * @param {function(object): *} [params.field] - The field with GeoJSON data, + * or null if the tuple itself is a GeoJSON feature. + * @param {string} [params.as='path'] - The output field in which to store + * the generated path data (default 'path'). + */function GeoPath(params){Transform.call(this,null,params);}GeoPath.Definition={'type':'GeoPath','metadata':{'modifies':true},'params':[{'name':'projection','type':'projection'},{'name':'field','type':'field'},{'name':'pointRadius','type':'number','expr':true},{'name':'as','type':'string','default':'path'}]};inherits(GeoPath,Transform,{transform:function transform(_,pulse){var out=pulse.fork(pulse.ALL),path=this.value,field=_.field||identity$6,as=_.as||'path',flag=out.SOURCE;if(!path||_.modified()){// parameters updated, reset and reflow +this.value=path=getProjectionPath(_.projection);out.materialize().reflow();}else{flag=field===identity$6||pulse.modified(field.fields)?out.ADD_MOD:out.ADD;}var prev=initPath(path,_.pointRadius);out.visit(flag,function(t){return t[as]=path(field(t));});path.pointRadius(prev);return out.modifies(as);}});function initPath(path,pointRadius){var prev=path.pointRadius();path.context(null);if(pointRadius!=null){path.pointRadius(pointRadius);}return prev;}/** + * Geo-code a longitude/latitude point to an x/y coordinate. + * @constructor + * @param {object} params - The parameters for this operator. + * @param {function(number, number): *} params.projection - The cartographic + * projection to apply. + * @param {Array<function(object): *>} params.fields - A two-element array of + * field accessors for the longitude and latitude values. + * @param {Array<string>} [params.as] - A two-element array of field names + * under which to store the result. Defaults to ['x','y']. + */function GeoPoint(params){Transform.call(this,null,params);}GeoPoint.Definition={'type':'GeoPoint','metadata':{'modifies':true},'params':[{'name':'projection','type':'projection','required':true},{'name':'fields','type':'field','array':true,'required':true,'length':2},{'name':'as','type':'string','array':true,'length':2,'default':['x','y']}]};inherits(GeoPoint,Transform,{transform:function transform(_,pulse){var proj=_.projection,lon=_.fields[0],lat=_.fields[1],as=_.as||['x','y'],x=as[0],y=as[1],mod;function set(t){var xy=proj([lon(t),lat(t)]);if(xy){t[x]=xy[0];t[y]=xy[1];}else{t[x]=undefined;t[y]=undefined;}}if(_.modified()){// parameters updated, reflow +pulse=pulse.materialize().reflow(true).visit(pulse.SOURCE,set);}else{mod=pulse.modified(lon.fields)||pulse.modified(lat.fields);pulse.visit(mod?pulse.ADD_MOD:pulse.ADD,set);}return pulse.modifies(as);}});/** + * Annotate items with a geopath shape generator. + * @constructor + * @param {object} params - The parameters for this operator. + * @param {function(number, number): *} params.projection - The cartographic + * projection to apply. + * @param {function(object): *} [params.field] - The field with GeoJSON data, + * or null if the tuple itself is a GeoJSON feature. + * @param {string} [params.as='shape'] - The output field in which to store + * the generated path data (default 'shape'). + */function GeoShape(params){Transform.call(this,null,params);}GeoShape.Definition={'type':'GeoShape','metadata':{'modifies':true,'nomod':true},'params':[{'name':'projection','type':'projection'},{'name':'field','type':'field','default':'datum'},{'name':'pointRadius','type':'number','expr':true},{'name':'as','type':'string','default':'shape'}]};inherits(GeoShape,Transform,{transform:function transform(_,pulse){var out=pulse.fork(pulse.ALL),shape=this.value,as=_.as||'shape',flag=out.ADD;if(!shape||_.modified()){// parameters updated, reset and reflow +this.value=shape=shapeGenerator(getProjectionPath(_.projection),_.field||field$1('datum'),_.pointRadius);out.materialize().reflow();flag=out.SOURCE;}out.visit(flag,function(t){return t[as]=shape;});return out.modifies(as);}});function shapeGenerator(path,field,pointRadius){var shape=pointRadius==null?function(_){return path(field(_));}:function(_){var prev=path.pointRadius(),value=path.pointRadius(pointRadius)(field(_));path.pointRadius(prev);return value;};shape.context=function(_){path.context(_);return shape;};return shape;}/** + * GeoJSON feature generator for creating graticules. + * @constructor + */function Graticule(params){Transform.call(this,[],params);this.generator=graticule();}Graticule.Definition={'type':'Graticule','metadata':{'changes':true,'generates':true},'params':[{'name':'extent','type':'array','array':true,'length':2,'content':{'type':'number','array':true,'length':2}},{'name':'extentMajor','type':'array','array':true,'length':2,'content':{'type':'number','array':true,'length':2}},{'name':'extentMinor','type':'array','array':true,'length':2,'content':{'type':'number','array':true,'length':2}},{'name':'step','type':'number','array':true,'length':2},{'name':'stepMajor','type':'number','array':true,'length':2,'default':[90,360]},{'name':'stepMinor','type':'number','array':true,'length':2,'default':[10,10]},{'name':'precision','type':'number','default':2.5}]};inherits(Graticule,Transform,{transform:function transform(_,pulse){var src=this.value,gen=this.generator,t;if(!src.length||_.modified()){for(var prop in _){if(isFunction(gen[prop])){gen[prop](_[prop]);}}}t=gen();if(src.length){pulse.mod.push(replace$1(src[0],t));}else{pulse.add.push(ingest$1(t));}src[0]=t;return pulse;}});/** + * Render a heatmap image for input raster grid data. + * @constructor + * @param {object} params - The parameters for this operator. + * @param {function(object): *} [params.field] - The field with raster grid + * data. If unspecified, the tuple itself is interpreted as a raster grid. + * @param {string} [params.color] - A constant color value or function for + * individual pixel color. If a function, it will be invoked with an input + * object that includes $x, $y, $value, and $max fields for the grid. + * @param {number} [params.opacity] - A constant opacity value or function for + * individual pixel opacity. If a function, it will be invoked with an input + * object that includes $x, $y, $value, and $max fields for the grid. + * @param {string} [params.resolve] - The method for resolving maximum values + * across multiple input grids. If 'independent' (the default), maximum + * calculation will be performed separately for each grid. If 'shared', + * a single global maximum will be used for all input grids. + * @param {string} [params.as='image'] - The output field in which to store + * the generated bitmap canvas images (default 'image'). + */function Heatmap(params){Transform.call(this,null,params);}Heatmap.Definition={'type':'heatmap','metadata':{'modifies':true},'params':[{'name':'field','type':'field'},{'name':'color','type':'string','expr':true},{'name':'opacity','type':'number','expr':true},{'name':'resolve','type':'enum','values':['shared','independent'],'default':'independent'},{'name':'as','type':'string','default':'image'}]};inherits(Heatmap,Transform,{transform:function transform(_,pulse){if(!pulse.changed()&&!_.modified()){return pulse.StopPropagation;}var source=pulse.materialize(pulse.SOURCE).source,shared=_.resolve==='shared',field=_.field||identity$6,opacity=opacity_(_.opacity,_),color=color_(_.color,_),as=_.as||'image',obj={$x:0,$y:0,$value:0,$max:shared?max$2(source.map(function(t){return max$2(field(t).values);})):0};source.forEach(function(t){var v=field(t);// build proxy data object +var o=extend$1({},t,obj);// set maximum value if not globally shared +if(!shared)o.$max=max$2(v.values||[]);// generate canvas image +// optimize color/opacity if not pixel-dependent +t[as]=toCanvas(v,o,color.dep?color:constant$5(color(o)),opacity.dep?opacity:constant$5(opacity(o)));});return pulse.reflow(true).modifies(as);}});// get image color function +function color_(color,_){var f;if(isFunction(color)){f=function f(obj){return rgb$1(color(obj,_));};f.dep=dependency(color);}else{// default to mid-grey +f=constant$5(rgb$1(color||'#888'));}return f;}// get image opacity function +function opacity_(opacity,_){var f;if(isFunction(opacity)){f=function f(obj){return opacity(obj,_);};f.dep=dependency(opacity);}else if(opacity){f=constant$5(opacity);}else{// default to [0, max] opacity gradient +f=function f(obj){return obj.$value/obj.$max||0;};f.dep=true;}return f;}// check if function depends on individual pixel data +function dependency(f){if(!isFunction(f))return false;var set=toSet(accessorFields(f));return set.$x||set.$y||set.$value||set.$max;}// render raster grid to canvas +function toCanvas(grid,obj,color,opacity){var n=grid.width,m=grid.height,x1=grid.x1||0,y1=grid.y1||0,x2=grid.x2||n,y2=grid.y2||m,val=grid.values,value=val?function(i){return val[i];}:zero$3,can=domCanvas(x2-x1,y2-y1),ctx=can.getContext('2d'),img=ctx.getImageData(0,0,x2-x1,y2-y1),pix=img.data;for(var j=y1,k=0;j<y2;++j){obj.$y=j-y1;for(var i=x1,r=j*n;i<x2;++i,k+=4){obj.$x=i-x1;obj.$value=value(i+r);var v=color(obj);pix[k+0]=v.r;pix[k+1]=v.g;pix[k+2]=v.b;pix[k+3]=~~(255*opacity(obj));}}ctx.putImageData(img,0,0);return can;}/** + * Maintains a cartographic projection. + * @constructor + * @param {object} params - The parameters for this operator. + */function Projection$1(params){Transform.call(this,null,params);this.modified(true);// always treat as modified +}inherits(Projection$1,Transform,{transform:function transform(_,pulse){var proj=this.value;if(!proj||_.modified('type')){this.value=proj=create(_.type);projectionProperties.forEach(function(prop){if(_[prop]!=null)set$1(proj,prop,_[prop]);});}else{projectionProperties.forEach(function(prop){if(_.modified(prop))set$1(proj,prop,_[prop]);});}if(_.pointRadius!=null)proj.path.pointRadius(_.pointRadius);if(_.fit)fit(proj,_);return pulse.fork(pulse.NO_SOURCE|pulse.NO_FIELDS);}});function fit(proj,_){var data=collectGeoJSON(_.fit);_.extent?proj.fitExtent(_.extent,data):_.size?proj.fitSize(_.size,data):0;}function create(type){var constructor=projection((type||'mercator').toLowerCase());if(!constructor)error('Unrecognized projection type: '+type);return constructor();}function set$1(proj,key,value){if(isFunction(proj[key]))proj[key](value);}function collectGeoJSON(data){data=array$5(data);return data.length===1?data[0]:{type:FeatureCollection,features:data.reduce(function(a,f){return a.concat(featurize(f));},[])};}function featurize(f){return f.type===FeatureCollection?f.features:array$5(f).filter(function(d){return d!=null;}).map(function(d){return d.type===Feature?d:{type:Feature,geometry:d};});}var geo=/*#__PURE__*/Object.freeze({__proto__:null,contour:Contour,geojson:GeoJSON,geopath:GeoPath,geopoint:GeoPoint,geoshape:GeoShape,graticule:Graticule,heatmap:Heatmap,isocontour:Isocontour,kde2d:KDE2D,projection:Projection$1});function forceCenter(x,y){var nodes,strength=1;if(x==null)x=0;if(y==null)y=0;function force(){var i,n=nodes.length,node,sx=0,sy=0;for(i=0;i<n;++i){node=nodes[i],sx+=node.x,sy+=node.y;}for(sx=(sx/n-x)*strength,sy=(sy/n-y)*strength,i=0;i<n;++i){node=nodes[i],node.x-=sx,node.y-=sy;}}force.initialize=function(_){nodes=_;};force.x=function(_){return arguments.length?(x=+_,force):x;};force.y=function(_){return arguments.length?(y=+_,force):y;};force.strength=function(_){return arguments.length?(strength=+_,force):strength;};return force;}function tree_add(d){var x=+this._x.call(null,d),y=+this._y.call(null,d);return add(this.cover(x,y),x,y,d);}function add(tree,x,y,d){if(isNaN(x)||isNaN(y))return tree;// ignore invalid points +var parent,node=tree._root,leaf={data:d},x0=tree._x0,y0=tree._y0,x1=tree._x1,y1=tree._y1,xm,ym,xp,yp,right,bottom,i,j;// If the tree is empty, initialize the root as a leaf. +if(!node)return tree._root=leaf,tree;// Find the existing leaf for the new point, or add it. +while(node.length){if(right=x>=(xm=(x0+x1)/2))x0=xm;else x1=xm;if(bottom=y>=(ym=(y0+y1)/2))y0=ym;else y1=ym;if(parent=node,!(node=node[i=bottom<<1|right]))return parent[i]=leaf,tree;}// Is the new point is exactly coincident with the existing point? +xp=+tree._x.call(null,node.data);yp=+tree._y.call(null,node.data);if(x===xp&&y===yp)return leaf.next=node,parent?parent[i]=leaf:tree._root=leaf,tree;// Otherwise, split the leaf node until the old and new point are separated. +do{parent=parent?parent[i]=new Array(4):tree._root=new Array(4);if(right=x>=(xm=(x0+x1)/2))x0=xm;else x1=xm;if(bottom=y>=(ym=(y0+y1)/2))y0=ym;else y1=ym;}while((i=bottom<<1|right)===(j=(yp>=ym)<<1|xp>=xm));return parent[j]=node,parent[i]=leaf,tree;}function addAll(data){var d,i,n=data.length,x,y,xz=new Array(n),yz=new Array(n),x0=Infinity,y0=Infinity,x1=-Infinity,y1=-Infinity;// Compute the points and their extent. +for(i=0;i<n;++i){if(isNaN(x=+this._x.call(null,d=data[i]))||isNaN(y=+this._y.call(null,d)))continue;xz[i]=x;yz[i]=y;if(x<x0)x0=x;if(x>x1)x1=x;if(y<y0)y0=y;if(y>y1)y1=y;}// If there were no (valid) points, abort. +if(x0>x1||y0>y1)return this;// Expand the tree to cover the new points. +this.cover(x0,y0).cover(x1,y1);// Add the new points. +for(i=0;i<n;++i){add(this,xz[i],yz[i],data[i]);}return this;}function tree_cover(x,y){if(isNaN(x=+x)||isNaN(y=+y))return this;// ignore invalid points +var x0=this._x0,y0=this._y0,x1=this._x1,y1=this._y1;// If the quadtree has no extent, initialize them. +// Integer extent are necessary so that if we later double the extent, +// the existing quadrant boundaries don’t change due to floating point error! +if(isNaN(x0)){x1=(x0=Math.floor(x))+1;y1=(y0=Math.floor(y))+1;}// Otherwise, double repeatedly to cover. +else{var z=x1-x0||1,node=this._root,parent,i;while(x0>x||x>=x1||y0>y||y>=y1){i=(y<y0)<<1|x<x0;parent=new Array(4),parent[i]=node,node=parent,z*=2;switch(i){case 0:x1=x0+z,y1=y0+z;break;case 1:x0=x1-z,y1=y0+z;break;case 2:x1=x0+z,y0=y1-z;break;case 3:x0=x1-z,y0=y1-z;break;}}if(this._root&&this._root.length)this._root=node;}this._x0=x0;this._y0=y0;this._x1=x1;this._y1=y1;return this;}function tree_data(){var data=[];this.visit(function(node){if(!node.length)do data.push(node.data);while(node=node.next);});return data;}function tree_extent(_){return arguments.length?this.cover(+_[0][0],+_[0][1]).cover(+_[1][0],+_[1][1]):isNaN(this._x0)?undefined:[[this._x0,this._y0],[this._x1,this._y1]];}function Quad(node,x0,y0,x1,y1){this.node=node;this.x0=x0;this.y0=y0;this.x1=x1;this.y1=y1;}function tree_find(x,y,radius){var data,x0=this._x0,y0=this._y0,x1,y1,x2,y2,x3=this._x1,y3=this._y1,quads=[],node=this._root,q,i;if(node)quads.push(new Quad(node,x0,y0,x3,y3));if(radius==null)radius=Infinity;else{x0=x-radius,y0=y-radius;x3=x+radius,y3=y+radius;radius*=radius;}while(q=quads.pop()){// Stop searching if this quadrant can’t contain a closer node. +if(!(node=q.node)||(x1=q.x0)>x3||(y1=q.y0)>y3||(x2=q.x1)<x0||(y2=q.y1)<y0)continue;// Bisect the current quadrant. +if(node.length){var xm=(x1+x2)/2,ym=(y1+y2)/2;quads.push(new Quad(node[3],xm,ym,x2,y2),new Quad(node[2],x1,ym,xm,y2),new Quad(node[1],xm,y1,x2,ym),new Quad(node[0],x1,y1,xm,ym));// Visit the closest quadrant first. +if(i=(y>=ym)<<1|x>=xm){q=quads[quads.length-1];quads[quads.length-1]=quads[quads.length-1-i];quads[quads.length-1-i]=q;}}// Visit this point. (Visiting coincident points isn’t necessary!) +else{var dx=x-+this._x.call(null,node.data),dy=y-+this._y.call(null,node.data),d2=dx*dx+dy*dy;if(d2<radius){var d=Math.sqrt(radius=d2);x0=x-d,y0=y-d;x3=x+d,y3=y+d;data=node.data;}}}return data;}function tree_remove(d){if(isNaN(x=+this._x.call(null,d))||isNaN(y=+this._y.call(null,d)))return this;// ignore invalid points +var parent,node=this._root,retainer,previous,next,x0=this._x0,y0=this._y0,x1=this._x1,y1=this._y1,x,y,xm,ym,right,bottom,i,j;// If the tree is empty, initialize the root as a leaf. +if(!node)return this;// Find the leaf node for the point. +// While descending, also retain the deepest parent with a non-removed sibling. +if(node.length)while(true){if(right=x>=(xm=(x0+x1)/2))x0=xm;else x1=xm;if(bottom=y>=(ym=(y0+y1)/2))y0=ym;else y1=ym;if(!(parent=node,node=node[i=bottom<<1|right]))return this;if(!node.length)break;if(parent[i+1&3]||parent[i+2&3]||parent[i+3&3])retainer=parent,j=i;}// Find the point to remove. +while(node.data!==d)if(!(previous=node,node=node.next))return this;if(next=node.next)delete node.next;// If there are multiple coincident points, remove just the point. +if(previous)return next?previous.next=next:delete previous.next,this;// If this is the root point, remove it. +if(!parent)return this._root=next,this;// Remove this leaf. +next?parent[i]=next:delete parent[i];// If the parent now contains exactly one leaf, collapse superfluous parents. +if((node=parent[0]||parent[1]||parent[2]||parent[3])&&node===(parent[3]||parent[2]||parent[1]||parent[0])&&!node.length){if(retainer)retainer[j]=node;else this._root=node;}return this;}function removeAll(data){for(var i=0,n=data.length;i<n;++i)this.remove(data[i]);return this;}function tree_root(){return this._root;}function tree_size(){var size=0;this.visit(function(node){if(!node.length)do++size;while(node=node.next);});return size;}function tree_visit(callback){var quads=[],q,node=this._root,child,x0,y0,x1,y1;if(node)quads.push(new Quad(node,this._x0,this._y0,this._x1,this._y1));while(q=quads.pop()){if(!callback(node=q.node,x0=q.x0,y0=q.y0,x1=q.x1,y1=q.y1)&&node.length){var xm=(x0+x1)/2,ym=(y0+y1)/2;if(child=node[3])quads.push(new Quad(child,xm,ym,x1,y1));if(child=node[2])quads.push(new Quad(child,x0,ym,xm,y1));if(child=node[1])quads.push(new Quad(child,xm,y0,x1,ym));if(child=node[0])quads.push(new Quad(child,x0,y0,xm,ym));}}return this;}function tree_visitAfter(callback){var quads=[],next=[],q;if(this._root)quads.push(new Quad(this._root,this._x0,this._y0,this._x1,this._y1));while(q=quads.pop()){var node=q.node;if(node.length){var child,x0=q.x0,y0=q.y0,x1=q.x1,y1=q.y1,xm=(x0+x1)/2,ym=(y0+y1)/2;if(child=node[0])quads.push(new Quad(child,x0,y0,xm,ym));if(child=node[1])quads.push(new Quad(child,xm,y0,x1,ym));if(child=node[2])quads.push(new Quad(child,x0,ym,xm,y1));if(child=node[3])quads.push(new Quad(child,xm,ym,x1,y1));}next.push(q);}while(q=next.pop()){callback(q.node,q.x0,q.y0,q.x1,q.y1);}return this;}function defaultX(d){return d[0];}function tree_x(_){return arguments.length?(this._x=_,this):this._x;}function defaultY(d){return d[1];}function tree_y(_){return arguments.length?(this._y=_,this):this._y;}function quadtree(nodes,x,y){var tree=new Quadtree(x==null?defaultX:x,y==null?defaultY:y,NaN,NaN,NaN,NaN);return nodes==null?tree:tree.addAll(nodes);}function Quadtree(x,y,x0,y0,x1,y1){this._x=x;this._y=y;this._x0=x0;this._y0=y0;this._x1=x1;this._y1=y1;this._root=undefined;}function leaf_copy(leaf){var copy={data:leaf.data},next=copy;while(leaf=leaf.next)next=next.next={data:leaf.data};return copy;}var treeProto=quadtree.prototype=Quadtree.prototype;treeProto.copy=function(){var copy=new Quadtree(this._x,this._y,this._x0,this._y0,this._x1,this._y1),node=this._root,nodes,child;if(!node)return copy;if(!node.length)return copy._root=leaf_copy(node),copy;nodes=[{source:node,target:copy._root=new Array(4)}];while(node=nodes.pop()){for(var i=0;i<4;++i){if(child=node.source[i]){if(child.length)nodes.push({source:child,target:node.target[i]=new Array(4)});else node.target[i]=leaf_copy(child);}}}return copy;};treeProto.add=tree_add;treeProto.addAll=addAll;treeProto.cover=tree_cover;treeProto.data=tree_data;treeProto.extent=tree_extent;treeProto.find=tree_find;treeProto.remove=tree_remove;treeProto.removeAll=removeAll;treeProto.root=tree_root;treeProto.size=tree_size;treeProto.visit=tree_visit;treeProto.visitAfter=tree_visitAfter;treeProto.x=tree_x;treeProto.y=tree_y;function constant$1(x){return function(){return x;};}function jiggle(random){return(random()-0.5)*1e-6;}function x$1(d){return d.x+d.vx;}function y$1(d){return d.y+d.vy;}function forceCollide(radius){var nodes,radii,random,strength=1,iterations=1;if(typeof radius!=="function")radius=constant$1(radius==null?1:+radius);function force(){var i,n=nodes.length,tree,node,xi,yi,ri,ri2;for(var k=0;k<iterations;++k){tree=quadtree(nodes,x$1,y$1).visitAfter(prepare);for(i=0;i<n;++i){node=nodes[i];ri=radii[node.index],ri2=ri*ri;xi=node.x+node.vx;yi=node.y+node.vy;tree.visit(apply);}}function apply(quad,x0,y0,x1,y1){var data=quad.data,rj=quad.r,r=ri+rj;if(data){if(data.index>node.index){var x=xi-data.x-data.vx,y=yi-data.y-data.vy,l=x*x+y*y;if(l<r*r){if(x===0)x=jiggle(random),l+=x*x;if(y===0)y=jiggle(random),l+=y*y;l=(r-(l=Math.sqrt(l)))/l*strength;node.vx+=(x*=l)*(r=(rj*=rj)/(ri2+rj));node.vy+=(y*=l)*r;data.vx-=x*(r=1-r);data.vy-=y*r;}}return;}return x0>xi+r||x1<xi-r||y0>yi+r||y1<yi-r;}}function prepare(quad){if(quad.data)return quad.r=radii[quad.data.index];for(var i=quad.r=0;i<4;++i){if(quad[i]&&quad[i].r>quad.r){quad.r=quad[i].r;}}}function initialize(){if(!nodes)return;var i,n=nodes.length,node;radii=new Array(n);for(i=0;i<n;++i)node=nodes[i],radii[node.index]=+radius(node,i,nodes);}force.initialize=function(_nodes,_random){nodes=_nodes;random=_random;initialize();};force.iterations=function(_){return arguments.length?(iterations=+_,force):iterations;};force.strength=function(_){return arguments.length?(strength=+_,force):strength;};force.radius=function(_){return arguments.length?(radius=typeof _==="function"?_:constant$1(+_),initialize(),force):radius;};return force;}function index$1(d){return d.index;}function find$1(nodeById,nodeId){var node=nodeById.get(nodeId);if(!node)throw new Error("node not found: "+nodeId);return node;}function forceLink(links){var id=index$1,strength=defaultStrength,strengths,distance=constant$1(30),distances,nodes,count,bias,random,iterations=1;if(links==null)links=[];function defaultStrength(link){return 1/Math.min(count[link.source.index],count[link.target.index]);}function force(alpha){for(var k=0,n=links.length;k<iterations;++k){for(var i=0,link,source,target,x,y,l,b;i<n;++i){link=links[i],source=link.source,target=link.target;x=target.x+target.vx-source.x-source.vx||jiggle(random);y=target.y+target.vy-source.y-source.vy||jiggle(random);l=Math.sqrt(x*x+y*y);l=(l-distances[i])/l*alpha*strengths[i];x*=l,y*=l;target.vx-=x*(b=bias[i]);target.vy-=y*b;source.vx+=x*(b=1-b);source.vy+=y*b;}}}function initialize(){if(!nodes)return;var i,n=nodes.length,m=links.length,nodeById=new Map(nodes.map(function(d,i){return[id(d,i,nodes),d];})),link;for(i=0,count=new Array(n);i<m;++i){link=links[i],link.index=i;if(_typeof(link.source)!=="object")link.source=find$1(nodeById,link.source);if(_typeof(link.target)!=="object")link.target=find$1(nodeById,link.target);count[link.source.index]=(count[link.source.index]||0)+1;count[link.target.index]=(count[link.target.index]||0)+1;}for(i=0,bias=new Array(m);i<m;++i){link=links[i],bias[i]=count[link.source.index]/(count[link.source.index]+count[link.target.index]);}strengths=new Array(m),initializeStrength();distances=new Array(m),initializeDistance();}function initializeStrength(){if(!nodes)return;for(var i=0,n=links.length;i<n;++i){strengths[i]=+strength(links[i],i,links);}}function initializeDistance(){if(!nodes)return;for(var i=0,n=links.length;i<n;++i){distances[i]=+distance(links[i],i,links);}}force.initialize=function(_nodes,_random){nodes=_nodes;random=_random;initialize();};force.links=function(_){return arguments.length?(links=_,initialize(),force):links;};force.id=function(_){return arguments.length?(id=_,force):id;};force.iterations=function(_){return arguments.length?(iterations=+_,force):iterations;};force.strength=function(_){return arguments.length?(strength=typeof _==="function"?_:constant$1(+_),initializeStrength(),force):strength;};force.distance=function(_){return arguments.length?(distance=typeof _==="function"?_:constant$1(+_),initializeDistance(),force):distance;};return force;}var noop={value:function value(){}};function dispatch(){for(var i=0,n=arguments.length,_={},t;i<n;++i){if(!(t=arguments[i]+"")||t in _||/[\s.]/.test(t))throw new Error("illegal type: "+t);_[t]=[];}return new Dispatch(_);}function Dispatch(_){this._=_;}function parseTypenames(typenames,types){return typenames.trim().split(/^|\s+/).map(function(t){var name="",i=t.indexOf(".");if(i>=0)name=t.slice(i+1),t=t.slice(0,i);if(t&&!types.hasOwnProperty(t))throw new Error("unknown type: "+t);return{type:t,name:name};});}Dispatch.prototype=dispatch.prototype={constructor:Dispatch,on:function on(typename,callback){var _=this._,T=parseTypenames(typename+"",_),t,i=-1,n=T.length;// If no callback was specified, return the callback of the given type and name. +if(arguments.length<2){while(++i<n)if((t=(typename=T[i]).type)&&(t=get(_[t],typename.name)))return t;return;}// If a type was specified, set the callback for the given type and name. +// Otherwise, if a null callback was specified, remove callbacks of the given name. +if(callback!=null&&typeof callback!=="function")throw new Error("invalid callback: "+callback);while(++i<n){if(t=(typename=T[i]).type)_[t]=set(_[t],typename.name,callback);else if(callback==null)for(t in _)_[t]=set(_[t],typename.name,null);}return this;},copy:function copy(){var copy={},_=this._;for(var t in _)copy[t]=_[t].slice();return new Dispatch(copy);},call:function call(type,that){if((n=arguments.length-2)>0)for(var args=new Array(n),i=0,n,t;i<n;++i)args[i]=arguments[i+2];if(!this._.hasOwnProperty(type))throw new Error("unknown type: "+type);for(t=this._[type],i=0,n=t.length;i<n;++i)t[i].value.apply(that,args);},apply:function apply(type,that,args){if(!this._.hasOwnProperty(type))throw new Error("unknown type: "+type);for(var t=this._[type],i=0,n=t.length;i<n;++i)t[i].value.apply(that,args);}};function get(type,name){for(var i=0,n=type.length,c;i<n;++i){if((c=type[i]).name===name){return c.value;}}}function set(type,name,callback){for(var i=0,n=type.length;i<n;++i){if(type[i].name===name){type[i]=noop,type=type.slice(0,i).concat(type.slice(i+1));break;}}if(callback!=null)type.push({name:name,value:callback});return type;}var frame=0,// is an animation frame pending? +timeout=0,// is a timeout pending? +interval$1=0,// are any timers active? +pokeDelay=1000,// how frequently we check for clock skew +taskHead,taskTail,clockLast=0,clockNow=0,clockSkew=0,clock=(typeof performance==="undefined"?"undefined":_typeof(performance))==="object"&&performance.now?performance:Date,setFrame=(typeof window==="undefined"?"undefined":_typeof(window))==="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(f){setTimeout(f,17);};function now(){return clockNow||(setFrame(clearNow),clockNow=clock.now()+clockSkew);}function clearNow(){clockNow=0;}function Timer$1(){this._call=this._time=this._next=null;}Timer$1.prototype=timer$1.prototype={constructor:Timer$1,restart:function restart(callback,delay,time){if(typeof callback!=="function")throw new TypeError("callback is not a function");time=(time==null?now():+time)+(delay==null?0:+delay);if(!this._next&&taskTail!==this){if(taskTail)taskTail._next=this;else taskHead=this;taskTail=this;}this._call=callback;this._time=time;sleep();},stop:function stop(){if(this._call){this._call=null;this._time=Infinity;sleep();}}};function timer$1(callback,delay,time){var t=new Timer$1();t.restart(callback,delay,time);return t;}function timerFlush(){now();// Get the current time, if not already set. +++frame;// Pretend we’ve set an alarm, if we haven’t already. +var t=taskHead,e;while(t){if((e=clockNow-t._time)>=0)t._call.call(undefined,e);t=t._next;}--frame;}function wake(){clockNow=(clockLast=clock.now())+clockSkew;frame=timeout=0;try{timerFlush();}finally{frame=0;nap();clockNow=0;}}function poke(){var now=clock.now(),delay=now-clockLast;if(delay>pokeDelay)clockSkew-=delay,clockLast=now;}function nap(){var t0,t1=taskHead,t2,time=Infinity;while(t1){if(t1._call){if(time>t1._time)time=t1._time;t0=t1,t1=t1._next;}else{t2=t1._next,t1._next=null;t1=t0?t0._next=t2:taskHead=t2;}}taskTail=t0;sleep(time);}function sleep(time){if(frame)return;// Soonest alarm already set, or will be. +if(timeout)timeout=clearTimeout(timeout);var delay=time-clockNow;// Strictly less than if we recomputed clockNow. +if(delay>24){if(time<Infinity)timeout=setTimeout(wake,time-clock.now()-clockSkew);if(interval$1)interval$1=clearInterval(interval$1);}else{if(!interval$1)clockLast=clock.now(),interval$1=setInterval(poke,pokeDelay);frame=1,setFrame(wake);}}function interval(callback,delay,time){var t=new Timer$1(),total=delay;if(delay==null)return t.restart(callback,delay,time),t;t._restart=t.restart;t.restart=function(callback,delay,time){delay=+delay,time=time==null?now():+time;t._restart(function tick(elapsed){elapsed+=total;t._restart(tick,total+=delay,time);callback(elapsed);},delay,time);};t.restart(callback,delay,time);return t;}// https://en.wikipedia.org/wiki/Linear_congruential_generator#Parameters_in_common_use +var a$1=1664525;var c$1=1013904223;var m$1=4294967296;// 2^32 +function lcg$1(){var s=1;return function(){return(s=(a$1*s+c$1)%m$1)/m$1;};}function x(d){return d.x;}function y(d){return d.y;}var initialRadius=10,initialAngle=Math.PI*(3-Math.sqrt(5));function forceSimulation(_nodes2){var simulation,_alpha=1,_alphaMin=0.001,_alphaDecay=1-Math.pow(_alphaMin,1/300),_alphaTarget=0,_velocityDecay=0.6,forces=new Map(),stepper=timer$1(step),event=dispatch("tick","end"),random=lcg$1();if(_nodes2==null)_nodes2=[];function step(){tick();event.call("tick",simulation);if(_alpha<_alphaMin){stepper.stop();event.call("end",simulation);}}function tick(iterations){var i,n=_nodes2.length,node;if(iterations===undefined)iterations=1;for(var k=0;k<iterations;++k){_alpha+=(_alphaTarget-_alpha)*_alphaDecay;forces.forEach(function(force){force(_alpha);});for(i=0;i<n;++i){node=_nodes2[i];if(node.fx==null)node.x+=node.vx*=_velocityDecay;else node.x=node.fx,node.vx=0;if(node.fy==null)node.y+=node.vy*=_velocityDecay;else node.y=node.fy,node.vy=0;}}return simulation;}function initializeNodes(){for(var i=0,n=_nodes2.length,node;i<n;++i){node=_nodes2[i],node.index=i;if(node.fx!=null)node.x=node.fx;if(node.fy!=null)node.y=node.fy;if(isNaN(node.x)||isNaN(node.y)){var radius=initialRadius*Math.sqrt(0.5+i),angle=i*initialAngle;node.x=radius*Math.cos(angle);node.y=radius*Math.sin(angle);}if(isNaN(node.vx)||isNaN(node.vy)){node.vx=node.vy=0;}}}function initializeForce(force){if(force.initialize)force.initialize(_nodes2,random);return force;}initializeNodes();return simulation={tick:tick,restart:function restart(){return stepper.restart(step),simulation;},stop:function stop(){return stepper.stop(),simulation;},nodes:function nodes(_){return arguments.length?(_nodes2=_,initializeNodes(),forces.forEach(initializeForce),simulation):_nodes2;},alpha:function alpha(_){return arguments.length?(_alpha=+_,simulation):_alpha;},alphaMin:function alphaMin(_){return arguments.length?(_alphaMin=+_,simulation):_alphaMin;},alphaDecay:function alphaDecay(_){return arguments.length?(_alphaDecay=+_,simulation):+_alphaDecay;},alphaTarget:function alphaTarget(_){return arguments.length?(_alphaTarget=+_,simulation):_alphaTarget;},velocityDecay:function velocityDecay(_){return arguments.length?(_velocityDecay=1-_,simulation):1-_velocityDecay;},randomSource:function randomSource(_){return arguments.length?(random=_,forces.forEach(initializeForce),simulation):random;},force:function force(name,_){return arguments.length>1?(_==null?forces["delete"](name):forces.set(name,initializeForce(_)),simulation):forces.get(name);},find:function find(x,y,radius){var i=0,n=_nodes2.length,dx,dy,d2,node,closest;if(radius==null)radius=Infinity;else radius*=radius;for(i=0;i<n;++i){node=_nodes2[i];dx=x-node.x;dy=y-node.y;d2=dx*dx+dy*dy;if(d2<radius)closest=node,radius=d2;}return closest;},on:function on(name,_){return arguments.length>1?(event.on(name,_),simulation):event.on(name);}};}function forceManyBody(){var nodes,node,random,alpha,strength=constant$1(-30),strengths,distanceMin2=1,distanceMax2=Infinity,theta2=0.81;function force(_){var i,n=nodes.length,tree=quadtree(nodes,x,y).visitAfter(accumulate);for(alpha=_,i=0;i<n;++i)node=nodes[i],tree.visit(apply);}function initialize(){if(!nodes)return;var i,n=nodes.length,node;strengths=new Array(n);for(i=0;i<n;++i)node=nodes[i],strengths[node.index]=+strength(node,i,nodes);}function accumulate(quad){var strength=0,q,c,weight=0,x,y,i;// For internal nodes, accumulate forces from child quadrants. +if(quad.length){for(x=y=i=0;i<4;++i){if((q=quad[i])&&(c=Math.abs(q.value))){strength+=q.value,weight+=c,x+=c*q.x,y+=c*q.y;}}quad.x=x/weight;quad.y=y/weight;}// For leaf nodes, accumulate forces from coincident quadrants. +else{q=quad;q.x=q.data.x;q.y=q.data.y;do strength+=strengths[q.data.index];while(q=q.next);}quad.value=strength;}function apply(quad,x1,_,x2){if(!quad.value)return true;var x=quad.x-node.x,y=quad.y-node.y,w=x2-x1,l=x*x+y*y;// Apply the Barnes-Hut approximation if possible. +// Limit forces for very close nodes; randomize direction if coincident. +if(w*w/theta2<l){if(l<distanceMax2){if(x===0)x=jiggle(random),l+=x*x;if(y===0)y=jiggle(random),l+=y*y;if(l<distanceMin2)l=Math.sqrt(distanceMin2*l);node.vx+=x*quad.value*alpha/l;node.vy+=y*quad.value*alpha/l;}return true;}// Otherwise, process points directly. +else if(quad.length||l>=distanceMax2)return;// Limit forces for very close nodes; randomize direction if coincident. +if(quad.data!==node||quad.next){if(x===0)x=jiggle(random),l+=x*x;if(y===0)y=jiggle(random),l+=y*y;if(l<distanceMin2)l=Math.sqrt(distanceMin2*l);}do if(quad.data!==node){w=strengths[quad.data.index]*alpha/l;node.vx+=x*w;node.vy+=y*w;}while(quad=quad.next);}force.initialize=function(_nodes,_random){nodes=_nodes;random=_random;initialize();};force.strength=function(_){return arguments.length?(strength=typeof _==="function"?_:constant$1(+_),initialize(),force):strength;};force.distanceMin=function(_){return arguments.length?(distanceMin2=_*_,force):Math.sqrt(distanceMin2);};force.distanceMax=function(_){return arguments.length?(distanceMax2=_*_,force):Math.sqrt(distanceMax2);};force.theta=function(_){return arguments.length?(theta2=_*_,force):Math.sqrt(theta2);};return force;}function forceX(x){var strength=constant$1(0.1),nodes,strengths,xz;if(typeof x!=="function")x=constant$1(x==null?0:+x);function force(alpha){for(var i=0,n=nodes.length,node;i<n;++i){node=nodes[i],node.vx+=(xz[i]-node.x)*strengths[i]*alpha;}}function initialize(){if(!nodes)return;var i,n=nodes.length;strengths=new Array(n);xz=new Array(n);for(i=0;i<n;++i){strengths[i]=isNaN(xz[i]=+x(nodes[i],i,nodes))?0:+strength(nodes[i],i,nodes);}}force.initialize=function(_){nodes=_;initialize();};force.strength=function(_){return arguments.length?(strength=typeof _==="function"?_:constant$1(+_),initialize(),force):strength;};force.x=function(_){return arguments.length?(x=typeof _==="function"?_:constant$1(+_),initialize(),force):x;};return force;}function forceY(y){var strength=constant$1(0.1),nodes,strengths,yz;if(typeof y!=="function")y=constant$1(y==null?0:+y);function force(alpha){for(var i=0,n=nodes.length,node;i<n;++i){node=nodes[i],node.vy+=(yz[i]-node.y)*strengths[i]*alpha;}}function initialize(){if(!nodes)return;var i,n=nodes.length;strengths=new Array(n);yz=new Array(n);for(i=0;i<n;++i){strengths[i]=isNaN(yz[i]=+y(nodes[i],i,nodes))?0:+strength(nodes[i],i,nodes);}}force.initialize=function(_){nodes=_;initialize();};force.strength=function(_){return arguments.length?(strength=typeof _==="function"?_:constant$1(+_),initialize(),force):strength;};force.y=function(_){return arguments.length?(y=typeof _==="function"?_:constant$1(+_),initialize(),force):y;};return force;}var ForceMap={center:forceCenter,collide:forceCollide,nbody:forceManyBody,link:forceLink,x:forceX,y:forceY};var Forces='forces',ForceParams=['alpha','alphaMin','alphaTarget','velocityDecay','forces'],ForceConfig=['static','iterations'],ForceOutput=['x','y','vx','vy'];/** + * Force simulation layout. + * @constructor + * @param {object} params - The parameters for this operator. + * @param {Array<object>} params.forces - The forces to apply. + */function Force(params){Transform.call(this,null,params);}Force.Definition={'type':'Force','metadata':{'modifies':true},'params':[{'name':'static','type':'boolean','default':false},{'name':'restart','type':'boolean','default':false},{'name':'iterations','type':'number','default':300},{'name':'alpha','type':'number','default':1},{'name':'alphaMin','type':'number','default':0.001},{'name':'alphaTarget','type':'number','default':0},{'name':'velocityDecay','type':'number','default':0.4},{'name':'forces','type':'param','array':true,'params':[{'key':{'force':'center'},'params':[{'name':'x','type':'number','default':0},{'name':'y','type':'number','default':0}]},{'key':{'force':'collide'},'params':[{'name':'radius','type':'number','expr':true},{'name':'strength','type':'number','default':0.7},{'name':'iterations','type':'number','default':1}]},{'key':{'force':'nbody'},'params':[{'name':'strength','type':'number','default':-30,'expr':true},{'name':'theta','type':'number','default':0.9},{'name':'distanceMin','type':'number','default':1},{'name':'distanceMax','type':'number'}]},{'key':{'force':'link'},'params':[{'name':'links','type':'data'},{'name':'id','type':'field'},{'name':'distance','type':'number','default':30,'expr':true},{'name':'strength','type':'number','expr':true},{'name':'iterations','type':'number','default':1}]},{'key':{'force':'x'},'params':[{'name':'strength','type':'number','default':0.1},{'name':'x','type':'field'}]},{'key':{'force':'y'},'params':[{'name':'strength','type':'number','default':0.1},{'name':'y','type':'field'}]}]},{'name':'as','type':'string','array':true,'modify':false,'default':ForceOutput}]};inherits(Force,Transform,{transform:function transform(_,pulse){var sim=this.value,change=pulse.changed(pulse.ADD_REM),params=_.modified(ForceParams),iters=_.iterations||300;// configure simulation +if(!sim){this.value=sim=simulation(pulse.source,_);sim.on('tick',rerun(pulse.dataflow,this));if(!_["static"]){change=true;sim.tick();// ensure we run on init +}pulse.modifies('index');}else{if(change){pulse.modifies('index');sim.nodes(pulse.source);}if(params||pulse.changed(pulse.MOD)){setup(sim,_,0,pulse);}}// run simulation +if(params||change||_.modified(ForceConfig)||pulse.changed()&&_.restart){sim.alpha(Math.max(sim.alpha(),_.alpha||1)).alphaDecay(1-Math.pow(sim.alphaMin(),1/iters));if(_["static"]){for(sim.stop();--iters>=0;)sim.tick();}else{if(sim.stopped())sim.restart();if(!change)return pulse.StopPropagation;// defer to sim ticks +}}return this.finish(_,pulse);},finish:function finish(_,pulse){var dataflow=pulse.dataflow;// inspect dependencies, touch link source data +for(var args=this._argops,j=0,_m4=args.length,arg;j<_m4;++j){arg=args[j];if(arg.name!==Forces||arg.op._argval.force!=='link'){continue;}for(var ops=arg.op._argops,i=0,n=ops.length,op;i<n;++i){if(ops[i].name==='links'&&(op=ops[i].op.source)){dataflow.pulse(op,dataflow.changeset().reflow());break;}}}// reflow all nodes +return pulse.reflow(_.modified()).modifies(ForceOutput);}});function rerun(df,op){return function(){return df.touch(op).run();};}function simulation(nodes,_){var sim=forceSimulation(nodes),stop=sim.stop,restart=sim.restart;var stopped=false;sim.stopped=function(){return stopped;};sim.restart=function(){return stopped=false,restart();};sim.stop=function(){return stopped=true,stop();};return setup(sim,_,true).on('end',function(){return stopped=true;});}function setup(sim,_,init,pulse){var f=array$5(_.forces),i,n,p,name;for(i=0,n=ForceParams.length;i<n;++i){p=ForceParams[i];if(p!==Forces&&_.modified(p))sim[p](_[p]);}for(i=0,n=f.length;i<n;++i){name=Forces+i;p=init||_.modified(Forces,i)?getForce(f[i]):pulse&&modified(f[i],pulse)?sim.force(name):null;if(p)sim.force(name,p);}for(n=sim.numForces||0;i<n;++i){sim.force(Forces+i,null);// remove +}sim.numForces=f.length;return sim;}function modified(f,pulse){var k,v;for(k in f){if(isFunction(v=f[k])&&pulse.modified(accessorFields(v)))return 1;}return 0;}function getForce(_){var f,p;if(!has$1(ForceMap,_.force)){error('Unrecognized force: '+_.force);}f=ForceMap[_.force]();for(p in _){if(isFunction(f[p]))setForceParam(f[p],_[p],_);}return f;}function setForceParam(f,v,_){f(isFunction(v)?function(d){return v(d,_);}:v);}var force=/*#__PURE__*/Object.freeze({__proto__:null,force:Force});function defaultSeparation$2(a,b){return a.parent===b.parent?1:2;}function meanX(children){return children.reduce(meanXReduce,0)/children.length;}function meanXReduce(x,c){return x+c.x;}function maxY(children){return 1+children.reduce(maxYReduce,0);}function maxYReduce(y,c){return Math.max(y,c.y);}function leafLeft(node){var children;while(children=node.children)node=children[0];return node;}function leafRight(node){var children;while(children=node.children)node=children[children.length-1];return node;}function cluster(){var separation=defaultSeparation$2,dx=1,dy=1,nodeSize=false;function cluster(root){var previousNode,x=0;// First walk, computing the initial x & y values. +root.eachAfter(function(node){var children=node.children;if(children){node.x=meanX(children);node.y=maxY(children);}else{node.x=previousNode?x+=separation(node,previousNode):0;node.y=0;previousNode=node;}});var left=leafLeft(root),right=leafRight(root),x0=left.x-separation(left,right)/2,x1=right.x+separation(right,left)/2;// Second walk, normalizing x & y to the desired size. +return root.eachAfter(nodeSize?function(node){node.x=(node.x-root.x)*dx;node.y=(root.y-node.y)*dy;}:function(node){node.x=(node.x-x0)/(x1-x0)*dx;node.y=(1-(root.y?node.y/root.y:1))*dy;});}cluster.separation=function(x){return arguments.length?(separation=x,cluster):separation;};cluster.size=function(x){return arguments.length?(nodeSize=false,dx=+x[0],dy=+x[1],cluster):nodeSize?null:[dx,dy];};cluster.nodeSize=function(x){return arguments.length?(nodeSize=true,dx=+x[0],dy=+x[1],cluster):nodeSize?[dx,dy]:null;};return cluster;}function count(node){var sum=0,children=node.children,i=children&&children.length;if(!i)sum=1;else while(--i>=0)sum+=children[i].value;node.value=sum;}function node_count(){return this.eachAfter(count);}function node_each(callback,that){var index=-1;var _iterator26=_createForOfIteratorHelper(this),_step26;try{for(_iterator26.s();!(_step26=_iterator26.n()).done;){var node=_step26.value;callback.call(that,node,++index,this);}}catch(err){_iterator26.e(err);}finally{_iterator26.f();}return this;}function node_eachBefore(callback,that){var node=this,nodes=[node],children,i,index=-1;while(node=nodes.pop()){callback.call(that,node,++index,this);if(children=node.children){for(i=children.length-1;i>=0;--i){nodes.push(children[i]);}}}return this;}function node_eachAfter(callback,that){var node=this,nodes=[node],next=[],children,i,n,index=-1;while(node=nodes.pop()){next.push(node);if(children=node.children){for(i=0,n=children.length;i<n;++i){nodes.push(children[i]);}}}while(node=next.pop()){callback.call(that,node,++index,this);}return this;}function node_find(callback,that){var index=-1;var _iterator27=_createForOfIteratorHelper(this),_step27;try{for(_iterator27.s();!(_step27=_iterator27.n()).done;){var node=_step27.value;if(callback.call(that,node,++index,this)){return node;}}}catch(err){_iterator27.e(err);}finally{_iterator27.f();}}function node_sum(value){return this.eachAfter(function(node){var sum=+value(node.data)||0,children=node.children,i=children&&children.length;while(--i>=0)sum+=children[i].value;node.value=sum;});}function node_sort(compare){return this.eachBefore(function(node){if(node.children){node.children.sort(compare);}});}function node_path(end){var start=this,ancestor=leastCommonAncestor(start,end),nodes=[start];while(start!==ancestor){start=start.parent;nodes.push(start);}var k=nodes.length;while(end!==ancestor){nodes.splice(k,0,end);end=end.parent;}return nodes;}function leastCommonAncestor(a,b){if(a===b)return a;var aNodes=a.ancestors(),bNodes=b.ancestors(),c=null;a=aNodes.pop();b=bNodes.pop();while(a===b){c=a;a=aNodes.pop();b=bNodes.pop();}return c;}function node_ancestors(){var node=this,nodes=[node];while(node=node.parent){nodes.push(node);}return nodes;}function node_descendants(){return Array.from(this);}function node_leaves(){var leaves=[];this.eachBefore(function(node){if(!node.children){leaves.push(node);}});return leaves;}function node_links(){var root=this,links=[];root.each(function(node){if(node!==root){// Don’t include the root’s parent, if any. +links.push({source:node.parent,target:node});}});return links;}function node_iterator(){var node,current,next,children,i,n;return _regenerator().w(function(_context5){while(1)switch(_context5.n){case 0:node=this,next=[node];case 1:current=next.reverse(),next=[];case 2:if(!(node=current.pop())){_context5.n=4;break;}_context5.n=3;return node;case 3:if(children=node.children){for(i=0,n=children.length;i<n;++i){next.push(children[i]);}}_context5.n=2;break;case 4:if(next.length){_context5.n=1;break;}case 5:return _context5.a(2);}},_marked4,this);}function hierarchy(data,children){if(data instanceof Map){data=[undefined,data];if(children===undefined)children=mapChildren;}else if(children===undefined){children=objectChildren;}var root=new Node$1(data),node,nodes=[root],child,childs,i,n;while(node=nodes.pop()){if((childs=children(node.data))&&(n=(childs=Array.from(childs)).length)){node.children=childs;for(i=n-1;i>=0;--i){nodes.push(child=childs[i]=new Node$1(childs[i]));child.parent=node;child.depth=node.depth+1;}}}return root.eachBefore(computeHeight);}function node_copy(){return hierarchy(this).eachBefore(copyData);}function objectChildren(d){return d.children;}function mapChildren(d){return Array.isArray(d)?d[1]:null;}function copyData(node){if(node.data.value!==undefined)node.value=node.data.value;node.data=node.data.data;}function computeHeight(node){var height=0;do node.height=height;while((node=node.parent)&&node.height<++height);}function Node$1(data){this.data=data;this.depth=this.height=0;this.parent=null;}Node$1.prototype=hierarchy.prototype=_defineProperty({constructor:Node$1,count:node_count,each:node_each,eachAfter:node_eachAfter,eachBefore:node_eachBefore,find:node_find,sum:node_sum,sort:node_sort,path:node_path,ancestors:node_ancestors,descendants:node_descendants,leaves:node_leaves,links:node_links,copy:node_copy},Symbol.iterator,node_iterator);function optional(f){return f==null?null:required(f);}function required(f){if(typeof f!=="function")throw new Error();return f;}function constantZero(){return 0;}function constant(x){return function(){return x;};}// https://en.wikipedia.org/wiki/Linear_congruential_generator#Parameters_in_common_use +var a=1664525;var c=1013904223;var m=4294967296;// 2^32 +function lcg(){var s=1;return function(){return(s=(a*s+c)%m)/m;};}function array$2(x){return _typeof(x)==="object"&&"length"in x?x// Array, TypedArray, NodeList, array-like +:Array.from(x);// Map, Set, iterable, string, or anything else +}function shuffle(array,random){var m=array.length,t,i;while(m){i=random()*m--|0;t=array[m];array[m]=array[i];array[i]=t;}return array;}function packEncloseRandom(circles,random){var i=0,n=(circles=shuffle(Array.from(circles),random)).length,B=[],p,e;while(i<n){p=circles[i];if(e&&enclosesWeak(e,p))++i;else e=encloseBasis(B=extendBasis(B,p)),i=0;}return e;}function extendBasis(B,p){var i,j;if(enclosesWeakAll(p,B))return[p];// If we get here then B must have at least one element. +for(i=0;i<B.length;++i){if(enclosesNot(p,B[i])&&enclosesWeakAll(encloseBasis2(B[i],p),B)){return[B[i],p];}}// If we get here then B must have at least two elements. +for(i=0;i<B.length-1;++i){for(j=i+1;j<B.length;++j){if(enclosesNot(encloseBasis2(B[i],B[j]),p)&&enclosesNot(encloseBasis2(B[i],p),B[j])&&enclosesNot(encloseBasis2(B[j],p),B[i])&&enclosesWeakAll(encloseBasis3(B[i],B[j],p),B)){return[B[i],B[j],p];}}}// If we get here then something is very wrong. +throw new Error();}function enclosesNot(a,b){var dr=a.r-b.r,dx=b.x-a.x,dy=b.y-a.y;return dr<0||dr*dr<dx*dx+dy*dy;}function enclosesWeak(a,b){var dr=a.r-b.r+Math.max(a.r,b.r,1)*1e-9,dx=b.x-a.x,dy=b.y-a.y;return dr>0&&dr*dr>dx*dx+dy*dy;}function enclosesWeakAll(a,B){for(var i=0;i<B.length;++i){if(!enclosesWeak(a,B[i])){return false;}}return true;}function encloseBasis(B){switch(B.length){case 1:return encloseBasis1(B[0]);case 2:return encloseBasis2(B[0],B[1]);case 3:return encloseBasis3(B[0],B[1],B[2]);}}function encloseBasis1(a){return{x:a.x,y:a.y,r:a.r};}function encloseBasis2(a,b){var x1=a.x,y1=a.y,r1=a.r,x2=b.x,y2=b.y,r2=b.r,x21=x2-x1,y21=y2-y1,r21=r2-r1,l=Math.sqrt(x21*x21+y21*y21);return{x:(x1+x2+x21/l*r21)/2,y:(y1+y2+y21/l*r21)/2,r:(l+r1+r2)/2};}function encloseBasis3(a,b,c){var x1=a.x,y1=a.y,r1=a.r,x2=b.x,y2=b.y,r2=b.r,x3=c.x,y3=c.y,r3=c.r,a2=x1-x2,a3=x1-x3,b2=y1-y2,b3=y1-y3,c2=r2-r1,c3=r3-r1,d1=x1*x1+y1*y1-r1*r1,d2=d1-x2*x2-y2*y2+r2*r2,d3=d1-x3*x3-y3*y3+r3*r3,ab=a3*b2-a2*b3,xa=(b2*d3-b3*d2)/(ab*2)-x1,xb=(b3*c2-b2*c3)/ab,ya=(a3*d2-a2*d3)/(ab*2)-y1,yb=(a2*c3-a3*c2)/ab,A=xb*xb+yb*yb-1,B=2*(r1+xa*xb+ya*yb),C=xa*xa+ya*ya-r1*r1,r=-(Math.abs(A)>1e-6?(B+Math.sqrt(B*B-4*A*C))/(2*A):C/B);return{x:x1+xa+xb*r,y:y1+ya+yb*r,r:r};}function place(b,a,c){var dx=b.x-a.x,x,a2,dy=b.y-a.y,y,b2,d2=dx*dx+dy*dy;if(d2){a2=a.r+c.r,a2*=a2;b2=b.r+c.r,b2*=b2;if(a2>b2){x=(d2+b2-a2)/(2*d2);y=Math.sqrt(Math.max(0,b2/d2-x*x));c.x=b.x-x*dx-y*dy;c.y=b.y-x*dy+y*dx;}else{x=(d2+a2-b2)/(2*d2);y=Math.sqrt(Math.max(0,a2/d2-x*x));c.x=a.x+x*dx-y*dy;c.y=a.y+x*dy+y*dx;}}else{c.x=a.x+c.r;c.y=a.y;}}function intersects(a,b){var dr=a.r+b.r-1e-6,dx=b.x-a.x,dy=b.y-a.y;return dr>0&&dr*dr>dx*dx+dy*dy;}function score(node){var a=node._,b=node.next._,ab=a.r+b.r,dx=(a.x*b.r+b.x*a.r)/ab,dy=(a.y*b.r+b.y*a.r)/ab;return dx*dx+dy*dy;}function Node(circle){this._=circle;this.next=null;this.previous=null;}function packSiblingsRandom(circles,random){if(!(n=(circles=array$2(circles)).length))return 0;var a,b,c,n,aa,ca,i,j,k,sj,sk;// Place the first circle. +a=circles[0],a.x=0,a.y=0;if(!(n>1))return a.r;// Place the second circle. +b=circles[1],a.x=-b.r,b.x=a.r,b.y=0;if(!(n>2))return a.r+b.r;// Place the third circle. +place(b,a,c=circles[2]);// Initialize the front-chain using the first three circles a, b and c. +a=new Node(a),b=new Node(b),c=new Node(c);a.next=c.previous=b;b.next=a.previous=c;c.next=b.previous=a;// Attempt to place each remaining circle… +pack:for(i=3;i<n;++i){place(a._,b._,c=circles[i]),c=new Node(c);// Find the closest intersecting circle on the front-chain, if any. +// “Closeness” is determined by linear distance along the front-chain. +// “Ahead” or “behind” is likewise determined by linear distance. +j=b.next,k=a.previous,sj=b._.r,sk=a._.r;do{if(sj<=sk){if(intersects(j._,c._)){b=j,a.next=b,b.previous=a,--i;continue pack;}sj+=j._.r,j=j.next;}else{if(intersects(k._,c._)){a=k,a.next=b,b.previous=a,--i;continue pack;}sk+=k._.r,k=k.previous;}}while(j!==k.next);// Success! Insert the new circle c between a and b. +c.previous=a,c.next=b,a.next=b.previous=b=c;// Compute the new closest circle pair to the centroid. +aa=score(a);while((c=c.next)!==b){if((ca=score(c))<aa){a=c,aa=ca;}}b=a.next;}// Compute the enclosing circle of the front chain. +a=[b._],c=b;while((c=c.next)!==b)a.push(c._);c=packEncloseRandom(a,random);// Translate the circles to put the enclosing circle around the origin. +for(i=0;i<n;++i)a=circles[i],a.x-=c.x,a.y-=c.y;return c.r;}function defaultRadius(d){return Math.sqrt(d.value);}function pack(){var radius=null,dx=1,dy=1,padding=constantZero;function pack(root){var random=lcg();root.x=dx/2,root.y=dy/2;if(radius){root.eachBefore(radiusLeaf(radius)).eachAfter(packChildrenRandom(padding,0.5,random)).eachBefore(translateChild(1));}else{root.eachBefore(radiusLeaf(defaultRadius)).eachAfter(packChildrenRandom(constantZero,1,random)).eachAfter(packChildrenRandom(padding,root.r/Math.min(dx,dy),random)).eachBefore(translateChild(Math.min(dx,dy)/(2*root.r)));}return root;}pack.radius=function(x){return arguments.length?(radius=optional(x),pack):radius;};pack.size=function(x){return arguments.length?(dx=+x[0],dy=+x[1],pack):[dx,dy];};pack.padding=function(x){return arguments.length?(padding=typeof x==="function"?x:constant(+x),pack):padding;};return pack;}function radiusLeaf(radius){return function(node){if(!node.children){node.r=Math.max(0,+radius(node)||0);}};}function packChildrenRandom(padding,k,random){return function(node){if(children=node.children){var children,i,n=children.length,r=padding(node)*k||0,e;if(r)for(i=0;i<n;++i)children[i].r+=r;e=packSiblingsRandom(children,random);if(r)for(i=0;i<n;++i)children[i].r-=r;node.r=e+r;}};}function translateChild(k){return function(node){var parent=node.parent;node.r*=k;if(parent){node.x=parent.x+k*node.x;node.y=parent.y+k*node.y;}};}function roundNode(node){node.x0=Math.round(node.x0);node.y0=Math.round(node.y0);node.x1=Math.round(node.x1);node.y1=Math.round(node.y1);}function treemapDice(parent,x0,y0,x1,y1){var nodes=parent.children,node,i=-1,n=nodes.length,k=parent.value&&(x1-x0)/parent.value;while(++i<n){node=nodes[i],node.y0=y0,node.y1=y1;node.x0=x0,node.x1=x0+=node.value*k;}}function partition$1(){var dx=1,dy=1,padding=0,round=false;function partition(root){var n=root.height+1;root.x0=root.y0=padding;root.x1=dx;root.y1=dy/n;root.eachBefore(positionNode(dy,n));if(round)root.eachBefore(roundNode);return root;}function positionNode(dy,n){return function(node){if(node.children){treemapDice(node,node.x0,dy*(node.depth+1)/n,node.x1,dy*(node.depth+2)/n);}var x0=node.x0,y0=node.y0,x1=node.x1-padding,y1=node.y1-padding;if(x1<x0)x0=x1=(x0+x1)/2;if(y1<y0)y0=y1=(y0+y1)/2;node.x0=x0;node.y0=y0;node.x1=x1;node.y1=y1;};}partition.round=function(x){return arguments.length?(round=!!x,partition):round;};partition.size=function(x){return arguments.length?(dx=+x[0],dy=+x[1],partition):[dx,dy];};partition.padding=function(x){return arguments.length?(padding=+x,partition):padding;};return partition;}var preroot={depth:-1},ambiguous={},imputed={};function defaultId(d){return d.id;}function defaultParentId(d){return d.parentId;}function stratify(){var id=defaultId,parentId=defaultParentId,path;function stratify(data){var nodes=Array.from(data),currentId=id,currentParentId=parentId,n,d,i,root,parent,node,nodeId,nodeKey,nodeByKey=new Map();if(path!=null){var I=nodes.map(function(d,i){return normalize(path(d,i,data));});var P=I.map(parentof);var S=new Set(I).add("");var _iterator28=_createForOfIteratorHelper(P),_step28;try{for(_iterator28.s();!(_step28=_iterator28.n()).done;){var _i12=_step28.value;if(!S.has(_i12)){S.add(_i12);I.push(_i12);P.push(parentof(_i12));nodes.push(imputed);}}}catch(err){_iterator28.e(err);}finally{_iterator28.f();}currentId=function currentId(_,i){return I[i];};currentParentId=function currentParentId(_,i){return P[i];};}for(i=0,n=nodes.length;i<n;++i){d=nodes[i],node=nodes[i]=new Node$1(d);if((nodeId=currentId(d,i,data))!=null&&(nodeId+="")){nodeKey=node.id=nodeId;nodeByKey.set(nodeKey,nodeByKey.has(nodeKey)?ambiguous:node);}if((nodeId=currentParentId(d,i,data))!=null&&(nodeId+="")){node.parent=nodeId;}}for(i=0;i<n;++i){node=nodes[i];if(nodeId=node.parent){parent=nodeByKey.get(nodeId);if(!parent)throw new Error("missing: "+nodeId);if(parent===ambiguous)throw new Error("ambiguous: "+nodeId);if(parent.children)parent.children.push(node);else parent.children=[node];node.parent=parent;}else{if(root)throw new Error("multiple roots");root=node;}}if(!root)throw new Error("no root");// When imputing internal nodes, only introduce roots if needed. +// Then replace the imputed marker data with null. +if(path!=null){while(root.data===imputed&&root.children.length===1){root=root.children[0],--n;}for(var _i13=nodes.length-1;_i13>=0;--_i13){node=nodes[_i13];if(node.data!==imputed)break;node.data=null;}}root.parent=preroot;root.eachBefore(function(node){node.depth=node.parent.depth+1;--n;}).eachBefore(computeHeight);root.parent=null;if(n>0)throw new Error("cycle");return root;}stratify.id=function(x){return arguments.length?(id=optional(x),stratify):id;};stratify.parentId=function(x){return arguments.length?(parentId=optional(x),stratify):parentId;};stratify.path=function(x){return arguments.length?(path=optional(x),stratify):path;};return stratify;}// To normalize a path, we coerce to a string, strip the trailing slash if any +// (as long as the trailing slash is not immediately preceded by another slash), +// and add leading slash if missing. +function normalize(path){path="".concat(path);var i=path.length;if(slash(path,i-1)&&!slash(path,i-2))path=path.slice(0,-1);return path[0]==="/"?path:"/".concat(path);}// Walk backwards to find the first slash that is not the leading slash, e.g.: +// "/foo/bar" ⇥ "/foo", "/foo" ⇥ "/", "/" ↦ "". (The root is special-cased +// because the id of the root must be a truthy value.) +function parentof(path){var i=path.length;if(i<2)return"";while(--i>1)if(slash(path,i))break;return path.slice(0,i);}// Slashes can be escaped; to determine whether a slash is a path delimiter, we +// count the number of preceding backslashes escaping the forward slash: an odd +// number indicates an escaped forward slash. +function slash(path,i){if(path[i]==="/"){var k=0;while(i>0&&path[--i]==="\\")++k;if((k&1)===0)return true;}return false;}function defaultSeparation$1(a,b){return a.parent===b.parent?1:2;}// function radialSeparation(a, b) { +// return (a.parent === b.parent ? 1 : 2) / a.depth; +// } +// This function is used to traverse the left contour of a subtree (or +// subforest). It returns the successor of v on this contour. This successor is +// either given by the leftmost child of v or by the thread of v. The function +// returns null if and only if v is on the highest level of its subtree. +function nextLeft(v){var children=v.children;return children?children[0]:v.t;}// This function works analogously to nextLeft. +function nextRight(v){var children=v.children;return children?children[children.length-1]:v.t;}// Shifts the current subtree rooted at w+. This is done by increasing +// prelim(w+) and mod(w+) by shift. +function moveSubtree(wm,wp,shift){var change=shift/(wp.i-wm.i);wp.c-=change;wp.s+=shift;wm.c+=change;wp.z+=shift;wp.m+=shift;}// All other shifts, applied to the smaller subtrees between w- and w+, are +// performed by this function. To prepare the shifts, we have to adjust +// change(w+), shift(w+), and change(w-). +function executeShifts(v){var shift=0,change=0,children=v.children,i=children.length,w;while(--i>=0){w=children[i];w.z+=shift;w.m+=shift;shift+=w.s+(change+=w.c);}}// If vi-’s ancestor is a sibling of v, returns vi-’s ancestor. Otherwise, +// returns the specified (default) ancestor. +function nextAncestor(vim,v,ancestor){return vim.a.parent===v.parent?vim.a:ancestor;}function TreeNode(node,i){this._=node;this.parent=null;this.children=null;this.A=null;// default ancestor +this.a=this;// ancestor +this.z=0;// prelim +this.m=0;// mod +this.c=0;// change +this.s=0;// shift +this.t=null;// thread +this.i=i;// number +}TreeNode.prototype=Object.create(Node$1.prototype);function treeRoot(root){var tree=new TreeNode(root,0),node,nodes=[tree],child,children,i,n;while(node=nodes.pop()){if(children=node._.children){node.children=new Array(n=children.length);for(i=n-1;i>=0;--i){nodes.push(child=node.children[i]=new TreeNode(children[i],i));child.parent=node;}}}(tree.parent=new TreeNode(null,0)).children=[tree];return tree;}// Node-link tree diagram using the Reingold-Tilford "tidy" algorithm +function tree$1(){var separation=defaultSeparation$1,dx=1,dy=1,nodeSize=null;function tree(root){var t=treeRoot(root);// Compute the layout using Buchheim et al.’s algorithm. +t.eachAfter(firstWalk),t.parent.m=-t.z;t.eachBefore(secondWalk);// If a fixed node size is specified, scale x and y. +if(nodeSize)root.eachBefore(sizeNode);// If a fixed tree size is specified, scale x and y based on the extent. +// Compute the left-most, right-most, and depth-most nodes for extents. +else{var left=root,right=root,bottom=root;root.eachBefore(function(node){if(node.x<left.x)left=node;if(node.x>right.x)right=node;if(node.depth>bottom.depth)bottom=node;});var s=left===right?1:separation(left,right)/2,tx=s-left.x,kx=dx/(right.x+s+tx),ky=dy/(bottom.depth||1);root.eachBefore(function(node){node.x=(node.x+tx)*kx;node.y=node.depth*ky;});}return root;}// Computes a preliminary x-coordinate for v. Before that, FIRST WALK is +// applied recursively to the children of v, as well as the function +// APPORTION. After spacing out the children by calling EXECUTE SHIFTS, the +// node v is placed to the midpoint of its outermost children. +function firstWalk(v){var children=v.children,siblings=v.parent.children,w=v.i?siblings[v.i-1]:null;if(children){executeShifts(v);var midpoint=(children[0].z+children[children.length-1].z)/2;if(w){v.z=w.z+separation(v._,w._);v.m=v.z-midpoint;}else{v.z=midpoint;}}else if(w){v.z=w.z+separation(v._,w._);}v.parent.A=apportion(v,w,v.parent.A||siblings[0]);}// Computes all real x-coordinates by summing up the modifiers recursively. +function secondWalk(v){v._.x=v.z+v.parent.m;v.m+=v.parent.m;}// The core of the algorithm. Here, a new subtree is combined with the +// previous subtrees. Threads are used to traverse the inside and outside +// contours of the left and right subtree up to the highest common level. The +// vertices used for the traversals are vi+, vi-, vo-, and vo+, where the +// superscript o means outside and i means inside, the subscript - means left +// subtree and + means right subtree. For summing up the modifiers along the +// contour, we use respective variables si+, si-, so-, and so+. Whenever two +// nodes of the inside contours conflict, we compute the left one of the +// greatest uncommon ancestors using the function ANCESTOR and call MOVE +// SUBTREE to shift the subtree and prepare the shifts of smaller subtrees. +// Finally, we add a new thread (if necessary). +function apportion(v,w,ancestor){if(w){var vip=v,vop=v,vim=w,vom=vip.parent.children[0],sip=vip.m,sop=vop.m,sim=vim.m,som=vom.m,shift;while(vim=nextRight(vim),vip=nextLeft(vip),vim&&vip){vom=nextLeft(vom);vop=nextRight(vop);vop.a=v;shift=vim.z+sim-vip.z-sip+separation(vim._,vip._);if(shift>0){moveSubtree(nextAncestor(vim,v,ancestor),v,shift);sip+=shift;sop+=shift;}sim+=vim.m;sip+=vip.m;som+=vom.m;sop+=vop.m;}if(vim&&!nextRight(vop)){vop.t=vim;vop.m+=sim-sop;}if(vip&&!nextLeft(vom)){vom.t=vip;vom.m+=sip-som;ancestor=v;}}return ancestor;}function sizeNode(node){node.x*=dx;node.y=node.depth*dy;}tree.separation=function(x){return arguments.length?(separation=x,tree):separation;};tree.size=function(x){return arguments.length?(nodeSize=false,dx=+x[0],dy=+x[1],tree):nodeSize?null:[dx,dy];};tree.nodeSize=function(x){return arguments.length?(nodeSize=true,dx=+x[0],dy=+x[1],tree):nodeSize?[dx,dy]:null;};return tree;}function treemapSlice(parent,x0,y0,x1,y1){var nodes=parent.children,node,i=-1,n=nodes.length,k=parent.value&&(y1-y0)/parent.value;while(++i<n){node=nodes[i],node.x0=x0,node.x1=x1;node.y0=y0,node.y1=y0+=node.value*k;}}var phi=(1+Math.sqrt(5))/2;function squarifyRatio(ratio,parent,x0,y0,x1,y1){var rows=[],nodes=parent.children,row,nodeValue,i0=0,i1=0,n=nodes.length,dx,dy,value=parent.value,sumValue,minValue,maxValue,newRatio,minRatio,alpha,beta;while(i0<n){dx=x1-x0,dy=y1-y0;// Find the next non-empty node. +do sumValue=nodes[i1++].value;while(!sumValue&&i1<n);minValue=maxValue=sumValue;alpha=Math.max(dy/dx,dx/dy)/(value*ratio);beta=sumValue*sumValue*alpha;minRatio=Math.max(maxValue/beta,beta/minValue);// Keep adding nodes while the aspect ratio maintains or improves. +for(;i1<n;++i1){sumValue+=nodeValue=nodes[i1].value;if(nodeValue<minValue)minValue=nodeValue;if(nodeValue>maxValue)maxValue=nodeValue;beta=sumValue*sumValue*alpha;newRatio=Math.max(maxValue/beta,beta/minValue);if(newRatio>minRatio){sumValue-=nodeValue;break;}minRatio=newRatio;}// Position and record the row orientation. +rows.push(row={value:sumValue,dice:dx<dy,children:nodes.slice(i0,i1)});if(row.dice)treemapDice(row,x0,y0,x1,value?y0+=dy*sumValue/value:y1);else treemapSlice(row,x0,y0,value?x0+=dx*sumValue/value:x1,y1);value-=sumValue,i0=i1;}return rows;}var treemapSquarify=function custom(ratio){function squarify(parent,x0,y0,x1,y1){squarifyRatio(ratio,parent,x0,y0,x1,y1);}squarify.ratio=function(x){return custom((x=+x)>1?x:1);};return squarify;}(phi);function treemap(){var tile=treemapSquarify,round=false,dx=1,dy=1,paddingStack=[0],paddingInner=constantZero,paddingTop=constantZero,paddingRight=constantZero,paddingBottom=constantZero,paddingLeft=constantZero;function treemap(root){root.x0=root.y0=0;root.x1=dx;root.y1=dy;root.eachBefore(positionNode);paddingStack=[0];if(round)root.eachBefore(roundNode);return root;}function positionNode(node){var p=paddingStack[node.depth],x0=node.x0+p,y0=node.y0+p,x1=node.x1-p,y1=node.y1-p;if(x1<x0)x0=x1=(x0+x1)/2;if(y1<y0)y0=y1=(y0+y1)/2;node.x0=x0;node.y0=y0;node.x1=x1;node.y1=y1;if(node.children){p=paddingStack[node.depth+1]=paddingInner(node)/2;x0+=paddingLeft(node)-p;y0+=paddingTop(node)-p;x1-=paddingRight(node)-p;y1-=paddingBottom(node)-p;if(x1<x0)x0=x1=(x0+x1)/2;if(y1<y0)y0=y1=(y0+y1)/2;tile(node,x0,y0,x1,y1);}}treemap.round=function(x){return arguments.length?(round=!!x,treemap):round;};treemap.size=function(x){return arguments.length?(dx=+x[0],dy=+x[1],treemap):[dx,dy];};treemap.tile=function(x){return arguments.length?(tile=required(x),treemap):tile;};treemap.padding=function(x){return arguments.length?treemap.paddingInner(x).paddingOuter(x):treemap.paddingInner();};treemap.paddingInner=function(x){return arguments.length?(paddingInner=typeof x==="function"?x:constant(+x),treemap):paddingInner;};treemap.paddingOuter=function(x){return arguments.length?treemap.paddingTop(x).paddingRight(x).paddingBottom(x).paddingLeft(x):treemap.paddingTop();};treemap.paddingTop=function(x){return arguments.length?(paddingTop=typeof x==="function"?x:constant(+x),treemap):paddingTop;};treemap.paddingRight=function(x){return arguments.length?(paddingRight=typeof x==="function"?x:constant(+x),treemap):paddingRight;};treemap.paddingBottom=function(x){return arguments.length?(paddingBottom=typeof x==="function"?x:constant(+x),treemap):paddingBottom;};treemap.paddingLeft=function(x){return arguments.length?(paddingLeft=typeof x==="function"?x:constant(+x),treemap):paddingLeft;};return treemap;}function treemapBinary(parent,x0,y0,x1,y1){var nodes=parent.children,i,n=nodes.length,sum,sums=new Array(n+1);for(sums[0]=sum=i=0;i<n;++i){sums[i+1]=sum+=nodes[i].value;}partition(0,n,parent.value,x0,y0,x1,y1);function partition(i,j,value,x0,y0,x1,y1){if(i>=j-1){var node=nodes[i];node.x0=x0,node.y0=y0;node.x1=x1,node.y1=y1;return;}var valueOffset=sums[i],valueTarget=value/2+valueOffset,k=i+1,hi=j-1;while(k<hi){var mid=k+hi>>>1;if(sums[mid]<valueTarget)k=mid+1;else hi=mid;}if(valueTarget-sums[k-1]<sums[k]-valueTarget&&i+1<k)--k;var valueLeft=sums[k]-valueOffset,valueRight=value-valueLeft;if(x1-x0>y1-y0){var xk=value?(x0*valueRight+x1*valueLeft)/value:x1;partition(i,k,valueLeft,x0,y0,xk,y1);partition(k,j,valueRight,xk,y0,x1,y1);}else{var yk=value?(y0*valueRight+y1*valueLeft)/value:y1;partition(i,k,valueLeft,x0,y0,x1,yk);partition(k,j,valueRight,x0,yk,x1,y1);}}}function treemapSliceDice(parent,x0,y0,x1,y1){(parent.depth&1?treemapSlice:treemapDice)(parent,x0,y0,x1,y1);}var treemapResquarify=function custom(ratio){function resquarify(parent,x0,y0,x1,y1){if((rows=parent._squarify)&&rows.ratio===ratio){var rows,row,nodes,i,j=-1,n,m=rows.length,value=parent.value;while(++j<m){row=rows[j],nodes=row.children;for(i=row.value=0,n=nodes.length;i<n;++i)row.value+=nodes[i].value;if(row.dice)treemapDice(row,x0,y0,x1,value?y0+=(y1-y0)*row.value/value:y1);else treemapSlice(row,x0,y0,value?x0+=(x1-x0)*row.value/value:x1,y1);value-=row.value;}}else{parent._squarify=rows=squarifyRatio(ratio,parent,x0,y0,x1,y1);rows.ratio=ratio;}}resquarify.ratio=function(x){return custom((x=+x)>1?x:1);};return resquarify;}(phi);// Build lookup table mapping tuple keys to tree node instances +function lookup$2(tree,key,filter){var map={};tree.each(function(node){var t=node.data;if(filter(t))map[key(t)]=node;});tree.lookup=map;return tree;}/** + * Nest tuples into a tree structure, grouped by key values. + * @constructor + * @param {object} params - The parameters for this operator. + * @param {Array<function(object): *>} params.keys - The key fields to nest by, in order. + * @param {boolean} [params.generate=false] - A boolean flag indicating if + * non-leaf nodes generated by this transform should be included in the + * output. The default (false) includes only the input data (leaf nodes) + * in the data stream. + */function Nest(params){Transform.call(this,null,params);}Nest.Definition={'type':'Nest','metadata':{'treesource':true,'changes':true},'params':[{'name':'keys','type':'field','array':true},{'name':'generate','type':'boolean'}]};var children$1=function children$1(n){return n.values;};inherits(Nest,Transform,{transform:function transform(_,pulse){if(!pulse.source){error('Nest transform requires an upstream data source.');}var gen=_.generate,mod=_.modified(),out=pulse.clone(),tree=this.value;if(!tree||mod||pulse.changed()){// collect nodes to remove +if(tree){tree.each(function(node){if(node.children&&isTuple(node.data)){out.rem.push(node.data);}});}// generate new tree structure +this.value=tree=hierarchy({values:array$5(_.keys).reduce(function(n,k){n.key(k);return n;},nest()).entries(out.source)},children$1);// collect nodes to add +if(gen){tree.each(function(node){if(node.children){node=ingest$1(node.data);out.add.push(node);out.source.push(node);}});}// build lookup table +lookup$2(tree,tupleid,tupleid);}out.source.root=tree;return out;}});function nest(){var keys=[],nest={entries:function entries(array){return _entries(apply(array,0),0);},key:function key(d){return keys.push(d),nest;}};function apply(array,depth){if(depth>=keys.length){return array;}var n=array.length,key=keys[depth++],valuesByKey={},result={};var i=-1,keyValue,value,values;while(++i<n){keyValue=key(value=array[i])+'';if(values=valuesByKey[keyValue]){values.push(value);}else{valuesByKey[keyValue]=[value];}}for(keyValue in valuesByKey){result[keyValue]=apply(valuesByKey[keyValue],depth);}return result;}function _entries(map,depth){if(++depth>keys.length)return map;var array=[];for(var _key14 in map){array.push({key:_key14,values:_entries(map[_key14],depth)});}return array;}return nest;}/** + * Abstract class for tree layout. + * @constructor + * @param {object} params - The parameters for this operator. + */function HierarchyLayout(params){Transform.call(this,null,params);}var defaultSeparation=function defaultSeparation(a,b){return a.parent===b.parent?1:2;};inherits(HierarchyLayout,Transform,{transform:function transform(_,pulse){if(!pulse.source||!pulse.source.root){error(this.constructor.name+' transform requires a backing tree data source.');}var layout=this.layout(_.method),fields=this.fields,root=pulse.source.root,as=_.as||fields;if(_.field)root.sum(_.field);else root.count();if(_.sort)root.sort(stableCompare(_.sort,function(d){return d.data;}));setParams(layout,this.params,_);if(layout.separation){layout.separation(_.separation!==false?defaultSeparation:one$2);}try{this.value=layout(root);}catch(err){error(err);}root.each(function(node){return setFields(node,fields,as);});return pulse.reflow(_.modified()).modifies(as).modifies('leaf');}});function setParams(layout,params,_){for(var p,i=0,n=params.length;i<n;++i){p=params[i];if(p in _)layout[p](_[p]);}}function setFields(node,fields,as){var t=node.data,n=fields.length-1;for(var i=0;i<n;++i){t[as[i]]=node[fields[i]];}t[as[n]]=node.children?node.children.length:0;}var Output$3=['x','y','r','depth','children'];/** + * Packed circle tree layout. + * @constructor + * @param {object} params - The parameters for this operator. + * @param {function(object): *} params.field - The value field to size nodes. + */function Pack(params){HierarchyLayout.call(this,params);}Pack.Definition={'type':'Pack','metadata':{'tree':true,'modifies':true},'params':[{'name':'field','type':'field'},{'name':'sort','type':'compare'},{'name':'padding','type':'number','default':0},{'name':'radius','type':'field','default':null},{'name':'size','type':'number','array':true,'length':2},{'name':'as','type':'string','array':true,'length':Output$3.length,'default':Output$3}]};inherits(Pack,HierarchyLayout,{layout:pack,params:['radius','size','padding'],fields:Output$3});var Output$2=['x0','y0','x1','y1','depth','children'];/** + * Partition tree layout. + * @constructor + * @param {object} params - The parameters for this operator. + * @param {function(object): *} params.field - The value field to size nodes. + */function Partition(params){HierarchyLayout.call(this,params);}Partition.Definition={'type':'Partition','metadata':{'tree':true,'modifies':true},'params':[{'name':'field','type':'field'},{'name':'sort','type':'compare'},{'name':'padding','type':'number','default':0},{'name':'round','type':'boolean','default':false},{'name':'size','type':'number','array':true,'length':2},{'name':'as','type':'string','array':true,'length':Output$2.length,'default':Output$2}]};inherits(Partition,HierarchyLayout,{layout:partition$1,params:['size','round','padding'],fields:Output$2});/** + * Stratify a collection of tuples into a tree structure based on + * id and parent id fields. + * @constructor + * @param {object} params - The parameters for this operator. + * @param {function(object): *} params.key - Unique key field for each tuple. + * @param {function(object): *} params.parentKey - Field with key for parent tuple. + */function Stratify(params){Transform.call(this,null,params);}Stratify.Definition={'type':'Stratify','metadata':{'treesource':true},'params':[{'name':'key','type':'field','required':true},{'name':'parentKey','type':'field','required':true}]};inherits(Stratify,Transform,{transform:function transform(_,pulse){if(!pulse.source){error('Stratify transform requires an upstream data source.');}var tree=this.value;var mod=_.modified(),out=pulse.fork(pulse.ALL).materialize(pulse.SOURCE),run=!tree||mod||pulse.changed(pulse.ADD_REM)||pulse.modified(_.key.fields)||pulse.modified(_.parentKey.fields);// prevent upstream source pollution +out.source=out.source.slice();if(run){tree=out.source.length?lookup$2(stratify().id(_.key).parentId(_.parentKey)(out.source),_.key,truthy):lookup$2(stratify()([{}]),_.key,_.key);}out.source.root=this.value=tree;return out;}});var Layouts={tidy:tree$1,cluster:cluster};var Output$1$1=['x','y','depth','children'];/** + * Tree layout. Depending on the method parameter, performs either + * Reingold-Tilford 'tidy' layout or dendrogram 'cluster' layout. + * @constructor + * @param {object} params - The parameters for this operator. + */function Tree(params){HierarchyLayout.call(this,params);}Tree.Definition={'type':'Tree','metadata':{'tree':true,'modifies':true},'params':[{'name':'field','type':'field'},{'name':'sort','type':'compare'},{'name':'method','type':'enum','default':'tidy','values':['tidy','cluster']},{'name':'size','type':'number','array':true,'length':2},{'name':'nodeSize','type':'number','array':true,'length':2},{'name':'separation','type':'boolean','default':true},{'name':'as','type':'string','array':true,'length':Output$1$1.length,'default':Output$1$1}]};inherits(Tree,HierarchyLayout,{/** + * Tree layout generator. Supports both 'tidy' and 'cluster' layouts. + */layout:function layout(method){var m=method||'tidy';if(has$1(Layouts,m))return Layouts[m]();else error('Unrecognized Tree layout method: '+m);},params:['size','nodeSize'],fields:Output$1$1});/** + * Generate tuples representing links between tree nodes. + * The resulting tuples will contain 'source' and 'target' fields, + * which point to parent and child node tuples, respectively. + * @constructor + * @param {object} params - The parameters for this operator. + */function TreeLinks(params){Transform.call(this,[],params);}TreeLinks.Definition={'type':'TreeLinks','metadata':{'tree':true,'generates':true,'changes':true},'params':[]};inherits(TreeLinks,Transform,{transform:function transform(_,pulse){var links=this.value,tree=pulse.source&&pulse.source.root,out=pulse.fork(pulse.NO_SOURCE),lut={};if(!tree)error('TreeLinks transform requires a tree data source.');if(pulse.changed(pulse.ADD_REM)){// remove previous links +out.rem=links;// build lookup table of valid tuples +pulse.visit(pulse.SOURCE,function(t){return lut[tupleid(t)]=1;});// generate links for all edges incident on valid tuples +tree.each(function(node){var t=node.data,p=node.parent&&node.parent.data;if(p&&lut[tupleid(t)]&&lut[tupleid(p)]){out.add.push(ingest$1({source:p,target:t}));}});this.value=out.add;}else if(pulse.changed(pulse.MOD)){// build lookup table of modified tuples +pulse.visit(pulse.MOD,function(t){return lut[tupleid(t)]=1;});// gather links incident on modified tuples +links.forEach(function(link){if(lut[tupleid(link.source)]||lut[tupleid(link.target)]){out.mod.push(link);}});}return out;}});var Tiles={binary:treemapBinary,dice:treemapDice,slice:treemapSlice,slicedice:treemapSliceDice,squarify:treemapSquarify,resquarify:treemapResquarify};var Output$4=['x0','y0','x1','y1','depth','children'];/** + * Treemap layout. + * @constructor + * @param {object} params - The parameters for this operator. + * @param {function(object): *} params.field - The value field to size nodes. + */function Treemap(params){HierarchyLayout.call(this,params);}Treemap.Definition={'type':'Treemap','metadata':{'tree':true,'modifies':true},'params':[{'name':'field','type':'field'},{'name':'sort','type':'compare'},{'name':'method','type':'enum','default':'squarify','values':['squarify','resquarify','binary','dice','slice','slicedice']},{'name':'padding','type':'number','default':0},{'name':'paddingInner','type':'number','default':0},{'name':'paddingOuter','type':'number','default':0},{'name':'paddingTop','type':'number','default':0},{'name':'paddingRight','type':'number','default':0},{'name':'paddingBottom','type':'number','default':0},{'name':'paddingLeft','type':'number','default':0},{'name':'ratio','type':'number','default':1.618033988749895},{'name':'round','type':'boolean','default':false},{'name':'size','type':'number','array':true,'length':2},{'name':'as','type':'string','array':true,'length':Output$4.length,'default':Output$4}]};inherits(Treemap,HierarchyLayout,{/** + * Treemap layout generator. Adds 'method' and 'ratio' parameters + * to configure the underlying tile method. + */layout:function layout(){var x=treemap();x.ratio=function(_){var t=x.tile();if(t.ratio)x.tile(t.ratio(_));};x.method=function(_){if(has$1(Tiles,_))x.tile(Tiles[_]);else error('Unrecognized Treemap layout method: '+_);};return x;},params:['method','ratio','size','round','padding','paddingInner','paddingOuter','paddingTop','paddingRight','paddingBottom','paddingLeft'],fields:Output$4});var tree=/*#__PURE__*/Object.freeze({__proto__:null,nest:Nest,pack:Pack,partition:Partition,stratify:Stratify,tree:Tree,treelinks:TreeLinks,treemap:Treemap});// bit mask for getting first 2 bytes of alpha value +var ALPHA_MASK=0xff000000;function baseBitmaps($,data){var bitmap=$.bitmap();// when there is no base mark but data points are to be avoided +(data||[]).forEach(function(d){return bitmap.set($(d.boundary[0]),$(d.boundary[3]));});return[bitmap,undefined];}function markBitmaps($,baseMark,avoidMarks,labelInside,isGroupArea){// create canvas +var width=$.width,height=$.height,border=labelInside||isGroupArea,context=domCanvas(width,height).getContext('2d'),baseMarkContext=domCanvas(width,height).getContext('2d'),strokeContext=border&&domCanvas(width,height).getContext('2d');// render all marks to be avoided into canvas +avoidMarks.forEach(function(items){return draw(context,items,false);});draw(baseMarkContext,baseMark,false);if(border){draw(strokeContext,baseMark,true);}// get canvas buffer, create bitmaps +var buffer=getBuffer(context,width,height),baseMarkBuffer=getBuffer(baseMarkContext,width,height),strokeBuffer=border&&getBuffer(strokeContext,width,height),layer1=$.bitmap(),layer2=border&&$.bitmap();// populate bitmap layers +var x,y,u,v,index,alpha,strokeAlpha,baseMarkAlpha;for(y=0;y<height;++y){for(x=0;x<width;++x){index=y*width+x;alpha=buffer[index]&ALPHA_MASK;baseMarkAlpha=baseMarkBuffer[index]&ALPHA_MASK;strokeAlpha=border&&strokeBuffer[index]&ALPHA_MASK;if(alpha||strokeAlpha||baseMarkAlpha){u=$(x);v=$(y);if(!isGroupArea&&(alpha||baseMarkAlpha))layer1.set(u,v);// update interior bitmap +if(border&&(alpha||strokeAlpha))layer2.set(u,v);// update border bitmap +}}}return[layer1,layer2];}function getBuffer(context,width,height){return new Uint32Array(context.getImageData(0,0,width,height).data.buffer);}function draw(context,items,interior){if(!items.length)return;var type=items[0].mark.marktype;if(type==='group'){items.forEach(function(group){group.items.forEach(function(mark){return draw(context,mark.items,interior);});});}else{Marks[type].draw(context,{items:interior?items.map(prepare):items});}}/** + * Prepare item before drawing into canvas (setting stroke and opacity) + * @param {object} source item to be prepared + * @returns prepared item + */function prepare(source){var item=rederive(source,{});if(item.stroke&&item.strokeOpacity!==0||item.fill&&item.fillOpacity!==0){return _objectSpread(_objectSpread({},item),{},{strokeOpacity:1,stroke:'#000',fillOpacity:0});}return item;}var DIV=5,// bit shift from x, y index to bit vector array index +MOD=31,// bit mask for index lookup within a bit vector +SIZE=32,// individual bit vector size +RIGHT0=new Uint32Array(SIZE+1),// left-anchored bit vectors, full -> 0 +RIGHT1=new Uint32Array(SIZE+1);// right-anchored bit vectors, 0 -> full +RIGHT1[0]=0;RIGHT0[0]=~RIGHT1[0];for(var i=1;i<=SIZE;++i){RIGHT1[i]=RIGHT1[i-1]<<1|1;RIGHT0[i]=~RIGHT1[i];}function Bitmap(w,h){var array=new Uint32Array(~~((w*h+SIZE)/SIZE));function _set(index,mask){array[index]|=mask;}function _clear(index,mask){array[index]&=mask;}return{array:array,get:function get(x,y){var index=y*w+x;return array[index>>>DIV]&1<<(index&MOD);},set:function set(x,y){var index=y*w+x;_set(index>>>DIV,1<<(index&MOD));},clear:function clear(x,y){var index=y*w+x;_clear(index>>>DIV,~(1<<(index&MOD)));},getRange:function getRange(x,y,x2,y2){var r=y2,start,end,indexStart,indexEnd;for(;r>=y;--r){start=r*w+x;end=r*w+x2;indexStart=start>>>DIV;indexEnd=end>>>DIV;if(indexStart===indexEnd){if(array[indexStart]&RIGHT0[start&MOD]&RIGHT1[(end&MOD)+1]){return true;}}else{if(array[indexStart]&RIGHT0[start&MOD])return true;if(array[indexEnd]&RIGHT1[(end&MOD)+1])return true;for(var _i14=indexStart+1;_i14<indexEnd;++_i14){if(array[_i14])return true;}}}return false;},setRange:function setRange(x,y,x2,y2){var start,end,indexStart,indexEnd,i;for(;y<=y2;++y){start=y*w+x;end=y*w+x2;indexStart=start>>>DIV;indexEnd=end>>>DIV;if(indexStart===indexEnd){_set(indexStart,RIGHT0[start&MOD]&RIGHT1[(end&MOD)+1]);}else{_set(indexStart,RIGHT0[start&MOD]);_set(indexEnd,RIGHT1[(end&MOD)+1]);for(i=indexStart+1;i<indexEnd;++i)_set(i,0xffffffff);}}},clearRange:function clearRange(x,y,x2,y2){var start,end,indexStart,indexEnd,i;for(;y<=y2;++y){start=y*w+x;end=y*w+x2;indexStart=start>>>DIV;indexEnd=end>>>DIV;if(indexStart===indexEnd){_clear(indexStart,RIGHT1[start&MOD]|RIGHT0[(end&MOD)+1]);}else{_clear(indexStart,RIGHT1[start&MOD]);_clear(indexEnd,RIGHT0[(end&MOD)+1]);for(i=indexStart+1;i<indexEnd;++i)_clear(i,0);}}},outOfBounds:function outOfBounds(x,y,x2,y2){return x<0||y<0||y2>=h||x2>=w;}};}function scaler(width,height,padding){var ratio=Math.max(1,Math.sqrt(width*height/1e6)),w=~~((width+2*padding+ratio)/ratio),h=~~((height+2*padding+ratio)/ratio),scale=function scale(_){return~~((_+padding)/ratio);};scale.invert=function(_){return _*ratio-padding;};scale.bitmap=function(){return Bitmap(w,h);};scale.ratio=ratio;scale.padding=padding;scale.width=width;scale.height=height;return scale;}function placeAreaLabelNaive($,bitmaps,avoidBaseMark,markIndex){var width=$.width,height=$.height;// try to place a label within an input area mark +return function(d){var items=d.datum.datum.items[markIndex].items,// area points +n=items.length,// number of points +textHeight=d.datum.fontSize,// label width +textWidth=textMetrics.width(d.datum,d.datum.text);// label height +var maxAreaWidth=0,x1,x2,y1,y2,x,y,areaWidth;// for each area sample point +for(var _i15=0;_i15<n;++_i15){x1=items[_i15].x;y1=items[_i15].y;x2=items[_i15].x2===undefined?x1:items[_i15].x2;y2=items[_i15].y2===undefined?y1:items[_i15].y2;x=(x1+x2)/2;y=(y1+y2)/2;areaWidth=Math.abs(x2-x1+y2-y1);if(areaWidth>=maxAreaWidth){maxAreaWidth=areaWidth;d.x=x;d.y=y;}}x=textWidth/2;y=textHeight/2;x1=d.x-x;x2=d.x+x;y1=d.y-y;y2=d.y+y;d.align='center';if(x1<0&&x2<=width){d.align='left';}else if(0<=x1&&width<x2){d.align='right';}d.baseline='middle';if(y1<0&&y2<=height){d.baseline='top';}else if(0<=y1&&height<y2){d.baseline='bottom';}return true;};}function outOfBounds(x,y,textWidth,textHeight,width,height){var r=textWidth/2;return x-r<0||x+r>width||y-(r=textHeight/2)<0||y+r>height;}function collision($,x,y,textHeight,textWidth,h,bm0,bm1){var w=textWidth*h/(textHeight*2),x1=$(x-w),x2=$(x+w),y1=$(y-(h=h/2)),y2=$(y+h);return bm0.outOfBounds(x1,y1,x2,y2)||bm0.getRange(x1,y1,x2,y2)||bm1&&bm1.getRange(x1,y1,x2,y2);}function placeAreaLabelReducedSearch($,bitmaps,avoidBaseMark,markIndex){var width=$.width,height=$.height,bm0=bitmaps[0],// where labels have been placed +bm1=bitmaps[1];// area outlines +function tryLabel(_x,_y,maxSize,textWidth,textHeight){var x=$.invert(_x),y=$.invert(_y);var lo=maxSize,hi=height,mid;if(!outOfBounds(x,y,textWidth,textHeight,width,height)&&!collision($,x,y,textHeight,textWidth,lo,bm0,bm1)&&!collision($,x,y,textHeight,textWidth,textHeight,bm0,null)){// if the label fits at the current sample point, +// perform binary search to find the largest font size that fits +while(hi-lo>=1){mid=(lo+hi)/2;if(collision($,x,y,textHeight,textWidth,mid,bm0,bm1)){hi=mid;}else{lo=mid;}}// place label if current lower bound exceeds prior max font size +if(lo>maxSize){return[x,y,lo,true];}}}// try to place a label within an input area mark +return function(d){var items=d.datum.datum.items[markIndex].items,// area points +n=items.length,// number of points +textHeight=d.datum.fontSize,// label width +textWidth=textMetrics.width(d.datum,d.datum.text);// label height +var maxSize=avoidBaseMark?textHeight:0,labelPlaced=false,labelPlaced2=false,maxAreaWidth=0,x1,x2,y1,y2,x,y,_x,_y,_x1,_xMid,_x2,_y1,_yMid,_y2,areaWidth,result,swapTmp;// for each area sample point +for(var _i16=0;_i16<n;++_i16){x1=items[_i16].x;y1=items[_i16].y;x2=items[_i16].x2===undefined?x1:items[_i16].x2;y2=items[_i16].y2===undefined?y1:items[_i16].y2;if(x1>x2){swapTmp=x1;x1=x2;x2=swapTmp;}if(y1>y2){swapTmp=y1;y1=y2;y2=swapTmp;}_x1=$(x1);_x2=$(x2);_xMid=~~((_x1+_x2)/2);_y1=$(y1);_y2=$(y2);_yMid=~~((_y1+_y2)/2);// search along the line from mid point between the 2 border to lower border +for(_x=_xMid;_x>=_x1;--_x){for(_y=_yMid;_y>=_y1;--_y){result=tryLabel(_x,_y,maxSize,textWidth,textHeight);if(result){var _result=result;var _result2=_slicedToArray(_result,4);d.x=_result2[0];d.y=_result2[1];maxSize=_result2[2];labelPlaced=_result2[3];}}}// search along the line from mid point between the 2 border to upper border +for(_x=_xMid;_x<=_x2;++_x){for(_y=_yMid;_y<=_y2;++_y){result=tryLabel(_x,_y,maxSize,textWidth,textHeight);if(result){var _result3=result;var _result4=_slicedToArray(_result3,4);d.x=_result4[0];d.y=_result4[1];maxSize=_result4[2];labelPlaced=_result4[3];}}}// place label at slice center if not placed through other means +// and if we're not avoiding overlap with other areas +if(!labelPlaced&&!avoidBaseMark){// one span is zero, hence we can add +areaWidth=Math.abs(x2-x1+y2-y1);x=(x1+x2)/2;y=(y1+y2)/2;// place label if it fits and improves the max area width +if(areaWidth>=maxAreaWidth&&!outOfBounds(x,y,textWidth,textHeight,width,height)&&!collision($,x,y,textHeight,textWidth,textHeight,bm0,null)){maxAreaWidth=areaWidth;d.x=x;d.y=y;labelPlaced2=true;}}}// record current label placement information, update label bitmap +if(labelPlaced||labelPlaced2){x=textWidth/2;y=textHeight/2;bm0.setRange($(d.x-x),$(d.y-y),$(d.x+x),$(d.y+y));d.align='center';d.baseline='middle';return true;}else{return false;}};}// pixel direction offsets for flood fill search +var X_DIR=[-1,-1,1,1];var Y_DIR=[-1,1,-1,1];function placeAreaLabelFloodFill($,bitmaps,avoidBaseMark,markIndex){var width=$.width,height=$.height,bm0=bitmaps[0],// where labels have been placed +bm1=bitmaps[1],// area outlines +bm2=$.bitmap();// flood-fill visitations +// try to place a label within an input area mark +return function(d){var items=d.datum.datum.items[markIndex].items,// area points +n=items.length,// number of points +textHeight=d.datum.fontSize,// label width +textWidth=textMetrics.width(d.datum,d.datum.text),// label height +stack=[];// flood fill stack +var maxSize=avoidBaseMark?textHeight:0,labelPlaced=false,labelPlaced2=false,maxAreaWidth=0,x1,x2,y1,y2,x,y,_x,_y,lo,hi,mid,areaWidth;// for each area sample point +for(var _i17=0;_i17<n;++_i17){x1=items[_i17].x;y1=items[_i17].y;x2=items[_i17].x2===undefined?x1:items[_i17].x2;y2=items[_i17].y2===undefined?y1:items[_i17].y2;// add scaled center point to stack +stack.push([$((x1+x2)/2),$((y1+y2)/2)]);// perform flood fill, visit points +while(stack.length){// exit if point already marked +var _stack$pop=stack.pop();var _stack$pop2=_slicedToArray(_stack$pop,2);_x=_stack$pop2[0];_y=_stack$pop2[1];if(bm0.get(_x,_y)||bm1.get(_x,_y)||bm2.get(_x,_y))continue;// mark point in flood fill bitmap +// add search points for all (in bound) directions +bm2.set(_x,_y);for(var j=0;j<4;++j){x=_x+X_DIR[j];y=_y+Y_DIR[j];if(!bm2.outOfBounds(x,y,x,y))stack.push([x,y]);}// unscale point back to x, y space +x=$.invert(_x);y=$.invert(_y);lo=maxSize;hi=height;// TODO: make this bound smaller +if(!outOfBounds(x,y,textWidth,textHeight,width,height)&&!collision($,x,y,textHeight,textWidth,lo,bm0,bm1)&&!collision($,x,y,textHeight,textWidth,textHeight,bm0,null)){// if the label fits at the current sample point, +// perform binary search to find the largest font size that fits +while(hi-lo>=1){mid=(lo+hi)/2;if(collision($,x,y,textHeight,textWidth,mid,bm0,bm1)){hi=mid;}else{lo=mid;}}// place label if current lower bound exceeds prior max font size +if(lo>maxSize){d.x=x;d.y=y;maxSize=lo;labelPlaced=true;}}}// place label at slice center if not placed through other means +// and if we're not avoiding overlap with other areas +if(!labelPlaced&&!avoidBaseMark){// one span is zero, hence we can add +areaWidth=Math.abs(x2-x1+y2-y1);x=(x1+x2)/2;y=(y1+y2)/2;// place label if it fits and improves the max area width +if(areaWidth>=maxAreaWidth&&!outOfBounds(x,y,textWidth,textHeight,width,height)&&!collision($,x,y,textHeight,textWidth,textHeight,bm0,null)){maxAreaWidth=areaWidth;d.x=x;d.y=y;labelPlaced2=true;}}}// record current label placement information, update label bitmap +if(labelPlaced||labelPlaced2){x=textWidth/2;y=textHeight/2;bm0.setRange($(d.x-x),$(d.y-y),$(d.x+x),$(d.y+y));d.align='center';d.baseline='middle';return true;}else{return false;}};}var Aligns=['right','center','left'],Baselines=['bottom','middle','top'];function placeMarkLabel($,bitmaps,anchors,offsets){var width=$.width,height=$.height,bm0=bitmaps[0],bm1=bitmaps[1],n=offsets.length;return function(d){var _d$textWidth;var boundary=d.boundary,textHeight=d.datum.fontSize;// can not be placed if the mark is not visible in the graph bound +if(boundary[2]<0||boundary[5]<0||boundary[0]>width||boundary[3]>height){return false;}var textWidth=(_d$textWidth=d.textWidth)!==null&&_d$textWidth!==void 0?_d$textWidth:0,dx,dy,isInside,sizeFactor,insideFactor,x1,x2,y1,y2,xc,yc,_x1,_x2,_y1,_y2;// for each anchor and offset +for(var _i18=0;_i18<n;++_i18){dx=(anchors[_i18]&0x3)-1;dy=(anchors[_i18]>>>0x2&0x3)-1;isInside=dx===0&&dy===0||offsets[_i18]<0;sizeFactor=dx&&dy?Math.SQRT1_2:1;insideFactor=offsets[_i18]<0?-1:1;x1=boundary[1+dx]+offsets[_i18]*dx*sizeFactor;yc=boundary[4+dy]+insideFactor*textHeight*dy/2+offsets[_i18]*dy*sizeFactor;y1=yc-textHeight/2;y2=yc+textHeight/2;_x1=$(x1);_y1=$(y1);_y2=$(y2);if(!textWidth){// to avoid finding width of text label, +if(!test(_x1,_x1,_y1,_y2,bm0,bm1,x1,x1,y1,y2,boundary,isInside)){// skip this anchor/offset option if we fail to place a label with 1px width +continue;}else{// Otherwise, find the label width +textWidth=textMetrics.width(d.datum,d.datum.text);}}xc=x1+insideFactor*textWidth*dx/2;x1=xc-textWidth/2;x2=xc+textWidth/2;_x1=$(x1);_x2=$(x2);if(test(_x1,_x2,_y1,_y2,bm0,bm1,x1,x2,y1,y2,boundary,isInside)){// place label if the position is placeable +d.x=!dx?xc:dx*insideFactor<0?x2:x1;d.y=!dy?yc:dy*insideFactor<0?y2:y1;d.align=Aligns[dx*insideFactor+1];d.baseline=Baselines[dy*insideFactor+1];bm0.setRange(_x1,_y1,_x2,_y2);return true;}}return false;};}// Test if a label with the given dimensions can be added without overlap +function test(_x1,_x2,_y1,_y2,bm0,bm1,x1,x2,y1,y2,boundary,isInside){return!(bm0.outOfBounds(_x1,_y1,_x2,_y2)||(isInside&&bm1||bm0).getRange(_x1,_y1,_x2,_y2));}// 8-bit representation of anchors +var TOP=0x0,MIDDLE=0x4,BOTTOM=0x8,LEFT=0x0,CENTER=0x1,RIGHT=0x2;// Mapping from text anchor to number representation +var anchorCode={'top-left':TOP+LEFT,'top':TOP+CENTER,'top-right':TOP+RIGHT,'left':MIDDLE+LEFT,'middle':MIDDLE+CENTER,'right':MIDDLE+RIGHT,'bottom-left':BOTTOM+LEFT,'bottom':BOTTOM+CENTER,'bottom-right':BOTTOM+RIGHT};var placeAreaLabel={'naive':placeAreaLabelNaive,'reduced-search':placeAreaLabelReducedSearch,'floodfill':placeAreaLabelFloodFill};function labelLayout(texts,size,compare,offset,anchor,avoidMarks,avoidBaseMark,lineAnchor,markIndex,padding,method){// early exit for empty data +if(!texts.length)return texts;var positions=Math.max(offset.length,anchor.length),offsets=getOffsets(offset,positions),anchors=getAnchors(anchor,positions),marktype=markType(texts[0].datum),grouptype=marktype==='group'&&texts[0].datum.items[markIndex].marktype,isGroupArea=grouptype==='area',boundary=markBoundary(marktype,grouptype,lineAnchor,markIndex),infPadding=padding===null||padding===Infinity,isNaiveGroupArea=isGroupArea&&method==='naive';var maxTextWidth=-1,maxTextHeight=-1;// prepare text mark data for placing +var data=texts.map(function(d){var textWidth=infPadding?textMetrics.width(d,d.text):undefined;maxTextWidth=Math.max(maxTextWidth,textWidth);maxTextHeight=Math.max(maxTextHeight,d.fontSize);return{datum:d,opacity:0,x:undefined,y:undefined,align:undefined,baseline:undefined,boundary:boundary(d),textWidth:textWidth};});padding=padding===null||padding===Infinity?Math.max(maxTextWidth,maxTextHeight)+Math.max.apply(Math,_toConsumableArray(offset)):padding;var $=scaler(size[0],size[1],padding);var bitmaps;if(!isNaiveGroupArea){// sort labels in priority order, if comparator is provided +if(compare){data.sort(function(a,b){return compare(a.datum,b.datum);});}// flag indicating if label can be placed inside its base mark +var labelInside=false;for(var _i19=0;_i19<anchors.length&&!labelInside;++_i19){// label inside if anchor is at center +// label inside if offset to be inside the mark bound +labelInside=anchors[_i19]===0x5||offsets[_i19]<0;}// extract data information from base mark when base mark is to be avoided +// base mark is implicitly avoided if it is a group area +var baseMark=(marktype&&avoidBaseMark||isGroupArea)&&texts.map(function(d){return d.datum;});// generate bitmaps for layout calculation +bitmaps=avoidMarks.length||baseMark?markBitmaps($,baseMark||[],avoidMarks,labelInside,isGroupArea):baseBitmaps($,avoidBaseMark&&data);}// generate label placement function +var place=isGroupArea?placeAreaLabel[method]($,bitmaps,avoidBaseMark,markIndex):placeMarkLabel($,bitmaps,anchors,offsets);// place all labels +data.forEach(function(d){return d.opacity=+place(d);});return data;}function getOffsets(_,count){var offsets=new Float64Array(count),n=_.length;for(var _i20=0;_i20<n;++_i20)offsets[_i20]=_[_i20]||0;for(var _i21=n;_i21<count;++_i21)offsets[_i21]=offsets[n-1];return offsets;}function getAnchors(_,count){var anchors=new Int8Array(count),n=_.length;for(var _i22=0;_i22<n;++_i22)anchors[_i22]|=anchorCode[_[_i22]];for(var _i23=n;_i23<count;++_i23)anchors[_i23]=anchors[n-1];return anchors;}function markType(item){return item&&item.mark&&item.mark.marktype;}/** + * Factory function for function for getting base mark boundary, depending + * on mark and group type. When mark type is undefined, line or area: boundary + * is the coordinate of each data point. When base mark is grouped line, + * boundary is either at the start or end of the line depending on the + * value of lineAnchor. Otherwise, use bounds of base mark. + */function markBoundary(marktype,grouptype,lineAnchor,markIndex){var xy=function xy(d){return[d.x,d.x,d.x,d.y,d.y,d.y];};if(!marktype){return xy;// no reactive geometry +}else if(marktype==='line'||marktype==='area'){return function(d){return xy(d.datum);};}else if(grouptype==='line'){return function(d){var items=d.datum.items[markIndex].items;return xy(items.length?items[lineAnchor==='start'?0:items.length-1]:{x:NaN,y:NaN});};}else{return function(d){var b=d.datum.bounds;return[b.x1,(b.x1+b.x2)/2,b.x2,b.y1,(b.y1+b.y2)/2,b.y2];};}}var Output$1=['x','y','opacity','align','baseline'];var Anchors=['top-left','left','bottom-left','top','bottom','top-right','right','bottom-right'];/** + * Compute text label layout to annotate marks. + * @constructor + * @param {object} params - The parameters for this operator. + * @param {Array<number>} params.size - The size of the layout, provided as a [width, height] array. + * @param {function(*,*): number} [params.sort] - An optional + * comparator function for sorting label data in priority order. + * @param {Array<string>} [params.anchor] - Label anchor points relative to the base mark bounding box. + * The available options are 'top-left', 'left', 'bottom-left', 'top', + * 'bottom', 'top-right', 'right', 'bottom-right', 'middle'. + * @param {Array<number>} [params.offset] - Label offsets (in pixels) from the base mark bounding box. + * This parameter is parallel to the list of anchor points. + * @param {number | null} [params.padding=0] - The amount (in pixels) that a label may exceed the layout size. + * If this parameter is null, a label may exceed the layout size without any boundary. + * @param {string} [params.lineAnchor='end'] - For group line mark labels only, indicates the anchor + * position for labels. One of 'start' or 'end'. + * @param {string} [params.markIndex=0] - For group mark labels only, an index indicating + * which mark within the group should be labeled. + * @param {Array<number>} [params.avoidMarks] - A list of additional mark names for which the label + * layout should avoid overlap. + * @param {boolean} [params.avoidBaseMark=true] - Boolean flag indicating if labels should avoid + * overlap with the underlying base mark being labeled. + * @param {string} [params.method='naive'] - For area make labels only, a method for + * place labels. One of 'naive', 'reduced-search', or 'floodfill'. + * @param {Array<string>} [params.as] - The output fields written by the transform. + * The default is ['x', 'y', 'opacity', 'align', 'baseline']. + */function Label$1(params){Transform.call(this,null,params);}Label$1.Definition={type:'Label',metadata:{modifies:true},params:[{name:'size',type:'number',array:true,length:2,required:true},{name:'sort',type:'compare'},{name:'anchor',type:'string',array:true,"default":Anchors},{name:'offset',type:'number',array:true,"default":[1]},{name:'padding',type:'number',"default":0,"null":true},{name:'lineAnchor',type:'string',values:['start','end'],"default":'end'},{name:'markIndex',type:'number',"default":0},{name:'avoidBaseMark',type:'boolean',"default":true},{name:'avoidMarks',type:'data',array:true},{name:'method',type:'string',"default":'naive'},{name:'as',type:'string',array:true,length:Output$1.length,"default":Output$1}]};inherits(Label$1,Transform,{transform:function transform(_,pulse){function modp(param){var p=_[param];return isFunction(p)&&pulse.modified(p.fields);}var mod=_.modified();if(!(mod||pulse.changed(pulse.ADD_REM)||modp('sort')))return;if(!_.size||_.size.length!==2){error('Size parameter should be specified as a [width, height] array.');}var as=_.as||Output$1;// run label layout +labelLayout(pulse.materialize(pulse.SOURCE).source||[],_.size,_.sort,array$5(_.offset==null?1:_.offset),array$5(_.anchor||Anchors),_.avoidMarks||[],_.avoidBaseMark!==false,_.lineAnchor||'end',_.markIndex||0,_.padding===undefined?0:_.padding,_.method||'naive').forEach(function(l){// write layout results to data stream +var t=l.datum;t[as[0]]=l.x;t[as[1]]=l.y;t[as[2]]=l.opacity;t[as[3]]=l.align;t[as[4]]=l.baseline;});return pulse.reflow(mod).modifies(as);}});var label=/*#__PURE__*/Object.freeze({__proto__:null,label:Label$1});function partition(data,groupby){var groups=[],get=function get(f){return f(t);},map,i,n,t,k,g;// partition data points into stack groups +if(groupby==null){groups.push(data);}else{for(map={},i=0,n=data.length;i<n;++i){t=data[i];k=groupby.map(get);g=map[k];if(!g){map[k]=g=[];g.dims=k;groups.push(g);}g.push(t);}}return groups;}/** + * Compute locally-weighted regression fits for one or more data groups. + * @constructor + * @param {object} params - The parameters for this operator. + * @param {function(object): *} params.x - An accessor for the predictor data field. + * @param {function(object): *} params.y - An accessor for the predicted data field. + * @param {Array<function(object): *>} [params.groupby] - An array of accessors to groupby. + * @param {number} [params.bandwidth=0.3] - The loess bandwidth. + */function Loess(params){Transform.call(this,null,params);}Loess.Definition={'type':'Loess','metadata':{'generates':true},'params':[{'name':'x','type':'field','required':true},{'name':'y','type':'field','required':true},{'name':'groupby','type':'field','array':true},{'name':'bandwidth','type':'number','default':0.3},{'name':'as','type':'string','array':true}]};inherits(Loess,Transform,{transform:function transform(_,pulse){var out=pulse.fork(pulse.NO_SOURCE|pulse.NO_FIELDS);if(!this.value||pulse.changed()||_.modified()){var _source2=pulse.materialize(pulse.SOURCE).source,groups=partition(_source2,_.groupby),names=(_.groupby||[]).map(accessorName),_m5=names.length,as=_.as||[accessorName(_.x),accessorName(_.y)],_values3=[];groups.forEach(function(g){loess(g,_.x,_.y,_.bandwidth||0.3).forEach(function(p){var t={};for(var _i24=0;_i24<_m5;++_i24){t[names[_i24]]=g.dims[_i24];}t[as[0]]=p[0];t[as[1]]=p[1];_values3.push(ingest$1(t));});});if(this.value)out.rem=this.value;this.value=out.add=out.source=_values3;}return out;}});var Methods={constant:constant$4,linear:linear$2,log:log$3,exp:exp$1,pow:pow$3,quad:quad,poly:poly};var degreesOfFreedom=function degreesOfFreedom(method,order){return method==='poly'?order:method==='quad'?2:1;};/** + * Compute regression fits for one or more data groups. + * @constructor + * @param {object} params - The parameters for this operator. + * @param {function(object): *} params.x - An accessor for the predictor data field. + * @param {function(object): *} params.y - An accessor for the predicted data field. + * @param {string} [params.method='linear'] - The regression method to apply. + * @param {Array<function(object): *>} [params.groupby] - An array of accessors to groupby. + * @param {Array<number>} [params.extent] - The domain extent over which to plot the regression line. + * @param {number} [params.order=3] - The polynomial order. Only applies to the 'poly' method. + */function Regression(params){Transform.call(this,null,params);}Regression.Definition={'type':'Regression','metadata':{'generates':true},'params':[{'name':'x','type':'field','required':true},{'name':'y','type':'field','required':true},{'name':'groupby','type':'field','array':true},{'name':'method','type':'string','default':'linear','values':Object.keys(Methods)},{'name':'order','type':'number','default':3},{'name':'extent','type':'number','array':true,'length':2},{'name':'params','type':'boolean','default':false},{'name':'as','type':'string','array':true}]};inherits(Regression,Transform,{transform:function transform(_,pulse){var out=pulse.fork(pulse.NO_SOURCE|pulse.NO_FIELDS);if(!this.value||pulse.changed()||_.modified()){var _source3=pulse.materialize(pulse.SOURCE).source,groups=partition(_source3,_.groupby),names=(_.groupby||[]).map(accessorName),_method3=_.method||'linear',order=_.order==null?3:_.order,dof=degreesOfFreedom(_method3,order),as=_.as||[accessorName(_.x),accessorName(_.y)],_fit=Methods[_method3],_values4=[];var _domain4=_.extent;if(!has$1(Methods,_method3)){error('Invalid regression method: '+_method3);}if(_domain4!=null){if(_method3==='log'&&_domain4[0]<=0){pulse.dataflow.warn('Ignoring extent with values <= 0 for log regression.');_domain4=null;}}groups.forEach(function(g){var n=g.length;if(n<=dof){pulse.dataflow.warn('Skipping regression with more parameters than data points.');return;}var model=_fit(g,_.x,_.y,order);if(_.params){// if parameter vectors requested return those +_values4.push(ingest$1({keys:g.dims,coef:model.coef,rSquared:model.rSquared}));return;}var dom=_domain4||_extent(g,_.x),add=function add(p){var t={};for(var _i25=0;_i25<names.length;++_i25){t[names[_i25]]=g.dims[_i25];}t[as[0]]=p[0];t[as[1]]=p[1];_values4.push(ingest$1(t));};if(_method3==='linear'||_method3==='constant'){// for linear or constant regression we only need the end points +dom.forEach(function(x){return add([x,model.predict(x)]);});}else{// otherwise return trend line sample points +sampleCurve(model.predict,dom,25,200).forEach(add);}});if(this.value)out.rem=this.value;this.value=out.add=out.source=_values4;}return out;}});var reg=/*#__PURE__*/Object.freeze({__proto__:null,loess:Loess,regression:Regression});var epsilon$1=1.1102230246251565e-16;var splitter=134217729;var resulterrbound=(3+8*epsilon$1)*epsilon$1;// fast_expansion_sum_zeroelim routine from oritinal code +function sum(elen,e,flen,f,h){var Q,Qnew,hh,bvirt;var enow=e[0];var fnow=f[0];var eindex=0;var findex=0;if(fnow>enow===fnow>-enow){Q=enow;enow=e[++eindex];}else{Q=fnow;fnow=f[++findex];}var hindex=0;if(eindex<elen&&findex<flen){if(fnow>enow===fnow>-enow){Qnew=enow+Q;hh=Q-(Qnew-enow);enow=e[++eindex];}else{Qnew=fnow+Q;hh=Q-(Qnew-fnow);fnow=f[++findex];}Q=Qnew;if(hh!==0){h[hindex++]=hh;}while(eindex<elen&&findex<flen){if(fnow>enow===fnow>-enow){Qnew=Q+enow;bvirt=Qnew-Q;hh=Q-(Qnew-bvirt)+(enow-bvirt);enow=e[++eindex];}else{Qnew=Q+fnow;bvirt=Qnew-Q;hh=Q-(Qnew-bvirt)+(fnow-bvirt);fnow=f[++findex];}Q=Qnew;if(hh!==0){h[hindex++]=hh;}}}while(eindex<elen){Qnew=Q+enow;bvirt=Qnew-Q;hh=Q-(Qnew-bvirt)+(enow-bvirt);enow=e[++eindex];Q=Qnew;if(hh!==0){h[hindex++]=hh;}}while(findex<flen){Qnew=Q+fnow;bvirt=Qnew-Q;hh=Q-(Qnew-bvirt)+(fnow-bvirt);fnow=f[++findex];Q=Qnew;if(hh!==0){h[hindex++]=hh;}}if(Q!==0||hindex===0){h[hindex++]=Q;}return hindex;}function estimate(elen,e){var Q=e[0];for(var _i26=1;_i26<elen;_i26++)Q+=e[_i26];return Q;}function vec(n){return new Float64Array(n);}var ccwerrboundA=(3+16*epsilon$1)*epsilon$1;var ccwerrboundB=(2+12*epsilon$1)*epsilon$1;var ccwerrboundC=(9+64*epsilon$1)*epsilon$1*epsilon$1;var B=vec(4);var C1=vec(8);var C2=vec(12);var D=vec(16);var u=vec(4);function orient2dadapt(ax,ay,bx,by,cx,cy,detsum){var acxtail,acytail,bcxtail,bcytail;var bvirt,c,ahi,alo,bhi,blo,_i,_j,_0,s1,s0,t1,t0,u3;var acx=ax-cx;var bcx=bx-cx;var acy=ay-cy;var bcy=by-cy;s1=acx*bcy;c=splitter*acx;ahi=c-(c-acx);alo=acx-ahi;c=splitter*bcy;bhi=c-(c-bcy);blo=bcy-bhi;s0=alo*blo-(s1-ahi*bhi-alo*bhi-ahi*blo);t1=acy*bcx;c=splitter*acy;ahi=c-(c-acy);alo=acy-ahi;c=splitter*bcx;bhi=c-(c-bcx);blo=bcx-bhi;t0=alo*blo-(t1-ahi*bhi-alo*bhi-ahi*blo);_i=s0-t0;bvirt=s0-_i;B[0]=s0-(_i+bvirt)+(bvirt-t0);_j=s1+_i;bvirt=_j-s1;_0=s1-(_j-bvirt)+(_i-bvirt);_i=_0-t1;bvirt=_0-_i;B[1]=_0-(_i+bvirt)+(bvirt-t1);u3=_j+_i;bvirt=u3-_j;B[2]=_j-(u3-bvirt)+(_i-bvirt);B[3]=u3;var det=estimate(4,B);var errbound=ccwerrboundB*detsum;if(det>=errbound||-det>=errbound){return det;}bvirt=ax-acx;acxtail=ax-(acx+bvirt)+(bvirt-cx);bvirt=bx-bcx;bcxtail=bx-(bcx+bvirt)+(bvirt-cx);bvirt=ay-acy;acytail=ay-(acy+bvirt)+(bvirt-cy);bvirt=by-bcy;bcytail=by-(bcy+bvirt)+(bvirt-cy);if(acxtail===0&&acytail===0&&bcxtail===0&&bcytail===0){return det;}errbound=ccwerrboundC*detsum+resulterrbound*Math.abs(det);det+=acx*bcytail+bcy*acxtail-(acy*bcxtail+bcx*acytail);if(det>=errbound||-det>=errbound)return det;s1=acxtail*bcy;c=splitter*acxtail;ahi=c-(c-acxtail);alo=acxtail-ahi;c=splitter*bcy;bhi=c-(c-bcy);blo=bcy-bhi;s0=alo*blo-(s1-ahi*bhi-alo*bhi-ahi*blo);t1=acytail*bcx;c=splitter*acytail;ahi=c-(c-acytail);alo=acytail-ahi;c=splitter*bcx;bhi=c-(c-bcx);blo=bcx-bhi;t0=alo*blo-(t1-ahi*bhi-alo*bhi-ahi*blo);_i=s0-t0;bvirt=s0-_i;u[0]=s0-(_i+bvirt)+(bvirt-t0);_j=s1+_i;bvirt=_j-s1;_0=s1-(_j-bvirt)+(_i-bvirt);_i=_0-t1;bvirt=_0-_i;u[1]=_0-(_i+bvirt)+(bvirt-t1);u3=_j+_i;bvirt=u3-_j;u[2]=_j-(u3-bvirt)+(_i-bvirt);u[3]=u3;var C1len=sum(4,B,4,u,C1);s1=acx*bcytail;c=splitter*acx;ahi=c-(c-acx);alo=acx-ahi;c=splitter*bcytail;bhi=c-(c-bcytail);blo=bcytail-bhi;s0=alo*blo-(s1-ahi*bhi-alo*bhi-ahi*blo);t1=acy*bcxtail;c=splitter*acy;ahi=c-(c-acy);alo=acy-ahi;c=splitter*bcxtail;bhi=c-(c-bcxtail);blo=bcxtail-bhi;t0=alo*blo-(t1-ahi*bhi-alo*bhi-ahi*blo);_i=s0-t0;bvirt=s0-_i;u[0]=s0-(_i+bvirt)+(bvirt-t0);_j=s1+_i;bvirt=_j-s1;_0=s1-(_j-bvirt)+(_i-bvirt);_i=_0-t1;bvirt=_0-_i;u[1]=_0-(_i+bvirt)+(bvirt-t1);u3=_j+_i;bvirt=u3-_j;u[2]=_j-(u3-bvirt)+(_i-bvirt);u[3]=u3;var C2len=sum(C1len,C1,4,u,C2);s1=acxtail*bcytail;c=splitter*acxtail;ahi=c-(c-acxtail);alo=acxtail-ahi;c=splitter*bcytail;bhi=c-(c-bcytail);blo=bcytail-bhi;s0=alo*blo-(s1-ahi*bhi-alo*bhi-ahi*blo);t1=acytail*bcxtail;c=splitter*acytail;ahi=c-(c-acytail);alo=acytail-ahi;c=splitter*bcxtail;bhi=c-(c-bcxtail);blo=bcxtail-bhi;t0=alo*blo-(t1-ahi*bhi-alo*bhi-ahi*blo);_i=s0-t0;bvirt=s0-_i;u[0]=s0-(_i+bvirt)+(bvirt-t0);_j=s1+_i;bvirt=_j-s1;_0=s1-(_j-bvirt)+(_i-bvirt);_i=_0-t1;bvirt=_0-_i;u[1]=_0-(_i+bvirt)+(bvirt-t1);u3=_j+_i;bvirt=u3-_j;u[2]=_j-(u3-bvirt)+(_i-bvirt);u[3]=u3;var Dlen=sum(C2len,C2,4,u,D);return D[Dlen-1];}function orient2d(ax,ay,bx,by,cx,cy){var detleft=(ay-cy)*(bx-cx);var detright=(ax-cx)*(by-cy);var det=detleft-detright;var detsum=Math.abs(detleft+detright);if(Math.abs(det)>=ccwerrboundA*detsum)return det;return-orient2dadapt(ax,ay,bx,by,cx,cy,detsum);}var EPSILON=Math.pow(2,-52);var EDGE_STACK=new Uint32Array(512);var Delaunator=/*#__PURE__*/function(){function Delaunator(coords){_classCallCheck(this,Delaunator);var n=coords.length>>1;if(n>0&&typeof coords[0]!=='number')throw new Error('Expected coords to contain numbers.');this.coords=coords;// arrays that will store the triangulation graph +var maxTriangles=Math.max(2*n-5,0);this._triangles=new Uint32Array(maxTriangles*3);this._halfedges=new Int32Array(maxTriangles*3);// temporary arrays for tracking the edges of the advancing convex hull +this._hashSize=Math.ceil(Math.sqrt(n));this._hullPrev=new Uint32Array(n);// edge to prev edge +this._hullNext=new Uint32Array(n);// edge to next edge +this._hullTri=new Uint32Array(n);// edge to adjacent triangle +this._hullHash=new Int32Array(this._hashSize);// angular edge hash +// temporary arrays for sorting points +this._ids=new Uint32Array(n);this._dists=new Float64Array(n);this.update();}return _createClass(Delaunator,[{key:"update",value:function update(){var coords=this.coords,hullPrev=this._hullPrev,hullNext=this._hullNext,hullTri=this._hullTri,hullHash=this._hullHash;var n=coords.length>>1;// populate an array of point indices; calculate input data bbox +var minX=Infinity;var minY=Infinity;var maxX=-Infinity;var maxY=-Infinity;for(var _i27=0;_i27<n;_i27++){var _x27=coords[2*_i27];var _y8=coords[2*_i27+1];if(_x27<minX)minX=_x27;if(_y8<minY)minY=_y8;if(_x27>maxX)maxX=_x27;if(_y8>maxY)maxY=_y8;this._ids[_i27]=_i27;}var cx=(minX+maxX)/2;var cy=(minY+maxY)/2;var i0,i1,i2;// pick a seed point close to the center +for(var _i28=0,minDist=Infinity;_i28<n;_i28++){var d=dist(cx,cy,coords[2*_i28],coords[2*_i28+1]);if(d<minDist){i0=_i28;minDist=d;}}var i0x=coords[2*i0];var i0y=coords[2*i0+1];// find the point closest to the seed +for(var _i29=0,_minDist=Infinity;_i29<n;_i29++){if(_i29===i0)continue;var _d2=dist(i0x,i0y,coords[2*_i29],coords[2*_i29+1]);if(_d2<_minDist&&_d2>0){i1=_i29;_minDist=_d2;}}var i1x=coords[2*i1];var i1y=coords[2*i1+1];var minRadius=Infinity;// find the third point which forms the smallest circumcircle with the first two +for(var _i30=0;_i30<n;_i30++){if(_i30===i0||_i30===i1)continue;var r=circumradius(i0x,i0y,i1x,i1y,coords[2*_i30],coords[2*_i30+1]);if(r<minRadius){i2=_i30;minRadius=r;}}var i2x=coords[2*i2];var i2y=coords[2*i2+1];if(minRadius===Infinity){// order collinear points by dx (or dy if all x are identical) +// and return the list as a hull +for(var _i31=0;_i31<n;_i31++){this._dists[_i31]=coords[2*_i31]-coords[0]||coords[2*_i31+1]-coords[1];}quicksort(this._ids,this._dists,0,n-1);var hull=new Uint32Array(n);var j=0;for(var _i32=0,d0=-Infinity;_i32<n;_i32++){var _id5=this._ids[_i32];var _d3=this._dists[_id5];if(_d3>d0){hull[j++]=_id5;d0=_d3;}}this.hull=hull.subarray(0,j);this.triangles=new Uint32Array(0);this.halfedges=new Uint32Array(0);return;}// swap the order of the seed points for counter-clockwise orientation +if(orient2d(i0x,i0y,i1x,i1y,i2x,i2y)<0){var _i33=i1;var _x28=i1x;var _y9=i1y;i1=i2;i1x=i2x;i1y=i2y;i2=_i33;i2x=_x28;i2y=_y9;}var center=circumcenter(i0x,i0y,i1x,i1y,i2x,i2y);this._cx=center.x;this._cy=center.y;for(var _i34=0;_i34<n;_i34++){this._dists[_i34]=dist(coords[2*_i34],coords[2*_i34+1],center.x,center.y);}// sort the points by distance from the seed triangle circumcenter +quicksort(this._ids,this._dists,0,n-1);// set up the seed triangle as the starting hull +this._hullStart=i0;var hullSize=3;hullNext[i0]=hullPrev[i2]=i1;hullNext[i1]=hullPrev[i0]=i2;hullNext[i2]=hullPrev[i1]=i0;hullTri[i0]=0;hullTri[i1]=1;hullTri[i2]=2;hullHash.fill(-1);hullHash[this._hashKey(i0x,i0y)]=i0;hullHash[this._hashKey(i1x,i1y)]=i1;hullHash[this._hashKey(i2x,i2y)]=i2;this.trianglesLen=0;this._addTriangle(i0,i1,i2,-1,-1,-1);for(var k=0,xp,yp;k<this._ids.length;k++){var _i35=this._ids[k];var _x29=coords[2*_i35];var _y0=coords[2*_i35+1];// skip near-duplicate points +if(k>0&&Math.abs(_x29-xp)<=EPSILON&&Math.abs(_y0-yp)<=EPSILON)continue;xp=_x29;yp=_y0;// skip seed triangle points +if(_i35===i0||_i35===i1||_i35===i2)continue;// find a visible edge on the convex hull using edge hash +var start=0;for(var _j2=0,_key15=this._hashKey(_x29,_y0);_j2<this._hashSize;_j2++){start=hullHash[(_key15+_j2)%this._hashSize];if(start!==-1&&start!==hullNext[start])break;}start=hullPrev[start];var e=start,q=void 0;while(q=hullNext[e],orient2d(_x29,_y0,coords[2*e],coords[2*e+1],coords[2*q],coords[2*q+1])>=0){e=q;if(e===start){e=-1;break;}}if(e===-1)continue;// likely a near-duplicate point; skip it +// add the first triangle from the point +var t=this._addTriangle(e,_i35,hullNext[e],-1,-1,hullTri[e]);// recursively flip triangles from the point until they satisfy the Delaunay condition +hullTri[_i35]=this._legalize(t+2);hullTri[e]=t;// keep track of boundary triangles on the hull +hullSize++;// walk forward through the hull, adding more triangles and flipping recursively +var _n3=hullNext[e];while(q=hullNext[_n3],orient2d(_x29,_y0,coords[2*_n3],coords[2*_n3+1],coords[2*q],coords[2*q+1])<0){t=this._addTriangle(_n3,_i35,q,hullTri[_i35],-1,hullTri[_n3]);hullTri[_i35]=this._legalize(t+2);hullNext[_n3]=_n3;// mark as removed +hullSize--;_n3=q;}// walk backward from the other side, adding more triangles and flipping +if(e===start){while(q=hullPrev[e],orient2d(_x29,_y0,coords[2*q],coords[2*q+1],coords[2*e],coords[2*e+1])<0){t=this._addTriangle(q,_i35,e,-1,hullTri[e],hullTri[q]);this._legalize(t+2);hullTri[q]=t;hullNext[e]=e;// mark as removed +hullSize--;e=q;}}// update the hull indices +this._hullStart=hullPrev[_i35]=e;hullNext[e]=hullPrev[_n3]=_i35;hullNext[_i35]=_n3;// save the two new edges in the hash table +hullHash[this._hashKey(_x29,_y0)]=_i35;hullHash[this._hashKey(coords[2*e],coords[2*e+1])]=e;}this.hull=new Uint32Array(hullSize);for(var _i36=0,_e=this._hullStart;_i36<hullSize;_i36++){this.hull[_i36]=_e;_e=hullNext[_e];}// trim typed triangle mesh arrays +this.triangles=this._triangles.subarray(0,this.trianglesLen);this.halfedges=this._halfedges.subarray(0,this.trianglesLen);}},{key:"_hashKey",value:function _hashKey(x,y){return Math.floor(pseudoAngle(x-this._cx,y-this._cy)*this._hashSize)%this._hashSize;}},{key:"_legalize",value:function _legalize(a){var triangles=this._triangles,halfedges=this._halfedges,coords=this.coords;var i=0;var ar=0;// recursion eliminated with a fixed-size stack +while(true){var _b2=halfedges[a];/* if the pair of triangles doesn't satisfy the Delaunay condition + * (p1 is inside the circumcircle of [p0, pl, pr]), flip them, + * then do the same check/flip recursively for the new pair of triangles + * + * pl pl + * /||\ / \ + * al/ || \bl al/ \a + * / || \ / \ + * / a||b \ flip /___ar___\ + * p0\ || /p1 => p0\---bl---/p1 + * \ || / \ / + * ar\ || /br b\ /br + * \||/ \ / + * pr pr + */var a0=a-a%3;ar=a0+(a+2)%3;if(_b2===-1){// convex hull edge +if(i===0)break;a=EDGE_STACK[--i];continue;}var b0=_b2-_b2%3;var al=a0+(a+1)%3;var _bl=b0+(_b2+2)%3;var _p2=triangles[ar];var pr=triangles[a];var pl=triangles[al];var p1=triangles[_bl];var illegal=inCircle(coords[2*_p2],coords[2*_p2+1],coords[2*pr],coords[2*pr+1],coords[2*pl],coords[2*pl+1],coords[2*p1],coords[2*p1+1]);if(illegal){triangles[a]=p1;triangles[_b2]=_p2;var hbl=halfedges[_bl];// edge swapped on the other side of the hull (rare); fix the halfedge reference +if(hbl===-1){var e=this._hullStart;do{if(this._hullTri[e]===_bl){this._hullTri[e]=a;break;}e=this._hullPrev[e];}while(e!==this._hullStart);}this._link(a,hbl);this._link(_b2,halfedges[ar]);this._link(ar,_bl);var _br=b0+(_b2+1)%3;// don't worry about hitting the cap: it can only happen on extremely degenerate input +if(i<EDGE_STACK.length){EDGE_STACK[i++]=_br;}}else{if(i===0)break;a=EDGE_STACK[--i];}}return ar;}},{key:"_link",value:function _link(a,b){this._halfedges[a]=b;if(b!==-1)this._halfedges[b]=a;}// add a new triangle given vertex indices and adjacent half-edge ids +},{key:"_addTriangle",value:function _addTriangle(i0,i1,i2,a,b,c){var t=this.trianglesLen;this._triangles[t]=i0;this._triangles[t+1]=i1;this._triangles[t+2]=i2;this._link(t,a);this._link(t+1,b);this._link(t+2,c);this.trianglesLen+=3;return t;}}],[{key:"from",value:function from(points){var getX=arguments.length>1&&arguments[1]!==undefined?arguments[1]:defaultGetX;var getY=arguments.length>2&&arguments[2]!==undefined?arguments[2]:defaultGetY;var n=points.length;var coords=new Float64Array(n*2);for(var _i37=0;_i37<n;_i37++){var p=points[_i37];coords[2*_i37]=getX(p);coords[2*_i37+1]=getY(p);}return new Delaunator(coords);}}]);}();// monotonically increases with real angle, but doesn't need expensive trigonometry +function pseudoAngle(dx,dy){var p=dx/(Math.abs(dx)+Math.abs(dy));return(dy>0?3-p:1+p)/4;// [0..1] +}function dist(ax,ay,bx,by){var dx=ax-bx;var dy=ay-by;return dx*dx+dy*dy;}function inCircle(ax,ay,bx,by,cx,cy,px,py){var dx=ax-px;var dy=ay-py;var ex=bx-px;var ey=by-py;var fx=cx-px;var fy=cy-py;var ap=dx*dx+dy*dy;var bp=ex*ex+ey*ey;var cp=fx*fx+fy*fy;return dx*(ey*cp-bp*fy)-dy*(ex*cp-bp*fx)+ap*(ex*fy-ey*fx)<0;}function circumradius(ax,ay,bx,by,cx,cy){var dx=bx-ax;var dy=by-ay;var ex=cx-ax;var ey=cy-ay;var bl=dx*dx+dy*dy;var cl=ex*ex+ey*ey;var d=0.5/(dx*ey-dy*ex);var x=(ey*bl-dy*cl)*d;var y=(dx*cl-ex*bl)*d;return x*x+y*y;}function circumcenter(ax,ay,bx,by,cx,cy){var dx=bx-ax;var dy=by-ay;var ex=cx-ax;var ey=cy-ay;var bl=dx*dx+dy*dy;var cl=ex*ex+ey*ey;var d=0.5/(dx*ey-dy*ex);var x=ax+(ey*bl-dy*cl)*d;var y=ay+(dx*cl-ex*bl)*d;return{x:x,y:y};}function quicksort(ids,dists,left,right){if(right-left<=20){for(var _i38=left+1;_i38<=right;_i38++){var _temp=ids[_i38];var tempDist=dists[_temp];var j=_i38-1;while(j>=left&&dists[ids[j]]>tempDist)ids[j+1]=ids[j--];ids[j+1]=_temp;}}else{var _median=left+right>>1;var _i39=left+1;var _j3=right;swap(ids,_median,_i39);if(dists[ids[left]]>dists[ids[right]])swap(ids,left,right);if(dists[ids[_i39]]>dists[ids[right]])swap(ids,_i39,right);if(dists[ids[left]]>dists[ids[_i39]])swap(ids,left,_i39);var _temp2=ids[_i39];var _tempDist=dists[_temp2];while(true){do _i39++;while(dists[ids[_i39]]<_tempDist);do _j3--;while(dists[ids[_j3]]>_tempDist);if(_j3<_i39)break;swap(ids,_i39,_j3);}ids[left+1]=ids[_j3];ids[_j3]=_temp2;if(right-_i39+1>=_j3-left){quicksort(ids,dists,_i39,right);quicksort(ids,dists,left,_j3-1);}else{quicksort(ids,dists,left,_j3-1);quicksort(ids,dists,_i39,right);}}}function swap(arr,i,j){var tmp=arr[i];arr[i]=arr[j];arr[j]=tmp;}function defaultGetX(p){return p[0];}function defaultGetY(p){return p[1];}var epsilon=1e-6;var Path=/*#__PURE__*/function(){function Path(){_classCallCheck(this,Path);this._x0=this._y0=// start of current subpath +this._x1=this._y1=null;// end of current subpath +this._="";}return _createClass(Path,[{key:"moveTo",value:function moveTo(x,y){this._+="M".concat(this._x0=this._x1=+x,",").concat(this._y0=this._y1=+y);}},{key:"closePath",value:function closePath(){if(this._x1!==null){this._x1=this._x0,this._y1=this._y0;this._+="Z";}}},{key:"lineTo",value:function lineTo(x,y){this._+="L".concat(this._x1=+x,",").concat(this._y1=+y);}},{key:"arc",value:function arc(x,y,r){x=+x,y=+y,r=+r;var x0=x+r;var y0=y;if(r<0)throw new Error("negative radius");if(this._x1===null)this._+="M".concat(x0,",").concat(y0);else if(Math.abs(this._x1-x0)>epsilon||Math.abs(this._y1-y0)>epsilon)this._+="L"+x0+","+y0;if(!r)return;this._+="A".concat(r,",").concat(r,",0,1,1,").concat(x-r,",").concat(y,"A").concat(r,",").concat(r,",0,1,1,").concat(this._x1=x0,",").concat(this._y1=y0);}},{key:"rect",value:function rect(x,y,w,h){this._+="M".concat(this._x0=this._x1=+x,",").concat(this._y0=this._y1=+y,"h").concat(+w,"v").concat(+h,"h").concat(-w,"Z");}},{key:"value",value:function value(){return this._||null;}}]);}();var Polygon=/*#__PURE__*/function(){function Polygon(){_classCallCheck(this,Polygon);this._=[];}return _createClass(Polygon,[{key:"moveTo",value:function moveTo(x,y){this._.push([x,y]);}},{key:"closePath",value:function closePath(){this._.push(this._[0].slice());}},{key:"lineTo",value:function lineTo(x,y){this._.push([x,y]);}},{key:"value",value:function value(){return this._.length?this._:null;}}]);}();var Voronoi$1=/*#__PURE__*/function(){function Voronoi(delaunay){_classCallCheck(this,Voronoi);var _ref17=arguments.length>1&&arguments[1]!==undefined?arguments[1]:[0,0,960,500],_ref18=_slicedToArray(_ref17,4),xmin=_ref18[0],ymin=_ref18[1],xmax=_ref18[2],ymax=_ref18[3];if(!((xmax=+xmax)>=(xmin=+xmin))||!((ymax=+ymax)>=(ymin=+ymin)))throw new Error("invalid bounds");this.delaunay=delaunay;this._circumcenters=new Float64Array(delaunay.points.length*2);this.vectors=new Float64Array(delaunay.points.length*2);this.xmax=xmax,this.xmin=xmin;this.ymax=ymax,this.ymin=ymin;this._init();}return _createClass(Voronoi,[{key:"update",value:function update(){this.delaunay.update();this._init();return this;}},{key:"_init",value:function _init(){var _this$delaunay=this.delaunay,points=_this$delaunay.points,hull=_this$delaunay.hull,triangles=_this$delaunay.triangles,vectors=this.vectors;var bx,by;// lazily computed barycenter of the hull +// Compute circumcenters. +var circumcenters=this.circumcenters=this._circumcenters.subarray(0,triangles.length/3*2);for(var _i40=0,j=0,n=triangles.length,_x30,_y10;_i40<n;_i40+=3,j+=2){var _t6=triangles[_i40]*2;var _t7=triangles[_i40+1]*2;var _t8=triangles[_i40+2]*2;var _x31=points[_t6];var _y11=points[_t6+1];var x2=points[_t7];var y2=points[_t7+1];var x3=points[_t8];var y3=points[_t8+1];var dx=x2-_x31;var dy=y2-_y11;var ex=x3-_x31;var ey=y3-_y11;var ab=(dx*ey-dy*ex)*2;if(Math.abs(ab)<1e-9){// For a degenerate triangle, the circumcenter is at the infinity, in a +// direction orthogonal to the halfedge and away from the “center” of +// the diagram <bx, by>, defined as the hull’s barycenter. +if(bx===undefined){bx=by=0;var _iterator29=_createForOfIteratorHelper(hull),_step29;try{for(_iterator29.s();!(_step29=_iterator29.n()).done;){var _i41=_step29.value;bx+=points[_i41*2],by+=points[_i41*2+1];}}catch(err){_iterator29.e(err);}finally{_iterator29.f();}bx/=hull.length,by/=hull.length;}var _a2=1e9*Math.sign((bx-_x31)*ey-(by-_y11)*ex);_x30=(_x31+x3)/2-_a2*ey;_y10=(_y11+y3)/2+_a2*ex;}else{var d=1/ab;var _bl2=dx*dx+dy*dy;var cl=ex*ex+ey*ey;_x30=_x31+(ey*_bl2-dy*cl)*d;_y10=_y11+(dx*cl-ex*_bl2)*d;}circumcenters[j]=_x30;circumcenters[j+1]=_y10;}// Compute exterior cell rays. +var h=hull[hull.length-1];var p0,p1=h*4;var x0,x1=points[2*h];var y0,y1=points[2*h+1];vectors.fill(0);for(var _i42=0;_i42<hull.length;++_i42){h=hull[_i42];p0=p1,x0=x1,y0=y1;p1=h*4,x1=points[2*h],y1=points[2*h+1];vectors[p0+2]=vectors[p1]=y0-y1;vectors[p0+3]=vectors[p1+1]=x1-x0;}}},{key:"render",value:function render(context){var buffer=context==null?context=new Path():undefined;var _this$delaunay2=this.delaunay,halfedges=_this$delaunay2.halfedges,inedges=_this$delaunay2.inedges,hull=_this$delaunay2.hull,circumcenters=this.circumcenters,vectors=this.vectors;if(hull.length<=1)return null;for(var _i43=0,n=halfedges.length;_i43<n;++_i43){var j=halfedges[_i43];if(j<_i43)continue;var ti=Math.floor(_i43/3)*2;var tj=Math.floor(j/3)*2;var xi=circumcenters[ti];var yi=circumcenters[ti+1];var xj=circumcenters[tj];var yj=circumcenters[tj+1];this._renderSegment(xi,yi,xj,yj,context);}var h0,h1=hull[hull.length-1];for(var _i44=0;_i44<hull.length;++_i44){h0=h1,h1=hull[_i44];var t=Math.floor(inedges[h1]/3)*2;var _x32=circumcenters[t];var _y12=circumcenters[t+1];var v=h0*4;var p=this._project(_x32,_y12,vectors[v+2],vectors[v+3]);if(p)this._renderSegment(_x32,_y12,p[0],p[1],context);}return buffer&&buffer.value();}},{key:"renderBounds",value:function renderBounds(context){var buffer=context==null?context=new Path():undefined;context.rect(this.xmin,this.ymin,this.xmax-this.xmin,this.ymax-this.ymin);return buffer&&buffer.value();}},{key:"renderCell",value:function renderCell(i,context){var buffer=context==null?context=new Path():undefined;var points=this._clip(i);if(points===null||!points.length)return;context.moveTo(points[0],points[1]);var n=points.length;while(points[0]===points[n-2]&&points[1]===points[n-1]&&n>1)n-=2;for(var _i45=2;_i45<n;_i45+=2){if(points[_i45]!==points[_i45-2]||points[_i45+1]!==points[_i45-1])context.lineTo(points[_i45],points[_i45+1]);}context.closePath();return buffer&&buffer.value();}},{key:"cellPolygons",value:/*#__PURE__*/_regenerator().m(function cellPolygons(){var points,_i46,n,_cell2;return _regenerator().w(function(_context6){while(1)switch(_context6.n){case 0:points=this.delaunay.points;_i46=0,n=points.length/2;case 1:if(!(_i46<n)){_context6.n=3;break;}_cell2=this.cellPolygon(_i46);if(!_cell2){_context6.n=2;break;}_cell2.index=_i46;_context6.n=2;return _cell2;case 2:++_i46;_context6.n=1;break;case 3:return _context6.a(2);}},cellPolygons,this);})},{key:"cellPolygon",value:function cellPolygon(i){var polygon=new Polygon();this.renderCell(i,polygon);return polygon.value();}},{key:"_renderSegment",value:function _renderSegment(x0,y0,x1,y1,context){var S;var c0=this._regioncode(x0,y0);var c1=this._regioncode(x1,y1);if(c0===0&&c1===0){context.moveTo(x0,y0);context.lineTo(x1,y1);}else if(S=this._clipSegment(x0,y0,x1,y1,c0,c1)){context.moveTo(S[0],S[1]);context.lineTo(S[2],S[3]);}}},{key:"contains",value:function contains(i,x,y){if((x=+x,x!==x)||(y=+y,y!==y))return false;return this.delaunay._step(i,x,y)===i;}},{key:"neighbors",value:/*#__PURE__*/_regenerator().m(function neighbors(i){var ci,_iterator30,_step30,j,cj,ai,li,aj,lj,_t9;return _regenerator().w(function(_context7){while(1)switch(_context7.p=_context7.n){case 0:ci=this._clip(i);if(!ci){_context7.n=12;break;}_iterator30=_createForOfIteratorHelper(this.delaunay.neighbors(i));_context7.p=1;_iterator30.s();case 2:if((_step30=_iterator30.n()).done){_context7.n=9;break;}j=_step30.value;cj=this._clip(j);// find the common edge +if(!cj){_context7.n=8;break;}ai=0,li=ci.length;case 3:if(!(ai<li)){_context7.n=8;break;}aj=0,lj=cj.length;case 4:if(!(aj<lj)){_context7.n=7;break;}if(!(ci[ai]===cj[aj]&&ci[ai+1]===cj[aj+1]&&ci[(ai+2)%li]===cj[(aj+lj-2)%lj]&&ci[(ai+3)%li]===cj[(aj+lj-1)%lj])){_context7.n=6;break;}_context7.n=5;return j;case 5:return _context7.a(3,8);case 6:aj+=2;_context7.n=4;break;case 7:ai+=2;_context7.n=3;break;case 8:_context7.n=2;break;case 9:_context7.n=11;break;case 10:_context7.p=10;_t9=_context7.v;_iterator30.e(_t9);case 11:_context7.p=11;_iterator30.f();return _context7.f(11);case 12:return _context7.a(2);}},neighbors,this,[[1,10,11,12]]);})},{key:"_cell",value:function _cell(i){var circumcenters=this.circumcenters,_this$delaunay3=this.delaunay,inedges=_this$delaunay3.inedges,halfedges=_this$delaunay3.halfedges,triangles=_this$delaunay3.triangles;var e0=inedges[i];if(e0===-1)return null;// coincident point +var points=[];var e=e0;do{var t=Math.floor(e/3);points.push(circumcenters[t*2],circumcenters[t*2+1]);e=e%3===2?e-2:e+1;if(triangles[e]!==i)break;// bad triangulation +e=halfedges[e];}while(e!==e0&&e!==-1);return points;}},{key:"_clip",value:function _clip(i){// degenerate case (1 valid point: return the box) +if(i===0&&this.delaunay.hull.length===1){return[this.xmax,this.ymin,this.xmax,this.ymax,this.xmin,this.ymax,this.xmin,this.ymin];}var points=this._cell(i);if(points===null)return null;var V=this.vectors;var v=i*4;return this._simplify(V[v]||V[v+1]?this._clipInfinite(i,points,V[v],V[v+1],V[v+2],V[v+3]):this._clipFinite(i,points));}},{key:"_clipFinite",value:function _clipFinite(i,points){var n=points.length;var P=null;var x0,y0,x1=points[n-2],y1=points[n-1];var c0,c1=this._regioncode(x1,y1);var e0,e1=0;for(var j=0;j<n;j+=2){x0=x1,y0=y1,x1=points[j],y1=points[j+1];c0=c1,c1=this._regioncode(x1,y1);if(c0===0&&c1===0){e0=e1,e1=0;if(P)P.push(x1,y1);else P=[x1,y1];}else{var S=void 0,sx0=void 0,sy0=void 0,sx1=void 0,sy1=void 0;if(c0===0){if((S=this._clipSegment(x0,y0,x1,y1,c0,c1))===null)continue;var _S=S;var _S2=_slicedToArray(_S,4);sx0=_S2[0];sy0=_S2[1];sx1=_S2[2];sy1=_S2[3];}else{if((S=this._clipSegment(x1,y1,x0,y0,c1,c0))===null)continue;var _S3=S;var _S4=_slicedToArray(_S3,4);sx1=_S4[0];sy1=_S4[1];sx0=_S4[2];sy0=_S4[3];e0=e1,e1=this._edgecode(sx0,sy0);if(e0&&e1)this._edge(i,e0,e1,P,P.length);if(P)P.push(sx0,sy0);else P=[sx0,sy0];}e0=e1,e1=this._edgecode(sx1,sy1);if(e0&&e1)this._edge(i,e0,e1,P,P.length);if(P)P.push(sx1,sy1);else P=[sx1,sy1];}}if(P){e0=e1,e1=this._edgecode(P[0],P[1]);if(e0&&e1)this._edge(i,e0,e1,P,P.length);}else if(this.contains(i,(this.xmin+this.xmax)/2,(this.ymin+this.ymax)/2)){return[this.xmax,this.ymin,this.xmax,this.ymax,this.xmin,this.ymax,this.xmin,this.ymin];}return P;}},{key:"_clipSegment",value:function _clipSegment(x0,y0,x1,y1,c0,c1){// for more robustness, always consider the segment in the same order +var flip=c0<c1;if(flip){var _ref19=[x1,y1,x0,y0,c1,c0];x0=_ref19[0];y0=_ref19[1];x1=_ref19[2];y1=_ref19[3];c0=_ref19[4];c1=_ref19[5];}while(true){if(c0===0&&c1===0)return flip?[x1,y1,x0,y0]:[x0,y0,x1,y1];if(c0&c1)return null;var _x33=void 0,_y13=void 0,_c2=c0||c1;if(_c2&8)_x33=x0+(x1-x0)*(this.ymax-y0)/(y1-y0),_y13=this.ymax;else if(_c2&4)_x33=x0+(x1-x0)*(this.ymin-y0)/(y1-y0),_y13=this.ymin;else if(_c2&2)_y13=y0+(y1-y0)*(this.xmax-x0)/(x1-x0),_x33=this.xmax;else _y13=y0+(y1-y0)*(this.xmin-x0)/(x1-x0),_x33=this.xmin;if(c0)x0=_x33,y0=_y13,c0=this._regioncode(x0,y0);else x1=_x33,y1=_y13,c1=this._regioncode(x1,y1);}}},{key:"_clipInfinite",value:function _clipInfinite(i,points,vx0,vy0,vxn,vyn){var P=Array.from(points),p;if(p=this._project(P[0],P[1],vx0,vy0))P.unshift(p[0],p[1]);if(p=this._project(P[P.length-2],P[P.length-1],vxn,vyn))P.push(p[0],p[1]);if(P=this._clipFinite(i,P)){for(var j=0,n=P.length,c0,c1=this._edgecode(P[n-2],P[n-1]);j<n;j+=2){c0=c1,c1=this._edgecode(P[j],P[j+1]);if(c0&&c1)j=this._edge(i,c0,c1,P,j),n=P.length;}}else if(this.contains(i,(this.xmin+this.xmax)/2,(this.ymin+this.ymax)/2)){P=[this.xmin,this.ymin,this.xmax,this.ymin,this.xmax,this.ymax,this.xmin,this.ymax];}return P;}},{key:"_edge",value:function _edge(i,e0,e1,P,j){while(e0!==e1){var _x34=void 0,_y14=void 0;switch(e0){case 5:e0=4;continue;// top-left +case 4:e0=6,_x34=this.xmax,_y14=this.ymin;break;// top +case 6:e0=2;continue;// top-right +case 2:e0=10,_x34=this.xmax,_y14=this.ymax;break;// right +case 10:e0=8;continue;// bottom-right +case 8:e0=9,_x34=this.xmin,_y14=this.ymax;break;// bottom +case 9:e0=1;continue;// bottom-left +case 1:e0=5,_x34=this.xmin,_y14=this.ymin;break;// left +}// Note: this implicitly checks for out of bounds: if P[j] or P[j+1] are +// undefined, the conditional statement will be executed. +if((P[j]!==_x34||P[j+1]!==_y14)&&this.contains(i,_x34,_y14)){P.splice(j,0,_x34,_y14),j+=2;}}return j;}},{key:"_project",value:function _project(x0,y0,vx,vy){var t=Infinity,c,x,y;if(vy<0){// top +if(y0<=this.ymin)return null;if((c=(this.ymin-y0)/vy)<t)y=this.ymin,x=x0+(t=c)*vx;}else if(vy>0){// bottom +if(y0>=this.ymax)return null;if((c=(this.ymax-y0)/vy)<t)y=this.ymax,x=x0+(t=c)*vx;}if(vx>0){// right +if(x0>=this.xmax)return null;if((c=(this.xmax-x0)/vx)<t)x=this.xmax,y=y0+(t=c)*vy;}else if(vx<0){// left +if(x0<=this.xmin)return null;if((c=(this.xmin-x0)/vx)<t)x=this.xmin,y=y0+(t=c)*vy;}return[x,y];}},{key:"_edgecode",value:function _edgecode(x,y){return(x===this.xmin?1:x===this.xmax?2:0)|(y===this.ymin?4:y===this.ymax?8:0);}},{key:"_regioncode",value:function _regioncode(x,y){return(x<this.xmin?1:x>this.xmax?2:0)|(y<this.ymin?4:y>this.ymax?8:0);}},{key:"_simplify",value:function _simplify(P){if(P&&P.length>4){for(var _i47=0;_i47<P.length;_i47+=2){var j=(_i47+2)%P.length,k=(_i47+4)%P.length;if(P[_i47]===P[j]&&P[j]===P[k]||P[_i47+1]===P[j+1]&&P[j+1]===P[k+1]){P.splice(j,2),_i47-=2;}}if(!P.length)P=null;}return P;}}]);}();var tau=2*Math.PI,pow=Math.pow;function pointX(p){return p[0];}function pointY(p){return p[1];}// A triangulation is collinear if all its triangles have a non-null area +function collinear(d){var triangles=d.triangles,coords=d.coords;for(var _i48=0;_i48<triangles.length;_i48+=3){var _a3=2*triangles[_i48],_b3=2*triangles[_i48+1],_c3=2*triangles[_i48+2],_cross=(coords[_c3]-coords[_a3])*(coords[_b3+1]-coords[_a3+1])-(coords[_b3]-coords[_a3])*(coords[_c3+1]-coords[_a3+1]);if(_cross>1e-10)return false;}return true;}function jitter(x,y,r){return[x+Math.sin(x+y)*r,y+Math.cos(x-y)*r];}var Delaunay=/*#__PURE__*/function(){function Delaunay(points){_classCallCheck(this,Delaunay);this._delaunator=new Delaunator(points);this.inedges=new Int32Array(points.length/2);this._hullIndex=new Int32Array(points.length/2);this.points=this._delaunator.coords;this._init();}return _createClass(Delaunay,[{key:"update",value:function update(){this._delaunator.update();this._init();return this;}},{key:"_init",value:function _init(){var d=this._delaunator,points=this.points;// check for collinear +if(d.hull&&d.hull.length>2&&collinear(d)){this.collinear=Int32Array.from({length:points.length/2},function(_,i){return i;}).sort(function(i,j){return points[2*i]-points[2*j]||points[2*i+1]-points[2*j+1];});// for exact neighbors +var e=this.collinear[0],f=this.collinear[this.collinear.length-1],_bounds=[points[2*e],points[2*e+1],points[2*f],points[2*f+1]],r=1e-8*Math.hypot(_bounds[3]-_bounds[1],_bounds[2]-_bounds[0]);for(var _i49=0,n=points.length/2;_i49<n;++_i49){var p=jitter(points[2*_i49],points[2*_i49+1],r);points[2*_i49]=p[0];points[2*_i49+1]=p[1];}this._delaunator=new Delaunator(points);}else{delete this.collinear;}var halfedges=this.halfedges=this._delaunator.halfedges;var hull=this.hull=this._delaunator.hull;var triangles=this.triangles=this._delaunator.triangles;var inedges=this.inedges.fill(-1);var hullIndex=this._hullIndex.fill(-1);// Compute an index from each point to an (arbitrary) incoming halfedge +// Used to give the first neighbor of each point; for this reason, +// on the hull we give priority to exterior halfedges +for(var _e2=0,_n4=halfedges.length;_e2<_n4;++_e2){var _p3=triangles[_e2%3===2?_e2-2:_e2+1];if(halfedges[_e2]===-1||inedges[_p3]===-1)inedges[_p3]=_e2;}for(var _i50=0,_n5=hull.length;_i50<_n5;++_i50){hullIndex[hull[_i50]]=_i50;}// degenerate case: 1 or 2 (distinct) points +if(hull.length<=2&&hull.length>0){this.triangles=new Int32Array(3).fill(-1);this.halfedges=new Int32Array(3).fill(-1);this.triangles[0]=hull[0];inedges[hull[0]]=1;if(hull.length===2){inedges[hull[1]]=0;this.triangles[1]=hull[1];this.triangles[2]=hull[1];}}}},{key:"voronoi",value:function voronoi(bounds){return new Voronoi$1(this,bounds);}},{key:"neighbors",value:/*#__PURE__*/_regenerator().m(function neighbors(i){var inedges,hull,_hullIndex,halfedges,triangles,collinear,l,e0,e,p0,p;return _regenerator().w(function(_context8){while(1)switch(_context8.n){case 0:inedges=this.inedges,hull=this.hull,_hullIndex=this._hullIndex,halfedges=this.halfedges,triangles=this.triangles,collinear=this.collinear;// degenerate case with several collinear points +if(!collinear){_context8.n=3;break;}l=collinear.indexOf(i);if(!(l>0)){_context8.n=1;break;}_context8.n=1;return collinear[l-1];case 1:if(!(l<collinear.length-1)){_context8.n=2;break;}_context8.n=2;return collinear[l+1];case 2:return _context8.a(2);case 3:e0=inedges[i];if(!(e0===-1)){_context8.n=4;break;}return _context8.a(2);case 4:// coincident point +e=e0,p0=-1;case 5:_context8.n=6;return p0=triangles[e];case 6:e=e%3===2?e-2:e+1;if(!(triangles[e]!==i)){_context8.n=7;break;}return _context8.a(2);case 7:// bad triangulation +e=halfedges[e];if(!(e===-1)){_context8.n=9;break;}p=hull[(_hullIndex[i]+1)%hull.length];if(!(p!==p0)){_context8.n=8;break;}_context8.n=8;return p;case 8:return _context8.a(2);case 9:if(e!==e0){_context8.n=5;break;}case 10:return _context8.a(2);}},neighbors,this);})},{key:"find",value:function find(x,y){var i=arguments.length>2&&arguments[2]!==undefined?arguments[2]:0;if((x=+x,x!==x)||(y=+y,y!==y))return-1;var i0=i;var c;while((c=this._step(i,x,y))>=0&&c!==i&&c!==i0)i=c;return c;}},{key:"_step",value:function _step(i,x,y){var inedges=this.inedges,hull=this.hull,_hullIndex=this._hullIndex,halfedges=this.halfedges,triangles=this.triangles,points=this.points;if(inedges[i]===-1||!points.length)return(i+1)%(points.length>>1);var c=i;var dc=pow(x-points[i*2],2)+pow(y-points[i*2+1],2);var e0=inedges[i];var e=e0;do{var t=triangles[e];var dt=pow(x-points[t*2],2)+pow(y-points[t*2+1],2);if(dt<dc)dc=dt,c=t;e=e%3===2?e-2:e+1;if(triangles[e]!==i)break;// bad triangulation +e=halfedges[e];if(e===-1){e=hull[(_hullIndex[i]+1)%hull.length];if(e!==t){if(pow(x-points[e*2],2)+pow(y-points[e*2+1],2)<dc)return e;}break;}}while(e!==e0);return c;}},{key:"render",value:function render(context){var buffer=context==null?context=new Path():undefined;var points=this.points,halfedges=this.halfedges,triangles=this.triangles;for(var _i51=0,n=halfedges.length;_i51<n;++_i51){var j=halfedges[_i51];if(j<_i51)continue;var ti=triangles[_i51]*2;var tj=triangles[j]*2;context.moveTo(points[ti],points[ti+1]);context.lineTo(points[tj],points[tj+1]);}this.renderHull(context);return buffer&&buffer.value();}},{key:"renderPoints",value:function renderPoints(context,r){if(r===undefined&&(!context||typeof context.moveTo!=="function"))r=context,context=null;r=r==undefined?2:+r;var buffer=context==null?context=new Path():undefined;var points=this.points;for(var _i52=0,n=points.length;_i52<n;_i52+=2){var _x35=points[_i52],_y15=points[_i52+1];context.moveTo(_x35+r,_y15);context.arc(_x35,_y15,r,0,tau);}return buffer&&buffer.value();}},{key:"renderHull",value:function renderHull(context){var buffer=context==null?context=new Path():undefined;var hull=this.hull,points=this.points;var h=hull[0]*2,n=hull.length;context.moveTo(points[h],points[h+1]);for(var _i53=1;_i53<n;++_i53){var _h=2*hull[_i53];context.lineTo(points[_h],points[_h+1]);}context.closePath();return buffer&&buffer.value();}},{key:"hullPolygon",value:function hullPolygon(){var polygon=new Polygon();this.renderHull(polygon);return polygon.value();}},{key:"renderTriangle",value:function renderTriangle(i,context){var buffer=context==null?context=new Path():undefined;var points=this.points,triangles=this.triangles;var t0=triangles[i*=3]*2;var t1=triangles[i+1]*2;var t2=triangles[i+2]*2;context.moveTo(points[t0],points[t0+1]);context.lineTo(points[t1],points[t1+1]);context.lineTo(points[t2],points[t2+1]);context.closePath();return buffer&&buffer.value();}},{key:"trianglePolygons",value:/*#__PURE__*/_regenerator().m(function trianglePolygons(){var triangles,_i54,n;return _regenerator().w(function(_context9){while(1)switch(_context9.n){case 0:triangles=this.triangles;_i54=0,n=triangles.length/3;case 1:if(!(_i54<n)){_context9.n=3;break;}_context9.n=2;return this.trianglePolygon(_i54);case 2:++_i54;_context9.n=1;break;case 3:return _context9.a(2);}},trianglePolygons,this);})},{key:"trianglePolygon",value:function trianglePolygon(i){var polygon=new Polygon();this.renderTriangle(i,polygon);return polygon.value();}}],[{key:"from",value:function from(points){var fx=arguments.length>1&&arguments[1]!==undefined?arguments[1]:pointX;var fy=arguments.length>2&&arguments[2]!==undefined?arguments[2]:pointY;var that=arguments.length>3?arguments[3]:undefined;return new Delaunay("length"in points?flatArray(points,fx,fy,that):Float64Array.from(flatIterable(points,fx,fy,that)));}}]);}();function flatArray(points,fx,fy,that){var n=points.length;var array=new Float64Array(n*2);for(var _i55=0;_i55<n;++_i55){var p=points[_i55];array[_i55*2]=fx.call(that,p,_i55,points);array[_i55*2+1]=fy.call(that,p,_i55,points);}return array;}function flatIterable(points,fx,fy,that){var i,_iterator31,_step31,p,_t0;return _regenerator().w(function(_context0){while(1)switch(_context0.p=_context0.n){case 0:i=0;_iterator31=_createForOfIteratorHelper(points);_context0.p=1;_iterator31.s();case 2:if((_step31=_iterator31.n()).done){_context0.n=6;break;}p=_step31.value;_context0.n=3;return fx.call(that,p,i,points);case 3:_context0.n=4;return fy.call(that,p,i,points);case 4:++i;case 5:_context0.n=2;break;case 6:_context0.n=8;break;case 7:_context0.p=7;_t0=_context0.v;_iterator31.e(_t0);case 8:_context0.p=8;_iterator31.f();return _context0.f(8);case 9:return _context0.a(2);}},_marked5,null,[[1,7,8,9]]);}function Voronoi(params){Transform.call(this,null,params);}Voronoi.Definition={'type':'Voronoi','metadata':{'modifies':true},'params':[{'name':'x','type':'field','required':true},{'name':'y','type':'field','required':true},{'name':'size','type':'number','array':true,'length':2},{'name':'extent','type':'array','array':true,'length':2,'default':[[-1e5,-1e5],[1e5,1e5]],'content':{'type':'number','array':true,'length':2}},{'name':'as','type':'string','default':'path'}]};var defaultExtent=[-1e5,-1e5,1e5,1e5];inherits(Voronoi,Transform,{transform:function transform(_,pulse){var as=_.as||'path',data=pulse.source;// nothing to do if no data +if(!data||!data.length)return pulse;// configure and construct voronoi diagram +var s=_.size;s=s?[0,0,s[0],s[1]]:(s=_.extent)?[s[0][0],s[0][1],s[1][0],s[1][1]]:defaultExtent;var voronoi=this.value=Delaunay.from(data,_.x,_.y).voronoi(s);// map polygons to paths +for(var _i56=0,n=data.length;_i56<n;++_i56){var polygon=voronoi.cellPolygon(_i56);data[_i56][as]=polygon&&!isPoint(polygon)?toPathString(polygon):null;}return pulse.reflow(_.modified()).modifies(as);}});// suppress duplicated end point vertices +function toPathString(p){var x=p[0][0],y=p[0][1];var n=p.length-1;for(;p[n][0]===x&&p[n][1]===y;--n);return'M'+p.slice(0,n+1).join('L')+'Z';}function isPoint(p){return p.length===2&&p[0][0]===p[1][0]&&p[0][1]===p[1][1];}var voronoi=/*#__PURE__*/Object.freeze({__proto__:null,voronoi:Voronoi});/* + Copyright (c) 2013, Jason Davies. + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + * The name Jason Davies may not be used to endorse or promote products + derived from this software without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + DISCLAIMED. IN NO EVENT SHALL JASON DAVIES BE LIABLE FOR ANY DIRECT, INDIRECT, + INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE + OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */// Word cloud layout by Jason Davies, https://www.jasondavies.com/wordcloud/ +// Algorithm due to Jonathan Feinberg, http://static.mrfeinberg.com/bv_ch03.pdf +var cloudRadians=Math.PI/180,cw=1<<11>>5,ch=1<<11;function cloud(){var size=[256,256],text,font,fontSize,fontStyle,fontWeight,rotate,padding,spiral=archimedeanSpiral,words=[],random=Math.random,cloud={};cloud.layout=function(){var contextAndRatio=getContext(domCanvas()),board=zeroArray((size[0]>>5)*size[1]),bounds=null,n=words.length,i=-1,tags=[],data=words.map(function(d){return{text:text(d),font:font(d),style:fontStyle(d),weight:fontWeight(d),rotate:rotate(d),size:~~(fontSize(d)+1e-14),padding:padding(d),xoff:0,yoff:0,x1:0,y1:0,x0:0,y0:0,hasText:false,sprite:null,datum:d};}).sort(function(a,b){return b.size-a.size;});while(++i<n){var d=data[i];d.x=size[0]*(random()+.5)>>1;d.y=size[1]*(random()+.5)>>1;cloudSprite(contextAndRatio,d,data,i);if(d.hasText&&place(board,d,bounds)){tags.push(d);if(bounds)cloudBounds(bounds,d);else bounds=[{x:d.x+d.x0,y:d.y+d.y0},{x:d.x+d.x1,y:d.y+d.y1}];// Temporary hack +d.x-=size[0]>>1;d.y-=size[1]>>1;}}return tags;};function getContext(canvas){canvas.width=canvas.height=1;var ratio=Math.sqrt(canvas.getContext('2d').getImageData(0,0,1,1).data.length>>2);canvas.width=(cw<<5)/ratio;canvas.height=ch/ratio;var context=canvas.getContext('2d');context.fillStyle=context.strokeStyle='red';context.textAlign='center';return{context:context,ratio:ratio};}function place(board,tag,bounds){var startX=tag.x,startY=tag.y,maxDelta=Math.hypot(size[0],size[1]),s=spiral(size),dt=random()<.5?1:-1,t=-dt,dxdy,dx,dy;while(dxdy=s(t+=dt)){dx=~~dxdy[0];dy=~~dxdy[1];if(Math.min(Math.abs(dx),Math.abs(dy))>=maxDelta)break;tag.x=startX+dx;tag.y=startY+dy;if(tag.x+tag.x0<0||tag.y+tag.y0<0||tag.x+tag.x1>size[0]||tag.y+tag.y1>size[1])continue;// TODO only check for collisions within current bounds. +if(!bounds||!cloudCollide(tag,board,size[0])){if(!bounds||collideRects(tag,bounds)){var sprite=tag.sprite,w=tag.width>>5,sw=size[0]>>5,lx=tag.x-(w<<4),sx=lx&0x7f,msx=32-sx,h=tag.y1-tag.y0,x=(tag.y+tag.y0)*sw+(lx>>5),last;for(var j=0;j<h;j++){last=0;for(var i=0;i<=w;i++){board[x+i]|=last<<msx|(i<w?(last=sprite[j*w+i])>>>sx:0);}x+=sw;}tag.sprite=null;return true;}}}return false;}cloud.words=function(_){if(arguments.length){words=_;return cloud;}else{return words;}};cloud.size=function(_){if(arguments.length){size=[+_[0],+_[1]];return cloud;}else{return size;}};cloud.font=function(_){if(arguments.length){font=functor(_);return cloud;}else{return font;}};cloud.fontStyle=function(_){if(arguments.length){fontStyle=functor(_);return cloud;}else{return fontStyle;}};cloud.fontWeight=function(_){if(arguments.length){fontWeight=functor(_);return cloud;}else{return fontWeight;}};cloud.rotate=function(_){if(arguments.length){rotate=functor(_);return cloud;}else{return rotate;}};cloud.text=function(_){if(arguments.length){text=functor(_);return cloud;}else{return text;}};cloud.spiral=function(_){if(arguments.length){spiral=spirals[_]||_;return cloud;}else{return spiral;}};cloud.fontSize=function(_){if(arguments.length){fontSize=functor(_);return cloud;}else{return fontSize;}};cloud.padding=function(_){if(arguments.length){padding=functor(_);return cloud;}else{return padding;}};cloud.random=function(_){if(arguments.length){random=_;return cloud;}else{return random;}};return cloud;}// Fetches a monochrome sprite bitmap for the specified text. +// Load in batches for speed. +function cloudSprite(contextAndRatio,d,data,di){if(d.sprite)return;var c=contextAndRatio.context,ratio=contextAndRatio.ratio;c.clearRect(0,0,(cw<<5)/ratio,ch/ratio);var x=0,y=0,maxh=0,n=data.length,w,w32,h,i,j;--di;while(++di<n){d=data[di];c.save();c.font=d.style+' '+d.weight+' '+~~((d.size+1)/ratio)+'px '+d.font;w=c.measureText(d.text+'m').width*ratio;h=d.size<<1;if(d.rotate){var sr=Math.sin(d.rotate*cloudRadians),cr=Math.cos(d.rotate*cloudRadians),wcr=w*cr,wsr=w*sr,hcr=h*cr,hsr=h*sr;w=Math.max(Math.abs(wcr+hsr),Math.abs(wcr-hsr))+0x1f>>5<<5;h=~~Math.max(Math.abs(wsr+hcr),Math.abs(wsr-hcr));}else{w=w+0x1f>>5<<5;}if(h>maxh)maxh=h;if(x+w>=cw<<5){x=0;y+=maxh;maxh=0;}if(y+h>=ch)break;c.translate((x+(w>>1))/ratio,(y+(h>>1))/ratio);if(d.rotate)c.rotate(d.rotate*cloudRadians);c.fillText(d.text,0,0);if(d.padding){c.lineWidth=2*d.padding;c.strokeText(d.text,0,0);}c.restore();d.width=w;d.height=h;d.xoff=x;d.yoff=y;d.x1=w>>1;d.y1=h>>1;d.x0=-d.x1;d.y0=-d.y1;d.hasText=true;x+=w;}var pixels=c.getImageData(0,0,(cw<<5)/ratio,ch/ratio).data,sprite=[];while(--di>=0){d=data[di];if(!d.hasText)continue;w=d.width;w32=w>>5;h=d.y1-d.y0;// Zero the buffer +for(i=0;i<h*w32;i++)sprite[i]=0;x=d.xoff;if(x==null)return;y=d.yoff;var seen=0,seenRow=-1;for(j=0;j<h;j++){for(i=0;i<w;i++){var k=w32*j+(i>>5),m=pixels[(y+j)*(cw<<5)+(x+i)<<2]?1<<31-i%32:0;sprite[k]|=m;seen|=m;}if(seen)seenRow=j;else{d.y0++;h--;j--;y++;}}d.y1=d.y0+seenRow;d.sprite=sprite.slice(0,(d.y1-d.y0)*w32);}}// Use mask-based collision detection. +function cloudCollide(tag,board,sw){sw>>=5;var sprite=tag.sprite,w=tag.width>>5,lx=tag.x-(w<<4),sx=lx&0x7f,msx=32-sx,h=tag.y1-tag.y0,x=(tag.y+tag.y0)*sw+(lx>>5),last;for(var j=0;j<h;j++){last=0;for(var i=0;i<=w;i++){if((last<<msx|(i<w?(last=sprite[j*w+i])>>>sx:0))&board[x+i])return true;}x+=sw;}return false;}function cloudBounds(bounds,d){var b0=bounds[0],b1=bounds[1];if(d.x+d.x0<b0.x)b0.x=d.x+d.x0;if(d.y+d.y0<b0.y)b0.y=d.y+d.y0;if(d.x+d.x1>b1.x)b1.x=d.x+d.x1;if(d.y+d.y1>b1.y)b1.y=d.y+d.y1;}function collideRects(a,b){return a.x+a.x1>b[0].x&&a.x+a.x0<b[1].x&&a.y+a.y1>b[0].y&&a.y+a.y0<b[1].y;}function archimedeanSpiral(size){var e=size[0]/size[1];return function(t){return[e*(t*=.1)*Math.cos(t),t*Math.sin(t)];};}function rectangularSpiral(size){var dy=4,dx=dy*size[0]/size[1],x=0,y=0;return function(t){var sign=t<0?-1:1;// See triangular numbers: T_n = n * (n + 1) / 2. +switch(Math.sqrt(1+4*sign*t)-sign&3){case 0:x+=dx;break;case 1:y+=dy;break;case 2:x-=dx;break;default:y-=dy;break;}return[x,y];};}// TODO reuse arrays? +function zeroArray(n){var a=[],i=-1;while(++i<n)a[i]=0;return a;}function functor(d){return typeof d==='function'?d:function(){return d;};}var spirals={archimedean:archimedeanSpiral,rectangular:rectangularSpiral};var Output=['x','y','font','fontSize','fontStyle','fontWeight','angle'];var Params$1=['text','font','rotate','fontSize','fontStyle','fontWeight'];function Wordcloud(params){Transform.call(this,cloud(),params);}Wordcloud.Definition={'type':'Wordcloud','metadata':{'modifies':true},'params':[{'name':'size','type':'number','array':true,'length':2},{'name':'font','type':'string','expr':true,'default':'sans-serif'},{'name':'fontStyle','type':'string','expr':true,'default':'normal'},{'name':'fontWeight','type':'string','expr':true,'default':'normal'},{'name':'fontSize','type':'number','expr':true,'default':14},{'name':'fontSizeRange','type':'number','array':'nullable','default':[10,50]},{'name':'rotate','type':'number','expr':true,'default':0},{'name':'text','type':'field'},{'name':'spiral','type':'string','values':['archimedean','rectangular']},{'name':'padding','type':'number','expr':true},{'name':'as','type':'string','array':true,'length':7,'default':Output}]};inherits(Wordcloud,Transform,{transform:function transform(_,pulse){if(_.size&&!(_.size[0]&&_.size[1])){error('Wordcloud size dimensions must be non-zero.');}function modp(param){var p=_[param];return isFunction(p)&&pulse.modified(p.fields);}var mod=_.modified();if(!(mod||pulse.changed(pulse.ADD_REM)||Params$1.some(modp)))return;var data=pulse.materialize(pulse.SOURCE).source,layout=this.value,as=_.as||Output;var fontSize=_.fontSize||14,range;isFunction(fontSize)?range=_.fontSizeRange:fontSize=constant$5(fontSize);// create font size scaling function as needed +if(range){var fsize=fontSize,sizeScale=scale$4('sqrt')().domain(_extent(data,fsize)).range(range);fontSize=function fontSize(x){return sizeScale(fsize(x));};}data.forEach(function(t){t[as[0]]=NaN;t[as[1]]=NaN;t[as[3]]=0;});// configure layout +var words=layout.words(data).text(_.text).size(_.size||[500,500]).padding(_.padding||1).spiral(_.spiral||'archimedean').rotate(_.rotate||0).font(_.font||'sans-serif').fontStyle(_.fontStyle||'normal').fontWeight(_.fontWeight||'normal').fontSize(fontSize).random(exports.random).layout();var size=layout.size(),dx=size[0]>>1,dy=size[1]>>1,n=words.length;for(var _i57=0,_w3,t;_i57<n;++_i57){_w3=words[_i57];t=_w3.datum;t[as[0]]=_w3.x+dx;t[as[1]]=_w3.y+dy;t[as[2]]=_w3.font;t[as[3]]=_w3.size;t[as[4]]=_w3.style;t[as[5]]=_w3.weight;t[as[6]]=_w3.rotate;}return pulse.reflow(mod).modifies(as);}});var wordcloud=/*#__PURE__*/Object.freeze({__proto__:null,wordcloud:Wordcloud});var array8=function array8(n){return new Uint8Array(n);};var array16=function array16(n){return new Uint16Array(n);};var array32=function array32(n){return new Uint32Array(n);};/** + * Maintains CrossFilter state. + */function Bitmaps(){var width=8,_data2=[],_seen=array32(0),_curr=array$1(0,width),_prev=array$1(0,width);return{data:function data(){return _data2;},seen:function seen(){return _seen=lengthen(_seen,_data2.length);},add:function add(array){for(var _i58=0,j=_data2.length,n=array.length,t;_i58<n;++_i58){t=array[_i58];t._index=j++;_data2.push(t);}},remove:function remove(num,map){// map: index -> boolean (true => remove) +var n=_data2.length,copy=Array(n-num),reindex=_data2;// reuse old data array for index map +var t,i,j;// seek forward to first removal +for(i=0;!map[i]&&i<n;++i){copy[i]=_data2[i];reindex[i]=i;}// condense arrays +for(j=i;i<n;++i){t=_data2[i];if(!map[i]){reindex[i]=j;_curr[j]=_curr[i];_prev[j]=_prev[i];copy[j]=t;t._index=j++;}else{reindex[i]=-1;}_curr[i]=0;// clear unused bits +}_data2=copy;return reindex;},size:function size(){return _data2.length;},curr:function curr(){return _curr;},prev:function prev(){return _prev;},reset:function reset(k){return _prev[k]=_curr[k];},all:function all(){return width<0x101?0xff:width<0x10001?0xffff:0xffffffff;},set:function set(k,one){_curr[k]|=one;},clear:function clear(k,one){_curr[k]&=~one;},resize:function resize(n,m){var k=_curr.length;if(n>k||m>width){width=Math.max(m,width);_curr=array$1(n,width,_curr);_prev=array$1(n,width);}}};}function lengthen(array,length,copy){if(array.length>=length)return array;copy=copy||new array.constructor(length);copy.set(array);return copy;}function array$1(n,m,array){var copy=(m<0x101?array8:m<0x10001?array16:array32)(n);if(array)copy.set(array);return copy;}function Dimension(index,i,query){var bit=1<<i;return{one:bit,zero:~bit,range:query.slice(),bisect:index.bisect,index:index.index,size:index.size,onAdd:function onAdd(added,curr){var dim=this,range=dim.bisect(dim.range,added.value),idx=added.index,lo=range[0],hi=range[1],n1=idx.length;var i;for(i=0;i<lo;++i)curr[idx[i]]|=bit;for(i=hi;i<n1;++i)curr[idx[i]]|=bit;return dim;}};}/** + * Maintains a list of values, sorted by key. + */function SortedIndex(){var _index8=array32(0),value=[],_size=0;function insert(key,data,base){if(!data.length)return[];var n0=_size,n1=data.length,addi=array32(n1);var addv=Array(n1),oldv,oldi,i;for(i=0;i<n1;++i){addv[i]=key(data[i]);addi[i]=i;}addv=sort$1(addv,addi);if(n0){oldv=value;oldi=_index8;value=Array(n0+n1);_index8=array32(n0+n1);merge$1(base,oldv,oldi,n0,addv,addi,n1,value,_index8);}else{if(base>0)for(i=0;i<n1;++i){addi[i]+=base;}value=addv;_index8=addi;}_size=n0+n1;return{index:addi,value:addv};}function remove(num,map){// map: index -> remove +var n=_size;var idx,i,j;// seek forward to first removal +for(i=0;!map[_index8[i]]&&i<n;++i);// condense index and value arrays +for(j=i;i<n;++i){if(!map[idx=_index8[i]]){_index8[j]=idx;value[j]=value[i];++j;}}_size=n-num;}function reindex(map){for(var _i59=0,n=_size;_i59<n;++_i59){_index8[_i59]=map[_index8[_i59]];}}function bisect(range,array){var n;if(array){n=array.length;}else{array=value;n=_size;}return[bisectLeft$1(array,range[0],0,n),bisectRight$1(array,range[1],0,n)];}return{insert:insert,remove:remove,bisect:bisect,reindex:reindex,index:function index(){return _index8;},size:function size(){return _size;}};}function sort$1(values,index){values.sort.call(index,function(a,b){var x=values[a],y=values[b];return x<y?-1:x>y?1:0;});return permute(values,index);}function merge$1(base,value0,index0,n0,value1,index1,n1,value,index){var i0=0,i1=0,i;for(i=0;i0<n0&&i1<n1;++i){if(value0[i0]<value1[i1]){value[i]=value0[i0];index[i]=index0[i0++];}else{value[i]=value1[i1];index[i]=index1[i1++]+base;}}for(;i0<n0;++i0,++i){value[i]=value0[i0];index[i]=index0[i0];}for(;i1<n1;++i1,++i){value[i]=value1[i1];index[i]=index1[i1]+base;}}/** + * An indexed multi-dimensional filter. + * @constructor + * @param {object} params - The parameters for this operator. + * @param {Array<function(object): *>} params.fields - An array of dimension accessors to filter. + * @param {Array} params.query - An array of per-dimension range queries. + */function CrossFilter(params){Transform.call(this,Bitmaps(),params);this._indices=null;this._dims=null;}CrossFilter.Definition={'type':'CrossFilter','metadata':{},'params':[{'name':'fields','type':'field','array':true,'required':true},{'name':'query','type':'array','array':true,'required':true,'content':{'type':'number','array':true,'length':2}}]};inherits(CrossFilter,Transform,{transform:function transform(_,pulse){if(!this._dims){return this.init(_,pulse);}else{var init=_.modified('fields')||_.fields.some(function(f){return pulse.modified(f.fields);});return init?this.reinit(_,pulse):this.eval(_,pulse);}},init:function init(_,pulse){var fields=_.fields,query=_.query,indices=this._indices={},dims=this._dims=[],m=query.length;var i=0,key,index;// instantiate indices and dimensions +for(;i<m;++i){key=fields[i].fname;index=indices[key]||(indices[key]=SortedIndex());dims.push(Dimension(index,i,query[i]));}return this.eval(_,pulse);},reinit:function reinit(_,pulse){var output=pulse.materialize().fork(),fields=_.fields,query=_.query,indices=this._indices,dims=this._dims,bits=this.value,curr=bits.curr(),prev=bits.prev(),all=bits.all(),out=output.rem=output.add,mod=output.mod,m=query.length,adds={};var add,index,key,mods,remMap,modMap,i,n,f;// set prev to current state +prev.set(curr);// if pulse has remove tuples, process them first +if(pulse.rem.length){remMap=this.remove(_,pulse,output);}// if pulse has added tuples, add them to state +if(pulse.add.length){bits.add(pulse.add);}// if pulse has modified tuples, create an index map +if(pulse.mod.length){modMap={};for(mods=pulse.mod,i=0,n=mods.length;i<n;++i){modMap[mods[i]._index]=1;}}// re-initialize indices as needed, update curr bitmap +for(i=0;i<m;++i){f=fields[i];if(!dims[i]||_.modified('fields',i)||pulse.modified(f.fields)){key=f.fname;if(!(add=adds[key])){indices[key]=index=SortedIndex();adds[key]=add=index.insert(f,pulse.source,0);}dims[i]=Dimension(index,i,query[i]).onAdd(add,curr);}}// visit each tuple +// if filter state changed, push index to add/rem +// else if in mod and passes a filter, push index to mod +for(i=0,n=bits.data().length;i<n;++i){if(remMap[i]){// skip if removed tuple +continue;}else if(prev[i]!==curr[i]){// add if state changed +out.push(i);}else if(modMap[i]&&curr[i]!==all){// otherwise, pass mods through +mod.push(i);}}bits.mask=(1<<m)-1;return output;},eval:function _eval(_,pulse){var output=pulse.materialize().fork(),m=this._dims.length;var mask=0;if(pulse.rem.length){this.remove(_,pulse,output);mask|=(1<<m)-1;}if(_.modified('query')&&!_.modified('fields')){mask|=this.update(_,pulse,output);}if(pulse.add.length){this.insert(_,pulse,output);mask|=(1<<m)-1;}if(pulse.mod.length){this.modify(pulse,output);mask|=(1<<m)-1;}this.value.mask=mask;return output;},insert:function insert(_,pulse,output){var tuples=pulse.add,bits=this.value,dims=this._dims,indices=this._indices,fields=_.fields,adds={},out=output.add,n=bits.size()+tuples.length,m=dims.length;var k=bits.size(),j,key,add;// resize bitmaps and add tuples as needed +bits.resize(n,m);bits.add(tuples);var curr=bits.curr(),prev=bits.prev(),all=bits.all();// add to dimensional indices +for(j=0;j<m;++j){key=fields[j].fname;add=adds[key]||(adds[key]=indices[key].insert(fields[j],tuples,k));dims[j].onAdd(add,curr);}// set previous filters, output if passes at least one filter +for(;k<n;++k){prev[k]=all;if(curr[k]!==all)out.push(k);}},modify:function modify(pulse,output){var out=output.mod,bits=this.value,curr=bits.curr(),all=bits.all(),tuples=pulse.mod;var i,n,k;for(i=0,n=tuples.length;i<n;++i){k=tuples[i]._index;if(curr[k]!==all)out.push(k);}},remove:function remove(_,pulse,output){var indices=this._indices,bits=this.value,curr=bits.curr(),prev=bits.prev(),all=bits.all(),map={},out=output.rem,tuples=pulse.rem;var i,n,k,f;// process tuples, output if passes at least one filter +for(i=0,n=tuples.length;i<n;++i){k=tuples[i]._index;map[k]=1;// build index map +prev[k]=f=curr[k];curr[k]=all;if(f!==all)out.push(k);}// remove from dimensional indices +for(k in indices){indices[k].remove(n,map);}this.reindex(pulse,n,map);return map;},// reindex filters and indices after propagation completes +reindex:function reindex(pulse,num,map){var indices=this._indices,bits=this.value;pulse.runAfter(function(){var indexMap=bits.remove(num,map);for(var _key16 in indices)indices[_key16].reindex(indexMap);});},update:function update(_,pulse,output){var dims=this._dims,query=_.query,stamp=pulse.stamp,m=dims.length;var mask=0,i,q;// survey how many queries have changed +output.filters=0;for(q=0;q<m;++q){if(_.modified('query',q)){i=q;++mask;}}if(mask===1){// only one query changed, use more efficient update +mask=dims[i].one;this.incrementOne(dims[i],query[i],output.add,output.rem);}else{// multiple queries changed, perform full record keeping +for(q=0,mask=0;q<m;++q){if(!_.modified('query',q))continue;mask|=dims[q].one;this.incrementAll(dims[q],query[q],stamp,output.add);output.rem=output.add;// duplicate add/rem for downstream resolve +}}return mask;},incrementAll:function incrementAll(dim,query,stamp,out){var bits=this.value,seen=bits.seen(),curr=bits.curr(),prev=bits.prev(),index=dim.index(),old=dim.bisect(dim.range),range=dim.bisect(query),lo1=range[0],hi1=range[1],lo0=old[0],hi0=old[1],one=dim.one;var i,j,k;// Fast incremental update based on previous lo index. +if(lo1<lo0){for(i=lo1,j=Math.min(lo0,hi1);i<j;++i){k=index[i];if(seen[k]!==stamp){prev[k]=curr[k];seen[k]=stamp;out.push(k);}curr[k]^=one;}}else if(lo1>lo0){for(i=lo0,j=Math.min(lo1,hi0);i<j;++i){k=index[i];if(seen[k]!==stamp){prev[k]=curr[k];seen[k]=stamp;out.push(k);}curr[k]^=one;}}// Fast incremental update based on previous hi index. +if(hi1>hi0){for(i=Math.max(lo1,hi0),j=hi1;i<j;++i){k=index[i];if(seen[k]!==stamp){prev[k]=curr[k];seen[k]=stamp;out.push(k);}curr[k]^=one;}}else if(hi1<hi0){for(i=Math.max(lo0,hi1),j=hi0;i<j;++i){k=index[i];if(seen[k]!==stamp){prev[k]=curr[k];seen[k]=stamp;out.push(k);}curr[k]^=one;}}dim.range=query.slice();},incrementOne:function incrementOne(dim,query,add,rem){var bits=this.value,curr=bits.curr(),index=dim.index(),old=dim.bisect(dim.range),range=dim.bisect(query),lo1=range[0],hi1=range[1],lo0=old[0],hi0=old[1],one=dim.one;var i,j,k;// Fast incremental update based on previous lo index. +if(lo1<lo0){for(i=lo1,j=Math.min(lo0,hi1);i<j;++i){k=index[i];curr[k]^=one;add.push(k);}}else if(lo1>lo0){for(i=lo0,j=Math.min(lo1,hi0);i<j;++i){k=index[i];curr[k]^=one;rem.push(k);}}// Fast incremental update based on previous hi index. +if(hi1>hi0){for(i=Math.max(lo1,hi0),j=hi1;i<j;++i){k=index[i];curr[k]^=one;add.push(k);}}else if(hi1<hi0){for(i=Math.max(lo0,hi1),j=hi0;i<j;++i){k=index[i];curr[k]^=one;rem.push(k);}}dim.range=query.slice();}});/** + * Selectively filters tuples by resolving against a filter bitmap. + * Useful for processing the output of a cross-filter transform. + * @constructor + * @param {object} params - The parameters for this operator. + * @param {object} params.ignore - A bit mask indicating which filters to ignore. + * @param {object} params.filter - The per-tuple filter bitmaps. Typically this + * parameter value is a reference to a {@link CrossFilter} transform. + */function ResolveFilter(params){Transform.call(this,null,params);}ResolveFilter.Definition={'type':'ResolveFilter','metadata':{},'params':[{'name':'ignore','type':'number','required':true,'description':'A bit mask indicating which filters to ignore.'},{'name':'filter','type':'object','required':true,'description':'Per-tuple filter bitmaps from a CrossFilter transform.'}]};inherits(ResolveFilter,Transform,{transform:function transform(_,pulse){var ignore=~(_.ignore||0),// bit mask where zeros -> dims to ignore +bitmap=_.filter,mask=bitmap.mask;// exit early if no relevant filter changes +if((mask&ignore)===0)return pulse.StopPropagation;var output=pulse.fork(pulse.ALL),data=bitmap.data(),curr=bitmap.curr(),prev=bitmap.prev(),pass=function pass(k){return!(curr[k]&ignore)?data[k]:null;};// propagate all mod tuples that pass the filter +output.filter(output.MOD,pass);// determine add & rem tuples via filter functions +// for efficiency, we do *not* populate new arrays, +// instead we add filter functions applied downstream +if(!(mask&mask-1)){// only one filter changed +output.filter(output.ADD,pass);output.filter(output.REM,function(k){return(curr[k]&ignore)===mask?data[k]:null;});}else{// multiple filters changed +output.filter(output.ADD,function(k){var c=curr[k]&ignore,f=!c&&c^prev[k]&ignore;return f?data[k]:null;});output.filter(output.REM,function(k){var c=curr[k]&ignore,f=c&&!(c^(c^prev[k]&ignore));return f?data[k]:null;});}// add filter to source data in case of reflow... +return output.filter(output.SOURCE,function(t){return pass(t._index);});}});var xf=/*#__PURE__*/Object.freeze({__proto__:null,crossfilter:CrossFilter,resolvefilter:ResolveFilter});var version$1="6.1.2";var RawCode='RawCode';var Literal='Literal';var Property='Property';var Identifier='Identifier';var ArrayExpression='ArrayExpression';var BinaryExpression='BinaryExpression';var CallExpression='CallExpression';var ConditionalExpression='ConditionalExpression';var LogicalExpression='LogicalExpression';var MemberExpression='MemberExpression';var ObjectExpression='ObjectExpression';var UnaryExpression='UnaryExpression';function ASTNode(type){this.type=type;}ASTNode.prototype.visit=function(visitor){var c,i,n;if(visitor(this))return 1;for(c=children(this),i=0,n=c.length;i<n;++i){if(c[i].visit(visitor))return 1;}};function children(node){switch(node.type){case ArrayExpression:return node.elements;case BinaryExpression:case LogicalExpression:return[node.left,node.right];case CallExpression:return[node.callee].concat(node.arguments);case ConditionalExpression:return[node.test,node.consequent,node.alternate];case MemberExpression:return[node.object,node.property];case ObjectExpression:return node.properties;case Property:return[node.key,node.value];case UnaryExpression:return[node.argument];case Identifier:case Literal:case RawCode:default:return[];}}/* + The following expression parser is based on Esprima (http://esprima.org/). + Original header comment and license for Esprima is included here: + + Copyright (C) 2013 Ariya Hidayat <ariya.hidayat@gmail.com> + Copyright (C) 2013 Thaddee Tyl <thaddee.tyl@gmail.com> + Copyright (C) 2013 Mathias Bynens <mathias@qiwi.be> + Copyright (C) 2012 Ariya Hidayat <ariya.hidayat@gmail.com> + Copyright (C) 2012 Mathias Bynens <mathias@qiwi.be> + Copyright (C) 2012 Joost-Wim Boekesteijn <joost-wim@boekesteijn.nl> + Copyright (C) 2012 Kris Kowal <kris.kowal@cixar.com> + Copyright (C) 2012 Yusuke Suzuki <utatane.tea@gmail.com> + Copyright (C) 2012 Arpad Borsos <arpad.borsos@googlemail.com> + Copyright (C) 2011 Ariya Hidayat <ariya.hidayat@gmail.com> + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */var TokenName,source,index,length,lookahead;var TokenBooleanLiteral=1,TokenEOF=2,TokenIdentifier=3,TokenKeyword=4,TokenNullLiteral=5,TokenNumericLiteral=6,TokenPunctuator=7,TokenStringLiteral=8,TokenRegularExpression=9;TokenName={};TokenName[TokenBooleanLiteral]='Boolean';TokenName[TokenEOF]='<end>';TokenName[TokenIdentifier]='Identifier';TokenName[TokenKeyword]='Keyword';TokenName[TokenNullLiteral]='Null';TokenName[TokenNumericLiteral]='Numeric';TokenName[TokenPunctuator]='Punctuator';TokenName[TokenStringLiteral]='String';TokenName[TokenRegularExpression]='RegularExpression';var SyntaxArrayExpression='ArrayExpression',SyntaxBinaryExpression='BinaryExpression',SyntaxCallExpression='CallExpression',SyntaxConditionalExpression='ConditionalExpression',SyntaxIdentifier='Identifier',SyntaxLiteral='Literal',SyntaxLogicalExpression='LogicalExpression',SyntaxMemberExpression='MemberExpression',SyntaxObjectExpression='ObjectExpression',SyntaxProperty='Property',SyntaxUnaryExpression='UnaryExpression';// Error messages should be identical to V8. +var MessageUnexpectedToken='Unexpected token %0',MessageUnexpectedNumber='Unexpected number',MessageUnexpectedString='Unexpected string',MessageUnexpectedIdentifier='Unexpected identifier',MessageUnexpectedReserved='Unexpected reserved word',MessageUnexpectedEOS='Unexpected end of input',MessageInvalidRegExp='Invalid regular expression',MessageUnterminatedRegExp='Invalid regular expression: missing /',MessageStrictOctalLiteral='Octal literals are not allowed in strict mode.',MessageStrictDuplicateProperty='Duplicate data property in object literal not allowed in strict mode';var ILLEGAL$1='ILLEGAL',DISABLED='Disabled.';// See also tools/generate-unicode-regex.py. +var RegexNonAsciiIdentifierStart=new RegExp("[\\xAA\\xB5\\xBA\\xC0-\\xD6\\xD8-\\xF6\\xF8-\\u02C1\\u02C6-\\u02D1\\u02E0-\\u02E4\\u02EC\\u02EE\\u0370-\\u0374\\u0376\\u0377\\u037A-\\u037D\\u037F\\u0386\\u0388-\\u038A\\u038C\\u038E-\\u03A1\\u03A3-\\u03F5\\u03F7-\\u0481\\u048A-\\u052F\\u0531-\\u0556\\u0559\\u0561-\\u0587\\u05D0-\\u05EA\\u05F0-\\u05F2\\u0620-\\u064A\\u066E\\u066F\\u0671-\\u06D3\\u06D5\\u06E5\\u06E6\\u06EE\\u06EF\\u06FA-\\u06FC\\u06FF\\u0710\\u0712-\\u072F\\u074D-\\u07A5\\u07B1\\u07CA-\\u07EA\\u07F4\\u07F5\\u07FA\\u0800-\\u0815\\u081A\\u0824\\u0828\\u0840-\\u0858\\u08A0-\\u08B2\\u0904-\\u0939\\u093D\\u0950\\u0958-\\u0961\\u0971-\\u0980\\u0985-\\u098C\\u098F\\u0990\\u0993-\\u09A8\\u09AA-\\u09B0\\u09B2\\u09B6-\\u09B9\\u09BD\\u09CE\\u09DC\\u09DD\\u09DF-\\u09E1\\u09F0\\u09F1\\u0A05-\\u0A0A\\u0A0F\\u0A10\\u0A13-\\u0A28\\u0A2A-\\u0A30\\u0A32\\u0A33\\u0A35\\u0A36\\u0A38\\u0A39\\u0A59-\\u0A5C\\u0A5E\\u0A72-\\u0A74\\u0A85-\\u0A8D\\u0A8F-\\u0A91\\u0A93-\\u0AA8\\u0AAA-\\u0AB0\\u0AB2\\u0AB3\\u0AB5-\\u0AB9\\u0ABD\\u0AD0\\u0AE0\\u0AE1\\u0B05-\\u0B0C\\u0B0F\\u0B10\\u0B13-\\u0B28\\u0B2A-\\u0B30\\u0B32\\u0B33\\u0B35-\\u0B39\\u0B3D\\u0B5C\\u0B5D\\u0B5F-\\u0B61\\u0B71\\u0B83\\u0B85-\\u0B8A\\u0B8E-\\u0B90\\u0B92-\\u0B95\\u0B99\\u0B9A\\u0B9C\\u0B9E\\u0B9F\\u0BA3\\u0BA4\\u0BA8-\\u0BAA\\u0BAE-\\u0BB9\\u0BD0\\u0C05-\\u0C0C\\u0C0E-\\u0C10\\u0C12-\\u0C28\\u0C2A-\\u0C39\\u0C3D\\u0C58\\u0C59\\u0C60\\u0C61\\u0C85-\\u0C8C\\u0C8E-\\u0C90\\u0C92-\\u0CA8\\u0CAA-\\u0CB3\\u0CB5-\\u0CB9\\u0CBD\\u0CDE\\u0CE0\\u0CE1\\u0CF1\\u0CF2\\u0D05-\\u0D0C\\u0D0E-\\u0D10\\u0D12-\\u0D3A\\u0D3D\\u0D4E\\u0D60\\u0D61\\u0D7A-\\u0D7F\\u0D85-\\u0D96\\u0D9A-\\u0DB1\\u0DB3-\\u0DBB\\u0DBD\\u0DC0-\\u0DC6\\u0E01-\\u0E30\\u0E32\\u0E33\\u0E40-\\u0E46\\u0E81\\u0E82\\u0E84\\u0E87\\u0E88\\u0E8A\\u0E8D\\u0E94-\\u0E97\\u0E99-\\u0E9F\\u0EA1-\\u0EA3\\u0EA5\\u0EA7\\u0EAA\\u0EAB\\u0EAD-\\u0EB0\\u0EB2\\u0EB3\\u0EBD\\u0EC0-\\u0EC4\\u0EC6\\u0EDC-\\u0EDF\\u0F00\\u0F40-\\u0F47\\u0F49-\\u0F6C\\u0F88-\\u0F8C\\u1000-\\u102A\\u103F\\u1050-\\u1055\\u105A-\\u105D\\u1061\\u1065\\u1066\\u106E-\\u1070\\u1075-\\u1081\\u108E\\u10A0-\\u10C5\\u10C7\\u10CD\\u10D0-\\u10FA\\u10FC-\\u1248\\u124A-\\u124D\\u1250-\\u1256\\u1258\\u125A-\\u125D\\u1260-\\u1288\\u128A-\\u128D\\u1290-\\u12B0\\u12B2-\\u12B5\\u12B8-\\u12BE\\u12C0\\u12C2-\\u12C5\\u12C8-\\u12D6\\u12D8-\\u1310\\u1312-\\u1315\\u1318-\\u135A\\u1380-\\u138F\\u13A0-\\u13F4\\u1401-\\u166C\\u166F-\\u167F\\u1681-\\u169A\\u16A0-\\u16EA\\u16EE-\\u16F8\\u1700-\\u170C\\u170E-\\u1711\\u1720-\\u1731\\u1740-\\u1751\\u1760-\\u176C\\u176E-\\u1770\\u1780-\\u17B3\\u17D7\\u17DC\\u1820-\\u1877\\u1880-\\u18A8\\u18AA\\u18B0-\\u18F5\\u1900-\\u191E\\u1950-\\u196D\\u1970-\\u1974\\u1980-\\u19AB\\u19C1-\\u19C7\\u1A00-\\u1A16\\u1A20-\\u1A54\\u1AA7\\u1B05-\\u1B33\\u1B45-\\u1B4B\\u1B83-\\u1BA0\\u1BAE\\u1BAF\\u1BBA-\\u1BE5\\u1C00-\\u1C23\\u1C4D-\\u1C4F\\u1C5A-\\u1C7D\\u1CE9-\\u1CEC\\u1CEE-\\u1CF1\\u1CF5\\u1CF6\\u1D00-\\u1DBF\\u1E00-\\u1F15\\u1F18-\\u1F1D\\u1F20-\\u1F45\\u1F48-\\u1F4D\\u1F50-\\u1F57\\u1F59\\u1F5B\\u1F5D\\u1F5F-\\u1F7D\\u1F80-\\u1FB4\\u1FB6-\\u1FBC\\u1FBE\\u1FC2-\\u1FC4\\u1FC6-\\u1FCC\\u1FD0-\\u1FD3\\u1FD6-\\u1FDB\\u1FE0-\\u1FEC\\u1FF2-\\u1FF4\\u1FF6-\\u1FFC\\u2071\\u207F\\u2090-\\u209C\\u2102\\u2107\\u210A-\\u2113\\u2115\\u2119-\\u211D\\u2124\\u2126\\u2128\\u212A-\\u212D\\u212F-\\u2139\\u213C-\\u213F\\u2145-\\u2149\\u214E\\u2160-\\u2188\\u2C00-\\u2C2E\\u2C30-\\u2C5E\\u2C60-\\u2CE4\\u2CEB-\\u2CEE\\u2CF2\\u2CF3\\u2D00-\\u2D25\\u2D27\\u2D2D\\u2D30-\\u2D67\\u2D6F\\u2D80-\\u2D96\\u2DA0-\\u2DA6\\u2DA8-\\u2DAE\\u2DB0-\\u2DB6\\u2DB8-\\u2DBE\\u2DC0-\\u2DC6\\u2DC8-\\u2DCE\\u2DD0-\\u2DD6\\u2DD8-\\u2DDE\\u2E2F\\u3005-\\u3007\\u3021-\\u3029\\u3031-\\u3035\\u3038-\\u303C\\u3041-\\u3096\\u309D-\\u309F\\u30A1-\\u30FA\\u30FC-\\u30FF\\u3105-\\u312D\\u3131-\\u318E\\u31A0-\\u31BA\\u31F0-\\u31FF\\u3400-\\u4DB5\\u4E00-\\u9FCC\\uA000-\\uA48C\\uA4D0-\\uA4FD\\uA500-\\uA60C\\uA610-\\uA61F\\uA62A\\uA62B\\uA640-\\uA66E\\uA67F-\\uA69D\\uA6A0-\\uA6EF\\uA717-\\uA71F\\uA722-\\uA788\\uA78B-\\uA78E\\uA790-\\uA7AD\\uA7B0\\uA7B1\\uA7F7-\\uA801\\uA803-\\uA805\\uA807-\\uA80A\\uA80C-\\uA822\\uA840-\\uA873\\uA882-\\uA8B3\\uA8F2-\\uA8F7\\uA8FB\\uA90A-\\uA925\\uA930-\\uA946\\uA960-\\uA97C\\uA984-\\uA9B2\\uA9CF\\uA9E0-\\uA9E4\\uA9E6-\\uA9EF\\uA9FA-\\uA9FE\\uAA00-\\uAA28\\uAA40-\\uAA42\\uAA44-\\uAA4B\\uAA60-\\uAA76\\uAA7A\\uAA7E-\\uAAAF\\uAAB1\\uAAB5\\uAAB6\\uAAB9-\\uAABD\\uAAC0\\uAAC2\\uAADB-\\uAADD\\uAAE0-\\uAAEA\\uAAF2-\\uAAF4\\uAB01-\\uAB06\\uAB09-\\uAB0E\\uAB11-\\uAB16\\uAB20-\\uAB26\\uAB28-\\uAB2E\\uAB30-\\uAB5A\\uAB5C-\\uAB5F\\uAB64\\uAB65\\uABC0-\\uABE2\\uAC00-\\uD7A3\\uD7B0-\\uD7C6\\uD7CB-\\uD7FB\\uF900-\\uFA6D\\uFA70-\\uFAD9\\uFB00-\\uFB06\\uFB13-\\uFB17\\uFB1D\\uFB1F-\\uFB28\\uFB2A-\\uFB36\\uFB38-\\uFB3C\\uFB3E\\uFB40\\uFB41\\uFB43\\uFB44\\uFB46-\\uFBB1\\uFBD3-\\uFD3D\\uFD50-\\uFD8F\\uFD92-\\uFDC7\\uFDF0-\\uFDFB\\uFE70-\\uFE74\\uFE76-\\uFEFC\\uFF21-\\uFF3A\\uFF41-\\uFF5A\\uFF66-\\uFFBE\\uFFC2-\\uFFC7\\uFFCA-\\uFFCF\\uFFD2-\\uFFD7\\uFFDA-\\uFFDC]"),// eslint-disable-next-line no-misleading-character-class +RegexNonAsciiIdentifierPart=new RegExp("[\\xAA\\xB5\\xBA\\xC0-\\xD6\\xD8-\\xF6\\xF8-\\u02C1\\u02C6-\\u02D1\\u02E0-\\u02E4\\u02EC\\u02EE\\u0300-\\u0374\\u0376\\u0377\\u037A-\\u037D\\u037F\\u0386\\u0388-\\u038A\\u038C\\u038E-\\u03A1\\u03A3-\\u03F5\\u03F7-\\u0481\\u0483-\\u0487\\u048A-\\u052F\\u0531-\\u0556\\u0559\\u0561-\\u0587\\u0591-\\u05BD\\u05BF\\u05C1\\u05C2\\u05C4\\u05C5\\u05C7\\u05D0-\\u05EA\\u05F0-\\u05F2\\u0610-\\u061A\\u0620-\\u0669\\u066E-\\u06D3\\u06D5-\\u06DC\\u06DF-\\u06E8\\u06EA-\\u06FC\\u06FF\\u0710-\\u074A\\u074D-\\u07B1\\u07C0-\\u07F5\\u07FA\\u0800-\\u082D\\u0840-\\u085B\\u08A0-\\u08B2\\u08E4-\\u0963\\u0966-\\u096F\\u0971-\\u0983\\u0985-\\u098C\\u098F\\u0990\\u0993-\\u09A8\\u09AA-\\u09B0\\u09B2\\u09B6-\\u09B9\\u09BC-\\u09C4\\u09C7\\u09C8\\u09CB-\\u09CE\\u09D7\\u09DC\\u09DD\\u09DF-\\u09E3\\u09E6-\\u09F1\\u0A01-\\u0A03\\u0A05-\\u0A0A\\u0A0F\\u0A10\\u0A13-\\u0A28\\u0A2A-\\u0A30\\u0A32\\u0A33\\u0A35\\u0A36\\u0A38\\u0A39\\u0A3C\\u0A3E-\\u0A42\\u0A47\\u0A48\\u0A4B-\\u0A4D\\u0A51\\u0A59-\\u0A5C\\u0A5E\\u0A66-\\u0A75\\u0A81-\\u0A83\\u0A85-\\u0A8D\\u0A8F-\\u0A91\\u0A93-\\u0AA8\\u0AAA-\\u0AB0\\u0AB2\\u0AB3\\u0AB5-\\u0AB9\\u0ABC-\\u0AC5\\u0AC7-\\u0AC9\\u0ACB-\\u0ACD\\u0AD0\\u0AE0-\\u0AE3\\u0AE6-\\u0AEF\\u0B01-\\u0B03\\u0B05-\\u0B0C\\u0B0F\\u0B10\\u0B13-\\u0B28\\u0B2A-\\u0B30\\u0B32\\u0B33\\u0B35-\\u0B39\\u0B3C-\\u0B44\\u0B47\\u0B48\\u0B4B-\\u0B4D\\u0B56\\u0B57\\u0B5C\\u0B5D\\u0B5F-\\u0B63\\u0B66-\\u0B6F\\u0B71\\u0B82\\u0B83\\u0B85-\\u0B8A\\u0B8E-\\u0B90\\u0B92-\\u0B95\\u0B99\\u0B9A\\u0B9C\\u0B9E\\u0B9F\\u0BA3\\u0BA4\\u0BA8-\\u0BAA\\u0BAE-\\u0BB9\\u0BBE-\\u0BC2\\u0BC6-\\u0BC8\\u0BCA-\\u0BCD\\u0BD0\\u0BD7\\u0BE6-\\u0BEF\\u0C00-\\u0C03\\u0C05-\\u0C0C\\u0C0E-\\u0C10\\u0C12-\\u0C28\\u0C2A-\\u0C39\\u0C3D-\\u0C44\\u0C46-\\u0C48\\u0C4A-\\u0C4D\\u0C55\\u0C56\\u0C58\\u0C59\\u0C60-\\u0C63\\u0C66-\\u0C6F\\u0C81-\\u0C83\\u0C85-\\u0C8C\\u0C8E-\\u0C90\\u0C92-\\u0CA8\\u0CAA-\\u0CB3\\u0CB5-\\u0CB9\\u0CBC-\\u0CC4\\u0CC6-\\u0CC8\\u0CCA-\\u0CCD\\u0CD5\\u0CD6\\u0CDE\\u0CE0-\\u0CE3\\u0CE6-\\u0CEF\\u0CF1\\u0CF2\\u0D01-\\u0D03\\u0D05-\\u0D0C\\u0D0E-\\u0D10\\u0D12-\\u0D3A\\u0D3D-\\u0D44\\u0D46-\\u0D48\\u0D4A-\\u0D4E\\u0D57\\u0D60-\\u0D63\\u0D66-\\u0D6F\\u0D7A-\\u0D7F\\u0D82\\u0D83\\u0D85-\\u0D96\\u0D9A-\\u0DB1\\u0DB3-\\u0DBB\\u0DBD\\u0DC0-\\u0DC6\\u0DCA\\u0DCF-\\u0DD4\\u0DD6\\u0DD8-\\u0DDF\\u0DE6-\\u0DEF\\u0DF2\\u0DF3\\u0E01-\\u0E3A\\u0E40-\\u0E4E\\u0E50-\\u0E59\\u0E81\\u0E82\\u0E84\\u0E87\\u0E88\\u0E8A\\u0E8D\\u0E94-\\u0E97\\u0E99-\\u0E9F\\u0EA1-\\u0EA3\\u0EA5\\u0EA7\\u0EAA\\u0EAB\\u0EAD-\\u0EB9\\u0EBB-\\u0EBD\\u0EC0-\\u0EC4\\u0EC6\\u0EC8-\\u0ECD\\u0ED0-\\u0ED9\\u0EDC-\\u0EDF\\u0F00\\u0F18\\u0F19\\u0F20-\\u0F29\\u0F35\\u0F37\\u0F39\\u0F3E-\\u0F47\\u0F49-\\u0F6C\\u0F71-\\u0F84\\u0F86-\\u0F97\\u0F99-\\u0FBC\\u0FC6\\u1000-\\u1049\\u1050-\\u109D\\u10A0-\\u10C5\\u10C7\\u10CD\\u10D0-\\u10FA\\u10FC-\\u1248\\u124A-\\u124D\\u1250-\\u1256\\u1258\\u125A-\\u125D\\u1260-\\u1288\\u128A-\\u128D\\u1290-\\u12B0\\u12B2-\\u12B5\\u12B8-\\u12BE\\u12C0\\u12C2-\\u12C5\\u12C8-\\u12D6\\u12D8-\\u1310\\u1312-\\u1315\\u1318-\\u135A\\u135D-\\u135F\\u1380-\\u138F\\u13A0-\\u13F4\\u1401-\\u166C\\u166F-\\u167F\\u1681-\\u169A\\u16A0-\\u16EA\\u16EE-\\u16F8\\u1700-\\u170C\\u170E-\\u1714\\u1720-\\u1734\\u1740-\\u1753\\u1760-\\u176C\\u176E-\\u1770\\u1772\\u1773\\u1780-\\u17D3\\u17D7\\u17DC\\u17DD\\u17E0-\\u17E9\\u180B-\\u180D\\u1810-\\u1819\\u1820-\\u1877\\u1880-\\u18AA\\u18B0-\\u18F5\\u1900-\\u191E\\u1920-\\u192B\\u1930-\\u193B\\u1946-\\u196D\\u1970-\\u1974\\u1980-\\u19AB\\u19B0-\\u19C9\\u19D0-\\u19D9\\u1A00-\\u1A1B\\u1A20-\\u1A5E\\u1A60-\\u1A7C\\u1A7F-\\u1A89\\u1A90-\\u1A99\\u1AA7\\u1AB0-\\u1ABD\\u1B00-\\u1B4B\\u1B50-\\u1B59\\u1B6B-\\u1B73\\u1B80-\\u1BF3\\u1C00-\\u1C37\\u1C40-\\u1C49\\u1C4D-\\u1C7D\\u1CD0-\\u1CD2\\u1CD4-\\u1CF6\\u1CF8\\u1CF9\\u1D00-\\u1DF5\\u1DFC-\\u1F15\\u1F18-\\u1F1D\\u1F20-\\u1F45\\u1F48-\\u1F4D\\u1F50-\\u1F57\\u1F59\\u1F5B\\u1F5D\\u1F5F-\\u1F7D\\u1F80-\\u1FB4\\u1FB6-\\u1FBC\\u1FBE\\u1FC2-\\u1FC4\\u1FC6-\\u1FCC\\u1FD0-\\u1FD3\\u1FD6-\\u1FDB\\u1FE0-\\u1FEC\\u1FF2-\\u1FF4\\u1FF6-\\u1FFC\\u200C\\u200D\\u203F\\u2040\\u2054\\u2071\\u207F\\u2090-\\u209C\\u20D0-\\u20DC\\u20E1\\u20E5-\\u20F0\\u2102\\u2107\\u210A-\\u2113\\u2115\\u2119-\\u211D\\u2124\\u2126\\u2128\\u212A-\\u212D\\u212F-\\u2139\\u213C-\\u213F\\u2145-\\u2149\\u214E\\u2160-\\u2188\\u2C00-\\u2C2E\\u2C30-\\u2C5E\\u2C60-\\u2CE4\\u2CEB-\\u2CF3\\u2D00-\\u2D25\\u2D27\\u2D2D\\u2D30-\\u2D67\\u2D6F\\u2D7F-\\u2D96\\u2DA0-\\u2DA6\\u2DA8-\\u2DAE\\u2DB0-\\u2DB6\\u2DB8-\\u2DBE\\u2DC0-\\u2DC6\\u2DC8-\\u2DCE\\u2DD0-\\u2DD6\\u2DD8-\\u2DDE\\u2DE0-\\u2DFF\\u2E2F\\u3005-\\u3007\\u3021-\\u302F\\u3031-\\u3035\\u3038-\\u303C\\u3041-\\u3096\\u3099\\u309A\\u309D-\\u309F\\u30A1-\\u30FA\\u30FC-\\u30FF\\u3105-\\u312D\\u3131-\\u318E\\u31A0-\\u31BA\\u31F0-\\u31FF\\u3400-\\u4DB5\\u4E00-\\u9FCC\\uA000-\\uA48C\\uA4D0-\\uA4FD\\uA500-\\uA60C\\uA610-\\uA62B\\uA640-\\uA66F\\uA674-\\uA67D\\uA67F-\\uA69D\\uA69F-\\uA6F1\\uA717-\\uA71F\\uA722-\\uA788\\uA78B-\\uA78E\\uA790-\\uA7AD\\uA7B0\\uA7B1\\uA7F7-\\uA827\\uA840-\\uA873\\uA880-\\uA8C4\\uA8D0-\\uA8D9\\uA8E0-\\uA8F7\\uA8FB\\uA900-\\uA92D\\uA930-\\uA953\\uA960-\\uA97C\\uA980-\\uA9C0\\uA9CF-\\uA9D9\\uA9E0-\\uA9FE\\uAA00-\\uAA36\\uAA40-\\uAA4D\\uAA50-\\uAA59\\uAA60-\\uAA76\\uAA7A-\\uAAC2\\uAADB-\\uAADD\\uAAE0-\\uAAEF\\uAAF2-\\uAAF6\\uAB01-\\uAB06\\uAB09-\\uAB0E\\uAB11-\\uAB16\\uAB20-\\uAB26\\uAB28-\\uAB2E\\uAB30-\\uAB5A\\uAB5C-\\uAB5F\\uAB64\\uAB65\\uABC0-\\uABEA\\uABEC\\uABED\\uABF0-\\uABF9\\uAC00-\\uD7A3\\uD7B0-\\uD7C6\\uD7CB-\\uD7FB\\uF900-\\uFA6D\\uFA70-\\uFAD9\\uFB00-\\uFB06\\uFB13-\\uFB17\\uFB1D-\\uFB28\\uFB2A-\\uFB36\\uFB38-\\uFB3C\\uFB3E\\uFB40\\uFB41\\uFB43\\uFB44\\uFB46-\\uFBB1\\uFBD3-\\uFD3D\\uFD50-\\uFD8F\\uFD92-\\uFDC7\\uFDF0-\\uFDFB\\uFE00-\\uFE0F\\uFE20-\\uFE2D\\uFE33\\uFE34\\uFE4D-\\uFE4F\\uFE70-\\uFE74\\uFE76-\\uFEFC\\uFF10-\\uFF19\\uFF21-\\uFF3A\\uFF3F\\uFF41-\\uFF5A\\uFF66-\\uFFBE\\uFFC2-\\uFFC7\\uFFCA-\\uFFCF\\uFFD2-\\uFFD7\\uFFDA-\\uFFDC]");// Ensure the condition is true, otherwise throw an error. +// This is only to have a better contract semantic, i.e. another safety net +// to catch a logic error. The condition shall be fulfilled in normal case. +// Do NOT use this to enforce a certain condition on any user input. +function assert(condition,message){/* istanbul ignore next */if(!condition){throw new Error('ASSERT: '+message);}}function isDecimalDigit(ch){return ch>=0x30&&ch<=0x39;// 0..9 +}function isHexDigit(ch){return'0123456789abcdefABCDEF'.includes(ch);}function isOctalDigit(ch){return'01234567'.includes(ch);}// 7.2 White Space +function isWhiteSpace(ch){return ch===0x20||ch===0x09||ch===0x0B||ch===0x0C||ch===0xA0||ch>=0x1680&&[0x1680,0x180E,0x2000,0x2001,0x2002,0x2003,0x2004,0x2005,0x2006,0x2007,0x2008,0x2009,0x200A,0x202F,0x205F,0x3000,0xFEFF].includes(ch);}// 7.3 Line Terminators +function isLineTerminator(ch){return ch===0x0A||ch===0x0D||ch===0x2028||ch===0x2029;}// 7.6 Identifier Names and Identifiers +function isIdentifierStart(ch){return ch===0x24||ch===0x5F||// $ (dollar) and _ (underscore) +ch>=0x41&&ch<=0x5A||// A..Z +ch>=0x61&&ch<=0x7A||// a..z +ch===0x5C||// \ (backslash) +ch>=0x80&&RegexNonAsciiIdentifierStart.test(String.fromCharCode(ch));}function isIdentifierPart(ch){return ch===0x24||ch===0x5F||// $ (dollar) and _ (underscore) +ch>=0x41&&ch<=0x5A||// A..Z +ch>=0x61&&ch<=0x7A||// a..z +ch>=0x30&&ch<=0x39||// 0..9 +ch===0x5C||// \ (backslash) +ch>=0x80&&RegexNonAsciiIdentifierPart.test(String.fromCharCode(ch));}// 7.6.1.1 Keywords +var keywords={'if':1,'in':1,'do':1,'var':1,'for':1,'new':1,'try':1,'let':1,'this':1,'else':1,'case':1,'void':1,'with':1,'enum':1,'while':1,'break':1,'catch':1,'throw':1,'const':1,'yield':1,'class':1,'super':1,'return':1,'typeof':1,'delete':1,'switch':1,'export':1,'import':1,'public':1,'static':1,'default':1,'finally':1,'extends':1,'package':1,'private':1,'function':1,'continue':1,'debugger':1,'interface':1,'protected':1,'instanceof':1,'implements':1};function skipComment(){while(index<length){var _ch=source.charCodeAt(index);if(isWhiteSpace(_ch)||isLineTerminator(_ch)){++index;}else{break;}}}function scanHexEscape(prefix){var i,len,ch,code=0;len=prefix==='u'?4:2;for(i=0;i<len;++i){if(index<length&&isHexDigit(source[index])){ch=source[index++];code=code*16+'0123456789abcdef'.indexOf(ch.toLowerCase());}else{throwError({},MessageUnexpectedToken,ILLEGAL$1);}}return String.fromCharCode(code);}function scanUnicodeCodePointEscape(){var ch,code,cu1,cu2;ch=source[index];code=0;// At least, one hex digit is required. +if(ch==='}'){throwError({},MessageUnexpectedToken,ILLEGAL$1);}while(index<length){ch=source[index++];if(!isHexDigit(ch)){break;}code=code*16+'0123456789abcdef'.indexOf(ch.toLowerCase());}if(code>0x10FFFF||ch!=='}'){throwError({},MessageUnexpectedToken,ILLEGAL$1);}// UTF-16 Encoding +if(code<=0xFFFF){return String.fromCharCode(code);}cu1=(code-0x10000>>10)+0xD800;cu2=(code-0x10000&1023)+0xDC00;return String.fromCharCode(cu1,cu2);}function getEscapedIdentifier(){var ch,id;ch=source.charCodeAt(index++);id=String.fromCharCode(ch);// '\u' (U+005C, U+0075) denotes an escaped character. +if(ch===0x5C){if(source.charCodeAt(index)!==0x75){throwError({},MessageUnexpectedToken,ILLEGAL$1);}++index;ch=scanHexEscape('u');if(!ch||ch==='\\'||!isIdentifierStart(ch.charCodeAt(0))){throwError({},MessageUnexpectedToken,ILLEGAL$1);}id=ch;}while(index<length){ch=source.charCodeAt(index);if(!isIdentifierPart(ch)){break;}++index;id+=String.fromCharCode(ch);// '\u' (U+005C, U+0075) denotes an escaped character. +if(ch===0x5C){id=id.substr(0,id.length-1);if(source.charCodeAt(index)!==0x75){throwError({},MessageUnexpectedToken,ILLEGAL$1);}++index;ch=scanHexEscape('u');if(!ch||ch==='\\'||!isIdentifierPart(ch.charCodeAt(0))){throwError({},MessageUnexpectedToken,ILLEGAL$1);}id+=ch;}}return id;}function getIdentifier(){var start,ch;start=index++;while(index<length){ch=source.charCodeAt(index);if(ch===0x5C){// Blackslash (U+005C) marks Unicode escape sequence. +index=start;return getEscapedIdentifier();}if(isIdentifierPart(ch)){++index;}else{break;}}return source.slice(start,index);}function scanIdentifier(){var start,id,type;start=index;// Backslash (U+005C) starts an escaped character. +id=source.charCodeAt(index)===0x5C?getEscapedIdentifier():getIdentifier();// There is no keyword or literal with only one character. +// Thus, it must be an identifier. +if(id.length===1){type=TokenIdentifier;}else if(keywords.hasOwnProperty(id)){// eslint-disable-line no-prototype-builtins +type=TokenKeyword;}else if(id==='null'){type=TokenNullLiteral;}else if(id==='true'||id==='false'){type=TokenBooleanLiteral;}else{type=TokenIdentifier;}return{type:type,value:id,start:start,end:index};}// 7.7 Punctuators +function scanPunctuator(){var start=index,code=source.charCodeAt(index),code2,ch1=source[index],ch2,ch3,ch4;switch(code){// Check for most common single-character punctuators. +case 0x2E:// . dot +case 0x28:// ( open bracket +case 0x29:// ) close bracket +case 0x3B:// ; semicolon +case 0x2C:// , comma +case 0x7B:// { open curly brace +case 0x7D:// } close curly brace +case 0x5B:// [ +case 0x5D:// ] +case 0x3A:// : +case 0x3F:// ? +case 0x7E:// ~ +++index;return{type:TokenPunctuator,value:String.fromCharCode(code),start:start,end:index};default:code2=source.charCodeAt(index+1);// '=' (U+003D) marks an assignment or comparison operator. +if(code2===0x3D){switch(code){case 0x2B:// + +case 0x2D:// - +case 0x2F:// / +case 0x3C:// < +case 0x3E:// > +case 0x5E:// ^ +case 0x7C:// | +case 0x25:// % +case 0x26:// & +case 0x2A:// * +index+=2;return{type:TokenPunctuator,value:String.fromCharCode(code)+String.fromCharCode(code2),start:start,end:index};case 0x21:// ! +case 0x3D:// = +index+=2;// !== and === +if(source.charCodeAt(index)===0x3D){++index;}return{type:TokenPunctuator,value:source.slice(start,index),start:start,end:index};}}}// 4-character punctuator: >>>= +ch4=source.substr(index,4);if(ch4==='>>>='){index+=4;return{type:TokenPunctuator,value:ch4,start:start,end:index};}// 3-character punctuators: === !== >>> <<= >>= +ch3=ch4.substr(0,3);if(ch3==='>>>'||ch3==='<<='||ch3==='>>='){index+=3;return{type:TokenPunctuator,value:ch3,start:start,end:index};}// Other 2-character punctuators: ++ -- << >> && || +ch2=ch3.substr(0,2);if(ch1===ch2[1]&&'+-<>&|'.includes(ch1)||ch2==='=>'){index+=2;return{type:TokenPunctuator,value:ch2,start:start,end:index};}if(ch2==='//'){throwError({},MessageUnexpectedToken,ILLEGAL$1);}// 1-character punctuators: < > = ! + - * % & | ^ / +if('<>=!+-*%&|^/'.includes(ch1)){++index;return{type:TokenPunctuator,value:ch1,start:start,end:index};}throwError({},MessageUnexpectedToken,ILLEGAL$1);}// 7.8.3 Numeric Literals +function scanHexLiteral(start){var number='';while(index<length){if(!isHexDigit(source[index])){break;}number+=source[index++];}if(number.length===0){throwError({},MessageUnexpectedToken,ILLEGAL$1);}if(isIdentifierStart(source.charCodeAt(index))){throwError({},MessageUnexpectedToken,ILLEGAL$1);}return{type:TokenNumericLiteral,value:parseInt('0x'+number,16),start:start,end:index};}function scanOctalLiteral(start){var number='0'+source[index++];while(index<length){if(!isOctalDigit(source[index])){break;}number+=source[index++];}if(isIdentifierStart(source.charCodeAt(index))||isDecimalDigit(source.charCodeAt(index))){throwError({},MessageUnexpectedToken,ILLEGAL$1);}return{type:TokenNumericLiteral,value:parseInt(number,8),octal:true,start:start,end:index};}function scanNumericLiteral(){var number,start,ch;ch=source[index];assert(isDecimalDigit(ch.charCodeAt(0))||ch==='.','Numeric literal must start with a decimal digit or a decimal point');start=index;number='';if(ch!=='.'){number=source[index++];ch=source[index];// Hex number starts with '0x'. +// Octal number starts with '0'. +if(number==='0'){if(ch==='x'||ch==='X'){++index;return scanHexLiteral(start);}if(isOctalDigit(ch)){return scanOctalLiteral(start);}// decimal number starts with '0' such as '09' is illegal. +if(ch&&isDecimalDigit(ch.charCodeAt(0))){throwError({},MessageUnexpectedToken,ILLEGAL$1);}}while(isDecimalDigit(source.charCodeAt(index))){number+=source[index++];}ch=source[index];}if(ch==='.'){number+=source[index++];while(isDecimalDigit(source.charCodeAt(index))){number+=source[index++];}ch=source[index];}if(ch==='e'||ch==='E'){number+=source[index++];ch=source[index];if(ch==='+'||ch==='-'){number+=source[index++];}if(isDecimalDigit(source.charCodeAt(index))){while(isDecimalDigit(source.charCodeAt(index))){number+=source[index++];}}else{throwError({},MessageUnexpectedToken,ILLEGAL$1);}}if(isIdentifierStart(source.charCodeAt(index))){throwError({},MessageUnexpectedToken,ILLEGAL$1);}return{type:TokenNumericLiteral,value:parseFloat(number),start:start,end:index};}// 7.8.4 String Literals +function scanStringLiteral(){var str='',quote,start,ch,code,octal=false;quote=source[index];assert(quote==='\''||quote==='"','String literal must starts with a quote');start=index;++index;while(index<length){ch=source[index++];if(ch===quote){quote='';break;}else if(ch==='\\'){ch=source[index++];if(!ch||!isLineTerminator(ch.charCodeAt(0))){switch(ch){case'u':case'x':if(source[index]==='{'){++index;str+=scanUnicodeCodePointEscape();}else{str+=scanHexEscape(ch);}break;case'n':str+='\n';break;case'r':str+='\r';break;case't':str+='\t';break;case'b':str+='\b';break;case'f':str+='\f';break;case'v':str+='\x0B';break;default:if(isOctalDigit(ch)){code='01234567'.indexOf(ch);// \0 is not octal escape sequence +if(code!==0){octal=true;}if(index<length&&isOctalDigit(source[index])){octal=true;code=code*8+'01234567'.indexOf(source[index++]);// 3 digits are only allowed when string starts +// with 0, 1, 2, 3 +if('0123'.includes(ch)&&index<length&&isOctalDigit(source[index])){code=code*8+'01234567'.indexOf(source[index++]);}}str+=String.fromCharCode(code);}else{str+=ch;}break;}}else{if(ch==='\r'&&source[index]==='\n'){++index;}}}else if(isLineTerminator(ch.charCodeAt(0))){break;}else{str+=ch;}}if(quote!==''){throwError({},MessageUnexpectedToken,ILLEGAL$1);}return{type:TokenStringLiteral,value:str,octal:octal,start:start,end:index};}function testRegExp(pattern,flags){var tmp=pattern;if(flags.includes('u')){// Replace each astral symbol and every Unicode code point +// escape sequence with a single ASCII symbol to avoid throwing on +// regular expressions that are only valid in combination with the +// `/u` flag. +// Note: replacing with the ASCII symbol `x` might cause false +// negatives in unlikely scenarios. For example, `[\u{61}-b]` is a +// perfectly valid pattern that is equivalent to `[a-b]`, but it +// would be replaced by `[x-b]` which throws an error. +tmp=tmp.replace(/\\u\{([0-9a-fA-F]+)\}/g,function($0,$1){if(parseInt($1,16)<=0x10FFFF){return'x';}throwError({},MessageInvalidRegExp);}).replace(/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,'x');}// First, detect invalid regular expressions. +try{new RegExp(tmp);}catch(e){throwError({},MessageInvalidRegExp);}// Return a regular expression object for this pattern-flag pair, or +// `null` in case the current environment doesn't support the flags it +// uses. +try{return new RegExp(pattern,flags);}catch(exception){return null;}}function scanRegExpBody(){var ch,str,classMarker,terminated,body;ch=source[index];assert(ch==='/','Regular expression literal must start with a slash');str=source[index++];classMarker=false;terminated=false;while(index<length){ch=source[index++];str+=ch;if(ch==='\\'){ch=source[index++];// ECMA-262 7.8.5 +if(isLineTerminator(ch.charCodeAt(0))){throwError({},MessageUnterminatedRegExp);}str+=ch;}else if(isLineTerminator(ch.charCodeAt(0))){throwError({},MessageUnterminatedRegExp);}else if(classMarker){if(ch===']'){classMarker=false;}}else{if(ch==='/'){terminated=true;break;}else if(ch==='['){classMarker=true;}}}if(!terminated){throwError({},MessageUnterminatedRegExp);}// Exclude leading and trailing slash. +body=str.substr(1,str.length-2);return{value:body,literal:str};}function scanRegExpFlags(){var ch,str,flags;str='';flags='';while(index<length){ch=source[index];if(!isIdentifierPart(ch.charCodeAt(0))){break;}++index;if(ch==='\\'&&index<length){throwError({},MessageUnexpectedToken,ILLEGAL$1);}else{flags+=ch;str+=ch;}}if(flags.search(/[^gimuy]/g)>=0){throwError({},MessageInvalidRegExp,flags);}return{value:flags,literal:str};}function scanRegExp(){var start,body,flags,value;lookahead=null;skipComment();start=index;body=scanRegExpBody();flags=scanRegExpFlags();value=testRegExp(body.value,flags.value);return{literal:body.literal+flags.literal,value:value,regex:{pattern:body.value,flags:flags.value},start:start,end:index};}function isIdentifierName(token){return token.type===TokenIdentifier||token.type===TokenKeyword||token.type===TokenBooleanLiteral||token.type===TokenNullLiteral;}function advance(){skipComment();if(index>=length){return{type:TokenEOF,start:index,end:index};}var ch=source.charCodeAt(index);if(isIdentifierStart(ch)){return scanIdentifier();}// Very common: ( and ) and ; +if(ch===0x28||ch===0x29||ch===0x3B){return scanPunctuator();}// String literal starts with single quote (U+0027) or double quote (U+0022). +if(ch===0x27||ch===0x22){return scanStringLiteral();}// Dot (.) U+002E can also start a floating-point number, hence the need +// to check the next character. +if(ch===0x2E){if(isDecimalDigit(source.charCodeAt(index+1))){return scanNumericLiteral();}return scanPunctuator();}if(isDecimalDigit(ch)){return scanNumericLiteral();}return scanPunctuator();}function lex(){var token=lookahead;index=token.end;lookahead=advance();index=token.end;return token;}function peek(){var pos=index;lookahead=advance();index=pos;}function finishArrayExpression(elements){var node=new ASTNode(SyntaxArrayExpression);node.elements=elements;return node;}function finishBinaryExpression(operator,left,right){var node=new ASTNode(operator==='||'||operator==='&&'?SyntaxLogicalExpression:SyntaxBinaryExpression);node.operator=operator;node.left=left;node.right=right;return node;}function finishCallExpression(callee,args){var node=new ASTNode(SyntaxCallExpression);node.callee=callee;node.arguments=args;return node;}function finishConditionalExpression(test,consequent,alternate){var node=new ASTNode(SyntaxConditionalExpression);node.test=test;node.consequent=consequent;node.alternate=alternate;return node;}function finishIdentifier(name){var node=new ASTNode(SyntaxIdentifier);node.name=name;return node;}function finishLiteral(token){var node=new ASTNode(SyntaxLiteral);node.value=token.value;node.raw=source.slice(token.start,token.end);if(token.regex){if(node.raw==='//'){node.raw='/(?:)/';}node.regex=token.regex;}return node;}function finishMemberExpression(accessor,object,property){var node=new ASTNode(SyntaxMemberExpression);node.computed=accessor==='[';node.object=object;node.property=property;if(!node.computed)property.member=true;return node;}function finishObjectExpression(properties){var node=new ASTNode(SyntaxObjectExpression);node.properties=properties;return node;}function finishProperty(kind,key,value){var node=new ASTNode(SyntaxProperty);node.key=key;node.value=value;node.kind=kind;return node;}function finishUnaryExpression(operator,argument){var node=new ASTNode(SyntaxUnaryExpression);node.operator=operator;node.argument=argument;node.prefix=true;return node;}// Throw an exception +function throwError(token,messageFormat){var error,args=Array.prototype.slice.call(arguments,2),msg=messageFormat.replace(/%(\d)/g,function(whole,index){assert(index<args.length,'Message reference must be in range');return args[index];});error=new Error(msg);error.index=index;error.description=msg;throw error;}// Throw an exception because of the token. +function throwUnexpected(token){if(token.type===TokenEOF){throwError(token,MessageUnexpectedEOS);}if(token.type===TokenNumericLiteral){throwError(token,MessageUnexpectedNumber);}if(token.type===TokenStringLiteral){throwError(token,MessageUnexpectedString);}if(token.type===TokenIdentifier){throwError(token,MessageUnexpectedIdentifier);}if(token.type===TokenKeyword){throwError(token,MessageUnexpectedReserved);}// BooleanLiteral, NullLiteral, or Punctuator. +throwError(token,MessageUnexpectedToken,token.value);}// Expect the next token to match the specified punctuator. +// If not, an exception will be thrown. +function expect(value){var token=lex();if(token.type!==TokenPunctuator||token.value!==value){throwUnexpected(token);}}// Return true if the next token matches the specified punctuator. +function match(value){return lookahead.type===TokenPunctuator&&lookahead.value===value;}// Return true if the next token matches the specified keyword +function matchKeyword(keyword){return lookahead.type===TokenKeyword&&lookahead.value===keyword;}// 11.1.4 Array Initialiser +function parseArrayInitialiser(){var elements=[];index=lookahead.start;expect('[');while(!match(']')){if(match(',')){lex();elements.push(null);}else{elements.push(parseConditionalExpression());if(!match(']')){expect(',');}}}lex();return finishArrayExpression(elements);}// 11.1.5 Object Initialiser +function parseObjectPropertyKey(){index=lookahead.start;var token=lex();// Note: This function is called only from parseObjectProperty(), where +// EOF and Punctuator tokens are already filtered out. +if(token.type===TokenStringLiteral||token.type===TokenNumericLiteral){if(token.octal){throwError(token,MessageStrictOctalLiteral);}return finishLiteral(token);}return finishIdentifier(token.value);}function parseObjectProperty(){var token,key,id,value;index=lookahead.start;token=lookahead;if(token.type===TokenIdentifier){id=parseObjectPropertyKey();expect(':');value=parseConditionalExpression();return finishProperty('init',id,value);}if(token.type===TokenEOF||token.type===TokenPunctuator){throwUnexpected(token);}else{key=parseObjectPropertyKey();expect(':');value=parseConditionalExpression();return finishProperty('init',key,value);}}function parseObjectInitialiser(){var properties=[],property,name,key,map={},toString=String;index=lookahead.start;expect('{');while(!match('}')){property=parseObjectProperty();if(property.key.type===SyntaxIdentifier){name=property.key.name;}else{name=toString(property.key.value);}key='$'+name;if(Object.prototype.hasOwnProperty.call(map,key)){throwError({},MessageStrictDuplicateProperty);}else{map[key]=true;}properties.push(property);if(!match('}')){expect(',');}}expect('}');return finishObjectExpression(properties);}// 11.1.6 The Grouping Operator +function parseGroupExpression(){expect('(');var expr=parseExpression();expect(')');return expr;}// 11.1 Primary Expressions +var legalKeywords={'if':1};function parsePrimaryExpression(){var type,token,expr;if(match('(')){return parseGroupExpression();}if(match('[')){return parseArrayInitialiser();}if(match('{')){return parseObjectInitialiser();}type=lookahead.type;index=lookahead.start;if(type===TokenIdentifier||legalKeywords[lookahead.value]){expr=finishIdentifier(lex().value);}else if(type===TokenStringLiteral||type===TokenNumericLiteral){if(lookahead.octal){throwError(lookahead,MessageStrictOctalLiteral);}expr=finishLiteral(lex());}else if(type===TokenKeyword){throw new Error(DISABLED);}else if(type===TokenBooleanLiteral){token=lex();token.value=token.value==='true';expr=finishLiteral(token);}else if(type===TokenNullLiteral){token=lex();token.value=null;expr=finishLiteral(token);}else if(match('/')||match('/=')){expr=finishLiteral(scanRegExp());peek();}else{throwUnexpected(lex());}return expr;}// 11.2 Left-Hand-Side Expressions +function parseArguments(){var args=[];expect('(');if(!match(')')){while(index<length){args.push(parseConditionalExpression());if(match(')')){break;}expect(',');}}expect(')');return args;}function parseNonComputedProperty(){index=lookahead.start;var token=lex();if(!isIdentifierName(token)){throwUnexpected(token);}return finishIdentifier(token.value);}function parseNonComputedMember(){expect('.');return parseNonComputedProperty();}function parseComputedMember(){expect('[');var expr=parseExpression();expect(']');return expr;}function parseLeftHandSideExpressionAllowCall(){var expr,args,property;expr=parsePrimaryExpression();for(;;){if(match('.')){property=parseNonComputedMember();expr=finishMemberExpression('.',expr,property);}else if(match('(')){args=parseArguments();expr=finishCallExpression(expr,args);}else if(match('[')){property=parseComputedMember();expr=finishMemberExpression('[',expr,property);}else{break;}}return expr;}// 11.3 Postfix Expressions +function parsePostfixExpression(){var expr=parseLeftHandSideExpressionAllowCall();if(lookahead.type===TokenPunctuator){if(match('++')||match('--')){throw new Error(DISABLED);}}return expr;}// 11.4 Unary Operators +function parseUnaryExpression(){var token,expr;if(lookahead.type!==TokenPunctuator&&lookahead.type!==TokenKeyword){expr=parsePostfixExpression();}else if(match('++')||match('--')){throw new Error(DISABLED);}else if(match('+')||match('-')||match('~')||match('!')){token=lex();expr=parseUnaryExpression();expr=finishUnaryExpression(token.value,expr);}else if(matchKeyword('delete')||matchKeyword('void')||matchKeyword('typeof')){throw new Error(DISABLED);}else{expr=parsePostfixExpression();}return expr;}function binaryPrecedence(token){var prec=0;if(token.type!==TokenPunctuator&&token.type!==TokenKeyword){return 0;}switch(token.value){case'||':prec=1;break;case'&&':prec=2;break;case'|':prec=3;break;case'^':prec=4;break;case'&':prec=5;break;case'==':case'!=':case'===':case'!==':prec=6;break;case'<':case'>':case'<=':case'>=':case'instanceof':case'in':prec=7;break;case'<<':case'>>':case'>>>':prec=8;break;case'+':case'-':prec=9;break;case'*':case'/':case'%':prec=11;break;}return prec;}// 11.5 Multiplicative Operators +// 11.6 Additive Operators +// 11.7 Bitwise Shift Operators +// 11.8 Relational Operators +// 11.9 Equality Operators +// 11.10 Binary Bitwise Operators +// 11.11 Binary Logical Operators +function parseBinaryExpression(){var marker,markers,expr,token,prec,stack,right,operator,left,i;marker=lookahead;left=parseUnaryExpression();token=lookahead;prec=binaryPrecedence(token);if(prec===0){return left;}token.prec=prec;lex();markers=[marker,lookahead];right=parseUnaryExpression();stack=[left,token,right];while((prec=binaryPrecedence(lookahead))>0){// Reduce: make a binary expression from the three topmost entries. +while(stack.length>2&&prec<=stack[stack.length-2].prec){right=stack.pop();operator=stack.pop().value;left=stack.pop();markers.pop();expr=finishBinaryExpression(operator,left,right);stack.push(expr);}// Shift. +token=lex();token.prec=prec;stack.push(token);markers.push(lookahead);expr=parseUnaryExpression();stack.push(expr);}// Final reduce to clean-up the stack. +i=stack.length-1;expr=stack[i];markers.pop();while(i>1){markers.pop();expr=finishBinaryExpression(stack[i-1].value,stack[i-2],expr);i-=2;}return expr;}// 11.12 Conditional Operator +function parseConditionalExpression(){var expr,consequent,alternate;expr=parseBinaryExpression();if(match('?')){lex();consequent=parseConditionalExpression();expect(':');alternate=parseConditionalExpression();expr=finishConditionalExpression(expr,consequent,alternate);}return expr;}// 11.14 Comma Operator +function parseExpression(){var expr=parseConditionalExpression();if(match(',')){throw new Error(DISABLED);// no sequence expressions +}return expr;}function parser$1(code){source=code;index=0;length=source.length;lookahead=null;peek();var expr=parseExpression();if(lookahead.type!==TokenEOF){throw new Error('Unexpect token after expression.');}return expr;}var Constants={NaN:'NaN',E:'Math.E',LN2:'Math.LN2',LN10:'Math.LN10',LOG2E:'Math.LOG2E',LOG10E:'Math.LOG10E',PI:'Math.PI',SQRT1_2:'Math.SQRT1_2',SQRT2:'Math.SQRT2',MIN_VALUE:'Number.MIN_VALUE',MAX_VALUE:'Number.MAX_VALUE'};function Functions(codegen){function fncall(name,args,cast,type){var obj=codegen(args[0]);if(cast){obj=cast+'('+obj+')';if(cast.lastIndexOf('new ',0)===0)obj='('+obj+')';}return obj+'.'+name+(type<0?'':type===0?'()':'('+args.slice(1).map(codegen).join(',')+')');}function fn(name,cast,type){return function(args){return fncall(name,args,cast,type);};}var DATE='new Date',STRING='String',REGEXP='RegExp';return{// MATH functions +isNaN:'Number.isNaN',isFinite:'Number.isFinite',abs:'Math.abs',acos:'Math.acos',asin:'Math.asin',atan:'Math.atan',atan2:'Math.atan2',ceil:'Math.ceil',cos:'Math.cos',exp:'Math.exp',floor:'Math.floor',hypot:'Math.hypot',log:'Math.log',max:'Math.max',min:'Math.min',pow:'Math.pow',random:'Math.random',round:'Math.round',sin:'Math.sin',sqrt:'Math.sqrt',tan:'Math.tan',clamp:function clamp(args){if(args.length<3)error('Missing arguments to clamp function.');if(args.length>3)error('Too many arguments to clamp function.');var a=args.map(codegen);return'Math.max('+a[1]+', Math.min('+a[2]+','+a[0]+'))';},// DATE functions +now:'Date.now',utc:'Date.UTC',datetime:DATE,date:fn('getDate',DATE,0),day:fn('getDay',DATE,0),year:fn('getFullYear',DATE,0),month:fn('getMonth',DATE,0),hours:fn('getHours',DATE,0),minutes:fn('getMinutes',DATE,0),seconds:fn('getSeconds',DATE,0),milliseconds:fn('getMilliseconds',DATE,0),time:fn('getTime',DATE,0),timezoneoffset:fn('getTimezoneOffset',DATE,0),utcdate:fn('getUTCDate',DATE,0),utcday:fn('getUTCDay',DATE,0),utcyear:fn('getUTCFullYear',DATE,0),utcmonth:fn('getUTCMonth',DATE,0),utchours:fn('getUTCHours',DATE,0),utcminutes:fn('getUTCMinutes',DATE,0),utcseconds:fn('getUTCSeconds',DATE,0),utcmilliseconds:fn('getUTCMilliseconds',DATE,0),// sequence functions +length:fn('length',null,-1),// STRING functions +parseFloat:'parseFloat',parseInt:'parseInt',upper:fn('toUpperCase',STRING,0),lower:fn('toLowerCase',STRING,0),substring:fn('substring',STRING),split:fn('split',STRING),trim:fn('trim',STRING,0),// base64 encode/decode +btoa:'btoa',atob:'atob',// REGEXP functions +regexp:REGEXP,test:fn('test',REGEXP),// Control Flow functions +"if":function _if(args){if(args.length<3)error('Missing arguments to if function.');if(args.length>3)error('Too many arguments to if function.');var a=args.map(codegen);return'('+a[0]+'?'+a[1]+':'+a[2]+')';}};}function stripQuotes(s){var n=s&&s.length-1;return n&&(s[0]==='"'&&s[n]==='"'||s[0]==='\''&&s[n]==='\'')?s.slice(1,-1):s;}function codegen(opt){opt=opt||{};var allowed=opt.allowed?toSet(opt.allowed):{},forbidden=opt.forbidden?toSet(opt.forbidden):{},constants=opt.constants||Constants,functions=(opt.functions||Functions)(visit),globalvar=opt.globalvar,fieldvar=opt.fieldvar,outputGlobal=isFunction(globalvar)?globalvar:function(id){return"".concat(globalvar,"[\"").concat(id,"\"]");};var globals={},fields={},memberDepth=0;function visit(ast){if(isString(ast))return ast;var generator=Generators[ast.type];if(generator==null)error('Unsupported type: '+ast.type);return generator(ast);}var Generators={Literal:function Literal(n){return n.raw;},Identifier:function Identifier(n){var id=n.name;if(memberDepth>0){return id;}else if(has$1(forbidden,id)){return error('Illegal identifier: '+id);}else if(has$1(constants,id)){return constants[id];}else if(has$1(allowed,id)){return id;}else{globals[id]=1;return outputGlobal(id);}},MemberExpression:function MemberExpression(n){var d=!n.computed,o=visit(n.object);if(d)memberDepth+=1;var p=visit(n.property);if(o===fieldvar){// strip quotes to sanitize field name (#1653) +fields[stripQuotes(p)]=1;}if(d)memberDepth-=1;return o+(d?'.'+p:'['+p+']');},CallExpression:function CallExpression(n){if(n.callee.type!=='Identifier'){error('Illegal callee type: '+n.callee.type);}var callee=n.callee.name,args=n.arguments,fn=has$1(functions,callee)&&functions[callee];if(!fn)error('Unrecognized function: '+callee);return isFunction(fn)?fn(args):fn+'('+args.map(visit).join(',')+')';},ArrayExpression:function ArrayExpression(n){return'['+n.elements.map(visit).join(',')+']';},BinaryExpression:function BinaryExpression(n){return'('+visit(n.left)+' '+n.operator+' '+visit(n.right)+')';},UnaryExpression:function UnaryExpression(n){return'('+n.operator+visit(n.argument)+')';},ConditionalExpression:function ConditionalExpression(n){return'('+visit(n.test)+'?'+visit(n.consequent)+':'+visit(n.alternate)+')';},LogicalExpression:function LogicalExpression(n){return'('+visit(n.left)+n.operator+visit(n.right)+')';},ObjectExpression:function ObjectExpression(n){return'{'+n.properties.map(visit).join(',')+'}';},Property:function Property(n){memberDepth+=1;var k=visit(n.key);memberDepth-=1;return k+':'+visit(n.value);}};function codegen(ast){var result={code:visit(ast),globals:Object.keys(globals),fields:Object.keys(fields)};globals={};fields={};return result;}codegen.functions=functions;codegen.constants=constants;return codegen;}// Registers vega-util field accessors to protect against XSS attacks +var SELECTION_GETTER=Symbol('vega_selection_getter');function getter(f){if(!f.getter||!f.getter[SELECTION_GETTER]){f.getter=field$1(f.field);f.getter[SELECTION_GETTER]=true;}return f.getter;}var Intersect='intersect';var Union='union';var VlMulti='vlMulti';var VlPoint='vlPoint';var Or='or';var And='and';var SelectionId='_vgsid_';var $selectionId=field$1(SelectionId);var TYPE_ENUM='E',TYPE_RANGE_INC='R',TYPE_RANGE_EXC='R-E',TYPE_RANGE_LE='R-LE',TYPE_RANGE_RE='R-RE',TYPE_PRED_LT='E-LT',TYPE_PRED_LTE='E-LTE',TYPE_PRED_GT='E-GT',TYPE_PRED_GTE='E-GTE',TYPE_PRED_VALID='E-VALID',TYPE_PRED_ONE_OF='E-ONE',UNIT_INDEX='index:unit';// TODO: revisit date coercion? +function testPoint(datum,entry){var fields=entry.fields,values=entry.values,n=fields.length,i=0,dval,f;for(;i<n;++i){f=fields[i];dval=getter(f)(datum);if(isDate$1(dval))dval=toNumber(dval);if(isDate$1(values[i]))values[i]=toNumber(values[i]);if(isArray(values[i])&&isDate$1(values[i][0]))values[i]=values[i].map(toNumber);if(f.type===TYPE_ENUM){// Enumerated fields can either specify individual values (single/multi selections) +// or an array of values (interval selections). +if(isArray(values[i])?!values[i].includes(dval):dval!==values[i]){return false;}}else{if(f.type===TYPE_RANGE_INC){if(!inrange(dval,values[i]))return false;}else if(f.type===TYPE_RANGE_RE){// Discrete selection of bins test within the range [bin_start, bin_end). +if(!inrange(dval,values[i],true,false))return false;}else if(f.type===TYPE_RANGE_EXC){// 'R-E'/'R-LE' included for completeness. +if(!inrange(dval,values[i],false,false))return false;}else if(f.type===TYPE_RANGE_LE){if(!inrange(dval,values[i],false,true))return false;}else if(f.type===TYPE_PRED_LT){if(dval>=values[i])return false;}else if(f.type===TYPE_PRED_LTE){if(dval>values[i])return false;}else if(f.type===TYPE_PRED_GT){if(dval<=values[i])return false;}else if(f.type===TYPE_PRED_GTE){if(dval<values[i])return false;}else if(f.type===TYPE_PRED_VALID){if(dval===null||isNaN(dval))return false;}else if(f.type===TYPE_PRED_ONE_OF){if(values[i].indexOf(dval)===-1)return false;}}}return true;}/** + * Tests if a tuple is contained within an interactive selection. + * @param {string} name - The name of the data set representing the selection. + * Tuples in the dataset are of the form + * {unit: string, fields: array<fielddef>, values: array<*>}. + * Fielddef is of the form + * {field: string, channel: string, type: 'E' | 'R'} where + * 'type' identifies whether tuples in the dataset enumerate + * values for the field, or specify a continuous range. + * @param {object} datum - The tuple to test for inclusion. + * @param {string} op - The set operation for combining selections. + * One of 'intersect' or 'union' (default). + * @return {boolean} - True if the datum is in the selection, false otherwise. + */function selectionTest(name,datum,op){var data=this.context.data[name],entries=data?data.values.value:[],unitIdx=data?data[UNIT_INDEX]&&data[UNIT_INDEX].value:undefined,intersect=op===Intersect,n=entries.length,i=0,entry,miss,count,unit,b;for(;i<n;++i){entry=entries[i];if(unitIdx&&intersect){// multi selections union within the same unit and intersect across units. +miss=miss||{};count=miss[unit=entry.unit]||0;// if we've already matched this unit, skip. +if(count===-1)continue;b=testPoint(datum,entry);miss[unit]=b?-1:++count;// if we match and there are no other units return true +// if we've missed against all tuples in this unit return false +if(b&&unitIdx.size===1)return true;if(!b&&count===unitIdx.get(unit).count)return false;}else{b=testPoint(datum,entry);// if we find a miss and we do require intersection return false +// if we find a match and we don't require intersection return true +if(intersect^b)return b;}}// if intersecting and we made it here, then we saw no misses +// if not intersecting, then we saw no matches +// if no active selections, return false +return n&&intersect;}var bisect=bisector($selectionId),bisectLeft=bisect.left,bisectRight=bisect.right;function selectionIdTest(name,datum,op){var data=this.context.data[name],entries=data?data.values.value:[],unitIdx=data?data[UNIT_INDEX]&&data[UNIT_INDEX].value:undefined,intersect=op===Intersect,value=$selectionId(datum),index=bisectLeft(entries,value);if(index===entries.length)return false;if($selectionId(entries[index])!==value)return false;if(unitIdx&&intersect){if(unitIdx.size===1)return true;if(bisectRight(entries,value)-index<unitIdx.size)return false;}return true;}/** + * Maps an array of scene graph items to an array of selection tuples. + * @param {string} name - The name of the dataset representing the selection. + * @param {string} base - The base object that generated tuples extend. + * + * @returns {array} An array of selection entries for the given unit. + */function selectionTuples(array,base){return array.map(function(x){return extend$1(base.fields?{values:base.fields.map(function(f){return getter(f)(x.datum);})}:_defineProperty({},SelectionId,$selectionId(x.datum)),base);});}/** + * Resolves selection for use as a scale domain or reads via the API. + * @param {string} name - The name of the dataset representing the selection + * @param {string} [op='union'] - The set operation for combining selections. + * One of 'intersect' or 'union' (default). + * @param {boolean} isMulti - Identifies a "multi" selection to perform more + * expensive resolution computation. + * @param {boolean} vl5 - With Vega-Lite v5, "multi" selections are now called "point" + * selections, and thus the resolved tuple should reflect this name. + * This parameter allows us to reflect this change without triggering + * a major version bump for Vega. + * @returns {object} An object of selected fields and values. + */function selectionResolve(name,op,isMulti,vl5){var data=this.context.data[name],entries=data?data.values.value:[],resolved={},multiRes={},types={},entry,fields,values,unit,field,value,res,resUnit,type,union,n=entries.length,i=0,j,m;// First union all entries within the same unit. +for(;i<n;++i){entry=entries[i];unit=entry.unit;fields=entry.fields;values=entry.values;if(fields&&values){// Intentional selection stores +for(j=0,m=fields.length;j<m;++j){field=fields[j];res=resolved[field.field]||(resolved[field.field]={});resUnit=res[unit]||(res[unit]=[]);types[field.field]=type=field.type.charAt(0);union=ops["".concat(type,"_union")];res[unit]=union(resUnit,array$5(values[j]));}// If the same multi-selection is repeated over views and projected over +// an encoding, it may operate over different fields making it especially +// tricky to reliably resolve it. At best, we can de-dupe identical entries +// but doing so may be more computationally expensive than it is worth. +// Instead, for now, we simply transform our store representation into +// a more human-friendly one. +if(isMulti){resUnit=multiRes[unit]||(multiRes[unit]=[]);resUnit.push(array$5(values).reduce(function(obj,curr,j){return obj[fields[j].field]=curr,obj;},{}));}}else{// Short circuit extensional selectionId stores which hold sorted IDs unique to each unit. +field=SelectionId;value=$selectionId(entry);res=resolved[field]||(resolved[field]={});resUnit=res[unit]||(res[unit]=[]);resUnit.push(value);if(isMulti){resUnit=multiRes[unit]||(multiRes[unit]=[]);resUnit.push(_defineProperty({},SelectionId,value));}}}// Then resolve fields across units as per the op. +op=op||Union;if(resolved[SelectionId]){resolved[SelectionId]=ops["".concat(SelectionId,"_").concat(op)].apply(ops,_toConsumableArray(Object.values(resolved[SelectionId])));}else{Object.keys(resolved).forEach(function(field){resolved[field]=Object.keys(resolved[field]).map(function(unit){return resolved[field][unit];}).reduce(function(acc,curr){return acc===undefined?curr:ops["".concat(types[field],"_").concat(op)](acc,curr);});});}entries=Object.keys(multiRes);if(isMulti&&entries.length){var _key17=vl5?VlPoint:VlMulti;resolved[_key17]=op===Union?_defineProperty({},Or,entries.reduce(function(acc,k){return acc.push.apply(acc,_toConsumableArray(multiRes[k])),acc;},[])):_defineProperty({},And,entries.map(function(k){return _defineProperty({},Or,multiRes[k]);}));}return resolved;}var ops=_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({},"".concat(SelectionId,"_union"),union),"".concat(SelectionId,"_intersect"),intersection),"E_union",function E_union(base,value){if(!base.length)return value;var i=0,n=value.length;for(;i<n;++i)if(!base.includes(value[i]))base.push(value[i]);return base;}),"E_intersect",function E_intersect(base,value){return!base.length?value:base.filter(function(v){return value.includes(v);});}),"R_union",function R_union(base,value){var lo=toNumber(value[0]),hi=toNumber(value[1]);if(lo>hi){lo=value[1];hi=value[0];}if(!base.length)return[lo,hi];if(base[0]>lo)base[0]=lo;if(base[1]<hi)base[1]=hi;return base;}),"R_intersect",function R_intersect(base,value){var lo=toNumber(value[0]),hi=toNumber(value[1]);if(lo>hi){lo=value[1];hi=value[0];}if(!base.length)return[lo,hi];if(hi<base[0]||base[1]<lo){return[];}else{if(base[0]<lo)base[0]=lo;if(base[1]>hi)base[1]=hi;}return base;});var DataPrefix$1=':',IndexPrefix$1='@';function selectionVisitor(name,args,scope,params){if(args[0].type!==Literal)error('First argument to selection functions must be a string literal.');var data=args[0].value,op=args.length>=2&&peek$1(args).value,field='unit',indexName=IndexPrefix$1+field,dataName=DataPrefix$1+data;if(op===Intersect&&!has$1(params,indexName)){params[indexName]=scope.getData(data).indataRef(scope,field);}if(!has$1(params,dataName)){params[dataName]=scope.getData(data).tuplesRef();}}function data$1(name){var data=this.context.data[name];return data?data.values.value:[];}function indata(name,field,value){var index=this.context.data[name]['index:'+field],entry=index?index.value.get(value):undefined;return entry?entry.count:entry;}function setdata(name,tuples){var df=this.context.dataflow,data=this.context.data[name],input=data.input;df.pulse(input,df.changeset().remove(truthy).insert(tuples));return 1;}function encode(item,name,retval){if(item){var df=this.context.dataflow,_target=item.mark.source;df.pulse(_target,df.changeset().encode(item,name));}return retval!==undefined?retval:item;}var wrap=function wrap(method){return function(value,spec){var locale=this.context.dataflow.locale();return value===null?'null':locale[method](spec)(value);};};var format=wrap('format');var timeFormat=wrap('timeFormat');var utcFormat=wrap('utcFormat');var timeParse=wrap('timeParse');var utcParse=wrap('utcParse');var dateObj=new Date(2000,0,1);function time(month,day,specifier){if(!Number.isInteger(month)||!Number.isInteger(day))return'';dateObj.setYear(2000);dateObj.setMonth(month);dateObj.setDate(day);return timeFormat.call(this,dateObj,specifier);}function monthFormat(month){return time.call(this,month,1,'%B');}function monthAbbrevFormat(month){return time.call(this,month,1,'%b');}function dayFormat(day){return time.call(this,0,2+day,'%A');}function dayAbbrevFormat(day){return time.call(this,0,2+day,'%a');}var DataPrefix=':';var IndexPrefix='@';var ScalePrefix='%';var SignalPrefix='$';function dataVisitor(name,args,scope,params){if(args[0].type!==Literal){error('First argument to data functions must be a string literal.');}var data=args[0].value,dataName=DataPrefix+data;if(!has$1(dataName,params)){try{params[dataName]=scope.getData(data).tuplesRef();}catch(err){// if data set does not exist, there's nothing to track +}}}function indataVisitor(name,args,scope,params){if(args[0].type!==Literal)error('First argument to indata must be a string literal.');if(args[1].type!==Literal)error('Second argument to indata must be a string literal.');var data=args[0].value,field=args[1].value,indexName=IndexPrefix+field;if(!has$1(indexName,params)){params[indexName]=scope.getData(data).indataRef(scope,field);}}function scaleVisitor(name,args,scope,params){if(args[0].type===Literal){// add scale dependency +addScaleDependency(scope,params,args[0].value);}else{// indirect scale lookup; add all scales as parameters +for(name in scope.scales){addScaleDependency(scope,params,name);}}}function addScaleDependency(scope,params,name){var scaleName=ScalePrefix+name;if(!has$1(params,scaleName)){try{params[scaleName]=scope.scaleRef(name);}catch(err){// TODO: error handling? warning? +}}}/** + * nameOrFunction must be a string or function that was registered. + * Return undefined if scale is not recognized. + */function getScale(nameOrFunction,ctx){if(isString(nameOrFunction)){var maybeScale=ctx.scales[nameOrFunction];return maybeScale&&isRegisteredScale(maybeScale.value)?maybeScale.value:undefined;}else if(isFunction(nameOrFunction)){return isRegisteredScale(nameOrFunction)?nameOrFunction:undefined;}return undefined;}function internalScaleFunctions(codegen,fnctx,visitors){// add helper method to the 'this' expression function context +fnctx.__bandwidth=function(s){return s&&s.bandwidth?s.bandwidth():0;};// register AST visitors for internal scale functions +visitors._bandwidth=scaleVisitor;visitors._range=scaleVisitor;visitors._scale=scaleVisitor;// resolve scale reference directly to the signal hash argument +var ref=function ref(arg){return'_['+(arg.type===Literal?$(ScalePrefix+arg.value):$(ScalePrefix)+'+'+codegen(arg))+']';};// define and return internal scale function code generators +// these internal functions are called by mark encoders +return{_bandwidth:function _bandwidth(args){return"this.__bandwidth(".concat(ref(args[0]),")");},_range:function _range(args){return"".concat(ref(args[0]),".range()");},_scale:function _scale(args){return"".concat(ref(args[0]),"(").concat(codegen(args[1]),")");}};}function geoMethod(methodName,globalMethod){return function(projection,geojson,group){if(projection){// projection defined, use it +var p=getScale(projection,(group||this).context);return p&&p.path[methodName](geojson);}else{// projection undefined, use global method +return globalMethod(geojson);}};}var geoArea=geoMethod('area',geoArea$1);var geoBounds=geoMethod('bounds',geoBounds$1);var geoCentroid=geoMethod('centroid',geoCentroid$1);function geoScale(projection,group){var p=getScale(projection,(group||this).context);return p&&p.scale();}function inScope(item){var group=this.context.group;var value=false;if(group)while(item){if(item===group){value=true;break;}item=item.mark.group;}return value;}function log(df,method,args){try{df[method].apply(df,['EXPRESSION'].concat([].slice.call(args)));}catch(err){df.warn(err);}return args[args.length-1];}function warn(){return log(this.context.dataflow,'warn',arguments);}function info(){return log(this.context.dataflow,'info',arguments);}function debug(){return log(this.context.dataflow,'debug',arguments);}// https://www.w3.org/TR/2008/REC-WCAG20-20081211/#relativeluminancedef +function channel_luminance_value(channelValue){var val=channelValue/255;if(val<=0.03928){return val/12.92;}return Math.pow((val+0.055)/1.055,2.4);}function luminance(color){var c=rgb$1(color),r=channel_luminance_value(c.r),g=channel_luminance_value(c.g),b=channel_luminance_value(c.b);return 0.2126*r+0.7152*g+0.0722*b;}// https://www.w3.org/TR/2008/REC-WCAG20-20081211/#contrast-ratiodef +function contrast(color1,color2){var lum1=luminance(color1),lum2=luminance(color2),lumL=Math.max(lum1,lum2),lumD=Math.min(lum1,lum2);return(lumL+0.05)/(lumD+0.05);}function merge(){var args=[].slice.call(arguments);args.unshift({});return extend$1.apply(void 0,_toConsumableArray(args));}function equal(a,b){return a===b||a!==a&&b!==b?true:isArray(a)?isArray(b)&&a.length===b.length?equalArray(a,b):false:isObject(a)&&isObject(b)?equalObject(a,b):false;}function equalArray(a,b){for(var _i60=0,n=a.length;_i60<n;++_i60){if(!equal(a[_i60],b[_i60]))return false;}return true;}function equalObject(a,b){for(var _key18 in a){if(!equal(a[_key18],b[_key18]))return false;}return true;}function removePredicate(props){return function(_){return equalObject(props,_);};}function modify(name,insert,remove,toggle,modify,values){var df=this.context.dataflow,data=this.context.data[name],input=data.input,stamp=df.stamp();var changes=data.changes,predicate,key;if(df._trigger===false||!(input.value.length||insert||toggle)){// nothing to do! +return 0;}if(!changes||changes.stamp<stamp){data.changes=changes=df.changeset();changes.stamp=stamp;df.runAfter(function(){data.modified=true;df.pulse(input,changes).run();},true,1);}if(remove){predicate=remove===true?truthy:isArray(remove)||isTuple(remove)?remove:removePredicate(remove);changes.remove(predicate);}if(insert){changes.insert(insert);}if(toggle){predicate=removePredicate(toggle);if(input.value.some(predicate)){changes.remove(predicate);}else{changes.insert(toggle);}}if(modify){for(key in values){changes.modify(modify,key,values[key]);}}return 1;}function pinchDistance(event){var t=event.touches,dx=t[0].clientX-t[1].clientX,dy=t[0].clientY-t[1].clientY;return Math.hypot(dx,dy);}function pinchAngle(event){var t=event.touches;return Math.atan2(t[0].clientY-t[1].clientY,t[0].clientX-t[1].clientX);}// memoize accessor functions +var accessors={};function pluck(data,name){var accessor=accessors[name]||(accessors[name]=field$1(name));return isArray(data)?data.map(accessor):accessor(data);}function array(seq){return isArray(seq)||ArrayBuffer.isView(seq)?seq:null;}function sequence(seq){return array(seq)||(isString(seq)?seq:null);}function join(seq){var _array2;for(var _len=arguments.length,args=new Array(_len>1?_len-1:0),_key=1;_key<_len;_key++){args[_key-1]=arguments[_key];}return(_array2=array(seq)).join.apply(_array2,args);}function indexof(seq){var _sequence;for(var _len2=arguments.length,args=new Array(_len2>1?_len2-1:0),_key2=1;_key2<_len2;_key2++){args[_key2-1]=arguments[_key2];}return(_sequence=sequence(seq)).indexOf.apply(_sequence,args);}function lastindexof(seq){var _sequence2;for(var _len3=arguments.length,args=new Array(_len3>1?_len3-1:0),_key3=1;_key3<_len3;_key3++){args[_key3-1]=arguments[_key3];}return(_sequence2=sequence(seq)).lastIndexOf.apply(_sequence2,args);}function slice(seq){var _sequence3;for(var _len4=arguments.length,args=new Array(_len4>1?_len4-1:0),_key4=1;_key4<_len4;_key4++){args[_key4-1]=arguments[_key4];}return(_sequence3=sequence(seq)).slice.apply(_sequence3,args);}function replace(str,pattern,repl){if(isFunction(repl))error('Function argument passed to replace.');if(!isString(pattern)&&!isRegExp(pattern))error('Please pass a string or RegExp argument to replace.');return String(str).replace(pattern,repl);}function reverse(seq){return array(seq).slice().reverse();}function sort(seq){return array(seq).slice().sort(ascending$2);}function bandspace(count,paddingInner,paddingOuter){return bandSpace(count||0,paddingInner||0,paddingOuter||0);}function bandwidth(name,group){var s=getScale(name,(group||this).context);return s&&s.bandwidth?s.bandwidth():0;}function copy(name,group){var s=getScale(name,(group||this).context);return s?s.copy():undefined;}function domain(name,group){var s=getScale(name,(group||this).context);return s?s.domain():[];}function invert(name,range,group){var s=getScale(name,(group||this).context);return!s?undefined:isArray(range)?(s.invertRange||s.invert)(range):(s.invert||s.invertExtent)(range);}function range$1(name,group){var s=getScale(name,(group||this).context);return s&&s.range?s.range():[];}function scale$2(name,value,group){var s=getScale(name,(group||this).context);return s?s(value):undefined;}function scaleGradient(scale,p0,p1,count,group){scale=getScale(scale,(group||this).context);var gradient=Gradient$1(p0,p1);var stops=scale.domain(),min=stops[0],max=peek$1(stops),fraction=identity$6;if(!(max-min)){// expand scale if domain has zero span, fix #1479 +scale=(scale.interpolator?scale$4('sequential')().interpolator(scale.interpolator()):scale$4('linear')().interpolate(scale.interpolate()).range(scale.range())).domain([min=0,max=1]);}else{fraction=scaleFraction(scale,min,max);}if(scale.ticks){stops=scale.ticks(+count||15);if(min!==stops[0])stops.unshift(min);if(max!==peek$1(stops))stops.push(max);}stops.forEach(function(_){return gradient.stop(fraction(_),scale(_));});return gradient;}function geoShape(projection,geojson,group){var p=getScale(projection,(group||this).context);return function(context){return p?p.path.context(context)(geojson):'';};}function pathShape(path){var p=null;return function(context){return context?pathRender(context,p=p||parse$3(path)):path;};}var datum=function datum(d){return d.data;};function treeNodes(name,context){var tree=data$1.call(context,name);return tree.root&&tree.root.lookup||{};}function treePath(name,source,target){var nodes=treeNodes(name,this),s=nodes[source],t=nodes[target];return s&&t?s.path(t).map(datum):undefined;}function treeAncestors(name,node){var n=treeNodes(name,this)[node];return n?n.ancestors().map(datum):undefined;}var _window=function _window(){return typeof window!=='undefined'&&window||null;};function screen(){var w=_window();return w?w.screen:{};}function windowSize(){var w=_window();return w?[w.innerWidth,w.innerHeight]:[undefined,undefined];}function containerSize(){var view=this.context.dataflow,el=view.container&&view.container();return el?[el.clientWidth,el.clientHeight]:[undefined,undefined];}function intersect(b,opt,group){if(!b)return[];var _b4=_slicedToArray(b,2),u=_b4[0],v=_b4[1],box=new Bounds().set(u[0],u[1],v[0],v[1]),scene=group||this.context.dataflow.scenegraph().root;return intersect$2(scene,box,filter(opt));}function filter(opt){var p=null;if(opt){var types=array$5(opt.marktype),names=array$5(opt.markname);p=function p(_){return(!types.length||types.some(function(t){return _.marktype===t;}))&&(!names.length||names.some(function(s){return _.name===s;}));};}return p;}/** + * Appends a new point to the lasso + * + * @param {*} lasso the lasso in pixel space + * @param {*} x the x coordinate in pixel space + * @param {*} y the y coordinate in pixel space + * @param {*} minDist the minimum distance, in pixels, that thenew point needs to be apart from the last point + * @returns a new array containing the lasso with the new point + */function lassoAppend(lasso,x,y){var minDist=arguments.length>3&&arguments[3]!==undefined?arguments[3]:5;lasso=array$5(lasso);var last=lasso[lasso.length-1];// Add point to lasso if its the first point or distance to last point exceed minDist +return last===undefined||Math.hypot(last[0]-x,last[1]-y)>minDist?[].concat(_toConsumableArray(lasso),[[x,y]]):lasso;}/** + * Generates a svg path command which draws a lasso + * + * @param {*} lasso the lasso in pixel space in the form [[x,y], [x,y], ...] + * @returns the svg path command that draws the lasso + */function lassoPath(lasso){return array$5(lasso).reduce(function(svg,_ref,i){var _ref24=_slicedToArray(_ref,2),x=_ref24[0],y=_ref24[1];return svg+=i==0?"M ".concat(x,",").concat(y," "):i===lasso.length-1?' Z':"L ".concat(x,",").concat(y," ");},'');}/** + * Inverts the lasso from pixel space to an array of vega scenegraph tuples + * + * @param {*} data the dataset + * @param {*} pixelLasso the lasso in pixel space, [[x,y], [x,y], ...] + * @param {*} unit the unit where the lasso is defined + * + * @returns an array of vega scenegraph tuples + */function intersectLasso(markname,pixelLasso,unit){var x=unit.x,y=unit.y,mark=unit.mark;var bb=new Bounds().set(Number.MAX_SAFE_INTEGER,Number.MAX_SAFE_INTEGER,Number.MIN_SAFE_INTEGER,Number.MIN_SAFE_INTEGER);// Get bounding box around lasso +var _iterator32=_createForOfIteratorHelper(pixelLasso),_step32;try{for(_iterator32.s();!(_step32=_iterator32.n()).done;){var _step32$value=_slicedToArray(_step32.value,2),_px=_step32$value[0],_py=_step32$value[1];if(_px<bb.x1)bb.x1=_px;if(_px>bb.x2)bb.x2=_px;if(_py<bb.y1)bb.y1=_py;if(_py>bb.y2)bb.y2=_py;}// Translate bb against unit coordinates +}catch(err){_iterator32.e(err);}finally{_iterator32.f();}bb.translate(x,y);var intersection=intersect([[bb.x1,bb.y1],[bb.x2,bb.y2]],markname,mark);// Check every point against the lasso +return intersection.filter(function(tuple){return pointInPolygon(tuple.x,tuple.y,pixelLasso);});}/** + * Performs a test if a point is inside a polygon based on the idea from + * https://wrf.ecse.rpi.edu/Research/Short_Notes/pnpoly.html + * + * This method will not need the same start/end point since it wraps around the edges of the array + * + * @param {*} test a point to test against + * @param {*} polygon a polygon in the form [[x,y], [x,y], ...] + * @returns true if the point lies inside the polygon, false otherwise + */function pointInPolygon(testx,testy,polygon){var intersections=0;for(var _i61=0,j=polygon.length-1;_i61<polygon.length;j=_i61++){var _polygon$j=_slicedToArray(polygon[j],2),prevX=_polygon$j[0],prevY=_polygon$j[1];var _polygon$_i=_slicedToArray(polygon[_i61],2),_x36=_polygon$_i[0],_y16=_polygon$_i[1];// count intersections +if(_y16>testy!=prevY>testy&&testx<(prevX-_x36)*(testy-_y16)/(prevY-_y16)+_x36){intersections++;}}// point is in polygon if intersection count is odd +return intersections&1;}// Expression function context object +var functionContext={random:function random(){return exports.random();},// override default +cumulativeNormal:cumulativeNormal,cumulativeLogNormal:cumulativeLogNormal,cumulativeUniform:cumulativeUniform,densityNormal:densityNormal,densityLogNormal:densityLogNormal,densityUniform:densityUniform,quantileNormal:quantileNormal,quantileLogNormal:quantileLogNormal,quantileUniform:quantileUniform,sampleNormal:sampleNormal,sampleLogNormal:sampleLogNormal,sampleUniform:sampleUniform,isArray:isArray,isBoolean:isBoolean$1,isDate:isDate$1,isDefined:function isDefined(_){return _!==undefined;},isNumber:isNumber$1,isObject:isObject,isRegExp:isRegExp,isString:isString,isTuple:isTuple,isValid:function isValid(_){return _!=null&&_===_;},toBoolean:toBoolean,toDate:function toDate(_){return _toDate(_);},// suppress extra arguments +toNumber:toNumber,toString:toString,indexof:indexof,join:join,lastindexof:lastindexof,replace:replace,reverse:reverse,sort:sort,slice:slice,flush:flush,lerp:lerp,merge:merge,pad:pad$2,peek:peek$1,pluck:pluck,span:span,inrange:inrange,truncate:truncate$1,rgb:rgb$1,lab:lab$1,hcl:hcl$2,hsl:hsl$2,luminance:luminance,contrast:contrast,sequence:range$3,format:format,utcFormat:utcFormat,utcParse:utcParse,utcOffset:utcOffset,utcSequence:utcSequence,timeFormat:timeFormat,timeParse:timeParse,timeOffset:timeOffset,timeSequence:timeSequence,timeUnitSpecifier:timeUnitSpecifier,monthFormat:monthFormat,monthAbbrevFormat:monthAbbrevFormat,dayFormat:dayFormat,dayAbbrevFormat:dayAbbrevFormat,quarter:quarter,utcquarter:utcquarter,week:week,utcweek:utcweek,dayofyear:dayofyear,utcdayofyear:utcdayofyear,warn:warn,info:info,debug:debug,extent:function extent(_){return _extent(_);},// suppress extra arguments +inScope:inScope,intersect:intersect,clampRange:clampRange,pinchDistance:pinchDistance,pinchAngle:pinchAngle,screen:screen,containerSize:containerSize,windowSize:windowSize,bandspace:bandspace,setdata:setdata,pathShape:pathShape,panLinear:panLinear,panLog:panLog,panPow:panPow,panSymlog:panSymlog,zoomLinear:zoomLinear,zoomLog:zoomLog,zoomPow:zoomPow,zoomSymlog:zoomSymlog,encode:encode,modify:modify,lassoAppend:lassoAppend,lassoPath:lassoPath,intersectLasso:intersectLasso};var eventFunctions=['view','item','group','xy','x','y'],// event functions +eventPrefix='event.vega.',// event function prefix +thisPrefix='this.',// function context prefix +astVisitors={};// AST visitors for dependency analysis +// export code generator parameters +var codegenParams={forbidden:['_'],allowed:['datum','event','item'],fieldvar:'datum',globalvar:function globalvar(id){return"_[".concat($(SignalPrefix+id),"]");},functions:buildFunctions,constants:Constants,visitors:astVisitors};// export code generator +var codeGenerator=codegen(codegenParams);// Build expression function registry +function buildFunctions(codegen){var fn=Functions(codegen);eventFunctions.forEach(function(name){return fn[name]=eventPrefix+name;});for(var name in functionContext){fn[name]=thisPrefix+name;}extend$1(fn,internalScaleFunctions(codegen,functionContext,astVisitors));return fn;}// Register an expression function +function expressionFunction(name,fn,visitor){if(arguments.length===1){return functionContext[name];}// register with the functionContext +functionContext[name]=fn;// if there is an astVisitor register that, too +if(visitor)astVisitors[name]=visitor;// if the code generator has already been initialized, +// we need to also register the function with it +if(codeGenerator)codeGenerator.functions[name]=thisPrefix+name;return this;}// register expression functions with ast visitors +expressionFunction('bandwidth',bandwidth,scaleVisitor);expressionFunction('copy',copy,scaleVisitor);expressionFunction('domain',domain,scaleVisitor);expressionFunction('range',range$1,scaleVisitor);expressionFunction('invert',invert,scaleVisitor);expressionFunction('scale',scale$2,scaleVisitor);expressionFunction('gradient',scaleGradient,scaleVisitor);expressionFunction('geoArea',geoArea,scaleVisitor);expressionFunction('geoBounds',geoBounds,scaleVisitor);expressionFunction('geoCentroid',geoCentroid,scaleVisitor);expressionFunction('geoShape',geoShape,scaleVisitor);expressionFunction('geoScale',geoScale,scaleVisitor);expressionFunction('indata',indata,indataVisitor);expressionFunction('data',data$1,dataVisitor);expressionFunction('treePath',treePath,dataVisitor);expressionFunction('treeAncestors',treeAncestors,dataVisitor);// register Vega-Lite selection functions +expressionFunction('vlSelectionTest',selectionTest,selectionVisitor);expressionFunction('vlSelectionIdTest',selectionIdTest,selectionVisitor);expressionFunction('vlSelectionResolve',selectionResolve,selectionVisitor);expressionFunction('vlSelectionTuples',selectionTuples);function parser(expr,scope){var params={};// parse the expression to an abstract syntax tree (ast) +var ast;try{expr=isString(expr)?expr:$(expr)+'';ast=parser$1(expr);}catch(err){error('Expression parse error: '+expr);}// analyze ast function calls for dependencies +ast.visit(function(node){if(node.type!==CallExpression)return;var name=node.callee.name,visit=codegenParams.visitors[name];if(visit)visit(name,node.arguments,scope,params);});// perform code generation +var gen=codeGenerator(ast);// collect signal dependencies +gen.globals.forEach(function(name){var signalName=SignalPrefix+name;if(!has$1(params,signalName)&&scope.getSignal(name)){params[signalName]=scope.signalRef(name);}});// return generated expression code and dependencies +return{$expr:extend$1({code:gen.code},scope.options.ast?{ast:ast}:null),$fields:gen.fields,$params:params};}/** + * Parse a serialized dataflow specification. + */function parse$2(spec){var ctx=this,operators=spec.operators||[];// parse background +if(spec.background){ctx.background=spec.background;}// parse event configuration +if(spec.eventConfig){ctx.eventConfig=spec.eventConfig;}// parse locale configuration +if(spec.locale){ctx.locale=spec.locale;}// parse operators +operators.forEach(function(entry){return ctx.parseOperator(entry);});// parse operator parameters +operators.forEach(function(entry){return ctx.parseOperatorParameters(entry);});// parse streams +(spec.streams||[]).forEach(function(entry){return ctx.parseStream(entry);});// parse updates +(spec.updates||[]).forEach(function(entry){return ctx.parseUpdate(entry);});return ctx.resolve();}var Skip$2=toSet(['rule']),Swap=toSet(['group','image','rect']);function adjustSpatial(encode,marktype){var code='';if(Skip$2[marktype])return code;if(encode.x2){if(encode.x){if(Swap[marktype]){code+='if(o.x>o.x2)$=o.x,o.x=o.x2,o.x2=$;';}code+='o.width=o.x2-o.x;';}else{code+='o.x=o.x2-(o.width||0);';}}if(encode.xc){code+='o.x=o.xc-(o.width||0)/2;';}if(encode.y2){if(encode.y){if(Swap[marktype]){code+='if(o.y>o.y2)$=o.y,o.y=o.y2,o.y2=$;';}code+='o.height=o.y2-o.y;';}else{code+='o.y=o.y2-(o.height||0);';}}if(encode.yc){code+='o.y=o.yc-(o.height||0)/2;';}return code;}function canonicalType(type){return(type+'').toLowerCase();}function isOperator(type){return canonicalType(type)==='operator';}function isCollect(type){return canonicalType(type)==='collect';}function expression(ctx,args,code){// wrap code in return statement if expression does not terminate +if(!code.endsWith(';')){code='return('+code+');';}var fn=Function.apply(void 0,_toConsumableArray(args.concat(code)));return ctx&&ctx.functions?fn.bind(ctx.functions):fn;}// generate code for comparing a single field +function _compare(u,v,lt,gt){return"((u = ".concat(u,") < (v = ").concat(v,") || u == null) && v != null ? ").concat(lt,"\n : (u > v || v == null) && u != null ? ").concat(gt,"\n : ((v = v instanceof Date ? +v : v), (u = u instanceof Date ? +u : u)) !== u && v === v ? ").concat(lt,"\n : v !== v && u === u ? ").concat(gt," : ");}var expressionCodegen={/** + * Parse an expression used to update an operator value. + */operator:function operator(ctx,expr){return expression(ctx,['_'],expr.code);},/** + * Parse an expression provided as an operator parameter value. + */parameter:function parameter(ctx,expr){return expression(ctx,['datum','_'],expr.code);},/** + * Parse an expression applied to an event stream. + */event:function event(ctx,expr){return expression(ctx,['event'],expr.code);},/** + * Parse an expression used to handle an event-driven operator update. + */handler:function handler(ctx,expr){var code="var datum=event.item&&event.item.datum;return ".concat(expr.code,";");return expression(ctx,['_','event'],code);},/** + * Parse an expression that performs visual encoding. + */encode:function encode(ctx,_encode){var marktype=_encode.marktype,channels=_encode.channels;var code='var o=item,datum=o.datum,m=0,$;';for(var name in channels){var o='o['+$(name)+']';code+="$=".concat(channels[name].code,";if(").concat(o,"!==$)").concat(o,"=$,m=1;");}code+=adjustSpatial(channels,marktype);code+='return m;';return expression(ctx,['item','_'],code);},/** + * Optimized code generators for access and comparison. + */codegen:{get:function get(path){var ref="[".concat(path.map($).join(']['),"]");var get=Function('_',"return _".concat(ref,";"));get.path=ref;return get;},comparator:function comparator(fields,orders){var t;var map=function map(f,i){var o=orders[i];var u,v;if(f.path){u="a".concat(f.path);v="b".concat(f.path);}else{(t=t||{})['f'+i]=f;u="this.f".concat(i,"(a)");v="this.f".concat(i,"(b)");}return _compare(u,v,-o,o);};var fn=Function('a','b','var u, v; return '+fields.map(map).join('')+'0;');return t?fn.bind(t):fn;}}};/** + * Parse a dataflow operator. + */function parseOperator(spec){var ctx=this;if(isOperator(spec.type)||!spec.type){ctx.operator(spec,spec.update?ctx.operatorExpression(spec.update):null);}else{ctx.transform(spec,spec.type);}}/** + * Parse and assign operator parameters. + */function parseOperatorParameters(spec){var ctx=this;if(spec.params){var op=ctx.get(spec.id);if(!op)error('Invalid operator id: '+spec.id);ctx.dataflow.connect(op,op.parameters(ctx.parseParameters(spec.params),spec.react,spec.initonly));}}/** + * Parse a set of operator parameters. + */function parseParameters$1(spec,params){params=params||{};var ctx=this;for(var _key19 in spec){var _value22=spec[_key19];params[_key19]=isArray(_value22)?_value22.map(function(v){return parseParameter$2(v,ctx,params);}):parseParameter$2(_value22,ctx,params);}return params;}/** + * Parse a single parameter. + */function parseParameter$2(spec,ctx,params){if(!spec||!isObject(spec))return spec;for(var _i62=0,n=PARSERS.length,p;_i62<n;++_i62){p=PARSERS[_i62];if(has$1(spec,p.key)){return p.parse(spec,ctx,params);}}return spec;}/** Reference parsers. */var PARSERS=[{key:'$ref',parse:getOperator},{key:'$key',parse:getKey},{key:'$expr',parse:getExpression},{key:'$field',parse:getField},{key:'$encode',parse:getEncode},{key:'$compare',parse:getCompare},{key:'$context',parse:getContext},{key:'$subflow',parse:getSubflow},{key:'$tupleid',parse:getTupleId}];/** + * Resolve an operator reference. + */function getOperator(_,ctx){return ctx.get(_.$ref)||error('Operator not defined: '+_.$ref);}/** + * Resolve an expression reference. + */function getExpression(_,ctx,params){if(_.$params){// parse expression parameters +ctx.parseParameters(_.$params,params);}var k='e:'+_.$expr.code;return ctx.fn[k]||(ctx.fn[k]=accessor(ctx.parameterExpression(_.$expr),_.$fields));}/** + * Resolve a key accessor reference. + */function getKey(_,ctx){var k='k:'+_.$key+'_'+!!_.$flat;return ctx.fn[k]||(ctx.fn[k]=key(_.$key,_.$flat,ctx.expr.codegen));}/** + * Resolve a field accessor reference. + */function getField(_,ctx){if(!_.$field)return null;var k='f:'+_.$field+'_'+_.$name;return ctx.fn[k]||(ctx.fn[k]=field$1(_.$field,_.$name,ctx.expr.codegen));}/** + * Resolve a comparator function reference. + */function getCompare(_,ctx){// As of Vega 5.5.3, $tupleid sort is no longer used. +// Keep here for now for backwards compatibility. +var k='c:'+_.$compare+'_'+_.$order,c=array$5(_.$compare).map(function(_){return _&&_.$tupleid?tupleid:_;});return ctx.fn[k]||(ctx.fn[k]=compare$1(c,_.$order,ctx.expr.codegen));}/** + * Resolve an encode operator reference. + */function getEncode(_,ctx){var spec=_.$encode,encode={};for(var name in spec){var enc=spec[name];encode[name]=accessor(ctx.encodeExpression(enc.$expr),enc.$fields);encode[name].output=enc.$output;}return encode;}/** + * Resolve a context reference. + */function getContext(_,ctx){return ctx;}/** + * Resolve a recursive subflow specification. + */function getSubflow(_,ctx){var spec=_.$subflow;return function(dataflow,key,parent){var subctx=ctx.fork().parse(spec),op=subctx.get(spec.operators[0].id),p=subctx.signals.parent;if(p)p.set(parent);op.detachSubflow=function(){return ctx.detach(subctx);};return op;};}/** + * Resolve a tuple id reference. + */function getTupleId(){return tupleid;}/** + * Parse an event stream specification. + */function parseStream$2(spec){var ctx=this,filter=spec.filter!=null?ctx.eventExpression(spec.filter):undefined,stream=spec.stream!=null?ctx.get(spec.stream):undefined,args;if(spec.source){stream=ctx.events(spec.source,spec.type,filter);}else if(spec.merge){args=spec.merge.map(function(_){return ctx.get(_);});stream=args[0].merge.apply(args[0],args.slice(1));}if(spec.between){args=spec.between.map(function(_){return ctx.get(_);});stream=stream.between(args[0],args[1]);}if(spec.filter){stream=stream.filter(filter);}if(spec.throttle!=null){stream=stream.throttle(+spec.throttle);}if(spec.debounce!=null){stream=stream.debounce(+spec.debounce);}if(stream==null){error('Invalid stream definition: '+JSON.stringify(spec));}if(spec.consume)stream.consume(true);ctx.stream(spec,stream);}/** + * Parse an event-driven operator update. + */function parseUpdate$1(spec){var ctx=this,srcid=isObject(srcid=spec.source)?srcid.$ref:srcid,source=ctx.get(srcid),target=null,update=spec.update,params=undefined;if(!source)error('Source not defined: '+spec.source);target=spec.target&&spec.target.$expr?ctx.eventExpression(spec.target.$expr):ctx.get(spec.target);if(update&&update.$expr){if(update.$params){params=ctx.parseParameters(update.$params);}update=ctx.handlerExpression(update.$expr);}ctx.update(spec,source,target,update,params);}var SKIP={skip:true};function getState$1(options){var ctx=this,state={};if(options.signals){var signals=state.signals={};Object.keys(ctx.signals).forEach(function(key){var op=ctx.signals[key];if(options.signals(key,op)){signals[key]=op.value;}});}if(options.data){var data=state.data={};Object.keys(ctx.data).forEach(function(key){var dataset=ctx.data[key];if(options.data(key,dataset)){data[key]=dataset.input.value;}});}if(ctx.subcontext&&options.recurse!==false){state.subcontext=ctx.subcontext.map(function(ctx){return ctx.getState(options);});}return state;}function setState$1(state){var ctx=this,df=ctx.dataflow,data=state.data,signals=state.signals;Object.keys(signals||{}).forEach(function(key){df.update(ctx.signals[key],signals[key],SKIP);});Object.keys(data||{}).forEach(function(key){df.pulse(ctx.data[key].input,df.changeset().remove(truthy).insert(data[key]));});(state.subcontext||[]).forEach(function(substate,i){var subctx=ctx.subcontext[i];if(subctx)subctx.setState(substate);});}/** + * Context objects store the current parse state. + * Enables lookup of parsed operators, event streams, accessors, etc. + * Provides a 'fork' method for creating child contexts for subflows. + */function context(df,transforms,functions,expr){return new Context(df,transforms,functions,expr);}function Context(df,transforms,functions,expr){this.dataflow=df;this.transforms=transforms;this.events=df.events.bind(df);this.expr=expr||expressionCodegen,this.signals={};this.scales={};this.nodes={};this.data={};this.fn={};if(functions){this.functions=Object.create(functions);this.functions.context=this;}}function Subcontext(ctx){this.dataflow=ctx.dataflow;this.transforms=ctx.transforms;this.events=ctx.events;this.expr=ctx.expr;this.signals=Object.create(ctx.signals);this.scales=Object.create(ctx.scales);this.nodes=Object.create(ctx.nodes);this.data=Object.create(ctx.data);this.fn=Object.create(ctx.fn);if(ctx.functions){this.functions=Object.create(ctx.functions);this.functions.context=this;}}Context.prototype=Subcontext.prototype={fork:function fork(){var ctx=new Subcontext(this);(this.subcontext||(this.subcontext=[])).push(ctx);return ctx;},detach:function detach(ctx){this.subcontext=this.subcontext.filter(function(c){return c!==ctx;});// disconnect all nodes in the subcontext +// wipe out targets first for better efficiency +var keys=Object.keys(ctx.nodes);for(var _i63=0,_keys=keys;_i63<_keys.length;_i63++){var _key20=_keys[_i63];ctx.nodes[_key20]._targets=null;}for(var _i64=0,_keys2=keys;_i64<_keys2.length;_i64++){var _key21=_keys2[_i64];ctx.nodes[_key21].detach();}ctx.nodes=null;},get:function get(id){return this.nodes[id];},set:function set(id,node){return this.nodes[id]=node;},add:function add(spec,op){var ctx=this,df=ctx.dataflow,data=spec.value;ctx.set(spec.id,op);if(isCollect(spec.type)&&data){if(data.$ingest){df.ingest(op,data.$ingest,data.$format);}else if(data.$request){df.preload(op,data.$request,data.$format);}else{df.pulse(op,df.changeset().insert(data));}}if(spec.root){ctx.root=op;}if(spec.parent){var p=ctx.get(spec.parent.$ref);if(p){df.connect(p,[op]);op.targets().add(p);}else{(ctx.unresolved=ctx.unresolved||[]).push(function(){p=ctx.get(spec.parent.$ref);df.connect(p,[op]);op.targets().add(p);});}}if(spec.signal){ctx.signals[spec.signal]=op;}if(spec.scale){ctx.scales[spec.scale]=op;}if(spec.data){var _loop=function _loop(){var data=ctx.data[name]||(ctx.data[name]={});spec.data[name].forEach(function(role){return data[role]=op;});};for(var name in spec.data){_loop();}}},resolve:function resolve(){(this.unresolved||[]).forEach(function(fn){return fn();});delete this.unresolved;return this;},operator:function operator(spec,update){this.add(spec,this.dataflow.add(spec.value,update));},transform:function transform(spec,type){this.add(spec,this.dataflow.add(this.transforms[canonicalType(type)]));},stream:function stream(spec,_stream){this.set(spec.id,_stream);},update:function update(spec,stream,target,_update2,params){this.dataflow.on(stream,target,_update2,params,spec.options);},// expression parsing +operatorExpression:function operatorExpression(expr){return this.expr.operator(this,expr);},parameterExpression:function parameterExpression(expr){return this.expr.parameter(this,expr);},eventExpression:function eventExpression(expr){return this.expr.event(this,expr);},handlerExpression:function handlerExpression(expr){return this.expr.handler(this,expr);},encodeExpression:function encodeExpression(encode){return this.expr.encode(this,encode);},// parse methods +parse:parse$2,parseOperator:parseOperator,parseOperatorParameters:parseOperatorParameters,parseParameters:parseParameters$1,parseStream:parseStream$2,parseUpdate:parseUpdate$1,// state methods +getState:getState$1,setState:setState$1};// initialize aria role and label attributes +function initializeAria(view){var el=view.container();if(el){el.setAttribute('role','graphics-document');el.setAttribute('aria-roleDescription','visualization');ariaLabel(el,view.description());}}// update aria-label if we have a DOM container element +function ariaLabel(el,desc){if(el)desc==null?el.removeAttribute('aria-label'):el.setAttribute('aria-label',desc);}function background(view){// respond to background signal +view.add(null,function(_){view._background=_.bg;view._resize=1;return _.bg;},{bg:view._signals.background});}var Default='default';function cursor(view){// get cursor signal, add to dataflow if needed +var cursor=view._signals.cursor||(view._signals.cursor=view.add({user:Default,item:null}));// evaluate cursor on each pointermove event +view.on(view.events('view','pointermove'),cursor,function(_,event){var value=cursor.value,user=value?isString(value)?value:value.user:Default,item=event.item&&event.item.cursor||null;return value&&user===value.user&&item==value.item?value:{user:user,item:item};});// when cursor signal updates, set visible cursor +view.add(null,function(_){var user=_.cursor,item=this.value;if(!isString(user)){item=user.item;user=user.user;}setCursor(view,user&&user!==Default?user:item||user);return item;},{cursor:cursor});}function setCursor(view,cursor){var el=view.globalCursor()?typeof document!=='undefined'&&document.body:view.container();if(el){return cursor==null?el.style.removeProperty('cursor'):el.style.cursor=cursor;}}function dataref(view,name){var data=view._runtime.data;if(!has$1(data,name)){error('Unrecognized data set: '+name);}return data[name];}function data(name,values){return arguments.length<2?dataref(this,name).values.value:change.call(this,name,changeset().remove(truthy).insert(values));}function change(name,changes){if(!isChangeSet(changes)){error('Second argument to changes must be a changeset.');}var dataset=dataref(this,name);dataset.modified=true;return this.pulse(dataset.input,changes);}function insert(name,_){return change.call(this,name,changeset().insert(_));}function remove(name,_){return change.call(this,name,changeset().remove(_));}function width(view){var padding=view.padding();return Math.max(0,view._viewWidth+padding.left+padding.right);}function height(view){var padding=view.padding();return Math.max(0,view._viewHeight+padding.top+padding.bottom);}function offset(view){var padding=view.padding(),origin=view._origin;return[padding.left+origin[0],padding.top+origin[1]];}function resizeRenderer(view){var origin=offset(view),w=width(view),h=height(view);view._renderer.background(view.background());view._renderer.resize(w,h,origin);view._handler.origin(origin);view._resizeListeners.forEach(function(handler){try{handler(w,h);}catch(error){view.error(error);}});}/** + * Extend an event with additional view-specific methods. + * Adds a new property ('vega') to an event that provides a number + * of methods for querying information about the current interaction. + * The vega object provides the following methods: + * view - Returns the backing View instance. + * item - Returns the currently active scenegraph item (if any). + * group - Returns the currently active scenegraph group (if any). + * This method accepts a single string-typed argument indicating the name + * of the desired parent group. The scenegraph will be traversed from + * the item up towards the root to search for a matching group. If no + * argument is provided the enclosing group for the active item is + * returned, unless the item it itself a group, in which case it is + * returned directly. + * xy - Returns a two-element array containing the x and y coordinates for + * mouse or touch events. For touch events, this is based on the first + * elements in the changedTouches array. This method accepts a single + * argument: either an item instance or mark name that should serve as + * the reference coordinate system. If no argument is provided the + * top-level view coordinate system is assumed. + * x - Returns the current x-coordinate, accepts the same arguments as xy. + * y - Returns the current y-coordinate, accepts the same arguments as xy. + * @param {Event} event - The input event to extend. + * @param {Item} item - The currently active scenegraph item (if any). + * @return {Event} - The extended input event. + */function eventExtend(view,event,item){var r=view._renderer,el=r&&r.canvas(),p,e,translate;if(el){translate=offset(view);e=event.changedTouches?event.changedTouches[0]:event;p=point(e,el);p[0]-=translate[0];p[1]-=translate[1];}event.dataflow=view;event.item=item;event.vega=extension(view,item,p);return event;}function extension(view,item,point){var itemGroup=item?item.mark.marktype==='group'?item:item.mark.group:null;function group(name){var g=itemGroup,i;if(name)for(i=item;i;i=i.mark.group){if(i.mark.name===name){g=i;break;}}return g&&g.mark&&g.mark.interactive?g:{};}function xy(item){if(!item)return point;if(isString(item))item=group(item);var p=point.slice();while(item){p[0]-=item.x||0;p[1]-=item.y||0;item=item.mark&&item.mark.group;}return p;}return{view:constant$5(view),item:constant$5(item||{}),group:group,xy:xy,x:function x(item){return xy(item)[0];},y:function y(item){return xy(item)[1];}};}var VIEW$1='view',TIMER='timer',WINDOW='window',NO_TRAP={trap:false};/** + * Initialize event handling configuration. + * @param {object} config - The configuration settings. + * @return {object} + */function initializeEventConfig(config){var events=extend$1({defaults:{}},config);var unpack=function unpack(obj,keys){keys.forEach(function(k){if(isArray(obj[k]))obj[k]=toSet(obj[k]);});};unpack(events.defaults,['prevent','allow']);unpack(events,['view','window','selector']);return events;}function trackEventListener(view,sources,type,handler){view._eventListeners.push({type:type,sources:array$5(sources),handler:handler});}function prevent(view,type){var def=view._eventConfig.defaults,prevent=def.prevent,allow=def.allow;return prevent===false||allow===true?false:prevent===true||allow===false?true:prevent?prevent[type]:allow?!allow[type]:view.preventDefault();}function permit(view,key,type){var rule=view._eventConfig&&view._eventConfig[key];if(rule===false||isObject(rule)&&!rule[type]){view.warn("Blocked ".concat(key," ").concat(type," event listener."));return false;}return true;}/** + * Create a new event stream from an event source. + * @param {object} source - The event source to monitor. + * @param {string} type - The event type. + * @param {function(object): boolean} [filter] - Event filter function. + * @return {EventStream} + */function events(source,type,filter){var view=this,s=new EventStream(filter),send=function send(e,item){view.runAsync(null,function(){if(source===VIEW$1&&prevent(view,type)){e.preventDefault();}s.receive(eventExtend(view,e,item));});},sources;if(source===TIMER){if(permit(view,'timer',type)){view.timer(send,type);}}else if(source===VIEW$1){if(permit(view,'view',type)){// send traps errors, so use {trap: false} option +view.addEventListener(type,send,NO_TRAP);}}else{if(source===WINDOW){if(permit(view,'window',type)&&typeof window!=='undefined'){sources=[window];}}else if(typeof document!=='undefined'){if(permit(view,'selector',type)){sources=Array.from(document.querySelectorAll(source));}}if(!sources){view.warn('Can not resolve event source: '+source);}else{for(var i=0,n=sources.length;i<n;++i){sources[i].addEventListener(type,send);}trackEventListener(view,sources,type,send);}}return s;}function itemFilter(event){return event.item;}function markTarget(event){// grab upstream collector feeding the mark operator +return event.item.mark.source;}function invoke(name){return function(_,event){return event.vega.view().changeset().encode(event.item,name);};}function hover(hoverSet,leaveSet){hoverSet=[hoverSet||'hover'];leaveSet=[leaveSet||'update',hoverSet[0]];// invoke hover set upon pointerover +this.on(this.events('view','pointerover',itemFilter),markTarget,invoke(hoverSet));// invoke leave set upon pointerout +this.on(this.events('view','pointerout',itemFilter),markTarget,invoke(leaveSet));return this;}/** + * Finalize a View instance that is being removed. + * Cancel any running timers. + * Remove all external event listeners. + * Remove any currently displayed tooltip. + */function finalize(){var tooltip=this._tooltip,timers=this._timers,handlers=this._handler.handlers(),listeners=this._eventListeners,n,m,e,h,t;n=timers.length;while(--n>=0){timers[n].stop();}n=listeners.length;while(--n>=0){e=listeners[n];m=e.sources.length;while(--m>=0){e.sources[m].removeEventListener(e.type,e.handler);}}if(tooltip){tooltip.call(this,this._handler,null,null,null);}// turn off all registered handlers +n=handlers.length;while(--n>=0){t=handlers[n].type;h=handlers[n].handler;this._handler.off(t,h);}return this;}function element(tag,attr,text){var el=document.createElement(tag);for(var _key22 in attr)el.setAttribute(_key22,attr[_key22]);if(text!=null)el.textContent=text;return el;}var BindClass='vega-bind',NameClass='vega-bind-name',RadioClass='vega-bind-radio';/** + * Bind a signal to an external HTML input element. The resulting two-way + * binding will propagate input changes to signals, and propagate signal + * changes to the input element state. If this view instance has no parent + * element, we assume the view is headless and no bindings are created. + * @param {Element|string} el - The parent DOM element to which the input + * element should be appended as a child. If string-valued, this argument + * will be treated as a CSS selector. If null or undefined, the parent + * element of this view will be used as the element. + * @param {object} param - The binding parameters which specify the signal + * to bind to, the input element type, and type-specific configuration. + * @return {View} - This view instance. + */function bind(view,el,binding){if(!el)return;var param=binding.param;var bind=binding.state;if(!bind){bind=binding.state={elements:null,active:false,set:null,update:function update(value){if(value!=view.signal(param.signal)){view.runAsync(null,function(){bind.source=true;view.signal(param.signal,value);});}}};if(param.debounce){bind.update=_debounce(param.debounce,bind.update);}}var create=param.input==null&¶m.element?target:generate;create(bind,el,param,view);if(!bind.active){view.on(view._signals[param.signal],null,function(){bind.source?bind.source=false:bind.set(view.signal(param.signal));});bind.active=true;}return bind;}/** + * Bind the signal to an external EventTarget. + */function target(bind,node,param,view){var type=param.event||'input';var handler=function handler(){return bind.update(node.value);};// initialize signal value to external input value +view.signal(param.signal,node.value);// listen for changes on the element +node.addEventListener(type,handler);// register with view, so we can remove it upon finalization +trackEventListener(view,node,type,handler);// propagate change to element +bind.set=function(value){node.value=value;node.dispatchEvent(event(type));};}function event(type){return typeof Event!=='undefined'?new Event(type):{type:type};}/** + * Generate an HTML input form element and bind it to a signal. + */function generate(bind,el,param,view){var value=view.signal(param.signal);var div=element('div',{'class':BindClass});var wrapper=param.input==='radio'?div:div.appendChild(element('label'));wrapper.appendChild(element('span',{'class':NameClass},param.name||param.signal));el.appendChild(div);var input=form;switch(param.input){case'checkbox':input=checkbox;break;case'select':input=select;break;case'radio':input=radio;break;case'range':input=range;break;}input(bind,wrapper,param,value);}/** + * Generates an arbitrary input form element. + * The input type is controlled via user-provided parameters. + */function form(bind,el,param,value){var node=element('input');for(var _key23 in param){if(_key23!=='signal'&&_key23!=='element'){node.setAttribute(_key23==='input'?'type':_key23,param[_key23]);}}node.setAttribute('name',param.signal);node.value=value;el.appendChild(node);node.addEventListener('input',function(){return bind.update(node.value);});bind.elements=[node];bind.set=function(value){return node.value=value;};}/** + * Generates a checkbox input element. + */function checkbox(bind,el,param,value){var attr={type:'checkbox',name:param.signal};if(value)attr.checked=true;var node=element('input',attr);el.appendChild(node);node.addEventListener('change',function(){return bind.update(node.checked);});bind.elements=[node];bind.set=function(value){return node.checked=!!value||null;};}/** + * Generates a selection list input element. + */function select(bind,el,param,value){var node=element('select',{name:param.signal}),labels=param.labels||[];param.options.forEach(function(option,i){var attr={value:option};if(valuesEqual(option,value))attr.selected=true;node.appendChild(element('option',attr,(labels[i]||option)+''));});el.appendChild(node);node.addEventListener('change',function(){bind.update(param.options[node.selectedIndex]);});bind.elements=[node];bind.set=function(value){for(var _i65=0,n=param.options.length;_i65<n;++_i65){if(valuesEqual(param.options[_i65],value)){node.selectedIndex=_i65;return;}}};}/** + * Generates a radio button group. + */function radio(bind,el,param,value){var group=element('span',{'class':RadioClass}),labels=param.labels||[];el.appendChild(group);bind.elements=param.options.map(function(option,i){var attr={type:'radio',name:param.signal,value:option};if(valuesEqual(option,value))attr.checked=true;var input=element('input',attr);input.addEventListener('change',function(){return bind.update(option);});var label=element('label',{},(labels[i]||option)+'');label.prepend(input);group.appendChild(label);return input;});bind.set=function(value){var nodes=bind.elements,n=nodes.length;for(var _i66=0;_i66<n;++_i66){if(valuesEqual(nodes[_i66].value,value))nodes[_i66].checked=true;}};}/** + * Generates a slider input element. + */function range(bind,el,param,value){value=value!==undefined?value:(+param.max+ +param.min)/2;var max=param.max!=null?param.max:Math.max(100,+value)||100,min=param.min||Math.min(0,max,+value)||0,step=param.step||tickStep(min,max,100);var node=element('input',{type:'range',name:param.signal,min:min,max:max,step:step});node.value=value;var span=element('span',{},+value);el.appendChild(node);el.appendChild(span);var update=function update(){span.textContent=node.value;bind.update(+node.value);};// subscribe to both input and change +node.addEventListener('input',update);node.addEventListener('change',update);bind.elements=[node];bind.set=function(value){node.value=value;span.textContent=value;};}function valuesEqual(a,b){return a===b||a+''===b+'';}function initializeRenderer(view,r,el,constructor,scaleFactor,opt){r=r||new constructor(view.loader());return r.initialize(el,width(view),height(view),offset(view),scaleFactor,opt).background(view.background());}function trap(view,fn){return!fn?null:function(){try{fn.apply(this,arguments);}catch(error){view.error(error);}};}function initializeHandler(view,prevHandler,el,constructor){// instantiate scenegraph handler +var handler=new constructor(view.loader(),trap(view,view.tooltip())).scene(view.scenegraph().root).initialize(el,offset(view),view);// transfer event handlers +if(prevHandler){prevHandler.handlers().forEach(function(h){handler.on(h.type,h.handler);});}return handler;}function initialize(el,elBind){var view=this,type=view._renderType,config=view._eventConfig.bind,module=renderModule(type);// containing dom element +el=view._el=el?lookup$1(view,el,true):null;// initialize aria attributes +initializeAria(view);// select appropriate renderer & handler +if(!module)view.error('Unrecognized renderer type: '+type);var Handler=module.handler||CanvasHandler,Renderer=el?module.renderer:module.headless;// initialize renderer and input handler +view._renderer=!Renderer?null:initializeRenderer(view,view._renderer,el,Renderer);view._handler=initializeHandler(view,view._handler,el,Handler);view._redraw=true;// initialize signal bindings +if(el&&config!=='none'){elBind=elBind?view._elBind=lookup$1(view,elBind,true):el.appendChild(element('form',{'class':'vega-bindings'}));view._bind.forEach(function(_){if(_.param.element&&config!=='container'){_.element=lookup$1(view,_.param.element,!!_.param.input);}});view._bind.forEach(function(_){bind(view,_.element||elBind,_);});}return view;}function lookup$1(view,el,clear){if(typeof el==='string'){if(typeof document!=='undefined'){el=document.querySelector(el);if(!el){view.error('Signal bind element not found: '+el);return null;}}else{view.error('DOM document instance not found.');return null;}}if(el&&clear){try{el.textContent='';}catch(e){el=null;view.error(e);}}return el;}var number$1=function number$1(_){return+_||0;};var paddingObject$1=function paddingObject$1(_){return{top:_,bottom:_,left:_,right:_};};function _padding2(_){return isObject(_)?{top:number$1(_.top),bottom:number$1(_.bottom),left:number$1(_.left),right:number$1(_.right)}:paddingObject$1(number$1(_));}/** + * Render the current scene in a headless fashion. + * This method is asynchronous, returning a Promise instance. + * @return {Promise} - A Promise that resolves to a renderer. + */function renderHeadless(_x37,_x38,_x39,_x40){return _renderHeadless.apply(this,arguments);}/** + * Produce an image URL for the visualization. Depending on the type + * parameter, the generated URL contains data for either a PNG or SVG image. + * The URL can be used (for example) to download images of the visualization. + * This method is asynchronous, returning a Promise instance. + * @param {string} type - The image type. One of 'svg', 'png' or 'canvas'. + * The 'canvas' and 'png' types are synonyms for a PNG image. + * @return {Promise} - A promise that resolves to an image URL. + */function _renderHeadless(){_renderHeadless=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee10(view,type,scaleFactor,opt){var module,ctr;return _regenerator().w(function(_context19){while(1)switch(_context19.n){case 0:module=renderModule(type),ctr=module&&module.headless;if(!ctr)error('Unrecognized renderer type: '+type);_context19.n=1;return view.runAsync();case 1:return _context19.a(2,initializeRenderer(view,null,null,ctr,scaleFactor,opt).renderAsync(view._scenegraph.root));}},_callee10);}));return _renderHeadless.apply(this,arguments);}function renderToImageURL(_x41,_x42){return _renderToImageURL.apply(this,arguments);}function _renderToImageURL(){_renderToImageURL=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee11(type,scaleFactor){var r;return _regenerator().w(function(_context20){while(1)switch(_context20.n){case 0:if(type!==RenderType.Canvas&&type!==RenderType.SVG&&type!==RenderType.PNG){error('Unrecognized image type: '+type);}_context20.n=1;return renderHeadless(this,type,scaleFactor);case 1:r=_context20.v;return _context20.a(2,type===RenderType.SVG?toBlobURL(r.svg(),'image/svg+xml'):r.canvas().toDataURL('image/png'));}},_callee11,this);}));return _renderToImageURL.apply(this,arguments);}function toBlobURL(data,mime){var blob=new Blob([data],{type:mime});return window.URL.createObjectURL(blob);}/** + * Produce a Canvas instance containing a rendered visualization. + * This method is asynchronous, returning a Promise instance. + * @return {Promise} - A promise that resolves to a Canvas instance. + */function renderToCanvas(_x43,_x44){return _renderToCanvas.apply(this,arguments);}/** + * Produce a rendered SVG string of the visualization. + * This method is asynchronous, returning a Promise instance. + * @return {Promise} - A promise that resolves to an SVG string. + */function _renderToCanvas(){_renderToCanvas=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee12(scaleFactor,opt){var r;return _regenerator().w(function(_context21){while(1)switch(_context21.n){case 0:_context21.n=1;return renderHeadless(this,RenderType.Canvas,scaleFactor,opt);case 1:r=_context21.v;return _context21.a(2,r.canvas());}},_callee12,this);}));return _renderToCanvas.apply(this,arguments);}function renderToSVG(_x45){return _renderToSVG.apply(this,arguments);}function _renderToSVG(){_renderToSVG=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee13(scaleFactor){var r;return _regenerator().w(function(_context22){while(1)switch(_context22.n){case 0:_context22.n=1;return renderHeadless(this,RenderType.SVG,scaleFactor);case 1:r=_context22.v;return _context22.a(2,r.svg());}},_callee13,this);}));return _renderToSVG.apply(this,arguments);}function runtime(view,spec,expr){return context(view,transforms,functionContext,expr).parse(spec);}function scale$1(name){var scales=this._runtime.scales;if(!has$1(scales,name)){error('Unrecognized scale or projection: '+name);}return scales[name].value;}var Width='width',Height='height',Padding='padding',Skip$1={skip:true};function viewWidth(view,width){var a=view.autosize(),p=view.padding();return width-(a&&a.contains===Padding?p.left+p.right:0);}function viewHeight(view,height){var a=view.autosize(),p=view.padding();return height-(a&&a.contains===Padding?p.top+p.bottom:0);}function initializeResize(view){var s=view._signals,w=s[Width],h=s[Height],p=s[Padding];function resetSize(){view._autosize=view._resize=1;}// respond to width signal +view._resizeWidth=view.add(null,function(_){view._width=_.size;view._viewWidth=viewWidth(view,_.size);resetSize();},{size:w});// respond to height signal +view._resizeHeight=view.add(null,function(_){view._height=_.size;view._viewHeight=viewHeight(view,_.size);resetSize();},{size:h});// respond to padding signal +var resizePadding=view.add(null,resetSize,{pad:p});// set rank to run immediately after source signal +view._resizeWidth.rank=w.rank+1;view._resizeHeight.rank=h.rank+1;resizePadding.rank=p.rank+1;}function resizeView(viewWidth,viewHeight,width,height,origin,auto){this.runAfter(function(view){var rerun=0;// reset autosize flag +view._autosize=0;// width value changed: update signal, skip resize op +if(view.width()!==width){rerun=1;view.signal(Width,width,Skip$1);// set width, skip update calc +view._resizeWidth.skip(true);// skip width resize handler +}// height value changed: update signal, skip resize op +if(view.height()!==height){rerun=1;view.signal(Height,height,Skip$1);// set height, skip update calc +view._resizeHeight.skip(true);// skip height resize handler +}// view width changed: update view property, set resize flag +if(view._viewWidth!==viewWidth){view._resize=1;view._viewWidth=viewWidth;}// view height changed: update view property, set resize flag +if(view._viewHeight!==viewHeight){view._resize=1;view._viewHeight=viewHeight;}// origin changed: update view property, set resize flag +if(view._origin[0]!==origin[0]||view._origin[1]!==origin[1]){view._resize=1;view._origin=origin;}// run dataflow on width/height signal change +if(rerun)view.run('enter');if(auto)view.runAfter(function(v){return v.resize();});},false,1);}/** + * Get the current view state, consisting of signal values and/or data sets. + * @param {object} [options] - Options flags indicating which state to export. + * If unspecified, all signals and data sets will be exported. + * @param {function(string, Operator):boolean} [options.signals] - Optional + * predicate function for testing if a signal should be included in the + * exported state. If unspecified, all signals will be included, except for + * those named 'parent' or those which refer to a Transform value. + * @param {function(string, object):boolean} [options.data] - Optional + * predicate function for testing if a data set's input should be included + * in the exported state. If unspecified, all data sets that have been + * explicitly modified will be included. + * @param {boolean} [options.recurse=true] - Flag indicating if the exported + * state should recursively include state from group mark sub-contexts. + * @return {object} - An object containing the exported state values. + */function getState(options){return this._runtime.getState(options||{data:dataTest,signals:signalTest,recurse:true});}function dataTest(name,data){return data.modified&&isArray(data.input.value)&&!name.startsWith('_:vega:_');}function signalTest(name,op){return!(name==='parent'||op instanceof transforms.proxy);}/** + * Sets the current view state and updates the view by invoking run. + * @param {object} state - A state object containing signal and/or + * data set values, following the format used by the getState method. + * @return {View} - This view instance. + */function setState(state){this.runAsync(null,function(v){v._trigger=false;v._runtime.setState(state);},function(v){v._trigger=true;});return this;}function timer(callback,delay){function tick(elapsed){callback({timestamp:Date.now(),elapsed:elapsed});}this._timers.push(interval(tick,delay));}function defaultTooltip(handler,event,item,value){var el=handler.element();if(el)el.setAttribute('title',formatTooltip(value));}function formatTooltip(value){return value==null?'':isArray(value)?formatArray(value):isObject(value)&&!isDate$1(value)?formatObject(value):value+'';}function formatObject(obj){return Object.keys(obj).map(function(key){var v=obj[key];return key+': '+(isArray(v)?formatArray(v):formatValue(v));}).join('\n');}function formatArray(value){return'['+value.map(formatValue).join(', ')+']';}function formatValue(value){return isArray(value)?"[\u2026]":isObject(value)&&!isDate$1(value)?"{\u2026}":value;}function watchPixelRatio(){var _this26=this;// based on https://developer.mozilla.org/en-US/docs/Web/API/Window/devicePixelRatio#monitoring_screen_resolution_or_zoom_level_changes +if(this.renderer()==='canvas'&&this._renderer._canvas){var _remove=null;var _updatePixelRatio=function updatePixelRatio(){if(_remove!=null){_remove();}var media=matchMedia("(resolution: ".concat(window.devicePixelRatio,"dppx)"));media.addEventListener('change',_updatePixelRatio);_remove=function _remove(){media.removeEventListener('change',_updatePixelRatio);};_this26._renderer._canvas.getContext('2d').pixelRatio=window.devicePixelRatio||1;_this26._redraw=true;_this26._resize=1;_this26.resize().runAsync();};_updatePixelRatio();}}/** + * Create a new View instance from a Vega dataflow runtime specification. + * The generated View will not immediately be ready for display. Callers + * should also invoke the initialize method (e.g., to set the parent + * DOM element in browser-based deployment) and then invoke the run + * method to evaluate the dataflow graph. Rendering will automatically + * be performed upon dataflow runs. + * @constructor + * @param {object} spec - The Vega dataflow runtime specification. + */function View$1(spec,options){var view=this;options=options||{};Dataflow.call(view);if(options.loader)view.loader(options.loader);if(options.logger)view.logger(options.logger);if(options.logLevel!=null)view.logLevel(options.logLevel);if(options.locale||spec.locale){var loc=extend$1({},spec.locale,options.locale);view.locale(locale(loc.number,loc.time));}view._el=null;view._elBind=null;view._renderType=options.renderer||RenderType.Canvas;view._scenegraph=new Scenegraph();var root=view._scenegraph.root;// initialize renderer, handler and event management +view._renderer=null;view._tooltip=options.tooltip||defaultTooltip,view._redraw=true;view._handler=new CanvasHandler().scene(root);view._globalCursor=false;view._preventDefault=false;view._timers=[];view._eventListeners=[];view._resizeListeners=[];// initialize event configuration +view._eventConfig=initializeEventConfig(spec.eventConfig);view.globalCursor(view._eventConfig.globalCursor);// initialize dataflow graph +var ctx=runtime(view,spec,options.expr);view._runtime=ctx;view._signals=ctx.signals;view._bind=(spec.bindings||[]).map(function(_){return{state:null,param:extend$1({},_)};});// initialize scenegraph +if(ctx.root)ctx.root.set(root);root.source=ctx.data.root.input;view.pulse(ctx.data.root.input,view.changeset().insert(root.items));// initialize view size +view._width=view.width();view._height=view.height();view._viewWidth=viewWidth(view,view._width);view._viewHeight=viewHeight(view,view._height);view._origin=[0,0];view._resize=0;view._autosize=1;initializeResize(view);// initialize background color +background(view);// initialize cursor +cursor(view);// initialize view description +view.description(spec.description);// initialize hover proessing, if requested +if(options.hover)view.hover();// initialize DOM container(s) and renderer +if(options.container)view.initialize(options.container,options.bind);if(options.watchPixelRatio)view._watchPixelRatio();}function lookupSignal(view,name){return has$1(view._signals,name)?view._signals[name]:error('Unrecognized signal name: '+$(name));}function findOperatorHandler(op,handler){var h=(op._targets||[]).filter(function(op){return op._update&&op._update.handler===handler;});return h.length?h[0]:null;}function addOperatorListener(view,name,op,handler){var h=findOperatorHandler(op,handler);if(!h){h=trap(view,function(){return handler(name,op.value);});h.handler=handler;view.on(op,null,h);}return view;}function removeOperatorListener(view,op,handler){var h=findOperatorHandler(op,handler);if(h)op._targets.remove(h);return view;}inherits(View$1,Dataflow,{// -- DATAFLOW / RENDERING ---- +evaluate:function evaluate(encode,prerun,postrun){var _this27=this;return _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(){var _t1;return _regenerator().w(function(_context1){while(1)switch(_context1.p=_context1.n){case 0:_context1.n=1;return Dataflow.prototype.evaluate.call(_this27,encode,prerun);case 1:if(!(_this27._redraw||_this27._resize)){_context1.n=5;break;}_context1.p=2;if(!_this27._renderer){_context1.n=3;break;}if(_this27._resize){_this27._resize=0;resizeRenderer(_this27);}_context1.n=3;return _this27._renderer.renderAsync(_this27._scenegraph.root);case 3:_this27._redraw=false;_context1.n=5;break;case 4:_context1.p=4;_t1=_context1.v;_this27.error(_t1);case 5:// evaluate postrun +if(postrun)asyncCallback(_this27,postrun);return _context1.a(2,_this27);}},_callee2,null,[[2,4]]);}))();},dirty:function dirty(item){this._redraw=true;this._renderer&&this._renderer.dirty(item);},// -- GET / SET ---- +description:function description(text){if(arguments.length){var desc=text!=null?text+'':null;if(desc!==this._desc)ariaLabel(this._el,this._desc=desc);return this;}return this._desc;},container:function container(){return this._el;},scenegraph:function scenegraph(){return this._scenegraph;},origin:function origin(){return this._origin.slice();},signal:function signal(name,value,options){var op=lookupSignal(this,name);return arguments.length===1?op.value:this.update(op,value,options);},width:function width(_){return arguments.length?this.signal('width',_):this.signal('width');},height:function height(_){return arguments.length?this.signal('height',_):this.signal('height');},padding:function padding(_){return arguments.length?this.signal('padding',_padding2(_)):_padding2(this.signal('padding'));},autosize:function autosize(_){return arguments.length?this.signal('autosize',_):this.signal('autosize');},background:function background(_){return arguments.length?this.signal('background',_):this.signal('background');},renderer:function renderer(type){if(!arguments.length)return this._renderType;if(!renderModule(type))error('Unrecognized renderer type: '+type);if(type!==this._renderType){this._renderType=type;this._resetRenderer();}return this;},tooltip:function tooltip(handler){if(!arguments.length)return this._tooltip;if(handler!==this._tooltip){this._tooltip=handler;this._resetRenderer();}return this;},loader:function loader(_loader){if(!arguments.length)return this._loader;if(_loader!==this._loader){Dataflow.prototype.loader.call(this,_loader);this._resetRenderer();}return this;},resize:function resize(){// set flag to perform autosize +this._autosize=1;// touch autosize signal to ensure top-level ViewLayout runs +return this.touch(lookupSignal(this,'autosize'));},_resetRenderer:function _resetRenderer(){if(this._renderer){this._renderer=null;this.initialize(this._el,this._elBind);}},// -- SIZING ---- +_resizeView:resizeView,// -- EVENT HANDLING ---- +addEventListener:function addEventListener(type,handler,options){var callback=handler;if(!(options&&options.trap===false)){// wrap callback in error handler +callback=trap(this,handler);callback.raw=handler;}this._handler.on(type,callback);return this;},removeEventListener:function removeEventListener(type,handler){var handlers=this._handler.handlers(type),i=handlers.length,h,t;// search registered handlers, remove if match found +while(--i>=0){t=handlers[i].type;h=handlers[i].handler;if(type===t&&(handler===h||handler===h.raw)){this._handler.off(t,h);break;}}return this;},addResizeListener:function addResizeListener(handler){var l=this._resizeListeners;if(!l.includes(handler)){// add handler if it isn't already registered +// note: error trapping handled elsewhere, so +// no need to wrap handlers here +l.push(handler);}return this;},removeResizeListener:function removeResizeListener(handler){var l=this._resizeListeners,i=l.indexOf(handler);if(i>=0){l.splice(i,1);}return this;},addSignalListener:function addSignalListener(name,handler){return addOperatorListener(this,name,lookupSignal(this,name),handler);},removeSignalListener:function removeSignalListener(name,handler){return removeOperatorListener(this,lookupSignal(this,name),handler);},addDataListener:function addDataListener(name,handler){return addOperatorListener(this,name,dataref(this,name).values,handler);},removeDataListener:function removeDataListener(name,handler){return removeOperatorListener(this,dataref(this,name).values,handler);},globalCursor:function globalCursor(_){if(arguments.length){if(this._globalCursor!==!!_){var prev=setCursor(this,null);// clear previous cursor +this._globalCursor=!!_;if(prev)setCursor(this,prev);// swap cursor +}return this;}else{return this._globalCursor;}},preventDefault:function preventDefault(_){if(arguments.length){this._preventDefault=_;return this;}else{return this._preventDefault;}},timer:timer,events:events,finalize:finalize,hover:hover,// -- DATA ---- +data:data,change:change,insert:insert,remove:remove,// -- SCALES -- +scale:scale$1,// -- INITIALIZATION ---- +initialize:initialize,// -- HEADLESS RENDERING ---- +toImageURL:renderToImageURL,toCanvas:renderToCanvas,toSVG:renderToSVG,// -- SAVE / RESTORE STATE ---- +getState:getState,setState:setState,// RE-RENDER ON ZOOM +_watchPixelRatio:watchPixelRatio});var VIEW='view',LBRACK='[',RBRACK=']',LBRACE='{',RBRACE='}',COLON=':',COMMA=',',NAME='@',GT='>',ILLEGAL=/[[\]{}]/,DEFAULT_MARKS={'*':1,arc:1,area:1,group:1,image:1,line:1,path:1,rect:1,rule:1,shape:1,symbol:1,text:1,trail:1};var DEFAULT_SOURCE,MARKS;/** + * Parse an event selector string. + * Returns an array of event stream definitions. + */function eventSelector(selector,source,marks){DEFAULT_SOURCE=source||VIEW;MARKS=marks||DEFAULT_MARKS;return parseMerge(selector.trim()).map(parseSelector);}function isMarkType(type){return MARKS[type];}function find(s,i,endChar,pushChar,popChar){var n=s.length;var count=0,c;for(;i<n;++i){c=s[i];if(!count&&c===endChar)return i;else if(popChar&&popChar.includes(c))--count;else if(pushChar&&pushChar.includes(c))++count;}return i;}function parseMerge(s){var output=[],n=s.length;var start=0,i=0;while(i<n){i=find(s,i,COMMA,LBRACK+LBRACE,RBRACK+RBRACE);output.push(s.substring(start,i).trim());start=++i;}if(output.length===0){throw'Empty event selector: '+s;}return output;}function parseSelector(s){return s[0]==='['?parseBetween(s):parseStream$1(s);}function parseBetween(s){var n=s.length;var i=1,b;i=find(s,i,RBRACK,LBRACK,RBRACK);if(i===n){throw'Empty between selector: '+s;}b=parseMerge(s.substring(1,i));if(b.length!==2){throw'Between selector must have two elements: '+s;}s=s.slice(i+1).trim();if(s[0]!==GT){throw'Expected \'>\' after between selector: '+s;}b=b.map(parseSelector);var stream=parseSelector(s.slice(1).trim());if(stream.between){return{between:b,stream:stream};}else{stream.between=b;}return stream;}function parseStream$1(s){var stream={source:DEFAULT_SOURCE},source=[];var throttle=[0,0],markname=0,start=0,n=s.length,i=0,j,filter;// extract throttle from end +if(s[n-1]===RBRACE){i=s.lastIndexOf(LBRACE);if(i>=0){try{throttle=parseThrottle(s.substring(i+1,n-1));}catch(e){throw'Invalid throttle specification: '+s;}s=s.slice(0,i).trim();n=s.length;}else throw'Unmatched right brace: '+s;i=0;}if(!n)throw s;// set name flag based on first char +if(s[0]===NAME)markname=++i;// extract first part of multi-part stream selector +j=find(s,i,COLON);if(j<n){source.push(s.substring(start,j).trim());start=i=++j;}// extract remaining part of stream selector +i=find(s,i,LBRACK);if(i===n){source.push(s.substring(start,n).trim());}else{source.push(s.substring(start,i).trim());filter=[];start=++i;if(start===n)throw'Unmatched left bracket: '+s;}// extract filters +while(i<n){i=find(s,i,RBRACK);if(i===n)throw'Unmatched left bracket: '+s;filter.push(s.substring(start,i).trim());if(i<n-1&&s[++i]!==LBRACK)throw'Expected left bracket: '+s;start=++i;}// marshall event stream specification +if(!(n=source.length)||ILLEGAL.test(source[n-1])){throw'Invalid event selector: '+s;}if(n>1){stream.type=source[1];if(markname){stream.markname=source[0].slice(1);}else if(isMarkType(source[0])){stream.marktype=source[0];}else{stream.source=source[0];}}else{stream.type=source[0];}if(stream.type.slice(-1)==='!'){stream.consume=true;stream.type=stream.type.slice(0,-1);}if(filter!=null)stream.filter=filter;if(throttle[0])stream.throttle=throttle[0];if(throttle[1])stream.debounce=throttle[1];return stream;}function parseThrottle(s){var a=s.split(COMMA);if(!s.length||a.length>2)throw s;return a.map(function(_){var x=+_;if(x!==x)throw s;return x;});}function parseAutosize(spec){return isObject(spec)?spec:{type:spec||'pad'};}var number=function number(_){return+_||0;};var paddingObject=function paddingObject(_){return{top:_,bottom:_,left:_,right:_};};function parsePadding(spec){return!isObject(spec)?paddingObject(number(spec)):spec.signal?spec:{top:number(spec.top),bottom:number(spec.bottom),left:number(spec.left),right:number(spec.right)};}var encoder=function encoder(_){return isObject(_)&&!isArray(_)?extend$1({},_):{value:_};};function addEncode(object,name,value,set){if(value!=null){var isEncoder=isObject(value)&&!isArray(value)||isArray(value)&&value.length&&isObject(value[0]);// Always assign signal to update, even if the signal is from the enter block +if(isEncoder){object.update[name]=value;}else{object[set||'enter'][name]={value:value};}return 1;}else{return 0;}}function addEncoders(object,enter,update){for(var name in enter){addEncode(object,name,enter[name]);}for(var _name in update){addEncode(object,_name,update[_name],'update');}}function extendEncode(encode,extra,skip){for(var name in extra){if(skip&&has$1(skip,name))continue;encode[name]=extend$1(encode[name]||{},extra[name]);}return encode;}function has(key,encode){return encode&&(encode.enter&&encode.enter[key]||encode.update&&encode.update[key]);}var MarkRole='mark';var FrameRole='frame';var ScopeRole='scope';var AxisRole='axis';var AxisDomainRole='axis-domain';var AxisGridRole='axis-grid';var AxisLabelRole='axis-label';var AxisTickRole='axis-tick';var AxisTitleRole='axis-title';var LegendRole='legend';var LegendBandRole='legend-band';var LegendEntryRole='legend-entry';var LegendGradientRole='legend-gradient';var LegendLabelRole='legend-label';var LegendSymbolRole='legend-symbol';var LegendTitleRole='legend-title';var TitleRole='title';var TitleTextRole='title-text';var TitleSubtitleRole='title-subtitle';function applyDefaults(encode,type,role,style,config){var defaults={},enter={};var update,key,skip,props;// if text mark, apply global lineBreak settings (#2370) +key='lineBreak';if(type==='text'&&config[key]!=null&&!has(key,encode)){applyDefault(defaults,key,config[key]);}// ignore legend and axis roles +if(role=='legend'||String(role).startsWith('axis')){role=null;}// resolve mark config +props=role===FrameRole?config.group:role===MarkRole?extend$1({},config.mark,config[type]):null;for(key in props){// do not apply defaults if relevant fields are defined +skip=has(key,encode)||(key==='fill'||key==='stroke')&&(has('fill',encode)||has('stroke',encode));if(!skip)applyDefault(defaults,key,props[key]);}// resolve styles, apply with increasing precedence +array$5(style).forEach(function(name){var props=config.style&&config.style[name];for(var _key24 in props){if(!has(_key24,encode)){applyDefault(defaults,_key24,props[_key24]);}}});encode=extend$1({},encode);// defensive copy +for(key in defaults){props=defaults[key];if(props.signal){(update=update||{})[key]=props;}else{enter[key]=props;}}encode.enter=extend$1(enter,encode.enter);if(update)encode.update=extend$1(update,encode.update);return encode;}function applyDefault(defaults,key,value){defaults[key]=value&&value.signal?{signal:value.signal}:{value:value};}var scaleRef=function scaleRef(scale){return isString(scale)?$(scale):scale.signal?"(".concat(scale.signal,")"):field(scale);};function entry$1(enc){if(enc.gradient!=null){return gradient(enc);}var value=enc.signal?"(".concat(enc.signal,")"):enc.color?color(enc.color):enc.field!=null?field(enc.field):enc.value!==undefined?$(enc.value):undefined;if(enc.scale!=null){value=scale(enc,value);}if(value===undefined){value=null;}if(enc.exponent!=null){value="pow(".concat(value,",").concat(property(enc.exponent),")");}if(enc.mult!=null){value+="*".concat(property(enc.mult));}if(enc.offset!=null){value+="+".concat(property(enc.offset));}if(enc.round){value="round(".concat(value,")");}return value;}var _color=function _color(type,x,y,z){return"(".concat(type,"(").concat([x,y,z].map(entry$1).join(','),")+'')");};function color(enc){return enc.c?_color('hcl',enc.h,enc.c,enc.l):enc.h||enc.s?_color('hsl',enc.h,enc.s,enc.l):enc.l||enc.a?_color('lab',enc.l,enc.a,enc.b):enc.r||enc.g||enc.b?_color('rgb',enc.r,enc.g,enc.b):null;}function gradient(enc){// map undefined to null; expression lang does not allow undefined +var args=[enc.start,enc.stop,enc.count].map(function(_){return _==null?null:$(_);});// trim null inputs from the end +while(args.length&&peek$1(args)==null)args.pop();args.unshift(scaleRef(enc.gradient));return"gradient(".concat(args.join(','),")");}function property(property){return isObject(property)?'('+entry$1(property)+')':property;}function field(ref){return resolveField(isObject(ref)?ref:{datum:ref});}function resolveField(ref){var object,level,field;if(ref.signal){object='datum';field=ref.signal;}else if(ref.group||ref.parent){level=Math.max(1,ref.level||1);object='item';while(level-->0){object+='.mark.group';}if(ref.parent){field=ref.parent;object+='.datum';}else{field=ref.group;}}else if(ref.datum){object='datum';field=ref.datum;}else{error('Invalid field reference: '+$(ref));}if(!ref.signal){field=isString(field)?splitAccessPath(field).map($).join(']['):resolveField(field);}return object+'['+field+']';}function scale(enc,value){var scale=scaleRef(enc.scale);if(enc.range!=null){// pull value from scale range +value="lerp(_range(".concat(scale,"), ").concat(+enc.range,")");}else{// run value through scale and/or pull scale bandwidth +if(value!==undefined)value="_scale(".concat(scale,", ").concat(value,")");if(enc.band){value=(value?value+'+':'')+"_bandwidth(".concat(scale,")")+(+enc.band===1?'':'*'+property(enc.band));if(enc.extra){// include logic to handle extraneous elements +value="(datum.extra ? _scale(".concat(scale,", datum.extra.value) : ").concat(value,")");}}if(value==null)value='0';}return value;}function rule(enc){var code='';enc.forEach(function(rule){var value=entry$1(rule);code+=rule.test?"(".concat(rule.test,")?").concat(value,":"):value;});// if no else clause, terminate with null (#1366) +if(peek$1(code)===':'){code+='null';}return code;}function parseEncode(encode,type,role,style,scope,params){var enc={};params=params||{};params.encoders={$encode:enc};encode=applyDefaults(encode,type,role,style,scope.config);for(var _key25 in encode){enc[_key25]=parseBlock(encode[_key25],type,params,scope);}return params;}function parseBlock(block,marktype,params,scope){var channels={},fields={};for(var name in block){if(block[name]!=null){// skip any null entries +channels[name]=parse$1(expr(block[name]),scope,params,fields);}}return{$expr:{marktype:marktype,channels:channels},$fields:Object.keys(fields),$output:Object.keys(block)};}function expr(enc){return isArray(enc)?rule(enc):entry$1(enc);}function parse$1(code,scope,params,fields){var expr=parser(code,scope);expr.$fields.forEach(function(name){return fields[name]=1;});extend$1(params,expr.$params);return expr.$expr;}var OUTER='outer',OUTER_INVALID=['value','update','init','react','bind'];function outerError(prefix,name){error(prefix+' for "outer" push: '+$(name));}function parseSignal(signal,scope){var name=signal.name;if(signal.push===OUTER){// signal must already be defined, raise error if not +if(!scope.signals[name])outerError('No prior signal definition',name);// signal push must not use properties reserved for standard definition +OUTER_INVALID.forEach(function(prop){if(signal[prop]!==undefined)outerError('Invalid property ',prop);});}else{// define a new signal in the current scope +var op=scope.addSignal(name,signal.value);if(signal.react===false)op.react=false;if(signal.bind)scope.addBinding(name,signal.bind);}}function Entry(type,value,params,parent){this.id=-1;this.type=type;this.value=value;this.params=params;if(parent)this.parent=parent;}function entry(type,value,params,parent){return new Entry(type,value,params,parent);}function operator(value,params){return entry('operator',value,params);}// ----- +function ref(op){var ref={$ref:op.id};// if operator not yet registered, cache ref to resolve later +if(op.id<0)(op.refs=op.refs||[]).push(ref);return ref;}function fieldRef$1(field,name){return name?{$field:field,$name:name}:{$field:field};}var keyFieldRef=fieldRef$1('key');function _compareRef(fields,orders){return{$compare:fields,$order:orders};}function _keyRef(fields,flat){var ref={$key:fields};if(flat)ref.$flat=true;return ref;}// ----- +var Ascending='ascending';var Descending='descending';function sortKey(sort){return!isObject(sort)?'':(sort.order===Descending?'-':'+')+aggrField(sort.op,sort.field);}function aggrField(op,field){return(op&&op.signal?'$'+op.signal:op||'')+(op&&field?'_':'')+(field&&field.signal?'$'+field.signal:field||'');}// ----- +var Scope$1='scope';var View='view';function isSignal(_){return _&&_.signal;}function isExpr$1(_){return _&&_.expr;}function hasSignal(_){if(isSignal(_))return true;if(isObject(_))for(var _key26 in _){if(hasSignal(_[_key26]))return true;}return false;}function value(specValue,defaultValue){return specValue!=null?specValue:defaultValue;}function deref(v){return v&&v.signal||v;}var Timer='timer';function parseStream(stream,scope){var method=stream.merge?mergeStream:stream.stream?nestedStream:stream.type?eventStream:error('Invalid stream specification: '+$(stream));return method(stream,scope);}function eventSource(source){return source===Scope$1?View:source||View;}function mergeStream(stream,scope){var list=stream.merge.map(function(s){return parseStream(s,scope);}),entry=streamParameters({merge:list},stream,scope);return scope.addStream(entry).id;}function nestedStream(stream,scope){var id=parseStream(stream.stream,scope),entry=streamParameters({stream:id},stream,scope);return scope.addStream(entry).id;}function eventStream(stream,scope){var id;if(stream.type===Timer){id=scope.event(Timer,stream.throttle);stream={between:stream.between,filter:stream.filter};}else{id=scope.event(eventSource(stream.source),stream.type);}var entry=streamParameters({stream:id},stream,scope);return Object.keys(entry).length===1?id:scope.addStream(entry).id;}function streamParameters(entry,stream,scope){var param=stream.between;if(param){if(param.length!==2){error('Stream "between" parameter must have 2 entries: '+$(stream));}entry.between=[parseStream(param[0],scope),parseStream(param[1],scope)];}param=stream.filter?[].concat(stream.filter):[];if(stream.marktype||stream.markname||stream.markrole){// add filter for mark type, name and/or role +param.push(filterMark(stream.marktype,stream.markname,stream.markrole));}if(stream.source===Scope$1){// add filter to limit events from sub-scope only +param.push('inScope(event.item)');}if(param.length){entry.filter=parser('('+param.join(')&&(')+')',scope).$expr;}if((param=stream.throttle)!=null){entry.throttle=+param;}if((param=stream.debounce)!=null){entry.debounce=+param;}if(stream.consume){entry.consume=true;}return entry;}function filterMark(type,name,role){var item='event.item';return item+(type&&type!=='*'?'&&'+item+'.mark.marktype===\''+type+'\'':'')+(role?'&&'+item+'.mark.role===\''+role+'\'':'')+(name?'&&'+item+'.mark.name===\''+name+'\'':'');}// bypass expression parser for internal operator references +var OP_VALUE_EXPR={code:'_.$value',ast:{type:'Identifier',value:'value'}};function parseUpdate(spec,scope,target){var encode=spec.encode,entry={target:target};var events=spec.events,update=spec.update,sources=[];if(!events){error('Signal update missing events specification.');}// interpret as an event selector string +if(isString(events)){events=eventSelector(events,scope.isSubscope()?Scope$1:View);}// separate event streams from signal updates +events=array$5(events).filter(function(s){return s.signal||s.scale?(sources.push(s),0):1;});// merge internal operator listeners +if(sources.length>1){sources=[mergeSources(sources)];}// merge event streams, include as source +if(events.length){sources.push(events.length>1?{merge:events}:events[0]);}if(encode!=null){if(update)error('Signal encode and update are mutually exclusive.');update='encode(item(),'+$(encode)+')';}// resolve update value +entry.update=isString(update)?parser(update,scope):update.expr!=null?parser(update.expr,scope):update.value!=null?update.value:update.signal!=null?{$expr:OP_VALUE_EXPR,$params:{$value:scope.signalRef(update.signal)}}:error('Invalid signal update specification.');if(spec.force){entry.options={force:true};}sources.forEach(function(source){return scope.addUpdate(extend$1(streamSource(source,scope),entry));});}function streamSource(stream,scope){return{source:stream.signal?scope.signalRef(stream.signal):stream.scale?scope.scaleRef(stream.scale):parseStream(stream,scope)};}function mergeSources(sources){return{signal:'['+sources.map(function(s){return s.scale?'scale("'+s.scale+'")':s.signal;})+']'};}function parseSignalUpdates(signal,scope){var op=scope.getSignal(signal.name);var expr=signal.update;if(signal.init){if(expr){error('Signals can not include both init and update expressions.');}else{expr=signal.init;op.initonly=true;}}if(expr){expr=parser(expr,scope);op.update=expr.$expr;op.params=expr.$params;}if(signal.on){signal.on.forEach(function(_){return parseUpdate(_,scope,op.id);});}}var transform=function transform(name){return function(params,value,parent){return entry(name,value,params||undefined,parent);};};var Aggregate=transform('aggregate');var AxisTicks=transform('axisticks');var Bound=transform('bound');var Collect=transform('collect');var Compare=transform('compare');var DataJoin=transform('datajoin');var Encode=transform('encode');var Expression=transform('expression');var Facet=transform('facet');var Field=transform('field');var Key=transform('key');var LegendEntries=transform('legendentries');var Load=transform('load');var Mark=transform('mark');var MultiExtent=transform('multiextent');var MultiValues=transform('multivalues');var Overlap=transform('overlap');var Params=transform('params');var PreFacet=transform('prefacet');var Projection=transform('projection');var Proxy=transform('proxy');var Relay=transform('relay');var Render=transform('render');var Scale=transform('scale');var Sieve=transform('sieve');var SortItems=transform('sortitems');var ViewLayout=transform('viewlayout');var Values=transform('values');var FIELD_REF_ID=0;var MULTIDOMAIN_SORT_OPS={min:'min',max:'max',count:'sum'}; +function initScale(spec,scope){ + var type=spec.type||'linear'; + if(!isValidScaleType(type)){ + error('Unrecognized scale type: '+$(type)); + } + scope.addScale(spec.name,{type:type,domain:undefined}); +} +function parseScale(spec,scope){var params=scope.getScale(spec.name).params;var key;params.domain=parseScaleDomain(spec.domain,spec,scope);if(spec.range!=null){params.range=parseScaleRange(spec,scope,params);}if(spec.interpolate!=null){parseScaleInterpolate(spec.interpolate,params);}if(spec.nice!=null){params.nice=parseScaleNice(spec.nice,scope);}if(spec.bins!=null){params.bins=parseScaleBins(spec.bins,scope);}for(key in spec){if(has$1(params,key)||key==='name')continue;params[key]=parseLiteral(spec[key],scope);}}function parseLiteral(v,scope){return!isObject(v)?v:v.signal?scope.signalRef(v.signal):error('Unsupported object: '+$(v));}function parseArray(v,scope){return v.signal?scope.signalRef(v.signal):v.map(function(v){return parseLiteral(v,scope);});}function dataLookupError(name){error('Can not find data set: '+$(name));}// -- SCALE DOMAIN ---- +function parseScaleDomain(domain,spec,scope){if(!domain){if(spec.domainMin!=null||spec.domainMax!=null){error('No scale domain defined for domainMin/domainMax to override.');}return;// default domain +}return domain.signal?scope.signalRef(domain.signal):(isArray(domain)?explicitDomain:domain.fields?multipleDomain:singularDomain)(domain,spec,scope);}function explicitDomain(domain,spec,scope){return domain.map(function(v){return parseLiteral(v,scope);});}function singularDomain(domain,spec,scope){var data=scope.getData(domain.data);if(!data)dataLookupError(domain.data);return isDiscrete(spec.type)?data.valuesRef(scope,domain.field,parseSort(domain.sort,false)):isQuantile(spec.type)?data.domainRef(scope,domain.field):data.extentRef(scope,domain.field);}function multipleDomain(domain,spec,scope){var data=domain.data,fields=domain.fields.reduce(function(dom,d){d=isString(d)?{data:data,field:d}:isArray(d)||d.signal?fieldRef(d,scope):d;dom.push(d);return dom;},[]);return(isDiscrete(spec.type)?ordinalMultipleDomain:isQuantile(spec.type)?quantileMultipleDomain:numericMultipleDomain)(domain,scope,fields);}function fieldRef(data,scope){var name='_:vega:_'+FIELD_REF_ID++,coll=Collect({});if(isArray(data)){coll.value={$ingest:data};}else if(data.signal){var code='setdata('+$(name)+','+data.signal+')';coll.params.input=scope.signalRef(code);}scope.addDataPipeline(name,[coll,Sieve({})]);return{data:name,field:'data'};}function ordinalMultipleDomain(domain,scope,fields){var sort=parseSort(domain.sort,true);var a,v;// get value counts for each domain field +var counts=fields.map(function(f){var data=scope.getData(f.data);if(!data)dataLookupError(f.data);return data.countsRef(scope,f.field,sort);});// aggregate the results from each domain field +var p={groupby:keyFieldRef,pulse:counts};if(sort){a=sort.op||'count';v=sort.field?aggrField(a,sort.field):'count';p.ops=[MULTIDOMAIN_SORT_OPS[a]];p.fields=[scope.fieldRef(v)];p.as=[v];}a=scope.add(Aggregate(p));// collect aggregate output +var c=scope.add(Collect({pulse:ref(a)}));// extract values for combined domain +v=scope.add(Values({field:keyFieldRef,sort:scope.sortRef(sort),pulse:ref(c)}));return ref(v);}function parseSort(sort,multidomain){if(sort){if(!sort.field&&!sort.op){if(isObject(sort))sort.field='key';else sort={field:'key'};}else if(!sort.field&&sort.op!=='count'){error('No field provided for sort aggregate op: '+sort.op);}else if(multidomain&&sort.field){if(sort.op&&!MULTIDOMAIN_SORT_OPS[sort.op]){error('Multiple domain scales can not be sorted using '+sort.op);}}}return sort;}function quantileMultipleDomain(domain,scope,fields){// get value arrays for each domain field +var values=fields.map(function(f){var data=scope.getData(f.data);if(!data)dataLookupError(f.data);return data.domainRef(scope,f.field);});// combine value arrays +return ref(scope.add(MultiValues({values:values})));}function numericMultipleDomain(domain,scope,fields){// get extents for each domain field +var extents=fields.map(function(f){var data=scope.getData(f.data);if(!data)dataLookupError(f.data);return data.extentRef(scope,f.field);});// combine extents +return ref(scope.add(MultiExtent({extents:extents})));}// -- SCALE BINS ----- +function parseScaleBins(v,scope){return v.signal||isArray(v)?parseArray(v,scope):scope.objectProperty(v);}// -- SCALE NICE ----- +function parseScaleNice(nice,scope){return nice.signal?scope.signalRef(nice.signal):isObject(nice)?{interval:parseLiteral(nice.interval),step:parseLiteral(nice.step)}:parseLiteral(nice);}// -- SCALE INTERPOLATION ----- +function parseScaleInterpolate(interpolate,params){params.interpolate=parseLiteral(interpolate.type||interpolate);if(interpolate.gamma!=null){params.interpolateGamma=parseLiteral(interpolate.gamma);}}// -- SCALE RANGE ----- +function parseScaleRange(spec,scope,params){var config=scope.config.range;var range=spec.range;if(range.signal){return scope.signalRef(range.signal);}else if(isString(range)){if(config&&has$1(config,range)){spec=extend$1({},spec,{range:config[range]});return parseScaleRange(spec,scope,params);}else if(range==='width'){range=[0,{signal:'width'}];}else if(range==='height'){range=isDiscrete(spec.type)?[0,{signal:'height'}]:[{signal:'height'},0];}else{error('Unrecognized scale range value: '+$(range));}}else if(range.scheme){params.scheme=isArray(range.scheme)?parseArray(range.scheme,scope):parseLiteral(range.scheme,scope);if(range.extent)params.schemeExtent=parseArray(range.extent,scope);if(range.count)params.schemeCount=parseLiteral(range.count,scope);return;}else if(range.step){params.rangeStep=parseLiteral(range.step,scope);return;}else if(isDiscrete(spec.type)&&!isArray(range)){return parseScaleDomain(range,spec,scope);}else if(!isArray(range)){error('Unsupported range type: '+$(range));}return range.map(function(v){return(isArray(v)?parseArray:parseLiteral)(v,scope);});}function parseProjection(proj,scope){var config=scope.config.projection||{},params={};for(var name in proj){if(name==='name')continue;params[name]=parseParameter$1(proj[name],name,scope);}// apply projection defaults from config +for(var _name2 in config){if(params[_name2]==null){params[_name2]=parseParameter$1(config[_name2],_name2,scope);}}scope.addProjection(proj.name,params);}function parseParameter$1(_,name,scope){return isArray(_)?_.map(function(_){return parseParameter$1(_,name,scope);}):!isObject(_)?_:_.signal?scope.signalRef(_.signal):name==='fit'?_:error('Unsupported parameter object: '+$(_));}var Top='top';var Left='left';var Right='right';var Bottom='bottom';var Center='center';var Vertical='vertical';var Start='start';var Middle='middle';var End='end';var Index='index';var Label='label';var Offset='offset';var Perc='perc';var Perc2='perc2';var Value='value';var GuideLabelStyle='guide-label';var GuideTitleStyle='guide-title';var GroupTitleStyle='group-title';var GroupSubtitleStyle='group-subtitle';/** All values of LegendType */var Symbols='symbol';var Gradient='gradient';var Discrete='discrete';var Size='size';var Shape='shape';var Fill='fill';var Stroke='stroke';var StrokeWidth='strokeWidth';var StrokeDash='strokeDash';var Opacity='opacity';// Encoding channels supported by legends +// In priority order of 'canonical' scale +var LegendScales=[Size,Shape,Fill,Stroke,StrokeWidth,StrokeDash,Opacity];var Skip={name:1,style:1,interactive:1};var zero={value:0};var one={value:1};var GroupMark='group';var RectMark='rect';var RuleMark='rule';var SymbolMark='symbol';var TextMark='text';function guideGroup(mark){mark.type=GroupMark;mark.interactive=mark.interactive||false;return mark;}function lookup(spec,config){var _=function _(name,dflt){return value(spec[name],value(config[name],dflt));};_.isVertical=function(s){return Vertical===value(spec.direction,config.direction||(s?config.symbolDirection:config.gradientDirection));};_.gradientLength=function(){return value(spec.gradientLength,config.gradientLength||config.gradientWidth);};_.gradientThickness=function(){return value(spec.gradientThickness,config.gradientThickness||config.gradientHeight);};_.entryColumns=function(){return value(spec.columns,value(config.columns,+_.isVertical(true)));};return _;}function getEncoding(name,encode){var v=encode&&(encode.update&&encode.update[name]||encode.enter&&encode.enter[name]);return v&&v.signal?v:v?v.value:null;}function getStyle(name,scope,style){var s=scope.config.style[style];return s&&s[name];}function anchorExpr(s,e,m){return"item.anchor === '".concat(Start,"' ? ").concat(s," : item.anchor === '").concat(End,"' ? ").concat(e," : ").concat(m);}var alignExpr$1=anchorExpr($(Left),$(Right),$(Center));function tickBand(_){var v=_('tickBand');var offset=_('tickOffset'),band,extra;if(!v){// if no tick band entry, fall back on other properties +band=_('bandPosition');extra=_('tickExtra');}else if(v.signal){// if signal, augment code to interpret values +band={signal:"(".concat(v.signal,") === 'extent' ? 1 : 0.5")};extra={signal:"(".concat(v.signal,") === 'extent'")};if(!isObject(offset)){offset={signal:"(".concat(v.signal,") === 'extent' ? 0 : ").concat(offset)};}}else if(v==='extent'){// if constant, simply set values +band=1;extra=true;offset=0;}else{band=0.5;extra=false;}return{extra:extra,band:band,offset:offset};}function extendOffset(value,offset){return!offset?value:!value?offset:!isObject(value)?{value:value,offset:offset}:Object.assign({},value,{offset:extendOffset(value.offset,offset)});}function guideMark(mark,extras){if(extras){mark.name=extras.name;mark.style=extras.style||mark.style;mark.interactive=!!extras.interactive;mark.encode=extendEncode(mark.encode,extras,Skip);}else{mark.interactive=false;}return mark;}function legendGradient(spec,scale,config,userEncode){var _=lookup(spec,config),vertical=_.isVertical(),thickness=_.gradientThickness(),length=_.gradientLength();var enter,start,stop,width,height;if(vertical){start=[0,1];stop=[0,0];width=thickness;height=length;}else{start=[0,0];stop=[1,0];width=length;height=thickness;}var encode={enter:enter={opacity:zero,x:zero,y:zero,width:encoder(width),height:encoder(height)},update:extend$1({},enter,{opacity:one,fill:{gradient:scale,start:start,stop:stop}}),exit:{opacity:zero}};addEncoders(encode,{stroke:_('gradientStrokeColor'),strokeWidth:_('gradientStrokeWidth')},{// update +opacity:_('gradientOpacity')});return guideMark({type:RectMark,role:LegendGradientRole,encode:encode},userEncode);}function legendGradientDiscrete(spec,scale,config,userEncode,dataRef){var _=lookup(spec,config),vertical=_.isVertical(),thickness=_.gradientThickness(),length=_.gradientLength();var u,v,uu,vv,adjust='';vertical?(u='y',uu='y2',v='x',vv='width',adjust='1-'):(u='x',uu='x2',v='y',vv='height');var enter={opacity:zero,fill:{scale:scale,field:Value}};enter[u]={signal:adjust+'datum.'+Perc,mult:length};enter[v]=zero;enter[uu]={signal:adjust+'datum.'+Perc2,mult:length};enter[vv]=encoder(thickness);var encode={enter:enter,update:extend$1({},enter,{opacity:one}),exit:{opacity:zero}};addEncoders(encode,{stroke:_('gradientStrokeColor'),strokeWidth:_('gradientStrokeWidth')},{// update +opacity:_('gradientOpacity')});return guideMark({type:RectMark,role:LegendBandRole,key:Value,from:dataRef,encode:encode},userEncode);}var alignExpr="datum.".concat(Perc,"<=0?\"").concat(Left,"\":datum.").concat(Perc,">=1?\"").concat(Right,"\":\"").concat(Center,"\""),baselineExpr="datum.".concat(Perc,"<=0?\"").concat(Bottom,"\":datum.").concat(Perc,">=1?\"").concat(Top,"\":\"").concat(Middle,"\"");function legendGradientLabels(spec,config,userEncode,dataRef){var _=lookup(spec,config),vertical=_.isVertical(),thickness=encoder(_.gradientThickness()),length=_.gradientLength();var overlap=_('labelOverlap'),enter,update,u,v,adjust='';var encode={enter:enter={opacity:zero},update:update={opacity:one,text:{field:Label}},exit:{opacity:zero}};addEncoders(encode,{fill:_('labelColor'),fillOpacity:_('labelOpacity'),font:_('labelFont'),fontSize:_('labelFontSize'),fontStyle:_('labelFontStyle'),fontWeight:_('labelFontWeight'),limit:value(spec.labelLimit,config.gradientLabelLimit)});if(vertical){enter.align={value:'left'};enter.baseline=update.baseline={signal:baselineExpr};u='y';v='x';adjust='1-';}else{enter.align=update.align={signal:alignExpr};enter.baseline={value:'top'};u='x';v='y';}enter[u]=update[u]={signal:adjust+'datum.'+Perc,mult:length};enter[v]=update[v]=thickness;thickness.offset=value(spec.labelOffset,config.gradientLabelOffset)||0;overlap=overlap?{separation:_('labelSeparation'),method:overlap,order:'datum.'+Index}:undefined;// type, role, style, key, dataRef, encode, extras +return guideMark({type:TextMark,role:LegendLabelRole,style:GuideLabelStyle,key:Value,from:dataRef,encode:encode,overlap:overlap},userEncode);}// userEncode is top-level, includes entries, symbols, labels +function legendSymbolGroups(spec,config,userEncode,dataRef,columns){var _=lookup(spec,config),entries=userEncode.entries,interactive=!!(entries&&entries.interactive),name=entries?entries.name:undefined,height=_('clipHeight'),symbolOffset=_('symbolOffset'),valueRef={data:'value'},xSignal="(".concat(columns,") ? datum.").concat(Offset," : datum.").concat(Size),yEncode=height?encoder(height):{field:Size},index="datum.".concat(Index),ncols="max(1, ".concat(columns,")");var encode,enter,update,nrows,sort;yEncode.mult=0.5;// -- LEGEND SYMBOLS -- +encode={enter:enter={opacity:zero,x:{signal:xSignal,mult:0.5,offset:symbolOffset},y:yEncode},update:update={opacity:one,x:enter.x,y:enter.y},exit:{opacity:zero}};var baseFill=null,baseStroke=null;if(!spec.fill){baseFill=config.symbolBaseFillColor;baseStroke=config.symbolBaseStrokeColor;}addEncoders(encode,{fill:_('symbolFillColor',baseFill),shape:_('symbolType'),size:_('symbolSize'),stroke:_('symbolStrokeColor',baseStroke),strokeDash:_('symbolDash'),strokeDashOffset:_('symbolDashOffset'),strokeWidth:_('symbolStrokeWidth')},{// update +opacity:_('symbolOpacity')});LegendScales.forEach(function(scale){if(spec[scale]){update[scale]=enter[scale]={scale:spec[scale],field:Value};}});var symbols=guideMark({type:SymbolMark,role:LegendSymbolRole,key:Value,from:valueRef,clip:height?true:undefined,encode:encode},userEncode.symbols);// -- LEGEND LABELS -- +var labelOffset=encoder(symbolOffset);labelOffset.offset=_('labelOffset');encode={enter:enter={opacity:zero,x:{signal:xSignal,offset:labelOffset},y:yEncode},update:update={opacity:one,text:{field:Label},x:enter.x,y:enter.y},exit:{opacity:zero}};addEncoders(encode,{align:_('labelAlign'),baseline:_('labelBaseline'),fill:_('labelColor'),fillOpacity:_('labelOpacity'),font:_('labelFont'),fontSize:_('labelFontSize'),fontStyle:_('labelFontStyle'),fontWeight:_('labelFontWeight'),limit:_('labelLimit')});var labels=guideMark({type:TextMark,role:LegendLabelRole,style:GuideLabelStyle,key:Value,from:valueRef,encode:encode},userEncode.labels);// -- LEGEND ENTRY GROUPS -- +encode={enter:{noBound:{value:!height},// ignore width/height in bounds calc +width:zero,height:height?encoder(height):zero,opacity:zero},exit:{opacity:zero},update:update={opacity:one,row:{signal:null},column:{signal:null}}};// annotate and sort groups to ensure correct ordering +if(_.isVertical(true)){nrows="ceil(item.mark.items.length / ".concat(ncols,")");update.row.signal="".concat(index,"%").concat(nrows);update.column.signal="floor(".concat(index," / ").concat(nrows,")");sort={field:['row',index]};}else{update.row.signal="floor(".concat(index," / ").concat(ncols,")");update.column.signal="".concat(index," % ").concat(ncols);sort={field:index};}// handle zero column case (implies infinite columns) +update.column.signal="(".concat(columns,")?").concat(update.column.signal,":").concat(index);// facet legend entries into sub-groups +dataRef={facet:{data:dataRef,name:'value',groupby:Index}};return guideGroup({role:ScopeRole,from:dataRef,encode:extendEncode(encode,entries,Skip),marks:[symbols,labels],name:name,interactive:interactive,sort:sort});}function legendSymbolLayout(spec,config){var _=lookup(spec,config);// layout parameters for legend entries +return{align:_('gridAlign'),columns:_.entryColumns(),center:{row:true,column:false},padding:{row:_('rowPadding'),column:_('columnPadding')}};}// expression logic for align, anchor, angle, and baseline calculation +var isL='item.orient === "left"',isR='item.orient === "right"',isLR="(".concat(isL," || ").concat(isR,")"),isVG="datum.vgrad && ".concat(isLR),baseline=anchorExpr('"top"','"bottom"','"middle"'),alignFlip=anchorExpr('"right"','"left"','"center"'),exprAlign="datum.vgrad && ".concat(isR," ? (").concat(alignFlip,") : (").concat(isLR," && !(datum.vgrad && ").concat(isL,")) ? \"left\" : ").concat(alignExpr$1),exprAnchor="item._anchor || (".concat(isLR," ? \"middle\" : \"start\")"),exprAngle="".concat(isVG," ? (").concat(isL," ? -90 : 90) : 0"),exprBaseline="".concat(isLR," ? (datum.vgrad ? (").concat(isR," ? \"bottom\" : \"top\") : ").concat(baseline,") : \"top\"");function legendTitle(spec,config,userEncode,dataRef){var _=lookup(spec,config);var encode={enter:{opacity:zero},update:{opacity:one,x:{field:{group:'padding'}},y:{field:{group:'padding'}}},exit:{opacity:zero}};addEncoders(encode,{orient:_('titleOrient'),_anchor:_('titleAnchor'),anchor:{signal:exprAnchor},angle:{signal:exprAngle},align:{signal:exprAlign},baseline:{signal:exprBaseline},text:spec.title,fill:_('titleColor'),fillOpacity:_('titleOpacity'),font:_('titleFont'),fontSize:_('titleFontSize'),fontStyle:_('titleFontStyle'),fontWeight:_('titleFontWeight'),limit:_('titleLimit'),lineHeight:_('titleLineHeight')},{// require update +align:_('titleAlign'),baseline:_('titleBaseline')});return guideMark({type:TextMark,role:LegendTitleRole,style:GuideTitleStyle,from:dataRef,encode:encode},userEncode);}function clip(clip,scope){var expr;if(isObject(clip)){if(clip.signal){expr=clip.signal;}else if(clip.path){expr='pathShape('+param(clip.path)+')';}else if(clip.sphere){expr='geoShape('+param(clip.sphere)+', {type: "Sphere"})';}}return expr?scope.signalRef(expr):!!clip;}function param(value){return isObject(value)&&value.signal?value.signal:$(value);}function getRole(spec){var role=spec.role||'';return role.startsWith('axis')||role.startsWith('legend')||role.startsWith('title')?role:spec.type===GroupMark?ScopeRole:role||MarkRole;}function definition(spec){return{marktype:spec.type,name:spec.name||undefined,role:spec.role||getRole(spec),zindex:+spec.zindex||undefined,aria:spec.aria,description:spec.description};}function interactive(spec,scope){return spec&&spec.signal?scope.signalRef(spec.signal):spec===false?false:true;}/** + * Parse a data transform specification. + */function parseTransform(spec,scope){var def=definition$1(spec.type);if(!def)error('Unrecognized transform type: '+$(spec.type));var t=entry(def.type.toLowerCase(),null,parseParameters(def,spec,scope));if(spec.signal)scope.addSignal(spec.signal,scope.proxy(t));t.metadata=def.metadata||{};return t;}/** + * Parse all parameters of a data transform. + */function parseParameters(def,spec,scope){var params={},n=def.params.length;for(var _i67=0;_i67<n;++_i67){var pdef=def.params[_i67];params[pdef.name]=parseParameter(pdef,spec,scope);}return params;}/** + * Parse a data transform parameter. + */function parseParameter(def,spec,scope){var type=def.type,value=spec[def.name];if(type==='index'){return parseIndexParameter(def,spec,scope);}else if(value===undefined){if(def.required){error('Missing required '+$(spec.type)+' parameter: '+$(def.name));}return;}else if(type==='param'){return parseSubParameters(def,spec,scope);}else if(type==='projection'){return scope.projectionRef(spec[def.name]);}return def.array&&!isSignal(value)?value.map(function(v){return parameterValue(def,v,scope);}):parameterValue(def,value,scope);}/** + * Parse a single parameter value. + */function parameterValue(def,value,scope){var type=def.type;if(isSignal(value)){return isExpr(type)?error('Expression references can not be signals.'):isField(type)?scope.fieldRef(value):isCompare(type)?scope.compareRef(value):scope.signalRef(value.signal);}else{var _expr=def.expr||isField(type);return _expr&&outerExpr(value)?scope.exprRef(value.expr,value.as):_expr&&outerField(value)?fieldRef$1(value.field,value.as):isExpr(type)?parser(value,scope):isData(type)?ref(scope.getData(value).values):isField(type)?fieldRef$1(value):isCompare(type)?scope.compareRef(value):value;}}/** + * Parse parameter for accessing an index of another data set. + */function parseIndexParameter(def,spec,scope){if(!isString(spec.from)){error('Lookup "from" parameter must be a string literal.');}return scope.getData(spec.from).lookupRef(scope,spec.key);}/** + * Parse a parameter that contains one or more sub-parameter objects. + */function parseSubParameters(def,spec,scope){var value=spec[def.name];if(def.array){if(!isArray(value)){// signals not allowed! +error('Expected an array of sub-parameters. Instead: '+$(value));}return value.map(function(v){return parseSubParameter(def,v,scope);});}else{return parseSubParameter(def,value,scope);}}/** + * Parse a sub-parameter object. + */function parseSubParameter(def,value,scope){var n=def.params.length;var pdef;// loop over defs to find matching key +for(var _i68=0;_i68<n;++_i68){pdef=def.params[_i68];for(var k in pdef.key){if(pdef.key[k]!==value[k]){pdef=null;break;}}if(pdef)break;}// raise error if matching key not found +if(!pdef)error('Unsupported parameter: '+$(value));// parse params, create Params transform, return ref +var params=extend$1(parseParameters(pdef,value,scope),pdef.key);return ref(scope.add(Params(params)));}// -- Utilities ----- +var outerExpr=function outerExpr(_){return _&&_.expr;};var outerField=function outerField(_){return _&&_.field;};var isData=function isData(_){return _==='data';};var isExpr=function isExpr(_){return _==='expr';};var isField=function isField(_){return _==='field';};var isCompare=function isCompare(_){return _==='compare';};function parseData$1(from,group,scope){var facet,key,op,dataRef,parent;// if no source data, generate singleton datum +if(!from){dataRef=ref(scope.add(Collect(null,[{}])));}// if faceted, process facet specification +else if(facet=from.facet){if(!group)error('Only group marks can be faceted.');// use pre-faceted source data, if available +if(facet.field!=null){dataRef=parent=getDataRef(facet,scope);}else{// generate facet aggregates if no direct data specification +if(!from.data){op=parseTransform(extend$1({type:'aggregate',groupby:array$5(facet.groupby)},facet.aggregate),scope);op.params.key=scope.keyRef(facet.groupby);op.params.pulse=getDataRef(facet,scope);dataRef=parent=ref(scope.add(op));}else{parent=ref(scope.getData(from.data).aggregate);}key=scope.keyRef(facet.groupby,true);}}// if not yet defined, get source data reference +if(!dataRef){dataRef=getDataRef(from,scope);}return{key:key,pulse:dataRef,parent:parent};}function getDataRef(from,scope){return from.$ref?from:from.data&&from.data.$ref?from.data:ref(scope.getData(from.data).output);}function DataScope(scope,input,output,values,aggr){this.scope=scope;// parent scope object +this.input=input;// first operator in pipeline (tuple input) +this.output=output;// last operator in pipeline (tuple output) +this.values=values;// operator for accessing tuples (but not tuple flow) +// last aggregate in transform pipeline +this.aggregate=aggr;// lookup table of field indices +this.index={};}DataScope.fromEntries=function(scope,entries){var n=entries.length,values=entries[n-1],output=entries[n-2];var input=entries[0],aggr=null,i=1;if(input&&input.type==='load'){input=entries[1];}// add operator entries to this scope, wire up pulse chain +scope.add(entries[0]);for(;i<n;++i){entries[i].params.pulse=ref(entries[i-1]);scope.add(entries[i]);if(entries[i].type==='aggregate')aggr=entries[i];}return new DataScope(scope,input,output,values,aggr);};function fieldKey(field){return isString(field)?field:null;}function addSortField(scope,p,sort){var as=aggrField(sort.op,sort.field);var s;if(p.ops){for(var _i69=0,n=p.as.length;_i69<n;++_i69){if(p.as[_i69]===as)return;}}else{p.ops=['count'];p.fields=[null];p.as=['count'];}if(sort.op){p.ops.push((s=sort.op.signal)?scope.signalRef(s):sort.op);p.fields.push(scope.fieldRef(sort.field));p.as.push(as);}}function cache(scope,ds,name,optype,field,counts,index){var cache=ds[name]||(ds[name]={}),sort=sortKey(counts);var k=fieldKey(field),v,op;if(k!=null){scope=ds.scope;k=k+(sort?'|'+sort:'');v=cache[k];}if(!v){var _params2=counts?{field:keyFieldRef,pulse:ds.countsRef(scope,field,counts)}:{field:scope.fieldRef(field),pulse:ref(ds.output)};if(sort)_params2.sort=scope.sortRef(counts);op=scope.add(entry(optype,undefined,_params2));if(index)ds.index[field]=op;v=ref(op);if(k!=null)cache[k]=v;}return v;}DataScope.prototype={countsRef:function countsRef(scope,field,sort){var ds=this,cache=ds.counts||(ds.counts={}),k=fieldKey(field);var v,a,p;if(k!=null){scope=ds.scope;v=cache[k];}if(!v){p={groupby:scope.fieldRef(field,'key'),pulse:ref(ds.output)};if(sort&&sort.field)addSortField(scope,p,sort);a=scope.add(Aggregate(p));v=scope.add(Collect({pulse:ref(a)}));v={agg:a,ref:ref(v)};if(k!=null)cache[k]=v;}else if(sort&&sort.field){addSortField(scope,v.agg.params,sort);}return v.ref;},tuplesRef:function tuplesRef(){return ref(this.values);},extentRef:function extentRef(scope,field){return cache(scope,this,'extent','extent',field,false);},domainRef:function domainRef(scope,field){return cache(scope,this,'domain','values',field,false);},valuesRef:function valuesRef(scope,field,sort){return cache(scope,this,'vals','values',field,sort||true);},lookupRef:function lookupRef(scope,field){return cache(scope,this,'lookup','tupleindex',field,false);},indataRef:function indataRef(scope,field){return cache(scope,this,'indata','tupleindex',field,true,true);}};function parseFacet(spec,scope,group){var facet=spec.from.facet,name=facet.name,data=getDataRef(facet,scope);var op;if(!facet.name){error('Facet must have a name: '+$(facet));}if(!facet.data){error('Facet must reference a data set: '+$(facet));}if(facet.field){op=scope.add(PreFacet({field:scope.fieldRef(facet.field),pulse:data}));}else if(facet.groupby){op=scope.add(Facet({key:scope.keyRef(facet.groupby),group:ref(scope.proxy(group.parent)),pulse:data}));}else{error('Facet must specify groupby or field: '+$(facet));}// initialize facet subscope +var subscope=scope.fork(),source=subscope.add(Collect()),values=subscope.add(Sieve({pulse:ref(source)}));subscope.addData(name,new DataScope(subscope,source,source,values));subscope.addSignal('parent',null);// parse faceted subflow +op.params.subflow={$subflow:subscope.parse(spec).toRuntime()};}function parseSubflow(spec,scope,input){var op=scope.add(PreFacet({pulse:input.pulse})),subscope=scope.fork();subscope.add(Sieve());subscope.addSignal('parent',null);// parse group mark subflow +op.params.subflow={$subflow:subscope.parse(spec).toRuntime()};}function parseTrigger(spec,scope,name){var remove=spec.remove,insert=spec.insert,toggle=spec.toggle,modify=spec.modify,values=spec.values,op=scope.add(operator());var update='if('+spec.trigger+',modify("'+name+'",'+[insert,remove,toggle,modify,values].map(function(_){return _==null?'null':_;}).join(',')+'),0)';var expr=parser(update,scope);op.update=expr.$expr;op.params=expr.$params;}function parseMark(spec,scope){var role=getRole(spec),group=spec.type===GroupMark,facet=spec.from&&spec.from.facet,overlap=spec.overlap;var layout=spec.layout||role===ScopeRole||role===FrameRole,ops,op,store,enc,name,layoutRef,boundRef;var nested=role===MarkRole||layout||facet;// resolve input data +var input=parseData$1(spec.from,group,scope);// data join to map tuples to visual items +op=scope.add(DataJoin({key:input.key||(spec.key?fieldRef$1(spec.key):undefined),pulse:input.pulse,clean:!group}));var joinRef=ref(op);// collect visual items +op=store=scope.add(Collect({pulse:joinRef}));// connect visual items to scenegraph +op=scope.add(Mark({markdef:definition(spec),interactive:interactive(spec.interactive,scope),clip:clip(spec.clip,scope),context:{$context:true},groups:scope.lookup(),parent:scope.signals.parent?scope.signalRef('parent'):null,index:scope.markpath(),pulse:ref(op)}));var markRef=ref(op);// add visual encoders +op=enc=scope.add(Encode(parseEncode(spec.encode,spec.type,role,spec.style,scope,{mod:false,pulse:markRef})));// monitor parent marks to propagate changes +op.params.parent=scope.encode();// add post-encoding transforms, if defined +if(spec.transform){spec.transform.forEach(function(_){var tx=parseTransform(_,scope),md=tx.metadata;if(md.generates||md.changes){error('Mark transforms should not generate new data.');}if(!md.nomod)enc.params.mod=true;// update encode mod handling +tx.params.pulse=ref(op);scope.add(op=tx);});}// if item sort specified, perform post-encoding +if(spec.sort){op=scope.add(SortItems({sort:scope.compareRef(spec.sort),pulse:ref(op)}));}var encodeRef=ref(op);// add view layout operator if needed +if(facet||layout){layout=scope.add(ViewLayout({layout:scope.objectProperty(spec.layout),legends:scope.legends,mark:markRef,pulse:encodeRef}));layoutRef=ref(layout);}// compute bounding boxes +var bound=scope.add(Bound({mark:markRef,pulse:layoutRef||encodeRef}));boundRef=ref(bound);// if group mark, recurse to parse nested content +if(group){// juggle layout & bounds to ensure they run *after* any faceting transforms +if(nested){ops=scope.operators;ops.pop();if(layout)ops.pop();}scope.pushState(encodeRef,layoutRef||boundRef,joinRef);facet?parseFacet(spec,scope,input)// explicit facet +:nested?parseSubflow(spec,scope,input)// standard mark group +:scope.parse(spec);// guide group, we can avoid nested scopes +scope.popState();if(nested){if(layout)ops.push(layout);ops.push(bound);}}// if requested, add overlap removal transform +if(overlap){boundRef=parseOverlap(overlap,boundRef,scope);}// render / sieve items +var render=scope.add(Render({pulse:boundRef})),sieve=scope.add(Sieve({pulse:ref(render)},undefined,scope.parent()));// if mark is named, make accessible as reactive geometry +// add trigger updates if defined +if(spec.name!=null){name=spec.name;scope.addData(name,new DataScope(scope,store,render,sieve));if(spec.on)spec.on.forEach(function(on){if(on.insert||on.remove||on.toggle){error('Marks only support modify triggers.');}parseTrigger(on,scope,name);});}}function parseOverlap(overlap,source,scope){var method=overlap.method,bound=overlap.bound,sep=overlap.separation;var params={separation:isSignal(sep)?scope.signalRef(sep.signal):sep,method:isSignal(method)?scope.signalRef(method.signal):method,pulse:source};if(overlap.order){params.sort=scope.compareRef({field:overlap.order});}if(bound){var tol=bound.tolerance;params.boundTolerance=isSignal(tol)?scope.signalRef(tol.signal):+tol;params.boundScale=scope.scaleRef(bound.scale);params.boundOrient=bound.orient;}return ref(scope.add(Overlap(params)));}function parseLegend(spec,scope){var config=scope.config.legend,encode=spec.encode||{},_=lookup(spec,config),legendEncode=encode.legend||{},name=legendEncode.name||undefined,interactive=legendEncode.interactive,style=legendEncode.style,scales={};var scale=0,entryLayout,params,children;// resolve scales and 'canonical' scale name +LegendScales.forEach(function(s){return spec[s]?(scales[s]=spec[s],scale=scale||spec[s]):0;});if(!scale)error('Missing valid scale for legend.');// resolve legend type (symbol, gradient, or discrete gradient) +var type=legendType(spec,scope.scaleType(scale));// single-element data source for legend group +var datum={title:spec.title!=null,scales:scales,type:type,vgrad:type!=='symbol'&&_.isVertical()};var dataRef=ref(scope.add(Collect(null,[datum])));// encoding properties for legend entry sub-group +var entryEncode={enter:{x:{value:0},y:{value:0}}};// data source for legend values +var entryRef=ref(scope.add(LegendEntries(params={type:type,scale:scope.scaleRef(scale),count:scope.objectProperty(_('tickCount')),limit:scope.property(_('symbolLimit')),values:scope.objectProperty(spec.values),minstep:scope.property(spec.tickMinStep),formatType:scope.property(spec.formatType),formatSpecifier:scope.property(spec.format)})));// continuous gradient legend +if(type===Gradient){children=[legendGradient(spec,scale,config,encode.gradient),legendGradientLabels(spec,config,encode.labels,entryRef)];// adjust default tick count based on the gradient length +params.count=params.count||scope.signalRef("max(2,2*floor((".concat(deref(_.gradientLength()),")/100))"));}// discrete gradient legend +else if(type===Discrete){children=[legendGradientDiscrete(spec,scale,config,encode.gradient,entryRef),legendGradientLabels(spec,config,encode.labels,entryRef)];}// symbol legend +else{// determine legend symbol group layout +entryLayout=legendSymbolLayout(spec,config);children=[legendSymbolGroups(spec,config,encode,entryRef,deref(entryLayout.columns))];// pass symbol size information to legend entry generator +params.size=sizeExpression(spec,scope,children[0].marks);}// generate legend marks +children=[guideGroup({role:LegendEntryRole,from:dataRef,encode:entryEncode,marks:children,layout:entryLayout,interactive:interactive})];// include legend title if defined +if(datum.title){children.push(legendTitle(spec,config,encode.title,dataRef));}// parse legend specification +return parseMark(guideGroup({role:LegendRole,from:dataRef,encode:extendEncode(buildLegendEncode(_,spec,config),legendEncode,Skip),marks:children,aria:_('aria'),description:_('description'),zindex:_('zindex'),name:name,interactive:interactive,style:style}),scope);}function legendType(spec,scaleType){var type=spec.type||Symbols;if(!spec.type&&scaleCount(spec)===1&&(spec.fill||spec.stroke)){type=isContinuous(scaleType)?Gradient:isDiscretizing(scaleType)?Discrete:Symbols;}return type!==Gradient?type:isDiscretizing(scaleType)?Discrete:Gradient;}function scaleCount(spec){return LegendScales.reduce(function(count,type){return count+(spec[type]?1:0);},0);}function buildLegendEncode(_,spec,config){var encode={enter:{},update:{}};addEncoders(encode,{orient:_('orient'),offset:_('offset'),padding:_('padding'),titlePadding:_('titlePadding'),cornerRadius:_('cornerRadius'),fill:_('fillColor'),stroke:_('strokeColor'),strokeWidth:config.strokeWidth,strokeDash:config.strokeDash,x:_('legendX'),y:_('legendY'),// accessibility support +format:spec.format,formatType:spec.formatType});return encode;}function sizeExpression(spec,scope,marks){var size=deref(getChannel('size',spec,marks)),strokeWidth=deref(getChannel('strokeWidth',spec,marks)),fontSize=deref(getFontSize(marks[1].encode,scope,GuideLabelStyle));return parser("max(ceil(sqrt(".concat(size,")+").concat(strokeWidth,"),").concat(fontSize,")"),scope);}function getChannel(name,spec,marks){return spec[name]?"scale(\"".concat(spec[name],"\",datum)"):getEncoding(name,marks[0].encode);}function getFontSize(encode,scope,style){return getEncoding('fontSize',encode)||getStyle('fontSize',scope,style);}var angleExpr="item.orient===\"".concat(Left,"\"?-90:item.orient===\"").concat(Right,"\"?90:0");function parseTitle(spec,scope){spec=isString(spec)?{text:spec}:spec;var _=lookup(spec,scope.config.title),encode=spec.encode||{},userEncode=encode.group||{},name=userEncode.name||undefined,interactive=userEncode.interactive,style=userEncode.style,children=[];// single-element data source for group title +var datum={},dataRef=ref(scope.add(Collect(null,[datum])));// include title text +children.push(buildTitle(spec,_,titleEncode(spec),dataRef));// include subtitle text +if(spec.subtitle){children.push(buildSubTitle(spec,_,encode.subtitle,dataRef));}// parse title specification +return parseMark(guideGroup({role:TitleRole,from:dataRef,encode:groupEncode(_,userEncode),marks:children,aria:_('aria'),description:_('description'),zindex:_('zindex'),name:name,interactive:interactive,style:style}),scope);}// provide backwards-compatibility for title custom encode; +// the top-level encode block has been *deprecated*. +function titleEncode(spec){var encode=spec.encode;return encode&&encode.title||extend$1({name:spec.name,interactive:spec.interactive,style:spec.style},encode);}function groupEncode(_,userEncode){var encode={enter:{},update:{}};addEncoders(encode,{orient:_('orient'),anchor:_('anchor'),align:{signal:alignExpr$1},angle:{signal:angleExpr},limit:_('limit'),frame:_('frame'),offset:_('offset')||0,padding:_('subtitlePadding')});return extendEncode(encode,userEncode,Skip);}function buildTitle(spec,_,userEncode,dataRef){var zero={value:0},text=spec.text,encode={enter:{opacity:zero},update:{opacity:{value:1}},exit:{opacity:zero}};addEncoders(encode,{text:text,align:{signal:'item.mark.group.align'},angle:{signal:'item.mark.group.angle'},limit:{signal:'item.mark.group.limit'},baseline:'top',dx:_('dx'),dy:_('dy'),fill:_('color'),font:_('font'),fontSize:_('fontSize'),fontStyle:_('fontStyle'),fontWeight:_('fontWeight'),lineHeight:_('lineHeight')},{// update +align:_('align'),angle:_('angle'),baseline:_('baseline')});return guideMark({type:TextMark,role:TitleTextRole,style:GroupTitleStyle,from:dataRef,encode:encode},userEncode);}function buildSubTitle(spec,_,userEncode,dataRef){var zero={value:0},text=spec.subtitle,encode={enter:{opacity:zero},update:{opacity:{value:1}},exit:{opacity:zero}};addEncoders(encode,{text:text,align:{signal:'item.mark.group.align'},angle:{signal:'item.mark.group.angle'},limit:{signal:'item.mark.group.limit'},baseline:'top',dx:_('dx'),dy:_('dy'),fill:_('subtitleColor'),font:_('subtitleFont'),fontSize:_('subtitleFontSize'),fontStyle:_('subtitleFontStyle'),fontWeight:_('subtitleFontWeight'),lineHeight:_('subtitleLineHeight')},{// update +align:_('align'),angle:_('angle'),baseline:_('baseline')});return guideMark({type:TextMark,role:TitleSubtitleRole,style:GroupSubtitleStyle,from:dataRef,encode:encode},userEncode);}function parseData(data,scope){var transforms=[];if(data.transform){data.transform.forEach(function(tx){transforms.push(parseTransform(tx,scope));});}if(data.on){data.on.forEach(function(on){parseTrigger(on,scope,data.name);});}scope.addDataPipeline(data.name,analyze(data,scope,transforms));}/** + * Analyze a data pipeline, add needed operators. + */function analyze(data,scope,ops){var output=[];var source=null,modify=false,generate=false,upstream,i,n,t,m;if(data.values){// hard-wired input data set +if(isSignal(data.values)||hasSignal(data.format)){// if either values is signal or format has signal, use dynamic loader +output.push(load(scope,data));output.push(source=collect());}else{// otherwise, ingest upon dataflow init +output.push(source=collect({$ingest:data.values,$format:data.format}));}}else if(data.url){// load data from external source +if(hasSignal(data.url)||hasSignal(data.format)){// if either url or format has signal, use dynamic loader +output.push(load(scope,data));output.push(source=collect());}else{// otherwise, request load upon dataflow init +output.push(source=collect({$request:data.url,$format:data.format}));}}else if(data.source){// derives from one or more other data sets +source=upstream=array$5(data.source).map(function(d){return ref(scope.getData(d).output);});output.push(null);// populate later +}// scan data transforms, add collectors as needed +for(i=0,n=ops.length;i<n;++i){t=ops[i];m=t.metadata;if(!source&&!m.source){output.push(source=collect());}output.push(t);if(m.generates)generate=true;if(m.modifies&&!generate)modify=true;if(m.source)source=t;else if(m.changes)source=null;}if(upstream){n=upstream.length-1;output[0]=Relay({derive:modify,pulse:n?upstream:upstream[0]});if(modify||n){// collect derived and multi-pulse tuples +output.splice(1,0,collect());}}if(!source)output.push(collect());output.push(Sieve({}));return output;}function collect(values){var s=Collect({},values);s.metadata={source:true};return s;}function load(scope,data){return Load({url:data.url?scope.property(data.url):undefined,async:data.async?scope.property(data.async):undefined,values:data.values?scope.property(data.values):undefined,format:scope.objectProperty(data.format)});}var isX=function isX(orient){return orient===Bottom||orient===Top;};// get sign coefficient based on axis orient +var getSign=function getSign(orient,a,b){return isSignal(orient)?ifLeftTopExpr(orient.signal,a,b):orient===Left||orient===Top?a:b;};// condition on axis x-direction +var ifX=function ifX(orient,a,b){return isSignal(orient)?ifXEnc(orient.signal,a,b):isX(orient)?a:b;};// condition on axis y-direction +var ifY=function ifY(orient,a,b){return isSignal(orient)?ifYEnc(orient.signal,a,b):isX(orient)?b:a;};var ifTop=function ifTop(orient,a,b){return isSignal(orient)?ifTopExpr(orient.signal,a,b):orient===Top?{value:a}:{value:b};};var ifRight=function ifRight(orient,a,b){return isSignal(orient)?ifRightExpr(orient.signal,a,b):orient===Right?{value:a}:{value:b};};var ifXEnc=function ifXEnc($orient,a,b){return ifEnc("".concat($orient," === '").concat(Top,"' || ").concat($orient," === '").concat(Bottom,"'"),a,b);};var ifYEnc=function ifYEnc($orient,a,b){return ifEnc("".concat($orient," !== '").concat(Top,"' && ").concat($orient," !== '").concat(Bottom,"'"),a,b);};var ifLeftTopExpr=function ifLeftTopExpr($orient,a,b){return ifExpr("".concat($orient," === '").concat(Left,"' || ").concat($orient," === '").concat(Top,"'"),a,b);};var ifTopExpr=function ifTopExpr($orient,a,b){return ifExpr("".concat($orient," === '").concat(Top,"'"),a,b);};var ifRightExpr=function ifRightExpr($orient,a,b){return ifExpr("".concat($orient," === '").concat(Right,"'"),a,b);};var ifEnc=function ifEnc(test,a,b){// ensure inputs are encoder objects (or null) +a=a!=null?encoder(a):a;b=b!=null?encoder(b):b;if(isSimple(a)&&isSimple(b)){// if possible generate simple signal expression +a=a?a.signal||$(a.value):null;b=b?b.signal||$(b.value):null;return{signal:"".concat(test," ? (").concat(a,") : (").concat(b,")")};}else{// otherwise generate rule set +return[extend$1({test:test},a)].concat(b||[]);}};var isSimple=function isSimple(enc){return enc==null||Object.keys(enc).length===1;};var ifExpr=function ifExpr(test,a,b){return{signal:"".concat(test," ? (").concat(toExpr(a),") : (").concat(toExpr(b),")")};};var ifOrient=function ifOrient($orient,t,b,l,r){return{signal:(l!=null?"".concat($orient," === '").concat(Left,"' ? (").concat(toExpr(l),") : "):'')+(b!=null?"".concat($orient," === '").concat(Bottom,"' ? (").concat(toExpr(b),") : "):'')+(r!=null?"".concat($orient," === '").concat(Right,"' ? (").concat(toExpr(r),") : "):'')+(t!=null?"".concat($orient," === '").concat(Top,"' ? (").concat(toExpr(t),") : "):'')+'(null)'};};var toExpr=function toExpr(v){return isSignal(v)?v.signal:v==null?null:$(v);};var mult=function mult(sign,value){return value===0?0:isSignal(sign)?{signal:"(".concat(sign.signal,") * ").concat(value)}:{value:sign*value};};var patch=function patch(value,base){var s=value.signal;return s&&s.endsWith('(null)')?{signal:s.slice(0,-6)+base.signal}:value;};function fallback(prop,config,axisConfig,style){var styleProp;if(config&&has$1(config,prop)){return config[prop];}else if(has$1(axisConfig,prop)){return axisConfig[prop];}else if(prop.startsWith('title')){switch(prop){case'titleColor':styleProp='fill';break;case'titleFont':case'titleFontSize':case'titleFontWeight':styleProp=prop[5].toLowerCase()+prop.slice(6);}return style[GuideTitleStyle][styleProp];}else if(prop.startsWith('label')){switch(prop){case'labelColor':styleProp='fill';break;case'labelFont':case'labelFontSize':styleProp=prop[5].toLowerCase()+prop.slice(6);}return style[GuideLabelStyle][styleProp];}return null;}function keys(objects){var map={};var _iterator33=_createForOfIteratorHelper(objects),_step33;try{for(_iterator33.s();!(_step33=_iterator33.n()).done;){var obj=_step33.value;if(!obj)continue;for(var _key27 in obj)map[_key27]=1;}}catch(err){_iterator33.e(err);}finally{_iterator33.f();}return Object.keys(map);}function axisConfig(spec,scope){var config=scope.config,style=config.style,axis=config.axis,band=scope.scaleType(spec.scale)==='band'&&config.axisBand,orient=spec.orient,xy,or,key;if(isSignal(orient)){var xyKeys=keys([config.axisX,config.axisY]),orientKeys=keys([config.axisTop,config.axisBottom,config.axisLeft,config.axisRight]);xy={};var _iterator34=_createForOfIteratorHelper(xyKeys),_step34;try{for(_iterator34.s();!(_step34=_iterator34.n()).done;){key=_step34.value;xy[key]=ifX(orient,fallback(key,config.axisX,axis,style),fallback(key,config.axisY,axis,style));}}catch(err){_iterator34.e(err);}finally{_iterator34.f();}or={};var _iterator35=_createForOfIteratorHelper(orientKeys),_step35;try{for(_iterator35.s();!(_step35=_iterator35.n()).done;){key=_step35.value;or[key]=ifOrient(orient.signal,fallback(key,config.axisTop,axis,style),fallback(key,config.axisBottom,axis,style),fallback(key,config.axisLeft,axis,style),fallback(key,config.axisRight,axis,style));}}catch(err){_iterator35.e(err);}finally{_iterator35.f();}}else{xy=orient===Top||orient===Bottom?config.axisX:config.axisY;or=config['axis'+orient[0].toUpperCase()+orient.slice(1)];}var result=xy||or||band?extend$1({},axis,xy,or,band):axis;return result;}function axisDomain(spec,config,userEncode,dataRef){var _=lookup(spec,config),orient=spec.orient;var enter,update;var encode={enter:enter={opacity:zero},update:update={opacity:one},exit:{opacity:zero}};addEncoders(encode,{stroke:_('domainColor'),strokeCap:_('domainCap'),strokeDash:_('domainDash'),strokeDashOffset:_('domainDashOffset'),strokeWidth:_('domainWidth'),strokeOpacity:_('domainOpacity')});var pos0=position(spec,0);var pos1=position(spec,1);enter.x=update.x=ifX(orient,pos0,zero);enter.x2=update.x2=ifX(orient,pos1);enter.y=update.y=ifY(orient,pos0,zero);enter.y2=update.y2=ifY(orient,pos1);return guideMark({type:RuleMark,role:AxisDomainRole,from:dataRef,encode:encode},userEncode);}function position(spec,pos){return{scale:spec.scale,range:pos};}function axisGrid(spec,config,userEncode,dataRef,band){var _=lookup(spec,config),orient=spec.orient,vscale=spec.gridScale,sign=getSign(orient,1,-1),offset=offsetValue(spec.offset,sign);var enter,exit,update;var encode={enter:enter={opacity:zero},update:update={opacity:one},exit:exit={opacity:zero}};addEncoders(encode,{stroke:_('gridColor'),strokeCap:_('gridCap'),strokeDash:_('gridDash'),strokeDashOffset:_('gridDashOffset'),strokeOpacity:_('gridOpacity'),strokeWidth:_('gridWidth')});var tickPos={scale:spec.scale,field:Value,band:band.band,extra:band.extra,offset:band.offset,round:_('tickRound')};var sz=ifX(orient,{signal:'height'},{signal:'width'});var gridStart=vscale?{scale:vscale,range:0,mult:sign,offset:offset}:{value:0,offset:offset};var gridEnd=vscale?{scale:vscale,range:1,mult:sign,offset:offset}:extend$1(sz,{mult:sign,offset:offset});enter.x=update.x=ifX(orient,tickPos,gridStart);enter.y=update.y=ifY(orient,tickPos,gridStart);enter.x2=update.x2=ifY(orient,gridEnd);enter.y2=update.y2=ifX(orient,gridEnd);exit.x=ifX(orient,tickPos);exit.y=ifY(orient,tickPos);return guideMark({type:RuleMark,role:AxisGridRole,key:Value,from:dataRef,encode:encode},userEncode);}function offsetValue(offset,sign){if(sign===1);else if(!isObject(offset)){offset=isSignal(sign)?{signal:"(".concat(sign.signal,") * (").concat(offset||0,")")}:sign*(offset||0);}else{var _entry=offset=extend$1({},offset);while(_entry.mult!=null){if(!isObject(_entry.mult)){_entry.mult=isSignal(sign)// no offset if sign === 1 +?{signal:"(".concat(_entry.mult,") * (").concat(sign.signal,")")}:_entry.mult*sign;return offset;}else{_entry=_entry.mult=extend$1({},_entry.mult);}}_entry.mult=sign;}return offset;}function axisTicks(spec,config,userEncode,dataRef,size,band){var _=lookup(spec,config),orient=spec.orient,sign=getSign(orient,-1,1);var enter,exit,update;var encode={enter:enter={opacity:zero},update:update={opacity:one},exit:exit={opacity:zero}};addEncoders(encode,{stroke:_('tickColor'),strokeCap:_('tickCap'),strokeDash:_('tickDash'),strokeDashOffset:_('tickDashOffset'),strokeOpacity:_('tickOpacity'),strokeWidth:_('tickWidth')});var tickSize=encoder(size);tickSize.mult=sign;var tickPos={scale:spec.scale,field:Value,band:band.band,extra:band.extra,offset:band.offset,round:_('tickRound')};update.y=enter.y=ifX(orient,zero,tickPos);update.y2=enter.y2=ifX(orient,tickSize);exit.x=ifX(orient,tickPos);update.x=enter.x=ifY(orient,zero,tickPos);update.x2=enter.x2=ifY(orient,tickSize);exit.y=ifY(orient,tickPos);return guideMark({type:RuleMark,role:AxisTickRole,key:Value,from:dataRef,encode:encode},userEncode);}function flushExpr(scale,threshold,a,b,c){return{signal:'flush(range("'+scale+'"), '+'scale("'+scale+'", datum.value), '+threshold+','+a+','+b+','+c+')'};}function axisLabels(spec,config,userEncode,dataRef,size,band){var _=lookup(spec,config),orient=spec.orient,scale=spec.scale,sign=getSign(orient,-1,1),flush=deref(_('labelFlush')),flushOffset=deref(_('labelFlushOffset')),labelAlign=_('labelAlign'),labelBaseline=_('labelBaseline');var flushOn=flush===0||!!flush,update;var tickSize=encoder(size);tickSize.mult=sign;tickSize.offset=encoder(_('labelPadding')||0);tickSize.offset.mult=sign;var tickPos={scale:scale,field:Value,band:0.5,offset:extendOffset(band.offset,_('labelOffset'))};var align=ifX(orient,flushOn?flushExpr(scale,flush,'"left"','"right"','"center"'):{value:'center'},ifRight(orient,'left','right'));var baseline=ifX(orient,ifTop(orient,'bottom','top'),flushOn?flushExpr(scale,flush,'"top"','"bottom"','"middle"'):{value:'middle'});var offsetExpr=flushExpr(scale,flush,"-(".concat(flushOffset,")"),flushOffset,0);flushOn=flushOn&&flushOffset;var enter={opacity:zero,x:ifX(orient,tickPos,tickSize),y:ifY(orient,tickPos,tickSize)};var encode={enter:enter,update:update={opacity:one,text:{field:Label},x:enter.x,y:enter.y,align:align,baseline:baseline},exit:{opacity:zero,x:enter.x,y:enter.y}};addEncoders(encode,{dx:!labelAlign&&flushOn?ifX(orient,offsetExpr):null,dy:!labelBaseline&&flushOn?ifY(orient,offsetExpr):null});addEncoders(encode,{angle:_('labelAngle'),fill:_('labelColor'),fillOpacity:_('labelOpacity'),font:_('labelFont'),fontSize:_('labelFontSize'),fontWeight:_('labelFontWeight'),fontStyle:_('labelFontStyle'),limit:_('labelLimit'),lineHeight:_('labelLineHeight')},{align:labelAlign,baseline:labelBaseline});var bound=_('labelBound');var overlap=_('labelOverlap');// if overlap method or bound defined, request label overlap removal +overlap=overlap||bound?{separation:_('labelSeparation'),method:overlap,order:'datum.index',bound:bound?{scale:scale,orient:orient,tolerance:bound}:null}:undefined;if(update.align!==align){update.align=patch(update.align,align);}if(update.baseline!==baseline){update.baseline=patch(update.baseline,baseline);}return guideMark({type:TextMark,role:AxisLabelRole,style:GuideLabelStyle,key:Value,from:dataRef,encode:encode,overlap:overlap},userEncode);}function axisTitle(spec,config,userEncode,dataRef){var _=lookup(spec,config),orient=spec.orient,sign=getSign(orient,-1,1);var enter,update;var encode={enter:enter={opacity:zero,anchor:encoder(_('titleAnchor',null)),align:{signal:alignExpr$1}},update:update=extend$1({},enter,{opacity:one,text:encoder(spec.title)}),exit:{opacity:zero}};var titlePos={signal:"lerp(range(\"".concat(spec.scale,"\"), ").concat(anchorExpr(0,1,0.5),")")};update.x=ifX(orient,titlePos);update.y=ifY(orient,titlePos);enter.angle=ifX(orient,zero,mult(sign,90));enter.baseline=ifX(orient,ifTop(orient,Bottom,Top),{value:Bottom});update.angle=enter.angle;update.baseline=enter.baseline;addEncoders(encode,{fill:_('titleColor'),fillOpacity:_('titleOpacity'),font:_('titleFont'),fontSize:_('titleFontSize'),fontStyle:_('titleFontStyle'),fontWeight:_('titleFontWeight'),limit:_('titleLimit'),lineHeight:_('titleLineHeight')},{// require update +align:_('titleAlign'),angle:_('titleAngle'),baseline:_('titleBaseline')});autoLayout(_,orient,encode,userEncode);encode.update.align=patch(encode.update.align,enter.align);encode.update.angle=patch(encode.update.angle,enter.angle);encode.update.baseline=patch(encode.update.baseline,enter.baseline);return guideMark({type:TextMark,role:AxisTitleRole,style:GuideTitleStyle,from:dataRef,encode:encode},userEncode);}function autoLayout(_,orient,encode,userEncode){var auto=function auto(value,dim){return value!=null?(encode.update[dim]=patch(encoder(value),encode.update[dim]),false):!has(dim,userEncode)?true:false;};var autoY=auto(_('titleX'),'x'),autoX=auto(_('titleY'),'y');encode.enter.auto=autoX===autoY?encoder(autoX):ifX(orient,encoder(autoX),encoder(autoY));}function parseAxis(spec,scope){var config=axisConfig(spec,scope),encode=spec.encode||{},axisEncode=encode.axis||{},name=axisEncode.name||undefined,interactive=axisEncode.interactive,style=axisEncode.style,_=lookup(spec,config),band=tickBand(_);// single-element data source for axis group +var datum={scale:spec.scale,ticks:!!_('ticks'),labels:!!_('labels'),grid:!!_('grid'),domain:!!_('domain'),title:spec.title!=null};var dataRef=ref(scope.add(Collect({},[datum])));// data source for axis ticks +var ticksRef=ref(scope.add(AxisTicks({scale:scope.scaleRef(spec.scale),extra:scope.property(band.extra),count:scope.objectProperty(spec.tickCount),values:scope.objectProperty(spec.values),minstep:scope.property(spec.tickMinStep),formatType:scope.property(spec.formatType),formatSpecifier:scope.property(spec.format)})));// generate axis marks +var children=[];var size;// include axis gridlines if requested +if(datum.grid){children.push(axisGrid(spec,config,encode.grid,ticksRef,band));}// include axis ticks if requested +if(datum.ticks){size=_('tickSize');children.push(axisTicks(spec,config,encode.ticks,ticksRef,size,band));}// include axis labels if requested +if(datum.labels){size=datum.ticks?size:0;children.push(axisLabels(spec,config,encode.labels,ticksRef,size,band));}// include axis domain path if requested +if(datum.domain){children.push(axisDomain(spec,config,encode.domain,dataRef));}// include axis title if defined +if(datum.title){children.push(axisTitle(spec,config,encode.title,dataRef));}// parse axis specification +return parseMark(guideGroup({role:AxisRole,from:dataRef,encode:extendEncode(buildAxisEncode(_,spec),axisEncode,Skip),marks:children,aria:_('aria'),description:_('description'),zindex:_('zindex'),name:name,interactive:interactive,style:style}),scope);}function buildAxisEncode(_,spec){var encode={enter:{},update:{}};addEncoders(encode,{orient:_('orient'),offset:_('offset')||0,position:value(spec.position,0),titlePadding:_('titlePadding'),minExtent:_('minExtent'),maxExtent:_('maxExtent'),range:{signal:"abs(span(range(\"".concat(spec.scale,"\")))")},translate:_('translate'),// accessibility support +format:spec.format,formatType:spec.formatType});return encode;}function parseScope(spec,scope,preprocessed){var signals=array$5(spec.signals),scales=array$5(spec.scales);// parse signal definitions, if not already preprocessed +if(!preprocessed)signals.forEach(function(_){return parseSignal(_,scope);});// parse cartographic projection definitions +array$5(spec.projections).forEach(function(_){return parseProjection(_,scope);});// initialize scale references +scales.forEach(function(_){return initScale(_,scope);});// parse data sources +array$5(spec.data).forEach(function(_){return parseData(_,scope);});// parse scale definitions +scales.forEach(function(_){return parseScale(_,scope);});// parse signal updates +(preprocessed||signals).forEach(function(_){return parseSignalUpdates(_,scope);});// parse axis definitions +array$5(spec.axes).forEach(function(_){return parseAxis(_,scope);});// parse mark definitions +array$5(spec.marks).forEach(function(_){return parseMark(_,scope);});// parse legend definitions +array$5(spec.legends).forEach(function(_){return parseLegend(_,scope);});// parse title, if defined +if(spec.title)parseTitle(spec.title,scope);// parse collected lambda (anonymous) expressions +scope.parseLambdas();return scope;}var rootEncode=function rootEncode(spec){return extendEncode({enter:{x:{value:0},y:{value:0}},update:{width:{signal:'width'},height:{signal:'height'}}},spec);};function parseView(spec,scope){var config=scope.config;// add scenegraph root +var root=ref(scope.root=scope.add(operator()));// parse top-level signal definitions +var signals=collectSignals(spec,config);signals.forEach(function(_){return parseSignal(_,scope);});// assign description, event, legend, and locale configuration +scope.description=spec.description||config.description;scope.eventConfig=config.events;scope.legends=scope.objectProperty(config.legend&&config.legend.layout);scope.locale=config.locale;// store root group item +var input=scope.add(Collect());// encode root group item +var encode=scope.add(Encode(parseEncode(rootEncode(spec.encode),GroupMark,FrameRole,spec.style,scope,{pulse:ref(input)})));// perform view layout +var parent=scope.add(ViewLayout({layout:scope.objectProperty(spec.layout),legends:scope.legends,autosize:scope.signalRef('autosize'),mark:root,pulse:ref(encode)}));scope.operators.pop();// parse remainder of specification +scope.pushState(ref(encode),ref(parent),null);parseScope(spec,scope,signals);scope.operators.push(parent);// bound / render / sieve root item +var op=scope.add(Bound({mark:root,pulse:ref(parent)}));op=scope.add(Render({pulse:ref(op)}));op=scope.add(Sieve({pulse:ref(op)}));// track metadata for root item +scope.addData('root',new DataScope(scope,input,input,op));return scope;}function signalObject(name,value){return value&&value.signal?{name:name,update:value.signal}:{name:name,value:value};}/** + * Collect top-level signals, merging values as needed. Signals + * defined in the config signals arrays are added only if that + * signal is not explicitly defined in the specification. + * Built-in signals (autosize, background, padding, width, height) + * receive special treatment. They are initialized using the + * top-level spec property, or, if undefined in the spec, using + * the corresponding top-level config property. If this property + * is a signal reference object, the signal expression maps to the + * signal 'update' property. If the spec's top-level signal array + * contains an entry that matches a built-in signal, that entry + * will be merged with the built-in specification, potentially + * overwriting existing 'value' or 'update' properties. + */function collectSignals(spec,config){var _=function _(name){return value(spec[name],config[name]);},signals=[signalObject('background',_('background')),signalObject('autosize',parseAutosize(_('autosize'))),signalObject('padding',parsePadding(_('padding'))),signalObject('width',_('width')||0),signalObject('height',_('height')||0)],pre=signals.reduce(function(p,s){return p[s.name]=s,p;},{}),map={};// add spec signal array +array$5(spec.signals).forEach(function(s){if(has$1(pre,s.name)){// merge if built-in signal +s=extend$1(pre[s.name],s);}else{// otherwise add to signal list +signals.push(s);}map[s.name]=s;});// add config signal array +array$5(config.signals).forEach(function(s){if(!has$1(map,s.name)&&!has$1(pre,s.name)){// add to signal list if not already defined +signals.push(s);}});return signals;}function Scope(config,options){this.config=config||{};this.options=options||{};this.bindings=[];this.field={};this.signals={};this.lambdas={};this.scales={};this.events={};this.data={};this.streams=[];this.updates=[];this.operators=[];this.eventConfig=null;this.locale=null;this._id=0;this._subid=0;this._nextsub=[0];this._parent=[];this._encode=[];this._lookup=[];this._markpath=[];}function Subscope(scope){this.config=scope.config;this.options=scope.options;this.legends=scope.legends;this.field=Object.create(scope.field);this.signals=Object.create(scope.signals);this.lambdas=Object.create(scope.lambdas);this.scales=Object.create(scope.scales);this.events=Object.create(scope.events);this.data=Object.create(scope.data);this.streams=[];this.updates=[];this.operators=[];this._id=0;this._subid=++scope._nextsub[0];this._nextsub=scope._nextsub;this._parent=scope._parent.slice();this._encode=scope._encode.slice();this._lookup=scope._lookup.slice();this._markpath=scope._markpath;}Scope.prototype=Subscope.prototype={parse:function parse(spec){return parseScope(spec,this);},fork:function fork(){return new Subscope(this);},isSubscope:function isSubscope(){return this._subid>0;},toRuntime:function toRuntime(){this.finish();return{description:this.description,operators:this.operators,streams:this.streams,updates:this.updates,bindings:this.bindings,eventConfig:this.eventConfig,locale:this.locale};},id:function id(){return(this._subid?this._subid+':':0)+this._id++;},add:function add(op){this.operators.push(op);op.id=this.id();// if pre-registration references exist, resolve them now +if(op.refs){op.refs.forEach(function(ref){ref.$ref=op.id;});op.refs=null;}return op;},proxy:function proxy(op){var vref=op instanceof Entry?ref(op):op;return this.add(Proxy({value:vref}));},addStream:function addStream(stream){this.streams.push(stream);stream.id=this.id();return stream;},addUpdate:function addUpdate(update){this.updates.push(update);return update;},// Apply metadata +finish:function finish(){var name,ds;// annotate root +if(this.root)this.root.root=true;// annotate signals +for(name in this.signals){this.signals[name].signal=name;}// annotate scales +for(name in this.scales){this.scales[name].scale=name;}// annotate data sets +function annotate(op,name,type){var data,list;if(op){data=op.data||(op.data={});list=data[name]||(data[name]=[]);list.push(type);}}for(name in this.data){ds=this.data[name];annotate(ds.input,name,'input');annotate(ds.output,name,'output');annotate(ds.values,name,'values');for(var _field in ds.index){annotate(ds.index[_field],name,'index:'+_field);}}return this;},// ---- +pushState:function pushState(encode,parent,lookup){this._encode.push(ref(this.add(Sieve({pulse:encode}))));this._parent.push(parent);this._lookup.push(lookup?ref(this.proxy(lookup)):null);this._markpath.push(-1);},popState:function popState(){this._encode.pop();this._parent.pop();this._lookup.pop();this._markpath.pop();},parent:function parent(){return peek$1(this._parent);},encode:function encode(){return peek$1(this._encode);},lookup:function lookup(){return peek$1(this._lookup);},markpath:function markpath(){var p=this._markpath;return++p[p.length-1];},// ---- +fieldRef:function fieldRef(field,name){if(isString(field))return fieldRef$1(field,name);if(!field.signal){error('Unsupported field reference: '+$(field));}var s=field.signal;var f=this.field[s];if(!f){var _params3={name:this.signalRef(s)};if(name)_params3.as=name;this.field[s]=f=ref(this.add(Field(_params3)));}return f;},compareRef:function compareRef(cmp){var _this28=this;var signal=false;var check=function check(_){return isSignal(_)?(signal=true,_this28.signalRef(_.signal)):isExpr$1(_)?(signal=true,_this28.exprRef(_.expr)):_;};var fields=array$5(cmp.field).map(check),orders=array$5(cmp.order).map(check);return signal?ref(this.add(Compare({fields:fields,orders:orders}))):_compareRef(fields,orders);},keyRef:function keyRef(fields,flat){var signal=false;var check=function check(_){return isSignal(_)?(signal=true,ref(sig[_.signal])):_;};var sig=this.signals;fields=array$5(fields).map(check);return signal?ref(this.add(Key({fields:fields,flat:flat}))):_keyRef(fields,flat);},sortRef:function sortRef(sort){if(!sort)return sort;// including id ensures stable sorting +var a=aggrField(sort.op,sort.field),o=sort.order||Ascending;return o.signal?ref(this.add(Compare({fields:a,orders:this.signalRef(o.signal)}))):_compareRef(a,o);},// ---- +event:function event(source,type){var key=source+':'+type;if(!this.events[key]){var _id6=this.id();this.streams.push({id:_id6,source:source,type:type});this.events[key]=_id6;}return this.events[key];},// ---- +hasOwnSignal:function hasOwnSignal(name){return has$1(this.signals,name);},addSignal:function addSignal(name,value){if(this.hasOwnSignal(name)){error('Duplicate signal name: '+$(name));}var op=value instanceof Entry?value:this.add(operator(value));return this.signals[name]=op;},getSignal:function getSignal(name){if(!this.signals[name]){error('Unrecognized signal name: '+$(name));}return this.signals[name];},signalRef:function signalRef(s){if(this.signals[s]){return ref(this.signals[s]);}else if(!has$1(this.lambdas,s)){this.lambdas[s]=this.add(operator(null));}return ref(this.lambdas[s]);},parseLambdas:function parseLambdas(){var code=Object.keys(this.lambdas);for(var _i70=0,n=code.length;_i70<n;++_i70){var s=code[_i70],e=parser(s,this),op=this.lambdas[s];op.params=e.$params;op.update=e.$expr;}},property:function property(spec){return spec&&spec.signal?this.signalRef(spec.signal):spec;},objectProperty:function objectProperty(spec){return!spec||!isObject(spec)?spec:this.signalRef(spec.signal||propertyLambda(spec));},exprRef:function exprRef(code,name){var params={expr:parser(code,this)};if(name)params.expr.$name=name;return ref(this.add(Expression(params)));},addBinding:function addBinding(name,bind){if(!this.bindings){error('Nested signals do not support binding: '+$(name));}this.bindings.push(extend$1({signal:name},bind));},// ---- +addScaleProj:function addScaleProj(name,transform){if(has$1(this.scales,name)){error('Duplicate scale or projection name: '+$(name));}this.scales[name]=this.add(transform);},addScale:function addScale(name,params){this.addScaleProj(name,Scale(params));},addProjection:function addProjection(name,params){this.addScaleProj(name,Projection(params));},getScale:function getScale(name){if(!this.scales[name]){error('Unrecognized scale name: '+$(name));}return this.scales[name];},scaleRef:function scaleRef(name){return ref(this.getScale(name));},scaleType:function scaleType(name){return this.getScale(name).params.type;},projectionRef:function projectionRef(name){return this.scaleRef(name);},projectionType:function projectionType(name){return this.scaleType(name);},// ---- +addData:function addData(name,dataScope){if(has$1(this.data,name)){error('Duplicate data set name: '+$(name));}return this.data[name]=dataScope;},getData:function getData(name){if(!this.data[name]){error('Undefined data set name: '+$(name));}return this.data[name];},addDataPipeline:function addDataPipeline(name,entries){if(has$1(this.data,name)){error('Duplicate data set name: '+$(name));}return this.addData(name,DataScope.fromEntries(this,entries));}};function propertyLambda(spec){return(isArray(spec)?arrayLambda:objectLambda)(spec);}function arrayLambda(array){var n=array.length;var code='[';for(var _i71=0;_i71<n;++_i71){var _value23=array[_i71];code+=(_i71>0?',':'')+(isObject(_value23)?_value23.signal||propertyLambda(_value23):$(_value23));}return code+']';}function objectLambda(obj){var code='{',i=0,key,value;for(key in obj){value=obj[key];code+=(++i>1?',':'')+$(key)+':'+(isObject(value)?value.signal||propertyLambda(value):$(value));}return code+'}';}/** + * Standard configuration defaults for Vega specification parsing. + * Users can provide their own (sub-)set of these default values + * by passing in a config object to the top-level parse method. + */function defaults(){var defaultFont='sans-serif',defaultSymbolSize=30,defaultStrokeWidth=2,defaultColor='#4c78a8',black='#000',gray='#888',lightGray='#ddd';return{// default visualization description +description:'Vega visualization',// default padding around visualization +padding:0,// default for automatic sizing; options: 'none', 'pad', 'fit' +// or provide an object (e.g., {'type': 'pad', 'resize': true}) +autosize:'pad',// default view background color +// covers the entire view component +background:null,// default event handling configuration +// preventDefault for view-sourced event types except 'wheel' +events:{defaults:{allow:['wheel']}},// defaults for top-level group marks +// accepts mark properties (fill, stroke, etc) +// covers the data rectangle within group width/height +group:null,// defaults for basic mark types +// each subset accepts mark properties (fill, stroke, etc) +mark:null,arc:{fill:defaultColor},area:{fill:defaultColor},image:null,line:{stroke:defaultColor,strokeWidth:defaultStrokeWidth},path:{stroke:defaultColor},rect:{fill:defaultColor},rule:{stroke:black},shape:{stroke:defaultColor},symbol:{fill:defaultColor,size:64},text:{fill:black,font:defaultFont,fontSize:11},trail:{fill:defaultColor,size:defaultStrokeWidth},// style definitions +style:{// axis & legend labels +'guide-label':{fill:black,font:defaultFont,fontSize:10},// axis & legend titles +'guide-title':{fill:black,font:defaultFont,fontSize:11,fontWeight:'bold'},// headers, including chart title +'group-title':{fill:black,font:defaultFont,fontSize:13,fontWeight:'bold'},// chart subtitle +'group-subtitle':{fill:black,font:defaultFont,fontSize:12},// defaults for styled point marks in Vega-Lite +point:{size:defaultSymbolSize,strokeWidth:defaultStrokeWidth,shape:'circle'},circle:{size:defaultSymbolSize,strokeWidth:defaultStrokeWidth},square:{size:defaultSymbolSize,strokeWidth:defaultStrokeWidth,shape:'square'},// defaults for styled group marks in Vega-Lite +cell:{fill:'transparent',stroke:lightGray},view:{fill:'transparent'}},// defaults for title +title:{orient:'top',anchor:'middle',offset:4,subtitlePadding:3},// defaults for axes +axis:{minExtent:0,maxExtent:200,bandPosition:0.5,domain:true,domainWidth:1,domainColor:gray,grid:false,gridWidth:1,gridColor:lightGray,labels:true,labelAngle:0,labelLimit:180,labelOffset:0,labelPadding:2,ticks:true,tickColor:gray,tickOffset:0,tickRound:true,tickSize:5,tickWidth:1,titlePadding:4},// correction for centering bias +axisBand:{tickOffset:-0.5},// defaults for cartographic projection +projection:{type:'mercator'},// defaults for legends +legend:{orient:'right',padding:0,gridAlign:'each',columnPadding:10,rowPadding:2,symbolDirection:'vertical',gradientDirection:'vertical',gradientLength:200,gradientThickness:16,gradientStrokeColor:lightGray,gradientStrokeWidth:0,gradientLabelOffset:2,labelAlign:'left',labelBaseline:'middle',labelLimit:160,labelOffset:4,labelOverlap:true,symbolLimit:30,symbolType:'circle',symbolSize:100,symbolOffset:0,symbolStrokeWidth:1.5,symbolBaseFillColor:'transparent',symbolBaseStrokeColor:gray,titleLimit:180,titleOrient:'top',titlePadding:5,layout:{offset:18,direction:'horizontal',left:{direction:'vertical'},right:{direction:'vertical'}}},// defaults for scale ranges +range:{category:{scheme:'tableau10'},ordinal:{scheme:'blues'},heatmap:{scheme:'yellowgreenblue'},ramp:{scheme:'blues'},diverging:{scheme:'blueorange',extent:[1,0]},symbol:['circle','square','triangle-up','cross','diamond','triangle-right','triangle-down','triangle-left']}};}function parse(spec,config,options){if(!isObject(spec)){error('Input Vega specification must be an object.');}config=mergeConfig(defaults(),config,spec.config);return parseView(spec,new Scope(config,options)).toRuntime();}// -- Transforms ----- +extend$1(transforms,tx,vtx,encode$1,geo,force,label,tree,reg,voronoi,wordcloud,xf);var version=version$1;exports.Bounds=Bounds;exports.CanvasHandler=CanvasHandler;exports.CanvasRenderer=CanvasRenderer;exports.DATE=DATE;exports.DAY=DAY;exports.DAYOFYEAR=DAYOFYEAR;exports.Dataflow=Dataflow;exports.Debug=Debug;exports.Error=Error$1;exports.EventStream=EventStream;exports.Gradient=Gradient$1;exports.GroupItem=GroupItem;exports.HOURS=HOURS;exports.Handler=Handler;exports.HybridHandler=HybridHandler;exports.HybridRenderer=HybridRenderer;exports.Info=Info;exports.Item=Item;exports.MILLISECONDS=MILLISECONDS;exports.MINUTES=MINUTES;exports.MONTH=MONTH;exports.Marks=Marks;exports.MultiPulse=MultiPulse;exports.None=None$2;exports.Operator=Operator;exports.Parameters=Parameters;exports.Pulse=Pulse;exports.QUARTER=QUARTER;exports.RenderType=RenderType;exports.Renderer=Renderer;exports.ResourceLoader=ResourceLoader;exports.SECONDS=SECONDS;exports.SVGHandler=SVGHandler;exports.SVGRenderer=SVGRenderer;exports.SVGStringRenderer=SVGStringRenderer;exports.Scenegraph=Scenegraph;exports.TIME_UNITS=TIME_UNITS;exports.Transform=Transform;exports.View=View$1;exports.WEEK=WEEK;exports.Warn=Warn;exports.YEAR=YEAR;exports.accessor=accessor;exports.accessorFields=accessorFields;exports.accessorName=accessorName;exports.array=array$5;exports.ascending=ascending$2;exports.bandwidthNRD=estimateBandwidth;exports.bin=bin;exports.bootstrapCI=bootstrapCI;exports.boundClip=boundClip;exports.boundContext=boundContext;exports.boundItem=boundItem$1;exports.boundMark=boundMark;exports.boundStroke=boundStroke;exports.changeset=changeset;exports.clampRange=clampRange;exports.codegenExpression=codegen;exports.compare=compare$1;exports.constant=constant$5;exports.cumulativeLogNormal=cumulativeLogNormal;exports.cumulativeNormal=cumulativeNormal;exports.cumulativeUniform=cumulativeUniform;exports.dayofyear=dayofyear;exports.debounce=_debounce;exports.defaultLocale=defaultLocale;exports.definition=definition$1;exports.densityLogNormal=densityLogNormal;exports.densityNormal=densityNormal;exports.densityUniform=densityUniform;exports.domChild=domChild;exports.domClear=domClear;exports.domCreate=domCreate;exports.domFind=domFind;exports.dotbin=dotbin;exports.error=error;exports.expressionFunction=expressionFunction;exports.extend=extend$1;exports.extent=_extent;exports.extentIndex=extentIndex;exports.falsy=falsy;exports.fastmap=fastmap;exports.field=field$1;exports.flush=flush;exports.font=font;exports.fontFamily=fontFamily;exports.fontSize=fontSize;exports.format=format$2;exports.formatLocale=numberFormatDefaultLocale;exports.formats=formats$1;exports.hasOwnProperty=has$1;exports.id=id;exports.identity=identity$6;exports.inferType=inferType;exports.inferTypes=inferTypes;exports.ingest=ingest$1;exports.inherits=inherits;exports.inrange=inrange;exports.interpolate=interpolate;exports.interpolateColors=interpolateColors;exports.interpolateRange=interpolateRange;exports.intersect=intersect$2;exports.intersectBoxLine=intersectBoxLine;exports.intersectPath=intersectPath;exports.intersectPoint=intersectPoint;exports.intersectRule=intersectRule;exports.isArray=isArray;exports.isBoolean=isBoolean$1;exports.isDate=isDate$1;exports.isFunction=isFunction;exports.isIterable=isIterable;exports.isNumber=isNumber$1;exports.isObject=isObject;exports.isRegExp=isRegExp;exports.isString=isString;exports.isTuple=isTuple;exports.key=key;exports.lerp=lerp;exports.lineHeight=lineHeight;exports.loader=loader;exports.locale=locale;exports.logger=logger;exports.lruCache=lruCache;exports.markup=markup;exports.merge=merge$3;exports.mergeConfig=mergeConfig;exports.multiLineOffset=multiLineOffset;exports.one=one$2;exports.pad=pad$2;exports.panLinear=panLinear;exports.panLog=panLog;exports.panPow=panPow;exports.panSymlog=panSymlog;exports.parse=parse;exports.parseExpression=parser$1;exports.parseSelector=eventSelector;exports.path=path$3;exports.pathCurves=curves;exports.pathEqual=pathEqual;exports.pathParse=parse$3;exports.pathRectangle=vg_rect;exports.pathRender=pathRender;exports.pathSymbols=symbols;exports.pathTrail=vg_trail;exports.peek=peek$1;exports.point=point;exports.projection=projection;exports.quantileLogNormal=quantileLogNormal;exports.quantileNormal=quantileNormal;exports.quantileUniform=quantileUniform;exports.quantiles=quantiles;exports.quantizeInterpolator=quantizeInterpolator;exports.quarter=quarter;exports.quartiles=quartiles;exports.randomInteger=integer;exports.randomKDE=kde;exports.randomLCG=lcg$2;exports.randomLogNormal=lognormal;exports.randomMixture=mixture$1;exports.randomNormal=gaussian;exports.randomUniform=uniform;exports.read=read;exports.regressionConstant=constant$4;exports.regressionExp=exp$1;exports.regressionLinear=linear$2;exports.regressionLoess=loess;exports.regressionLog=log$3;exports.regressionPoly=poly;exports.regressionPow=pow$3;exports.regressionQuad=quad;exports.renderModule=renderModule;exports.repeat=repeat;exports.resetDefaultLocale=resetDefaultLocale;exports.resetSVGDefIds=resetSVGDefIds;exports.responseType=responseType;exports.runtimeContext=context;exports.sampleCurve=sampleCurve;exports.sampleLogNormal=sampleLogNormal;exports.sampleNormal=sampleNormal;exports.sampleUniform=sampleUniform;exports.scale=scale$4;exports.sceneEqual=sceneEqual;exports.sceneFromJSON=sceneFromJSON;exports.scenePickVisit=pickVisit;exports.sceneToJSON=sceneToJSON;exports.sceneVisit=visit;exports.sceneZOrder=zorder;exports.scheme=scheme;exports.serializeXML=serializeXML;exports.setHybridRendererOptions=setHybridRendererOptions;exports.setRandom=setRandom;exports.span=span;exports.splitAccessPath=splitAccessPath;exports.stringValue=$;exports.textMetrics=textMetrics;exports.timeBin=bin$1;exports.timeFloor=timeFloor;exports.timeFormatLocale=timeFormatDefaultLocale;exports.timeInterval=timeInterval;exports.timeOffset=timeOffset;exports.timeSequence=timeSequence;exports.timeUnitSpecifier=timeUnitSpecifier;exports.timeUnits=timeUnits;exports.toBoolean=toBoolean;exports.toDate=_toDate;exports.toNumber=toNumber;exports.toSet=toSet;exports.toString=toString;exports.transform=transform$2;exports.transforms=transforms;exports.truncate=truncate$1;exports.truthy=truthy;exports.tupleid=tupleid;exports.typeParsers=typeParsers;exports.utcFloor=utcFloor;exports.utcInterval=utcInterval;exports.utcOffset=utcOffset;exports.utcSequence=utcSequence;exports.utcdayofyear=utcdayofyear;exports.utcquarter=utcquarter;exports.utcweek=utcweek;exports.version=version;exports.visitArray=visitArray;exports.week=week;exports.writeConfig=writeConfig;exports.zero=zero$3;exports.zoomLinear=zoomLinear;exports.zoomLog=zoomLog;exports.zoomPow=zoomPow;exports.zoomSymlog=zoomSymlog;}); diff --git a/lib/node_modules/@stdlib/plot/vega/vendored/package.json b/lib/node_modules/@stdlib/plot/vega/vendored/package.json new file mode 100644 index 000000000000..e4ae98f55bd7 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/vendored/package.json @@ -0,0 +1,54 @@ +{ + "name": "@stdlib/plot/vega/vendored", + "version": "0.0.0", + "description": "Vendored Vega.", + "license": "Apache-2.0", + "author": { + "name": "The Stdlib Authors", + "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" + }, + "contributors": [ + { + "name": "The Stdlib Authors", + "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" + } + ], + "main": "./lib", + "directories": { + "doc": "./docs", + "example": "./examples", + "lib": "./lib", + "test": "./test" + }, + "scripts": {}, + "homepage": "https://github.com/stdlib-js/stdlib", + "repository": { + "type": "git", + "url": "git://github.com/stdlib-js/stdlib.git" + }, + "bugs": { + "url": "https://github.com/stdlib-js/stdlib/issues" + }, + "dependencies": {}, + "devDependencies": {}, + "engines": { + "node": ">=0.10.0", + "npm": ">2.7.0" + }, + "os": [ + "aix", + "darwin", + "freebsd", + "linux", + "macos", + "openbsd", + "sunos", + "win32", + "windows" + ], + "keywords": [ + "stdlib", + "plot", + "vega" + ] +}