From 0453f0d075e4d552dcb3a795f757b40b84cff1af Mon Sep 17 00:00:00 2001 From: orthodox-64 Date: Mon, 1 Jun 2026 02:55:47 +0530 Subject: [PATCH] feat: add plot/vega/mark/trail --- .../plot/vega/mark/trail/examples/index.js | 27 ++ .../plot/vega/mark/trail/lib/change_event.js | 41 +++ .../plot/vega/mark/trail/lib/defined/get.js | 43 +++ .../vega/mark/trail/lib/defined/properties.js | 33 +++ .../plot/vega/mark/trail/lib/defined/set.js | 66 +++++ .../@stdlib/plot/vega/mark/trail/lib/index.js | 42 +++ .../@stdlib/plot/vega/mark/trail/lib/main.js | 244 ++++++++++++++++++ .../plot/vega/mark/trail/lib/properties.json | 20 ++ .../vega/mark/trail/lib/properties/get.js | 41 +++ .../plot/vega/mark/trail/lib/size/get.js | 43 +++ .../vega/mark/trail/lib/size/properties.js | 33 +++ .../plot/vega/mark/trail/lib/size/set.js | 66 +++++ .../plot/vega/mark/trail/lib/type/get.js | 41 +++ .../plot/vega/mark/trail/lib/type/set.js | 46 ++++ .../plot/vega/mark/trail/lib/type/type.js | 23 ++ .../@stdlib/plot/vega/mark/trail/package.json | 59 +++++ 16 files changed, 868 insertions(+) create mode 100644 lib/node_modules/@stdlib/plot/vega/mark/trail/examples/index.js create mode 100644 lib/node_modules/@stdlib/plot/vega/mark/trail/lib/change_event.js create mode 100644 lib/node_modules/@stdlib/plot/vega/mark/trail/lib/defined/get.js create mode 100644 lib/node_modules/@stdlib/plot/vega/mark/trail/lib/defined/properties.js create mode 100644 lib/node_modules/@stdlib/plot/vega/mark/trail/lib/defined/set.js create mode 100644 lib/node_modules/@stdlib/plot/vega/mark/trail/lib/index.js create mode 100644 lib/node_modules/@stdlib/plot/vega/mark/trail/lib/main.js create mode 100644 lib/node_modules/@stdlib/plot/vega/mark/trail/lib/properties.json create mode 100644 lib/node_modules/@stdlib/plot/vega/mark/trail/lib/properties/get.js create mode 100644 lib/node_modules/@stdlib/plot/vega/mark/trail/lib/size/get.js create mode 100644 lib/node_modules/@stdlib/plot/vega/mark/trail/lib/size/properties.js create mode 100644 lib/node_modules/@stdlib/plot/vega/mark/trail/lib/size/set.js create mode 100644 lib/node_modules/@stdlib/plot/vega/mark/trail/lib/type/get.js create mode 100644 lib/node_modules/@stdlib/plot/vega/mark/trail/lib/type/set.js create mode 100644 lib/node_modules/@stdlib/plot/vega/mark/trail/lib/type/type.js create mode 100644 lib/node_modules/@stdlib/plot/vega/mark/trail/package.json diff --git a/lib/node_modules/@stdlib/plot/vega/mark/trail/examples/index.js b/lib/node_modules/@stdlib/plot/vega/mark/trail/examples/index.js new file mode 100644 index 000000000000..1c5ae2fbeaef --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/mark/trail/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 TrailMark = require( './../lib' ); + +var mark = new TrailMark({ + 'defined': true +}); + +console.log( mark.toJSON() ); diff --git a/lib/node_modules/@stdlib/plot/vega/mark/trail/lib/change_event.js b/lib/node_modules/@stdlib/plot/vega/mark/trail/lib/change_event.js new file mode 100644 index 000000000000..359afbfa206b --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/mark/trail/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/trail/lib/defined/get.js b/lib/node_modules/@stdlib/plot/vega/mark/trail/lib/defined/get.js new file mode 100644 index 000000000000..ab9e2dfd7f7d --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/mark/trail/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/trail/lib/defined/properties.js b/lib/node_modules/@stdlib/plot/vega/mark/trail/lib/defined/properties.js new file mode 100644 index 000000000000..21cb5d64d313 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/mark/trail/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/trail/lib/defined/set.js b/lib/node_modules/@stdlib/plot/vega/mark/trail/lib/defined/set.js new file mode 100644 index 000000000000..51665c83ee85 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/mark/trail/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:trail-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/trail/lib/index.js b/lib/node_modules/@stdlib/plot/vega/mark/trail/lib/index.js new file mode 100644 index 000000000000..629317bf382f --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/mark/trail/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'; + +/** +* Trail mark constructor. +* +* @module @stdlib/plot/vega/mark/trail +* +* @example +* var TrailMark = require( '@stdlib/plot/vega/mark/trail' ); +* +* var mark = new TrailMark({ +* 'defined': true +* }); +* // returns +*/ + +// MODULES // + +var main = require( './main.js' ); + + +// EXPORTS // + +module.exports = main; diff --git a/lib/node_modules/@stdlib/plot/vega/mark/trail/lib/main.js b/lib/node_modules/@stdlib/plot/vega/mark/trail/lib/main.js new file mode 100644 index 000000000000..f99c20064ceb --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/mark/trail/lib/main.js @@ -0,0 +1,244 @@ +/** +* @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 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' ); + +// 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 getProperties = require( './properties/get.js' ); + +var getSize = require( './size/get.js' ); +var setSize = require( './size/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:trail-mark:main '); + + +// MAIN // + +/** +* Trail 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 a data point is defined +* @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|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 {number} [options.size] - trail size (width) +* @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 {TypeError} `type` option, if provided, must be equal to "trail" +* @throws {Error} must provide valid options +* @returns {TrailMark} trail mark instance +* +* @example +* var mark = new TrailMark({ +* 'defined': true +* }); +* // returns +*/ +function TrailMark( options ) { + var v; + var k; + var i; + if ( !( this instanceof TrailMark ) ) { + if ( arguments.length === 0 ) { + return new TrailMark( {} ); + } + return new TrailMark( 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 ); + // 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( TrailMark, Mark ); + +/** +* Constructor name. +* +* @private +* @name name +* @memberof TrailMark +* @readonly +* @type {string} +*/ +setNonEnumerableReadOnly( TrailMark, 'name', 'TrailMark' ); + +/** +* Boolean indicating whether a data point is defined. +* +* @name defined +* @memberof TrailMark.prototype +* @type {(boolean|void)} +* +* @example +* var mark = new TrailMark({ +* 'defined': false +* }); +* +* var v = mark.defined; +* // returns false +*/ +setReadWriteAccessor( TrailMark.prototype, 'defined', getDefined, setDefined ); + +/** +* Trail size (width). +* +* @name size +* @memberof TrailMark.prototype +* @type {(number|void)} +* +* @example +* var mark = new TrailMark({ +* 'size': 10 +* }); +* +* var v = mark.size; +* // returns 10 +*/ +setReadWriteAccessor( TrailMark.prototype, 'size', getSize, setSize ); + +/** +* Mark properties. +* +* @name properties +* @memberof TrailMark.prototype +* @type {Array} +* +* @example +* var mark = new TrailMark({}); +* +* var v = mark.properties; +* // returns [...] +*/ +setNonEnumerableReadOnlyAccessor( TrailMark.prototype, 'properties', getProperties ); + +/** +* Mark type. +* +* @name type +* @memberof TrailMark.prototype +* @type {string} +* @default 'trail' +* +* @example +* var mark = new TrailMark({ +* 'defined': true +* }); +* +* var v = mark.type; +* // returns 'trail' +*/ + +setReadWriteAccessor( TrailMark.prototype, 'type', getType, setType ); + +/** +* Serializes an instance to a JSON object. +* +* ## Notes +* +* - This method is implicitly invoked by `JSON.stringify`. +* +* @name toJSON +* @memberof TrailMark.prototype +* @type {Function} +* @returns {Object} JSON object +* +* @example +* var mark = new TrailMark({ +* 'defined': true +* }); +* +* var v = mark.toJSON(); +* // returns {...} +*/ +setNonEnumerableReadOnly( TrailMark.prototype, 'toJSON', function toJSON() { + return instance2json( this, properties ); +}); + + +// EXPORTS // + +module.exports = TrailMark; diff --git a/lib/node_modules/@stdlib/plot/vega/mark/trail/lib/properties.json b/lib/node_modules/@stdlib/plot/vega/mark/trail/lib/properties.json new file mode 100644 index 000000000000..6966548ec3c0 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/mark/trail/lib/properties.json @@ -0,0 +1,20 @@ +[ + "aria", + "clip", + "description", + "encode", + "from", + "interactive", + "key", + "name", + "role", + "sort", + "style", + "transform", + "triggers", + "type", + "zindex", + + "defined", + "size" +] diff --git a/lib/node_modules/@stdlib/plot/vega/mark/trail/lib/properties/get.js b/lib/node_modules/@stdlib/plot/vega/mark/trail/lib/properties/get.js new file mode 100644 index 000000000000..f3cbb28454ea --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/mark/trail/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/trail/lib/size/get.js b/lib/node_modules/@stdlib/plot/vega/mark/trail/lib/size/get.js new file mode 100644 index 000000000000..b8ca6aa4851d --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/mark/trail/lib/size/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 trail size. +* +* @private +* @returns {(number|void)} trail size +*/ +function get() { + return this[ prop.private ]; +} + + +// EXPORTS // + +module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/vega/mark/trail/lib/size/properties.js b/lib/node_modules/@stdlib/plot/vega/mark/trail/lib/size/properties.js new file mode 100644 index 000000000000..bf1bd182f0eb --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/mark/trail/lib/size/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( 'size' ); + + +// EXPORTS // + +module.exports = obj; diff --git a/lib/node_modules/@stdlib/plot/vega/mark/trail/lib/size/set.js b/lib/node_modules/@stdlib/plot/vega/mark/trail/lib/size/set.js new file mode 100644 index 000000000000..b672dc8b14ed --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/mark/trail/lib/size/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 isNonNegativeNumber = require( '@stdlib/assert/is-nonnegative-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:trail-mark:set:'+prop.name ); + + +// MAIN // + +/** +* Sets the trail size. +* +* ## Notes +* +* - Providing `undefined` "unsets" the configured value. +* +* @private +* @param {(NonNegativeNumber|void)} value - input value +* @throws {TypeError} must be a non-negative number +* @returns {void} +*/ +function set( value ) { + if ( !isNonNegativeNumber( value ) && !isUndefined( value ) ) { + throw new TypeError( format( 'invalid assignment. `%s` must be a non-negative 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/trail/lib/type/get.js b/lib/node_modules/@stdlib/plot/vega/mark/trail/lib/type/get.js new file mode 100644 index 000000000000..84cc34fbacd5 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/mark/trail/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/trail/lib/type/set.js b/lib/node_modules/@stdlib/plot/vega/mark/trail/lib/type/set.js new file mode 100644 index 000000000000..9e06599a5a16 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/mark/trail/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/trail/lib/type/type.js b/lib/node_modules/@stdlib/plot/vega/mark/trail/lib/type/type.js new file mode 100644 index 000000000000..8c2d952eefd8 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/mark/trail/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 = 'trail'; diff --git a/lib/node_modules/@stdlib/plot/vega/mark/trail/package.json b/lib/node_modules/@stdlib/plot/vega/mark/trail/package.json new file mode 100644 index 000000000000..decd9a4c87ca --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/mark/trail/package.json @@ -0,0 +1,59 @@ +{ + "name": "@stdlib/plot/vega/mark/trail", + "version": "0.0.0", + "description": "Trail 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", + "trail" + ], + "__stdlib__": {} +}