@converse/skeletor 0.0.9 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -89
- package/dist/skeletor.d.ts +764 -0
- package/dist/skeletor.js +7568 -7747
- package/dist/skeletor.min.js +6 -11
- package/package.json +46 -30
- package/src/{collection.js → collection.ts} +232 -271
- package/src/drivers/{sessionStorage.js → sessionStorage.ts} +81 -93
- package/src/{eventemitter.js → eventemitter.ts} +44 -59
- package/src/{helpers.js → helpers.ts} +56 -69
- package/src/index.ts +84 -0
- package/src/{listening.js → listening.ts} +32 -27
- package/src/{model.js → model.ts} +143 -162
- package/src/{storage.js → storage.ts} +92 -49
- package/src/types.ts +189 -0
- package/src/utils/{events.js → events.ts} +98 -48
- package/dist/skeletor.js.map +0 -1
- package/dist/skeletor.min.js.map +0 -1
- package/src/element.js +0 -238
- package/src/index.js +0 -47
- package/src/types/collection.d.ts +0 -366
- package/src/types/collection.d.ts.map +0 -1
- package/src/types/drivers/sessionStorage.d.ts +0 -37
- package/src/types/drivers/sessionStorage.d.ts.map +0 -1
- package/src/types/element.d.ts +0 -115
- package/src/types/element.d.ts.map +0 -1
- package/src/types/eventemitter.d.ts +0 -93
- package/src/types/eventemitter.d.ts.map +0 -1
- package/src/types/helpers.d.ts +0 -62
- package/src/types/helpers.d.ts.map +0 -1
- package/src/types/index.d.ts +0 -19
- package/src/types/index.d.ts.map +0 -1
- package/src/types/listening.d.ts +0 -40
- package/src/types/listening.d.ts.map +0 -1
- package/src/types/model.d.ts +0 -230
- package/src/types/model.d.ts.map +0 -1
- package/src/types/storage.d.ts +0 -35
- package/src/types/storage.d.ts.map +0 -1
- package/src/types/utils/events.d.ts +0 -28
- package/src/types/utils/events.d.ts.map +0 -1
package/src/types/element.d.ts
DELETED
|
@@ -1,115 +0,0 @@
|
|
|
1
|
-
export default ElementView;
|
|
2
|
-
export type TemplateResult = import("lit-html").TemplateResult;
|
|
3
|
-
declare const ElementView_base: {
|
|
4
|
-
new (...args: any[]): {
|
|
5
|
-
on(name: string, callback: (event: any, model: import("./model.js").Model, collection: import("./collection.js").Collection, options?: Record<string, any>) => any, context: any): /*elided*/ any;
|
|
6
|
-
_events: any;
|
|
7
|
-
_listeners: {};
|
|
8
|
-
listenTo(obj: any, name: string, callback?: (event: any, model: import("./model.js").Model, collection: import("./collection.js").Collection, options?: Record<string, any>) => any): /*elided*/ any;
|
|
9
|
-
_listeningTo: {};
|
|
10
|
-
_listenId: any;
|
|
11
|
-
off(name: string, callback: (event: any, model: import("./model.js").Model, collection: import("./collection.js").Collection, options?: Record<string, any>) => any, context?: any): /*elided*/ any;
|
|
12
|
-
stopListening(obj?: any, name?: string, callback?: (event: any, model: import("./model.js").Model, collection: import("./collection.js").Collection, options?: Record<string, any>) => any): /*elided*/ any;
|
|
13
|
-
once(name: string, callback: (event: any, model: import("./model.js").Model, collection: import("./collection.js").Collection, options?: Record<string, any>) => any, context: any): /*elided*/ any;
|
|
14
|
-
listenToOnce(obj: any, name: string, callback?: (event: any, model: import("./model.js").Model, collection: import("./collection.js").Collection, options?: Record<string, any>) => any): /*elided*/ any;
|
|
15
|
-
trigger(name: string, ...args: any[]): /*elided*/ any;
|
|
16
|
-
};
|
|
17
|
-
} & {
|
|
18
|
-
new (): HTMLElement;
|
|
19
|
-
prototype: HTMLElement;
|
|
20
|
-
};
|
|
21
|
-
declare class ElementView extends ElementView_base {
|
|
22
|
-
/**
|
|
23
|
-
* @param {Options} options
|
|
24
|
-
*/
|
|
25
|
-
constructor(options?: Record<string, any>);
|
|
26
|
-
/**
|
|
27
|
-
* @typedef {import('./model.js').Model} Model
|
|
28
|
-
* @typedef {import('./collection.js').Collection} Collection
|
|
29
|
-
* @typedef {Record.<string, any>} Options
|
|
30
|
-
*
|
|
31
|
-
* @callback EventCallback
|
|
32
|
-
* @param {any} event
|
|
33
|
-
* @param {Model} model
|
|
34
|
-
* @param {Collection} collection
|
|
35
|
-
* @param {Options} [options]
|
|
36
|
-
*/
|
|
37
|
-
set events(events: {});
|
|
38
|
-
get events(): {};
|
|
39
|
-
_declarativeEvents: {};
|
|
40
|
-
stopListening: any;
|
|
41
|
-
cid: any;
|
|
42
|
-
_domEvents: any[];
|
|
43
|
-
createRenderRoot(): this;
|
|
44
|
-
connectedCallback(...args: any[]): void;
|
|
45
|
-
_initialized: boolean;
|
|
46
|
-
disconnectedCallback(): void;
|
|
47
|
-
/**
|
|
48
|
-
* preinitialize is an empty function by default. You can override it with a function
|
|
49
|
-
* or object. preinitialize will run before any instantiation logic is run in the View
|
|
50
|
-
* eslint-disable-next-line class-methods-use-this
|
|
51
|
-
*/
|
|
52
|
-
preinitialize(): void;
|
|
53
|
-
/**
|
|
54
|
-
* Initialize is an empty function by default. Override it with your own
|
|
55
|
-
* initialization logic.
|
|
56
|
-
*/
|
|
57
|
-
initialize(): void;
|
|
58
|
-
beforeRender(): void;
|
|
59
|
-
afterRender(): void;
|
|
60
|
-
/**
|
|
61
|
-
* **render** is the core function that your view should override, in order
|
|
62
|
-
* to populate its element (`this.el`), with the appropriate HTML. The
|
|
63
|
-
* convention is for **render** to always return `this`.
|
|
64
|
-
*/
|
|
65
|
-
render(): this;
|
|
66
|
-
/**
|
|
67
|
-
* @returns {string|TemplateResult}
|
|
68
|
-
*/
|
|
69
|
-
toHTML(): string | TemplateResult;
|
|
70
|
-
/**
|
|
71
|
-
* Set callbacks, where `this.events` is a hash of
|
|
72
|
-
*
|
|
73
|
-
* *{"event selector": "callback"}*
|
|
74
|
-
*
|
|
75
|
-
* {
|
|
76
|
-
* 'mousedown .title': 'edit',
|
|
77
|
-
* 'click .button': 'save',
|
|
78
|
-
* 'click .open': function(e) { ... }
|
|
79
|
-
* }
|
|
80
|
-
*
|
|
81
|
-
* pairs. Callbacks will be bound to the view, with `this` set properly.
|
|
82
|
-
* Uses event delegation for efficiency.
|
|
83
|
-
* Omitting the selector binds the event to `this.el`.
|
|
84
|
-
*/
|
|
85
|
-
delegateEvents(): this;
|
|
86
|
-
/**
|
|
87
|
-
* Make a event delegation handler for the given `eventName` and `selector`
|
|
88
|
-
* and attach it to `this.el`.
|
|
89
|
-
* If selector is empty, the listener will be bound to `this.el`. If not, a
|
|
90
|
-
* new handler that will recursively traverse up the event target's DOM
|
|
91
|
-
* hierarchy looking for a node that matches the selector. If one is found,
|
|
92
|
-
* the event's `delegateTarget` property is set to it and the return the
|
|
93
|
-
* result of calling bound `listener` with the parameters given to the
|
|
94
|
-
* handler.
|
|
95
|
-
* @param {string} eventName
|
|
96
|
-
* @param {string} selector
|
|
97
|
-
* @param {(ev: Event) => any} listener
|
|
98
|
-
*/
|
|
99
|
-
delegate(eventName: string, selector: string, listener: (ev: Event) => any): this | ((ev: Event) => any);
|
|
100
|
-
/**
|
|
101
|
-
* Clears all callbacks previously bound to the view by `delegateEvents`.
|
|
102
|
-
* You usually don't need to use this, but may wish to if you have multiple
|
|
103
|
-
* Backbone views attached to the same DOM element.
|
|
104
|
-
*/
|
|
105
|
-
undelegateEvents(): this;
|
|
106
|
-
/**
|
|
107
|
-
* A finer-grained `undelegateEvents` for removing a single delegated event.
|
|
108
|
-
* `selector` and `listener` are both optional.
|
|
109
|
-
* @param {string} eventName
|
|
110
|
-
* @param {string} selector
|
|
111
|
-
* @param {(ev: Event) => any} listener
|
|
112
|
-
*/
|
|
113
|
-
undelegate(eventName: string, selector: string, listener: (ev: Event) => any): this;
|
|
114
|
-
}
|
|
115
|
-
//# sourceMappingURL=element.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"element.d.ts","sourceRoot":"","sources":["../element.js"],"names":[],"mappings":";6BAEa,OAAO,UAAU,EAAE,cAAc;;;;;;;;;;;;;;;;;;;AAS9C;IAsBE;;OAEG;IACH,2CAeC;IAtCD;;;;;;;;;;OAUG;IAEH,uBAEC;IAED,iBAEC;IALC,uBAAgC;IAchC,mBAAyB;IAIzB,SAA2B;IAE3B,kBAAoB;IAOtB,yBAGC;IAED,wCAOC;IAHG,sBAAwB;IAK5B,6BAGC;IAED;;;;OAIG;IACH,sBAAkB;IAElB;;;OAGG;IACH,mBAAe;IAEf,qBAAiB;IACjB,oBAAgB;IAEhB;;;;OAIG;IACH,eAKC;IAED;;OAEG;IACH,UAFa,MAAM,GAAC,cAAc,CAIjC;IAED;;;;;;;;;;;;;;OAcG;IACH,uBAaC;IAED;;;;;;;;;;;;OAYG;IACH,oBAJW,MAAM,YACN,MAAM,YACN,CAAC,EAAE,EAAE,KAAK,KAAK,GAAG,gBAAb,KAAK,KAAK,GAAG,EAsC5B;IAED;;;;OAIG;IACH,yBASC;IAED;;;;;;OAMG;IACH,sBAJW,MAAM,YACN,MAAM,YACN,CAAC,EAAE,EAAE,KAAK,KAAK,GAAG,QAyB5B;CACF"}
|
|
@@ -1,93 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @function
|
|
3
|
-
* @template {new(...args: any[]) => {}} ClassConstructor
|
|
4
|
-
* @param {ClassConstructor} Base
|
|
5
|
-
*/
|
|
6
|
-
export function EventEmitter<ClassConstructor extends new (...args: any[]) => {}>(Base: ClassConstructor): {
|
|
7
|
-
new (...args: any[]): {
|
|
8
|
-
/**
|
|
9
|
-
* @typedef {import('./model.js').Model} Model
|
|
10
|
-
* @typedef {import('./collection.js').Collection} Collection
|
|
11
|
-
* @typedef {Record.<string, any>} Options
|
|
12
|
-
*
|
|
13
|
-
* @callback EventCallback
|
|
14
|
-
* @param {any} event
|
|
15
|
-
* @param {Model} model
|
|
16
|
-
* @param {Collection} collection
|
|
17
|
-
* @param {Options} [options]
|
|
18
|
-
*/
|
|
19
|
-
/**
|
|
20
|
-
* Bind an event to a `callback` function. Passing `"all"` will bind
|
|
21
|
-
* the callback to all events fired.
|
|
22
|
-
* @param {string} name
|
|
23
|
-
* @param {EventCallback} callback
|
|
24
|
-
* @param {any} context
|
|
25
|
-
* @return {EventEmitter}
|
|
26
|
-
*/
|
|
27
|
-
on(name: string, callback: (event: any, model: import("./model.js").Model, collection: import("./collection.js").Collection, options?: Record<string, any>) => any, context: any): /*elided*/ any;
|
|
28
|
-
_events: any;
|
|
29
|
-
_listeners: {};
|
|
30
|
-
/**
|
|
31
|
-
* Inversion-of-control versions of `on`. Tell *this* object to listen to
|
|
32
|
-
* an event in another object... keeping track of what it's listening to
|
|
33
|
-
* for easier unbinding later.
|
|
34
|
-
* @param {any} obj
|
|
35
|
-
* @param {string} name
|
|
36
|
-
* @param {EventCallback} [callback]
|
|
37
|
-
* @return {EventEmitter}
|
|
38
|
-
*/
|
|
39
|
-
listenTo(obj: any, name: string, callback?: (event: any, model: import("./model.js").Model, collection: import("./collection.js").Collection, options?: Record<string, any>) => any): /*elided*/ any;
|
|
40
|
-
_listeningTo: {};
|
|
41
|
-
_listenId: any;
|
|
42
|
-
/**
|
|
43
|
-
* Remove one or many callbacks. If `context` is null, removes all
|
|
44
|
-
* callbacks with that function. If `callback` is null, removes all
|
|
45
|
-
* callbacks for the event. If `name` is null, removes all bound
|
|
46
|
-
* callbacks for all events.
|
|
47
|
-
* @param {string} name
|
|
48
|
-
* @param {EventCallback} callback
|
|
49
|
-
* @param {any} [context]
|
|
50
|
-
* @return {EventEmitter}
|
|
51
|
-
*/
|
|
52
|
-
off(name: string, callback: (event: any, model: import("./model.js").Model, collection: import("./collection.js").Collection, options?: Record<string, any>) => any, context?: any): /*elided*/ any;
|
|
53
|
-
/**
|
|
54
|
-
* Tell this object to stop listening to either specific events ... or
|
|
55
|
-
* to every object it's currently listening to.
|
|
56
|
-
* @param {any} [obj]
|
|
57
|
-
* @param {string} [name]
|
|
58
|
-
* @param {EventCallback} [callback]
|
|
59
|
-
* @return {EventEmitter}
|
|
60
|
-
*/
|
|
61
|
-
stopListening(obj?: any, name?: string, callback?: (event: any, model: import("./model.js").Model, collection: import("./collection.js").Collection, options?: Record<string, any>) => any): /*elided*/ any;
|
|
62
|
-
/**
|
|
63
|
-
* Bind an event to only be triggered a single time. After the first time
|
|
64
|
-
* the callback is invoked, its listener will be removed. If multiple events
|
|
65
|
-
* are passed in using the space-separated syntax, the handler will fire
|
|
66
|
-
* once for each event, not once for a combination of all events.
|
|
67
|
-
* @param {string} name
|
|
68
|
-
* @param {EventCallback} callback
|
|
69
|
-
* @param {any} context
|
|
70
|
-
* @return {EventEmitter}
|
|
71
|
-
*/
|
|
72
|
-
once(name: string, callback: (event: any, model: import("./model.js").Model, collection: import("./collection.js").Collection, options?: Record<string, any>) => any, context: any): /*elided*/ any;
|
|
73
|
-
/**
|
|
74
|
-
* Inversion-of-control versions of `once`.
|
|
75
|
-
* @param {any} obj
|
|
76
|
-
* @param {string} name
|
|
77
|
-
* @param {EventCallback} [callback]
|
|
78
|
-
* @return {EventEmitter}
|
|
79
|
-
*/
|
|
80
|
-
listenToOnce(obj: any, name: string, callback?: (event: any, model: import("./model.js").Model, collection: import("./collection.js").Collection, options?: Record<string, any>) => any): /*elided*/ any;
|
|
81
|
-
/**
|
|
82
|
-
* Trigger one or many events, firing all bound callbacks. Callbacks are
|
|
83
|
-
* passed the same arguments as `trigger` is, apart from the event name
|
|
84
|
-
* (unless you're listening on `"all"`, which will cause your callback to
|
|
85
|
-
* receive the true name of the event as the first argument).
|
|
86
|
-
* @param {string} name
|
|
87
|
-
* @return {EventEmitter}
|
|
88
|
-
*/
|
|
89
|
-
trigger(name: string, ...args: any[]): /*elided*/ any;
|
|
90
|
-
};
|
|
91
|
-
} & ClassConstructor;
|
|
92
|
-
export default EventEmitter;
|
|
93
|
-
//# sourceMappingURL=eventemitter.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"eventemitter.d.ts","sourceRoot":"","sources":["../eventemitter.js"],"names":[],"mappings":"AAaA;;;;GAIG;AACH,6BAHyC,gBAAgB,SAA5C,KAAK,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,EAAG,QAC7B,gBAAgB;kBADA,GAAG,EAAE;QAK5B;;;;;;;;;;WAUG;QAEH;;;;;;;WAOG;iBAJQ,MAAM,oBATN,GAAG,uIAWH,GAAG;;;QAqBd;;;;;;;;WAQG;sBAJQ,GAAG,QACH,MAAM,qBArCN,GAAG;;;QAiEd;;;;;;;;;WASG;kBAJQ,MAAM,oBAtEN,GAAG,wIAwEH,GAAG;QAad;;;;;;;WAOG;4BAJQ,GAAG,SACH,MAAM,qBAzFN,GAAG;QAiHd;;;;;;;;;WASG;mBAJQ,MAAM,oBAtHN,GAAG,uIAwHH,GAAG;QAUd;;;;;;WAMG;0BAJQ,GAAG,QACH,MAAM,qBArIN,GAAG;QA+Id;;;;;;;WAOG;sBAFQ,MAAM;;qBAUpB"}
|
package/src/types/helpers.d.ts
DELETED
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
export function guid(): string;
|
|
2
|
-
export function inherits(protoProps: any, staticProps: any): any;
|
|
3
|
-
export function getResolveablePromise(): Promise<any> & {
|
|
4
|
-
isResolved: boolean;
|
|
5
|
-
isPending: boolean;
|
|
6
|
-
isRejected: boolean;
|
|
7
|
-
resolve: Function;
|
|
8
|
-
reject: Function;
|
|
9
|
-
};
|
|
10
|
-
export function urlError(): void;
|
|
11
|
-
export function wrapError(model: any, options: any): void;
|
|
12
|
-
/**
|
|
13
|
-
* @typedef {import('./model.js').Model} Model
|
|
14
|
-
* @typedef {import('./collection.js').Collection} Collection
|
|
15
|
-
*/
|
|
16
|
-
/**
|
|
17
|
-
* @param {Model | Collection} model
|
|
18
|
-
*/
|
|
19
|
-
export function getSyncMethod(model: Model | Collection): any;
|
|
20
|
-
/**
|
|
21
|
-
* @typedef {Object} SyncOptions
|
|
22
|
-
* @property {string} [url]
|
|
23
|
-
* @property {any} [data]
|
|
24
|
-
* @property {any} [attrs]
|
|
25
|
-
* @property {Function} [success]
|
|
26
|
-
* @property {Function} [error]
|
|
27
|
-
* @property {any} [xhr]
|
|
28
|
-
*/
|
|
29
|
-
/**
|
|
30
|
-
* Override this function to change the manner in which Backbone persists
|
|
31
|
-
* models to the server. You will be passed the type of request, and the
|
|
32
|
-
* model in question. By default makes a `fetch()` API call
|
|
33
|
-
* to the model's `url()`.
|
|
34
|
-
*
|
|
35
|
-
* Some possible customizations could be:
|
|
36
|
-
*
|
|
37
|
-
* - Use `setTimeout` to batch rapid-fire updates into a single request.
|
|
38
|
-
* - Persist models via WebSockets instead of Ajax.
|
|
39
|
-
* - Persist models to browser storage
|
|
40
|
-
*
|
|
41
|
-
* @param {'create'|'update'|'patch'} method
|
|
42
|
-
* @param {import('./model.js').Model} model
|
|
43
|
-
* @param {SyncOptions} [options]
|
|
44
|
-
*/
|
|
45
|
-
export function sync(method: "create" | "update" | "patch", model: import("./model.js").Model, options?: SyncOptions): Promise<Response>;
|
|
46
|
-
/**
|
|
47
|
-
* Custom error for indicating timeouts
|
|
48
|
-
* @namespace _converse
|
|
49
|
-
*/
|
|
50
|
-
export class NotImplementedError extends Error {
|
|
51
|
-
}
|
|
52
|
-
export type Model = import("./model.js").Model;
|
|
53
|
-
export type Collection = import("./collection.js").Collection;
|
|
54
|
-
export type SyncOptions = {
|
|
55
|
-
url?: string;
|
|
56
|
-
data?: any;
|
|
57
|
-
attrs?: any;
|
|
58
|
-
success?: Function;
|
|
59
|
-
error?: Function;
|
|
60
|
-
xhr?: any;
|
|
61
|
-
};
|
|
62
|
-
//# sourceMappingURL=helpers.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../helpers.js"],"names":[],"mappings":"AAkBA,+BAGC;AASD,iEA6BC;AAED;gBAGgB,OAAO;eACP,OAAO;gBACP,OAAO;;;EAwCtB;AAGD,iCAEC;AAGD,0DAMC;AAWD;;;GAGG;AAGH;;GAEG;AACH,qCAFW,KAAK,GAAG,UAAU,OAK5B;AAED;;;;;;;;GAQG;AAEH;;;;;;;;;;;;;;;GAeG;AACH,6BAJW,QAAQ,GAAC,QAAQ,GAAC,OAAO,SACzB,OAAO,YAAY,EAAE,KAAK,YAC1B,WAAW,qBAsBrB;AAxLD;;;GAGG;AACH;CAAiD;oBAyHpC,OAAO,YAAY,EAAE,KAAK;yBAC1B,OAAO,iBAAiB,EAAE,UAAU;;UAcnC,MAAM;WACN,GAAG;YACH,GAAG;;;UAGH,GAAG"}
|
package/src/types/index.d.ts
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
export default skeletor;
|
|
2
|
-
declare namespace skeletor {
|
|
3
|
-
let VERSION: string;
|
|
4
|
-
function noConflict(): {
|
|
5
|
-
Collection: typeof Collection;
|
|
6
|
-
ElementView: typeof ElementView;
|
|
7
|
-
EventEmitter: typeof EventEmitter;
|
|
8
|
-
Model: typeof Model;
|
|
9
|
-
sync: typeof sync;
|
|
10
|
-
};
|
|
11
|
-
}
|
|
12
|
-
import { Collection } from './collection.js';
|
|
13
|
-
import ElementView from './element.js';
|
|
14
|
-
import EventEmitter from './eventemitter.js';
|
|
15
|
-
import { Model } from './model.js';
|
|
16
|
-
import Storage from './storage.js';
|
|
17
|
-
import { sync } from './helpers.js';
|
|
18
|
-
export { Collection, ElementView, EventEmitter, Model, Storage, sync };
|
|
19
|
-
//# sourceMappingURL=index.d.ts.map
|
package/src/types/index.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../index.js"],"names":[],"mappings":";;;IA+BA;;;;;;MAGC;;2BA9B0B,iBAAiB;wBAHpB,cAAc;yBACb,mBAAmB;sBAGtB,YAAY;oBAFd,cAAc;qBAGb,cAAc"}
|
package/src/types/listening.d.ts
DELETED
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
export default Listening;
|
|
2
|
-
/**
|
|
3
|
-
* A listening class that tracks and cleans up memory bindings
|
|
4
|
-
* when all callbacks have been offed.
|
|
5
|
-
*/
|
|
6
|
-
declare class Listening {
|
|
7
|
-
/** @typedef {import('./eventemitter.js').default} EventEmitter */
|
|
8
|
-
/**
|
|
9
|
-
* @param {any} listener
|
|
10
|
-
* @param {any} obj
|
|
11
|
-
*/
|
|
12
|
-
constructor(listener: any, obj: any);
|
|
13
|
-
id: any;
|
|
14
|
-
listener: any;
|
|
15
|
-
obj: any;
|
|
16
|
-
interop: boolean;
|
|
17
|
-
count: number;
|
|
18
|
-
_events: any;
|
|
19
|
-
/**
|
|
20
|
-
* @param {string} name
|
|
21
|
-
* @param {Function} callback
|
|
22
|
-
* @param {any} context
|
|
23
|
-
* @param {Listening} _listening
|
|
24
|
-
*/
|
|
25
|
-
start(name: string, callback: Function, context: any, _listening: Listening): this;
|
|
26
|
-
/**
|
|
27
|
-
* Stop's listening to a callback (or several).
|
|
28
|
-
* Uses an optimized counter if the listenee uses Backbone.Events.
|
|
29
|
-
* Otherwise, falls back to manual tracking to support events
|
|
30
|
-
* library interop.
|
|
31
|
-
* @param {string} name
|
|
32
|
-
* @param {Function} callback
|
|
33
|
-
*/
|
|
34
|
-
stop(name: string, callback: Function): void;
|
|
35
|
-
/**
|
|
36
|
-
* Cleans up memory bindings between the listener and the listenee.
|
|
37
|
-
*/
|
|
38
|
-
cleanup(): void;
|
|
39
|
-
}
|
|
40
|
-
//# sourceMappingURL=listening.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"listening.d.ts","sourceRoot":"","sources":["../listening.js"],"names":[],"mappings":";AAEA;;;GAGG;AACH;IAEE,kEAAkE;IAElE;;;OAGG;IACH,sBAHW,GAAG,OACH,GAAG,EASb;IANC,QAA4B;IAC5B,cAAwB;IACxB,SAAc;IACd,iBAAmB;IACnB,cAAc;IACd,aAAwB;IAG1B;;;;;OAKG;IACH,YALW,MAAM,+BAEN,GAAG,cACH,SAAS,QAmBnB;IAED;;;;;;;OAOG;IACH,WAHW,MAAM,4BAgBhB;IAED;;OAEG;IACH,gBAGC;CACF"}
|
package/src/types/model.d.ts
DELETED
|
@@ -1,230 +0,0 @@
|
|
|
1
|
-
export type Collection = import("./collection.js").Collection;
|
|
2
|
-
export type Attributes = Record<string, any>;
|
|
3
|
-
export type Options = Record<string, any>;
|
|
4
|
-
export type ModelOptions = Record<string, any>;
|
|
5
|
-
declare const Model_base: {
|
|
6
|
-
new (...args: any[]): {
|
|
7
|
-
on(name: string, callback: (event: any, model: Model, collection: import("./collection.js").Collection, options: Record<string, any>) => any, context: any): /*elided*/ any;
|
|
8
|
-
_events: any;
|
|
9
|
-
_listeners: {};
|
|
10
|
-
listenTo(obj: any, name: string, callback?: (event: any, model: Model, collection: import("./collection.js").Collection, options: Record<string, any>) => any): /*elided*/ any;
|
|
11
|
-
_listeningTo: {};
|
|
12
|
-
_listenId: any;
|
|
13
|
-
off(name: string, callback: (event: any, model: Model, collection: import("./collection.js").Collection, options: Record<string, any>) => any, context?: any): /*elided*/ any;
|
|
14
|
-
stopListening(obj?: any, name?: string, callback?: (event: any, model: Model, collection: import("./collection.js").Collection, options: Record<string, any>) => any): /*elided*/ any;
|
|
15
|
-
once(name: string, callback: (event: any, model: Model, collection: import("./collection.js").Collection, options: Record<string, any>) => any, context: any): /*elided*/ any;
|
|
16
|
-
listenToOnce(obj: any, name: string, callback?: (event: any, model: Model, collection: import("./collection.js").Collection, options: Record<string, any>) => any): /*elided*/ any;
|
|
17
|
-
trigger(name: string, ...args: any[]): /*elided*/ any;
|
|
18
|
-
};
|
|
19
|
-
} & ObjectConstructor;
|
|
20
|
-
/**
|
|
21
|
-
* @typedef {import('./collection.js').Collection} Collection
|
|
22
|
-
* @typedef {Record.<string, any>} Attributes
|
|
23
|
-
*
|
|
24
|
-
* @typedef {Record.<string, any>} Options
|
|
25
|
-
* @property {boolean} [validate]
|
|
26
|
-
*
|
|
27
|
-
* @typedef {Record.<string, any>} ModelOptions
|
|
28
|
-
* @property {Collection} [collection]
|
|
29
|
-
* @property {boolean} [parse]
|
|
30
|
-
* @property {boolean} [unset]
|
|
31
|
-
* @property {boolean} [silent]
|
|
32
|
-
*/
|
|
33
|
-
/**
|
|
34
|
-
* **Models** are the basic data object in the framework --
|
|
35
|
-
* frequently representing a row in a table in a database on your server.
|
|
36
|
-
* A discrete chunk of data and a bunch of useful, related methods for
|
|
37
|
-
* performing computations and transformations on that data.
|
|
38
|
-
*/
|
|
39
|
-
export class Model extends Model_base {
|
|
40
|
-
/**
|
|
41
|
-
* Create a new model with the specified attributes. A client id (`cid`)
|
|
42
|
-
* is automatically generated and assigned for you.
|
|
43
|
-
* @param {Attributes} [attributes]
|
|
44
|
-
* @param {ModelOptions} [options]
|
|
45
|
-
*/
|
|
46
|
-
constructor(attributes?: Attributes, options?: ModelOptions, ...args: any[]);
|
|
47
|
-
cid: any;
|
|
48
|
-
attributes: {};
|
|
49
|
-
validationError: string;
|
|
50
|
-
collection: any;
|
|
51
|
-
changed: {};
|
|
52
|
-
/**
|
|
53
|
-
* @param {Storage} storage
|
|
54
|
-
*/
|
|
55
|
-
set browserStorage(storage: Storage);
|
|
56
|
-
/**
|
|
57
|
-
* @returns {Storage} storage
|
|
58
|
-
*/
|
|
59
|
-
get browserStorage(): Storage;
|
|
60
|
-
_browserStorage: Storage;
|
|
61
|
-
/**
|
|
62
|
-
* The default name for the JSON `id` attribute is `"id"`. MongoDB and
|
|
63
|
-
* CouchDB users may want to set this to `"_id"` (by overriding this getter
|
|
64
|
-
* in a subclass).
|
|
65
|
-
*/
|
|
66
|
-
get idAttribute(): string;
|
|
67
|
-
/**
|
|
68
|
-
* The prefix is used to create the client id which is used to identify models locally.
|
|
69
|
-
* You may want to override this if you're experiencing name clashes with model ids.
|
|
70
|
-
*/
|
|
71
|
-
get cidPrefix(): string;
|
|
72
|
-
/**
|
|
73
|
-
* preinitialize is an empty function by default. You can override it with a function
|
|
74
|
-
* or object. preinitialize will run before any instantiation logic is run in the Model.
|
|
75
|
-
*/
|
|
76
|
-
preinitialize(): void;
|
|
77
|
-
/**
|
|
78
|
-
* Initialize is an empty function by default. Override it with your own
|
|
79
|
-
* initialization logic.
|
|
80
|
-
* @param {Attributes} [attrs]
|
|
81
|
-
* @param {ModelOptions} [options]
|
|
82
|
-
*/
|
|
83
|
-
initialize(attrs?: Attributes, options?: ModelOptions): void;
|
|
84
|
-
/**
|
|
85
|
-
* @param {object} attrs
|
|
86
|
-
* @param {object} [options]
|
|
87
|
-
* @returns {string} The validation error message
|
|
88
|
-
*/
|
|
89
|
-
validate(attrs: object, options?: object): string;
|
|
90
|
-
/**
|
|
91
|
-
* Return a copy of the model's `attributes` object.
|
|
92
|
-
*/
|
|
93
|
-
toJSON(): any;
|
|
94
|
-
/**
|
|
95
|
-
* Override this if you need custom syncing semantics for *this* particular model.
|
|
96
|
-
* @param {'create'|'update'|'patch'|'delete'|'read'} method
|
|
97
|
-
* @param {Model} model
|
|
98
|
-
* @param {Options} options
|
|
99
|
-
*/
|
|
100
|
-
sync(method: "create" | "update" | "patch" | "delete" | "read", model: Model, options: Options): any;
|
|
101
|
-
/**
|
|
102
|
-
* Get the value of an attribute.
|
|
103
|
-
* @param {string} attr
|
|
104
|
-
*/
|
|
105
|
-
get(attr: string): any;
|
|
106
|
-
keys(): string[];
|
|
107
|
-
values(): any[];
|
|
108
|
-
pairs(): [string, any][];
|
|
109
|
-
entries(): [string, any][];
|
|
110
|
-
invert(): any;
|
|
111
|
-
pick(...args: any[]): any;
|
|
112
|
-
omit(...args: any[]): any;
|
|
113
|
-
isEmpty(): any;
|
|
114
|
-
/**
|
|
115
|
-
* Returns `true` if the attribute contains a value that is not null
|
|
116
|
-
* or undefined.
|
|
117
|
-
* @param {string} attr
|
|
118
|
-
*/
|
|
119
|
-
has(attr: string): boolean;
|
|
120
|
-
/**
|
|
121
|
-
* Special-cased proxy to lodash's `matches` method.
|
|
122
|
-
* @param {Attributes} attrs
|
|
123
|
-
*/
|
|
124
|
-
matches(attrs: Attributes): boolean;
|
|
125
|
-
/**
|
|
126
|
-
* Set a hash of model attributes on the object, firing `"change"`. This is
|
|
127
|
-
* the core primitive operation of a model, updating the data and notifying
|
|
128
|
-
* anyone who needs to know about the change in state. The heart of the beast.
|
|
129
|
-
* @param {string|Object} key
|
|
130
|
-
* @param {string|Object} [val]
|
|
131
|
-
* @param {Options} [options]
|
|
132
|
-
*/
|
|
133
|
-
set(key: string | any, val?: string | any, options?: Options): false | this;
|
|
134
|
-
_changing: boolean;
|
|
135
|
-
_previousAttributes: any;
|
|
136
|
-
id: any;
|
|
137
|
-
_pending: boolean | Options;
|
|
138
|
-
/**
|
|
139
|
-
* Remove an attribute from the model, firing `"change"`. `unset` is a noop
|
|
140
|
-
* if the attribute doesn't exist.
|
|
141
|
-
* @param {string} attr
|
|
142
|
-
* @param {Options} [options]
|
|
143
|
-
*/
|
|
144
|
-
unset(attr: string, options?: Options): false | this;
|
|
145
|
-
/**
|
|
146
|
-
* Clear all attributes on the model, firing `"change"`.
|
|
147
|
-
* @param {Options} options
|
|
148
|
-
*/
|
|
149
|
-
clear(options: Options): false | this;
|
|
150
|
-
/**
|
|
151
|
-
* Determine if the model has changed since the last `"change"` event.
|
|
152
|
-
* If you specify an attribute name, determine if that attribute has changed.
|
|
153
|
-
* @param {string} [attr]
|
|
154
|
-
*/
|
|
155
|
-
hasChanged(attr?: string): any;
|
|
156
|
-
/**
|
|
157
|
-
* Return an object containing all the attributes that have changed, or
|
|
158
|
-
* false if there are no changed attributes. Useful for determining what
|
|
159
|
-
* parts of a view need to be updated and/or what attributes need to be
|
|
160
|
-
* persisted to the server. Unset attributes will be set to undefined.
|
|
161
|
-
* You can also pass an attributes object to diff against the model,
|
|
162
|
-
* determining if there *would be* a change.
|
|
163
|
-
* @param {Object} diff
|
|
164
|
-
*/
|
|
165
|
-
changedAttributes(diff: any): any;
|
|
166
|
-
/**
|
|
167
|
-
* Get the previous value of an attribute, recorded at the time the last
|
|
168
|
-
* `"change"` event was fired.
|
|
169
|
-
* @param {string} [attr]
|
|
170
|
-
*/
|
|
171
|
-
previous(attr?: string): any;
|
|
172
|
-
/**
|
|
173
|
-
* Get all of the attributes of the model at the time of the previous
|
|
174
|
-
* `"change"` event.
|
|
175
|
-
*/
|
|
176
|
-
previousAttributes(): any;
|
|
177
|
-
/**
|
|
178
|
-
* Fetch the model from the server, merging the response with the model's
|
|
179
|
-
* local attributes. Any changed attributes will trigger a "change" event.
|
|
180
|
-
* @param {Options} [options={}]
|
|
181
|
-
*/
|
|
182
|
-
fetch(options?: Options): any;
|
|
183
|
-
/**
|
|
184
|
-
* Set a hash of model attributes, and sync the model to the server.
|
|
185
|
-
* If the server returns an attributes hash that differs, the model's
|
|
186
|
-
* state will be `set` again.
|
|
187
|
-
* @param {string|Attributes} [key]
|
|
188
|
-
* @param {boolean|number|string|Options} [val]
|
|
189
|
-
* @param {Options} [options]
|
|
190
|
-
*/
|
|
191
|
-
save(key?: string | Attributes, val?: boolean | number | string | Options, options?: Options): any;
|
|
192
|
-
/**
|
|
193
|
-
* Destroy this model on the server if it was already persisted.
|
|
194
|
-
* Optimistically removes the model from its collection, if it has one.
|
|
195
|
-
* If `wait: true` is passed, waits for the server to respond before removal.
|
|
196
|
-
* @param {Options} [options]
|
|
197
|
-
*/
|
|
198
|
-
destroy(options?: Options): boolean;
|
|
199
|
-
/**
|
|
200
|
-
* Default URL for the model's representation on the server -- if you're
|
|
201
|
-
* using Backbone's restful methods, override this to change the endpoint
|
|
202
|
-
* that will be called.
|
|
203
|
-
*/
|
|
204
|
-
url(): any;
|
|
205
|
-
/**
|
|
206
|
-
* **parse** converts a response into the hash of attributes to be `set` on
|
|
207
|
-
* the model. The default implementation is just to pass the response along.
|
|
208
|
-
* @param {Options} resp
|
|
209
|
-
* @param {Options} [options]
|
|
210
|
-
*/
|
|
211
|
-
parse(resp: Options, options?: Options): Options;
|
|
212
|
-
/**
|
|
213
|
-
* A model is new if it has never been saved to the server, and lacks an id.
|
|
214
|
-
*/
|
|
215
|
-
isNew(): boolean;
|
|
216
|
-
/**
|
|
217
|
-
* Check if the model is currently in a valid state.
|
|
218
|
-
* @param {Options} [options]
|
|
219
|
-
*/
|
|
220
|
-
isValid(options?: Options): boolean;
|
|
221
|
-
/**
|
|
222
|
-
* Run validation against the next complete set of model attributes,
|
|
223
|
-
* returning `true` if all is well. Otherwise, fire an `"invalid"` event.
|
|
224
|
-
* @param {Attributes} attrs
|
|
225
|
-
* @param {Options} [options]
|
|
226
|
-
*/
|
|
227
|
-
_validate(attrs: Attributes, options?: Options): boolean;
|
|
228
|
-
}
|
|
229
|
-
export {};
|
|
230
|
-
//# sourceMappingURL=model.d.ts.map
|
package/src/types/model.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"model.d.ts","sourceRoot":"","sources":["../model.js"],"names":[],"mappings":"yBAgBa,OAAO,iBAAiB,EAAE,UAAU;yBACpC,MAAM,CAAE,MAAM,EAAE,GAAG,CAAC;sBAEpB,MAAM,CAAE,MAAM,EAAE,GAAG,CAAC;2BAGpB,MAAM,CAAE,MAAM,EAAE,GAAG,CAAC;;;;;;;;;;;;;;;;AAPjC;;;;;;;;;;;;GAYG;AAEH;;;;;GAKG;AACH;IACE;;;;;OAKG;IACH,yBAHW,UAAU,YACV,YAAY,kBAyBtB;IAlBC,SAAmC;IACnC,eAAoB;IAGpB,wBAA2B;IAEH,gBAAoC;IAW5D,YAAiB;IAGnB;;OAEG;IACH,4BAFW,OAAO,EAIjB;IAED;;OAEG;IACH,sBAFa,OAAO,CAInB;IARC,yBAA8B;IAUhC;;;;OAIG;IAEH,0BAEC;IAED;;;OAGG;IAEH,wBAEC;IAED;;;OAGG;IAEH,sBAAkB;IAElB;;;;;OAKG;IACH,mBAHW,UAAU,YACV,YAAY,QAEM;IAE7B;;;;OAIG;IACH,gBAJW,MAAM,YACN,MAAM,GACJ,MAAM,CAIlB;IAED;;OAEG;IACH,cAEC;IAED;;;;;OAKG;IAEH,aALW,QAAQ,GAAC,QAAQ,GAAC,OAAO,GAAC,QAAQ,GAAC,MAAM,SACzC,KAAK,WACL,OAAO,OAKjB;IAED;;;OAGG;IACH,UAFW,MAAM,OAIhB;IAED,iBAEC;IAED,gBAEC;IAED,yBAEC;IAED,2BAEC;IAED,cAEC;IAED,0BAKC;IAED,0BAKC;IAED,eAEC;IAED;;;;OAIG;IACH,UAFW,MAAM,WAIhB;IAED;;;OAGG;IACH,eAFW,UAAU,WAIpB;IAED;;;;;;;OAOG;IACH,SAJW,MAAM,MAAO,QACb,MAAM,MAAO,YACb,OAAO,gBAuEjB;IA/CC,mBAAqB;IAGnB,yBAAiD;IAqBpB,QAAoC;IAI7C,4BAAuB;IAqB/C;;;;;OAKG;IACH,YAHW,MAAM,YACN,OAAO,gBAIjB;IAED;;;OAGG;IACH,eAFW,OAAO,gBAMjB;IAED;;;;OAIG;IACH,kBAFW,MAAM,OAKhB;IAED;;;;;;;;OAQG;IACH,kCAeC;IAED;;;;OAIG;IACH,gBAFW,MAAM,OAKhB;IAED;;;OAGG;IACH,0BAEC;IAED;;;;OAIG;IACH,gBAFW,OAAO,OAgBjB;IAED;;;;;;;OAOG;IACH,WAJW,MAAM,GAAC,UAAU,QACjB,OAAO,GAAC,MAAM,GAAC,MAAM,GAAC,OAAO,YAC7B,OAAO,OAiEjB;IAED;;;;;OAKG;IACH,kBAFW,OAAO,WA2BjB;IAED;;;;OAIG;IACH,WAKC;IAED;;;;;OAKG;IACH,YAHW,OAAO,YACP,OAAO,WAIjB;IAED;;OAEG;IACH,iBAEC;IAED;;;OAGG;IACH,kBAFW,OAAO,WAIjB;IAED;;;;;OAKG;IACH,iBAHW,UAAU,YACV,OAAO,WASjB;CACF"}
|
package/src/types/storage.d.ts
DELETED
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
export default Storage;
|
|
2
|
-
declare class Storage {
|
|
3
|
-
constructor(id: any, type: any, batchedWrites?: boolean);
|
|
4
|
-
storeInitialized: Promise<void>;
|
|
5
|
-
store: any;
|
|
6
|
-
name: any;
|
|
7
|
-
/**
|
|
8
|
-
* @param {'local'|'session'|'indexed'|'in_memory'} type
|
|
9
|
-
* @param {boolean} batchedWrites
|
|
10
|
-
*/
|
|
11
|
-
initStore(type: "local" | "session" | "indexed" | "in_memory", batchedWrites: boolean): Promise<void>;
|
|
12
|
-
flush(): any;
|
|
13
|
-
clear(): Promise<void>;
|
|
14
|
-
sync(): {
|
|
15
|
-
(method: any, model: any, options: any): Promise<void>;
|
|
16
|
-
__name__: string;
|
|
17
|
-
};
|
|
18
|
-
removeCollectionReference(model: any, collection: any): any;
|
|
19
|
-
addCollectionReference(model: any, collection: any): any;
|
|
20
|
-
getCollectionReferenceData(model: any): {};
|
|
21
|
-
save(model: any): Promise<any>;
|
|
22
|
-
create(model: any, options: any): Promise<any>;
|
|
23
|
-
update(model: any): Promise<any>;
|
|
24
|
-
find(model: any): any;
|
|
25
|
-
findAll(): Promise<any[]>;
|
|
26
|
-
destroy(model: any, collection: any): Promise<any>;
|
|
27
|
-
getStorageSize(): any;
|
|
28
|
-
getItemName(id: any): string;
|
|
29
|
-
}
|
|
30
|
-
declare namespace Storage {
|
|
31
|
-
export let sessionStorageInitialized: Promise<void>;
|
|
32
|
-
export { localForage };
|
|
33
|
-
}
|
|
34
|
-
import localForage from 'localforage';
|
|
35
|
-
//# sourceMappingURL=storage.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"storage.d.ts","sourceRoot":"","sources":["../storage.js"],"names":[],"mappings":";AAkBA;IACE,yDAgBC;IATG,gCAA2D;IAE3D,WAAiB;IAMnB,UAAc;IAGhB;;;OAGG;IACH,gBAHW,OAAO,GAAC,SAAS,GAAC,SAAS,GAAC,WAAW,iBACvC,OAAO,iBAgBjB;IAED,aAEC;IAED,uBAMC;IAED;;;MAiFC;IAED,4DAOC;IAED,yDAUC;IAED,2CAYC;IAED,+BAYC;IAED,+CASC;IAED,iCAEC;IAED,sBAEC;IAED,0BASC;IAED,mDAKC;IAED,sBAEC;IAED,6BAEC;CACF;;;;;wBA/OuB,aAAa"}
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Iterates over the standard `event, callback` (as well as the fancy multiple
|
|
3
|
-
* space-separated events `"change blur", callback` and jQuery-style event
|
|
4
|
-
* maps `{event: callback}`).
|
|
5
|
-
*/
|
|
6
|
-
export function eventsApi(iteratee: any, events: any, name: any, callback: any, opts: any): any;
|
|
7
|
-
export function onApi(events: any, name: any, callback: any, options: any): any;
|
|
8
|
-
/**
|
|
9
|
-
* An try-catch guarded #on function, to prevent poisoning the global
|
|
10
|
-
* `_listening` variable.
|
|
11
|
-
* @param {any} obj
|
|
12
|
-
* @param {string} name
|
|
13
|
-
* @param {Function} callback
|
|
14
|
-
* @param {any} context
|
|
15
|
-
*/
|
|
16
|
-
export function tryCatchOn(obj: any, name: string, callback: Function, context: any): any;
|
|
17
|
-
/**
|
|
18
|
-
* The reducing API that removes a callback from the `events` object.
|
|
19
|
-
*/
|
|
20
|
-
export function offApi(events: any, name: any, callback: any, options: any): any;
|
|
21
|
-
/**
|
|
22
|
-
* Reduces the event callbacks into a map of `{event: onceWrapper}`.
|
|
23
|
-
* `offer` unbinds the `onceWrapper` after it has been called.
|
|
24
|
-
*/
|
|
25
|
-
export function onceMap(map: any, name: any, callback: any, offer: any): any;
|
|
26
|
-
/** Handles triggering the appropriate event callbacks. */
|
|
27
|
-
export function triggerApi(objEvents: any, name: any, callback: any, args: any): any;
|
|
28
|
-
//# sourceMappingURL=events.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"events.d.ts","sourceRoot":"","sources":["../../utils/events.js"],"names":[],"mappings":"AAMA;;;;GAIG;AACH,gGAmBC;AAGD,gFAWC;AAED;;;;;;;GAOG;AACH,gCALW,GAAG,QACH,MAAM,+BAEN,GAAG,OAQb;AAED;;GAEG;AACH,iFAkDC;AAED;;;GAGG;AACH,6EASC;AAED,0DAA0D;AAC1D,qFASC"}
|