0, 'colors' => []]; #[State] public bool $agree = false; public int $renders = 0; public int $clicks = 0; public bool $menu = false; public array $keys = []; public bool $polling = false; public int $polls = 0; public bool $inited = false; public ?string $failure = null; public string $napped = ''; public int $told = 0; #[Server] public static function boom(): \Unscripted\Ui\ServerCall { return new \Unscripted\Ui\ServerCall('features', 'boom', func_get_args()); } #[Server] public static function nap(): \Unscripted\Ui\ServerCall { return new \Unscripted\Ui\ServerCall('features', 'nap', func_get_args()); } #[Server] public static function story(string $topic): \Unscripted\Ui\ServerCall { return new \Unscripted\Ui\ServerCall('features', 'story', func_get_args()); } #[State] public ?array $photo = null; public string $kept = ''; #[Server] public static function keep(array $photo): \Unscripted\Ui\ServerCall { return new \Unscripted\Ui\ServerCall('features', 'keep', func_get_args()); } public function save(): Generator { $this->kept = yield static::keep($this->photo); } public string $story = ''; public string $storyResult = ''; public function tellStory(): Generator { $this->story = ''; $this->storyResult = yield static::story('server')->into('story'); } protected function rendered(): void { $this->renders++; } protected function failed(ServerError $e): void { $this->failure = "{$e->status} {$e->getMessage()}"; } #[Computed] public function shout(): string { return strtoupper($this->q); } public function key(string $key): void { $this->keys[] = $key; } public function toggleMenu(): void { $this->menu = !$this->menu; } public function close(): void { $this->menu = false; } public function click(): void { $this->clicks++; } public function poll(): void { $this->polls++; } public function togglePolling(): void { $this->polling = !$this->polling; } public function init(): void { $this->inited = true; } public function fail(): Generator { yield static::boom(); } public function rest(): Generator { $this->napped = yield static::nap(); } public function tell(): void { $this->dispatch('told', ['n' => ++$this->told]); } public function agreed(): void {} }; ?>
{{ $this->shout }}
{{ $lazyText }}
{{ $slow }}
{{ var_export($form['amount'], true) }}
{{ implode(',', $form['colors']) }}
renders: {{ $renders }}
{{ implode(',', $keys) }}
{{ $clicks }}
{{ $failure }}
resting… idle {{ $napped }}
@if ($polling)@endif {{ $polls }}
{{ $inited ? 'inited' : 'not yet' }} offline
@if ($this->progress('photo') !== null) {{ $this->progress('photo') }}% @endif
@if ($photo) @endif
@error('photo') {{ $message }} @enderror {{ $kept }}
{{ $story }} {{ $storyResult }}