From 7355be233adc9d3467c52cf6991972c16780d101 Mon Sep 17 00:00:00 2001 From: orthodox-64 Date: Sun, 10 May 2026 01:28:42 +0530 Subject: [PATCH 1/3] feat: add plot/vega/mark/area --- .../plot/vega/mark/area/examples/index.js | 27 ++ .../plot/vega/mark/area/lib/change_event.js | 41 +++ .../plot/vega/mark/area/lib/defaults.js | 49 +++ .../plot/vega/mark/area/lib/defined/get.js | 43 +++ .../vega/mark/area/lib/defined/properties.js | 33 ++ .../plot/vega/mark/area/lib/defined/set.js | 66 ++++ .../@stdlib/plot/vega/mark/area/lib/index.js | 42 +++ .../vega/mark/area/lib/interpolate/get.js | 43 +++ .../mark/area/lib/interpolate/properties.js | 33 ++ .../vega/mark/area/lib/interpolate/set.js | 63 ++++ .../@stdlib/plot/vega/mark/area/lib/main.js | 295 ++++++++++++++++++ .../plot/vega/mark/area/lib/orient/get.js | 43 +++ .../vega/mark/area/lib/orient/properties.js | 33 ++ .../plot/vega/mark/area/lib/orient/set.js | 63 ++++ .../plot/vega/mark/area/lib/properties.json | 22 ++ .../plot/vega/mark/area/lib/properties/get.js | 41 +++ .../plot/vega/mark/area/lib/tension/get.js | 43 +++ .../vega/mark/area/lib/tension/properties.js | 33 ++ .../plot/vega/mark/area/lib/tension/set.js | 61 ++++ .../plot/vega/mark/area/lib/type/get.js | 41 +++ .../plot/vega/mark/area/lib/type/set.js | 46 +++ .../plot/vega/mark/area/lib/type/type.js | 23 ++ .../@stdlib/plot/vega/mark/area/package.json | 59 ++++ 23 files changed, 1243 insertions(+) create mode 100644 lib/node_modules/@stdlib/plot/vega/mark/area/examples/index.js create mode 100644 lib/node_modules/@stdlib/plot/vega/mark/area/lib/change_event.js create mode 100644 lib/node_modules/@stdlib/plot/vega/mark/area/lib/defaults.js create mode 100644 lib/node_modules/@stdlib/plot/vega/mark/area/lib/defined/get.js create mode 100644 lib/node_modules/@stdlib/plot/vega/mark/area/lib/defined/properties.js create mode 100644 lib/node_modules/@stdlib/plot/vega/mark/area/lib/defined/set.js create mode 100644 lib/node_modules/@stdlib/plot/vega/mark/area/lib/index.js create mode 100644 lib/node_modules/@stdlib/plot/vega/mark/area/lib/interpolate/get.js create mode 100644 lib/node_modules/@stdlib/plot/vega/mark/area/lib/interpolate/properties.js create mode 100644 lib/node_modules/@stdlib/plot/vega/mark/area/lib/interpolate/set.js create mode 100644 lib/node_modules/@stdlib/plot/vega/mark/area/lib/main.js create mode 100644 lib/node_modules/@stdlib/plot/vega/mark/area/lib/orient/get.js create mode 100644 lib/node_modules/@stdlib/plot/vega/mark/area/lib/orient/properties.js create mode 100644 lib/node_modules/@stdlib/plot/vega/mark/area/lib/orient/set.js create mode 100644 lib/node_modules/@stdlib/plot/vega/mark/area/lib/properties.json create mode 100644 lib/node_modules/@stdlib/plot/vega/mark/area/lib/properties/get.js create mode 100644 lib/node_modules/@stdlib/plot/vega/mark/area/lib/tension/get.js create mode 100644 lib/node_modules/@stdlib/plot/vega/mark/area/lib/tension/properties.js create mode 100644 lib/node_modules/@stdlib/plot/vega/mark/area/lib/tension/set.js create mode 100644 lib/node_modules/@stdlib/plot/vega/mark/area/lib/type/get.js create mode 100644 lib/node_modules/@stdlib/plot/vega/mark/area/lib/type/set.js create mode 100644 lib/node_modules/@stdlib/plot/vega/mark/area/lib/type/type.js create mode 100644 lib/node_modules/@stdlib/plot/vega/mark/area/package.json diff --git a/lib/node_modules/@stdlib/plot/vega/mark/area/examples/index.js b/lib/node_modules/@stdlib/plot/vega/mark/area/examples/index.js new file mode 100644 index 000000000000..f3fa878f53d7 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/mark/area/examples/index.js @@ -0,0 +1,27 @@ +/** +* @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 AreaMark = require( './../lib' ); + +var mark = new AreaMark({ + 'interpolate': 'monotone' +}); + +console.log( mark.toJSON() ); diff --git a/lib/node_modules/@stdlib/plot/vega/mark/area/lib/change_event.js b/lib/node_modules/@stdlib/plot/vega/mark/area/lib/change_event.js new file mode 100644 index 000000000000..359afbfa206b --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/mark/area/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': 'mark', + 'property': property + }; +} + + +// EXPORTS // + +module.exports = event; diff --git a/lib/node_modules/@stdlib/plot/vega/mark/area/lib/defaults.js b/lib/node_modules/@stdlib/plot/vega/mark/area/lib/defaults.js new file mode 100644 index 000000000000..874416fa8bcc --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/mark/area/lib/defaults.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'; + +// MAIN // + +/** +* Returns defaults. +* +* @private +* @returns {Object} default options +* +* @example +* var o = defaults(); +* // returns {...} +*/ +function defaults() { + return { + // The orientation of the area: + 'orient': 'vertical', + + // The interpolation method for the area: + 'interpolate': 'linear', + + // The tension parameter for cardinal and catmull-rom interpolation: + 'tension': 0.5 + }; +} + + +// EXPORTS // + +module.exports = defaults; diff --git a/lib/node_modules/@stdlib/plot/vega/mark/area/lib/defined/get.js b/lib/node_modules/@stdlib/plot/vega/mark/area/lib/defined/get.js new file mode 100644 index 000000000000..ab9e2dfd7f7d --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/mark/area/lib/defined/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 defined flag. +* +* @private +* @returns {(boolean|void)} defined flag +*/ +function get() { + return this[ prop.private ]; +} + + +// EXPORTS // + +module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/vega/mark/area/lib/defined/properties.js b/lib/node_modules/@stdlib/plot/vega/mark/area/lib/defined/properties.js new file mode 100644 index 000000000000..21cb5d64d313 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/mark/area/lib/defined/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( 'defined' ); + + +// EXPORTS // + +module.exports = obj; diff --git a/lib/node_modules/@stdlib/plot/vega/mark/area/lib/defined/set.js b/lib/node_modules/@stdlib/plot/vega/mark/area/lib/defined/set.js new file mode 100644 index 000000000000..d416bee5f1aa --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/mark/area/lib/defined/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:area-mark:set:'+prop.name ); + + +// MAIN // + +/** +* Sets the defined flag. +* +* ## 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.', 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/mark/area/lib/index.js b/lib/node_modules/@stdlib/plot/vega/mark/area/lib/index.js new file mode 100644 index 000000000000..e1afda4784fb --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/mark/area/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'; + +/** +* Area mark constructor. +* +* @module @stdlib/plot/vega/mark/area +* +* @example +* var AreaMark = require( '@stdlib/plot/vega/mark/area' ); +* +* var mark = new AreaMark({ +* 'interpolate': 'monotone' +* }); +* // returns +*/ + +// MODULES // + +var main = require( './main.js' ); + + +// EXPORTS // + +module.exports = main; diff --git a/lib/node_modules/@stdlib/plot/vega/mark/area/lib/interpolate/get.js b/lib/node_modules/@stdlib/plot/vega/mark/area/lib/interpolate/get.js new file mode 100644 index 000000000000..51881751b573 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/mark/area/lib/interpolate/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 interpolation method. +* +* @private +* @returns {string} interpolation method +*/ +function get() { + return this[ prop.private ]; +} + + +// EXPORTS // + +module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/vega/mark/area/lib/interpolate/properties.js b/lib/node_modules/@stdlib/plot/vega/mark/area/lib/interpolate/properties.js new file mode 100644 index 000000000000..fa8d68680162 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/mark/area/lib/interpolate/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( 'interpolate' ); + + +// EXPORTS // + +module.exports = obj; diff --git a/lib/node_modules/@stdlib/plot/vega/mark/area/lib/interpolate/set.js b/lib/node_modules/@stdlib/plot/vega/mark/area/lib/interpolate/set.js new file mode 100644 index 000000000000..73abb8039cb1 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/mark/area/lib/interpolate/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 isMarkInterpolationMethod = require( '@stdlib/plot/vega/base/assert/is-mark-interpolation-method' ); +var join = require( '@stdlib/array/base/join' ); +var markInterpolationMethods = require( '@stdlib/plot/vega/mark/interpolation-methods' ); +var format = require( '@stdlib/string/format' ); +var changeEvent = require( './../change_event.js' ); +var prop = require( './properties.js' ); + + +// VARIABLES // + +var debug = logger( 'vega:area-mark:set:'+prop.name ); + + +// MAIN // + +/** +* Sets the interpolation method. +* +* @private +* @param {string} value - input value +* @throws {TypeError} must be a valid interpolation method +* @returns {void} +*/ +function set( value ) { + if ( !isMarkInterpolationMethod( value ) ) { + throw new TypeError( format( 'invalid assignment. `%s` must be one of the following: "%s". Value: `%s`.', prop.name, join( markInterpolationMethods(), '", "' ), 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/mark/area/lib/main.js b/lib/node_modules/@stdlib/plot/vega/mark/area/lib/main.js new file mode 100644 index 000000000000..bb7d4dd9f684 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/mark/area/lib/main.js @@ -0,0 +1,295 @@ +/** +* @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 Mark = require( '@stdlib/plot/vega/mark/base/ctor' ); +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 getDefined = require( './defined/get.js' ); +var setDefined = require( './defined/set.js' ); +var getInterpolate = require( './interpolate/get.js' ); +var setInterpolate = require( './interpolate/set.js' ); +var getOrient = require( './orient/get.js' ); +var setOrient = require( './orient/set.js' ); +var getProperties = require( './properties/get.js' ); +var getTension = require( './tension/get.js' ); +var setTension = require( './tension/set.js' ); +var getType = require( './type/get.js' ); +var setType = require( './type/set.js' ); +var TYPE = require( './type/type.js' ); + + +// VARIABLES // + +var debug = logger(' vega:area-mark:main '); + + +// MAIN // + +/** +* Area mark constructor. +* +* @constructor +* @param {Options} [options] - constructor options +* @param {boolean} [options.aria=true] - boolean indicating whether to include ARIA attributes in SVG output +* @param {(boolean|Signal|Object)} [options.clip=false] - setting indicating whether to clip marks to a specified shape +* @param {boolean} [options.defined] - boolean indicating whether the area is defined at a data point +* @param {string} [options.description] - text description of a mark for ARIA accessibility +* @param {Object} [options.encode] - object containing visual encoding rules for mark properties +* @param {Object} [options.from] - object describing the data a mark should visualize +* @param {boolean} [options.interactive=true] - boolean indicating whether a mark can serve as an input event source +* @param {string} [options.interpolate='linear'] - interpolation method +* @param {(string|Object)} [options.key] - data field to use as a unique key for data binding +* @param {string} [options.name] - unique name +* @param {string} [options.orient='vertical'] - orientation of the area +* @param {string} [options.role] - metadata string indicating the role of a mark +* @param {Object} [options.sort] - comparator for sorting mark items +* @param {(string|Array)} [options.style] - custom styles to apply to a mark +* @param {number} [options.tension=0.5] - numerical tension for cardinal and catmull-rom interpolation +* @param {Array} [options.transforms=[]] - list of post-encoding transforms to apply after any "encode" blocks and which operate directly on mark scenegraph items +* @param {Array} [options.triggers=[]] - list of triggers for modifying mark properties in response to signal changes +* @param {number} [options.zindex=0] - integer z-index indicating the layering of a mark relative to other marks +* @throws {TypeError} options argument must be an object +* @throws {TypeError} `type` option, if provided, must be equal to "area" +* @throws {Error} must provide valid options +* @returns {AreaMark} area mark instance +* +* @example +* var mark = new AreaMark({ +* 'interpolate': 'monotone' +* }); +* // returns +*/ +function AreaMark( options ) { + var opts; + var keys; + var v; + var k; + var i; + if ( !( this instanceof AreaMark ) ) { + if ( arguments.length === 0 ) { + return new AreaMark( {} ); + } + return new AreaMark( options ); + } + if ( arguments.length === 0 ) { + 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 ) ); + } + options.type = TYPE; + Mark.call( this, options ); + + // 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 ) ); + } + } + this._type = TYPE; + return this; +} + +/* +* Inherit from a parent prototype. +*/ +inherit( AreaMark, Mark ); + +/** +* Constructor name. +* +* @private +* @name name +* @memberof AreaMark +* @readonly +* @type {string} +*/ +setNonEnumerableReadOnly( AreaMark, 'name', 'AreaMark' ); + +/** +* Boolean indicating whether the area is defined at a data point. +* +* @name defined +* @memberof AreaMark.prototype +* @type {(boolean|void)} +* +* @example +* var mark = new AreaMark({ +* 'defined': true +* }); +* +* var v = mark.defined; +* // returns true +*/ +setReadWriteAccessor( AreaMark.prototype, 'defined', getDefined, setDefined ); + +/** +* Interpolation method. +* +* @name interpolate +* @memberof AreaMark.prototype +* @type {string} +* @default 'linear' +* +* @example +* var mark = new AreaMark({ +* 'interpolate': 'monotone' +* }); +* +* var v = mark.interpolate; +* // returns 'monotone' +*/ +setReadWriteAccessor( AreaMark.prototype, 'interpolate', getInterpolate, setInterpolate ); + +/** +* Orientation of the area. +* +* @name orient +* @memberof AreaMark.prototype +* @type {string} +* @default 'vertical' +* +* @example +* var mark = new AreaMark({ +* 'orient': 'horizontal' +* }); +* +* var v = mark.orient; +* // returns 'horizontal' +*/ +setReadWriteAccessor( AreaMark.prototype, 'orient', getOrient, setOrient ); + +/** +* Numerical tension parameter for cardinal and catmull-rom interpolation. +* +* @name tension +* @memberof AreaMark.prototype +* @type {number} +* @default 0.5 +* +* @example +* var mark = new AreaMark({ +* 'tension': 0.5 +* }); +* +* var v = mark.tension; +* // returns 0.5 +*/ +setReadWriteAccessor( AreaMark.prototype, 'tension', getTension, setTension ); + +/** +* Mark properties. +* +* @name properties +* @memberof AreaMark.prototype +* @type {Array} +* +* @example +* var mark = new AreaMark({}); +* +* var v = mark.properties; +* // returns [...] +*/ +setNonEnumerableReadOnlyAccessor( AreaMark.prototype, 'properties', getProperties ); + +/** +* Mark type. +* +* @name type +* @memberof AreaMark.prototype +* @type {string} +* @default 'area' +* +* @example +* var mark = new AreaMark({ +* 'interpolate': 'monotone' +* }); +* +* var v = mark.type; +* // returns 'area' +*/ +setReadWriteAccessor( AreaMark.prototype, 'type', getType, setType ); + +/** +* Serializes an instance to a JSON object. +* +* ## Notes +* +* - This method is implicitly invoked by `JSON.stringify`. +* +* @name toJSON +* @memberof AreaMark.prototype +* @type {Function} +* @returns {Object} JSON object +* +* @example +* var mark = new AreaMark({ +* 'interpolate': 'monotone' +* }); +* +* var v = mark.toJSON(); +* // returns {...} +*/ +setNonEnumerableReadOnly( AreaMark.prototype, 'toJSON', function toJSON() { + return instance2json( this, properties ); +}); + + +// EXPORTS // + +module.exports = AreaMark; diff --git a/lib/node_modules/@stdlib/plot/vega/mark/area/lib/orient/get.js b/lib/node_modules/@stdlib/plot/vega/mark/area/lib/orient/get.js new file mode 100644 index 000000000000..07ee5e6deb6f --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/mark/area/lib/orient/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 orientation. +* +* @private +* @returns {string} orientation +*/ +function get() { + return this[ prop.private ]; +} + + +// EXPORTS // + +module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/vega/mark/area/lib/orient/properties.js b/lib/node_modules/@stdlib/plot/vega/mark/area/lib/orient/properties.js new file mode 100644 index 000000000000..5e8fa13f48f4 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/mark/area/lib/orient/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( 'orient' ); + + +// EXPORTS // + +module.exports = obj; diff --git a/lib/node_modules/@stdlib/plot/vega/mark/area/lib/orient/set.js b/lib/node_modules/@stdlib/plot/vega/mark/area/lib/orient/set.js new file mode 100644 index 000000000000..70994bb989b0 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/mark/area/lib/orient/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 isAreaMarkOrientation = require( '@stdlib/plot/vega/base/assert/is-area-mark-orientation' ); +var join = require( '@stdlib/array/base/join' ); +var areaMarkOrientations = require( '@stdlib/plot/vega/mark/area/orientations' ); +var format = require( '@stdlib/string/format' ); +var changeEvent = require( './../change_event.js' ); +var prop = require( './properties.js' ); + + +// VARIABLES // + +var debug = logger( 'vega:area-mark:set:'+prop.name ); + + +// MAIN // + +/** +* Sets the orientation. +* +* @private +* @param {string} value - input value +* @throws {TypeError} must be a valid orientation +* @returns {void} +*/ +function set( value ) { + if ( !isAreaMarkOrientation( value ) ) { + throw new TypeError( format( 'invalid assignment. `%s` must be one of the following: "%s". Value: `%s`.', prop.name, join( areaMarkOrientations(), '", "' ), 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/mark/area/lib/properties.json b/lib/node_modules/@stdlib/plot/vega/mark/area/lib/properties.json new file mode 100644 index 000000000000..33cd35902e92 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/mark/area/lib/properties.json @@ -0,0 +1,22 @@ +[ + "aria", + "clip", + "description", + "encode", + "from", + "interactive", + "key", + "name", + "role", + "sort", + "style", + "transform", + "triggers", + "type", + "zindex", + + "defined", + "interpolate", + "orient", + "tension" +] diff --git a/lib/node_modules/@stdlib/plot/vega/mark/area/lib/properties/get.js b/lib/node_modules/@stdlib/plot/vega/mark/area/lib/properties/get.js new file mode 100644 index 000000000000..f3cbb28454ea --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/mark/area/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/mark/area/lib/tension/get.js b/lib/node_modules/@stdlib/plot/vega/mark/area/lib/tension/get.js new file mode 100644 index 000000000000..9d82ba81dbe5 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/mark/area/lib/tension/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 tension parameter. +* +* @private +* @returns {number} tension +*/ +function get() { + return this[ prop.private ]; +} + + +// EXPORTS // + +module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/vega/mark/area/lib/tension/properties.js b/lib/node_modules/@stdlib/plot/vega/mark/area/lib/tension/properties.js new file mode 100644 index 000000000000..fbb1a44b959c --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/mark/area/lib/tension/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( 'tension' ); + + +// EXPORTS // + +module.exports = obj; diff --git a/lib/node_modules/@stdlib/plot/vega/mark/area/lib/tension/set.js b/lib/node_modules/@stdlib/plot/vega/mark/area/lib/tension/set.js new file mode 100644 index 000000000000..d412be658360 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/mark/area/lib/tension/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:area-mark:set:'+prop.name ); + + +// MAIN // + +/** +* Sets the tension parameter. +* +* @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/mark/area/lib/type/get.js b/lib/node_modules/@stdlib/plot/vega/mark/area/lib/type/get.js new file mode 100644 index 000000000000..84cc34fbacd5 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/mark/area/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 mark type. +* +* @private +* @returns {string} mark type +*/ +function get() { + return TYPE; +} + + +// EXPORTS // + +module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/vega/mark/area/lib/type/set.js b/lib/node_modules/@stdlib/plot/vega/mark/area/lib/type/set.js new file mode 100644 index 000000000000..9e06599a5a16 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/mark/area/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 mark type. +* +* @private +* @param {string} value - input value +* @throws {TypeError} must be a valid mark type +* @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/mark/area/lib/type/type.js b/lib/node_modules/@stdlib/plot/vega/mark/area/lib/type/type.js new file mode 100644 index 000000000000..f162fb9a42ff --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/mark/area/lib/type/type.js @@ -0,0 +1,23 @@ +/** +* @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'; + +// EXPORTS // + +module.exports = 'area'; diff --git a/lib/node_modules/@stdlib/plot/vega/mark/area/package.json b/lib/node_modules/@stdlib/plot/vega/mark/area/package.json new file mode 100644 index 000000000000..c5238a19a117 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/mark/area/package.json @@ -0,0 +1,59 @@ +{ + "name": "@stdlib/plot/vega/mark/area", + "version": "0.0.0", + "description": "Area mark 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", + "mark", + "area" + ], + "__stdlib__": {} +} From 50d1c25d35b587b243ede4dbb176dcba7a87efc7 Mon Sep 17 00:00:00 2001 From: orthodox-64 Date: Sat, 6 Jun 2026 14:06:04 +0530 Subject: [PATCH 2/3] chore: fix lint --- type: pre_commit_static_analysis_report description: Results of running static analysis checks when committing changes. report: - task: lint_filenames status: passed - task: lint_editorconfig status: passed - task: lint_markdown status: na - task: lint_package_json status: na - task: lint_repl_help status: na - task: lint_javascript_src status: passed - task: lint_javascript_cli status: na - task: lint_javascript_examples status: na - task: lint_javascript_tests status: na - task: lint_javascript_benchmarks status: na - task: lint_python status: na - task: lint_r status: na - task: lint_c_src status: na - task: lint_c_examples status: na - task: lint_c_benchmarks status: na - task: lint_c_tests_fixtures status: na - task: lint_shell status: na - task: lint_typescript_declarations status: passed - task: lint_typescript_tests status: na - task: lint_license_headers status: passed --- --- .../@stdlib/plot/vega/mark/area/lib/main.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/lib/node_modules/@stdlib/plot/vega/mark/area/lib/main.js b/lib/node_modules/@stdlib/plot/vega/mark/area/lib/main.js index bb7d4dd9f684..444f3c879d7d 100644 --- a/lib/node_modules/@stdlib/plot/vega/mark/area/lib/main.js +++ b/lib/node_modules/@stdlib/plot/vega/mark/area/lib/main.js @@ -16,7 +16,7 @@ * limitations under the License. */ -/* eslint-disable no-restricted-syntax, no-invalid-this */ +/* eslint-disable no-restricted-syntax, no-invalid-this, stdlib/no-empty-lines-between-requires */ 'use strict'; @@ -36,19 +36,25 @@ var Mark = require( '@stdlib/plot/vega/mark/base/ctor' ); 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 getDefined = require( './defined/get.js' ); var setDefined = require( './defined/set.js' ); + var getInterpolate = require( './interpolate/get.js' ); var setInterpolate = require( './interpolate/set.js' ); + var getOrient = require( './orient/get.js' ); var setOrient = require( './orient/set.js' ); + var getProperties = require( './properties/get.js' ); + var getTension = require( './tension/get.js' ); var setTension = require( './tension/set.js' ); + var getType = require( './type/get.js' ); var setType = require( './type/set.js' ); -var TYPE = require( './type/type.js' ); // VARIABLES // From 6472ba2307a854c7727660705fa177c0cd6a8ba5 Mon Sep 17 00:00:00 2001 From: Sachinn-64 Date: Thu, 30 Jul 2026 21:46:08 +0530 Subject: [PATCH 3/3] refactor: area mark implementation --- type: pre_commit_static_analysis_report description: Results of running static analysis checks when committing changes. report: - task: lint_filenames status: passed - task: lint_editorconfig status: passed - task: lint_markdown_pkg_readmes status: na - task: lint_markdown_docs status: na - task: lint_markdown status: na - task: lint_package_json status: passed - task: lint_repl_help status: na - task: lint_javascript_src status: passed - task: lint_javascript_cli status: na - task: lint_javascript_examples status: passed - task: lint_javascript_tests status: na - task: lint_javascript_benchmarks status: na - task: lint_python status: na - task: lint_r status: na - task: lint_c_src status: na - task: lint_c_examples status: na - task: lint_c_benchmarks status: na - task: lint_c_tests_fixtures status: na - task: lint_shell status: na - task: lint_typescript_declarations status: passed - task: lint_typescript_tests status: na - task: lint_license_headers status: passed --- --- .../mark/area/{ => ctor}/examples/index.js | 22 +- .../mark/area/{ => ctor}/lib/change_event.js | 0 .../vega/mark/area/{ => ctor}/lib/defaults.js | 16 +- .../interpolate => ctor/lib/encode}/get.js | 4 +- .../orient => ctor/lib/encode}/properties.js | 2 +- .../{lib/defined => ctor/lib/encode}/set.js | 16 +- .../vega/mark/area/{ => ctor}/lib/index.js | 8 +- .../plot/vega/mark/area/ctor/lib/main.js | 162 ++++++++++ .../vega/mark/area/{ => ctor}/package.json | 7 +- .../plot/vega/mark/area/lib/defined/get.js | 43 --- .../vega/mark/area/lib/defined/properties.js | 33 -- .../mark/area/lib/interpolate/properties.js | 33 -- .../vega/mark/area/lib/interpolate/set.js | 63 ---- .../@stdlib/plot/vega/mark/area/lib/main.js | 301 ------------------ .../plot/vega/mark/area/lib/orient/get.js | 43 --- .../plot/vega/mark/area/lib/orient/set.js | 63 ---- .../plot/vega/mark/area/lib/properties.json | 22 -- .../plot/vega/mark/area/lib/properties/get.js | 41 --- .../plot/vega/mark/area/lib/tension/get.js | 43 --- .../vega/mark/area/lib/tension/properties.js | 33 -- .../plot/vega/mark/area/lib/tension/set.js | 61 ---- .../plot/vega/mark/area/lib/type/get.js | 41 --- .../plot/vega/mark/area/lib/type/set.js | 46 --- .../plot/vega/mark/area/lib/type/type.js | 23 -- 24 files changed, 210 insertions(+), 916 deletions(-) rename lib/node_modules/@stdlib/plot/vega/mark/area/{ => ctor}/examples/index.js (58%) rename lib/node_modules/@stdlib/plot/vega/mark/area/{ => ctor}/lib/change_event.js (100%) rename lib/node_modules/@stdlib/plot/vega/mark/area/{ => ctor}/lib/defaults.js (79%) rename lib/node_modules/@stdlib/plot/vega/mark/area/{lib/interpolate => ctor/lib/encode}/get.js (88%) rename lib/node_modules/@stdlib/plot/vega/mark/area/{lib/orient => ctor/lib/encode}/properties.js (95%) rename lib/node_modules/@stdlib/plot/vega/mark/area/{lib/defined => ctor/lib/encode}/set.js (70%) rename lib/node_modules/@stdlib/plot/vega/mark/area/{ => ctor}/lib/index.js (83%) create mode 100644 lib/node_modules/@stdlib/plot/vega/mark/area/ctor/lib/main.js rename lib/node_modules/@stdlib/plot/vega/mark/area/{ => ctor}/package.json (91%) delete mode 100644 lib/node_modules/@stdlib/plot/vega/mark/area/lib/defined/get.js delete mode 100644 lib/node_modules/@stdlib/plot/vega/mark/area/lib/defined/properties.js delete mode 100644 lib/node_modules/@stdlib/plot/vega/mark/area/lib/interpolate/properties.js delete mode 100644 lib/node_modules/@stdlib/plot/vega/mark/area/lib/interpolate/set.js delete mode 100644 lib/node_modules/@stdlib/plot/vega/mark/area/lib/main.js delete mode 100644 lib/node_modules/@stdlib/plot/vega/mark/area/lib/orient/get.js delete mode 100644 lib/node_modules/@stdlib/plot/vega/mark/area/lib/orient/set.js delete mode 100644 lib/node_modules/@stdlib/plot/vega/mark/area/lib/properties.json delete mode 100644 lib/node_modules/@stdlib/plot/vega/mark/area/lib/properties/get.js delete mode 100644 lib/node_modules/@stdlib/plot/vega/mark/area/lib/tension/get.js delete mode 100644 lib/node_modules/@stdlib/plot/vega/mark/area/lib/tension/properties.js delete mode 100644 lib/node_modules/@stdlib/plot/vega/mark/area/lib/tension/set.js delete mode 100644 lib/node_modules/@stdlib/plot/vega/mark/area/lib/type/get.js delete mode 100644 lib/node_modules/@stdlib/plot/vega/mark/area/lib/type/set.js delete mode 100644 lib/node_modules/@stdlib/plot/vega/mark/area/lib/type/type.js diff --git a/lib/node_modules/@stdlib/plot/vega/mark/area/examples/index.js b/lib/node_modules/@stdlib/plot/vega/mark/area/ctor/examples/index.js similarity index 58% rename from lib/node_modules/@stdlib/plot/vega/mark/area/examples/index.js rename to lib/node_modules/@stdlib/plot/vega/mark/area/ctor/examples/index.js index f3fa878f53d7..840636e3c686 100644 --- a/lib/node_modules/@stdlib/plot/vega/mark/area/examples/index.js +++ b/lib/node_modules/@stdlib/plot/vega/mark/area/ctor/examples/index.js @@ -18,10 +18,28 @@ 'use strict'; +var Value = require( '@stdlib/plot/vega/value/ctor' ); +var AreaEncodingSet = require( '@stdlib/plot/vega/mark/area/encoding-set' ); +var AreaEncoding = require( '@stdlib/plot/vega/mark/area/encoding' ); var AreaMark = require( './../lib' ); var mark = new AreaMark({ - 'interpolate': 'monotone' + 'encode': new AreaEncoding({ + 'enter': new AreaEncodingSet({ + 'stroke': new Value({ + 'value': '#000' + }) + }), + 'update': new AreaEncodingSet({ + 'stroke': new Value({ + 'value': 'steelblue' + }) + }), + 'exit': new AreaEncodingSet({ + 'stroke': new Value({ + 'value': '#fff' + }) + }) + }) }); - console.log( mark.toJSON() ); diff --git a/lib/node_modules/@stdlib/plot/vega/mark/area/lib/change_event.js b/lib/node_modules/@stdlib/plot/vega/mark/area/ctor/lib/change_event.js similarity index 100% rename from lib/node_modules/@stdlib/plot/vega/mark/area/lib/change_event.js rename to lib/node_modules/@stdlib/plot/vega/mark/area/ctor/lib/change_event.js diff --git a/lib/node_modules/@stdlib/plot/vega/mark/area/lib/defaults.js b/lib/node_modules/@stdlib/plot/vega/mark/area/ctor/lib/defaults.js similarity index 79% rename from lib/node_modules/@stdlib/plot/vega/mark/area/lib/defaults.js rename to lib/node_modules/@stdlib/plot/vega/mark/area/ctor/lib/defaults.js index 874416fa8bcc..c58b167655bc 100644 --- a/lib/node_modules/@stdlib/plot/vega/mark/area/lib/defaults.js +++ b/lib/node_modules/@stdlib/plot/vega/mark/area/ctor/lib/defaults.js @@ -18,6 +18,11 @@ 'use strict'; +// MODULES // + +var AreaEncoding = require( '@stdlib/plot/vega/mark/area/encoding' ); + + // MAIN // /** @@ -32,14 +37,11 @@ */ function defaults() { return { - // The orientation of the area: - 'orient': 'vertical', - - // The interpolation method for the area: - 'interpolate': 'linear', + // Visual encoding rules for area mark properties: + 'encoding': new AreaEncoding(), - // The tension parameter for cardinal and catmull-rom interpolation: - 'tension': 0.5 + // Mark type: + 'type': 'area' }; } diff --git a/lib/node_modules/@stdlib/plot/vega/mark/area/lib/interpolate/get.js b/lib/node_modules/@stdlib/plot/vega/mark/area/ctor/lib/encode/get.js similarity index 88% rename from lib/node_modules/@stdlib/plot/vega/mark/area/lib/interpolate/get.js rename to lib/node_modules/@stdlib/plot/vega/mark/area/ctor/lib/encode/get.js index 51881751b573..bb3905db85f1 100644 --- a/lib/node_modules/@stdlib/plot/vega/mark/area/lib/interpolate/get.js +++ b/lib/node_modules/@stdlib/plot/vega/mark/area/ctor/lib/encode/get.js @@ -28,10 +28,10 @@ var prop = require( './properties.js' ); // MAIN // /** -* Returns the interpolation method. +* Returns the set of visual encoding rules for area mark properties. * * @private -* @returns {string} interpolation method +* @returns {(AreaEncoding|void)} encodings */ function get() { return this[ prop.private ]; diff --git a/lib/node_modules/@stdlib/plot/vega/mark/area/lib/orient/properties.js b/lib/node_modules/@stdlib/plot/vega/mark/area/ctor/lib/encode/properties.js similarity index 95% rename from lib/node_modules/@stdlib/plot/vega/mark/area/lib/orient/properties.js rename to lib/node_modules/@stdlib/plot/vega/mark/area/ctor/lib/encode/properties.js index 5e8fa13f48f4..534754763d4e 100644 --- a/lib/node_modules/@stdlib/plot/vega/mark/area/lib/orient/properties.js +++ b/lib/node_modules/@stdlib/plot/vega/mark/area/ctor/lib/encode/properties.js @@ -25,7 +25,7 @@ var property2object = require( '@stdlib/plot/vega/base/property2object' ); // MAIN // -var obj = property2object( 'orient' ); +var obj = property2object( 'encode' ); // EXPORTS // diff --git a/lib/node_modules/@stdlib/plot/vega/mark/area/lib/defined/set.js b/lib/node_modules/@stdlib/plot/vega/mark/area/ctor/lib/encode/set.js similarity index 70% rename from lib/node_modules/@stdlib/plot/vega/mark/area/lib/defined/set.js rename to lib/node_modules/@stdlib/plot/vega/mark/area/ctor/lib/encode/set.js index d416bee5f1aa..01124729a978 100644 --- a/lib/node_modules/@stdlib/plot/vega/mark/area/lib/defined/set.js +++ b/lib/node_modules/@stdlib/plot/vega/mark/area/ctor/lib/encode/set.js @@ -23,7 +23,7 @@ // MODULES // var logger = require( 'debug' ); -var isBoolean = require( '@stdlib/assert/is-boolean' ).isPrimitive; +var isAreaMarkEncoding = require( '@stdlib/plot/vega/base/assert/is-area-mark-encoding' ); var isUndefined = require( '@stdlib/assert/is-undefined' ); var format = require( '@stdlib/string/format' ); var changeEvent = require( './../change_event.js' ); @@ -32,29 +32,29 @@ var prop = require( './properties.js' ); // VARIABLES // -var debug = logger( 'vega:area-mark:set:'+prop.name ); +var debug = logger( 'vega:mark:area:set:'+prop.name ); // MAIN // /** -* Sets the defined flag. +* Sets the visual encoding rules for area mark properties. * * ## Notes * * - Providing `undefined` "unsets" the configured value. * * @private -* @param {(boolean|void)} value - input value -* @throws {TypeError} must be a boolean +* @param {(Encoding|void)} value - input value +* @throws {TypeError} must be an area mark encoding instance * @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 ( !isAreaMarkEncoding( value ) && !isUndefined( value ) ) { + throw new TypeError( format( 'invalid assignment. `%s` must be an area mark encoding instance. Value: `%s`.', prop.name, value ) ); } if ( value !== this[ prop.private ] ) { - debug( 'Current value: %s. New value: %s.', this[ prop.private ], value ); + 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 ) ); } diff --git a/lib/node_modules/@stdlib/plot/vega/mark/area/lib/index.js b/lib/node_modules/@stdlib/plot/vega/mark/area/ctor/lib/index.js similarity index 83% rename from lib/node_modules/@stdlib/plot/vega/mark/area/lib/index.js rename to lib/node_modules/@stdlib/plot/vega/mark/area/ctor/lib/index.js index e1afda4784fb..3f9cde257c3f 100644 --- a/lib/node_modules/@stdlib/plot/vega/mark/area/lib/index.js +++ b/lib/node_modules/@stdlib/plot/vega/mark/area/ctor/lib/index.js @@ -21,14 +21,12 @@ /** * Area mark constructor. * -* @module @stdlib/plot/vega/mark/area +* @module @stdlib/plot/vega/mark/area/ctor * * @example -* var AreaMark = require( '@stdlib/plot/vega/mark/area' ); +* var AreaMark = require( '@stdlib/plot/vega/mark/area/ctor' ); * -* var mark = new AreaMark({ -* 'interpolate': 'monotone' -* }); +* var mark = new AreaMark(); * // returns */ diff --git a/lib/node_modules/@stdlib/plot/vega/mark/area/ctor/lib/main.js b/lib/node_modules/@stdlib/plot/vega/mark/area/ctor/lib/main.js new file mode 100644 index 000000000000..fcab2f016e42 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/mark/area/ctor/lib/main.js @@ -0,0 +1,162 @@ +/** +* @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 stdlib/no-empty-lines-between-requires */ + +'use strict'; + +// MODULES // + +var logger = require( 'debug' ); +var isObject = require( '@stdlib/assert/is-object' ); +var setNonEnumerableReadOnly = require( '@stdlib/utils/define-nonenumerable-read-only-property' ); +var setReadWriteAccessor = require( '@stdlib/utils/define-read-write-accessor' ); +var hasProp = require( '@stdlib/assert/has-property' ); +var inherit = require( '@stdlib/utils/inherit' ); +var transformErrorMessage = require( '@stdlib/plot/vega/base/transform-validation-message' ); +var Mark = require( '@stdlib/plot/vega/mark/base/ctor' ); +var format = require( '@stdlib/string/format' ); +var defaults = require( './defaults.js' ); + +// Note: keep the following in alphabetical order according to the `require` path... +var getEncode = require( './encode/get.js' ); +var setEncode = require( './encode/set.js' ); + + +// VARIABLES // + +var debug = logger( 'vega:mark:area:main' ); + + +// MAIN // + +/** +* Area mark constructor. +* +* @constructor +* @param {Options} options - constructor options +* @param {boolean} [options.aria=true] - boolean indicating whether to include ARIA attributes in SVG output +* @param {(boolean|Signal|Object)} [options.clip=false] - setting indicating whether to clip marks to a specified shape +* @param {string} [options.description] - text description of a mark for ARIA accessibility +* @param {AreaEncoding} [options.encode] - visual encoding rules for mark properties +* @param {DataSource} [options.from] - object describing the data a mark should visualize +* @param {boolean} [options.interactive=true] - boolean indicating whether a mark can serve as an input event source +* @param {(string|Object)} [options.key] - data field to use as a unique key for data binding +* @param {string} [options.name] - unique name +* @param {string} [options.role] - metadata string indicating the role of a mark +* @param {Object} [options.sort] - comparator for sorting mark items +* @param {(string|Array)} [options.style] - custom styles to apply to a mark +* @param {Array} [options.transforms=[]] - list of post-encoding transforms to apply after any "encode" blocks and which operate directly on mark scenegraph items +* @param {Array} [options.triggers=[]] - list of triggers for modifying mark properties in response to signal changes +* @param {number} [options.zindex=0] - integer z-index indicating the layering of a mark relative to other marks +* @throws {TypeError} options argument must be an object +* @throws {Error} must provide valid options +* @returns {AreaMark} area mark instance +* +* @example +* var mark = new AreaMark(); +* // returns +*/ +function AreaMark( options ) { + var nargs; + var props; + var v; + var k; + var i; + + nargs = arguments.length; + if ( !( this instanceof AreaMark ) ) { + if ( nargs === 0 ) { + return new AreaMark(); + } + return new AreaMark( options ); + } + Mark.call( this, defaults() ); // note: explicitly called without provided options, as we want to perform our own validation + + if ( nargs ) { + if ( !isObject( options ) ) { + throw new TypeError( format( 'invalid argument. Options argument must be an object. Value: `%s`.', options ) ); + } + // Validate provided options by attempting to assign option values to corresponding fields... + props = this.properties; + for ( i = 0; i < props.length; i++ ) { + k = props[ 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 the `Mark` prototype. +*/ +inherit( AreaMark, Mark ); + +/** +* Constructor name. +* +* @private +* @name name +* @memberof AreaMark +* @readonly +* @type {string} +*/ +setNonEnumerableReadOnly( AreaMark, 'name', 'AreaMark' ); + +/** +* Visual encoding rules for area mark properties. +* +* @name encode +* @memberof Mark.prototype +* @type {(AreaEncoding|void)} +* +* @example +* var Value = require( '@stdlib/plot/vega/value/ctor' ); +* var EncodingSet = require( '@stdlib/plot/vega/mark/area/encoding-set' ); +* var Encoding = require( '@stdlib/plot/vega/mark/area/encoding' ); +* +* var mark = new AreaMark({ +* 'encode': new Encoding({ +* 'enter': new EncodingSet({ +* 'stroke': new Value({ +* 'value': 'steelblue' +* }) +* }) +* }) +* }); +* +* var v = mark.encode; +* // returns {...} +*/ +setReadWriteAccessor( AreaMark.prototype, 'encode', getEncode, setEncode ); + + +// EXPORTS // + +module.exports = AreaMark; diff --git a/lib/node_modules/@stdlib/plot/vega/mark/area/package.json b/lib/node_modules/@stdlib/plot/vega/mark/area/ctor/package.json similarity index 91% rename from lib/node_modules/@stdlib/plot/vega/mark/area/package.json rename to lib/node_modules/@stdlib/plot/vega/mark/area/ctor/package.json index c5238a19a117..3e7ebdbe4c95 100644 --- a/lib/node_modules/@stdlib/plot/vega/mark/area/package.json +++ b/lib/node_modules/@stdlib/plot/vega/mark/area/ctor/package.json @@ -1,5 +1,5 @@ { - "name": "@stdlib/plot/vega/mark/area", + "name": "@stdlib/plot/vega/mark/area/ctor", "version": "0.0.0", "description": "Area mark constructor.", "license": "Apache-2.0", @@ -53,7 +53,10 @@ "plot", "vega", "mark", - "area" + "area", + "encoding", + "constructor", + "ctor" ], "__stdlib__": {} } diff --git a/lib/node_modules/@stdlib/plot/vega/mark/area/lib/defined/get.js b/lib/node_modules/@stdlib/plot/vega/mark/area/lib/defined/get.js deleted file mode 100644 index ab9e2dfd7f7d..000000000000 --- a/lib/node_modules/@stdlib/plot/vega/mark/area/lib/defined/get.js +++ /dev/null @@ -1,43 +0,0 @@ -/** -* @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 defined flag. -* -* @private -* @returns {(boolean|void)} defined flag -*/ -function get() { - return this[ prop.private ]; -} - - -// EXPORTS // - -module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/vega/mark/area/lib/defined/properties.js b/lib/node_modules/@stdlib/plot/vega/mark/area/lib/defined/properties.js deleted file mode 100644 index 21cb5d64d313..000000000000 --- a/lib/node_modules/@stdlib/plot/vega/mark/area/lib/defined/properties.js +++ /dev/null @@ -1,33 +0,0 @@ -/** -* @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( 'defined' ); - - -// EXPORTS // - -module.exports = obj; diff --git a/lib/node_modules/@stdlib/plot/vega/mark/area/lib/interpolate/properties.js b/lib/node_modules/@stdlib/plot/vega/mark/area/lib/interpolate/properties.js deleted file mode 100644 index fa8d68680162..000000000000 --- a/lib/node_modules/@stdlib/plot/vega/mark/area/lib/interpolate/properties.js +++ /dev/null @@ -1,33 +0,0 @@ -/** -* @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( 'interpolate' ); - - -// EXPORTS // - -module.exports = obj; diff --git a/lib/node_modules/@stdlib/plot/vega/mark/area/lib/interpolate/set.js b/lib/node_modules/@stdlib/plot/vega/mark/area/lib/interpolate/set.js deleted file mode 100644 index 73abb8039cb1..000000000000 --- a/lib/node_modules/@stdlib/plot/vega/mark/area/lib/interpolate/set.js +++ /dev/null @@ -1,63 +0,0 @@ -/** -* @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 isMarkInterpolationMethod = require( '@stdlib/plot/vega/base/assert/is-mark-interpolation-method' ); -var join = require( '@stdlib/array/base/join' ); -var markInterpolationMethods = require( '@stdlib/plot/vega/mark/interpolation-methods' ); -var format = require( '@stdlib/string/format' ); -var changeEvent = require( './../change_event.js' ); -var prop = require( './properties.js' ); - - -// VARIABLES // - -var debug = logger( 'vega:area-mark:set:'+prop.name ); - - -// MAIN // - -/** -* Sets the interpolation method. -* -* @private -* @param {string} value - input value -* @throws {TypeError} must be a valid interpolation method -* @returns {void} -*/ -function set( value ) { - if ( !isMarkInterpolationMethod( value ) ) { - throw new TypeError( format( 'invalid assignment. `%s` must be one of the following: "%s". Value: `%s`.', prop.name, join( markInterpolationMethods(), '", "' ), 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/mark/area/lib/main.js b/lib/node_modules/@stdlib/plot/vega/mark/area/lib/main.js deleted file mode 100644 index 444f3c879d7d..000000000000 --- a/lib/node_modules/@stdlib/plot/vega/mark/area/lib/main.js +++ /dev/null @@ -1,301 +0,0 @@ -/** -* @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 */ - -'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 Mark = require( '@stdlib/plot/vega/mark/base/ctor' ); -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 getDefined = require( './defined/get.js' ); -var setDefined = require( './defined/set.js' ); - -var getInterpolate = require( './interpolate/get.js' ); -var setInterpolate = require( './interpolate/set.js' ); - -var getOrient = require( './orient/get.js' ); -var setOrient = require( './orient/set.js' ); - -var getProperties = require( './properties/get.js' ); - -var getTension = require( './tension/get.js' ); -var setTension = require( './tension/set.js' ); - -var getType = require( './type/get.js' ); -var setType = require( './type/set.js' ); - - -// VARIABLES // - -var debug = logger(' vega:area-mark:main '); - - -// MAIN // - -/** -* Area mark constructor. -* -* @constructor -* @param {Options} [options] - constructor options -* @param {boolean} [options.aria=true] - boolean indicating whether to include ARIA attributes in SVG output -* @param {(boolean|Signal|Object)} [options.clip=false] - setting indicating whether to clip marks to a specified shape -* @param {boolean} [options.defined] - boolean indicating whether the area is defined at a data point -* @param {string} [options.description] - text description of a mark for ARIA accessibility -* @param {Object} [options.encode] - object containing visual encoding rules for mark properties -* @param {Object} [options.from] - object describing the data a mark should visualize -* @param {boolean} [options.interactive=true] - boolean indicating whether a mark can serve as an input event source -* @param {string} [options.interpolate='linear'] - interpolation method -* @param {(string|Object)} [options.key] - data field to use as a unique key for data binding -* @param {string} [options.name] - unique name -* @param {string} [options.orient='vertical'] - orientation of the area -* @param {string} [options.role] - metadata string indicating the role of a mark -* @param {Object} [options.sort] - comparator for sorting mark items -* @param {(string|Array)} [options.style] - custom styles to apply to a mark -* @param {number} [options.tension=0.5] - numerical tension for cardinal and catmull-rom interpolation -* @param {Array} [options.transforms=[]] - list of post-encoding transforms to apply after any "encode" blocks and which operate directly on mark scenegraph items -* @param {Array} [options.triggers=[]] - list of triggers for modifying mark properties in response to signal changes -* @param {number} [options.zindex=0] - integer z-index indicating the layering of a mark relative to other marks -* @throws {TypeError} options argument must be an object -* @throws {TypeError} `type` option, if provided, must be equal to "area" -* @throws {Error} must provide valid options -* @returns {AreaMark} area mark instance -* -* @example -* var mark = new AreaMark({ -* 'interpolate': 'monotone' -* }); -* // returns -*/ -function AreaMark( options ) { - var opts; - var keys; - var v; - var k; - var i; - if ( !( this instanceof AreaMark ) ) { - if ( arguments.length === 0 ) { - return new AreaMark( {} ); - } - return new AreaMark( options ); - } - if ( arguments.length === 0 ) { - 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 ) ); - } - options.type = TYPE; - Mark.call( this, options ); - - // 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 ) ); - } - } - this._type = TYPE; - return this; -} - -/* -* Inherit from a parent prototype. -*/ -inherit( AreaMark, Mark ); - -/** -* Constructor name. -* -* @private -* @name name -* @memberof AreaMark -* @readonly -* @type {string} -*/ -setNonEnumerableReadOnly( AreaMark, 'name', 'AreaMark' ); - -/** -* Boolean indicating whether the area is defined at a data point. -* -* @name defined -* @memberof AreaMark.prototype -* @type {(boolean|void)} -* -* @example -* var mark = new AreaMark({ -* 'defined': true -* }); -* -* var v = mark.defined; -* // returns true -*/ -setReadWriteAccessor( AreaMark.prototype, 'defined', getDefined, setDefined ); - -/** -* Interpolation method. -* -* @name interpolate -* @memberof AreaMark.prototype -* @type {string} -* @default 'linear' -* -* @example -* var mark = new AreaMark({ -* 'interpolate': 'monotone' -* }); -* -* var v = mark.interpolate; -* // returns 'monotone' -*/ -setReadWriteAccessor( AreaMark.prototype, 'interpolate', getInterpolate, setInterpolate ); - -/** -* Orientation of the area. -* -* @name orient -* @memberof AreaMark.prototype -* @type {string} -* @default 'vertical' -* -* @example -* var mark = new AreaMark({ -* 'orient': 'horizontal' -* }); -* -* var v = mark.orient; -* // returns 'horizontal' -*/ -setReadWriteAccessor( AreaMark.prototype, 'orient', getOrient, setOrient ); - -/** -* Numerical tension parameter for cardinal and catmull-rom interpolation. -* -* @name tension -* @memberof AreaMark.prototype -* @type {number} -* @default 0.5 -* -* @example -* var mark = new AreaMark({ -* 'tension': 0.5 -* }); -* -* var v = mark.tension; -* // returns 0.5 -*/ -setReadWriteAccessor( AreaMark.prototype, 'tension', getTension, setTension ); - -/** -* Mark properties. -* -* @name properties -* @memberof AreaMark.prototype -* @type {Array} -* -* @example -* var mark = new AreaMark({}); -* -* var v = mark.properties; -* // returns [...] -*/ -setNonEnumerableReadOnlyAccessor( AreaMark.prototype, 'properties', getProperties ); - -/** -* Mark type. -* -* @name type -* @memberof AreaMark.prototype -* @type {string} -* @default 'area' -* -* @example -* var mark = new AreaMark({ -* 'interpolate': 'monotone' -* }); -* -* var v = mark.type; -* // returns 'area' -*/ -setReadWriteAccessor( AreaMark.prototype, 'type', getType, setType ); - -/** -* Serializes an instance to a JSON object. -* -* ## Notes -* -* - This method is implicitly invoked by `JSON.stringify`. -* -* @name toJSON -* @memberof AreaMark.prototype -* @type {Function} -* @returns {Object} JSON object -* -* @example -* var mark = new AreaMark({ -* 'interpolate': 'monotone' -* }); -* -* var v = mark.toJSON(); -* // returns {...} -*/ -setNonEnumerableReadOnly( AreaMark.prototype, 'toJSON', function toJSON() { - return instance2json( this, properties ); -}); - - -// EXPORTS // - -module.exports = AreaMark; diff --git a/lib/node_modules/@stdlib/plot/vega/mark/area/lib/orient/get.js b/lib/node_modules/@stdlib/plot/vega/mark/area/lib/orient/get.js deleted file mode 100644 index 07ee5e6deb6f..000000000000 --- a/lib/node_modules/@stdlib/plot/vega/mark/area/lib/orient/get.js +++ /dev/null @@ -1,43 +0,0 @@ -/** -* @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 orientation. -* -* @private -* @returns {string} orientation -*/ -function get() { - return this[ prop.private ]; -} - - -// EXPORTS // - -module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/vega/mark/area/lib/orient/set.js b/lib/node_modules/@stdlib/plot/vega/mark/area/lib/orient/set.js deleted file mode 100644 index 70994bb989b0..000000000000 --- a/lib/node_modules/@stdlib/plot/vega/mark/area/lib/orient/set.js +++ /dev/null @@ -1,63 +0,0 @@ -/** -* @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 isAreaMarkOrientation = require( '@stdlib/plot/vega/base/assert/is-area-mark-orientation' ); -var join = require( '@stdlib/array/base/join' ); -var areaMarkOrientations = require( '@stdlib/plot/vega/mark/area/orientations' ); -var format = require( '@stdlib/string/format' ); -var changeEvent = require( './../change_event.js' ); -var prop = require( './properties.js' ); - - -// VARIABLES // - -var debug = logger( 'vega:area-mark:set:'+prop.name ); - - -// MAIN // - -/** -* Sets the orientation. -* -* @private -* @param {string} value - input value -* @throws {TypeError} must be a valid orientation -* @returns {void} -*/ -function set( value ) { - if ( !isAreaMarkOrientation( value ) ) { - throw new TypeError( format( 'invalid assignment. `%s` must be one of the following: "%s". Value: `%s`.', prop.name, join( areaMarkOrientations(), '", "' ), 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/mark/area/lib/properties.json b/lib/node_modules/@stdlib/plot/vega/mark/area/lib/properties.json deleted file mode 100644 index 33cd35902e92..000000000000 --- a/lib/node_modules/@stdlib/plot/vega/mark/area/lib/properties.json +++ /dev/null @@ -1,22 +0,0 @@ -[ - "aria", - "clip", - "description", - "encode", - "from", - "interactive", - "key", - "name", - "role", - "sort", - "style", - "transform", - "triggers", - "type", - "zindex", - - "defined", - "interpolate", - "orient", - "tension" -] diff --git a/lib/node_modules/@stdlib/plot/vega/mark/area/lib/properties/get.js b/lib/node_modules/@stdlib/plot/vega/mark/area/lib/properties/get.js deleted file mode 100644 index f3cbb28454ea..000000000000 --- a/lib/node_modules/@stdlib/plot/vega/mark/area/lib/properties/get.js +++ /dev/null @@ -1,41 +0,0 @@ -/** -* @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/mark/area/lib/tension/get.js b/lib/node_modules/@stdlib/plot/vega/mark/area/lib/tension/get.js deleted file mode 100644 index 9d82ba81dbe5..000000000000 --- a/lib/node_modules/@stdlib/plot/vega/mark/area/lib/tension/get.js +++ /dev/null @@ -1,43 +0,0 @@ -/** -* @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 tension parameter. -* -* @private -* @returns {number} tension -*/ -function get() { - return this[ prop.private ]; -} - - -// EXPORTS // - -module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/vega/mark/area/lib/tension/properties.js b/lib/node_modules/@stdlib/plot/vega/mark/area/lib/tension/properties.js deleted file mode 100644 index fbb1a44b959c..000000000000 --- a/lib/node_modules/@stdlib/plot/vega/mark/area/lib/tension/properties.js +++ /dev/null @@ -1,33 +0,0 @@ -/** -* @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( 'tension' ); - - -// EXPORTS // - -module.exports = obj; diff --git a/lib/node_modules/@stdlib/plot/vega/mark/area/lib/tension/set.js b/lib/node_modules/@stdlib/plot/vega/mark/area/lib/tension/set.js deleted file mode 100644 index d412be658360..000000000000 --- a/lib/node_modules/@stdlib/plot/vega/mark/area/lib/tension/set.js +++ /dev/null @@ -1,61 +0,0 @@ -/** -* @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:area-mark:set:'+prop.name ); - - -// MAIN // - -/** -* Sets the tension parameter. -* -* @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/mark/area/lib/type/get.js b/lib/node_modules/@stdlib/plot/vega/mark/area/lib/type/get.js deleted file mode 100644 index 84cc34fbacd5..000000000000 --- a/lib/node_modules/@stdlib/plot/vega/mark/area/lib/type/get.js +++ /dev/null @@ -1,41 +0,0 @@ -/** -* @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 mark type. -* -* @private -* @returns {string} mark type -*/ -function get() { - return TYPE; -} - - -// EXPORTS // - -module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/vega/mark/area/lib/type/set.js b/lib/node_modules/@stdlib/plot/vega/mark/area/lib/type/set.js deleted file mode 100644 index 9e06599a5a16..000000000000 --- a/lib/node_modules/@stdlib/plot/vega/mark/area/lib/type/set.js +++ /dev/null @@ -1,46 +0,0 @@ -/** -* @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 mark type. -* -* @private -* @param {string} value - input value -* @throws {TypeError} must be a valid mark type -* @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/mark/area/lib/type/type.js b/lib/node_modules/@stdlib/plot/vega/mark/area/lib/type/type.js deleted file mode 100644 index f162fb9a42ff..000000000000 --- a/lib/node_modules/@stdlib/plot/vega/mark/area/lib/type/type.js +++ /dev/null @@ -1,23 +0,0 @@ -/** -* @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'; - -// EXPORTS // - -module.exports = 'area';