mirror of
https://github.com/FJurmanovic/wallet-web.git
synced 2026-02-06 14:18:08 +00:00
changes to structure
This commit is contained in:
@@ -1,3 +1,44 @@
|
||||
import { attr, controller, target, targets} from '@github/catalyst';
|
||||
import { attr, target, targets, register } from '@github/catalyst';
|
||||
import { bind, bindShadow } from '@github/catalyst/lib/bind';
|
||||
import { autoShadowRoot } from '@github/catalyst/lib/auto-shadow-root';
|
||||
import { defineObservedAttributes, initializeAttrs } from '@github/catalyst/lib/attr';
|
||||
|
||||
export { attr, controller, target, targets }
|
||||
import { CustomElement } from '@github/catalyst/lib/custom-element';
|
||||
|
||||
function controller(customElement: CustomElement | string): void | any {
|
||||
if (typeof customElement == 'string') {
|
||||
return function (classObject: CustomElement) {
|
||||
const connect = classObject.prototype.connectedCallback;
|
||||
classObject.prototype.connectedCallback = function (this: HTMLElement) {
|
||||
this.toggleAttribute('data-catalyst', true);
|
||||
autoShadowRoot(this);
|
||||
initializeAttrs(this);
|
||||
bind(this);
|
||||
if (connect) connect.call(this);
|
||||
if (this.shadowRoot) bindShadow(this.shadowRoot);
|
||||
};
|
||||
defineObservedAttributes(classObject);
|
||||
if (!window.customElements.get(customElement)) {
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-ignore
|
||||
window[classObject.name] = classObject;
|
||||
window.customElements.define(customElement, classObject);
|
||||
}
|
||||
};
|
||||
} else {
|
||||
const classObject = customElement;
|
||||
const connect = classObject.prototype.connectedCallback;
|
||||
classObject.prototype.connectedCallback = function (this: HTMLElement) {
|
||||
this.toggleAttribute('data-catalyst', true);
|
||||
autoShadowRoot(this);
|
||||
initializeAttrs(this);
|
||||
bind(this);
|
||||
if (connect) connect.call(this);
|
||||
if (this.shadowRoot) bindShadow(this.shadowRoot);
|
||||
};
|
||||
defineObservedAttributes(classObject);
|
||||
register(classObject);
|
||||
}
|
||||
}
|
||||
|
||||
export { attr, controller, target, targets };
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
import { render, html, TemplateResult, directive, isPrimitive } from 'lit-html';
|
||||
import { render, html, TemplateResult, directive, isPrimitive, nothing } from 'lit-html';
|
||||
|
||||
export { render, html, TemplateResult, directive, isPrimitive };
|
||||
export { render, html, TemplateResult, directive, isPrimitive, nothing };
|
||||
|
||||
Reference in New Issue
Block a user