From 8b159cdf456e065a9b7ba4795e56f25196d51786 Mon Sep 17 00:00:00 2001 From: orthodox-64 Date: Sun, 12 Apr 2026 00:30:23 +0530 Subject: [PATCH 1/3] feat: add plot/vega/mark/path --- 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: 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 --- --- .../plot/vega/mark/path/examples/index.js | 27 ++ .../plot/vega/mark/path/lib/angle/get.js | 43 +++ .../vega/mark/path/lib/angle/properties.js | 33 ++ .../plot/vega/mark/path/lib/angle/set.js | 61 ++++ .../plot/vega/mark/path/lib/change_event.js | 41 +++ .../plot/vega/mark/path/lib/defaults.js | 49 +++ .../@stdlib/plot/vega/mark/path/lib/index.js | 42 +++ .../@stdlib/plot/vega/mark/path/lib/main.js | 302 ++++++++++++++++++ .../plot/vega/mark/path/lib/path/get.js | 43 +++ .../vega/mark/path/lib/path/properties.js | 33 ++ .../plot/vega/mark/path/lib/path/set.js | 66 ++++ .../plot/vega/mark/path/lib/properties.json | 22 ++ .../plot/vega/mark/path/lib/properties/get.js | 41 +++ .../plot/vega/mark/path/lib/scale-x/get.js | 43 +++ .../vega/mark/path/lib/scale-x/properties.js | 33 ++ .../plot/vega/mark/path/lib/scale-x/set.js | 61 ++++ .../plot/vega/mark/path/lib/scale-y/get.js | 43 +++ .../vega/mark/path/lib/scale-y/properties.js | 33 ++ .../plot/vega/mark/path/lib/scale-y/set.js | 61 ++++ .../plot/vega/mark/path/lib/type/get.js | 41 +++ .../plot/vega/mark/path/lib/type/set.js | 46 +++ .../plot/vega/mark/path/lib/type/type.js | 23 ++ .../@stdlib/plot/vega/mark/path/package.json | 61 ++++ 23 files changed, 1248 insertions(+) create mode 100644 lib/node_modules/@stdlib/plot/vega/mark/path/examples/index.js create mode 100644 lib/node_modules/@stdlib/plot/vega/mark/path/lib/angle/get.js create mode 100644 lib/node_modules/@stdlib/plot/vega/mark/path/lib/angle/properties.js create mode 100644 lib/node_modules/@stdlib/plot/vega/mark/path/lib/angle/set.js create mode 100644 lib/node_modules/@stdlib/plot/vega/mark/path/lib/change_event.js create mode 100644 lib/node_modules/@stdlib/plot/vega/mark/path/lib/defaults.js create mode 100644 lib/node_modules/@stdlib/plot/vega/mark/path/lib/index.js create mode 100644 lib/node_modules/@stdlib/plot/vega/mark/path/lib/main.js create mode 100644 lib/node_modules/@stdlib/plot/vega/mark/path/lib/path/get.js create mode 100644 lib/node_modules/@stdlib/plot/vega/mark/path/lib/path/properties.js create mode 100644 lib/node_modules/@stdlib/plot/vega/mark/path/lib/path/set.js create mode 100644 lib/node_modules/@stdlib/plot/vega/mark/path/lib/properties.json create mode 100644 lib/node_modules/@stdlib/plot/vega/mark/path/lib/properties/get.js create mode 100644 lib/node_modules/@stdlib/plot/vega/mark/path/lib/scale-x/get.js create mode 100644 lib/node_modules/@stdlib/plot/vega/mark/path/lib/scale-x/properties.js create mode 100644 lib/node_modules/@stdlib/plot/vega/mark/path/lib/scale-x/set.js create mode 100644 lib/node_modules/@stdlib/plot/vega/mark/path/lib/scale-y/get.js create mode 100644 lib/node_modules/@stdlib/plot/vega/mark/path/lib/scale-y/properties.js create mode 100644 lib/node_modules/@stdlib/plot/vega/mark/path/lib/scale-y/set.js create mode 100644 lib/node_modules/@stdlib/plot/vega/mark/path/lib/type/get.js create mode 100644 lib/node_modules/@stdlib/plot/vega/mark/path/lib/type/set.js create mode 100644 lib/node_modules/@stdlib/plot/vega/mark/path/lib/type/type.js create mode 100644 lib/node_modules/@stdlib/plot/vega/mark/path/package.json diff --git a/lib/node_modules/@stdlib/plot/vega/mark/path/examples/index.js b/lib/node_modules/@stdlib/plot/vega/mark/path/examples/index.js new file mode 100644 index 000000000000..e755cdac8435 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/mark/path/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 PathMark = require( './../lib' ); + +var mark = new PathMark({ + 'path': 'M-50,-50 L50,50 V-50 L-50,50 Z' +}); + +console.log( mark.toJSON() ); diff --git a/lib/node_modules/@stdlib/plot/vega/mark/path/lib/angle/get.js b/lib/node_modules/@stdlib/plot/vega/mark/path/lib/angle/get.js new file mode 100644 index 000000000000..3ebc4f78fa6f --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/mark/path/lib/angle/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 rotation angle in degrees. +* +* @private +* @returns {number} rotation angle +*/ +function get() { + return this[ prop.private ]; +} + + +// EXPORTS // + +module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/vega/mark/path/lib/angle/properties.js b/lib/node_modules/@stdlib/plot/vega/mark/path/lib/angle/properties.js new file mode 100644 index 000000000000..5889ae58645a --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/mark/path/lib/angle/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( 'angle' ); + + +// EXPORTS // + +module.exports = obj; diff --git a/lib/node_modules/@stdlib/plot/vega/mark/path/lib/angle/set.js b/lib/node_modules/@stdlib/plot/vega/mark/path/lib/angle/set.js new file mode 100644 index 000000000000..003a8e74bd64 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/mark/path/lib/angle/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:path-mark:set:'+prop.name ); + + +// MAIN // + +/** +* Sets the rotation angle in degrees. +* +* @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/path/lib/change_event.js b/lib/node_modules/@stdlib/plot/vega/mark/path/lib/change_event.js new file mode 100644 index 000000000000..359afbfa206b --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/mark/path/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/path/lib/defaults.js b/lib/node_modules/@stdlib/plot/vega/mark/path/lib/defaults.js new file mode 100644 index 000000000000..6c6ec0c6dca2 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/mark/path/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 { + // Rotation angle in degrees: + 'angle': 0, + + // Horizontal scale factor: + 'scaleX': 1, + + // Vertical scale factor: + 'scaleY': 1 + }; +} + + +// EXPORTS // + +module.exports = defaults; diff --git a/lib/node_modules/@stdlib/plot/vega/mark/path/lib/index.js b/lib/node_modules/@stdlib/plot/vega/mark/path/lib/index.js new file mode 100644 index 000000000000..38218600bf62 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/mark/path/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'; + +/** +* Path mark constructor. +* +* @module @stdlib/plot/vega/mark/path +* +* @example +* var PathMark = require( '@stdlib/plot/vega/mark/path' ); +* +* var mark = new PathMark({ +* 'path': 'M-50,-50 L50,50 V-50 L-50,50 Z' +* }); +* // returns +*/ + +// MODULES // + +var main = require( './main.js' ); + + +// EXPORTS // + +module.exports = main; diff --git a/lib/node_modules/@stdlib/plot/vega/mark/path/lib/main.js b/lib/node_modules/@stdlib/plot/vega/mark/path/lib/main.js new file mode 100644 index 000000000000..225d84614158 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/mark/path/lib/main.js @@ -0,0 +1,302 @@ +/** +* @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 getAngle = require( './angle/get.js' ); +var setAngle = require( './angle/set.js' ); + +var getPath = require( './path/get.js' ); +var setPath = require( './path/set.js' ); + +var getProperties = require( './properties/get.js' ); + +var getScaleX = require( './scale-x/get.js' ); +var setScaleX = require( './scale-x/set.js' ); + +var getScaleY = require( './scale-y/get.js' ); +var setScaleY = require( './scale-y/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:path-mark:main' ); + + +// MAIN // + +/** +* Path mark constructor. +* +* @constructor +* @param {Options} [options] - constructor options +* @param {number} [options.angle=0] - rotation angle in degrees +* @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 {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.path] - SVG path string +* @param {string} [options.role] - metadata string indicating the role of a mark +* @param {number} [options.scaleX=1] - horizontal scale factor +* @param {number} [options.scaleY=1] - vertical scale factor +* @param {Array} [options.triggers=[]] - list of triggers for modifying mark properties in response to signal changes +* @param {Object} [options.sort] - comparator for sorting mark items +* @param {Array} [options.transforms=[]] - list of post-encoding transforms to apply after any "encode" blocks and which operate directly on mark scenegraph items +* @param {(string|Array)} [options.style] - custom styles to apply to a mark +* @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 "path" +* @throws {Error} must provide valid options +* @returns {PathMark} path mark instance +* +* @example +* var mark = new PathMark({ +* 'path': 'M-50,-50 L50,50 V-50 L-50,50 Z' +* }); +* // returns +*/ +function PathMark( options ) { + var opts; + var keys; + var v; + var k; + var i; + if ( !( this instanceof PathMark ) ) { + if ( arguments.length === 0 ) { + return new PathMark( {} ); + } + return new PathMark( 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( PathMark, Mark ); + +/** +* Constructor name. +* +* @private +* @name name +* @memberof PathMark +* @readonly +* @type {string} +*/ +setNonEnumerableReadOnly( PathMark, 'name', 'PathMark' ); + +/** +* Rotation angle in degrees. +* +* @name angle +* @memberof PathMark.prototype +* @type {number} +* @default 0 +* +* @example +* var mark = new PathMark({ +* 'angle': 45 +* }); +* +* var v = mark.angle; +* // returns 45 +*/ +setReadWriteAccessor( PathMark.prototype, 'angle', getAngle, setAngle ); + +/** +* SVG path string. +* +* @name path +* @memberof PathMark.prototype +* @type {(string|void)} +* +* @example +* var mark = new PathMark({ +* 'path': 'M-50,-50 L50,50 V-50 L-50,50 Z' +* }); +* +* var v = mark.path; +* // returns 'M-50,-50 L50,50 V-50 L-50,50 Z' +*/ +setReadWriteAccessor( PathMark.prototype, 'path', getPath, setPath ); + +/** +* Mark properties. +* +* @name properties +* @memberof PathMark.prototype +* @type {Array} +* +* @example +* var mark = new PathMark({}); +* +* var v = mark.properties; +* // returns [...] +*/ +setNonEnumerableReadOnlyAccessor( PathMark.prototype, 'properties', getProperties ); + +/** +* Horizontal scale factor. +* +* @name scaleX +* @memberof PathMark.prototype +* @type {number} +* @default 1 +* +* @example +* var mark = new PathMark({ +* 'scaleX': 2.0 +* }); +* +* var v = mark.scaleX; +* // returns 2.0 +*/ +setReadWriteAccessor( PathMark.prototype, 'scaleX', getScaleX, setScaleX ); + +/** +* Vertical scale factor. +* +* @name scaleY +* @memberof PathMark.prototype +* @type {number} +* @default 1 +* +* @example +* var mark = new PathMark({ +* 'scaleY': 2.0 +* }); +* +* var v = mark.scaleY; +* // returns 2.0 +*/ +setReadWriteAccessor( PathMark.prototype, 'scaleY', getScaleY, setScaleY ); + +/** +* Mark type. +* +* @name type +* @memberof PathMark.prototype +* @type {string} +* @default 'path' +* +* @example +* var mark = new PathMark({ +* 'path': 'M-50,-50 L50,50 V-50 L-50,50 Z' +* }); +* +* var v = mark.type; +* // returns 'path' +*/ +setReadWriteAccessor( PathMark.prototype, 'type', getType, setType ); + +/** +* Serializes an instance to a JSON object. +* +* ## Notes +* +* - This method is implicitly invoked by `JSON.stringify`. +* +* @name toJSON +* @memberof PathMark.prototype +* @type {Function} +* @returns {Object} JSON object +* +* @example +* var mark = new PathMark({ +* 'path': 'M-50,-50 L50,50 V-50 L-50,50 Z' +* }); +* +* var v = mark.toJSON(); +* // returns {...} +*/ +setNonEnumerableReadOnly( PathMark.prototype, 'toJSON', function toJSON() { + return instance2json( this, properties ); +}); + + +// EXPORTS // + +module.exports = PathMark; diff --git a/lib/node_modules/@stdlib/plot/vega/mark/path/lib/path/get.js b/lib/node_modules/@stdlib/plot/vega/mark/path/lib/path/get.js new file mode 100644 index 000000000000..456551a05abc --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/mark/path/lib/path/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 SVG path string. +* +* @private +* @returns {(string|void)} SVG path string +*/ +function get() { + return this[ prop.private ]; +} + + +// EXPORTS // + +module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/vega/mark/path/lib/path/properties.js b/lib/node_modules/@stdlib/plot/vega/mark/path/lib/path/properties.js new file mode 100644 index 000000000000..0a634413abfe --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/mark/path/lib/path/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( 'path' ); + + +// EXPORTS // + +module.exports = obj; diff --git a/lib/node_modules/@stdlib/plot/vega/mark/path/lib/path/set.js b/lib/node_modules/@stdlib/plot/vega/mark/path/lib/path/set.js new file mode 100644 index 000000000000..c196cdfe1fa1 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/mark/path/lib/path/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 isString = require( '@stdlib/assert/is-string' ).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:path-mark:set:'+prop.name ); + + +// MAIN // + +/** +* Sets the SVG path string. +* +* ## Notes +* +* - Providing `undefined` "unsets" the configured value. +* +* @private +* @param {(string|void)} value - input value +* @throws {TypeError} must be a string +* @returns {void} +*/ +function set( value ) { + if ( !isUndefined( value ) && !isString( value ) ) { + throw new TypeError( format( 'invalid assignment. `%s` must be a string. 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/path/lib/properties.json b/lib/node_modules/@stdlib/plot/vega/mark/path/lib/properties.json new file mode 100644 index 000000000000..e0d936383b59 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/mark/path/lib/properties.json @@ -0,0 +1,22 @@ +[ + "aria", + "clip", + "description", + "encode", + "from", + "interactive", + "key", + "name", + "role", + "sort", + "style", + "transform", + "triggers", + "type", + "zindex", + + "angle", + "path", + "scaleX", + "scaleY" +] diff --git a/lib/node_modules/@stdlib/plot/vega/mark/path/lib/properties/get.js b/lib/node_modules/@stdlib/plot/vega/mark/path/lib/properties/get.js new file mode 100644 index 000000000000..f3cbb28454ea --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/mark/path/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/path/lib/scale-x/get.js b/lib/node_modules/@stdlib/plot/vega/mark/path/lib/scale-x/get.js new file mode 100644 index 000000000000..49a3f0306fa2 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/mark/path/lib/scale-x/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 horizontal scale factor. +* +* @private +* @returns {number} horizontal scale factor +*/ +function get() { + return this[ prop.private ]; +} + + +// EXPORTS // + +module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/vega/mark/path/lib/scale-x/properties.js b/lib/node_modules/@stdlib/plot/vega/mark/path/lib/scale-x/properties.js new file mode 100644 index 000000000000..334f11137117 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/mark/path/lib/scale-x/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( 'scaleX' ); + + +// EXPORTS // + +module.exports = obj; diff --git a/lib/node_modules/@stdlib/plot/vega/mark/path/lib/scale-x/set.js b/lib/node_modules/@stdlib/plot/vega/mark/path/lib/scale-x/set.js new file mode 100644 index 000000000000..4357307b1f74 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/mark/path/lib/scale-x/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:path-mark:set:'+prop.name ); + + +// MAIN // + +/** +* Sets the horizontal scale factor. +* +* @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/path/lib/scale-y/get.js b/lib/node_modules/@stdlib/plot/vega/mark/path/lib/scale-y/get.js new file mode 100644 index 000000000000..d22952dbf0a7 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/mark/path/lib/scale-y/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 vertical scale factor. +* +* @private +* @returns {number} vertical scale factor +*/ +function get() { + return this[ prop.private ]; +} + + +// EXPORTS // + +module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/vega/mark/path/lib/scale-y/properties.js b/lib/node_modules/@stdlib/plot/vega/mark/path/lib/scale-y/properties.js new file mode 100644 index 000000000000..62831aa423f4 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/mark/path/lib/scale-y/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( 'scaleY' ); + + +// EXPORTS // + +module.exports = obj; diff --git a/lib/node_modules/@stdlib/plot/vega/mark/path/lib/scale-y/set.js b/lib/node_modules/@stdlib/plot/vega/mark/path/lib/scale-y/set.js new file mode 100644 index 000000000000..d2646d0212e8 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/mark/path/lib/scale-y/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:path-mark:set:'+prop.name ); + + +// MAIN // + +/** +* Sets the vertical scale factor. +* +* @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/path/lib/type/get.js b/lib/node_modules/@stdlib/plot/vega/mark/path/lib/type/get.js new file mode 100644 index 000000000000..84cc34fbacd5 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/mark/path/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/path/lib/type/set.js b/lib/node_modules/@stdlib/plot/vega/mark/path/lib/type/set.js new file mode 100644 index 000000000000..9e06599a5a16 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/mark/path/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/path/lib/type/type.js b/lib/node_modules/@stdlib/plot/vega/mark/path/lib/type/type.js new file mode 100644 index 000000000000..f55041b80b8b --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/mark/path/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 = 'path'; diff --git a/lib/node_modules/@stdlib/plot/vega/mark/path/package.json b/lib/node_modules/@stdlib/plot/vega/mark/path/package.json new file mode 100644 index 000000000000..582e46e7d759 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/mark/path/package.json @@ -0,0 +1,61 @@ +{ + "name": "@stdlib/plot/vega/mark/path", + "version": "0.0.0", + "description": "Path 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", + "path", + "constructor", + "ctor" + ], + "__stdlib__": {} +} From 2ce0c8b07e18fae70af98ebc056f0ca14a54b915 Mon Sep 17 00:00:00 2001 From: orthodox-64 Date: Sat, 6 Jun 2026 14:32:12 +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 --- --- lib/node_modules/@stdlib/plot/vega/mark/path/lib/main.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lib/node_modules/@stdlib/plot/vega/mark/path/lib/main.js b/lib/node_modules/@stdlib/plot/vega/mark/path/lib/main.js index 225d84614158..d7e42cb7a98e 100644 --- a/lib/node_modules/@stdlib/plot/vega/mark/path/lib/main.js +++ b/lib/node_modules/@stdlib/plot/vega/mark/path/lib/main.js @@ -36,6 +36,7 @@ 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 getAngle = require( './angle/get.js' ); @@ -55,8 +56,6 @@ var setScaleY = require( './scale-y/set.js' ); var getType = require( './type/get.js' ); var setType = require( './type/set.js' ); -var TYPE = require( './type/type.js' ); - // VARIABLES // From 66f3ca26decf42787a0031bbab5a2e1d6dcafa21 Mon Sep 17 00:00:00 2001 From: Sachinn-64 Date: Fri, 31 Jul 2026 22:40:24 +0530 Subject: [PATCH 3/3] refactor: path mark --- 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/path/{ => ctor}/examples/index.js | 22 +- .../mark/path/{ => ctor}/lib/change_event.js | 0 .../vega/mark/path/{ => ctor}/lib/defaults.js | 16 +- .../path/{lib/path => ctor/lib/encode}/get.js | 4 +- .../scale-y => ctor/lib/encode}/properties.js | 2 +- .../path/{lib/path => ctor/lib/encode}/set.js | 16 +- .../vega/mark/path/{ => ctor}/lib/index.js | 8 +- .../plot/vega/mark/path/ctor/lib/main.js | 162 ++++++++++ .../vega/mark/path/{ => ctor}/package.json | 3 +- .../plot/vega/mark/path/lib/angle/get.js | 43 --- .../vega/mark/path/lib/angle/properties.js | 33 -- .../plot/vega/mark/path/lib/angle/set.js | 61 ---- .../@stdlib/plot/vega/mark/path/lib/main.js | 301 ------------------ .../vega/mark/path/lib/path/properties.js | 33 -- .../plot/vega/mark/path/lib/properties.json | 22 -- .../plot/vega/mark/path/lib/properties/get.js | 41 --- .../plot/vega/mark/path/lib/scale-x/get.js | 43 --- .../vega/mark/path/lib/scale-x/properties.js | 33 -- .../plot/vega/mark/path/lib/scale-x/set.js | 61 ---- .../plot/vega/mark/path/lib/scale-y/get.js | 43 --- .../plot/vega/mark/path/lib/scale-y/set.js | 61 ---- .../plot/vega/mark/path/lib/type/get.js | 41 --- .../plot/vega/mark/path/lib/type/set.js | 46 --- .../plot/vega/mark/path/lib/type/type.js | 23 -- 24 files changed, 207 insertions(+), 911 deletions(-) rename lib/node_modules/@stdlib/plot/vega/mark/path/{ => ctor}/examples/index.js (58%) rename lib/node_modules/@stdlib/plot/vega/mark/path/{ => ctor}/lib/change_event.js (100%) rename lib/node_modules/@stdlib/plot/vega/mark/path/{ => ctor}/lib/defaults.js (80%) rename lib/node_modules/@stdlib/plot/vega/mark/path/{lib/path => ctor/lib/encode}/get.js (88%) rename lib/node_modules/@stdlib/plot/vega/mark/path/{lib/scale-y => ctor/lib/encode}/properties.js (95%) rename lib/node_modules/@stdlib/plot/vega/mark/path/{lib/path => ctor/lib/encode}/set.js (70%) rename lib/node_modules/@stdlib/plot/vega/mark/path/{ => ctor}/lib/index.js (81%) create mode 100644 lib/node_modules/@stdlib/plot/vega/mark/path/ctor/lib/main.js rename lib/node_modules/@stdlib/plot/vega/mark/path/{ => ctor}/package.json (94%) delete mode 100644 lib/node_modules/@stdlib/plot/vega/mark/path/lib/angle/get.js delete mode 100644 lib/node_modules/@stdlib/plot/vega/mark/path/lib/angle/properties.js delete mode 100644 lib/node_modules/@stdlib/plot/vega/mark/path/lib/angle/set.js delete mode 100644 lib/node_modules/@stdlib/plot/vega/mark/path/lib/main.js delete mode 100644 lib/node_modules/@stdlib/plot/vega/mark/path/lib/path/properties.js delete mode 100644 lib/node_modules/@stdlib/plot/vega/mark/path/lib/properties.json delete mode 100644 lib/node_modules/@stdlib/plot/vega/mark/path/lib/properties/get.js delete mode 100644 lib/node_modules/@stdlib/plot/vega/mark/path/lib/scale-x/get.js delete mode 100644 lib/node_modules/@stdlib/plot/vega/mark/path/lib/scale-x/properties.js delete mode 100644 lib/node_modules/@stdlib/plot/vega/mark/path/lib/scale-x/set.js delete mode 100644 lib/node_modules/@stdlib/plot/vega/mark/path/lib/scale-y/get.js delete mode 100644 lib/node_modules/@stdlib/plot/vega/mark/path/lib/scale-y/set.js delete mode 100644 lib/node_modules/@stdlib/plot/vega/mark/path/lib/type/get.js delete mode 100644 lib/node_modules/@stdlib/plot/vega/mark/path/lib/type/set.js delete mode 100644 lib/node_modules/@stdlib/plot/vega/mark/path/lib/type/type.js diff --git a/lib/node_modules/@stdlib/plot/vega/mark/path/examples/index.js b/lib/node_modules/@stdlib/plot/vega/mark/path/ctor/examples/index.js similarity index 58% rename from lib/node_modules/@stdlib/plot/vega/mark/path/examples/index.js rename to lib/node_modules/@stdlib/plot/vega/mark/path/ctor/examples/index.js index e755cdac8435..ec5c71f7f81d 100644 --- a/lib/node_modules/@stdlib/plot/vega/mark/path/examples/index.js +++ b/lib/node_modules/@stdlib/plot/vega/mark/path/ctor/examples/index.js @@ -18,10 +18,28 @@ 'use strict'; +var Value = require( '@stdlib/plot/vega/value/ctor' ); +var PathEncodingSet = require( '@stdlib/plot/vega/mark/path/encoding-set' ); +var PathEncoding = require( '@stdlib/plot/vega/mark/path/encoding' ); var PathMark = require( './../lib' ); var mark = new PathMark({ - 'path': 'M-50,-50 L50,50 V-50 L-50,50 Z' + 'encode': new PathEncoding({ + 'enter': new PathEncodingSet({ + 'stroke': new Value({ + 'value': '#000' + }) + }), + 'update': new PathEncodingSet({ + 'stroke': new Value({ + 'value': 'steelblue' + }) + }), + 'exit': new PathEncodingSet({ + 'stroke': new Value({ + 'value': '#fff' + }) + }) + }) }); - console.log( mark.toJSON() ); diff --git a/lib/node_modules/@stdlib/plot/vega/mark/path/lib/change_event.js b/lib/node_modules/@stdlib/plot/vega/mark/path/ctor/lib/change_event.js similarity index 100% rename from lib/node_modules/@stdlib/plot/vega/mark/path/lib/change_event.js rename to lib/node_modules/@stdlib/plot/vega/mark/path/ctor/lib/change_event.js diff --git a/lib/node_modules/@stdlib/plot/vega/mark/path/lib/defaults.js b/lib/node_modules/@stdlib/plot/vega/mark/path/ctor/lib/defaults.js similarity index 80% rename from lib/node_modules/@stdlib/plot/vega/mark/path/lib/defaults.js rename to lib/node_modules/@stdlib/plot/vega/mark/path/ctor/lib/defaults.js index 6c6ec0c6dca2..734133191f43 100644 --- a/lib/node_modules/@stdlib/plot/vega/mark/path/lib/defaults.js +++ b/lib/node_modules/@stdlib/plot/vega/mark/path/ctor/lib/defaults.js @@ -18,6 +18,11 @@ 'use strict'; +// MODULES // + +var PathEncoding = require( '@stdlib/plot/vega/mark/path/encoding' ); + + // MAIN // /** @@ -32,14 +37,11 @@ */ function defaults() { return { - // Rotation angle in degrees: - 'angle': 0, - - // Horizontal scale factor: - 'scaleX': 1, + // Visual encoding rules for path mark properties: + 'encoding': new PathEncoding(), - // Vertical scale factor: - 'scaleY': 1 + // Mark type: + 'type': 'path' }; } diff --git a/lib/node_modules/@stdlib/plot/vega/mark/path/lib/path/get.js b/lib/node_modules/@stdlib/plot/vega/mark/path/ctor/lib/encode/get.js similarity index 88% rename from lib/node_modules/@stdlib/plot/vega/mark/path/lib/path/get.js rename to lib/node_modules/@stdlib/plot/vega/mark/path/ctor/lib/encode/get.js index 456551a05abc..74123a470d5c 100644 --- a/lib/node_modules/@stdlib/plot/vega/mark/path/lib/path/get.js +++ b/lib/node_modules/@stdlib/plot/vega/mark/path/ctor/lib/encode/get.js @@ -28,10 +28,10 @@ var prop = require( './properties.js' ); // MAIN // /** -* Returns the SVG path string. +* Returns the set of visual encoding rules for path mark properties. * * @private -* @returns {(string|void)} SVG path string +* @returns {(PathEncoding|void)} encodings */ function get() { return this[ prop.private ]; diff --git a/lib/node_modules/@stdlib/plot/vega/mark/path/lib/scale-y/properties.js b/lib/node_modules/@stdlib/plot/vega/mark/path/ctor/lib/encode/properties.js similarity index 95% rename from lib/node_modules/@stdlib/plot/vega/mark/path/lib/scale-y/properties.js rename to lib/node_modules/@stdlib/plot/vega/mark/path/ctor/lib/encode/properties.js index 62831aa423f4..534754763d4e 100644 --- a/lib/node_modules/@stdlib/plot/vega/mark/path/lib/scale-y/properties.js +++ b/lib/node_modules/@stdlib/plot/vega/mark/path/ctor/lib/encode/properties.js @@ -25,7 +25,7 @@ var property2object = require( '@stdlib/plot/vega/base/property2object' ); // MAIN // -var obj = property2object( 'scaleY' ); +var obj = property2object( 'encode' ); // EXPORTS // diff --git a/lib/node_modules/@stdlib/plot/vega/mark/path/lib/path/set.js b/lib/node_modules/@stdlib/plot/vega/mark/path/ctor/lib/encode/set.js similarity index 70% rename from lib/node_modules/@stdlib/plot/vega/mark/path/lib/path/set.js rename to lib/node_modules/@stdlib/plot/vega/mark/path/ctor/lib/encode/set.js index c196cdfe1fa1..2a79f797cd2c 100644 --- a/lib/node_modules/@stdlib/plot/vega/mark/path/lib/path/set.js +++ b/lib/node_modules/@stdlib/plot/vega/mark/path/ctor/lib/encode/set.js @@ -23,7 +23,7 @@ // MODULES // var logger = require( 'debug' ); -var isString = require( '@stdlib/assert/is-string' ).isPrimitive; +var isPathMarkEncoding = require( '@stdlib/plot/vega/base/assert/is-path-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:path-mark:set:'+prop.name ); +var debug = logger( 'vega:mark:path:set:'+prop.name ); // MAIN // /** -* Sets the SVG path string. +* Sets the visual encoding rules for path mark properties. * * ## Notes * * - Providing `undefined` "unsets" the configured value. * * @private -* @param {(string|void)} value - input value -* @throws {TypeError} must be a string +* @param {(Encoding|void)} value - input value +* @throws {TypeError} must be a path mark encoding instance * @returns {void} */ function set( value ) { - if ( !isUndefined( value ) && !isString( value ) ) { - throw new TypeError( format( 'invalid assignment. `%s` must be a string. Value: `%s`.', prop.name, value ) ); + if ( !isPathMarkEncoding( value ) && !isUndefined( value ) ) { + throw new TypeError( format( 'invalid assignment. `%s` must be a path 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/path/lib/index.js b/lib/node_modules/@stdlib/plot/vega/mark/path/ctor/lib/index.js similarity index 81% rename from lib/node_modules/@stdlib/plot/vega/mark/path/lib/index.js rename to lib/node_modules/@stdlib/plot/vega/mark/path/ctor/lib/index.js index 38218600bf62..86390ea18ff5 100644 --- a/lib/node_modules/@stdlib/plot/vega/mark/path/lib/index.js +++ b/lib/node_modules/@stdlib/plot/vega/mark/path/ctor/lib/index.js @@ -21,14 +21,12 @@ /** * Path mark constructor. * -* @module @stdlib/plot/vega/mark/path +* @module @stdlib/plot/vega/mark/path/ctor * * @example -* var PathMark = require( '@stdlib/plot/vega/mark/path' ); +* var PathMark = require( '@stdlib/plot/vega/mark/path/ctor' ); * -* var mark = new PathMark({ -* 'path': 'M-50,-50 L50,50 V-50 L-50,50 Z' -* }); +* var mark = new PathMark(); * // returns */ diff --git a/lib/node_modules/@stdlib/plot/vega/mark/path/ctor/lib/main.js b/lib/node_modules/@stdlib/plot/vega/mark/path/ctor/lib/main.js new file mode 100644 index 000000000000..c637d22805bb --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/mark/path/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:path:main' ); + + +// MAIN // + +/** +* Path 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 {PathEncoding} [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 {PathMark} path mark instance +* +* @example +* var mark = new PathMark(); +* // returns +*/ +function PathMark( options ) { + var nargs; + var props; + var v; + var k; + var i; + + nargs = arguments.length; + if ( !( this instanceof PathMark ) ) { + if ( nargs === 0 ) { + return new PathMark(); + } + return new PathMark( 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( PathMark, Mark ); + +/** +* Constructor name. +* +* @private +* @name name +* @memberof PathMark +* @readonly +* @type {string} +*/ +setNonEnumerableReadOnly( PathMark, 'name', 'PathMark' ); + +/** +* Visual encoding rules for path mark properties. +* +* @name encode +* @memberof Mark.prototype +* @type {(PathEncoding|void)} +* +* @example +* var Value = require( '@stdlib/plot/vega/value/ctor' ); +* var EncodingSet = require( '@stdlib/plot/vega/mark/path/encoding-set' ); +* var Encoding = require( '@stdlib/plot/vega/mark/path/encoding' ); +* +* var mark = new PathMark({ +* 'encode': new Encoding({ +* 'enter': new EncodingSet({ +* 'stroke': new Value({ +* 'value': 'steelblue' +* }) +* }) +* }) +* }); +* +* var v = mark.encode; +* // returns {...} +*/ +setReadWriteAccessor( PathMark.prototype, 'encode', getEncode, setEncode ); + + +// EXPORTS // + +module.exports = PathMark; diff --git a/lib/node_modules/@stdlib/plot/vega/mark/path/package.json b/lib/node_modules/@stdlib/plot/vega/mark/path/ctor/package.json similarity index 94% rename from lib/node_modules/@stdlib/plot/vega/mark/path/package.json rename to lib/node_modules/@stdlib/plot/vega/mark/path/ctor/package.json index 582e46e7d759..686840922442 100644 --- a/lib/node_modules/@stdlib/plot/vega/mark/path/package.json +++ b/lib/node_modules/@stdlib/plot/vega/mark/path/ctor/package.json @@ -1,5 +1,5 @@ { - "name": "@stdlib/plot/vega/mark/path", + "name": "@stdlib/plot/vega/mark/path/ctor", "version": "0.0.0", "description": "Path mark constructor.", "license": "Apache-2.0", @@ -54,6 +54,7 @@ "vega", "mark", "path", + "encoding", "constructor", "ctor" ], diff --git a/lib/node_modules/@stdlib/plot/vega/mark/path/lib/angle/get.js b/lib/node_modules/@stdlib/plot/vega/mark/path/lib/angle/get.js deleted file mode 100644 index 3ebc4f78fa6f..000000000000 --- a/lib/node_modules/@stdlib/plot/vega/mark/path/lib/angle/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 rotation angle in degrees. -* -* @private -* @returns {number} rotation angle -*/ -function get() { - return this[ prop.private ]; -} - - -// EXPORTS // - -module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/vega/mark/path/lib/angle/properties.js b/lib/node_modules/@stdlib/plot/vega/mark/path/lib/angle/properties.js deleted file mode 100644 index 5889ae58645a..000000000000 --- a/lib/node_modules/@stdlib/plot/vega/mark/path/lib/angle/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( 'angle' ); - - -// EXPORTS // - -module.exports = obj; diff --git a/lib/node_modules/@stdlib/plot/vega/mark/path/lib/angle/set.js b/lib/node_modules/@stdlib/plot/vega/mark/path/lib/angle/set.js deleted file mode 100644 index 003a8e74bd64..000000000000 --- a/lib/node_modules/@stdlib/plot/vega/mark/path/lib/angle/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:path-mark:set:'+prop.name ); - - -// MAIN // - -/** -* Sets the rotation angle in degrees. -* -* @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/path/lib/main.js b/lib/node_modules/@stdlib/plot/vega/mark/path/lib/main.js deleted file mode 100644 index d7e42cb7a98e..000000000000 --- a/lib/node_modules/@stdlib/plot/vega/mark/path/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 */ - -'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 getAngle = require( './angle/get.js' ); -var setAngle = require( './angle/set.js' ); - -var getPath = require( './path/get.js' ); -var setPath = require( './path/set.js' ); - -var getProperties = require( './properties/get.js' ); - -var getScaleX = require( './scale-x/get.js' ); -var setScaleX = require( './scale-x/set.js' ); - -var getScaleY = require( './scale-y/get.js' ); -var setScaleY = require( './scale-y/set.js' ); - -var getType = require( './type/get.js' ); -var setType = require( './type/set.js' ); - - -// VARIABLES // - -var debug = logger( 'vega:path-mark:main' ); - - -// MAIN // - -/** -* Path mark constructor. -* -* @constructor -* @param {Options} [options] - constructor options -* @param {number} [options.angle=0] - rotation angle in degrees -* @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 {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.path] - SVG path string -* @param {string} [options.role] - metadata string indicating the role of a mark -* @param {number} [options.scaleX=1] - horizontal scale factor -* @param {number} [options.scaleY=1] - vertical scale factor -* @param {Array} [options.triggers=[]] - list of triggers for modifying mark properties in response to signal changes -* @param {Object} [options.sort] - comparator for sorting mark items -* @param {Array} [options.transforms=[]] - list of post-encoding transforms to apply after any "encode" blocks and which operate directly on mark scenegraph items -* @param {(string|Array)} [options.style] - custom styles to apply to a mark -* @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 "path" -* @throws {Error} must provide valid options -* @returns {PathMark} path mark instance -* -* @example -* var mark = new PathMark({ -* 'path': 'M-50,-50 L50,50 V-50 L-50,50 Z' -* }); -* // returns -*/ -function PathMark( options ) { - var opts; - var keys; - var v; - var k; - var i; - if ( !( this instanceof PathMark ) ) { - if ( arguments.length === 0 ) { - return new PathMark( {} ); - } - return new PathMark( 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( PathMark, Mark ); - -/** -* Constructor name. -* -* @private -* @name name -* @memberof PathMark -* @readonly -* @type {string} -*/ -setNonEnumerableReadOnly( PathMark, 'name', 'PathMark' ); - -/** -* Rotation angle in degrees. -* -* @name angle -* @memberof PathMark.prototype -* @type {number} -* @default 0 -* -* @example -* var mark = new PathMark({ -* 'angle': 45 -* }); -* -* var v = mark.angle; -* // returns 45 -*/ -setReadWriteAccessor( PathMark.prototype, 'angle', getAngle, setAngle ); - -/** -* SVG path string. -* -* @name path -* @memberof PathMark.prototype -* @type {(string|void)} -* -* @example -* var mark = new PathMark({ -* 'path': 'M-50,-50 L50,50 V-50 L-50,50 Z' -* }); -* -* var v = mark.path; -* // returns 'M-50,-50 L50,50 V-50 L-50,50 Z' -*/ -setReadWriteAccessor( PathMark.prototype, 'path', getPath, setPath ); - -/** -* Mark properties. -* -* @name properties -* @memberof PathMark.prototype -* @type {Array} -* -* @example -* var mark = new PathMark({}); -* -* var v = mark.properties; -* // returns [...] -*/ -setNonEnumerableReadOnlyAccessor( PathMark.prototype, 'properties', getProperties ); - -/** -* Horizontal scale factor. -* -* @name scaleX -* @memberof PathMark.prototype -* @type {number} -* @default 1 -* -* @example -* var mark = new PathMark({ -* 'scaleX': 2.0 -* }); -* -* var v = mark.scaleX; -* // returns 2.0 -*/ -setReadWriteAccessor( PathMark.prototype, 'scaleX', getScaleX, setScaleX ); - -/** -* Vertical scale factor. -* -* @name scaleY -* @memberof PathMark.prototype -* @type {number} -* @default 1 -* -* @example -* var mark = new PathMark({ -* 'scaleY': 2.0 -* }); -* -* var v = mark.scaleY; -* // returns 2.0 -*/ -setReadWriteAccessor( PathMark.prototype, 'scaleY', getScaleY, setScaleY ); - -/** -* Mark type. -* -* @name type -* @memberof PathMark.prototype -* @type {string} -* @default 'path' -* -* @example -* var mark = new PathMark({ -* 'path': 'M-50,-50 L50,50 V-50 L-50,50 Z' -* }); -* -* var v = mark.type; -* // returns 'path' -*/ -setReadWriteAccessor( PathMark.prototype, 'type', getType, setType ); - -/** -* Serializes an instance to a JSON object. -* -* ## Notes -* -* - This method is implicitly invoked by `JSON.stringify`. -* -* @name toJSON -* @memberof PathMark.prototype -* @type {Function} -* @returns {Object} JSON object -* -* @example -* var mark = new PathMark({ -* 'path': 'M-50,-50 L50,50 V-50 L-50,50 Z' -* }); -* -* var v = mark.toJSON(); -* // returns {...} -*/ -setNonEnumerableReadOnly( PathMark.prototype, 'toJSON', function toJSON() { - return instance2json( this, properties ); -}); - - -// EXPORTS // - -module.exports = PathMark; diff --git a/lib/node_modules/@stdlib/plot/vega/mark/path/lib/path/properties.js b/lib/node_modules/@stdlib/plot/vega/mark/path/lib/path/properties.js deleted file mode 100644 index 0a634413abfe..000000000000 --- a/lib/node_modules/@stdlib/plot/vega/mark/path/lib/path/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( 'path' ); - - -// EXPORTS // - -module.exports = obj; diff --git a/lib/node_modules/@stdlib/plot/vega/mark/path/lib/properties.json b/lib/node_modules/@stdlib/plot/vega/mark/path/lib/properties.json deleted file mode 100644 index e0d936383b59..000000000000 --- a/lib/node_modules/@stdlib/plot/vega/mark/path/lib/properties.json +++ /dev/null @@ -1,22 +0,0 @@ -[ - "aria", - "clip", - "description", - "encode", - "from", - "interactive", - "key", - "name", - "role", - "sort", - "style", - "transform", - "triggers", - "type", - "zindex", - - "angle", - "path", - "scaleX", - "scaleY" -] diff --git a/lib/node_modules/@stdlib/plot/vega/mark/path/lib/properties/get.js b/lib/node_modules/@stdlib/plot/vega/mark/path/lib/properties/get.js deleted file mode 100644 index f3cbb28454ea..000000000000 --- a/lib/node_modules/@stdlib/plot/vega/mark/path/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/path/lib/scale-x/get.js b/lib/node_modules/@stdlib/plot/vega/mark/path/lib/scale-x/get.js deleted file mode 100644 index 49a3f0306fa2..000000000000 --- a/lib/node_modules/@stdlib/plot/vega/mark/path/lib/scale-x/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 horizontal scale factor. -* -* @private -* @returns {number} horizontal scale factor -*/ -function get() { - return this[ prop.private ]; -} - - -// EXPORTS // - -module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/vega/mark/path/lib/scale-x/properties.js b/lib/node_modules/@stdlib/plot/vega/mark/path/lib/scale-x/properties.js deleted file mode 100644 index 334f11137117..000000000000 --- a/lib/node_modules/@stdlib/plot/vega/mark/path/lib/scale-x/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( 'scaleX' ); - - -// EXPORTS // - -module.exports = obj; diff --git a/lib/node_modules/@stdlib/plot/vega/mark/path/lib/scale-x/set.js b/lib/node_modules/@stdlib/plot/vega/mark/path/lib/scale-x/set.js deleted file mode 100644 index 4357307b1f74..000000000000 --- a/lib/node_modules/@stdlib/plot/vega/mark/path/lib/scale-x/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:path-mark:set:'+prop.name ); - - -// MAIN // - -/** -* Sets the horizontal scale factor. -* -* @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/path/lib/scale-y/get.js b/lib/node_modules/@stdlib/plot/vega/mark/path/lib/scale-y/get.js deleted file mode 100644 index d22952dbf0a7..000000000000 --- a/lib/node_modules/@stdlib/plot/vega/mark/path/lib/scale-y/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 vertical scale factor. -* -* @private -* @returns {number} vertical scale factor -*/ -function get() { - return this[ prop.private ]; -} - - -// EXPORTS // - -module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/vega/mark/path/lib/scale-y/set.js b/lib/node_modules/@stdlib/plot/vega/mark/path/lib/scale-y/set.js deleted file mode 100644 index d2646d0212e8..000000000000 --- a/lib/node_modules/@stdlib/plot/vega/mark/path/lib/scale-y/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:path-mark:set:'+prop.name ); - - -// MAIN // - -/** -* Sets the vertical scale factor. -* -* @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/path/lib/type/get.js b/lib/node_modules/@stdlib/plot/vega/mark/path/lib/type/get.js deleted file mode 100644 index 84cc34fbacd5..000000000000 --- a/lib/node_modules/@stdlib/plot/vega/mark/path/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/path/lib/type/set.js b/lib/node_modules/@stdlib/plot/vega/mark/path/lib/type/set.js deleted file mode 100644 index 9e06599a5a16..000000000000 --- a/lib/node_modules/@stdlib/plot/vega/mark/path/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/path/lib/type/type.js b/lib/node_modules/@stdlib/plot/vega/mark/path/lib/type/type.js deleted file mode 100644 index f55041b80b8b..000000000000 --- a/lib/node_modules/@stdlib/plot/vega/mark/path/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 = 'path';