diff --git a/lib/node_modules/@stdlib/plot/vega/mark/clip/examples/index.js b/lib/node_modules/@stdlib/plot/vega/mark/clip/examples/index.js new file mode 100644 index 000000000000..d8a536459ce8 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/mark/clip/examples/index.js @@ -0,0 +1,27 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 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 Clip = require( './../lib' ); + +var clip = new Clip({ + 'path': '', + 'sphere': '' +}); +console.log( clip.toJSON() ); diff --git a/lib/node_modules/@stdlib/plot/vega/mark/clip/lib/change_event.js b/lib/node_modules/@stdlib/plot/vega/mark/clip/lib/change_event.js new file mode 100644 index 000000000000..8a7e7cde912d --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/mark/clip/lib/change_event.js @@ -0,0 +1,41 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 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': 'clip', + 'property': property + }; +} + + +// EXPORTS // + +module.exports = event; diff --git a/lib/node_modules/@stdlib/plot/vega/mark/clip/lib/index.js b/lib/node_modules/@stdlib/plot/vega/mark/clip/lib/index.js new file mode 100644 index 000000000000..fc25337c2e13 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/mark/clip/lib/index.js @@ -0,0 +1,40 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 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'; + +/** +* Clip constructor. +* +* @module @stdlib/plot/vega/mark/clip +* +* @example +* var Clip = require( '@stdlib/plot/vega/mark/clip' ); +* +* var clip = new Clip(); +* // returns +*/ + +// MODULES // + +var main = require( './main.js' ); + + +// EXPORTS // + +module.exports = main; diff --git a/lib/node_modules/@stdlib/plot/vega/mark/clip/lib/main.js b/lib/node_modules/@stdlib/plot/vega/mark/clip/lib/main.js new file mode 100644 index 000000000000..03c11b25f2f1 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/mark/clip/lib/main.js @@ -0,0 +1,199 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 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 EventEmitter = require( 'events' ).EventEmitter; +var logger = require( 'debug' ); +var isObject = require( '@stdlib/assert/is-object' ); +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 setReadWriteAccessor = require( '@stdlib/utils/define-read-write-accessor' ); +var hasProp = require( '@stdlib/assert/has-property' ); +var inherit = require( '@stdlib/utils/inherit' ); +var instance2json = require( '@stdlib/plot/vega/base/to-json' ); +var transformErrorMessage = require( '@stdlib/plot/vega/base/transform-validation-message' ); +var format = require( '@stdlib/string/format' ); +var properties = require( './properties.json' ); + +// Note: keep the following in alphabetical order according to the `require` path... +var getPath = require( './path/get.js' ); +var setPath = require( './path/set.js' ); + +var getProperties = require( './properties/get.js' ); + +var getSphere = require( './sphere/get.js' ); +var setSphere = require( './sphere/set.js' ); + + +// VARIABLES // + +var debug = logger( 'vega:clip:main' ); + + +// MAIN // + +/** +* Clip constructor. +* +* @constructor +* @param {Options} [options] - constructor options +* @param {(string|Signal)} [options.path] - SVG path string describing the clipping region. +* @param {(string|Signal)} [options.sphere] - name of a cartographic projection with which to clip all marks to the projected sphere of the globe. +* @throws {TypeError} options argument must be an object +* @throws {Error} must provide valid options +* @returns {Clip} clip instance +* +* @example +* var clip = new Clip(); +* // returns +*/ +function Clip( options ) { + var nargs; + var v; + var k; + var i; + + nargs = arguments.length; + if ( !( this instanceof Clip ) ) { + if ( nargs ) { + return new Clip( options ); + } + return new Clip(); + } + EventEmitter.call( this ); + + 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... + 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 ) ); + } + } + } + return this; +} + +/* +* Inherit from the `EventEmitter` prototype. +*/ +inherit( Clip, EventEmitter ); + +/** +* Constructor name. +* +* @private +* @name name +* @memberof Clip +* @readonly +* @type {string} +*/ +setNonEnumerableReadOnly( Clip, 'name', 'Clip' ); + +/** +* SVG path string describing the clipping region. +* +* @name path +* @memberof Clip.prototype +* @type {(string|Signal)} +* +* @example +* var clip = new Clip({ +* 'path': 'foo bar' +* }); +* +* var v = clip.path; +* // returns 'foo bar' +*/ +setReadWriteAccessor( Clip.prototype, 'path', getPath, setPath ); + +/** +* Clip properties. +* +* @name properties +* @memberof Clip.prototype +* @type {Array} +* +* @example +* var clip = new Clip(); +* +* var v = clip.properties; +* // returns [...] +*/ +setNonEnumerableReadOnlyAccessor( Clip.prototype, 'properties', getProperties ); + +/** +* Name of a cartographic projection with which to clip all marks to the projected sphere of the globe. +* +* @name sphere +* @memberof Clip.prototype +* @type {(string|Signal)} +* +* @example +* var clip = new Clip({ +* 'sphere': 'foo bar' +* }); +* +* var v = clip.sphere; +* // returns 'foo bar' +*/ +setReadWriteAccessor( Clip.prototype, 'sphere', getSphere, setSphere ); + +/** +* Serializes an instance to a JSON object. +* +* ## Notes +* +* - This method is implicitly invoked by `JSON.stringify`. +* +* @name toJSON +* @memberof Clip.prototype +* @type {Function} +* @returns {Object} JSON object +* +* @example +* var clip = new Clip(); +* +* var v = clip.toJSON(); +* // returns {...} +*/ +setNonEnumerableReadOnly( Clip.prototype, 'toJSON', function toJSON() { + return instance2json( this, properties ); +}); + + +// EXPORTS // + +module.exports = Clip; diff --git a/lib/node_modules/@stdlib/plot/vega/mark/clip/lib/path/get.js b/lib/node_modules/@stdlib/plot/vega/mark/clip/lib/path/get.js new file mode 100644 index 000000000000..59701e501c00 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/mark/clip/lib/path/get.js @@ -0,0 +1,43 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 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 describing the clipping region. +* +* @private +* @returns {(string|Signal)} path +*/ +function get() { + return this[ prop.private ]; +} + + +// EXPORTS // + +module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/vega/mark/clip/lib/path/properties.js b/lib/node_modules/@stdlib/plot/vega/mark/clip/lib/path/properties.js new file mode 100644 index 000000000000..8793c7748ca2 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/mark/clip/lib/path/properties.js @@ -0,0 +1,33 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 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/clip/lib/path/set.js b/lib/node_modules/@stdlib/plot/vega/mark/clip/lib/path/set.js new file mode 100644 index 000000000000..c4b41b56a173 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/mark/clip/lib/path/set.js @@ -0,0 +1,61 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 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 format = require( '@stdlib/string/format' ); +var changeEvent = require( './../change_event.js' ); +var prop = require( './properties.js' ); + + +// VARIABLES // + +var debug = logger( 'vega:clip:set:'+prop.name ); + + +// MAIN // + +/** +* Sets the SVG path string describing the clipping region. +* +* @private +* @param {(string|Signal)} value - input value +* @throws {TypeError} must be a valid method +* @returns {void} +*/ +function set( value ) { + if ( !isString( value ) ) { + throw new TypeError( format( 'invalid assignment. `%s` must be a string. Value: `%s`.', 'title', value ) ); + } + if ( value !== this[ prop.private ] ) { + debug( 'Current value: %s. New value: %s.', JSON.stringify( this[ prop.private ] ), JSON.stringify( value ) ); + this[ prop.private ] = value; + this.emit( 'change', changeEvent( prop.name ) ); + } +} + + +// EXPORTS // + +module.exports = set; diff --git a/lib/node_modules/@stdlib/plot/vega/mark/clip/lib/properties.json b/lib/node_modules/@stdlib/plot/vega/mark/clip/lib/properties.json new file mode 100644 index 000000000000..a049e92b0cde --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/mark/clip/lib/properties.json @@ -0,0 +1,4 @@ +[ + "path", + "sphere" +] diff --git a/lib/node_modules/@stdlib/plot/vega/mark/clip/lib/properties/get.js b/lib/node_modules/@stdlib/plot/vega/mark/clip/lib/properties/get.js new file mode 100644 index 000000000000..8fc57de14e90 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/mark/clip/lib/properties/get.js @@ -0,0 +1,41 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 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/clip/lib/sphere/get.js b/lib/node_modules/@stdlib/plot/vega/mark/clip/lib/sphere/get.js new file mode 100644 index 000000000000..aee5d3e63670 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/mark/clip/lib/sphere/get.js @@ -0,0 +1,43 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 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 name of a cartographic projection with which to clip all marks to the projected sphere of the globe. +* +* @private +* @returns {string} name +*/ +function get() { + return this[ prop.private ]; +} + + +// EXPORTS // + +module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/vega/mark/clip/lib/sphere/properties.js b/lib/node_modules/@stdlib/plot/vega/mark/clip/lib/sphere/properties.js new file mode 100644 index 000000000000..76b5ff12fb39 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/mark/clip/lib/sphere/properties.js @@ -0,0 +1,33 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 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( 'sphere' ); + + +// EXPORTS // + +module.exports = obj; diff --git a/lib/node_modules/@stdlib/plot/vega/mark/clip/lib/sphere/set.js b/lib/node_modules/@stdlib/plot/vega/mark/clip/lib/sphere/set.js new file mode 100644 index 000000000000..471ab15a33ed --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/mark/clip/lib/sphere/set.js @@ -0,0 +1,61 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 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 format = require( '@stdlib/string/format' ); +var changeEvent = require( './../change_event.js' ); +var prop = require( './properties.js' ); + + +// VARIABLES // + +var debug = logger( 'vega:clip:set:'+prop.name ); + + +// MAIN // + +/** +* Sets the name of a cartographic projection with which to clip all marks to the projected sphere of the globe. +* +* @private +* @param {(string|Signal)} value - input value +* @throws {TypeError} must be a valid method +* @returns {void} +*/ +function set( value ) { + if ( !isString( value ) ) { + throw new TypeError( format( 'invalid assignment. `%s` must be a string. Value: `%s`.', 'title', value ) ); + } + if ( value !== this[ prop.private ] ) { + debug( 'Current value: %s. New value: %s.', JSON.stringify( this[ prop.private ] ), JSON.stringify( value ) ); + this[ prop.private ] = value; + this.emit( 'change', changeEvent( prop.name ) ); + } +} + + +// EXPORTS // + +module.exports = set; diff --git a/lib/node_modules/@stdlib/plot/vega/mark/clip/package.json b/lib/node_modules/@stdlib/plot/vega/mark/clip/package.json new file mode 100644 index 000000000000..068c312f60a7 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/mark/clip/package.json @@ -0,0 +1,60 @@ +{ + "name": "@stdlib/plot/vega/mark/clip", + "version": "0.0.0", + "description": "Clip 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", + "clip", + "constructor", + "ctor" + ], + "__stdlib__": {} +}