changes to structure

This commit is contained in:
Fran Jurmanović
2021-08-03 15:43:11 +02:00
parent 70ff75b0f8
commit 6b152d320c
95 changed files with 1342 additions and 1124 deletions

View File

@@ -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 };

View File

@@ -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 };