Skip to content

Commit

Permalink
feat(element/fsm): add render_unresolved, render_resolving
Browse files Browse the repository at this point in the history
  • Loading branch information
alimd committed Feb 27, 2023
1 parent b395b79 commit 5b8674c
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions ui/element/src/mixins/state-machine.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,28 @@
import {nothing, PropertyValues} from '../lit.js';

import type {SignalMixinInterface} from './signal.js';
import type {PropertyValues} from '../lit.js';
import type {FiniteStateMachine} from '@alwatr/fsm';
import type {Constructor} from '@alwatr/type';

export declare class StateMachineMixinInterface<TMachine extends FiniteStateMachine> extends SignalMixinInterface {
stateMachine: TMachine;
protected stateMachine: TMachine;
protected render_unresolved(): unknown;
protected render_resolving(): unknown;
}

export function StateMachineMixin<T extends Constructor<SignalMixinInterface>, TMachine extends FiniteStateMachine>(
stateMachine: TMachine,
superClass: T,
): Constructor<StateMachineMixinInterface<TMachine>> & T {
class StateMachineMixinClass extends superClass {
stateMachine = stateMachine;
protected stateMachine = stateMachine;

protected render_unresolved(): unknown {
return nothing;
}
protected render_resolving(): unknown {
return nothing;
}

override connectedCallback(): void {
super.connectedCallback();
Expand Down

0 comments on commit 5b8674c

Please sign in to comment.