use Reaction::Class;
use Scalar::Util qw/blessed/;
-sub DEBUG_EVENTS () { $ENV{REACTION_UI_VIEWPORT_DEBUG_EVENTS} }
-
class ViewPort which {
+ sub DEBUG_EVENTS () { $ENV{REACTION_UI_VIEWPORT_DEBUG_EVENTS} }
+
has location => (isa => 'Str', is => 'rw', required => 1);
has layout => (isa => 'Str', is => 'rw', lazy_build => 1);
+ has layout_args => (isa => 'HashRef', is => 'ro', default => sub { {} });
has outer => (isa => 'Reaction::UI::ViewPort', is => 'rw', weak_ref => 1);
has inner => (isa => 'Reaction::UI::ViewPort', is => 'rw');
has focus_stack => (
has _tangent_stacks => (
isa => 'HashRef', is => 'ro', default => sub { {} }
);
- has ctx => (isa => 'Catalyst', is => 'ro', required => 1);
+ has ctx => (isa => 'Catalyst', is => 'ro'); #, required => 1);
implements _build_layout => as {
'';
implements handle_events => as {
my ($self, $events) = @_;
+ my $exists = exists $events->{exists};
+ if ($exists) {
+ my %force = $self->force_events;
+ my @need = grep { !exists $events->{$_} } keys %force;
+ @{$events}{@need} = @force{@need};
+ }
foreach my $event ($self->accept_events) {
if (exists $events->{$event}) {
if (DEBUG_EVENTS) {
my $name = join(' at ', $self, $self->location);
$self->ctx->log->debug(
"Applying Event: $event on $name with value: "
- .$events->{$event}
+ .(defined $events->{$event} ? $events->{$event} : '<undef>')
);
}
$self->$event($events->{$event});
implements accept_events => as { () };
+ implements force_events => as { () };
+
implements event_id_for => as {
my ($self, $name) = @_;
return join(':', $self->location, $name);