From f35197928cb3502771d0832853509d980795b4af Mon Sep 17 00:00:00 2001 From: orthodox-64 Date: Sun, 17 May 2026 13:44:34 +0530 Subject: [PATCH] feat: add plot/vega/legend/directions --- type: pre_commit_static_analysis_report description: Results of running static analysis checks when committing changes. report: - task: lint_filenames status: passed - task: lint_editorconfig status: passed - task: lint_markdown status: passed - task: lint_package_json status: passed - task: lint_repl_help status: passed - task: lint_javascript_src status: passed - task: lint_javascript_cli status: na - task: lint_javascript_examples status: passed - task: lint_javascript_tests status: passed - task: lint_javascript_benchmarks status: passed - task: lint_python status: na - task: lint_r status: na - task: lint_c_src status: na - task: lint_c_examples status: na - task: lint_c_benchmarks status: na - task: lint_c_tests_fixtures status: na - task: lint_shell status: na - task: lint_typescript_declarations status: passed - task: lint_typescript_tests status: passed - task: lint_license_headers status: passed --- --- .../plot/vega/legend/directions/README.md | 117 ++++++++++++++++++ .../legend/directions/benchmark/benchmark.js | 48 +++++++ .../plot/vega/legend/directions/docs/repl.txt | 17 +++ .../legend/directions/docs/types/index.d.ts | 35 ++++++ .../vega/legend/directions/docs/types/test.ts | 32 +++++ .../vega/legend/directions/examples/index.js | 40 ++++++ .../plot/vega/legend/directions/lib/data.json | 4 + .../plot/vega/legend/directions/lib/index.js | 40 ++++++ .../plot/vega/legend/directions/lib/main.js | 44 +++++++ .../plot/vega/legend/directions/package.json | 64 ++++++++++ .../plot/vega/legend/directions/test/test.js | 47 +++++++ 11 files changed, 488 insertions(+) create mode 100644 lib/node_modules/@stdlib/plot/vega/legend/directions/README.md create mode 100644 lib/node_modules/@stdlib/plot/vega/legend/directions/benchmark/benchmark.js create mode 100644 lib/node_modules/@stdlib/plot/vega/legend/directions/docs/repl.txt create mode 100644 lib/node_modules/@stdlib/plot/vega/legend/directions/docs/types/index.d.ts create mode 100644 lib/node_modules/@stdlib/plot/vega/legend/directions/docs/types/test.ts create mode 100644 lib/node_modules/@stdlib/plot/vega/legend/directions/examples/index.js create mode 100644 lib/node_modules/@stdlib/plot/vega/legend/directions/lib/data.json create mode 100644 lib/node_modules/@stdlib/plot/vega/legend/directions/lib/index.js create mode 100644 lib/node_modules/@stdlib/plot/vega/legend/directions/lib/main.js create mode 100644 lib/node_modules/@stdlib/plot/vega/legend/directions/package.json create mode 100644 lib/node_modules/@stdlib/plot/vega/legend/directions/test/test.js diff --git a/lib/node_modules/@stdlib/plot/vega/legend/directions/README.md b/lib/node_modules/@stdlib/plot/vega/legend/directions/README.md new file mode 100644 index 000000000000..00014260c77d --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/legend/directions/README.md @@ -0,0 +1,117 @@ + + +# legendDirections + +> List of supported Vega legend directions. + + + +
+ +
+ + + + + +
+ +## Usage + +```javascript +var legendDirections = require( '@stdlib/plot/vega/legend/directions' ); +``` + +#### legendDirections() + +Returns a list of legend directions. + +```javascript +var out = legendDirections(); +// returns [ 'horizontal', 'vertical' ] +``` + +
+ + + + + +
+ +
+ + + + + +
+ +## Examples + + + +```javascript +var contains = require( '@stdlib/array/base/assert/contains' ).factory; +var legendDirections = require( '@stdlib/plot/vega/legend/directions' ); + +var isLegendDirection = contains( legendDirections() ); + +var bool = isLegendDirection( 'horizontal' ); +// returns true + +bool = isLegendDirection( 'vertical' ); +// returns true + +bool = isLegendDirection( 'beep' ); +// returns false + +bool = isLegendDirection( 'boop' ); +// returns false +``` + +
+ + + + + +
+ +
+ + + + + + + + + + + + + + diff --git a/lib/node_modules/@stdlib/plot/vega/legend/directions/benchmark/benchmark.js b/lib/node_modules/@stdlib/plot/vega/legend/directions/benchmark/benchmark.js new file mode 100644 index 000000000000..5bfc8a279de2 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/legend/directions/benchmark/benchmark.js @@ -0,0 +1,48 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF 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 legendDirections = require( './../lib' ); + + +// MAIN // + +bench( pkg, function benchmark( b ) { + var out; + var i; + + b.tic(); + for ( i = 0; i < b.iterations; i++ ) { + out = legendDirections(); + 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/legend/directions/docs/repl.txt b/lib/node_modules/@stdlib/plot/vega/legend/directions/docs/repl.txt new file mode 100644 index 000000000000..3281b681ee66 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/legend/directions/docs/repl.txt @@ -0,0 +1,17 @@ + +{{alias}}() + Returns a list of legend directions. + + Returns + ------- + out: Array + List of legend directions. + + Examples + -------- + > var out = {{alias}}() + [ 'horizontal', 'vertical' ] + + See Also + -------- + diff --git a/lib/node_modules/@stdlib/plot/vega/legend/directions/docs/types/index.d.ts b/lib/node_modules/@stdlib/plot/vega/legend/directions/docs/types/index.d.ts new file mode 100644 index 000000000000..8fe087cbf0fd --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/legend/directions/docs/types/index.d.ts @@ -0,0 +1,35 @@ +/* +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT 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 legend directions. +* +* @returns list of legend directions +* +* @example +* var list = legendDirections(); +* // returns [ 'horizontal', 'vertical' ] +*/ +declare function legendDirections(): Array; + + +// EXPORTS // + +export = legendDirections; diff --git a/lib/node_modules/@stdlib/plot/vega/legend/directions/docs/types/test.ts b/lib/node_modules/@stdlib/plot/vega/legend/directions/docs/types/test.ts new file mode 100644 index 000000000000..e9dc416c7ee7 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/legend/directions/docs/types/test.ts @@ -0,0 +1,32 @@ +/* +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT 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 legendDirections = require( './index' ); + + +// TESTS // + +// The function returns an array of strings... +{ + legendDirections(); // $ExpectType string[] +} + +// The compiler throws an error if the function is provided any arguments... +{ + legendDirections( 9 ); // $ExpectError +} diff --git a/lib/node_modules/@stdlib/plot/vega/legend/directions/examples/index.js b/lib/node_modules/@stdlib/plot/vega/legend/directions/examples/index.js new file mode 100644 index 000000000000..35dbc5f83f9e --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/legend/directions/examples/index.js @@ -0,0 +1,40 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR 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 legendDirections = require( './../lib' ); + +var isLegendDirection = contains( legendDirections() ); + +var bool = isLegendDirection( 'horizontal' ); +console.log( bool ); +// => true + +bool = isLegendDirection( 'vertical' ); +console.log( bool ); +// => true + +bool = isLegendDirection( 'beep' ); +console.log( bool ); +// => false + +bool = isLegendDirection( 'boop' ); +console.log( bool ); +// => false diff --git a/lib/node_modules/@stdlib/plot/vega/legend/directions/lib/data.json b/lib/node_modules/@stdlib/plot/vega/legend/directions/lib/data.json new file mode 100644 index 000000000000..38176275f512 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/legend/directions/lib/data.json @@ -0,0 +1,4 @@ +[ + "horizontal", + "vertical" +] diff --git a/lib/node_modules/@stdlib/plot/vega/legend/directions/lib/index.js b/lib/node_modules/@stdlib/plot/vega/legend/directions/lib/index.js new file mode 100644 index 000000000000..e825fefb532b --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/legend/directions/lib/index.js @@ -0,0 +1,40 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR 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 legend directions. +* +* @module @stdlib/plot/vega/legend/directions +* +* @example +* var legendDirections = require( '@stdlib/plot/vega/legend/directions' ); +* +* var out = legendDirections(); +* // returns [ 'horizontal', 'vertical' ] +*/ + +// MODULES // + +var main = require( './main.js' ); + + +// EXPORTS // + +module.exports = main; diff --git a/lib/node_modules/@stdlib/plot/vega/legend/directions/lib/main.js b/lib/node_modules/@stdlib/plot/vega/legend/directions/lib/main.js new file mode 100644 index 000000000000..ef2ce95dcf17 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/legend/directions/lib/main.js @@ -0,0 +1,44 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF 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 legend directions. +* +* @returns {StringArray} list of legend directions +* +* @example +* var out = legendDirections(); +* // returns [ 'horizontal', 'vertical' ] +*/ +function legendDirections() { + return DATA.slice(); +} + + +// EXPORTS // + +module.exports = legendDirections; diff --git a/lib/node_modules/@stdlib/plot/vega/legend/directions/package.json b/lib/node_modules/@stdlib/plot/vega/legend/directions/package.json new file mode 100644 index 000000000000..fc4a20e8a3b5 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/legend/directions/package.json @@ -0,0 +1,64 @@ +{ + "name": "@stdlib/plot/vega/legend/directions", + "version": "0.0.0", + "description": "List of supported Vega legend directions.", + "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", + "legend", + "direction", + "directions", + "utilities", + "utility", + "utils", + "util" + ], + "__stdlib__": {} +} diff --git a/lib/node_modules/@stdlib/plot/vega/legend/directions/test/test.js b/lib/node_modules/@stdlib/plot/vega/legend/directions/test/test.js new file mode 100644 index 000000000000..ef22ca22fec8 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/legend/directions/test/test.js @@ -0,0 +1,47 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF 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 legendDirections = require( './../lib' ); + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof legendDirections, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'the function returns a list of legend directions', function test( t ) { + var expected; + var actual; + + expected = [ + 'horizontal', + 'vertical' + ]; + actual = legendDirections(); + + t.deepEqual( actual, expected, 'returns expected value' ); + t.end(); +});