From eb64ecc323cbaabf1a0191aea50fcb6ab65e750e Mon Sep 17 00:00:00 2001 From: gururaj1512 Date: Tue, 4 Aug 2026 15:58:49 +0530 Subject: [PATCH 01/12] docs: add figure SVGs --- 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_pkg_readmes status: na - task: lint_markdown_docs status: na - task: lint_markdown status: na - task: lint_package_json status: na - task: lint_repl_help status: na - task: lint_javascript_src status: na - 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: passed - task: lint_typescript_tests status: na - task: lint_license_headers status: passed --- --- .../@stdlib/plot/vega/padding/ctor/docs/img/figure_padding.svg | 1 + .../plot/vega/padding/ctor/docs/img/figure_padding_bottom_0.svg | 1 + .../vega/padding/ctor/docs/img/figure_padding_bottom_100.svg | 1 + .../plot/vega/padding/ctor/docs/img/figure_padding_left_0.svg | 1 + .../plot/vega/padding/ctor/docs/img/figure_padding_left_130.svg | 1 + .../plot/vega/padding/ctor/docs/img/figure_padding_right_0.svg | 1 + .../plot/vega/padding/ctor/docs/img/figure_padding_right_130.svg | 1 + .../plot/vega/padding/ctor/docs/img/figure_padding_top_0.svg | 1 + .../plot/vega/padding/ctor/docs/img/figure_padding_top_100.svg | 1 + 9 files changed, 9 insertions(+) create mode 100644 lib/node_modules/@stdlib/plot/vega/padding/ctor/docs/img/figure_padding.svg create mode 100644 lib/node_modules/@stdlib/plot/vega/padding/ctor/docs/img/figure_padding_bottom_0.svg create mode 100644 lib/node_modules/@stdlib/plot/vega/padding/ctor/docs/img/figure_padding_bottom_100.svg create mode 100644 lib/node_modules/@stdlib/plot/vega/padding/ctor/docs/img/figure_padding_left_0.svg create mode 100644 lib/node_modules/@stdlib/plot/vega/padding/ctor/docs/img/figure_padding_left_130.svg create mode 100644 lib/node_modules/@stdlib/plot/vega/padding/ctor/docs/img/figure_padding_right_0.svg create mode 100644 lib/node_modules/@stdlib/plot/vega/padding/ctor/docs/img/figure_padding_right_130.svg create mode 100644 lib/node_modules/@stdlib/plot/vega/padding/ctor/docs/img/figure_padding_top_0.svg create mode 100644 lib/node_modules/@stdlib/plot/vega/padding/ctor/docs/img/figure_padding_top_100.svg diff --git a/lib/node_modules/@stdlib/plot/vega/padding/ctor/docs/img/figure_padding.svg b/lib/node_modules/@stdlib/plot/vega/padding/ctor/docs/img/figure_padding.svg new file mode 100644 index 000000000000..a098583ae714 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/padding/ctor/docs/img/figure_padding.svg @@ -0,0 +1 @@ +left: 80pxright: 80pxtop: 80pxbottom: 80px \ No newline at end of file diff --git a/lib/node_modules/@stdlib/plot/vega/padding/ctor/docs/img/figure_padding_bottom_0.svg b/lib/node_modules/@stdlib/plot/vega/padding/ctor/docs/img/figure_padding_bottom_0.svg new file mode 100644 index 000000000000..f9b3d55bca04 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/padding/ctor/docs/img/figure_padding_bottom_0.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/lib/node_modules/@stdlib/plot/vega/padding/ctor/docs/img/figure_padding_bottom_100.svg b/lib/node_modules/@stdlib/plot/vega/padding/ctor/docs/img/figure_padding_bottom_100.svg new file mode 100644 index 000000000000..a416d238c55f --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/padding/ctor/docs/img/figure_padding_bottom_100.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/lib/node_modules/@stdlib/plot/vega/padding/ctor/docs/img/figure_padding_left_0.svg b/lib/node_modules/@stdlib/plot/vega/padding/ctor/docs/img/figure_padding_left_0.svg new file mode 100644 index 000000000000..f744392e0cee --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/padding/ctor/docs/img/figure_padding_left_0.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/lib/node_modules/@stdlib/plot/vega/padding/ctor/docs/img/figure_padding_left_130.svg b/lib/node_modules/@stdlib/plot/vega/padding/ctor/docs/img/figure_padding_left_130.svg new file mode 100644 index 000000000000..507c5c270b11 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/padding/ctor/docs/img/figure_padding_left_130.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/lib/node_modules/@stdlib/plot/vega/padding/ctor/docs/img/figure_padding_right_0.svg b/lib/node_modules/@stdlib/plot/vega/padding/ctor/docs/img/figure_padding_right_0.svg new file mode 100644 index 000000000000..edf88d3d267c --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/padding/ctor/docs/img/figure_padding_right_0.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/lib/node_modules/@stdlib/plot/vega/padding/ctor/docs/img/figure_padding_right_130.svg b/lib/node_modules/@stdlib/plot/vega/padding/ctor/docs/img/figure_padding_right_130.svg new file mode 100644 index 000000000000..402ab7ff846b --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/padding/ctor/docs/img/figure_padding_right_130.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/lib/node_modules/@stdlib/plot/vega/padding/ctor/docs/img/figure_padding_top_0.svg b/lib/node_modules/@stdlib/plot/vega/padding/ctor/docs/img/figure_padding_top_0.svg new file mode 100644 index 000000000000..b6f7610e718b --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/padding/ctor/docs/img/figure_padding_top_0.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/lib/node_modules/@stdlib/plot/vega/padding/ctor/docs/img/figure_padding_top_100.svg b/lib/node_modules/@stdlib/plot/vega/padding/ctor/docs/img/figure_padding_top_100.svg new file mode 100644 index 000000000000..2343aeb30d9b --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/padding/ctor/docs/img/figure_padding_top_100.svg @@ -0,0 +1 @@ + \ No newline at end of file From 0bdf37d78f2afccb2073b44669768f6c298e49e0 Mon Sep 17 00:00:00 2001 From: gururaj1512 Date: Tue, 4 Aug 2026 16:02:55 +0530 Subject: [PATCH 02/12] feat: add README and figure generation script for padding constructor --- 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_pkg_readmes status: passed - task: lint_markdown_docs status: na - task: lint_markdown status: na - task: lint_package_json status: na - task: lint_repl_help status: na - task: lint_javascript_src status: na - 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: passed - task: lint_typescript_tests status: na - task: lint_license_headers status: passed --- --- .../@stdlib/plot/vega/padding/ctor/README.md | 330 ++++++++++++ .../vega/padding/ctor/srv/scripts/fig_padding | 489 ++++++++++++++++++ 2 files changed, 819 insertions(+) create mode 100644 lib/node_modules/@stdlib/plot/vega/padding/ctor/README.md create mode 100644 lib/node_modules/@stdlib/plot/vega/padding/ctor/srv/scripts/fig_padding diff --git a/lib/node_modules/@stdlib/plot/vega/padding/ctor/README.md b/lib/node_modules/@stdlib/plot/vega/padding/ctor/README.md new file mode 100644 index 000000000000..b9a92558bdd9 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/padding/ctor/README.md @@ -0,0 +1,330 @@ + + +# Padding + +> [Padding][@stdlib/plot/vega/padding] constructor. + +
+ +The [padding][@stdlib/plot/vega/padding] directive defines the spacing (in pixels) around the main chart group area. It determines the gap between the boundaries of the root visualization area and the inner rendering layout. + +
+ + + +
+ +## Usage + +```javascript +var Padding = require( '@stdlib/plot/vega/padding/ctor' ); +``` + +#### Padding( \[options] ) + +Returns a `Padding` instance. + +```javascript +var padding = new Padding(); +// returns + +padding = new Padding({ + 'left': 80, + 'right': 80, + 'top': 80, + 'bottom': 80 +}); +// returns +``` + + + +
+ A visualization showing padding margins around the main chart area. +
+
+ + + +The `options` object has the following properties: + +- **bottom**: bottom padding (in pixels). Default: `0`. +- **left**: left padding (in pixels). Default: `0`. +- **right**: right padding (in pixels). Default: `0`. +- **top**: top padding (in pixels). Default: `0`. + +* * * + +### Methods + + + +#### Padding.prototype.toJSON() + +Serializes an instance to a JSON representation. + +```javascript +var padding = new Padding({ + 'left': 80, + 'right': 80, + 'top': 80, + 'bottom': 80 +}); + +var json = padding.toJSON(); +// returns { 'left': 80, 'right': 80, 'top': 80, 'bottom': 80 } +``` + +This method is implicitly invoked by `JSON.stringify`. + +* * * + +### Writable Properties + + + +#### Padding.prototype.top + +Top padding (in pixels). + +```javascript +var padding = new Padding({ + 'left': 80, + 'right': 80, + 'top': 0, + 'bottom': 80 +}); + +var v = padding.top; +// returns 0 + +padding.top = 100; + +v = padding.top; +// returns 100 +``` + + + +
+ Padding with top set to 0. +
+
+ + + + + +
+ Padding with top set to 100. +
+
+ + + + + +#### Padding.prototype.bottom + +Bottom padding (in pixels). + +```javascript +var padding = new Padding({ + 'left': 80, + 'right': 80, + 'top': 80, + 'bottom': 0 +}); + +var v = padding.bottom; +// returns 0 + +padding.bottom = 100; + +v = padding.bottom; +// returns 100 +``` + + + +
+ Padding with bottom set to 0. +
+
+ + + + + +
+ Padding with bottom set to 100. +
+
+ + + + + +#### Padding.prototype.left + +Left padding (in pixels). + +```javascript +var padding = new Padding({ + 'left': 0, + 'right': 80, + 'top': 80, + 'bottom': 80 +}); + +var v = padding.left; +// returns 0 + +padding.left = 130; + +v = padding.left; +// returns 130 +``` + + + +
+ Padding with left set to 0. +
+
+ + + + + +
+ Padding with left set to 130. +
+
+ + + + + +#### Padding.prototype.right + +Right padding (in pixels). + +```javascript +var padding = new Padding({ + 'left': 80, + 'right': 0, + 'top': 80, + 'bottom': 80 +}); + +var v = padding.right; +// returns 0 + +padding.right = 130; + +v = padding.right; +// returns 130 +``` + + + +
+ Padding with right set to 0. +
+
+ + + + + +
+ Padding with right set to 130. +
+
+ + + +* * * + +### Read-Only Properties + + + +#### Padding.prototype.properties + +An array of Padding property names. + +```javascript +var padding = new Padding(); + +var props = padding.properties; +// returns [ 'bottom', 'left', 'right', 'top' ] +``` + +
+ + + +
+ +## Examples + +```javascript +var Padding = require( '@stdlib/plot/vega/padding/ctor' ); + +var padding = new Padding(); +console.log( padding.toJSON() ); +``` + +
+ + + +
+ +
+ + + + + + + + + + diff --git a/lib/node_modules/@stdlib/plot/vega/padding/ctor/srv/scripts/fig_padding b/lib/node_modules/@stdlib/plot/vega/padding/ctor/srv/scripts/fig_padding new file mode 100644 index 000000000000..d41758f0b759 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/padding/ctor/srv/scripts/fig_padding @@ -0,0 +1,489 @@ +#!/usr/bin/env node +'use strict'; + +/* eslint-disable max-lines, stdlib/no-unnecessary-nested-functions */ + +// MODULES // + +var resolve = require( 'path' ).resolve; +var join = require( 'path' ).join; +var logger = require( 'debug' ); +var readdir = require( '@stdlib/fs/read-dir' ); +var unlink = require( '@stdlib/fs/unlink' ); +var exists = require( '@stdlib/fs/exists' ); +var renderFig = require( '@stdlib/plot/vega/base/spec2svg-file' ); + + +// VARIABLES // + +var debug = logger( 'vega:padding:figures' ); + +var IMG_DIR = resolve( __dirname, '..', '..', 'docs', 'img' ); +var SCHEMA = 'https://vega.github.io/schema/vega/v6.json'; +var OUTER_MARGIN = 15; +var OUTER_WIDTH = 600; +var OUTER_HEIGHT = 260; +var DEFAULT_PADDING = 80; +var LABEL_FONT_SIZE = 13; +var LABEL_FONT_WEIGHT = 'bold'; +var LABEL_FILL = '#555'; + +/** +* Figure configuration array. +*/ +var FIGURES = [ + { + 'name': 'figure_padding', + 'padding': { + 'left': DEFAULT_PADDING, + 'right': DEFAULT_PADDING, + 'top': DEFAULT_PADDING, + 'bottom': DEFAULT_PADDING + }, + 'marks': [ + createTextLabel( 40, 130, 'left: 80px' ), + createTextLabel( 560, 130, 'right: 80px' ), + createTextLabel( 300, 40, 'top: 80px' ), + createTextLabel( 300, 220, 'bottom: 80px' ) + ] + }, + + // top: + { + 'name': 'figure_padding_top_0', + 'padding': { + 'left': DEFAULT_PADDING, + 'right': DEFAULT_PADDING, + 'top': 0, + 'bottom': DEFAULT_PADDING + } + }, + { + 'name': 'figure_padding_top_100', + 'padding': { + 'left': DEFAULT_PADDING, + 'right': DEFAULT_PADDING, + 'top': 100, + 'bottom': DEFAULT_PADDING + } + }, + + // bottom: + { + 'name': 'figure_padding_bottom_0', + 'padding': { + 'left': DEFAULT_PADDING, + 'right': DEFAULT_PADDING, + 'top': DEFAULT_PADDING, + 'bottom': 0 + } + }, + { + 'name': 'figure_padding_bottom_100', + 'padding': { + 'left': DEFAULT_PADDING, + 'right': DEFAULT_PADDING, + 'top': DEFAULT_PADDING, + 'bottom': 100 + } + }, + + // left: + { + 'name': 'figure_padding_left_0', + 'padding': { + 'left': 0, + 'right': DEFAULT_PADDING, + 'top': DEFAULT_PADDING, + 'bottom': DEFAULT_PADDING + } + }, + { + 'name': 'figure_padding_left_130', + 'padding': { + 'left': 130, + 'right': DEFAULT_PADDING, + 'top': DEFAULT_PADDING, + 'bottom': DEFAULT_PADDING + } + }, + + // right: + { + 'name': 'figure_padding_right_0', + 'padding': { + 'left': DEFAULT_PADDING, + 'right': 0, + 'top': DEFAULT_PADDING, + 'bottom': DEFAULT_PADDING + } + }, + { + 'name': 'figure_padding_right_130', + 'padding': { + 'left': DEFAULT_PADDING, + 'right': 130, + 'top': DEFAULT_PADDING, + 'bottom': DEFAULT_PADDING + } + } +]; + + +// FUNCTIONS // + +/** +* Creates a Vega text label mark definition. +* +* @private +* @param {number} x - x-coordinate +* @param {number} y - y-coordinate +* @param {string} text - label text +* @returns {Object} Vega mark definition +*/ +function createTextLabel( x, y, text ) { + return { + 'type': 'text', + 'encode': { + 'enter': { + 'x': { + 'value': x + }, + 'y': { + 'value': y + }, + 'align': { + 'value': 'center' + }, + 'baseline': { + 'value': 'middle' + }, + 'text': { + 'value': text + }, + 'fontSize': { + 'value': LABEL_FONT_SIZE + }, + 'fontWeight': { + 'value': LABEL_FONT_WEIGHT + }, + 'fill': { + 'value': LABEL_FILL + } + } + } + }; +} + +/** +* Creates a Vega rectangle mark for the outer dotted boundary. +* +* @private +* @param {number} width - outer width +* @param {number} height - outer height +* @returns {Object} Vega mark definition +*/ +function createOuterRect( width, height ) { + return { + 'type': 'rect', + 'encode': { + 'enter': { + 'x': { + 'value': 0 + }, + 'y': { + 'value': 0 + }, + 'width': { + 'value': width + }, + 'height': { + 'value': height + }, + 'stroke': { + 'value': '#aaa' + }, + 'strokeWidth': { + 'value': 1.5 + }, + 'strokeDash': { + 'value': [ 4, 4 ] + } + } + } + }; +} + +/** +* Creates a Vega rectangle mark for the inner chart area. +* +* @private +* @param {number} x - x-coordinate +* @param {number} y - y-coordinate +* @param {number} width - width +* @param {number} height - height +* @returns {Object} Vega mark definition +*/ +function createInnerRect( x, y, width, height ) { + return { + 'type': 'rect', + 'encode': { + 'enter': { + 'x': { + 'value': x + }, + 'y': { + 'value': y + }, + 'width': { + 'value': width + }, + 'height': { + 'value': height + }, + 'fill': { + 'value': '#f5f5f5' + }, + 'stroke': { + 'value': '#666' + }, + 'strokeWidth': { + 'value': 1 + } + } + } + }; +} + +/** +* Creates a Vega specification from a figure configuration. +* +* @private +* @param {Object} config - figure configuration +* @param {Object} config.padding - padding configuration +* @param {Array} [config.marks] - additional marks +* @returns {Object} Vega specification +*/ +function createSpec( config ) { + var innerHeight; + var innerWidth; + var padding; + var marks; + var spec; + var x; + var y; + + padding = config.padding; + + // Compute inner chart area dimensions based on actual padding values: + x = padding.left; + y = padding.top; + innerWidth = OUTER_WIDTH - padding.left - padding.right; + innerHeight = OUTER_HEIGHT - padding.top - padding.bottom; + + marks = [ + createOuterRect( OUTER_WIDTH, OUTER_HEIGHT ), + createInnerRect( x, y, innerWidth, innerHeight ) + ]; + if ( config.marks ) { + marks = marks.concat( config.marks ); + } + spec = { + '$schema': SCHEMA, + 'width': OUTER_WIDTH, + 'height': OUTER_HEIGHT, + 'padding': OUTER_MARGIN, + 'background': '#ffffff', + 'marks': marks + }; + return spec; +} + +/** +* Generates all figure SVGs sequentially. +* +* @private +* @param {Array} figures - figure configuration array +* @param {Callback} clbk - callback to invoke upon completion +* @returns {void} +*/ +function generateAll( figures, clbk ) { + var idx = 0; + + next(); + + /** + * Processes the next figure in the queue. + * + * @private + * @returns {void} + */ + function next() { + var outputPath; + var config; + var spec; + + if ( idx >= figures.length ) { + return clbk( null ); + } + config = figures[ idx ]; + spec = createSpec( config ); + outputPath = join( IMG_DIR, config.name + '.svg' ); + + debug( 'Rendering: %s', config.name ); + renderFig( outputPath, spec, onDone ); + } + + /** + * Callback invoked upon completing a figure render. + * + * @private + * @param {(Error|null)} error - error object + * @returns {void} + */ + function onDone( error ) { + if ( error ) { + return clbk( error ); + } + debug( ' -> %s', join( IMG_DIR, figures[ idx ].name + '.svg' ) ); + idx += 1; + next(); + } +} + +/** +* Removes stale SVG files from a list of directory entries. +* +* @private +* @param {Array} files - directory entries +* @param {Callback} clbk - callback to invoke upon completion +* @returns {void} +*/ +function removeStaleFiles( files, clbk ) { + var idx = 0; + + next(); + + /** + * Processes the next file in the queue. + * + * @private + * @returns {void} + */ + function next() { + var valid; + var file; + var j; + + while ( idx < files.length ) { + file = files[ idx ]; + if ( file.indexOf( '.svg' ) === -1 ) { + idx += 1; + continue; + } + valid = false; + for ( j = 0; j < FIGURES.length; j++ ) { + if ( file === FIGURES[ j ].name + '.svg' ) { + valid = true; + break; + } + } + if ( !valid ) { + debug( 'Removing stale SVG: %s', file ); + unlink( join( IMG_DIR, file ), onRemove ); + return; + } + idx += 1; + } + return clbk( null ); + } + + /** + * Callback invoked upon removing a file. + * + * @private + * @param {(Error|null)} error - error object + * @returns {void} + */ + function onRemove( error ) { + if ( error ) { + return clbk( error ); + } + idx += 1; + next(); + } +} + + +// MAIN // + +/** +* Generates all padding documentation figures. +* +* @private +* @returns {void} +*/ +function main() { + exists( IMG_DIR, onExists ); + + /** + * Callback invoked upon checking directory existence. + * + * @private + * @param {boolean} bool - boolean indicating whether the path exists + * @returns {void} + */ + function onExists( bool ) { + if ( !bool ) { + return generateAll( FIGURES, onComplete ); + } + readdir( IMG_DIR, onRead ); + } + + /** + * Callback invoked upon reading directory contents. + * + * @private + * @param {(Error|null)} error - error object + * @param {Array} files - directory entries + * @returns {void} + */ + function onRead( error, files ) { + if ( error ) { + return onComplete( error ); + } + removeStaleFiles( files, onClean ); + } + + /** + * Callback invoked upon completing stale file cleanup. + * + * @private + * @param {(Error|null)} error - error object + * @returns {void} + */ + function onClean( error ) { + if ( error ) { + return onComplete( error ); + } + generateAll( FIGURES, onComplete ); + } + + /** + * Callback invoked upon completing all figure generation. + * + * @private + * @param {(Error|null)} error - error object + * @returns {void} + */ + function onComplete( error ) { + if ( error ) { + console.error( 'Error generating figures: %s', error.message ); // eslint-disable-line no-console + process.exitCode = 1; + return; + } + console.log( 'Successfully generated %d padding figures.', FIGURES.length ); // eslint-disable-line no-console + } +} + +main(); From f48b98ca8f81bf022d21834bbe01c522c22211d5 Mon Sep 17 00:00:00 2001 From: gururaj1512 Date: Tue, 4 Aug 2026 16:12:11 +0530 Subject: [PATCH 03/12] fix: update copyright year --- 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_pkg_readmes status: passed - task: lint_markdown_docs status: na - task: lint_markdown status: na - task: lint_package_json status: na - task: lint_repl_help status: na - task: lint_javascript_src status: na - 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: passed - task: lint_typescript_tests status: na - task: lint_license_headers status: passed --- --- lib/node_modules/@stdlib/plot/vega/padding/ctor/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/node_modules/@stdlib/plot/vega/padding/ctor/README.md b/lib/node_modules/@stdlib/plot/vega/padding/ctor/README.md index b9a92558bdd9..f2fdd6950ffb 100644 --- a/lib/node_modules/@stdlib/plot/vega/padding/ctor/README.md +++ b/lib/node_modules/@stdlib/plot/vega/padding/ctor/README.md @@ -2,7 +2,7 @@ @license Apache-2.0 -Copyright (c) 2025 The Stdlib Authors. +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. From 8f5fc391d0fc0a2a1e733b875c490dfe61270cdf Mon Sep 17 00:00:00 2001 From: Athan Date: Tue, 4 Aug 2026 11:07:50 -0700 Subject: [PATCH 04/12] Apply suggestions from code review Co-authored-by: Athan Signed-off-by: Athan --- .../vega/padding/ctor/srv/scripts/fig_padding | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/lib/node_modules/@stdlib/plot/vega/padding/ctor/srv/scripts/fig_padding b/lib/node_modules/@stdlib/plot/vega/padding/ctor/srv/scripts/fig_padding index d41758f0b759..857bf5043ce2 100644 --- a/lib/node_modules/@stdlib/plot/vega/padding/ctor/srv/scripts/fig_padding +++ b/lib/node_modules/@stdlib/plot/vega/padding/ctor/srv/scripts/fig_padding @@ -1,4 +1,23 @@ #!/usr/bin/env node + +/** +* @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'; /* eslint-disable max-lines, stdlib/no-unnecessary-nested-functions */ From fd0873b0277186229284d65eedb2ebde50bf2011 Mon Sep 17 00:00:00 2001 From: gururaj1512 Date: Sun, 9 Aug 2026 12:07:36 +0530 Subject: [PATCH 05/12] refactor: apply suggested changes --- 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_pkg_readmes status: na - task: lint_markdown_docs status: na - 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: passed - task: lint_typescript_tests status: na - task: lint_license_headers status: passed --- --- .../scripts/{fig_padding => fig_padding.js} | 138 +++++------------- 1 file changed, 40 insertions(+), 98 deletions(-) rename lib/node_modules/@stdlib/plot/vega/padding/ctor/srv/scripts/{fig_padding => fig_padding.js} (78%) diff --git a/lib/node_modules/@stdlib/plot/vega/padding/ctor/srv/scripts/fig_padding b/lib/node_modules/@stdlib/plot/vega/padding/ctor/srv/scripts/fig_padding.js similarity index 78% rename from lib/node_modules/@stdlib/plot/vega/padding/ctor/srv/scripts/fig_padding rename to lib/node_modules/@stdlib/plot/vega/padding/ctor/srv/scripts/fig_padding.js index 857bf5043ce2..9728eb7e409d 100644 --- a/lib/node_modules/@stdlib/plot/vega/padding/ctor/srv/scripts/fig_padding +++ b/lib/node_modules/@stdlib/plot/vega/padding/ctor/srv/scripts/fig_padding.js @@ -20,16 +20,16 @@ 'use strict'; -/* eslint-disable max-lines, stdlib/no-unnecessary-nested-functions */ +/* eslint-disable max-lines, stdlib/no-unnecessary-nested-functions, n/no-sync */ // MODULES // var resolve = require( 'path' ).resolve; var join = require( 'path' ).join; var logger = require( 'debug' ); -var readdir = require( '@stdlib/fs/read-dir' ); -var unlink = require( '@stdlib/fs/unlink' ); -var exists = require( '@stdlib/fs/exists' ); +var readdirSync = require( '@stdlib/fs/read-dir' ).sync; +var unlinkSync = require( '@stdlib/fs/unlink' ).sync; +var existsSync = require( '@stdlib/fs/exists' ).sync; var renderFig = require( '@stdlib/plot/vega/base/spec2svg-file' ); @@ -47,9 +47,7 @@ var LABEL_FONT_SIZE = 13; var LABEL_FONT_WEIGHT = 'bold'; var LABEL_FILL = '#555'; -/** -* Figure configuration array. -*/ +// Figure configuration array: var FIGURES = [ { 'name': 'figure_padding', @@ -371,65 +369,39 @@ function generateAll( figures, clbk ) { } /** -* Removes stale SVG files from a list of directory entries. +* Removes stale SVG files from a directory listing. * * @private * @param {Array} files - directory entries -* @param {Callback} clbk - callback to invoke upon completion +* @throws {Error} if unable to remove a stale file * @returns {void} */ -function removeStaleFiles( files, clbk ) { - var idx = 0; - - next(); - - /** - * Processes the next file in the queue. - * - * @private - * @returns {void} - */ - function next() { - var valid; - var file; - var j; - - while ( idx < files.length ) { - file = files[ idx ]; - if ( file.indexOf( '.svg' ) === -1 ) { - idx += 1; - continue; - } - valid = false; - for ( j = 0; j < FIGURES.length; j++ ) { - if ( file === FIGURES[ j ].name + '.svg' ) { - valid = true; - break; - } - } - if ( !valid ) { - debug( 'Removing stale SVG: %s', file ); - unlink( join( IMG_DIR, file ), onRemove ); - return; +function removeStaleFiles( files ) { + var valid; + var file; + var err; + var i; + var j; + + for ( i = 0; i < files.length; i++ ) { + file = files[ i ]; + if ( file.indexOf( '.svg' ) === -1 ) { + continue; + } + valid = false; + for ( j = 0; j < FIGURES.length; j++ ) { + if ( file === FIGURES[ j ].name + '.svg' ) { + valid = true; + break; } - idx += 1; } - return clbk( null ); - } - - /** - * Callback invoked upon removing a file. - * - * @private - * @param {(Error|null)} error - error object - * @returns {void} - */ - function onRemove( error ) { - if ( error ) { - return clbk( error ); + if ( !valid ) { + debug( 'Removing stale SVG: %s', file ); + err = unlinkSync( join( IMG_DIR, file ) ); + if ( err instanceof Error ) { + throw err; + } } - idx += 1; - next(); } } @@ -443,50 +415,20 @@ function removeStaleFiles( files, clbk ) { * @returns {void} */ function main() { - exists( IMG_DIR, onExists ); - - /** - * Callback invoked upon checking directory existence. - * - * @private - * @param {boolean} bool - boolean indicating whether the path exists - * @returns {void} - */ - function onExists( bool ) { - if ( !bool ) { - return generateAll( FIGURES, onComplete ); - } - readdir( IMG_DIR, onRead ); - } + var files; - /** - * Callback invoked upon reading directory contents. - * - * @private - * @param {(Error|null)} error - error object - * @param {Array} files - directory entries - * @returns {void} - */ - function onRead( error, files ) { - if ( error ) { - return onComplete( error ); + if ( existsSync( IMG_DIR ) ) { + files = readdirSync( IMG_DIR ); + if ( files instanceof Error ) { + console.error( 'Error reading directory: %s', files.message ); // eslint-disable-line no-console + process.exitCode = 1; + return; } - removeStaleFiles( files, onClean ); + removeStaleFiles( files ); } - /** - * Callback invoked upon completing stale file cleanup. - * - * @private - * @param {(Error|null)} error - error object - * @returns {void} - */ - function onClean( error ) { - if ( error ) { - return onComplete( error ); - } - generateAll( FIGURES, onComplete ); - } + // Generate all figure SVGs: + generateAll( FIGURES, onComplete ); /** * Callback invoked upon completing all figure generation. From 8bbbc07a62a8884410004d68d3d3d28c44e2e929 Mon Sep 17 00:00:00 2001 From: Athan Date: Mon, 9 Nov 2026 00:46:44 +0100 Subject: [PATCH 06/12] refactor: use utility for resolving filename extension Signed-off-by: Athan --- .../plot/vega/padding/ctor/srv/scripts/fig_padding.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/lib/node_modules/@stdlib/plot/vega/padding/ctor/srv/scripts/fig_padding.js b/lib/node_modules/@stdlib/plot/vega/padding/ctor/srv/scripts/fig_padding.js index 9728eb7e409d..a8c1a9886444 100644 --- a/lib/node_modules/@stdlib/plot/vega/padding/ctor/srv/scripts/fig_padding.js +++ b/lib/node_modules/@stdlib/plot/vega/padding/ctor/srv/scripts/fig_padding.js @@ -27,6 +27,7 @@ var resolve = require( 'path' ).resolve; var join = require( 'path' ).join; var logger = require( 'debug' ); +var extname = require( '@stdlib/utils/extname' ); var readdirSync = require( '@stdlib/fs/read-dir' ).sync; var unlinkSync = require( '@stdlib/fs/unlink' ).sync; var existsSync = require( '@stdlib/fs/exists' ).sync; @@ -326,7 +327,6 @@ function createSpec( config ) { */ function generateAll( figures, clbk ) { var idx = 0; - next(); /** @@ -380,17 +380,19 @@ function removeStaleFiles( files ) { var valid; var file; var err; + var f; var i; var j; for ( i = 0; i < files.length; i++ ) { file = files[ i ]; - if ( file.indexOf( '.svg' ) === -1 ) { + if ( extname( file ) === '.svg' ) ) { continue; } valid = false; for ( j = 0; j < FIGURES.length; j++ ) { - if ( file === FIGURES[ j ].name + '.svg' ) { + f = FIGURES[ j ].name + '.svg'; + if ( file === f ) { valid = true; break; } From 37bf070821cddb1800cd169c76742b4ec7d53b9e Mon Sep 17 00:00:00 2001 From: Athan Date: Mon, 9 Nov 2026 00:48:29 +0100 Subject: [PATCH 07/12] style: fix stray parenthesis Signed-off-by: Athan --- .../@stdlib/plot/vega/padding/ctor/srv/scripts/fig_padding.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/node_modules/@stdlib/plot/vega/padding/ctor/srv/scripts/fig_padding.js b/lib/node_modules/@stdlib/plot/vega/padding/ctor/srv/scripts/fig_padding.js index a8c1a9886444..6a19bbaac110 100644 --- a/lib/node_modules/@stdlib/plot/vega/padding/ctor/srv/scripts/fig_padding.js +++ b/lib/node_modules/@stdlib/plot/vega/padding/ctor/srv/scripts/fig_padding.js @@ -386,7 +386,7 @@ function removeStaleFiles( files ) { for ( i = 0; i < files.length; i++ ) { file = files[ i ]; - if ( extname( file ) === '.svg' ) ) { + if ( extname( file ) === '.svg' ) { continue; } valid = false; From c1387c99364a3b054163cf78f86cae10daa90b23 Mon Sep 17 00:00:00 2001 From: Athan Date: Mon, 9 Nov 2026 00:51:39 +0100 Subject: [PATCH 08/12] Apply batched suggestions from code review Co-authored-by: Athan Signed-off-by: Athan --- lib/node_modules/@stdlib/plot/vega/padding/ctor/README.md | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/lib/node_modules/@stdlib/plot/vega/padding/ctor/README.md b/lib/node_modules/@stdlib/plot/vega/padding/ctor/README.md index 101b13271b66..8d06ba1aaacf 100644 --- a/lib/node_modules/@stdlib/plot/vega/padding/ctor/README.md +++ b/lib/node_modules/@stdlib/plot/vega/padding/ctor/README.md @@ -22,6 +22,8 @@ limitations under the License. > Padding constructor. + +
The [padding][@stdlib/plot/vega/padding] directive defines the spacing (in pixels) around the main chart group area. It determines the gap between the boundaries of the root visualization area and the inner rendering layout. @@ -243,18 +245,18 @@ v = padding.right; * * * -### Read-Only Properties +### Read-only Properties #### Padding.prototype.properties -An array of Padding property names. +List of enumerable properties. ```javascript var padding = new Padding(); -var props = padding.properties; +var v = padding.properties; // returns [ 'bottom', 'left', 'right', 'top' ] ``` From 70c803b8314d4eda83ab2313647484abd29a3410 Mon Sep 17 00:00:00 2001 From: Athan Date: Mon, 9 Nov 2026 00:52:45 +0100 Subject: [PATCH 09/12] docs: update description Signed-off-by: Athan --- lib/node_modules/@stdlib/plot/vega/padding/ctor/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/node_modules/@stdlib/plot/vega/padding/ctor/README.md b/lib/node_modules/@stdlib/plot/vega/padding/ctor/README.md index 8d06ba1aaacf..d99e9dbe9aa5 100644 --- a/lib/node_modules/@stdlib/plot/vega/padding/ctor/README.md +++ b/lib/node_modules/@stdlib/plot/vega/padding/ctor/README.md @@ -44,7 +44,7 @@ var Padding = require( '@stdlib/plot/vega/padding/ctor' ); #### Padding( \[options] ) -Returns a `Padding` instance. +Returns a padding instance. ```javascript var padding = new Padding(); From caa31f9475043461075491256be89d4b2da85fe7 Mon Sep 17 00:00:00 2001 From: Athan Date: Mon, 9 Nov 2026 00:55:49 +0100 Subject: [PATCH 10/12] docs: rearrange props in alphabetical order Signed-off-by: Athan --- .../@stdlib/plot/vega/padding/ctor/README.md | 86 +++++++++---------- 1 file changed, 43 insertions(+), 43 deletions(-) diff --git a/lib/node_modules/@stdlib/plot/vega/padding/ctor/README.md b/lib/node_modules/@stdlib/plot/vega/padding/ctor/README.md index d99e9dbe9aa5..8da7d33a8a3f 100644 --- a/lib/node_modules/@stdlib/plot/vega/padding/ctor/README.md +++ b/lib/node_modules/@stdlib/plot/vega/padding/ctor/README.md @@ -79,47 +79,6 @@ The constructor accepts the following options: ### Writable Properties - - -#### Padding.prototype.top - -Top padding (in pixels). - -```javascript -var padding = new Padding({ - 'left': 80, - 'right': 80, - 'top': 0, - 'bottom': 80 -}); - -var v = padding.top; -// returns 0 - -padding.top = 100; - -v = padding.top; -// returns 100 -``` - - - -
- Padding with top set to 0. -
-
- - - - - -
- Padding with top set to 100. -
-
- - - #### Padding.prototype.bottom @@ -243,6 +202,47 @@ v = padding.right; + + +#### Padding.prototype.top + +Top padding (in pixels). + +```javascript +var padding = new Padding({ + 'left': 80, + 'right': 80, + 'top': 0, + 'bottom': 80 +}); + +var v = padding.top; +// returns 0 + +padding.top = 100; + +v = padding.top; +// returns 100 +``` + + + +
+ Padding with top set to 0. +
+
+ + + + + +
+ Padding with top set to 100. +
+
+ + + * * * ### Read-only Properties @@ -278,7 +278,7 @@ var padding = new Padding({ 'bottom': 80 }); -var json = padding.toJSON(); +var v = padding.toJSON(); // returns { 'left': 80, 'right': 80, 'top': 80, 'bottom': 80 } ``` @@ -289,7 +289,7 @@ var padding = new Padding({ 'top': 10 }); -var str = JSON.stringify( padding ); +var v = JSON.stringify( padding ); // returns '{"bottom":0,"left":0,"right":0,"top":10}' ``` From 5d034504d466c43a3943758595e9249dc945427f Mon Sep 17 00:00:00 2001 From: Athan Date: Mon, 9 Nov 2026 00:57:57 +0100 Subject: [PATCH 11/12] docs: update return value Signed-off-by: Athan --- lib/node_modules/@stdlib/plot/vega/padding/ctor/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/node_modules/@stdlib/plot/vega/padding/ctor/README.md b/lib/node_modules/@stdlib/plot/vega/padding/ctor/README.md index 8da7d33a8a3f..3041beb52556 100644 --- a/lib/node_modules/@stdlib/plot/vega/padding/ctor/README.md +++ b/lib/node_modules/@stdlib/plot/vega/padding/ctor/README.md @@ -279,7 +279,7 @@ var padding = new Padding({ }); var v = padding.toJSON(); -// returns { 'left': 80, 'right': 80, 'top': 80, 'bottom': 80 } +// returns { 'bottom': 80, 'left': 80, 'right': 80, 'top': 80 } ``` This method is implicitly invoked by `JSON.stringify`. From 399223c26a6d7ccafdeb0e632d91573b7aa6365e Mon Sep 17 00:00:00 2001 From: Athan Date: Mon, 9 Nov 2026 01:02:17 +0100 Subject: [PATCH 12/12] docs: update copy Signed-off-by: Athan --- lib/node_modules/@stdlib/plot/vega/padding/ctor/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/node_modules/@stdlib/plot/vega/padding/ctor/README.md b/lib/node_modules/@stdlib/plot/vega/padding/ctor/README.md index 3041beb52556..94324833e6ca 100644 --- a/lib/node_modules/@stdlib/plot/vega/padding/ctor/README.md +++ b/lib/node_modules/@stdlib/plot/vega/padding/ctor/README.md @@ -26,7 +26,7 @@ limitations under the License.
-The [padding][@stdlib/plot/vega/padding] directive defines the spacing (in pixels) around the main chart group area. It determines the gap between the boundaries of the root visualization area and the inner rendering layout. +A padding configuration defines the spacing (in pixels) around the main chart group area. It determines the gap between the boundaries of the root visualization area and the inner rendering layout.