diff --git a/lib/node_modules/@stdlib/plot/vega/layout/ctor/examples/index.js b/lib/node_modules/@stdlib/plot/vega/layout/ctor/examples/index.js new file mode 100644 index 000000000000..6b8641b0fe34 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/layout/ctor/examples/index.js @@ -0,0 +1,27 @@ +/** +* @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 Layout = require( './../lib' ); + +var layout = new Layout({ + 'columns': 2 +}); + +console.log( layout.toJSON() ); diff --git a/lib/node_modules/@stdlib/plot/vega/layout/ctor/lib/align/get.js b/lib/node_modules/@stdlib/plot/vega/layout/ctor/lib/align/get.js new file mode 100644 index 000000000000..68158dfd2310 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/layout/ctor/lib/align/get.js @@ -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' ); + + +// MAIN // + +/** +* Returns the grid alignment. +* +* @private +* @returns {(string|Object)} grid alignment +*/ +function get() { + return this[ prop.private ]; +} + + +// EXPORTS // + +module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/vega/layout/ctor/lib/align/properties.js b/lib/node_modules/@stdlib/plot/vega/layout/ctor/lib/align/properties.js new file mode 100644 index 000000000000..d8b59b16570b --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/layout/ctor/lib/align/properties.js @@ -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( 'align' ); + + +// EXPORTS // + +module.exports = obj; diff --git a/lib/node_modules/@stdlib/plot/vega/layout/ctor/lib/align/set.js b/lib/node_modules/@stdlib/plot/vega/layout/ctor/lib/align/set.js new file mode 100644 index 000000000000..11b40788252f --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/layout/ctor/lib/align/set.js @@ -0,0 +1,64 @@ +/** +* @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 isGridAlignment = require( '@stdlib/plot/vega/base/assert/is-grid-alignment' ); +var isObject = require( '@stdlib/assert/is-object' ); +var join = require( '@stdlib/array/base/join' ); +var gridAlignments = require( '@stdlib/plot/vega/base/grid-alignments' ); +var format = require( '@stdlib/string/format' ); +var changeEvent = require( './../change_event.js' ); +var prop = require( './properties.js' ); + + +// VARIABLES // + +var debug = logger( 'vega:layout:set:'+prop.name ); + + +// MAIN // + +/** +* Sets the grid alignment to apply to rows and columns. +* +* @private +* @param {(string|Object)} value - input value +* @throws {TypeError} must be a grid alignment or an object +* @returns {void} +*/ +function set( value ) { + if ( !isGridAlignment( value ) && !isObject( value ) ) { + throw new TypeError( format( 'invalid assignment. `%s` must be one of the following: "%s", or an object. Value: `%s`.', prop.name, join( gridAlignments(), '", "' ), 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; diff --git a/lib/node_modules/@stdlib/plot/vega/layout/ctor/lib/bounds/get.js b/lib/node_modules/@stdlib/plot/vega/layout/ctor/lib/bounds/get.js new file mode 100644 index 000000000000..0a7e4fd8996e --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/layout/ctor/lib/bounds/get.js @@ -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' ); + + +// MAIN // + +/** +* Returns the bounds calculation method. +* +* @private +* @returns {string} bounds calculation method +*/ +function get() { + return this[ prop.private ]; +} + + +// EXPORTS // + +module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/vega/layout/ctor/lib/bounds/properties.js b/lib/node_modules/@stdlib/plot/vega/layout/ctor/lib/bounds/properties.js new file mode 100644 index 000000000000..3e4b4f1c23ae --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/layout/ctor/lib/bounds/properties.js @@ -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( 'bounds' ); + + +// EXPORTS // + +module.exports = obj; diff --git a/lib/node_modules/@stdlib/plot/vega/layout/ctor/lib/bounds/set.js b/lib/node_modules/@stdlib/plot/vega/layout/ctor/lib/bounds/set.js new file mode 100644 index 000000000000..89950449b1ae --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/layout/ctor/lib/bounds/set.js @@ -0,0 +1,63 @@ +/** +* @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 isLayoutBound = require( '@stdlib/plot/vega/base/assert/is-layout-bound' ); +var join = require( '@stdlib/array/base/join' ); +var layoutBounds = require( '@stdlib/plot/vega/layout/bounds' ); +var format = require( '@stdlib/string/format' ); +var changeEvent = require( './../change_event.js' ); +var prop = require( './properties.js' ); + + +// VARIABLES // + +var debug = logger( 'vega:layout:set:'+prop.name ); + + +// MAIN // + +/** +* Sets the bounds calculation method to use for determining the extent of a sub-plot. +* +* @private +* @param {string} value - input value +* @throws {TypeError} must be a supported bounds calculation method +* @returns {void} +*/ +function set( value ) { + if ( !isLayoutBound( value ) ) { + throw new TypeError( format( 'invalid assignment. `%s` must be one of the following: "%s". Value: `%s`.', prop.name, join( layoutBounds(), '", "' ), value ) ); + } + if ( value !== this[ prop.private ] ) { + debug( 'Current value: %s. New value: %s.', this[ prop.private ], value ); + this[ prop.private ] = value; + this.emit( 'change', changeEvent( prop.name ) ); + } +} + + +// EXPORTS // + +module.exports = set; diff --git a/lib/node_modules/@stdlib/plot/vega/layout/ctor/lib/center/get.js b/lib/node_modules/@stdlib/plot/vega/layout/ctor/lib/center/get.js new file mode 100644 index 000000000000..188d68c073d1 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/layout/ctor/lib/center/get.js @@ -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' ); + + +// MAIN // + +/** +* Returns the flag indicating whether to center child elements. +* +* @private +* @returns {(boolean|Object)} flag indicating whether to center child elements +*/ +function get() { + return this[ prop.private ]; +} + + +// EXPORTS // + +module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/vega/layout/ctor/lib/center/properties.js b/lib/node_modules/@stdlib/plot/vega/layout/ctor/lib/center/properties.js new file mode 100644 index 000000000000..a6564ba4b230 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/layout/ctor/lib/center/properties.js @@ -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( 'center' ); + + +// EXPORTS // + +module.exports = obj; diff --git a/lib/node_modules/@stdlib/plot/vega/layout/ctor/lib/center/set.js b/lib/node_modules/@stdlib/plot/vega/layout/ctor/lib/center/set.js new file mode 100644 index 000000000000..67499bc0cd30 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/layout/ctor/lib/center/set.js @@ -0,0 +1,62 @@ +/** +* @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 isBoolean = require( '@stdlib/assert/is-boolean' ).isPrimitive; +var isObject = require( '@stdlib/assert/is-object' ); +var format = require( '@stdlib/string/format' ); +var changeEvent = require( './../change_event.js' ); +var prop = require( './properties.js' ); + + +// VARIABLES // + +var debug = logger( 'vega:layout:set:'+prop.name ); + + +// MAIN // + +/** +* Sets a boolean flag (or row/column object) indicating whether to center child elements within their respective rows and columns. +* +* @private +* @param {(boolean|Object)} value - input value +* @throws {TypeError} must be a boolean or an object +* @returns {void} +*/ +function set( value ) { + if ( !isBoolean( value ) && !isObject( value ) ) { + throw new TypeError( format( 'invalid assignment. `%s` must be a boolean or an object. 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; diff --git a/lib/node_modules/@stdlib/plot/vega/layout/ctor/lib/change_event.js b/lib/node_modules/@stdlib/plot/vega/layout/ctor/lib/change_event.js new file mode 100644 index 000000000000..a06740194846 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/layout/ctor/lib/change_event.js @@ -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': 'layout', + 'property': property + }; +} + + +// EXPORTS // + +module.exports = event; diff --git a/lib/node_modules/@stdlib/plot/vega/layout/ctor/lib/columns/get.js b/lib/node_modules/@stdlib/plot/vega/layout/ctor/lib/columns/get.js new file mode 100644 index 000000000000..1b168df12524 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/layout/ctor/lib/columns/get.js @@ -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' ); + + +// MAIN // + +/** +* Returns the number of columns. +* +* @private +* @returns {(number|void)} number of columns +*/ +function get() { + return this[ prop.private ]; +} + + +// EXPORTS // + +module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/vega/layout/ctor/lib/columns/properties.js b/lib/node_modules/@stdlib/plot/vega/layout/ctor/lib/columns/properties.js new file mode 100644 index 000000000000..5b18349782bf --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/layout/ctor/lib/columns/properties.js @@ -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( 'columns' ); + + +// EXPORTS // + +module.exports = obj; diff --git a/lib/node_modules/@stdlib/plot/vega/layout/ctor/lib/columns/set.js b/lib/node_modules/@stdlib/plot/vega/layout/ctor/lib/columns/set.js new file mode 100644 index 000000000000..a2ca76e91ded --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/layout/ctor/lib/columns/set.js @@ -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 isNonNegativeNumber = require( '@stdlib/assert/is-nonnegative-number' ).isPrimitive; +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:layout:set:'+prop.name ); + + +// MAIN // + +/** +* Sets the number of columns to include in the grid layout. +* +* ## Notes +* +* - Providing `undefined` "unsets" the configured value. +* +* @private +* @param {(NonNegativeNumber|void)} value - input value +* @throws {TypeError} must be a nonnegative number +* @returns {void} +*/ +function set( value ) { + if ( !isNonNegativeNumber( value ) && !isUndefined( value ) ) { + throw new TypeError( format( 'invalid assignment. `%s` must be a nonnegative number. Value: `%s`.', prop.name, value ) ); + } + if ( value !== this[ prop.private ] ) { + debug( 'Current value: %s. New value: %s.', this[ prop.private ], value ); + this[ prop.private ] = value; + this.emit( 'change', changeEvent( prop.name ) ); + } +} + + +// EXPORTS // + +module.exports = set; diff --git a/lib/node_modules/@stdlib/plot/vega/layout/ctor/lib/defaults.js b/lib/node_modules/@stdlib/plot/vega/layout/ctor/lib/defaults.js new file mode 100644 index 000000000000..aef7c39130c4 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/layout/ctor/lib/defaults.js @@ -0,0 +1,64 @@ +/** +* @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 defaults. +* +* @private +* @returns {Object} default options +* +* @example +* var o = defaults(); +* // returns {...} +*/ +function defaults() { + return { + // Grid alignment to apply to rows and columns: + 'align': 'none', + + // Bounds calculation method to use for determining the extent of a sub-plot: + 'bounds': 'full', + + // Boolean flag indicating whether to center child elements within their respective rows and columns: + 'center': false, + + // Alignment of footers relative to their bands (`null` indicates positioning using the coordinate of the nearest grid content cell): + 'footerBand': null, + + // Alignment of headers relative to their bands (`null` indicates positioning using the coordinate of the nearest grid content cell): + 'headerBand': null, + + // Offset (in pixels) by which to displace header, footer, and title cells from the edges of the grid: + 'offset': 0, + + // Anchor position for placing titles relative to their bands: + 'titleAnchor': 'start', + + // Alignment of titles relative to their bands: + 'titleBand': 0.5 + }; +} + + +// EXPORTS // + +module.exports = defaults; diff --git a/lib/node_modules/@stdlib/plot/vega/layout/ctor/lib/footer-band/get.js b/lib/node_modules/@stdlib/plot/vega/layout/ctor/lib/footer-band/get.js new file mode 100644 index 000000000000..b7c7309b1f69 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/layout/ctor/lib/footer-band/get.js @@ -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' ); + + +// MAIN // + +/** +* Returns the footer band alignment. +* +* @private +* @returns {(number|Object|null)} footer band alignment +*/ +function get() { + return this[ prop.private ]; +} + + +// EXPORTS // + +module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/vega/layout/ctor/lib/footer-band/properties.js b/lib/node_modules/@stdlib/plot/vega/layout/ctor/lib/footer-band/properties.js new file mode 100644 index 000000000000..bc58648b6693 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/layout/ctor/lib/footer-band/properties.js @@ -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( 'footerBand' ); + + +// EXPORTS // + +module.exports = obj; diff --git a/lib/node_modules/@stdlib/plot/vega/layout/ctor/lib/footer-band/set.js b/lib/node_modules/@stdlib/plot/vega/layout/ctor/lib/footer-band/set.js new file mode 100644 index 000000000000..835e5f1b2201 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/layout/ctor/lib/footer-band/set.js @@ -0,0 +1,67 @@ +/** +* @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 isNonNegativeNumber = require( '@stdlib/assert/is-nonnegative-number' ).isPrimitive; +var isObject = require( '@stdlib/assert/is-object' ); +var isNull = require( '@stdlib/assert/is-null' ); +var format = require( '@stdlib/string/format' ); +var changeEvent = require( './../change_event.js' ); +var prop = require( './properties.js' ); + + +// VARIABLES // + +var debug = logger( 'vega:layout:set:'+prop.name ); + + +// MAIN // + +/** +* Sets the alignment (in the range `[0,1]`) of footers relative to their bands. +* +* ## Notes +* +* - Providing `null` positions the footer using the coordinate of the nearest grid content cell. +* +* @private +* @param {(NonNegativeNumber|Object|null)} value - input value +* @throws {TypeError} must be a nonnegative number, null, or an object +* @returns {void} +*/ +function set( value ) { + if ( !isNonNegativeNumber( value ) && !isObject( value ) && !isNull( value ) ) { + throw new TypeError( format( 'invalid assignment. `%s` must be a nonnegative number, null, or an object. 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; diff --git a/lib/node_modules/@stdlib/plot/vega/layout/ctor/lib/header-band/get.js b/lib/node_modules/@stdlib/plot/vega/layout/ctor/lib/header-band/get.js new file mode 100644 index 000000000000..e16fc0c38ad9 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/layout/ctor/lib/header-band/get.js @@ -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' ); + + +// MAIN // + +/** +* Returns the header band alignment. +* +* @private +* @returns {(number|Object|null)} header band alignment +*/ +function get() { + return this[ prop.private ]; +} + + +// EXPORTS // + +module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/vega/layout/ctor/lib/header-band/properties.js b/lib/node_modules/@stdlib/plot/vega/layout/ctor/lib/header-band/properties.js new file mode 100644 index 000000000000..0b9b080cdaa3 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/layout/ctor/lib/header-band/properties.js @@ -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( 'headerBand' ); + + +// EXPORTS // + +module.exports = obj; diff --git a/lib/node_modules/@stdlib/plot/vega/layout/ctor/lib/header-band/set.js b/lib/node_modules/@stdlib/plot/vega/layout/ctor/lib/header-band/set.js new file mode 100644 index 000000000000..5b81ec75497e --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/layout/ctor/lib/header-band/set.js @@ -0,0 +1,67 @@ +/** +* @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 isNonNegativeNumber = require( '@stdlib/assert/is-nonnegative-number' ).isPrimitive; +var isObject = require( '@stdlib/assert/is-object' ); +var isNull = require( '@stdlib/assert/is-null' ); +var format = require( '@stdlib/string/format' ); +var changeEvent = require( './../change_event.js' ); +var prop = require( './properties.js' ); + + +// VARIABLES // + +var debug = logger( 'vega:layout:set:'+prop.name ); + + +// MAIN // + +/** +* Sets the alignment (in the range `[0,1]`) of headers relative to their bands. +* +* ## Notes +* +* - Providing `null` positions the header using the coordinate of the nearest grid content cell. +* +* @private +* @param {(NonNegativeNumber|Object|null)} value - input value +* @throws {TypeError} must be a nonnegative number, null, or an object +* @returns {void} +*/ +function set( value ) { + if ( !isNonNegativeNumber( value ) && !isObject( value ) && !isNull( value ) ) { + throw new TypeError( format( 'invalid assignment. `%s` must be a nonnegative number, null, or an object. 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; diff --git a/lib/node_modules/@stdlib/plot/vega/layout/ctor/lib/index.js b/lib/node_modules/@stdlib/plot/vega/layout/ctor/lib/index.js new file mode 100644 index 000000000000..4dcbebfdad01 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/layout/ctor/lib/index.js @@ -0,0 +1,42 @@ +/** +* @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'; + +/** +* Layout constructor. +* +* @module @stdlib/plot/vega/layout/ctor +* +* @example +* var Layout = require( '@stdlib/plot/vega/layout/ctor' ); +* +* var layout = new Layout({ +* 'columns': 2 +* }); +* // returns +*/ + +// MODULES // + +var main = require( './main.js' ); + + +// EXPORTS // + +module.exports = main; diff --git a/lib/node_modules/@stdlib/plot/vega/layout/ctor/lib/main.js b/lib/node_modules/@stdlib/plot/vega/layout/ctor/lib/main.js new file mode 100644 index 000000000000..437f7a9b0ba7 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/layout/ctor/lib/main.js @@ -0,0 +1,391 @@ +/** +* @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-restricted-syntax, no-invalid-this, stdlib/no-empty-lines-between-requires */ + +'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 objectKeys = require( '@stdlib/utils/keys' ); +var transformErrorMessage = require( '@stdlib/plot/vega/base/transform-validation-message' ); +var instance2json = require( '@stdlib/plot/vega/base/to-json' ); +var format = require( '@stdlib/string/format' ); +var properties = require( './properties.json' ); +var defaults = require( './defaults.js' ); + +// Note: keep the following in alphabetical order according to the `require` path... +var getAlign = require( './align/get.js' ); +var setAlign = require( './align/set.js' ); + +var getBounds = require( './bounds/get.js' ); +var setBounds = require( './bounds/set.js' ); + +var getCenter = require( './center/get.js' ); +var setCenter = require( './center/set.js' ); +var getColumns = require( './columns/get.js' ); +var setColumns = require( './columns/set.js' ); + +var getFooterBand = require( './footer-band/get.js' ); +var setFooterBand = require( './footer-band/set.js' ); + +var getHeaderBand = require( './header-band/get.js' ); +var setHeaderBand = require( './header-band/set.js' ); + +var getOffset = require( './offset/get.js' ); +var setOffset = require( './offset/set.js' ); + +var getPadding = require( './padding/get.js' ); +var setPadding = require( './padding/set.js' ); +var getProperties = require( './properties/get.js' ); + +var getTitleAnchor = require( './title-anchor/get.js' ); +var setTitleAnchor = require( './title-anchor/set.js' ); +var getTitleBand = require( './title-band/get.js' ); +var setTitleBand = require( './title-band/set.js' ); + + +// VARIABLES // + +var debug = logger( 'vega:layout:main' ); + + +// MAIN // + +/** +* Layout constructor. +* +* @constructor +* @param {Options} [options] - constructor options +* @param {(string|Object)} [options.align] - grid alignment to apply to rows and columns +* @param {string} [options.bounds] - bounds calculation method to use for determining the extent of a sub-plot +* @param {(boolean|Object)} [options.center] - boolean flag (or row/column object) indicating whether to center child elements within their respective rows and columns +* @param {number} [options.columns] - number of columns to include in the grid layout +* @param {(number|Object|null)} [options.footerBand] - alignment of footers relative to their bands +* @param {(number|Object|null)} [options.headerBand] - alignment of headers relative to their bands +* @param {(number|Object)} [options.offset] - offset (in pixels) by which to displace header, footer, and title cells from the edges of the grid +* @param {(number|Object)} [options.padding] - padding (in pixels) between the rows and columns of the grid +* @param {(string|Object)} [options.titleAnchor] - anchor position for placing titles relative to their bands +* @param {(number|Object)} [options.titleBand] - alignment of titles relative to their bands +* @throws {TypeError} options argument must be an object +* @throws {Error} must provide valid options +* @returns {Layout} layout instance +* +* @example +* var layout = new Layout({ +* 'columns': 2 +* }); +* // returns +*/ +function Layout( options ) { + var nargs; + var opts; + var keys; + var v; + var k; + var i; + + nargs = arguments.length; + if ( !( this instanceof Layout ) ) { + if ( nargs ) { + return new Layout( options ); + } + return new Layout(); + } + EventEmitter.call( this ); + + // Resolve the default configuration: + opts = defaults(); + + // Set internal properties according to the default configuration... + keys = objectKeys( opts ); + for ( i = 0; i < keys.length; i++ ) { + k = keys[ i ]; + this[ '_'+k ] = opts[ k ]; + } + 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 + throw new Error( transformErrorMessage( err.message ) ); + } + } + } + return this; +} + +/* +* Inherit from the `EventEmitter` prototype. +*/ +inherit( Layout, EventEmitter ); + +/** +* Constructor name. +* +* @private +* @name name +* @memberof Layout +* @readonly +* @type {string} +*/ +setNonEnumerableReadOnly( Layout, 'name', 'Layout' ); + +/** +* Grid alignment to apply to rows and columns. +* +* @name align +* @memberof Layout.prototype +* @type {(string|Object)} +* @default 'none' +* +* @example +* var layout = new Layout({ +* 'align': 'each' +* }); +* +* var v = layout.align; +* // returns 'each' +*/ +setReadWriteAccessor( Layout.prototype, 'align', getAlign, setAlign ); + +/** +* Bounds calculation method to use for determining the extent of a sub-plot. +* +* @name bounds +* @memberof Layout.prototype +* @type {string} +* @default 'full' +* +* @example +* var layout = new Layout({ +* 'bounds': 'flush' +* }); +* +* var v = layout.bounds; +* // returns 'flush' +*/ +setReadWriteAccessor( Layout.prototype, 'bounds', getBounds, setBounds ); + +/** +* Boolean flag (or row/column object) indicating whether to center child elements within their respective rows and columns. +* +* @name center +* @memberof Layout.prototype +* @type {(boolean|Object)} +* @default false +* +* @example +* var layout = new Layout({ +* 'center': true +* }); +* +* var v = layout.center; +* // returns true +*/ +setReadWriteAccessor( Layout.prototype, 'center', getCenter, setCenter ); + +/** +* Number of columns to include in the grid layout. +* +* @name columns +* @memberof Layout.prototype +* @type {(number|void)} +* +* @example +* var layout = new Layout({ +* 'columns': 2 +* }); +* +* var v = layout.columns; +* // returns 2 +*/ +setReadWriteAccessor( Layout.prototype, 'columns', getColumns, setColumns ); + +/** +* Alignment (in the range `[0,1]`) of footers relative to their bands. +* +* @name footerBand +* @memberof Layout.prototype +* @type {(number|Object|null)} +* @default null +* +* @example +* var layout = new Layout({ +* 'footerBand': 0.5 +* }); +* +* var v = layout.footerBand; +* // returns 0.5 +*/ +setReadWriteAccessor( Layout.prototype, 'footerBand', getFooterBand, setFooterBand ); + +/** +* Alignment (in the range `[0,1]`) of headers relative to their bands. +* +* @name headerBand +* @memberof Layout.prototype +* @type {(number|Object|null)} +* @default null +* +* @example +* var layout = new Layout({ +* 'headerBand': 0.5 +* }); +* +* var v = layout.headerBand; +* // returns 0.5 +*/ +setReadWriteAccessor( Layout.prototype, 'headerBand', getHeaderBand, setHeaderBand ); + +/** +* Offset (in pixels) by which to displace header, footer, and title cells from the edges of the grid. +* +* @name offset +* @memberof Layout.prototype +* @type {(number|Object)} +* @default 0 +* +* @example +* var layout = new Layout({ +* 'offset': 10 +* }); +* +* var v = layout.offset; +* // returns 10 +*/ +setReadWriteAccessor( Layout.prototype, 'offset', getOffset, setOffset ); + +/** +* Padding (in pixels) between the rows and columns of the grid. +* +* @name padding +* @memberof Layout.prototype +* @type {(number|Object|void)} +* +* @example +* var layout = new Layout({ +* 'padding': 5 +* }); +* +* var v = layout.padding; +* // returns 5 +*/ +setReadWriteAccessor( Layout.prototype, 'padding', getPadding, setPadding ); + +/** +* Layout properties. +* +* @name properties +* @memberof Layout.prototype +* @type {Array} +* +* @example +* var layout = new Layout({ +* 'columns': 2 +* }); +* +* var v = layout.properties; +* // returns [...] +*/ +setNonEnumerableReadOnlyAccessor( Layout.prototype, 'properties', getProperties ); + +/** +* Anchor position for placing titles relative to their bands. +* +* @name titleAnchor +* @memberof Layout.prototype +* @type {(string|Object)} +* @default 'start' +* +* @example +* var layout = new Layout({ +* 'titleAnchor': 'end' +* }); +* +* var v = layout.titleAnchor; +* // returns 'end' +*/ +setReadWriteAccessor( Layout.prototype, 'titleAnchor', getTitleAnchor, setTitleAnchor ); + +/** +* Alignment (in the range `[0,1]`) of titles relative to their bands. +* +* @name titleBand +* @memberof Layout.prototype +* @type {(number|Object)} +* @default 0.5 +* +* @example +* var layout = new Layout({ +* 'titleBand': 0.5 +* }); +* +* var v = layout.titleBand; +* // returns 0.5 +*/ +setReadWriteAccessor( Layout.prototype, 'titleBand', getTitleBand, setTitleBand ); + +/** +* Serializes an instance to a JSON object. +* +* ## Notes +* +* - This method is implicitly invoked by `JSON.stringify`. +* +* @name toJSON +* @memberof Layout.prototype +* @type {Function} +* @returns {Object} JSON object +* +* @example +* var layout = new Layout({ +* 'columns': 2 +* }); +* +* var v = layout.toJSON(); +* // returns {...} +*/ +setNonEnumerableReadOnly( Layout.prototype, 'toJSON', function toJSON() { + return instance2json( this, properties ); +}); + + +// EXPORTS // + +module.exports = Layout; diff --git a/lib/node_modules/@stdlib/plot/vega/layout/ctor/lib/offset/get.js b/lib/node_modules/@stdlib/plot/vega/layout/ctor/lib/offset/get.js new file mode 100644 index 000000000000..1ceb07e1f0af --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/layout/ctor/lib/offset/get.js @@ -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' ); + + +// MAIN // + +/** +* Returns the offset. +* +* @private +* @returns {(number|Object)} offset +*/ +function get() { + return this[ prop.private ]; +} + + +// EXPORTS // + +module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/vega/layout/ctor/lib/offset/properties.js b/lib/node_modules/@stdlib/plot/vega/layout/ctor/lib/offset/properties.js new file mode 100644 index 000000000000..d1b5fccec871 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/layout/ctor/lib/offset/properties.js @@ -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( 'offset' ); + + +// EXPORTS // + +module.exports = obj; diff --git a/lib/node_modules/@stdlib/plot/vega/layout/ctor/lib/offset/set.js b/lib/node_modules/@stdlib/plot/vega/layout/ctor/lib/offset/set.js new file mode 100644 index 000000000000..9eaf293c785b --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/layout/ctor/lib/offset/set.js @@ -0,0 +1,62 @@ +/** +* @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 isNumber = require( '@stdlib/assert/is-number' ).isPrimitive; +var isObject = require( '@stdlib/assert/is-object' ); +var format = require( '@stdlib/string/format' ); +var changeEvent = require( './../change_event.js' ); +var prop = require( './properties.js' ); + + +// VARIABLES // + +var debug = logger( 'vega:layout:set:'+prop.name ); + + +// MAIN // + +/** +* Sets the offset (in pixels) by which to displace header, footer, and title cells from the edges of the grid. +* +* @private +* @param {(number|Object)} value - input value +* @throws {TypeError} must be a number or an object +* @returns {void} +*/ +function set( value ) { + if ( !isNumber( value ) && !isObject( value ) ) { + throw new TypeError( format( 'invalid assignment. `%s` must be a number or an object. 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; diff --git a/lib/node_modules/@stdlib/plot/vega/layout/ctor/lib/padding/get.js b/lib/node_modules/@stdlib/plot/vega/layout/ctor/lib/padding/get.js new file mode 100644 index 000000000000..57b46daab8dd --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/layout/ctor/lib/padding/get.js @@ -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' ); + + +// MAIN // + +/** +* Returns the padding. +* +* @private +* @returns {(number|Object|void)} padding +*/ +function get() { + return this[ prop.private ]; +} + + +// EXPORTS // + +module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/vega/layout/ctor/lib/padding/properties.js b/lib/node_modules/@stdlib/plot/vega/layout/ctor/lib/padding/properties.js new file mode 100644 index 000000000000..7c8d98d6884c --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/layout/ctor/lib/padding/properties.js @@ -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( 'padding' ); + + +// EXPORTS // + +module.exports = obj; diff --git a/lib/node_modules/@stdlib/plot/vega/layout/ctor/lib/padding/set.js b/lib/node_modules/@stdlib/plot/vega/layout/ctor/lib/padding/set.js new file mode 100644 index 000000000000..e8e5d1a5414f --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/layout/ctor/lib/padding/set.js @@ -0,0 +1,67 @@ +/** +* @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 isNonNegativeNumber = require( '@stdlib/assert/is-nonnegative-number' ).isPrimitive; +var isObject = require( '@stdlib/assert/is-object' ); +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:layout:set:'+prop.name ); + + +// MAIN // + +/** +* Sets the padding (in pixels) between the rows and columns of the grid. +* +* ## Notes +* +* - Providing `undefined` "unsets" the configured value. +* +* @private +* @param {(NonNegativeNumber|Object|void)} value - input value +* @throws {TypeError} must be a nonnegative number or an object +* @returns {void} +*/ +function set( value ) { + if ( !isNonNegativeNumber( value ) && !isObject( value ) && !isUndefined( value ) ) { + throw new TypeError( format( 'invalid assignment. `%s` must be a nonnegative number or an object. 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; diff --git a/lib/node_modules/@stdlib/plot/vega/layout/ctor/lib/properties.json b/lib/node_modules/@stdlib/plot/vega/layout/ctor/lib/properties.json new file mode 100644 index 000000000000..cda5ad53473b --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/layout/ctor/lib/properties.json @@ -0,0 +1,12 @@ +[ + "align", + "bounds", + "center", + "columns", + "footerBand", + "headerBand", + "offset", + "padding", + "titleAnchor", + "titleBand" +] diff --git a/lib/node_modules/@stdlib/plot/vega/layout/ctor/lib/properties/get.js b/lib/node_modules/@stdlib/plot/vega/layout/ctor/lib/properties/get.js new file mode 100644 index 000000000000..f3cbb28454ea --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/layout/ctor/lib/properties/get.js @@ -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'; + +// MODULES // + +var properties = require( './../properties.json' ); + + +// MAIN // + +/** +* Returns the list of enumerable properties. +* +* @private +* @returns {Array} properties +*/ +function get() { + return properties.slice(); +} + + +// EXPORTS // + +module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/vega/layout/ctor/lib/title-anchor/get.js b/lib/node_modules/@stdlib/plot/vega/layout/ctor/lib/title-anchor/get.js new file mode 100644 index 000000000000..a8ce42b91369 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/layout/ctor/lib/title-anchor/get.js @@ -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' ); + + +// MAIN // + +/** +* Returns the title anchor position. +* +* @private +* @returns {(string|Object)} title anchor position +*/ +function get() { + return this[ prop.private ]; +} + + +// EXPORTS // + +module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/vega/layout/ctor/lib/title-anchor/properties.js b/lib/node_modules/@stdlib/plot/vega/layout/ctor/lib/title-anchor/properties.js new file mode 100644 index 000000000000..0c5e8f5c97f8 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/layout/ctor/lib/title-anchor/properties.js @@ -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( 'titleAnchor' ); + + +// EXPORTS // + +module.exports = obj; diff --git a/lib/node_modules/@stdlib/plot/vega/layout/ctor/lib/title-anchor/set.js b/lib/node_modules/@stdlib/plot/vega/layout/ctor/lib/title-anchor/set.js new file mode 100644 index 000000000000..c10970c28e6f --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/layout/ctor/lib/title-anchor/set.js @@ -0,0 +1,64 @@ +/** +* @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 isAnchorPosition = require( '@stdlib/plot/vega/base/assert/is-anchor-position' ); +var isObject = require( '@stdlib/assert/is-object' ); +var join = require( '@stdlib/array/base/join' ); +var anchorPositions = require( '@stdlib/plot/vega/base/anchor-positions' ); +var format = require( '@stdlib/string/format' ); +var changeEvent = require( './../change_event.js' ); +var prop = require( './properties.js' ); + + +// VARIABLES // + +var debug = logger( 'vega:layout:set:'+prop.name ); + + +// MAIN // + +/** +* Sets the anchor position for placing titles relative to their bands. +* +* @private +* @param {(string|Object)} value - input value +* @throws {TypeError} must be an anchor position or an object +* @returns {void} +*/ +function set( value ) { + if ( !isAnchorPosition( value ) && !isObject( value ) ) { + throw new TypeError( format( 'invalid assignment. `%s` must be one of the following: "%s", or an object. Value: `%s`.', prop.name, join( anchorPositions(), '", "' ), 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; diff --git a/lib/node_modules/@stdlib/plot/vega/layout/ctor/lib/title-band/get.js b/lib/node_modules/@stdlib/plot/vega/layout/ctor/lib/title-band/get.js new file mode 100644 index 000000000000..4e32e9c0bd6b --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/layout/ctor/lib/title-band/get.js @@ -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' ); + + +// MAIN // + +/** +* Returns the title band alignment. +* +* @private +* @returns {(number|Object)} title band alignment +*/ +function get() { + return this[ prop.private ]; +} + + +// EXPORTS // + +module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/vega/layout/ctor/lib/title-band/properties.js b/lib/node_modules/@stdlib/plot/vega/layout/ctor/lib/title-band/properties.js new file mode 100644 index 000000000000..943925a468a9 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/layout/ctor/lib/title-band/properties.js @@ -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( 'titleBand' ); + + +// EXPORTS // + +module.exports = obj; diff --git a/lib/node_modules/@stdlib/plot/vega/layout/ctor/lib/title-band/set.js b/lib/node_modules/@stdlib/plot/vega/layout/ctor/lib/title-band/set.js new file mode 100644 index 000000000000..b70066e862ad --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/layout/ctor/lib/title-band/set.js @@ -0,0 +1,62 @@ +/** +* @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 isNonNegativeNumber = require( '@stdlib/assert/is-nonnegative-number' ).isPrimitive; +var isObject = require( '@stdlib/assert/is-object' ); +var format = require( '@stdlib/string/format' ); +var changeEvent = require( './../change_event.js' ); +var prop = require( './properties.js' ); + + +// VARIABLES // + +var debug = logger( 'vega:layout:set:'+prop.name ); + + +// MAIN // + +/** +* Sets the alignment (in the range `[0,1]`) of titles relative to their bands. +* +* @private +* @param {(NonNegativeNumber|Object)} value - input value +* @throws {TypeError} must be a nonnegative number or an object +* @returns {void} +*/ +function set( value ) { + if ( !isNonNegativeNumber( value ) && !isObject( value ) ) { + throw new TypeError( format( 'invalid assignment. `%s` must be a nonnegative number or an object. 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; diff --git a/lib/node_modules/@stdlib/plot/vega/layout/ctor/package.json b/lib/node_modules/@stdlib/plot/vega/layout/ctor/package.json new file mode 100644 index 000000000000..f9301eabb446 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/layout/ctor/package.json @@ -0,0 +1,60 @@ +{ + "name": "@stdlib/plot/vega/layout/ctor", + "version": "0.0.0", + "description": "Layout constructor.", + "license": "Apache-2.0", + "author": { + "name": "The Stdlib Authors", + "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" + }, + "contributors": [ + { + "name": "The Stdlib Authors", + "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" + } + ], + "main": "./lib", + "directories": { + "benchmark": "./benchmark", + "doc": "./docs", + "example": "./examples", + "lib": "./lib", + "test": "./test" + }, + "types": "./docs/types", + "scripts": {}, + "homepage": "https://github.com/stdlib-js/stdlib", + "repository": { + "type": "git", + "url": "git://github.com/stdlib-js/stdlib.git" + }, + "bugs": { + "url": "https://github.com/stdlib-js/stdlib/issues" + }, + "dependencies": {}, + "devDependencies": {}, + "engines": { + "node": ">=0.10.0", + "npm": ">2.7.0" + }, + "os": [ + "aix", + "darwin", + "freebsd", + "linux", + "macos", + "openbsd", + "sunos", + "win32", + "windows" + ], + "keywords": [ + "stdlib", + "plot", + "vega", + "layout", + "constructor", + "ctor" + ], + "__stdlib__": {} +}