Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 43 additions & 0 deletions lib/node_modules/@stdlib/plot/vega/value/ctor/lib/band/get.js
Original file line number Diff line number Diff line change
@@ -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;
Original file line number Diff line number Diff line change
@@ -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;
66 changes: 66 additions & 0 deletions lib/node_modules/@stdlib/plot/vega/value/ctor/lib/band/set.js
Original file line number Diff line number Diff line change
@@ -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.

Check warning on line 45 in lib/node_modules/@stdlib/plot/vega/value/ctor/lib/band/set.js

View workflow job for this annotation

GitHub Actions / Lint Changed Files

Unknown word: "unsets"
*
* @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;
86 changes: 85 additions & 1 deletion lib/node_modules/@stdlib/plot/vega/value/ctor/lib/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@
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' );

Expand All @@ -45,8 +48,17 @@
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' );
Expand All @@ -68,7 +80,7 @@
*
* @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
Expand Down Expand Up @@ -121,7 +133,7 @@
} catch ( err ) {
debug( 'Encountered an error. Error: %s', err.message );

// FIXME: retain thrown error type

Check warning on line 136 in lib/node_modules/@stdlib/plot/vega/value/ctor/lib/main.js

View workflow job for this annotation

GitHub Actions / Lint Changed Files

Unexpected 'fixme' comment: 'FIXME: retain thrown error type'
throw new Error( transformErrorMessage( err.message ) );
}
}
Expand Down Expand Up @@ -175,6 +187,24 @@
);
});

/**
* 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.
*
Expand Down Expand Up @@ -229,6 +259,42 @@
*/
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;

Check warning on line 275 in lib/node_modules/@stdlib/plot/vega/value/ctor/lib/main.js

View workflow job for this annotation

GitHub Actions / Lint Changed Files

Unknown word: "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.
*
Expand All @@ -244,6 +310,24 @@
*/
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.
*
Expand Down
43 changes: 43 additions & 0 deletions lib/node_modules/@stdlib/plot/vega/value/ctor/lib/mult/get.js
Original file line number Diff line number Diff line change
@@ -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;
Original file line number Diff line number Diff line change
@@ -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;
Loading
Loading