Skip to content

Commit

Permalink
Add declarations files
Browse files Browse the repository at this point in the history
  • Loading branch information
kefniark committed Nov 17, 2019
1 parent 2d39230 commit 12d3e7e
Show file tree
Hide file tree
Showing 23 changed files with 272 additions and 9 deletions.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ coverage/
node_modules/
lib/

build/declarations/
build/docs/
.DS_Store
npm-debug.log
27 changes: 27 additions & 0 deletions build/declarations/customStore/entityComponent/component.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import { Vector3, ITransformComponentData, IComponentData } from "./interfaces";
import { Entity } from "./entity";
import { EntityStore } from "../../stores";
export declare class Component {
get id(): string;
get name(): string;
get gameobject(): Entity;
get transform(): TransformComponent;
protected get watchedData(): any;
protected store: EntityStore;
protected data: IComponentData;
dataDefault: IComponentData;
constructor(store: EntityStore, data: IComponentData);
created(): void;
deleted(): void;
mounted(): void;
unmounted(): void;
enabled(): void;
disabled(): void;
}
export declare class TransformComponent extends Component {
get position(): Vector3;
get rotation(): Vector3;
get scale(): Vector3;
data: ITransformComponentData;
constructor(store: EntityStore, data: IComponentData);
}
22 changes: 22 additions & 0 deletions build/declarations/customStore/entityComponent/entity.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import { TransformComponent, Component } from "./component";
import { EntityStore } from "../../stores";
import { IEntityData } from "./interfaces";
export declare class Entity {
get enable(): boolean;
set enable(value: boolean);
get id(): string;
get name(): string;
set name(value: string);
get gameobject(): Entity;
get transform(): TransformComponent;
get parent(): Entity;
get components(): Component[];
get childs(): Entity[];
protected get watchedData(): any;
store: EntityStore;
data: IEntityData;
dataDefault: IEntityData;
constructor(store: EntityStore, data: IEntityData);
created(): void;
deleted(): void;
}
3 changes: 3 additions & 0 deletions build/declarations/customStore/entityComponent/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export * from "./interfaces";
export * from "./entity";
export * from "./component";
26 changes: 26 additions & 0 deletions build/declarations/customStore/entityComponent/interfaces.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
export interface IComponentData {
id: string;
parentId: string;
enable: boolean;
type: string;
}
export interface Vector3 {
x: number;
y: number;
z: number;
}
export interface ITransformComponentData extends IComponentData {
position: Vector3;
rotation: Vector3;
scale: Vector3;
}
export interface IEntityData {
id: string;
name: string;
parentId: string;
childIds: string[];
componentIds: {
[id: string]: string;
};
enable: boolean;
}
18 changes: 18 additions & 0 deletions build/declarations/customStore/fileFolder/entityFile.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import { EntityStore } from "../../stores";
import { IFileData } from "./interfaces";
export declare class EntityFile {
get id(): string;
get label(): string;
set label(val: string);
get icon(): string;
set icon(val: string);
get isFolder(): boolean;
protected get watchedData(): any;
protected store: EntityStore;
protected data: IFileData;
constructor(store: EntityStore, data: IFileData);
setParent(parentId: string): void;
created(): void;
deleted(): void;
toNestedJSON(): any;
}
11 changes: 11 additions & 0 deletions build/declarations/customStore/fileFolder/entityFolder.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { EntityStore } from "../../stores";
import { IFolderData } from "./interfaces";
import { EntityFile } from "./entityFile";
export declare class EntityFolder extends EntityFile {
get icon(): string;
set icon(val: string);
get isFolder(): boolean;
protected data: IFolderData;
constructor(store: EntityStore, data: IFolderData);
toNestedJSON(): any;
}
3 changes: 3 additions & 0 deletions build/declarations/customStore/fileFolder/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export * from "./interfaces";
export * from "./entityFile";
export * from "./entityFolder";
14 changes: 14 additions & 0 deletions build/declarations/customStore/fileFolder/interfaces.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
export interface IFileData {
parentId: string;
id: string;
label: string;
icon: string;
meta: {
collapse?: boolean;
hidden?: boolean;
draggable?: boolean;
};
}
export interface IFolderData extends IFileData {
childIds: string[];
}
2 changes: 2 additions & 0 deletions build/declarations/helpers/check.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export declare function pathWalk(obj: any, path: string): any;
export declare function clone(obj: any): any;
5 changes: 5 additions & 0 deletions build/declarations/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { Kaaya } from "./kaaya";
export default Kaaya;
export * from "./stores";
export * from "./customStore/entityComponent";
export * from "./customStore/fileFolder";
29 changes: 29 additions & 0 deletions build/declarations/kaaya.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import { BaseStore, KeyStore, TableStore, EntityStore } from "./stores";
export declare class Kaaya {
/**
* Create a Base Store (basic store without helpers or predefined structure)
*
* @param {*} [data={}]
* @returns {BaseStore}
*/
static createRawStore(data?: any): BaseStore;
/**
* Create a Keystore
*
* @param {*} [data={}]
* @returns {KeyStore}
*/
static createKeyStore(data?: any): KeyStore;
/**
* Create a Keystore from a configuration file (.json)
*
* @param {string} data
* @memberof Kaaya
*/
static createKeyStoreFromJSON(data: string): KeyStore;
static createTableStore(data?: any): TableStore;
static createTableStoreFromJSON(data: string): TableStore;
static createEntityStore(data?: any): EntityStore;
static createEntityComponentStore(data?: any): EntityStore;
static createFileFolderStore(data?: any): EntityStore;
}
21 changes: 21 additions & 0 deletions build/declarations/stores/baseStore.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import { DataStore } from "./dataStore";
export declare class BaseStore {
get id(): string;
get history(): any[];
get data(): any;
get proxy(): any;
get serialize(): any;
protected _store: DataStore;
protected _originalData: any;
private _data;
constructor(data?: any);
addHookBefore(name: string, path: string, promise: (obj: any, mut: any) => Promise<void>): void;
addHookAfter(name: string, path: string, promise: (obj: any, mut: any) => Promise<void>): void;
transactionStart(meta?: any): void;
transactionEnd(path?: string, meta?: any): void;
observe(cb: (mut: any) => void): void;
sync(history: any[]): void;
syncAsync(history: any[]): Promise<void>;
undo(): void;
redo(): void;
}
36 changes: 36 additions & 0 deletions build/declarations/stores/dataStore.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
import { Event } from "coopa";
export declare class DataStore {
evtCreate: Event<any>;
evtApply: Event<any>;
private hook;
addHookBefore(name: string, path: string, promise: (obj: any, mut: any) => Promise<void>): void;
addHookAfter(name: string, path: string, promise: (obj: any, mut: any) => Promise<void>): void;
id: string;
private mutations;
private history;
historyIds: Set<string>;
private transactionMeta;
private transactionHistory;
private lastUndoIndex;
private undoBuffer;
private undoMap;
get nextUndoId(): string | number;
get nextRedoId(): string | number;
constructor();
keepUndoObject(id: string, val: any): void;
addHistory(mut: any, force?: boolean): void;
transactionStart(meta?: any): void;
transactionEnd(path: string, meta?: any): void;
createMutation(name: string, path: string, data: any): any;
registerMutation(name: string, cb: (obj: any, mut: any, forward?: boolean) => void): void;
revertMutation(obj: any, mut: any): void;
applyMutation(obj: any, mut: any): void;
hookBefore(obj: any, mut: any): Promise<void>;
hookAfter(obj: any, mut: any): Promise<void>;
sync(obj: any, history: any[]): void;
private syncCurrent;
private syncQueue;
syncAsyncExecute(obj: any, history: any[]): Promise<void>;
syncAsync(obj: any, history: any[]): Promise<void>;
getHistory(): any[];
}
12 changes: 12 additions & 0 deletions build/declarations/stores/entityStore.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import { BaseStore } from "./baseStore";
export declare class EntityStore extends BaseStore {
factory: Map<string, (store: EntityStore, data: any) => any>;
instances: WeakMap<any, any>;
created: Set<string>;
constructor(data?: any);
register(name: string, factory: (store: EntityStore, data: any) => any): void;
create(classname: string, data?: any): void;
delete(id: string): void;
getData(id: string, event?: boolean): any;
getEntity<T>(id: string): T;
}
5 changes: 5 additions & 0 deletions build/declarations/stores/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
export * from "./baseStore";
export * from "./dataStore";
export * from "./entityStore";
export * from "./keyStore";
export * from "./tableStore";
10 changes: 10 additions & 0 deletions build/declarations/stores/keyStore.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { BaseStore } from "./baseStore";
export declare class KeyStore extends BaseStore {
createSection(name: string): void;
has(section: string, key: string): boolean;
get(section: string, key: string, def?: string | number): any;
set(section: string, key: string, value?: string | number): void;
delete(section: string, key: string): void;
deleteSection(name: string): void;
stringify(): string;
}
21 changes: 21 additions & 0 deletions build/declarations/stores/tableStore.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import { BaseStore } from "./baseStore";
export interface ITableSheet {
id: string;
rows: string[];
values: any;
}
export declare class TableStore extends BaseStore {
constructor(entries?: any);
private getValues;
getSheet(name: string): ITableSheet;
createSheet(name: string, id?: string): void;
getRows(sheet: string): unknown[];
getRowById(sheet: string, id: string): any;
addRow(sheet: string, value: any): void;
setRow(sheet: string, rowId: string, value: any): void;
deleteRow(sheet: string, rowId: string): void;
getCell(sheet: string, rowId: string, col: string): string | number | undefined;
setCell(sheet: string, rowId: string, col: string, value?: string | number): void;
deleteSheet(name: string): void;
stringify(): string;
}
2 changes: 1 addition & 1 deletion build/kaaya.es.mjs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// [KAAYA] Build: 0.1.0 - November 17, 2019
// [COOPA] Build: 0.2.1 - November 17, 2019
// [COOPA] Build: 0.2.2 - November 17, 2019

// Used only as a polyfill for DOMMatrix
/* istanbul ignore file */
Expand Down
2 changes: 1 addition & 1 deletion build/kaaya.umd.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
(global = global || self, factory(global.Kaaya = {}));
}(this, (function (exports) { 'use strict';

// [COOPA] Build: 0.2.1 - November 17, 2019
// [COOPA] Build: 0.2.2 - November 17, 2019

// Used only as a polyfill for DOMMatrix
/* istanbul ignore file */
Expand Down
6 changes: 3 additions & 3 deletions package-lock.json

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

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
"@types/node": "^12.12.8",
"@typescript-eslint/eslint-plugin": "^2.7.0",
"@typescript-eslint/parser": "^2.7.0",
"coopa": "^0.2.1",
"coopa": "^0.2.2",
"eslint": "^6.6.0",
"eslint-config-prettier": "^6.6.0",
"jest": "^24.9.0",
Expand Down
3 changes: 1 addition & 2 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@
// build settings
"sourceMap": true,
"pretty": true,
"declaration": true,
"preserveConstEnums": true,
"preserveConstEnums": false,
"allowSyntheticDefaultImports": true,
"experimentalDecorators": true,

Expand Down

0 comments on commit 12d3e7e

Please sign in to comment.