diff --git a/lib/node_modules/@stdlib/plot/vega/value/ctor/lib/band/get.js b/lib/node_modules/@stdlib/plot/vega/value/ctor/lib/band/get.js new file mode 100644 index 000000000000..1e39f97c7c48 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/value/ctor/lib/band/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'; + +// VARIABLES // + +var prop = require( './properties.js' ); + + +// MAIN // + +/** +* Returns a multiplication factor for the band width of a scale. +* +* @private +* @returns {(number|void)} multiplication factor +*/ +function get() { + return this[ prop.private ]; +} + + +// EXPORTS // + +module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/vega/value/ctor/lib/band/properties.js b/lib/node_modules/@stdlib/plot/vega/value/ctor/lib/band/properties.js new file mode 100644 index 000000000000..977ba60a8280 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/value/ctor/lib/band/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( 'band' ); + + +// EXPORTS // + +module.exports = obj; diff --git a/lib/node_modules/@stdlib/plot/vega/value/ctor/lib/band/set.js b/lib/node_modules/@stdlib/plot/vega/value/ctor/lib/band/set.js new file mode 100644 index 000000000000..9585ca44ba68 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/value/ctor/lib/band/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:value:set:'+prop.name ); + + +// MAIN // + +/** +* Sets a multiplication factor for the band width of a scale. +* +* ## 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.', 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/value/ctor/lib/main.js b/lib/node_modules/@stdlib/plot/vega/value/ctor/lib/main.js index 8acde0a77dad..c7736edeede5 100644 --- a/lib/node_modules/@stdlib/plot/vega/value/ctor/lib/main.js +++ b/lib/node_modules/@stdlib/plot/vega/value/ctor/lib/main.js @@ -36,6 +36,9 @@ var format = require( '@stdlib/string/format' ); var properties = require( './properties.json' ); // Note: keep the following in alphabetical order according to the `require` path... +var getBand = require( './band/get.js' ); +var setBand = require( './band/set.js' ); + var getColor = require( './color/get.js' ); var setColor = require( './color/set.js' ); @@ -45,8 +48,17 @@ var setExponent = require( './exponent/set.js' ); var getField = require( './field/get.js' ); var setField = require( './field/set.js' ); +var getMult = require( './mult/get.js' ); +var setMult = require( './mult/set.js' ); + +var getOffset = require( './offset/get.js' ); +var setOffset = require( './offset/set.js' ); + var getProperties = require( './properties/get.js' ); +var getRound = require( './round/get.js' ); +var setRound = require( './round/set.js' ); + var getScale = require( './scale/get.js' ); var setScale = require( './scale/set.js' ); var getSignal = require( './signal/get.js' ); @@ -68,7 +80,7 @@ var debug = logger( 'vega:value:main' ); * * @constructor * @param {Options} [options] - constructor options -* @param {number} [options.band] - band width of a scale multiplication factor +* @param {number} [options.band] - multiplication factor for the band width of a scale * @param {Object} [options.color] - color value specifying per-channel references * @param {(number|Value)} [options.exponent] - scale exponent modifier * @param {(string|FieldDescriptor)} [options.field] - data field name or descriptor @@ -175,6 +187,24 @@ setNonEnumerableReadOnly( Value.prototype, '_isValue', function isValue( value ) ); }); +/** +* Multiplication factor for the band width of a scale. +* +* @name band +* @memberof Value.prototype +* @type {(number|void)} +* @default undefined +* +* @example +* var value = new Value({ +* 'band': 0.5 +* }); +* +* var v = value.band; +* // returns 0.5 +*/ +setReadWriteAccessor( Value.prototype, 'band', getBand, setBand ); + /** * Color value specifying per-channel references. * @@ -229,6 +259,42 @@ setReadWriteAccessor( Value.prototype, 'exponent', getExponent, setExponent ); */ setReadWriteAccessor( Value.prototype, 'field', getField, setField ); +/** +* Scale multiplier modifier. +* +* @name mult +* @memberof Value.prototype +* @type {(number|Value|void)} +* @default undefined +* +* @example +* var value = new Value({ +* 'mult': 2 +* }); +* +* var v = value.mult; +* // returns 2 +*/ +setReadWriteAccessor( Value.prototype, 'mult', getMult, setMult ); + +/** +* Scale additive offset. +* +* @name offset +* @memberof Value.prototype +* @type {(number|Value|void)} +* @default undefined +* +* @example +* var value = new Value({ +* 'offset': 5 +* }); +* +* var v = value.offset; +* // returns 5 +*/ +setReadWriteAccessor( Value.prototype, 'offset', getOffset, setOffset ); + /** * Value properties. * @@ -244,6 +310,24 @@ setReadWriteAccessor( Value.prototype, 'field', getField, setField ); */ setNonEnumerableReadOnlyAccessor( Value.prototype, 'properties', getProperties ); +/** +* Boolean indicating whether to round a value after scale transformations. +* +* @name round +* @memberof Value.prototype +* @type {(boolean|void)} +* @default undefined +* +* @example +* var value = new Value({ +* 'round': true +* }); +* +* var v = value.round; +* // returns true +*/ +setReadWriteAccessor( Value.prototype, 'round', getRound, setRound ); + /** * Name of a scale transform to apply or a field descriptor. * diff --git a/lib/node_modules/@stdlib/plot/vega/value/ctor/lib/mult/get.js b/lib/node_modules/@stdlib/plot/vega/value/ctor/lib/mult/get.js new file mode 100644 index 000000000000..ab716f0f695a --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/value/ctor/lib/mult/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'; + +// VARIABLES // + +var prop = require( './properties.js' ); + + +// MAIN // + +/** +* Returns a scale multiplier modifier. +* +* @private +* @returns {(number|Value|void)} scale multiplier modifier +*/ +function get() { + return this[ prop.private ]; +} + + +// EXPORTS // + +module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/vega/value/ctor/lib/mult/properties.js b/lib/node_modules/@stdlib/plot/vega/value/ctor/lib/mult/properties.js new file mode 100644 index 000000000000..b6f87b088e1d --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/value/ctor/lib/mult/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( 'mult' ); + + +// EXPORTS // + +module.exports = obj; diff --git a/lib/node_modules/@stdlib/plot/vega/value/ctor/lib/mult/set.js b/lib/node_modules/@stdlib/plot/vega/value/ctor/lib/mult/set.js new file mode 100644 index 000000000000..8e390954dd5a --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/value/ctor/lib/mult/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:value:set:'+prop.name ); + + +// MAIN // + +/** +* Sets a scale multiplier modifier. +* +* ## Notes +* +* - Providing `undefined` "unsets" the configured value. +* +* @private +* @param {(number|Value|void)} value - input value +* @throws {TypeError} must be a number or a value instance +* @returns {void} +*/ +function set( value ) { + if ( !isNumber( value ) && !isUndefined( value ) && !this._isValue( value ) ) { + throw new TypeError( format( 'invalid assignment. `%s` must be a number or value instance. Value: `%s`.', prop.name, value ) ); + } + if ( value !== this[ prop.private ] ) { + debug( 'Current value: %s. New value: %s.', JSON.stringify( this[ prop.private ] ), JSON.stringify( value ) ); + this[ prop.private ] = value; + this.emit( 'change', changeEvent( prop.name ) ); + } +} + + +// EXPORTS // + +module.exports = set; diff --git a/lib/node_modules/@stdlib/plot/vega/value/ctor/lib/offset/get.js b/lib/node_modules/@stdlib/plot/vega/value/ctor/lib/offset/get.js new file mode 100644 index 000000000000..6fd98e245e00 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/value/ctor/lib/offset/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'; + +// VARIABLES // + +var prop = require( './properties.js' ); + + +// MAIN // + +/** +* Returns a scale additive offset. +* +* @private +* @returns {(number|Value|void)} scale additive offset +*/ +function get() { + return this[ prop.private ]; +} + + +// EXPORTS // + +module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/vega/value/ctor/lib/offset/properties.js b/lib/node_modules/@stdlib/plot/vega/value/ctor/lib/offset/properties.js new file mode 100644 index 000000000000..d1b5fccec871 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/value/ctor/lib/offset/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( 'offset' ); + + +// EXPORTS // + +module.exports = obj; diff --git a/lib/node_modules/@stdlib/plot/vega/value/ctor/lib/offset/set.js b/lib/node_modules/@stdlib/plot/vega/value/ctor/lib/offset/set.js new file mode 100644 index 000000000000..4342ec1f4467 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/value/ctor/lib/offset/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:value:set:'+prop.name ); + + +// MAIN // + +/** +* Sets a scale additive offset. +* +* ## Notes +* +* - Providing `undefined` "unsets" the configured value. +* +* @private +* @param {(number|Value|void)} value - input value +* @throws {TypeError} must be a number or a value instance +* @returns {void} +*/ +function set( value ) { + if ( !isNumber( value ) && !isUndefined( value ) && !this._isValue( value ) ) { + throw new TypeError( format( 'invalid assignment. `%s` must be a number or value instance. Value: `%s`.', prop.name, value ) ); + } + if ( value !== this[ prop.private ] ) { + debug( 'Current value: %s. New value: %s.', JSON.stringify( this[ prop.private ] ), JSON.stringify( value ) ); + this[ prop.private ] = value; + this.emit( 'change', changeEvent( prop.name ) ); + } +} + + +// EXPORTS // + +module.exports = set; diff --git a/lib/node_modules/@stdlib/plot/vega/value/ctor/lib/round/get.js b/lib/node_modules/@stdlib/plot/vega/value/ctor/lib/round/get.js new file mode 100644 index 000000000000..6401fa968b83 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/value/ctor/lib/round/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'; + +// VARIABLES // + +var prop = require( './properties.js' ); + + +// MAIN // + +/** +* Returns a boolean indicating whether to round a value after scale transformations. +* +* @private +* @returns {(boolean|void)} boolean flag +*/ +function get() { + return this[ prop.private ]; +} + + +// EXPORTS // + +module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/vega/value/ctor/lib/round/properties.js b/lib/node_modules/@stdlib/plot/vega/value/ctor/lib/round/properties.js new file mode 100644 index 000000000000..940065171f35 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/value/ctor/lib/round/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( 'round' ); + + +// EXPORTS // + +module.exports = obj; diff --git a/lib/node_modules/@stdlib/plot/vega/value/ctor/lib/round/set.js b/lib/node_modules/@stdlib/plot/vega/value/ctor/lib/round/set.js new file mode 100644 index 000000000000..f106a5707c2b --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/value/ctor/lib/round/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 isBoolean = require( '@stdlib/assert/is-boolean' ).isPrimitive; +var isUndefined = require( '@stdlib/assert/is-undefined' ); +var format = require( '@stdlib/string/format' ); +var changeEvent = require( './../change_event.js' ); +var prop = require( './properties.js' ); + + +// VARIABLES // + +var debug = logger( 'vega:value:set:'+prop.name ); + + +// MAIN // + +/** +* Sets a boolean indicating whether to round a value after scale transformations. +* +* ## Notes +* +* - Providing `undefined` "unsets" the configured value. +* +* @private +* @param {(boolean|void)} value - input value +* @throws {TypeError} must be a boolean +* @returns {void} +*/ +function set( value ) { + if ( !isBoolean( value ) && !isUndefined( value ) ) { + throw new TypeError( format( 'invalid assignment. `%s` must be a boolean. Value: `%s`.', prop.name, value ) ); + } + if ( value !== this[ prop.private ] ) { + debug( 'Current value: %s. New value: %s.', JSON.stringify( this[ prop.private ] ), JSON.stringify( value ) ); + this[ prop.private ] = value; + this.emit( 'change', changeEvent( prop.name ) ); + } +} + + +// EXPORTS // + +module.exports = set;