Skip to content

Commit 7ab078a

Browse files
committed
feat: add stubs for remaining properties
--- 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: na - task: lint_typescript_tests status: na - task: lint_license_headers status: passed ---
1 parent 3e2dfaf commit 7ab078a

File tree

17 files changed

+978
-0
lines changed

17 files changed

+978
-0
lines changed
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
/**
2+
* @license Apache-2.0
3+
*
4+
* Copyright (c) 2025 The Stdlib Authors.
5+
*
6+
* Licensed under the Apache License, Version 2.0 (the "License");
7+
* you may not use this file except in compliance with the License.
8+
* You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing, software
13+
* distributed under the License is distributed on an "AS IS" BASIS,
14+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
* See the License for the specific language governing permissions and
16+
* limitations under the License.
17+
*/
18+
19+
/* eslint-disable no-invalid-this */
20+
21+
'use strict';
22+
23+
// MAIN //
24+
25+
/**
26+
* Returns the visualization theme.
27+
*
28+
* @private
29+
* @returns {(Config|void)} theme
30+
*/
31+
function get() {
32+
return this._config;
33+
}
34+
35+
36+
// EXPORTS //
37+
38+
module.exports = get;
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
/**
2+
* @license Apache-2.0
3+
*
4+
* Copyright (c) 2025 The Stdlib Authors.
5+
*
6+
* Licensed under the Apache License, Version 2.0 (the "License");
7+
* you may not use this file except in compliance with the License.
8+
* You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing, software
13+
* distributed under the License is distributed on an "AS IS" BASIS,
14+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
* See the License for the specific language governing permissions and
16+
* limitations under the License.
17+
*/
18+
19+
/* eslint-disable no-invalid-this */
20+
21+
'use strict';
22+
23+
// MODULES //
24+
25+
var logger = require( 'debug' );
26+
var isUndefined = require( '@stdlib/assert/is-undefined' );
27+
var isObject = require( '@stdlib/assert/is-object' );
28+
var format = require( '@stdlib/string/format' );
29+
30+
31+
// VARIABLES //
32+
33+
var debug = logger( 'vega:visualization:set:config' );
34+
35+
36+
// MAIN //
37+
38+
/**
39+
* Sets the visualization theme.
40+
*
41+
* ## Notes
42+
*
43+
* - Providing `undefined` "unsets" the configured value.
44+
*
45+
* @private
46+
* @param {(Config|void)} value - input value
47+
* @throws {TypeError} must be a configuration instance
48+
* @returns {void}
49+
*/
50+
function set( value ) {
51+
if ( !isObject( value ) && !isUndefined( value ) ) { // FIXME: validate configuration instance
52+
throw new TypeError( format( 'invalid assignment. `%s` must be a configuration instance. Value: `%s`.', 'config', value ) );
53+
}
54+
if ( value !== this._config ) {
55+
if ( this._config ) {
56+
this._removeChangeListener( this._config );
57+
}
58+
debug( 'Current value: %s. New value: %s.', JSON.stringify( this._config ), JSON.stringify( value ) );
59+
this._config = value;
60+
this.emit( 'change' );
61+
if ( this._config ) {
62+
this._addChangeListener( this._config );
63+
}
64+
}
65+
}
66+
67+
68+
// EXPORTS //
69+
70+
module.exports = set;
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
/**
2+
* @license Apache-2.0
3+
*
4+
* Copyright (c) 2025 The Stdlib Authors.
5+
*
6+
* Licensed under the Apache License, Version 2.0 (the "License");
7+
* you may not use this file except in compliance with the License.
8+
* You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing, software
13+
* distributed under the License is distributed on an "AS IS" BASIS,
14+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
* See the License for the specific language governing permissions and
16+
* limitations under the License.
17+
*/
18+
19+
/* eslint-disable no-invalid-this */
20+
21+
'use strict';
22+
23+
// MODULES //
24+
25+
var copy = require( '@stdlib/array/base/copy-indexed' );
26+
27+
28+
// MAIN //
29+
30+
// eslint-disable-next-line stdlib/jsdoc-typedef-typos
31+
/**
32+
* Returns a list of data set definitions and transforms.
33+
*
34+
* @private
35+
* @returns {Array<Data>} data set definitions and transforms
36+
*/
37+
function get() {
38+
return copy( this._data );
39+
}
40+
41+
42+
// EXPORTS //
43+
44+
module.exports = get;
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
/**
2+
* @license Apache-2.0
3+
*
4+
* Copyright (c) 2025 The Stdlib Authors.
5+
*
6+
* Licensed under the Apache License, Version 2.0 (the "License");
7+
* you may not use this file except in compliance with the License.
8+
* You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing, software
13+
* distributed under the License is distributed on an "AS IS" BASIS,
14+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
* See the License for the specific language governing permissions and
16+
* limitations under the License.
17+
*/
18+
19+
/* eslint-disable no-invalid-this */
20+
21+
'use strict';
22+
23+
// MODULES //
24+
25+
var logger = require( 'debug' );
26+
var isArrayLikeObject = require( '@stdlib/assert/is-array-like-object' );
27+
var hasEqualValues = require( '@stdlib/array/base/assert/has-equal-values' );
28+
var copy = require( '@stdlib/array/base/copy' );
29+
var format = require( '@stdlib/string/format' );
30+
31+
32+
// VARIABLES //
33+
34+
var debug = logger( 'vega:visualization:set:data' );
35+
36+
37+
// MAIN //
38+
39+
// eslint-disable-next-line stdlib/jsdoc-typedef-typos
40+
/**
41+
* Sets data set definitions and transforms.
42+
*
43+
* @private
44+
* @param {ArrayLikeObject<Data>} value - input value
45+
* @throws {TypeError} must be an array of data
46+
* @returns {void}
47+
*/
48+
function set( value ) {
49+
if ( !isArrayLikeObject( value ) ) { // FIXME: validate array of data or an empty array
50+
throw new TypeError( format( 'invalid assignment. `%s` must be an array of data. Value: `%s`.', 'data', value ) );
51+
}
52+
value = copy( value );
53+
if ( !hasEqualValues( value, this._data ) ) {
54+
this._removeChangeListeners( this._data );
55+
debug( 'Current value: %s. New value: %s.', JSON.stringify( this._data ), JSON.stringify( value ) );
56+
this._data = value;
57+
this.emit( 'change' );
58+
this._addChangeListeners( this._data );
59+
}
60+
}
61+
62+
63+
// EXPORTS //
64+
65+
module.exports = set;
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
/**
2+
* @license Apache-2.0
3+
*
4+
* Copyright (c) 2025 The Stdlib Authors.
5+
*
6+
* Licensed under the Apache License, Version 2.0 (the "License");
7+
* you may not use this file except in compliance with the License.
8+
* You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing, software
13+
* distributed under the License is distributed on an "AS IS" BASIS,
14+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
* See the License for the specific language governing permissions and
16+
* limitations under the License.
17+
*/
18+
19+
/* eslint-disable no-invalid-this */
20+
21+
'use strict';
22+
23+
// MAIN //
24+
25+
/**
26+
* Returns encoding directives for the visual properties of the top-level group mark representing a visualization's data rectangle.
27+
*
28+
* @private
29+
* @returns {(Encode|void)} encoding directives
30+
*/
31+
function get() {
32+
return this._encode;
33+
}
34+
35+
36+
// EXPORTS //
37+
38+
module.exports = get;
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
/**
2+
* @license Apache-2.0
3+
*
4+
* Copyright (c) 2025 The Stdlib Authors.
5+
*
6+
* Licensed under the Apache License, Version 2.0 (the "License");
7+
* you may not use this file except in compliance with the License.
8+
* You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing, software
13+
* distributed under the License is distributed on an "AS IS" BASIS,
14+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
* See the License for the specific language governing permissions and
16+
* limitations under the License.
17+
*/
18+
19+
/* eslint-disable no-invalid-this */
20+
21+
'use strict';
22+
23+
// MODULES //
24+
25+
var logger = require( 'debug' );
26+
var isUndefined = require( '@stdlib/assert/is-undefined' );
27+
var isObject = require( '@stdlib/assert/is-object' );
28+
var format = require( '@stdlib/string/format' );
29+
30+
31+
// VARIABLES //
32+
33+
var debug = logger( 'vega:visualization:set:encode' );
34+
35+
36+
// MAIN //
37+
38+
/**
39+
* Sets encoding directives for the visual properties of the top-level group mark representing a visualization's data rectangle.
40+
*
41+
* ## Notes
42+
*
43+
* - Providing `undefined` "unsets" the configured value.
44+
*
45+
* @private
46+
* @param {(Encode|void)} value - input value
47+
* @throws {TypeError} must be an encoding object
48+
* @returns {void}
49+
*/
50+
function set( value ) {
51+
if ( !isObject( value ) && !isUndefined( value ) ) { // FIXME: validate encoding object
52+
throw new TypeError( format( 'invalid assignment. `%s` must be a valid encoding. Value: `%s`.', 'encode', value ) );
53+
}
54+
if ( value !== this._encode ) {
55+
if ( this._encode ) {
56+
this._removeChangeListener( this._encode );
57+
}
58+
debug( 'Current value: %s. New value: %s.', JSON.stringify( this._encode ), JSON.stringify( value ) );
59+
this._encode = value;
60+
this.emit( 'change' );
61+
if ( this._encode ) {
62+
this._addChangeListener( this._encode );
63+
}
64+
}
65+
}
66+
67+
68+
// EXPORTS //
69+
70+
module.exports = set;
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
/**
2+
* @license Apache-2.0
3+
*
4+
* Copyright (c) 2025 The Stdlib Authors.
5+
*
6+
* Licensed under the Apache License, Version 2.0 (the "License");
7+
* you may not use this file except in compliance with the License.
8+
* You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing, software
13+
* distributed under the License is distributed on an "AS IS" BASIS,
14+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
* See the License for the specific language governing permissions and
16+
* limitations under the License.
17+
*/
18+
19+
/* eslint-disable no-invalid-this */
20+
21+
'use strict';
22+
23+
// MODULES //
24+
25+
var copy = require( '@stdlib/array/base/copy-indexed' );
26+
27+
28+
// MAIN //
29+
30+
/**
31+
* Returns a list of legends.
32+
*
33+
* @private
34+
* @returns {Array<Legend>} legends
35+
*/
36+
function get() {
37+
return copy( this._legends );
38+
}
39+
40+
41+
// EXPORTS //
42+
43+
module.exports = get;

0 commit comments

Comments
 (0)