Skip to content
Merged
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
/**
* @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 Value = require( '@stdlib/plot/vega/value/ctor' );
var RuleEncodingSet = require( '@stdlib/plot/vega/mark/rule/encoding-set' );
var RuleEncoding = require( '@stdlib/plot/vega/mark/rule/encoding' );
var RuleMark = require( './../lib' );

var mark = new RuleMark({
'encode': new RuleEncoding({
'enter': new RuleEncodingSet({
'stroke': new Value({
'value': '#000'
})
}),
'update': new RuleEncodingSet({
'stroke': new Value({
'value': 'steelblue'
})
}),
'exit': new RuleEncodingSet({
'stroke': new Value({
'value': '#fff'
})
})
})
});
console.log( mark.toJSON() );
Original file line number Diff line number Diff line change
@@ -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;
51 changes: 51 additions & 0 deletions lib/node_modules/@stdlib/plot/vega/mark/rule/ctor/lib/defaults.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
/**
* @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 RuleEncoding = require( '@stdlib/plot/vega/mark/rule/encoding' );


// MAIN //

/**
* Returns defaults.
*
* @private
* @returns {Object} default options
*
* @example
* var o = defaults();
* // returns {...}
*/
function defaults() {
return {
// Visual encoding rules for rule mark properties:
'encode': new RuleEncoding(),

// Mark type:
'type': 'rule'
};
}


// EXPORTS //

module.exports = defaults;
Original file line number Diff line number Diff line change
@@ -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' );

Check warning on line 25 in lib/node_modules/@stdlib/plot/vega/mark/rule/ctor/lib/encode/get.js

View workflow job for this annotation

GitHub Actions / Lint Changed Files

only the `private` property of the required module is used; require the property directly


// MAIN //

/**
* Returns the set of visual encoding rules for rule mark properties.
*
* @private
* @returns {(RuleEncoding|void)} encodings
*/
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) 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( 'encode' );


// EXPORTS //

module.exports = obj;
Original file line number Diff line number Diff line change
@@ -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 isRuleMarkEncoding = require( '@stdlib/plot/vega/base/assert/is-rule-mark-encoding' );
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:mark:rule:set:'+prop.name );


// MAIN //

/**
* Sets the visual encoding rules for rule mark properties.
*
* ## Notes
*
* - Providing `undefined` "unsets" the configured value.

Check warning on line 45 in lib/node_modules/@stdlib/plot/vega/mark/rule/ctor/lib/encode/set.js

View workflow job for this annotation

GitHub Actions / Lint Changed Files

Unknown word: "unsets"
*
* @private
* @param {(Encoding|void)} value - input value
* @throws {TypeError} must be a rule mark encoding instance
* @returns {void}
*/
function set( value ) {
if ( !isRuleMarkEncoding( value ) && !isUndefined( value ) ) {
throw new TypeError( format( 'invalid assignment. `%s` must be a rule mark encoding instance. Value: `%s`.', prop.name, 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;
40 changes: 40 additions & 0 deletions lib/node_modules/@stdlib/plot/vega/mark/rule/ctor/lib/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
/**
* @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';

/**
* Rule mark constructor.
*
* @module @stdlib/plot/vega/mark/rule/ctor
*
* @example
* var RuleMark = require( '@stdlib/plot/vega/mark/rule/ctor' );
*
* var mark = new RuleMark();
* // returns <RuleMark>
*/

// MODULES //

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


// EXPORTS //

module.exports = main;
Loading
Loading