diff --git a/lib/node_modules/@stdlib/plot/vega/transform/bin/examples/index.js b/lib/node_modules/@stdlib/plot/vega/transform/bin/examples/index.js new file mode 100644 index 000000000000..d290b05e6c18 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/transform/bin/examples/index.js @@ -0,0 +1,33 @@ +/** +* @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 Field = require( '@stdlib/plot/vega/field/ctor' ); +var BinTransform = require( './../lib' ); + +var field = new Field({ + 'field': 'amount' +}); + +var transform = new BinTransform({ + 'extent': [ 0, 10 ], + 'field': field +}); + +console.log( transform.toJSON() ); diff --git a/lib/node_modules/@stdlib/plot/vega/transform/bin/lib/anchor/get.js b/lib/node_modules/@stdlib/plot/vega/transform/bin/lib/anchor/get.js new file mode 100644 index 000000000000..53f246c31210 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/transform/bin/lib/anchor/get.js @@ -0,0 +1,43 @@ +/** +* @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. +*/ + +/* eslint-disable no-invalid-this */ + +'use strict'; + +// MODULES // + +var prop = require( './properties.js' ); + + +// MAIN // + +/** +* Returns a value in the binned domain used to anchor bin boundaries. +* +* @private +* @returns {number} anchor value +*/ +function get() { + return this[ prop.private ]; +} + + +// EXPORTS // + +module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/vega/transform/bin/lib/anchor/properties.js b/lib/node_modules/@stdlib/plot/vega/transform/bin/lib/anchor/properties.js new file mode 100644 index 000000000000..46d8fc92c323 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/transform/bin/lib/anchor/properties.js @@ -0,0 +1,33 @@ +/** +* @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 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/transform/bin/lib/anchor/set.js b/lib/node_modules/@stdlib/plot/vega/transform/bin/lib/anchor/set.js new file mode 100644 index 000000000000..db46654cf5c8 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/transform/bin/lib/anchor/set.js @@ -0,0 +1,61 @@ +/** +* @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. +*/ + +/* 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:bin-transform:set:'+prop.name ); + + +// MAIN // + +/** +* Sets a value in the binned domain used to anchor bin boundaries. +* +* @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/transform/bin/lib/as/get.js b/lib/node_modules/@stdlib/plot/vega/transform/bin/lib/as/get.js new file mode 100644 index 000000000000..077be353d555 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/transform/bin/lib/as/get.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. +*/ + +/* eslint-disable no-invalid-this */ + +'use strict'; + +// MODULES // + +var copy = require( '@stdlib/array/base/copy-indexed' ); +var prop = require( './properties.js' ); + + +// MAIN // + +/** +* Returns the output field names for the start and end bin values. +* +* @private +* @returns {ArrayLikeObject} field names +*/ +function get() { + return copy( this[ prop.private ] ); +} + + +// EXPORTS // + +module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/vega/transform/bin/lib/as/properties.js b/lib/node_modules/@stdlib/plot/vega/transform/bin/lib/as/properties.js new file mode 100644 index 000000000000..3f2304dc2f08 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/transform/bin/lib/as/properties.js @@ -0,0 +1,33 @@ +/** +* @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 property2object = require( '@stdlib/plot/vega/base/property2object' ); + + +// MAIN // + +var obj = property2object( 'as' ); + + +// EXPORTS // + +module.exports = obj; diff --git a/lib/node_modules/@stdlib/plot/vega/transform/bin/lib/as/set.js b/lib/node_modules/@stdlib/plot/vega/transform/bin/lib/as/set.js new file mode 100644 index 000000000000..05f6049dabfb --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/transform/bin/lib/as/set.js @@ -0,0 +1,63 @@ +/** +* @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. +*/ + +/* eslint-disable no-invalid-this */ + +'use strict'; + +// MODULES // + +var logger = require( 'debug' ); +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:bin-transform:set:'+prop.name ); + + +// MAIN // + +/** +* Sets the output field names for the start and end bin values. +* +* @private +* @param {StringArray} value - input value +* @throws {TypeError} must be an array of strings +* @returns {void} +*/ +function set( value ) { + if ( !isStringArray( value ) ) { + throw new TypeError( format( 'invalid assignment. `%s` must be an array of strings. Value: `%s`.', prop.name, 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/transform/bin/lib/base/get.js b/lib/node_modules/@stdlib/plot/vega/transform/bin/lib/base/get.js new file mode 100644 index 000000000000..7b76087f2d0c --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/transform/bin/lib/base/get.js @@ -0,0 +1,43 @@ +/** +* @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. +*/ + +/* eslint-disable no-invalid-this */ + +'use strict'; + +// MODULES // + +var prop = require( './properties.js' ); + + +// MAIN // + +/** +* Returns a number base for automatic bin determination. +* +* @private +* @returns {number} base +*/ +function get() { + return this[ prop.private ]; +} + + +// EXPORTS // + +module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/vega/transform/bin/lib/base/properties.js b/lib/node_modules/@stdlib/plot/vega/transform/bin/lib/base/properties.js new file mode 100644 index 000000000000..b1a5cd2c1c9c --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/transform/bin/lib/base/properties.js @@ -0,0 +1,33 @@ +/** +* @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 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/transform/bin/lib/base/set.js b/lib/node_modules/@stdlib/plot/vega/transform/bin/lib/base/set.js new file mode 100644 index 000000000000..e6b334bdf68c --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/transform/bin/lib/base/set.js @@ -0,0 +1,61 @@ +/** +* @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. +*/ + +/* 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:bin-transform:set:'+prop.name ); + + +// MAIN // + +/** +* Sets a number base for automatic bin determination. +* +* @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/transform/bin/lib/change_event.js b/lib/node_modules/@stdlib/plot/vega/transform/bin/lib/change_event.js new file mode 100644 index 000000000000..e444f9c667b0 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/transform/bin/lib/change_event.js @@ -0,0 +1,41 @@ +/** +* @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'; + +// 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': 'transform', + 'property': property + }; +} + + +// EXPORTS // + +module.exports = event; diff --git a/lib/node_modules/@stdlib/plot/vega/transform/bin/lib/defaults.js b/lib/node_modules/@stdlib/plot/vega/transform/bin/lib/defaults.js new file mode 100644 index 000000000000..f3e817831472 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/transform/bin/lib/defaults.js @@ -0,0 +1,75 @@ +/** +* @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 min = require( '@stdlib/stats/array/min' ); + + +// MAIN // + +/** +* Returns defaults. +* +* @private +* @param {NumericArray} extent - two-element array with the minimum and maximum values of the bin range +* @returns {Object} default options +* +* @example +* var ext = [ 0, 10 ]; +* +* var o = defaults( ext ); +* // returns {...} +*/ +function defaults( extent ) { + return { + // Value in the binned domain at which to anchor bin boundaries: + 'anchor': min( extent ), + + // Output field names for the start and end bin values: + 'as': [ 'bin0', 'bin1' ], + + // Number base for automatic bin determination: + 'base': 10, + + // Allowable bin step sub-divisions: + 'divide': [ 5, 2 ], + + // Boolean indicating whether to output start and end bin values: + 'interval': 'true', + + // Maximum number of bins: + 'maxbins': 20, + + // Minimum allowed bin step size: + 'minstep': 0, + + // Boolean indicating attempt to make bin boundaries "nice": + 'nice': true, + + // Span over which to generate bin boundaries: + 'span': extent[1] - extent[0] + }; +} + + +// EXPORTS // + +module.exports = defaults; diff --git a/lib/node_modules/@stdlib/plot/vega/transform/bin/lib/divide/get.js b/lib/node_modules/@stdlib/plot/vega/transform/bin/lib/divide/get.js new file mode 100644 index 000000000000..688833a3d845 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/transform/bin/lib/divide/get.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. +*/ + +/* eslint-disable no-invalid-this */ + +'use strict'; + +// MODULES // + +var copy = require( '@stdlib/array/base/copy-indexed' ); +var prop = require( './properties.js' ); + + +// MAIN // + +/** +* Returns the allowable bin step sub-divisions. +* +* @private +* @returns {NumericArray} step sub-divisions +*/ +function get() { + return copy( this[ prop.private ] ); +} + + +// EXPORTS // + +module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/vega/transform/bin/lib/divide/properties.js b/lib/node_modules/@stdlib/plot/vega/transform/bin/lib/divide/properties.js new file mode 100644 index 000000000000..daa90b7792c7 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/transform/bin/lib/divide/properties.js @@ -0,0 +1,33 @@ +/** +* @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 property2object = require( '@stdlib/plot/vega/base/property2object' ); + + +// MAIN // + +var obj = property2object( 'divide' ); + + +// EXPORTS // + +module.exports = obj; diff --git a/lib/node_modules/@stdlib/plot/vega/transform/bin/lib/divide/set.js b/lib/node_modules/@stdlib/plot/vega/transform/bin/lib/divide/set.js new file mode 100644 index 000000000000..6c2e653d4985 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/transform/bin/lib/divide/set.js @@ -0,0 +1,63 @@ +/** +* @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. +*/ + +/* eslint-disable no-invalid-this */ + +'use strict'; + +// MODULES // + +var logger = require( 'debug' ); +var isNumberArray = require( '@stdlib/assert/is-number-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:bin-transform:set:'+prop.name ); + + +// MAIN // + +/** +* Sets the allowable bin step sub-divisions. +* +* @private +* @param {NumericArray} value - input value +* @throws {TypeError} must be an array of numbers +* @returns {void} +*/ +function set( value ) { + if ( !isNumberArray( value ) ) { + throw new TypeError( format( 'invalid assignment. `%s` must be an array of numbers. Value: `%s`.', prop.name, 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/transform/bin/lib/extent/get.js b/lib/node_modules/@stdlib/plot/vega/transform/bin/lib/extent/get.js new file mode 100644 index 000000000000..7346cf7ec037 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/transform/bin/lib/extent/get.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. +*/ + +/* eslint-disable no-invalid-this */ + +'use strict'; + +// MODULES // + +var copy = require( '@stdlib/array/base/copy-indexed' ); +var prop = require( './properties.js' ); + + +// MAIN // + +/** +* Returns the two-element array with the minimum and maximum values of the bin range. +* +* @private +* @returns {NumericArray} field names +*/ +function get() { + return copy( this[ prop.private ] ); +} + + +// EXPORTS // + +module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/vega/transform/bin/lib/extent/properties.js b/lib/node_modules/@stdlib/plot/vega/transform/bin/lib/extent/properties.js new file mode 100644 index 000000000000..8c50b4926af7 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/transform/bin/lib/extent/properties.js @@ -0,0 +1,33 @@ +/** +* @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 property2object = require( '@stdlib/plot/vega/base/property2object' ); + + +// MAIN // + +var obj = property2object( 'extent' ); + + +// EXPORTS // + +module.exports = obj; diff --git a/lib/node_modules/@stdlib/plot/vega/transform/bin/lib/extent/set.js b/lib/node_modules/@stdlib/plot/vega/transform/bin/lib/extent/set.js new file mode 100644 index 000000000000..c7cbd8b60409 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/transform/bin/lib/extent/set.js @@ -0,0 +1,67 @@ +/** +* @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. +*/ + +/* eslint-disable no-invalid-this */ + +'use strict'; + +// MODULES // + +var logger = require( 'debug' ); +var isNumberArray = require( '@stdlib/assert/is-number-array' ).primitives; +var isUndefined = require( '@stdlib/assert/is-undefined' ); +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:bin-transform:set:'+prop.name ); + + +// MAIN // + +/** +* Sets the two-element array with the minimum and maximum values of the bin range. +* +* @private +* @param {NumericArray} value - input value +* @throws {TypeError} must be an array of numbers +* @returns {void} +*/ +function set( value ) { + var isUndef; + + isUndef = isUndefined( this[ prop.private ] ); + if ( !isNumberArray( value ) ) { + throw new TypeError( format( 'invalid assignment. `%s` must be an array of numbers. Value: `%s`.', prop.name, value ) ); + } + if ( isUndef || 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/transform/bin/lib/field/get.js b/lib/node_modules/@stdlib/plot/vega/transform/bin/lib/field/get.js new file mode 100644 index 000000000000..911b8f782d79 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/transform/bin/lib/field/get.js @@ -0,0 +1,43 @@ +/** +* @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. +*/ + +/* eslint-disable no-invalid-this */ + +'use strict'; + +// MODULES // + +var prop = require( './properties.js' ); + + +// MAIN // + +/** +* Returns the data field to bin. +* +* @private +* @returns {Field} data field +*/ +function get() { + return this[ prop.private ]; +} + + +// EXPORTS // + +module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/vega/transform/bin/lib/field/properties.js b/lib/node_modules/@stdlib/plot/vega/transform/bin/lib/field/properties.js new file mode 100644 index 000000000000..639ddb612903 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/transform/bin/lib/field/properties.js @@ -0,0 +1,33 @@ +/** +* @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 property2object = require( '@stdlib/plot/vega/base/property2object' ); + + +// MAIN // + +var obj = property2object( 'field' ); + + +// EXPORTS // + +module.exports = obj; diff --git a/lib/node_modules/@stdlib/plot/vega/transform/bin/lib/field/set.js b/lib/node_modules/@stdlib/plot/vega/transform/bin/lib/field/set.js new file mode 100644 index 000000000000..5c4d98bb5143 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/transform/bin/lib/field/set.js @@ -0,0 +1,63 @@ +/** +* @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. +*/ + +/* eslint-disable no-invalid-this */ + +'use strict'; + +// MODULES // + +var logger = require( 'debug' ); +var isField = require( '@stdlib/plot/vega/base/assert/is-field' ); +var format = require( '@stdlib/string/format' ); +var changeEvent = require( './../change_event.js' ); +var prop = require( './properties.js' ); + + +// VARIABLES // + +var debug = logger( 'vega:bin-transform:set:'+prop.name ); + + +// MAIN // + +/** +* Sets the data field to bin. +* +* @private +* @param {Field} value - input value +* @throws {TypeError} must be a field instance +* @returns {void} +*/ +function set( value ) { + if ( !isField( value ) ) { + throw new TypeError( format( 'invalid assignment. `%s` must be a field 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/transform/bin/lib/index.js b/lib/node_modules/@stdlib/plot/vega/transform/bin/lib/index.js new file mode 100644 index 000000000000..265ac973064f --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/transform/bin/lib/index.js @@ -0,0 +1,49 @@ +/** +* @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'; + +/** +* Bin transform constructor. +* +* @module @stdlib/plot/vega/transform/bin +* +* @example +* var Field = require( '@stdlib/plot/vega/field/ctor' ); +* var BinTransform = require( '@stdlib/plot/vega/transform/bin' ); +* +* var field = new Field({ +* 'field': 'amount' +* }); +* // returns +* +* var transform = new BinTransform({ +* 'extent': [ 0, 10 ], +* 'field': field +* }); +* // returns +*/ + +// MODULES // + +var main = require( './main.js' ); + + +// EXPORTS // + +module.exports = main; diff --git a/lib/node_modules/@stdlib/plot/vega/transform/bin/lib/interval/get.js b/lib/node_modules/@stdlib/plot/vega/transform/bin/lib/interval/get.js new file mode 100644 index 000000000000..74c446c594b6 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/transform/bin/lib/interval/get.js @@ -0,0 +1,43 @@ +/** +* @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. +*/ + +/* eslint-disable no-invalid-this */ + +'use strict'; + +// MODULES // + +var prop = require( './properties.js' ); + + +// MAIN // + +/** +* Returns a boolean indicating whether to output start and end bin values. +* +* @private +* @returns {string} boolean flag +*/ +function get() { + return this[ prop.private ]; +} + + +// EXPORTS // + +module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/vega/transform/bin/lib/interval/properties.js b/lib/node_modules/@stdlib/plot/vega/transform/bin/lib/interval/properties.js new file mode 100644 index 000000000000..415e5be9298e --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/transform/bin/lib/interval/properties.js @@ -0,0 +1,33 @@ +/** +* @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 property2object = require( '@stdlib/plot/vega/base/property2object' ); + + +// MAIN // + +var obj = property2object( 'interval' ); + + +// EXPORTS // + +module.exports = obj; diff --git a/lib/node_modules/@stdlib/plot/vega/transform/bin/lib/interval/set.js b/lib/node_modules/@stdlib/plot/vega/transform/bin/lib/interval/set.js new file mode 100644 index 000000000000..a433d54d45f6 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/transform/bin/lib/interval/set.js @@ -0,0 +1,61 @@ +/** +* @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. +*/ + +/* 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:bin-transform:set:'+prop.name ); + + +// MAIN // + +/** +* Sets a boolean indicating whether to output start and end bin values. +* +* @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/transform/bin/lib/main.js b/lib/node_modules/@stdlib/plot/vega/transform/bin/lib/main.js new file mode 100644 index 000000000000..91204a979721 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/transform/bin/lib/main.js @@ -0,0 +1,700 @@ +/** +* @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. +*/ + +/* eslint-disable no-restricted-syntax, no-invalid-this, stdlib/no-empty-lines-between-requires, stdlib/no-redeclare */ + +'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 getAnchor = require( './anchor/get.js' ); +var setAnchor = require( './anchor/set.js' ); + +var getAs = require( './as/get.js' ); +var setAs = require( './as/set.js' ); + +var getBase = require( './base/get.js' ); +var setBase = require( './base/set.js' ); + +var getDivide = require( './divide/get.js' ); +var setDivide = require( './divide/set.js' ); + +var getExtent = require( './extent/get.js' ); +var setExtent = require( './extent/set.js' ); + +var getField = require( './field/get.js' ); +var setField = require( './field/set.js' ); + +var getInterval = require( './interval/get.js' ); +var setInterval = require( './interval/set.js' ); + +var getMaxbins = require( './maxbins/get.js' ); +var setMaxbins = require( './maxbins/set.js' ); + +var getMinstep = require( './minstep/get.js' ); +var setMinstep = require( './minstep/set.js' ); + +var getNice = require( './nice/get.js' ); +var setNice = require( './nice/set.js' ); + +var getSignal = require( './signal/get.js' ); +var setSignal = require( './signal/set.js' ); + +var getProperties = require( './properties/get.js' ); + +var getSpan = require( './span/get.js' ); +var setSpan = require( './span/set.js' ); + +var getStep = require( './step/get.js' ); +var setStep = require( './step/set.js' ); + +var getSteps = require( './steps/get.js' ); +var setSteps = require( './steps/set.js' ); + + +// VARIABLES // + +var debug = logger( 'vega:bin-transform:main' ); + + +// MAIN // + +/** +* Bin transform constructor. +* +* @constructor +* @param {Options} options - constructor options +* @param {NumericArray} options.extent - two-element array with the minimum and maximum values of the bin range +* @param {Field} options.field - data field to bin +* @param {number} [options.anchor=min(options.extent)] - value in the binned domain used to anchor bin boundaries +* @param {ArrayLikeObject} [options.as=['bin0','bin1']] - output field names for the start and end bin values +* @param {number} [options.base=10] - number base for automatic bin determination +* @param {NumericArray} [options.divide=[5,2]] - allowable bin step sub-divisions +* @param {string} [options.interval='true'] - boolean indicating whether to output start and end bin values +* @param {number} [options.maxbins=20] - maximum number of bins +* @param {number} [options.minstep=0] - minimum allowed bin step size +* @param {boolean} [options.nice=true] - boolean indicating attempt to make bin boundaries "nice" +* @param {string} [options.signal] - binds the computed binning specification to a signal with the given name +* @param {number} [options.span=options.extent[1]-options.extent[0]] - span over which to generate bin boundaries +* @param {number} [options.step] - step size to use between bins +* @param {NumericArray} [options.steps] - array of allowable step sizes to choose from +* @throws {TypeError} options argument must be an object +* @throws {Error} must provide valid options +* @returns {BinTransform} bin transform instance +* +* @example +* var Field = require( '@stdlib/plot/vega/field/ctor' ); +* +* var field = new Field({ +* 'field': 'amount' +* }); +* // returns +* +* var transform = new BinTransform({ +* 'extent': [ 0, 10 ], +* 'field': field +* }); +* // returns +*/ +function BinTransform( options ) { + var self; + var opts; + var keys; + var v; + var k; + var i; + if ( !( this instanceof BinTransform ) ) { + return new BinTransform( options ); + } + self = this; + 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, 'extent' ) ) { + throw new TypeError( 'invalid argument. Options argument must specify an bin extent.' ); + } + if ( !hasProp( options, 'field' ) ) { + throw new TypeError( 'invalid argument. Options argument must specify an data field to bin.' ); + } + + // Resolve the default configuration: + opts = defaults( options.extent ); + + // 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; + + // Add change listeners to default event emitters: + if ( this._field && typeof this._field.on === 'function' ) { + this._addChangeListener( this._field ); + } + + // 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; + + /** + * 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( BinTransform, EventEmitter ); + +/** +* Constructor name. +* +* @private +* @name name +* @memberof BinTransform +* @readonly +* @type {string} +*/ +setNonEnumerableReadOnly( BinTransform, 'name', 'BinTransform' ); + +/** +* Adds an internal listener to a change event on a child instance. +* +* @private +* @name _addChangeListener +* @memberof BinTransform.prototype +* @type {Function} +* @param {Object} emitter - event emitter +* @returns {BinTransform} bin transform instance +*/ +setNonEnumerableReadOnly( BinTransform.prototype, '_addChangeListener', function addChangeListener( emitter ) { + if ( emitter && typeof emitter.on === 'function' ) { + emitter.on( 'change', this._onChange ); + } + return this; +}); + +/** +* Adds internal listeners to change events on child instances. +* +* @private +* @name _addChangeListeners +* @memberof BinTransform.prototype +* @type {Function} +* @param {ArrayLikeObject} emitters - list of event emitters +* @returns {BinTransform} bin transform instance +*/ +setNonEnumerableReadOnly( BinTransform.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 BinTransform.prototype +* @type {Function} +* @param {Object} emitter - event emitter +* @returns {BinTransform} bin transform instance +*/ +setNonEnumerableReadOnly( BinTransform.prototype, '_removeChangeListener', function removeChangeListener( emitter ) { + if ( emitter && typeof emitter.removeListener === 'function' ) { + emitter.removeListener( 'change', this._onChange ); + } + return this; +}); + +/** +* Removes internal listeners to change events on child instances. +* +* @private +* @name _removeChangeListeners +* @memberof BinTransform.prototype +* @type {Function} +* @param {ArrayLikeObject} emitters - list of event emitters +* @returns {BinTransform} bin transform instance +*/ +setNonEnumerableReadOnly( BinTransform.prototype, '_removeChangeListeners', function removeChangeListeners( emitters ) { + var i; + for ( i = 0; i < emitters.length; i++ ) { + this._removeChangeListener( emitters[ i ] ); + } + return this; +}); + +/** +* Value in the binned domain used to anchor bin boundaries. +* +* @name anchor +* @memberof BinTransform.prototype +* @type {number} +* @default min(extent) +* +* @example +* var Field = require( '@stdlib/plot/vega/field/ctor' ); +* +* var field = new Field({ +* 'field': 'amount' +* }); +* +* var transform = new BinTransform({ +* 'extent': [ 0, 10 ], +* 'field': field +* }); +* +* var v = transform.anchor; +* // returns 0 +*/ +setReadWriteAccessor( BinTransform.prototype, 'anchor', getAnchor, setAnchor ); + +/** +* Output field names for the start and end bin values. +* +* @name as +* @memberof BinTransform.prototype +* @type {ArrayLikeObject} +* @default ['bin0','bin1'] +* +* @example +* var Field = require( '@stdlib/plot/vega/field/ctor' ); +* +* var field = new Field({ +* 'field': 'amount' +* }); +* +* var transform = new BinTransform({ +* 'extent': [ 0, 10 ], +* 'field': field, +* 'as': [ 'foo', 'bar' ] +* }); +* +* var v = transform.as; +* // returns [ 'foo', 'bar' ] +*/ +setReadWriteAccessor( BinTransform.prototype, 'as', getAs, setAs ); + +/** +* Number base for automatic bin determination. +* +* @name base +* @memberof BinTransform.prototype +* @type {number} +* @default 10 +* +* @example +* var Field = require( '@stdlib/plot/vega/field/ctor' ); +* +* var field = new Field({ +* 'field': 'amount' +* }); +* +* var transform = new BinTransform({ +* 'extent': [ 0, 10 ], +* 'field': field, +* 'base': 8 +* }); +* +* var v = transform.base; +* // returns 8 +*/ +setReadWriteAccessor( BinTransform.prototype, 'base', getBase, setBase ); + +/** +* Allowable bin step sub-divisions. +* +* @name divide +* @memberof BinTransform.prototype +* @type {NumericArray} +* @default [5,2] +* +* @example +* var Field = require( '@stdlib/plot/vega/field/ctor' ); +* +* var field = new Field({ +* 'field': 'amount' +* }); +* +* var transform = new BinTransform({ +* 'extent': [ 0, 10 ], +* 'field': field, +* 'divide': [ 4, 2 ] +* }); +* +* var v = transform.divide; +* // returns [ 4, 2 ] +*/ +setReadWriteAccessor( BinTransform.prototype, 'divide', getDivide, setDivide ); + +/** +* Two-element array with the minimum and maximum values of the bin range. +* +* @name extent +* @memberof BinTransform.prototype +* @type {NumericArray} +* +* @example +* var Field = require( '@stdlib/plot/vega/field/ctor' ); +* +* var field = new Field({ +* 'field': 'amount' +* }); +* +* var transform = new BinTransform({ +* 'extent': [ 0, 10 ], +* 'field': field +* }); +* +* var v = transform.extent; +* // returns [ 0, 10 ] +*/ +setReadWriteAccessor( BinTransform.prototype, 'extent', getExtent, setExtent ); + +/** +* Data field to bin. +* +* @name field +* @memberof BinTransform.prototype +* @type {Field} +* +* @example +* var Field = require( '@stdlib/plot/vega/field/ctor' ); +* +* var field = new Field({ +* 'field': 'amount' +* }); +* +* var transform = new BinTransform({ +* 'extent': [ 0, 10 ], +* 'field': field +* }); +* +* var v = transform.field; +* // returns +*/ +setReadWriteAccessor( BinTransform.prototype, 'field', getField, setField ); + +/** +* Boolean indicating whether to output start and end bin values. +* +* @name interval +* @memberof BinTransform.prototype +* @type {string} +* @default 'true' +* +* @example +* var Field = require( '@stdlib/plot/vega/field/ctor' ); +* +* var field = new Field({ +* 'field': 'amount' +* }); +* +* var transform = new BinTransform({ +* 'extent': [ 0, 10 ], +* 'field': field +* }); +* +* var v = transform.interval; +* // returns 'true' +*/ +setReadWriteAccessor( BinTransform.prototype, 'interval', getInterval, setInterval ); + +/** +* Maximum number of bins. +* +* @name maxbins +* @memberof BinTransform.prototype +* @type {number} +* @default 20 +* +* @example +* var Field = require( '@stdlib/plot/vega/field/ctor' ); +* +* var field = new Field({ +* 'field': 'amount' +* }); +* +* var transform = new BinTransform({ +* 'extent': [ 0, 10 ], +* 'field': field, +* 'maxbins': 10 +* }); +* +* var v = transform.maxbins; +* // returns 10 +*/ +setReadWriteAccessor( BinTransform.prototype, 'maxbins', getMaxbins, setMaxbins ); + +/** +* Minimum allowed bin step size. +* +* @name minstep +* @memberof BinTransform.prototype +* @type {number} +* @default 0 +* +* @example +* var Field = require( '@stdlib/plot/vega/field/ctor' ); +* +* var field = new Field({ +* 'field': 'amount' +* }); +* +* var transform = new BinTransform({ +* 'extent': [ 0, 10 ], +* 'field': field, +* 'minstep': 2 +* }); +* +* var v = transform.minstep; +* // returns 2 +*/ +setReadWriteAccessor( BinTransform.prototype, 'minstep', getMinstep, setMinstep ); + +/** +* Boolean indicating attempt to make bin boundaries "nice". +* +* @name nice +* @memberof BinTransform.prototype +* @type {boolean} +* @default true +* +* @example +* var Field = require( '@stdlib/plot/vega/field/ctor' ); +* +* var field = new Field({ +* 'field': 'amount' +* }); +* +* var transform = new BinTransform({ +* 'extent': [ 0, 10 ], +* 'field': field +* }); +* +* var v = transform.nice; +* // returns true +*/ +setReadWriteAccessor( BinTransform.prototype, 'nice', getNice, setNice ); + +/** +* Bin transform properties. +* +* @name properties +* @memberof BinTransform.prototype +* @type {Array} +* +* @example +* var Field = require( '@stdlib/plot/vega/field/ctor' ); +* +* var field = new Field({ +* 'field': 'amount' +* }); +* +* var transform = new BinTransform({ +* 'extent': [ 0, 10 ], +* 'field': field +* }); +* +* var v = transform.properties; +* // returns [...] +*/ +setNonEnumerableReadOnlyAccessor( BinTransform.prototype, 'properties', getProperties ); + +/** +* Binds the computed binning specification to a signal with the given name. +* +* @name signal +* @memberof BinTransform.prototype +* @type {(string|void)} +* +* @example +* var Field = require( '@stdlib/plot/vega/field/ctor' ); +* +* var field = new Field({ +* 'field': 'amount' +* }); +* +* var transform = new BinTransform({ +* 'extent': [ 0, 10 ], +* 'field': field, +* 'signal': 'foo bar' +* }); +* +* var v = transform.signal; +* // returns 'foo bar' +*/ +setReadWriteAccessor( BinTransform.prototype, 'signal', getSignal, setSignal ); + +/** +* Span over which to generate bin boundaries. +* +* @name span +* @memberof BinTransform.prototype +* @type {number} +* @default extent[1]-extent[0] +* +* @example +* var Field = require( '@stdlib/plot/vega/field/ctor' ); +* +* var field = new Field({ +* 'field': 'amount' +* }); +* +* var transform = new BinTransform({ +* 'extent': [ 0, 10 ], +* 'field': field +* }); +* +* var v = transform.span; +* // returns 10 +*/ +setReadWriteAccessor( BinTransform.prototype, 'span', getSpan, setSpan ); + +/** +* Step size to use between bins. +* +* @name step +* @memberof BinTransform.prototype +* @type {(number|void)} +* +* @example +* var Field = require( '@stdlib/plot/vega/field/ctor' ); +* +* var field = new Field({ +* 'field': 'amount' +* }); +* +* var transform = new BinTransform({ +* 'extent': [ 0, 10 ], +* 'field': field, +* 'step': 2 +* }); +* +* var v = transform.step; +* // returns 2 +*/ +setReadWriteAccessor( BinTransform.prototype, 'step', getStep, setStep ); + +/** +* Array of allowable step sizes to choose from. +* +* @name steps +* @memberof BinTransform.prototype +* @type {(NumericArray|void)} +* +* @example +* var Field = require( '@stdlib/plot/vega/field/ctor' ); +* +* var field = new Field({ +* 'field': 'amount' +* }); +* +* var transform = new BinTransform({ +* 'extent': [ 0, 10 ], +* 'field': field, +* 'steps': [ 2, 4 ] +* }); +* +* var v = transform.steps; +* // returns [ 2, 4 ] +*/ +setReadWriteAccessor( BinTransform.prototype, 'steps', getSteps, setSteps ); + +/** +* Serializes an instance to a JSON object. +* +* ## Notes +* +* - This method is implicitly invoked by `JSON.stringify`. +* +* @name toJSON +* @memberof BinTransform.prototype +* @type {Function} +* @returns {Object} JSON object +* +* @example +* var Field = require( '@stdlib/plot/vega/field/ctor' ); +* +* var field = new Field({ +* 'field': 'amount' +* }); +* +* var transform = new BinTransform({ +* 'extent': [ 0, 10 ], +* 'field': field +* }); +* +* var v = transform.toJSON(); +* // returns {...} +*/ +setNonEnumerableReadOnly( BinTransform.prototype, 'toJSON', function toJSON() { + return instance2json( this, properties ); +}); + + +// EXPORTS // + +module.exports = BinTransform; diff --git a/lib/node_modules/@stdlib/plot/vega/transform/bin/lib/maxbins/get.js b/lib/node_modules/@stdlib/plot/vega/transform/bin/lib/maxbins/get.js new file mode 100644 index 000000000000..67a19717d62a --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/transform/bin/lib/maxbins/get.js @@ -0,0 +1,43 @@ +/** +* @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. +*/ + +/* eslint-disable no-invalid-this */ + +'use strict'; + +// MODULES // + +var prop = require( './properties.js' ); + + +// MAIN // + +/** +* Returns a maximum number of bins. +* +* @private +* @returns {number} max bins +*/ +function get() { + return this[ prop.private ]; +} + + +// EXPORTS // + +module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/vega/transform/bin/lib/maxbins/properties.js b/lib/node_modules/@stdlib/plot/vega/transform/bin/lib/maxbins/properties.js new file mode 100644 index 000000000000..7f890b5910d5 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/transform/bin/lib/maxbins/properties.js @@ -0,0 +1,33 @@ +/** +* @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 property2object = require( '@stdlib/plot/vega/base/property2object' ); + + +// MAIN // + +var obj = property2object( 'maxbins' ); + + +// EXPORTS // + +module.exports = obj; diff --git a/lib/node_modules/@stdlib/plot/vega/transform/bin/lib/maxbins/set.js b/lib/node_modules/@stdlib/plot/vega/transform/bin/lib/maxbins/set.js new file mode 100644 index 000000000000..7200423e6512 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/transform/bin/lib/maxbins/set.js @@ -0,0 +1,61 @@ +/** +* @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. +*/ + +/* 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:bin-transform:set:'+prop.name ); + + +// MAIN // + +/** +* Sets a maximum number of bins. +* +* @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/transform/bin/lib/minstep/get.js b/lib/node_modules/@stdlib/plot/vega/transform/bin/lib/minstep/get.js new file mode 100644 index 000000000000..f263fd1977e4 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/transform/bin/lib/minstep/get.js @@ -0,0 +1,43 @@ +/** +* @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. +*/ + +/* eslint-disable no-invalid-this */ + +'use strict'; + +// MODULES // + +var prop = require( './properties.js' ); + + +// MAIN // + +/** +* Returns a minimum allowed bin step size. +* +* @private +* @returns {number} min step size +*/ +function get() { + return this[ prop.private ]; +} + + +// EXPORTS // + +module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/vega/transform/bin/lib/minstep/properties.js b/lib/node_modules/@stdlib/plot/vega/transform/bin/lib/minstep/properties.js new file mode 100644 index 000000000000..5679b4a03e16 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/transform/bin/lib/minstep/properties.js @@ -0,0 +1,33 @@ +/** +* @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 property2object = require( '@stdlib/plot/vega/base/property2object' ); + + +// MAIN // + +var obj = property2object( 'minstep' ); + + +// EXPORTS // + +module.exports = obj; diff --git a/lib/node_modules/@stdlib/plot/vega/transform/bin/lib/minstep/set.js b/lib/node_modules/@stdlib/plot/vega/transform/bin/lib/minstep/set.js new file mode 100644 index 000000000000..355c9b228845 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/transform/bin/lib/minstep/set.js @@ -0,0 +1,61 @@ +/** +* @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. +*/ + +/* 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:bin-transform:set:'+prop.name ); + + +// MAIN // + +/** +* Sets a minimum allowed bin step size. +* +* @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/transform/bin/lib/nice/get.js b/lib/node_modules/@stdlib/plot/vega/transform/bin/lib/nice/get.js new file mode 100644 index 000000000000..611744f54d63 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/transform/bin/lib/nice/get.js @@ -0,0 +1,43 @@ +/** +* @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. +*/ + +/* eslint-disable no-invalid-this */ + +'use strict'; + +// MODULES // + +var prop = require( './properties.js' ); + + +// MAIN // + +/** +* Returns a boolean indicating attempt to make bin boundaries "nice". +* +* @private +* @returns {boolean} boolean flag +*/ +function get() { + return this[ prop.private ]; +} + + +// EXPORTS // + +module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/vega/transform/bin/lib/nice/properties.js b/lib/node_modules/@stdlib/plot/vega/transform/bin/lib/nice/properties.js new file mode 100644 index 000000000000..61afcfc54f0d --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/transform/bin/lib/nice/properties.js @@ -0,0 +1,33 @@ +/** +* @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 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/transform/bin/lib/nice/set.js b/lib/node_modules/@stdlib/plot/vega/transform/bin/lib/nice/set.js new file mode 100644 index 000000000000..c1c649be4089 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/transform/bin/lib/nice/set.js @@ -0,0 +1,61 @@ +/** +* @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. +*/ + +/* 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:bin-transform:set:'+prop.name ); + + +// MAIN // + +/** +* Sets a boolean indicating attempt to make bin boundaries "nice". +* +* @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/transform/bin/lib/properties.json b/lib/node_modules/@stdlib/plot/vega/transform/bin/lib/properties.json new file mode 100644 index 000000000000..007360455a1d --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/transform/bin/lib/properties.json @@ -0,0 +1,16 @@ +[ + "anchor", + "as", + "base", + "divide", + "extent", + "field", + "interval", + "maxbins", + "minstep", + "nice", + "signal", + "span", + "step", + "steps" +] diff --git a/lib/node_modules/@stdlib/plot/vega/transform/bin/lib/properties/get.js b/lib/node_modules/@stdlib/plot/vega/transform/bin/lib/properties/get.js new file mode 100644 index 000000000000..f3cbb28454ea --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/transform/bin/lib/properties/get.js @@ -0,0 +1,41 @@ +/** +* @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 properties = require( './../properties.json' ); + + +// MAIN // + +/** +* Returns the list of enumerable properties. +* +* @private +* @returns {Array} properties +*/ +function get() { + return properties.slice(); +} + + +// EXPORTS // + +module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/vega/transform/bin/lib/signal/get.js b/lib/node_modules/@stdlib/plot/vega/transform/bin/lib/signal/get.js new file mode 100644 index 000000000000..03b4ad50e017 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/transform/bin/lib/signal/get.js @@ -0,0 +1,43 @@ +/** +* @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. +*/ + +/* eslint-disable no-invalid-this */ + +'use strict'; + +// MODULES // + +var prop = require( './properties.js' ); + + +// MAIN // + +/** +* Returns a computed binning specification bound to a signal with the given name. +* +* @private +* @returns {(string|void)} signal name +*/ +function get() { + return this[ prop.private ]; +} + + +// EXPORTS // + +module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/vega/transform/bin/lib/signal/properties.js b/lib/node_modules/@stdlib/plot/vega/transform/bin/lib/signal/properties.js new file mode 100644 index 000000000000..9a15daba64d4 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/transform/bin/lib/signal/properties.js @@ -0,0 +1,33 @@ +/** +* @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 property2object = require( '@stdlib/plot/vega/base/property2object' ); + + +// MAIN // + +var obj = property2object( 'signal' ); + + +// EXPORTS // + +module.exports = obj; diff --git a/lib/node_modules/@stdlib/plot/vega/transform/bin/lib/signal/set.js b/lib/node_modules/@stdlib/plot/vega/transform/bin/lib/signal/set.js new file mode 100644 index 000000000000..5b2d49b381de --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/transform/bin/lib/signal/set.js @@ -0,0 +1,66 @@ +/** +* @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. +*/ + +/* 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:bin-transform:set:'+prop.name ); + + +// MAIN // + +/** +* Sets a computed binning specification bound to a signal with the given name. +* +* ## 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/transform/bin/lib/span/get.js b/lib/node_modules/@stdlib/plot/vega/transform/bin/lib/span/get.js new file mode 100644 index 000000000000..71ab646869bc --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/transform/bin/lib/span/get.js @@ -0,0 +1,43 @@ +/** +* @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. +*/ + +/* eslint-disable no-invalid-this */ + +'use strict'; + +// MODULES // + +var prop = require( './properties.js' ); + + +// MAIN // + +/** +* Returns a span over which to generate bin boundaries. +* +* @private +* @returns {number} span +*/ +function get() { + return this[ prop.private ]; +} + + +// EXPORTS // + +module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/vega/transform/bin/lib/span/properties.js b/lib/node_modules/@stdlib/plot/vega/transform/bin/lib/span/properties.js new file mode 100644 index 000000000000..3619153079bc --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/transform/bin/lib/span/properties.js @@ -0,0 +1,33 @@ +/** +* @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 property2object = require( '@stdlib/plot/vega/base/property2object' ); + + +// MAIN // + +var obj = property2object( 'span' ); + + +// EXPORTS // + +module.exports = obj; diff --git a/lib/node_modules/@stdlib/plot/vega/transform/bin/lib/span/set.js b/lib/node_modules/@stdlib/plot/vega/transform/bin/lib/span/set.js new file mode 100644 index 000000000000..5853f31046d7 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/transform/bin/lib/span/set.js @@ -0,0 +1,61 @@ +/** +* @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. +*/ + +/* 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:bin-transform:set:'+prop.name ); + + +// MAIN // + +/** +* Sets a span over which to generate bin boundaries. +* +* @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/transform/bin/lib/step/get.js b/lib/node_modules/@stdlib/plot/vega/transform/bin/lib/step/get.js new file mode 100644 index 000000000000..d59153c6fa33 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/transform/bin/lib/step/get.js @@ -0,0 +1,43 @@ +/** +* @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. +*/ + +/* eslint-disable no-invalid-this */ + +'use strict'; + +// MODULES // + +var prop = require( './properties.js' ); + + +// MAIN // + +/** +* Returns a step size to use between bins. +* +* @private +* @returns {(number|void)} step size +*/ +function get() { + return this[ prop.private ]; +} + + +// EXPORTS // + +module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/vega/transform/bin/lib/step/properties.js b/lib/node_modules/@stdlib/plot/vega/transform/bin/lib/step/properties.js new file mode 100644 index 000000000000..7378229ee6fc --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/transform/bin/lib/step/properties.js @@ -0,0 +1,33 @@ +/** +* @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 property2object = require( '@stdlib/plot/vega/base/property2object' ); + + +// MAIN // + +var obj = property2object( 'step' ); + + +// EXPORTS // + +module.exports = obj; diff --git a/lib/node_modules/@stdlib/plot/vega/transform/bin/lib/step/set.js b/lib/node_modules/@stdlib/plot/vega/transform/bin/lib/step/set.js new file mode 100644 index 000000000000..4ded9af0e689 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/transform/bin/lib/step/set.js @@ -0,0 +1,66 @@ +/** +* @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. +*/ + +/* 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:bin-transform:set:'+prop.name ); + + +// MAIN // + +/** +* Sets a step size to use between bins. +* +* ## 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/transform/bin/lib/steps/get.js b/lib/node_modules/@stdlib/plot/vega/transform/bin/lib/steps/get.js new file mode 100644 index 000000000000..d364b0e07ac9 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/transform/bin/lib/steps/get.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. +*/ + +/* eslint-disable no-invalid-this */ + +'use strict'; + +// MODULES // + +var copy = require( '@stdlib/array/base/copy-indexed' ); +var prop = require( './properties.js' ); + + +// MAIN // + +/** +* Returns the array of allowable step sizes to choose from. +* +* @private +* @returns {(NumericArray|void)} step sizes +*/ +function get() { + return copy( this[ prop.private ] ); +} + + +// EXPORTS // + +module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/vega/transform/bin/lib/steps/properties.js b/lib/node_modules/@stdlib/plot/vega/transform/bin/lib/steps/properties.js new file mode 100644 index 000000000000..afc2a24047b5 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/transform/bin/lib/steps/properties.js @@ -0,0 +1,33 @@ +/** +* @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 property2object = require( '@stdlib/plot/vega/base/property2object' ); + + +// MAIN // + +var obj = property2object( 'steps' ); + + +// EXPORTS // + +module.exports = obj; diff --git a/lib/node_modules/@stdlib/plot/vega/transform/bin/lib/steps/set.js b/lib/node_modules/@stdlib/plot/vega/transform/bin/lib/steps/set.js new file mode 100644 index 000000000000..016f7f830600 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/transform/bin/lib/steps/set.js @@ -0,0 +1,84 @@ +/** +* @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. +*/ + +/* eslint-disable no-invalid-this */ + +'use strict'; + +// MODULES // + +var logger = require( 'debug' ); +var isNumberArray = require( '@stdlib/assert/is-number-array' ).primitives; +var isUndefined = require( '@stdlib/assert/is-undefined' ); +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:bin-transform:set:'+prop.name ); + + +// MAIN // + +/** +* Sets the array of allowable step sizes to choose from. +* +* ## Notes +* +* - Providing `undefined` "unsets" the configured value. +* +* @private +* @param {(NumericArray|void)} value - input value +* @throws {TypeError} must be an array of numbers +* @returns {void} +*/ +function set( value ) { + if ( !isNumberArray( value ) ) { + if ( isUndefined( value ) ) { + if ( value === this[ prop.private ] ) { + return; + } + debug( 'Current value: %s. New value: %s.', JSON.stringify( this[ prop.private ] ), value ); + this[ prop.private ] = value; + this.emit( 'change', changeEvent( prop.name ) ); + return; + } + throw new TypeError( format( 'invalid assignment. `%s` must be an array of numbers. Value: `%s`.', prop.name, value ) ); + } + value = copy( value ); + if ( isUndefined( this[ prop.private ] ) ) { + debug( 'Current value: %s. New value: %s.', this[ prop.private ], JSON.stringify( 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.', 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/transform/bin/package.json b/lib/node_modules/@stdlib/plot/vega/transform/bin/package.json new file mode 100644 index 000000000000..8bce205ba8e1 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/transform/bin/package.json @@ -0,0 +1,61 @@ +{ + "name": "@stdlib/plot/vega/transform/bin", + "version": "0.0.0", + "description": "Bin transform 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", + "transform", + "bin", + "constructor", + "ctor" + ], + "__stdlib__": {} +}