Skip to content

Commit

Permalink
simplifying standalone and demo build into single, adding d.ts genera…
Browse files Browse the repository at this point in the history
…ting
  • Loading branch information
Ofigelov committed Nov 9, 2020
1 parent 1156955 commit 514a8c3
Show file tree
Hide file tree
Showing 27 changed files with 791 additions and 3,300 deletions.
2 changes: 0 additions & 2 deletions demo/dist/dc.min.js

This file was deleted.

1 change: 0 additions & 1 deletion demo/dist/dc.min.js.map

This file was deleted.

8 changes: 5 additions & 3 deletions demo/test-async-component.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
export default class TestAsyncComponent extends DcBaseComponent {
onInit() {
export class TestAsyncComponent extends DcBaseComponent {
static namespace = 'test-async-component';

init() {
this.element.innerHTML = 'Test async component was initialized';
}
}
}
8 changes: 8 additions & 0 deletions dist/dc-async.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
/**
* This function returns wrapper componentClass
*
* @param {function} importFunction
* @return {typeof DcBaseComponent} wrapper for component class
*/
export declare const dcAsync: (importFunction: CallableFunction) => any;
//# sourceMappingURL=dc-async.d.ts.map
1 change: 1 addition & 0 deletions dist/dc-async.d.ts.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

23 changes: 23 additions & 0 deletions dist/dc-base-component.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import { ReferencesCollection } from './dc-dom';
/**
* Base component.
* @class
* @implements {DcBaseComponent}
*/
declare class DcBaseComponent {
readonly element: HTMLElement;
private _listenersList;
protected readonly options: object;
protected readonly refs: ReferencesCollection;
static namespace: string;
static requiredRefs: string[];
constructor(element: HTMLElement, namespace: string, requiredRefs: string[]);
private _checkRequiredRefs;
init(): void;
protected readonly addListener: (elem: HTMLElement, eventName: string, eventCallback: CallableFunction) => void;
private _removeAllListeners;
readonly destroy: () => void;
protected onDestroy(): void;
}
export { DcBaseComponent };
//# sourceMappingURL=dc-base-component.d.ts.map
1 change: 1 addition & 0 deletions dist/dc-base-component.d.ts.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

40 changes: 40 additions & 0 deletions dist/dc-dom.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
declare const matches: (root: HTMLElement, selector: string) => boolean;
/**
*
* @param {HTMLElement} element
* @param {string} selector
* @return {HTMLElement[]}
*/
declare const scopedQuerySelectorAll: (element: HTMLElement, selector: string) => HTMLElement[];
/**
* @param {HTMLElement} root!
* @param {string} namespace
* @param {?string|Function} selector
* @return {Array}
* @throws Error
*/
declare const findElementsForInit: (root: HTMLElement, namespace: string, selector?: string | Function | undefined) => HTMLElement[];
/**
* @param {HTMLElement} element
* @return {boolean}
*/
declare const isElementWithinLazyParent: (element: HTMLElement) => boolean;
/**
* @param {HTMLElement} element
* @param {string} namespace
* @return {ReferencesCollection}
*/
interface ReferencesCollection {
[key: string]: HTMLElement | HTMLElement[] | {
[_key: string]: HTMLElement;
};
}
declare const getElementRefs: (element: HTMLElement, namespace: string) => ReferencesCollection;
/**
* @param {HTMLElement} element
* @param {string} namespace
* @return {?Object}
*/
declare const getElementOptions: (element: HTMLElement, namespace: string) => {};
export { ReferencesCollection, scopedQuerySelectorAll, getElementRefs, findElementsForInit, isElementWithinLazyParent, matches, getElementOptions, };
//# sourceMappingURL=dc-dom.d.ts.map
1 change: 1 addition & 0 deletions dist/dc-dom.d.ts.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

30 changes: 30 additions & 0 deletions dist/dc-factory.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import { DcBaseComponent } from 'src/dc-base-component';
declare class DcFactory {
private _registeredComponents;
/**
*
* @param {typeof DcBaseComponent} ComponentClass
* @param {Function|string} selector that indicates how we should search that component elements
*/
register(ComponentClass: typeof DcBaseComponent, selector?: string | Function | undefined): void;
/**
* Starts the factory on a given root: finds and creates all registered components within the root
* @param {HTMLElement} root
* @param {boolean} withLazy - Whether or not initialize component which is marked as lazy
*/
init: (root?: HTMLElement, withLazy?: boolean) => void;
/**
* Destroy all previously registered components within the passed element
* @param {HTMLElement} root
*/
destroy: (root: HTMLElement) => void;
private _getComponent;
private _getState;
private _setState;
private _initComponent;
private _initComponentOnElement;
private _createComponent;
}
export declare const dcFactory: DcFactory;
export {};
//# sourceMappingURL=dc-factory.d.ts.map
1 change: 1 addition & 0 deletions dist/dc-factory.d.ts.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 514a8c3

Please sign in to comment.