From a1eec82115276ea8c76eae9c391c07856b51cd11 Mon Sep 17 00:00:00 2001 From: gururaj1512 Date: Thu, 30 Apr 2026 14:02:36 +0530 Subject: [PATCH 1/6] fix: properties not updating correctly without refresh --- .../base/view/lib/browser/app/editor/on_change.js | 15 +++++++++++++-- .../@stdlib/plot/base/view/lib/browser/router.js | 1 + 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/lib/node_modules/@stdlib/plot/base/view/lib/browser/app/editor/on_change.js b/lib/node_modules/@stdlib/plot/base/view/lib/browser/app/editor/on_change.js index 04361d4f9d18..ed41d7f6ba49 100644 --- a/lib/node_modules/@stdlib/plot/base/view/lib/browser/app/editor/on_change.js +++ b/lib/node_modules/@stdlib/plot/base/view/lib/browser/app/editor/on_change.js @@ -22,6 +22,7 @@ // MODULES // +var isJSON = require( '@stdlib/assert/is-json' ); var join = require( '@stdlib/array/base/join' ); var log = require( './../log.js' ); var config = require( './../config.js' ); @@ -67,6 +68,7 @@ function onChange( event ) { var prop; var path; var url; + var val; var obj; var ns; var i; @@ -100,18 +102,27 @@ function onChange( event ) { // Convert namespace entries to a path: path = join( ns, '/' ); + val = event.value; + if ( isJSON( val ) ) { + try { + val = JSON.parse( val ); + } catch ( err ) { + // Ignore parse errors and fall back to the raw string + } + } + log( 'Editor changed: %s/%s', path, prop ); this.emit( 'change', { 'type': 'change', 'source': 'editor', 'property': event.property, 'path': ns.concat( [ prop ] ), - 'value': event.value + 'value': val }); log( 'Attempting to update configuration...' ); url = URL_PREFIX+'/'+( ( path ) ? path+'/' : path )+prop; - fetch( url, requestOptions( event.value.toString() ) ) + fetch( url, requestOptions( val.toString() ) ) .then( onResponse ) .catch( onError ); diff --git a/lib/node_modules/@stdlib/plot/base/view/lib/browser/router.js b/lib/node_modules/@stdlib/plot/base/view/lib/browser/router.js index eb8c2a9f02bb..e944b6087f16 100644 --- a/lib/node_modules/@stdlib/plot/base/view/lib/browser/router.js +++ b/lib/node_modules/@stdlib/plot/base/view/lib/browser/router.js @@ -79,6 +79,7 @@ function parameterize( url ) { if ( re[ re.length-1 ] === '/' ) { re = re.substring( re.length-1 ) + '\\/'; } + re = '^' + re + '$'; return { 'regexp': new RegExp( re ), 'names': names From 8cb280cb7a21d150d54641fb06e46c00496dfde9 Mon Sep 17 00:00:00 2001 From: Gururaj Gurram <143020143+gururaj1512@users.noreply.github.com> Date: Thu, 30 Apr 2026 14:15:59 +0530 Subject: [PATCH 2/6] Fix fetch call to use event.value instead of val Signed-off-by: Gururaj Gurram <143020143+gururaj1512@users.noreply.github.com> --- .../@stdlib/plot/base/view/lib/browser/app/editor/on_change.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/node_modules/@stdlib/plot/base/view/lib/browser/app/editor/on_change.js b/lib/node_modules/@stdlib/plot/base/view/lib/browser/app/editor/on_change.js index ed41d7f6ba49..8ac84cdd9de3 100644 --- a/lib/node_modules/@stdlib/plot/base/view/lib/browser/app/editor/on_change.js +++ b/lib/node_modules/@stdlib/plot/base/view/lib/browser/app/editor/on_change.js @@ -122,7 +122,7 @@ function onChange( event ) { log( 'Attempting to update configuration...' ); url = URL_PREFIX+'/'+( ( path ) ? path+'/' : path )+prop; - fetch( url, requestOptions( val.toString() ) ) + fetch( url, requestOptions( event.value.toString() ) ) .then( onResponse ) .catch( onError ); From 0694b9f842ba986083bc9f888c5be291f20b52e5 Mon Sep 17 00:00:00 2001 From: gururaj1512 Date: Sat, 2 May 2026 03:31:47 +0530 Subject: [PATCH 3/6] feat: add domain properties to axis schema and apply conditional opacity signal --- .../lib/browser/app/schema/transforms/axis.js | 21 ++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/lib/node_modules/@stdlib/plot/base/view/lib/browser/app/schema/transforms/axis.js b/lib/node_modules/@stdlib/plot/base/view/lib/browser/app/schema/transforms/axis.js index 2a3fe86c8706..019fc2e6db9a 100644 --- a/lib/node_modules/@stdlib/plot/base/view/lib/browser/app/schema/transforms/axis.js +++ b/lib/node_modules/@stdlib/plot/base/view/lib/browser/app/schema/transforms/axis.js @@ -29,6 +29,13 @@ var signalName = require( './../../utils/signal_name.js' ); // VARIABLES // var PROPS = [ + 'domain', + 'domainCap', + 'domainColor', + 'domainDash', + 'domainDashOffset', + 'domainOpacity', + 'domainWidth', 'title', 'titleColor', 'titleFont', @@ -69,9 +76,17 @@ function transform( schema, signals, defaults, prefix ) { 'name': name, 'value': ( isUndefined( v ) ) ? defaults[ k ].default : v }); - out[ k ] = { - 'signal': name - }; + if ( k === 'domain' ) { + out[ k ] = true; + } else if ( k === 'domainOpacity' ) { + out[ k ] = { + 'signal': signalName( prefix+'domain' ) + ' ? ' + name + ' : 0' + }; + } else { + out[ k ] = { + 'signal': name + }; + } } } return out; From 5a2a68404f84d18a951e5b6d721073adc4e5cc29 Mon Sep 17 00:00:00 2001 From: gururaj1512 Date: Sat, 2 May 2026 03:34:24 +0530 Subject: [PATCH 4/6] chore: apply suggested changes --- .../plot/base/view/lib/browser/app/editor/on_change.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/lib/node_modules/@stdlib/plot/base/view/lib/browser/app/editor/on_change.js b/lib/node_modules/@stdlib/plot/base/view/lib/browser/app/editor/on_change.js index 8ac84cdd9de3..ca70967c531a 100644 --- a/lib/node_modules/@stdlib/plot/base/view/lib/browser/app/editor/on_change.js +++ b/lib/node_modules/@stdlib/plot/base/view/lib/browser/app/editor/on_change.js @@ -22,6 +22,7 @@ // MODULES // +var parseJSON = require( '@stdlib/utils/parse-json' ); var isJSON = require( '@stdlib/assert/is-json' ); var join = require( '@stdlib/array/base/join' ); var log = require( './../log.js' ); @@ -68,6 +69,7 @@ function onChange( event ) { var prop; var path; var url; + var tmp; var val; var obj; var ns; @@ -104,10 +106,9 @@ function onChange( event ) { val = event.value; if ( isJSON( val ) ) { - try { - val = JSON.parse( val ); - } catch ( err ) { - // Ignore parse errors and fall back to the raw string + tmp = parseJSON( val ); + if ( !( tmp instanceof Error ) ) { + val = tmp; } } From 6c4158b13d1d9df8b63cf05c929f0ac8abc5a409 Mon Sep 17 00:00:00 2001 From: gururaj1512 Date: Sat, 2 May 2026 03:46:33 +0530 Subject: [PATCH 5/6] fix: workaround Vega limitation by dynamically toggling domain opacity instead of updating domain property --- .../plot/base/view/lib/browser/app/schema/transforms/axis.js | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/node_modules/@stdlib/plot/base/view/lib/browser/app/schema/transforms/axis.js b/lib/node_modules/@stdlib/plot/base/view/lib/browser/app/schema/transforms/axis.js index 019fc2e6db9a..415528e7fcd4 100644 --- a/lib/node_modules/@stdlib/plot/base/view/lib/browser/app/schema/transforms/axis.js +++ b/lib/node_modules/@stdlib/plot/base/view/lib/browser/app/schema/transforms/axis.js @@ -76,6 +76,7 @@ function transform( schema, signals, defaults, prefix ) { 'name': name, 'value': ( isUndefined( v ) ) ? defaults[ k ].default : v }); + // FIXME: Vega does not currently support signal updates for structural properties like `domain`. As a workaround, we keep `domain` statically `true` and dynamically hide it by dropping `domainOpacity` to 0 when unchecked. if ( k === 'domain' ) { out[ k ] = true; } else if ( k === 'domainOpacity' ) { From fe5f586a088becc5c20157e4fefa20dd7942fab8 Mon Sep 17 00:00:00 2001 From: gururaj1512 Date: Sat, 2 May 2026 16:14:22 +0530 Subject: [PATCH 6/6] add whitespace --- .../plot/base/view/lib/browser/app/schema/transforms/axis.js | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/node_modules/@stdlib/plot/base/view/lib/browser/app/schema/transforms/axis.js b/lib/node_modules/@stdlib/plot/base/view/lib/browser/app/schema/transforms/axis.js index 415528e7fcd4..77b394a2f98a 100644 --- a/lib/node_modules/@stdlib/plot/base/view/lib/browser/app/schema/transforms/axis.js +++ b/lib/node_modules/@stdlib/plot/base/view/lib/browser/app/schema/transforms/axis.js @@ -76,6 +76,7 @@ function transform( schema, signals, defaults, prefix ) { 'name': name, 'value': ( isUndefined( v ) ) ? defaults[ k ].default : v }); + // FIXME: Vega does not currently support signal updates for structural properties like `domain`. As a workaround, we keep `domain` statically `true` and dynamically hide it by dropping `domainOpacity` to 0 when unchecked. if ( k === 'domain' ) { out[ k ] = true;