Skip to content

Commit 04656cd

Browse files
committed
feat: add $schema property
--- 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 7ab078a commit 04656cd

File tree

5 files changed

+60
-3
lines changed

5 files changed

+60
-3
lines changed

lib/node_modules/@stdlib/plot/vega/visualization/lib/defaults.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,9 @@
3232
*/
3333
function defaults() {
3434
return {
35+
// Schema URL:
36+
'$schema': 'https://vega.github.io/schema/vega/v6.json',
37+
3538
// Coordinate axes:
3639
'axes': [],
3740

lib/node_modules/@stdlib/plot/vega/visualization/lib/main.js

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ var logger = require( 'debug' );
2727
var isPlainObject = require( '@stdlib/assert/is-plain-object' );
2828
var setReadOnly = require( '@stdlib/utils/define-nonenumerable-read-only-property' );
2929
var setReadWriteAccessor = require( '@stdlib/utils/define-read-write-accessor' );
30+
var setReadOnlyAccessor = require( '@stdlib/utils/define-read-only-accessor' );
3031
var hasProp = require( '@stdlib/assert/has-property' );
3132
var inherit = require( '@stdlib/utils/inherit' );
3233
var objectKeys = require( '@stdlib/utils/keys' );
@@ -69,6 +70,7 @@ var setProjections = require( './projections/set.js' );
6970

7071
var getScales = require( './scales/get.js' );
7172
var setScales = require( './scales/set.js' );
73+
var getSchema = require( './schema/get.js' );
7274
var getSignals = require( './signals/get.js' );
7375
var setSignals = require( './signals/set.js' );
7476

@@ -278,6 +280,21 @@ setReadOnly( Visualization.prototype, '_removeChangeListeners', function removeC
278280
return this;
279281
});
280282

283+
/**
284+
* Visualization schema URL.
285+
*
286+
* @name $schema
287+
* @memberof Visualization.prototype
288+
* @type {string}
289+
*
290+
* @example
291+
* var viz = new Visualization();
292+
*
293+
* var v = viz.$schema;
294+
* // returns '...'
295+
*/
296+
setReadOnlyAccessor( Visualization.prototype, '$schema', getSchema );
297+
281298
/**
282299
* Visualization autosize configuration.
283300
*

lib/node_modules/@stdlib/plot/vega/visualization/lib/properties.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
[
2+
"$schema",
23
"autosize",
34
"axes",
45
"background",
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 configuration schema URL.
27+
*
28+
* @private
29+
* @returns {string} schema URL
30+
*/
31+
function get() {
32+
return this._$schema;
33+
}
34+
35+
36+
// EXPORTS //
37+
38+
module.exports = get;

lib/node_modules/@stdlib/plot/vega/visualization/lib/to_json.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,7 @@ function toJSON() {
4444
var i;
4545
var j;
4646

47-
out = {
48-
'$schema': 'https://vega.github.io/schema/vega/v6.json'
49-
};
47+
out = {};
5048

5149
// Copy property values over to the output object...
5250
for ( i = 0; i < PROPERTIES.length; i++ ) {

0 commit comments

Comments
 (0)