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

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions lib/node_modules/@stdlib/plot/vega/mark/clip/examples/index.js
Original file line number Diff line number Diff line change
@@ -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() );
41 changes: 41 additions & 0 deletions lib/node_modules/@stdlib/plot/vega/mark/clip/lib/change_event.js
Original file line number Diff line number Diff line change
@@ -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;
40 changes: 40 additions & 0 deletions lib/node_modules/@stdlib/plot/vega/mark/clip/lib/index.js
Original file line number Diff line number Diff line change
@@ -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 <Clip>
*/

// MODULES //

var main = require( './main.js' );


// EXPORTS //

module.exports = main;
199 changes: 199 additions & 0 deletions lib/node_modules/@stdlib/plot/vega/mark/clip/lib/main.js
Original file line number Diff line number Diff line change
@@ -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 <Clip>
*/
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

Check warning on line 101 in lib/node_modules/@stdlib/plot/vega/mark/clip/lib/main.js

View workflow job for this annotation

GitHub Actions / Lint Changed Files

Unexpected 'fixme' comment: 'FIXME: retain thrown error type'
throw new Error( transformErrorMessage( err.message ) );
}
}
}
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<string>}
*
* @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;
43 changes: 43 additions & 0 deletions lib/node_modules/@stdlib/plot/vega/mark/clip/lib/path/get.js
Original file line number Diff line number Diff line change
@@ -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;
Original file line number Diff line number Diff line change
@@ -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;
Loading
Loading