2020-11-25 13:43:39 +00:00
|
|
|
import * as plugins from './dees-element.plugins';
|
|
|
|
|
2020-11-25 14:44:57 +00:00
|
|
|
export {
|
|
|
|
property,
|
|
|
|
html,
|
|
|
|
customElement,
|
|
|
|
TemplateResult,
|
|
|
|
internalProperty,
|
2020-11-30 14:26:07 +00:00
|
|
|
css,
|
2020-12-07 22:56:24 +00:00
|
|
|
unsafeCSS,
|
2020-11-25 14:44:57 +00:00
|
|
|
} from 'lit-element';
|
2020-11-25 13:43:39 +00:00
|
|
|
|
|
|
|
export class DeesElement extends plugins.litElement.LitElement {
|
2020-12-07 22:56:24 +00:00
|
|
|
@plugins.litElement.property({ type: Boolean })
|
2020-11-25 13:43:39 +00:00
|
|
|
public goBright: boolean = false;
|
2020-12-07 22:56:24 +00:00
|
|
|
|
|
|
|
// domtools
|
2020-11-25 13:43:39 +00:00
|
|
|
public domtoolsPromise = plugins.domtools.elementBasic.setup(this);
|
|
|
|
|
2020-12-07 22:56:24 +00:00
|
|
|
@plugins.litElement.property()
|
|
|
|
domtools?: plugins.domtools.DomTools;
|
|
|
|
|
2020-12-07 03:30:59 +00:00
|
|
|
private themeSubscription: plugins.smartrx.rxjs.Subscription;
|
|
|
|
|
2020-12-07 22:56:24 +00:00
|
|
|
constructor() {
|
|
|
|
super();
|
|
|
|
this.domtoolsPromise.then((domtoolsArg) => {
|
|
|
|
this.domtools = domtoolsArg;
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2020-11-25 13:43:39 +00:00
|
|
|
public connectedCallback() {
|
|
|
|
super.connectedCallback();
|
2020-12-07 03:30:59 +00:00
|
|
|
this.domtoolsPromise.then(async (domtools) => {
|
2020-12-07 22:56:24 +00:00
|
|
|
this.themeSubscription = domtools.themeManager.themeObservable.subscribe((goBrightArg) => {
|
2020-12-07 03:30:59 +00:00
|
|
|
this.goBright = goBrightArg;
|
|
|
|
});
|
|
|
|
});
|
|
|
|
this.dispatchEvent(new CustomEvent('deesElementConnected'));
|
2020-11-25 13:43:39 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
public disconnectedCallback() {
|
|
|
|
super.disconnectedCallback();
|
2020-12-07 03:30:59 +00:00
|
|
|
this.themeSubscription.unsubscribe();
|
|
|
|
this.dispatchEvent(new CustomEvent('deesElementDisconnected'));
|
2020-11-25 13:43:39 +00:00
|
|
|
}
|
2020-12-07 22:56:24 +00:00
|
|
|
}
|