#!/usr/bin/env perl
use strict;
use warnings;
use utf8;
use 5.010;
use JSON;
use Path::Tiny;
use Const::Fast;
const my $dash_renderer_package_name => 'dash_renderer';
const my $dash_component_pac
derer.py');
my $dash_renderer_deps_path = $dist_share_js_renderer->child('js_deps.json');
# TODO extract js_deps.json into Dash::Renderer using aux_dash_renderer.py
system("source $dash_venv_path; py
->remove_tree();
$component_suite_assets_path->mkpath();
$perl_base_path->child('js_deps.json')->copy($component_suite_assets_path);
# TODO source map files
my $node_modules_componen
$routes->get(
'/_dash-layout' => sub {
my $c = shift;
$c->render( json => $dash_app->()->layout() );
}
);
$routes->get(
'/_dash-dependencies' =
$c->render( json => $dependencies );
}
);
$routes->post(
'/_dash-update-component' => sub {
my $c = shift;
my $request = $c->req->json;
nder( json => $content );
} catch {
if ( Scalar::Util::blessed $_ && $_->isa('Dash::Exceptions::PreventUpdate') ) {
$c->render( status => 204, json => '
se JSON;
use File::ShareDir;
use Path::Tiny;
my $_deps;
sub _deps {
my $kind = shift;
if ( !defined $_deps ) {
# TODO recover from __PACKAGE__ variable
$_deps = from_json(
'Dash', Path::Tiny::path( 'assets', 'dash_renderer', 'js_deps.json' )->canonpath
)
)->slurp_utf8
e strict;
use warnings;
use JSON;
use File::ShareDir;
use Path::Tiny;
my $_deps;
sub _deps {
my $kind = shift;
if ( !defined $_deps ) {
$_deps = from_json(
"Dash", Path::Tiny::path( "assets", "dash_table", "js_deps.json" )->canonpath
)
)->slurp_utf8
use strictures 2;
use namespace::clean;
sub DashNamespace {
return 'no_namespace';
}
sub TO_JSON {
my $self = shift;
my @components = split( /::/, ref($self) );
my $type
Config;
use Moo;
use strictures 2;
use JSON;
use namespace::clean;
has url_base_pathname => ( is => 'rw',
default => sub { JSON::null } );
has requests_pathname_pref
JSON::false } );
has props_check => ( is => 'rw',
default => sub { JSON::false } );
has show_undo_redo => ( is => 'rw',
default => sub { JSON:
:false } );
has hot_reload => ( is => 'rw' );
has name => ( is => 'rw' );
sub TO_JSON {
my $self = shift;
my %hash =
map { $_ => $self->{$_} } qw(url_base_pathname requests_pathname_p
e strict;
use warnings;
use JSON;
use File::ShareDir;
use Path::Tiny;
my $_deps;
sub _deps {
my $kind = shift;
if ( !defined $_deps ) {
$_deps = from_json(
P
"Dash", Path::Tiny::path( "assets", "dash_core_components", "js_deps.json" )->canonpath
)
)->slurp_utf8
);
e strict;
use warnings;
use JSON;
use File::ShareDir;
use Path::Tiny;
my $_deps;
sub _deps {
my $kind = shift;
if ( !defined $_deps ) {
$_deps = from_json(
P
"Dash", Path::Tiny::path( "assets", "dash_html_components", "js_deps.json" )->canonpath
)
)->slurp_utf8
);
RACT: Analytical Web Apps in Perl (Port of Plotly's Dash to Perl)
# TODO Enable signatures?
use JSON;
use Scalar::Util;
use Browser::Open;
use Path::Tiny;
use Dash::Renderer;
use Dash::Config;
use D
back ( values %{ $self->_callbacks } ) {
my $rendered_callback = { clientside_function => JSON::null };
my $states = [];
for my $state ( @{ $callback->{State} } ) {
if ($some_updated) {
return { response => $props_updated, multi => JSON::true };
} else {
Dash::Exceptions::PreventUpdate->throw;