diff --git a/lib/node_modules/@stdlib/plot/vega/scale/band/examples/index.js b/lib/node_modules/@stdlib/plot/vega/scale/band/examples/index.js new file mode 100644 index 000000000000..ae5a1fbae392 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/scale/band/examples/index.js @@ -0,0 +1,32 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +var BandScale = require( './../lib' ); + +var scale = new BandScale({ + 'name': 'xScale', + 'align': 1.0, + 'domainImplicit': true, + 'padding': 0.1, + 'paddingInner': 0.5, + 'paddingOuter': 0.8 +}); + +console.log( scale.toJSON() ); diff --git a/lib/node_modules/@stdlib/plot/vega/scale/band/lib/align/get.js b/lib/node_modules/@stdlib/plot/vega/scale/band/lib/align/get.js new file mode 100644 index 000000000000..b2478c16c4e8 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/scale/band/lib/align/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 alignment which aligns the elements within the scale range. +* +* @private +* @returns {number} alignment +*/ +function get() { + return this[ prop.private ]; +} + + +// EXPORTS // + +module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/vega/scale/band/lib/align/properties.js b/lib/node_modules/@stdlib/plot/vega/scale/band/lib/align/properties.js new file mode 100644 index 000000000000..d8b59b16570b --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/scale/band/lib/align/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( 'align' ); + + +// EXPORTS // + +module.exports = obj; diff --git a/lib/node_modules/@stdlib/plot/vega/scale/band/lib/align/set.js b/lib/node_modules/@stdlib/plot/vega/scale/band/lib/align/set.js new file mode 100644 index 000000000000..14e158276399 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/scale/band/lib/align/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:band-scale:set:'+prop.name ); + + +// MAIN // + +/** +* Sets the alignment which aligns the elements within the scale range. +* +* @private +* @param {number} value - input value +* @throws {TypeError} must be a number +* @returns {void} +*/ +function set( value ) { + if ( !isNumber( value ) || value < 0.0 || value > 1.0 ) { + throw new TypeError( format( 'invalid assignment. `%s` must lie in the range [0,1]. Value: `%s`.', prop.name, value ) ); + } + if ( value !== this[ prop.private ] ) { + debug( 'Current value: %s. New value: %s.', this[ prop.private ], value ); + this[ prop.private ] = value; + this.emit( 'change', changeEvent( prop.name ) ); + } +} + + +// EXPORTS // + +module.exports = set; diff --git a/lib/node_modules/@stdlib/plot/vega/scale/band/lib/change_event.js b/lib/node_modules/@stdlib/plot/vega/scale/band/lib/change_event.js new file mode 100644 index 000000000000..730718cd6454 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/scale/band/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': 'scale', + 'property': property + }; +} + + +// EXPORTS // + +module.exports = event; diff --git a/lib/node_modules/@stdlib/plot/vega/scale/band/lib/defaults.js b/lib/node_modules/@stdlib/plot/vega/scale/band/lib/defaults.js new file mode 100644 index 000000000000..e01deb623fff --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/scale/band/lib/defaults.js @@ -0,0 +1,55 @@ +/** +* @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 defaults. +* +* @private +* @returns {Object} default options +* +* @example +* var o = defaults(); +* // returns {...} +*/ +function defaults() { + return { + // Alignment of elements within the scale range: + 'align': 0.5, + + // Boolean indicating whether an ordinal domain should be implicitly extended with new values: + 'domainImplicit': false, + + // Sets paddingInner and paddingOuter to the same padding value: + 'padding': 0, + + // Inner padding within each band step (as a fraction of the step size): + 'paddingInner': 0, + + // Outer padding at the ends of the scale range (as a fraction of the step size): + 'paddingOuter': 0 + }; +} + + +// EXPORTS // + +module.exports = defaults; diff --git a/lib/node_modules/@stdlib/plot/vega/scale/band/lib/domain-implicit/get.js b/lib/node_modules/@stdlib/plot/vega/scale/band/lib/domain-implicit/get.js new file mode 100644 index 000000000000..cc8cbe95e40d --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/scale/band/lib/domain-implicit/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 an ordinal domain should be implicitly extended with new values. +* +* @private +* @returns {boolean} boolean flag +*/ +function get() { + return this[ prop.private ]; +} + + +// EXPORTS // + +module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/vega/scale/band/lib/domain-implicit/properties.js b/lib/node_modules/@stdlib/plot/vega/scale/band/lib/domain-implicit/properties.js new file mode 100644 index 000000000000..0de6bbf58fcb --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/scale/band/lib/domain-implicit/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( 'domainImplicit' ); + + +// EXPORTS // + +module.exports = obj; diff --git a/lib/node_modules/@stdlib/plot/vega/scale/band/lib/domain-implicit/set.js b/lib/node_modules/@stdlib/plot/vega/scale/band/lib/domain-implicit/set.js new file mode 100644 index 000000000000..f14f7e654426 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/scale/band/lib/domain-implicit/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:band-scale:set:'+prop.name ); + + +// MAIN // + +/** +* Sets a boolean flag indicating whether an ordinal domain should be implicitly extended with new values. +* +* @private +* @param {boolean} value - input value +* @throws {TypeError} must be a boolean +* @returns {void} +*/ +function set( value ) { + if ( !isBoolean( value ) ) { + throw new TypeError( format( 'invalid assignment. `%s` must be a boolean. Value: `%s`.', prop.name, value ) ); + } + if ( value !== this[ prop.private ] ) { + debug( 'Current value: %s. New value: %s.', this[ prop.private ], value ); + this[ prop.private ] = value; + this.emit( 'change', changeEvent( prop.name ) ); + } +} + + +// EXPORTS // + +module.exports = set; diff --git a/lib/node_modules/@stdlib/plot/vega/scale/band/lib/index.js b/lib/node_modules/@stdlib/plot/vega/scale/band/lib/index.js new file mode 100644 index 000000000000..8a57c4bd8e08 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/scale/band/lib/index.js @@ -0,0 +1,42 @@ +/** +* @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'; + +/** +* Band scale constructor. +* +* @module @stdlib/plot/vega/scale/band +* +* @example +* var BandScale = require( '@stdlib/plot/vega/scale/band' ); +* +* var scale = new BandScale({ +* 'name': 'xScale' +* }); +* // returns +*/ + +// MODULES // + +var main = require( './main.js' ); + + +// EXPORTS // + +module.exports = main; diff --git a/lib/node_modules/@stdlib/plot/vega/scale/band/lib/main.js b/lib/node_modules/@stdlib/plot/vega/scale/band/lib/main.js new file mode 100644 index 000000000000..e391e2de9444 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/scale/band/lib/main.js @@ -0,0 +1,326 @@ +/** +* @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 */ + +'use strict'; + +// MODULES // + +var logger = require( 'debug' ); +var isObject = require( '@stdlib/assert/is-object' ); +var setReadWriteAccessor = require( '@stdlib/utils/define-read-write-accessor' ); +var setNonEnumerableReadOnly = require( '@stdlib/utils/define-nonenumerable-read-only-property' ); +var setNonEnumerableReadOnlyAccessor = require( '@stdlib/utils/define-nonenumerable-read-only-accessor' ); // eslint-disable-line id-length +var hasProp = require( '@stdlib/assert/has-property' ); +var inherit = require( '@stdlib/utils/inherit' ); +var objectKeys = require( '@stdlib/utils/keys' ); +var transformErrorMessage = require( '@stdlib/plot/vega/base/transform-validation-message' ); +var instance2json = require( '@stdlib/plot/vega/base/to-json' ); +var DiscreteScale = require( '@stdlib/plot/vega/scale/discrete' ); +var format = require( '@stdlib/string/format' ); +var properties = require( './properties.json' ); +var defaults = require( './defaults.js' ); +var TYPE = require( './type/type.js' ); + +// Note: keep the following in alphabetical order according to the `require` path... +var getAlign = require( './align/get.js' ); +var setAlign = require( './align/set.js' ); + +var getDomainImplicit = require( './domain-implicit/get.js' ); +var setDomainImplicit = require( './domain-implicit/set.js' ); + +var getPadding = require( './padding/get.js' ); +var setPadding = require( './padding/set.js' ); + +var getPaddingInner = require( './padding-inner/get.js' ); +var setPaddingInner = require( './padding-inner/set.js' ); + +var getPaddingOuter = require( './padding-outer/get.js' ); +var setPaddingOuter = require( './padding-outer/set.js' ); + +var getProperties = require( './properties/get.js' ); + +var getType = require( './type/get.js' ); +var setType = require( './type/set.js' ); + + +// VARIABLES // + +var debug = logger( 'vega:band-scale:main' ); + + +// MAIN // + +/** +* Band scale constructor. +* +* @constructor +* @param {Options} options - constructor options +* @param {string} options.name - scale name +* @param {number} [options.align=0.5] - alignment of elements within the scale range. +* @param {(Collection|Object|Signal)} [options.domain] - domain of associated data values +* @param {boolean} [options.domainImplicit=false] - boolean flag indicating whether an ordinal domain should be implicitly extended with new values. +* @param {number} [options.domainMax] - maximum value in the scale domain (overrides the `domain` option) +* @param {number} [options.domainMin] - minimum value in the scale domain (overrides the `domain` option) +* @param {number} [options.domainMid] - single mid-point value inserted into a two-element domain +* @param {Collection} [options.domainRaw] - array of raw domain values which overrides the `domain` property +* @param {(string|Object)} [options.interpolate] - scale range interpolation method +* @param {number} [options.padding=0] - padding value which sets paddingInner and paddingOuter to the same padding value +* @param {number} [options.paddingInner=0] - inner padding within each band step (as a fraction of the step size) +* @param {number} [options.paddingOuter=0] - outer padding at the ends of the scale range (as a fraction of the step size) +* @param {(Collection|Object|Signal|string)} [options.range] - scale range +* @param {boolean} [options.reverse=false] - boolean indicating whether to reverse the order of the scale range +* @param {boolean} [options.round=false] - boolean indicating whether to round numeric output values to integers +* @throws {TypeError} options argument must be an object +* @throws {Error} must provide valid options +* @returns {BandScale} scale instance +* +* @example +* var scale = new BandScale({ +* 'name': 'xScale' +* }); +* // returns +*/ +function BandScale( options ) { + var opts; + var keys; + var v; + var k; + var i; + if ( !( this instanceof BandScale ) ) { + return new BandScale( options ); + } + if ( !isObject( options ) ) { + throw new TypeError( format( 'invalid argument. Options argument must be an object. Value: `%s`.', options ) ); + } + if ( hasProp( options, 'type' ) && options.type !== TYPE ) { + throw new TypeError( format( 'invalid argument. `%s` option must be equal to "%s". Option: `%s`.', 'type', TYPE, options.type ) ); + } + // Check for required properties... + if ( !hasProp( options, 'name' ) ) { + throw new TypeError( 'invalid argument. Options argument must specify the scale name.' ); + } + DiscreteScale.call( this, { + 'name': options.name, + 'type': TYPE + }); + this._type = TYPE; + + // Resolve the default configuration: + opts = defaults(); + + // Set internal properties according to the default configuration... + keys = objectKeys( opts ); + for ( i = 0; i < keys.length; i++ ) { + k = keys[ i ]; + this[ '_'+k ] = opts[ k ]; + } + // Validate provided options by attempting to assign option values to corresponding fields... + for ( i = 0; i < properties.length; i++ ) { + k = properties[ i ]; + if ( !hasProp( options, k ) ) { + continue; + } + v = options[ k ]; + try { + this[ k ] = v; + } catch ( err ) { + debug( 'Encountered an error. Error: %s', err.message ); + + // FIXME: retain thrown error type + throw new Error( transformErrorMessage( err.message ) ); + } + } + return this; +} + +/* +* Inherit from a parent prototype. +*/ +inherit( BandScale, DiscreteScale ); + +/** +* Constructor name. +* +* @private +* @name name +* @memberof BandScale +* @readonly +* @type {string} +*/ +setNonEnumerableReadOnly( BandScale, 'name', 'BandScale' ); + +/** +* Alignment of elements within the scale range. +* +* @name align +* @memberof BandScale.prototype +* @type {number} +* @default 0 +* +* @example +* var scale = new BandScale({ +* 'name': 'xScale', +* 'align': 0.5 +* }); +* +* var v = scale.align; +* // returns 0.5 +*/ +setReadWriteAccessor( BandScale.prototype, 'align', getAlign, setAlign ); + +/** +* Boolean flag indicating whether an ordinal domain should be implicitly extended with new values. +* +* @name domainImplicit +* @memberof BandScale.prototype +* @type {boolean} +* @default false +* +* @example +* var scale = new BandScale({ +* 'name': 'xScale', +* 'domainImplicit': true +* }); +* +* var v = scale.domainImplicit; +* // returns true +*/ +setReadWriteAccessor( BandScale.prototype, 'domainImplicit', getDomainImplicit, setDomainImplicit ); + +/** +* Padding value which sets paddingInner and paddingOuter to the same padding value. +* +* @name padding +* @memberof BandScale.prototype +* @type {number} +* @default 0.5 +* +* @example +* var scale = new BandScale({ +* 'name': 'xScale', +* 'padding': 1 +* }); +* +* var v = scale.padding; +* // returns 1 +*/ +setReadWriteAccessor( BandScale.prototype, 'padding', getPadding, setPadding ); + +/** +* Inner padding within each band step (as a fraction of the step size). +* +* @name paddingInner +* @memberof BandScale.prototype +* @type {number} +* @default 0 +* +* @example +* var scale = new BandScale({ +* 'name': 'xScale', +* 'paddingInner': 0.5 +* }); +* +* var v = scale.paddingInner; +* // returns 0.5 +*/ +setReadWriteAccessor( BandScale.prototype, 'paddingInner', getPaddingInner, setPaddingInner ); + +/** +* Outer padding at the ends of the scale range (as a fraction of the step size). +* +* @name paddingOuter +* @memberof BandScale.prototype +* @type {number} +* @default 0 +* +* @example +* var scale = new BandScale({ +* 'name': 'xScale', +* 'paddingOuter': 0.5 +* }); +* +* var v = scale.paddingOuter; +* // returns 0.5 +*/ +setReadWriteAccessor( BandScale.prototype, 'paddingOuter', getPaddingOuter, setPaddingOuter ); + +/** +* Scale properties. +* +* @name properties +* @memberof BandScale.prototype +* @type {Array} +* +* @example +* var scale = new BandScale({ +* 'name': 'xScale' +* }); +* +* var v = scale.properties; +* // returns [...] +*/ +setNonEnumerableReadOnlyAccessor( BandScale.prototype, 'properties', getProperties ); + +/** +* Scale type. +* +* @name type +* @memberof BandScale.prototype +* @type {string} +* @default 'band' +* +* @example +* var scale = new BandScale({ +* 'name': 'xScale' +* }); +* +* var v = scale.type; +* // returns 'band' +*/ +setReadWriteAccessor( BandScale.prototype, 'type', getType, setType ); + +/** +* Serializes an instance to a JSON object. +* +* ## Notes +* +* - This method is implicitly invoked by `JSON.stringify`. +* +* @name toJSON +* @memberof BandScale.prototype +* @type {Function} +* @returns {Object} JSON object +* +* @example +* var scale = new BandScale({ +* 'name': 'xScale' +* }); +* +* var v = scale.toJSON(); +* // returns {...} +*/ +setNonEnumerableReadOnly( BandScale.prototype, 'toJSON', function toJSON() { + return instance2json( this, properties ); +}); + + +// EXPORTS // + +module.exports = BandScale; diff --git a/lib/node_modules/@stdlib/plot/vega/scale/band/lib/padding-inner/get.js b/lib/node_modules/@stdlib/plot/vega/scale/band/lib/padding-inner/get.js new file mode 100644 index 000000000000..35fbfdb2a582 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/scale/band/lib/padding-inner/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 value of inner padding within each band step (as a fraction of the step size). +* +* @private +* @returns {number} padding +*/ +function get() { + return this[ prop.private ]; +} + + +// EXPORTS // + +module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/vega/scale/band/lib/padding-inner/properties.js b/lib/node_modules/@stdlib/plot/vega/scale/band/lib/padding-inner/properties.js new file mode 100644 index 000000000000..c10d50202b0f --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/scale/band/lib/padding-inner/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( 'paddingInner' ); + + +// EXPORTS // + +module.exports = obj; diff --git a/lib/node_modules/@stdlib/plot/vega/scale/band/lib/padding-inner/set.js b/lib/node_modules/@stdlib/plot/vega/scale/band/lib/padding-inner/set.js new file mode 100644 index 000000000000..f49a7911c93b --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/scale/band/lib/padding-inner/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:band-scale:set:'+prop.name ); + + +// MAIN // + +/** +* Sets value of inner padding within each band step (as a fraction of the step size). +* +* @private +* @param {number} value - input value +* @throws {TypeError} must be a number +* @returns {void} +*/ +function set( value ) { + if ( !isNumber( value ) || value < 0.0 || value > 1.0 ) { + throw new TypeError( format( 'invalid assignment. `%s` must lie in the range [0,1]. Value: `%s`.', prop.name, value ) ); + } + if ( value !== this[ prop.private ] ) { + debug( 'Current value: %s. New value: %s.', this[ prop.private ], value ); + this[ prop.private ] = value; + this.emit( 'change', changeEvent( prop.name ) ); + } +} + + +// EXPORTS // + +module.exports = set; diff --git a/lib/node_modules/@stdlib/plot/vega/scale/band/lib/padding-outer/get.js b/lib/node_modules/@stdlib/plot/vega/scale/band/lib/padding-outer/get.js new file mode 100644 index 000000000000..1c45ec416131 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/scale/band/lib/padding-outer/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 value of outer padding at the ends of the scale range (as a fraction of the step size). +* +* @private +* @returns {number} padding +*/ +function get() { + return this[ prop.private ]; +} + + +// EXPORTS // + +module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/vega/scale/band/lib/padding-outer/properties.js b/lib/node_modules/@stdlib/plot/vega/scale/band/lib/padding-outer/properties.js new file mode 100644 index 000000000000..4db55cc213fb --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/scale/band/lib/padding-outer/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( 'paddingOuter' ); + + +// EXPORTS // + +module.exports = obj; diff --git a/lib/node_modules/@stdlib/plot/vega/scale/band/lib/padding-outer/set.js b/lib/node_modules/@stdlib/plot/vega/scale/band/lib/padding-outer/set.js new file mode 100644 index 000000000000..4b2dcda41bb6 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/scale/band/lib/padding-outer/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:band-scale:set:'+prop.name ); + + +// MAIN // + +/** +* Sets value of outer padding at the ends of the scale range (as a fraction of the step size). +* +* @private +* @param {number} value - input value +* @throws {TypeError} must be a number +* @returns {void} +*/ +function set( value ) { + if ( !isNumber( value ) || value < 0.0 || value > 1.0 ) { + throw new TypeError( format( 'invalid assignment. `%s` must lie in the range [0,1]. Value: `%s`.', prop.name, value ) ); + } + if ( value !== this[ prop.private ] ) { + debug( 'Current value: %s. New value: %s.', this[ prop.private ], value ); + this[ prop.private ] = value; + this.emit( 'change', changeEvent( prop.name ) ); + } +} + + +// EXPORTS // + +module.exports = set; diff --git a/lib/node_modules/@stdlib/plot/vega/scale/band/lib/padding/get.js b/lib/node_modules/@stdlib/plot/vega/scale/band/lib/padding/get.js new file mode 100644 index 000000000000..f319c14a9d93 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/scale/band/lib/padding/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 padding value which sets paddingInner and paddingOuter to the same padding value. +* +* @private +* @returns {number} padding +*/ +function get() { + return this[ prop.private ]; +} + + +// EXPORTS // + +module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/vega/scale/band/lib/padding/properties.js b/lib/node_modules/@stdlib/plot/vega/scale/band/lib/padding/properties.js new file mode 100644 index 000000000000..7c8d98d6884c --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/scale/band/lib/padding/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( 'padding' ); + + +// EXPORTS // + +module.exports = obj; diff --git a/lib/node_modules/@stdlib/plot/vega/scale/band/lib/padding/set.js b/lib/node_modules/@stdlib/plot/vega/scale/band/lib/padding/set.js new file mode 100644 index 000000000000..9d20adc5cd9b --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/scale/band/lib/padding/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:band-scale:set:'+prop.name ); + + +// MAIN // + +/** +* Sets the padding value which sets paddingInner and paddingOuter to the same padding value. +* +* @private +* @param {number} value - input value +* @throws {TypeError} must be a number +* @returns {void} +*/ +function set( value ) { + if ( !isNumber( value ) || value < 0.0 || value > 1.0 ) { + throw new TypeError( format( 'invalid assignment. `%s` must lie in the range [0,1]. Value: `%s`.', prop.name, value ) ); + } + if ( value !== this[ prop.private ] ) { + debug( 'Current value: %s. New value: %s.', this[ prop.private ], value ); + this[ prop.private ] = value; + this.emit( 'change', changeEvent( prop.name ) ); + } +} + + +// EXPORTS // + +module.exports = set; diff --git a/lib/node_modules/@stdlib/plot/vega/scale/band/lib/properties.json b/lib/node_modules/@stdlib/plot/vega/scale/band/lib/properties.json new file mode 100644 index 000000000000..16766543d61b --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/scale/band/lib/properties.json @@ -0,0 +1,19 @@ +[ + "domain", + "domainMax", + "domainMin", + "domainMid", + "domainRaw", + "interpolate", + "name", + "range", + "reverse", + "round", + "type", + + "align", + "domainImplicit", + "padding", + "paddingInner", + "paddingOuter" +] diff --git a/lib/node_modules/@stdlib/plot/vega/scale/band/lib/properties/get.js b/lib/node_modules/@stdlib/plot/vega/scale/band/lib/properties/get.js new file mode 100644 index 000000000000..f3cbb28454ea --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/scale/band/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/scale/band/lib/type/get.js b/lib/node_modules/@stdlib/plot/vega/scale/band/lib/type/get.js new file mode 100644 index 000000000000..b0e023118efa --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/scale/band/lib/type/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 TYPE = require( './type.js' ); + + +// MAIN // + +/** +* Returns the scale type. +* +* @private +* @returns {string} scale type +*/ +function get() { + return TYPE; +} + + +// EXPORTS // + +module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/vega/scale/band/lib/type/set.js b/lib/node_modules/@stdlib/plot/vega/scale/band/lib/type/set.js new file mode 100644 index 000000000000..d14f0839d329 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/scale/band/lib/type/set.js @@ -0,0 +1,46 @@ +/** +* @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 format = require( '@stdlib/string/format' ); +var TYPE = require( './type.js' ); + + +// MAIN // + +/** +* Sets the scale type. +* +* @private +* @param {string} value - input value +* @throws {TypeError} must be a valid scale +* @returns {void} +*/ +function set( value ) { + if ( value !== TYPE ) { + throw new TypeError( format( 'invalid assignment. `%s` must be equal to "%s". Value: `%s`.', 'type', TYPE, value ) ); + } +} + + +// EXPORTS // + +module.exports = set; diff --git a/lib/node_modules/@stdlib/plot/vega/scale/band/lib/type/type.js b/lib/node_modules/@stdlib/plot/vega/scale/band/lib/type/type.js new file mode 100644 index 000000000000..67190eb4ee81 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/scale/band/lib/type/type.js @@ -0,0 +1,23 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// EXPORTS // + +module.exports = 'band'; diff --git a/lib/node_modules/@stdlib/plot/vega/scale/band/package.json b/lib/node_modules/@stdlib/plot/vega/scale/band/package.json new file mode 100644 index 000000000000..d1a33dd41c8b --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/scale/band/package.json @@ -0,0 +1,63 @@ +{ + "name": "@stdlib/plot/vega/scale/band", + "version": "0.0.0", + "description": "Band scale constructor.", + "license": "Apache-2.0", + "author": { + "name": "The Stdlib Authors", + "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" + }, + "contributors": [ + { + "name": "The Stdlib Authors", + "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" + } + ], + "main": "./lib", + "directories": { + "benchmark": "./benchmark", + "doc": "./docs", + "example": "./examples", + "lib": "./lib", + "test": "./test" + }, + "types": "./docs/types", + "scripts": {}, + "homepage": "https://github.com/stdlib-js/stdlib", + "repository": { + "type": "git", + "url": "git://github.com/stdlib-js/stdlib.git" + }, + "bugs": { + "url": "https://github.com/stdlib-js/stdlib/issues" + }, + "dependencies": {}, + "devDependencies": {}, + "engines": { + "node": ">=0.10.0", + "npm": ">2.7.0" + }, + "os": [ + "aix", + "darwin", + "freebsd", + "linux", + "macos", + "openbsd", + "sunos", + "win32", + "windows" + ], + "keywords": [ + "stdlib", + "plot", + "vega", + "scale", + "discrete", + "categorical", + "band", + "constructor", + "ctor" + ], + "__stdlib__": {} +}