Skip to content

Commit 1ea66bd

Browse files
committed
feat: add frame, limit, lineHeight, offset, and zindex support
--- 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 7536a5e commit 1ea66bd

File tree

11 files changed

+608
-0
lines changed

11 files changed

+608
-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 reference frame for the anchor position.
27+
*
28+
* @private
29+
* @returns {string} reference frame
30+
*/
31+
function get() {
32+
return this._frame;
33+
}
34+
35+
36+
// EXPORTS //
37+
38+
module.exports = get;
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
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 isAnchorReferenceFrame = require( '@stdlib/plot/vega/base/assert/is-anchor-reference-frame' );
27+
var join = require( '@stdlib/array/base/join' );
28+
var anchorReferenceFrames = require( '@stdlib/plot/vega/anchor-reference-frames' );
29+
var format = require( '@stdlib/string/format' );
30+
31+
32+
// VARIABLES //
33+
34+
var debug = logger( 'vega:title:set:frame' );
35+
36+
37+
// MAIN //
38+
39+
/**
40+
* Sets the the reference frame for the anchor position.
41+
*
42+
* @private
43+
* @param {string} value - input value
44+
* @throws {TypeError} must be a valid reference frame
45+
* @returns {void}
46+
*/
47+
function set( value ) {
48+
if ( !isAnchorReferenceFrame( value ) ) {
49+
throw new TypeError( format( 'invalid assignment. `%s` must be one of the following: "%s". Value: `%s`.', 'frame', join( anchorReferenceFrames(), '", "' ), value ) );
50+
}
51+
if ( value !== this._frame ) {
52+
debug( 'Current value: %s. New value: %s.', this._frame, value );
53+
this._frame = value;
54+
this.emit( 'change' );
55+
}
56+
}
57+
58+
59+
// EXPORTS //
60+
61+
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 the maximum allowed length (in pixels) of title and subtitle text.
27+
*
28+
* @private
29+
* @returns {(number|void)} maximum allowed length
30+
*/
31+
function get() {
32+
return this._limit;
33+
}
34+
35+
36+
// EXPORTS //
37+
38+
module.exports = get;
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
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 isNumber = require( '@stdlib/assert/is-number' ).isPrimitive;
27+
var isUndefined = require( '@stdlib/assert/is-undefined' );
28+
var format = require( '@stdlib/string/format' );
29+
30+
31+
// VARIABLES //
32+
33+
var debug = logger( 'vega:title:set:limit' );
34+
35+
36+
// MAIN //
37+
38+
/**
39+
* Sets the maximum allowed length (in pixels) of title and subtitle text.
40+
*
41+
* ## Notes
42+
*
43+
* - Providing `undefined` "unsets" the configured value.
44+
*
45+
* @private
46+
* @param {(number|void)} value - input value
47+
* @throws {TypeError} must be a number
48+
* @returns {void}
49+
*/
50+
function set( value ) {
51+
if ( !isNumber( value ) && !isUndefined( value ) ) {
52+
throw new TypeError( format( 'invalid assignment. `%s` must be a number. Value: `%s`.', 'limit', value ) );
53+
}
54+
if ( value !== this._limit ) {
55+
debug( 'Current value: %s. New value: %s.', this._limit, value );
56+
this._limit = value;
57+
this.emit( 'change' );
58+
}
59+
}
60+
61+
62+
// EXPORTS //
63+
64+
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 the line height (in pixels) for multi-line title text.
27+
*
28+
* @private
29+
* @returns {(number|void)} line height
30+
*/
31+
function get() {
32+
return this._lineHeight;
33+
}
34+
35+
36+
// EXPORTS //
37+
38+
module.exports = get;
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
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 isNumber = require( '@stdlib/assert/is-number' ).isPrimitive;
27+
var isUndefined = require( '@stdlib/assert/is-undefined' );
28+
var format = require( '@stdlib/string/format' );
29+
30+
31+
// VARIABLES //
32+
33+
var debug = logger( 'vega:title:set:lineHeight' );
34+
35+
36+
// MAIN //
37+
38+
/**
39+
* Sets the line height (in pixels) of multi-line title text.
40+
*
41+
* ## Notes
42+
*
43+
* - Providing `undefined` "unsets" the configured value.
44+
*
45+
* @private
46+
* @param {(number|void)} value - input value
47+
* @throws {TypeError} must be a number
48+
* @returns {void}
49+
*/
50+
function set( value ) {
51+
if ( !isNumber( value ) && !isUndefined( value ) ) {
52+
throw new TypeError( format( 'invalid assignment. `%s` must be a number. Value: `%s`.', 'lineHeight', value ) );
53+
}
54+
if ( value !== this._lineHeight ) {
55+
debug( 'Current value: %s. New value: %s.', this._lineHeight, value );
56+
this._lineHeight = value;
57+
this.emit( 'change' );
58+
}
59+
}
60+
61+
62+
// EXPORTS //
63+
64+
module.exports = set;

0 commit comments

Comments
 (0)