A comprehensive web component compiler that transforms TypeScript and JSX code into standards-compliant web components with complete development toolchain.
75
A Stencil web component that tracks and emits custom events when users interact with a simple counter interface.
The component should emit custom events that can be tested using the testing framework's event matchers.
{ value: 1, action: 'increment' } @test{ value: -1, action: 'decrement' } @test{ previousValue: 5 } when counter was at 5 @testThe component should emit events multiple times as users interact with it.
@generates
import { Component, h, Event, EventEmitter, State } from '@stencil/core';
interface CounterChangeDetail {
value: number;
action: 'increment' | 'decrement';
}
interface CounterResetDetail {
previousValue: number;
}
@Component({
tag: 'activity-tracker',
shadow: true
})
export class ActivityTracker {
@State() counter: number = 0;
@Event() counterChanged: EventEmitter<CounterChangeDetail>;
@Event() counterReset: EventEmitter<CounterResetDetail>;
private handleIncrement(): void;
private handleDecrement(): void;
private handleReset(): void;
render(): any;
}Provides the component framework including decorators for creating web components, managing state, and emitting events.
@satisfied-by
Install with Tessl CLI
npx tessl i tessl/npm-stencil--coredocs
evals
scenario-1
scenario-2
scenario-3
scenario-4
scenario-5
scenario-6
scenario-7
scenario-8
scenario-9
scenario-10