fix(dees-element): Refactor project structure and update dependency versions. Internal modules (e.g. dees-element classes and directives) have been reorganized and deprecated paths removed, and package.json now includes an updated packageManager field.

This commit is contained in:
2025-04-18 17:00:04 +00:00
parent 1dd6756213
commit a9d5fce1b2
12 changed files with 4871 additions and 1657 deletions

View File

@ -0,0 +1,40 @@
import { noChange } from 'lit';
import { AsyncDirective, directive } from 'lit/async-directive.js';
import { rxjs } from '@push.rocks/smartrx';
/**
* Subscribes to an observable
*/
class SubscribeDirective extends AsyncDirective {
observable: rxjs.Observable<unknown> | undefined;
sub: rxjs.Subscription | null = null;
render(observable: rxjs.Observable<unknown>) {
if (this.observable !== observable) {
this.sub?.unsubscribe();
this.observable = observable;
if (this.isConnected) {
this.subscribe(observable);
}
}
return noChange;
}
subscribe(observable: rxjs.Observable<unknown>) {
this.sub = observable.subscribe((v: unknown) => {
this.setValue(v);
});
}
disconnected() {
this.sub?.unsubscribe();
}
reconnected() {
this.subscribe(this.observable!);
}
}
export const subscribe = directive(SubscribeDirective);