@converse/skeletor 0.0.8 → 0.0.9
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 +38 -25
- package/dist/skeletor.js +9232 -5096
- package/dist/skeletor.js.map +1 -1
- package/dist/skeletor.min.js +74 -3
- package/dist/skeletor.min.js.map +1 -1
- package/package.json +21 -11
- package/src/collection.js +540 -395
- package/src/drivers/sessionStorage.js +222 -219
- package/src/element.js +132 -82
- package/src/eventemitter.js +187 -0
- package/src/helpers.js +143 -118
- package/src/{main.js → index.js} +21 -17
- package/src/listening.js +81 -0
- package/src/model.js +340 -238
- package/src/storage.js +222 -230
- package/src/types/collection.d.ts +366 -0
- package/src/types/collection.d.ts.map +1 -0
- package/src/types/drivers/sessionStorage.d.ts +37 -0
- package/src/types/drivers/sessionStorage.d.ts.map +1 -0
- package/src/types/element.d.ts +115 -0
- package/src/types/element.d.ts.map +1 -0
- package/src/types/eventemitter.d.ts +93 -0
- package/src/types/eventemitter.d.ts.map +1 -0
- package/src/types/helpers.d.ts +62 -0
- package/src/types/helpers.d.ts.map +1 -0
- package/src/types/index.d.ts +19 -0
- package/src/types/index.d.ts.map +1 -0
- package/src/types/listening.d.ts +40 -0
- package/src/types/listening.d.ts.map +1 -0
- package/src/types/model.d.ts +230 -0
- package/src/types/model.d.ts.map +1 -0
- package/src/types/storage.d.ts +35 -0
- package/src/types/storage.d.ts.map +1 -0
- package/src/types/utils/events.d.ts +28 -0
- package/src/types/utils/events.d.ts.map +1 -0
- package/src/utils/events.js +174 -0
- package/src/drivers/sessionStorage.js~ +0 -307
- package/src/events.js +0 -328
- package/src/history.js +0 -301
- package/src/overview.js +0 -191
- package/src/router.js +0 -119
- package/src/view.js +0 -267
|
@@ -0,0 +1,366 @@
|
|
|
1
|
+
export type Options = Record<string, any>;
|
|
2
|
+
export type Attributes = Record<string, any>;
|
|
3
|
+
export type Storage = import("./storage.js").default;
|
|
4
|
+
export type CollectionOptions = Record<string, any>;
|
|
5
|
+
declare const Collection_base: {
|
|
6
|
+
new (...args: any[]): {
|
|
7
|
+
on(name: string, callback: (event: any, model: Model, collection: 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: Collection, options: Record<string, any>) => any): /*elided*/ any;
|
|
11
|
+
_listeningTo: {};
|
|
12
|
+
_listenId: any;
|
|
13
|
+
off(name: string, callback: (event: any, model: Model, collection: Collection, options: Record<string, any>) => any, context?: any): /*elided*/ any;
|
|
14
|
+
stopListening(obj?: any, name?: string, callback?: (event: any, model: Model, collection: Collection, options: Record<string, any>) => any): /*elided*/ any;
|
|
15
|
+
once(name: string, callback: (event: any, model: Model, collection: Collection, options: Record<string, any>) => any, context: any): /*elided*/ any;
|
|
16
|
+
listenToOnce(obj: any, name: string, callback?: (event: any, model: Model, collection: Collection, options: Record<string, any>) => any): /*elided*/ any;
|
|
17
|
+
trigger(name: string, ...args: any[]): /*elided*/ any;
|
|
18
|
+
};
|
|
19
|
+
} & ObjectConstructor;
|
|
20
|
+
/**
|
|
21
|
+
* @typedef {Record.<string, any>} Options
|
|
22
|
+
* @typedef {Record.<string, any>} Attributes
|
|
23
|
+
*
|
|
24
|
+
* @typedef {import('./storage.js').default} Storage
|
|
25
|
+
*
|
|
26
|
+
* @typedef {Record.<string, any>} CollectionOptions
|
|
27
|
+
* @property {Model} [model]
|
|
28
|
+
* @property {Function} [comparator]
|
|
29
|
+
*/
|
|
30
|
+
/**
|
|
31
|
+
* If models tend to represent a single row of data, a Collection is
|
|
32
|
+
* more analogous to a table full of data ... or a small slice or page of that
|
|
33
|
+
* table, or a collection of rows that belong together for a particular reason
|
|
34
|
+
* -- all of the messages in this particular folder, all of the documents
|
|
35
|
+
* belonging to this particular author, and so on. Collections maintain
|
|
36
|
+
* indexes of their models, both in order, and for lookup by `id`.
|
|
37
|
+
*/
|
|
38
|
+
export class Collection extends Collection_base {
|
|
39
|
+
/**
|
|
40
|
+
* Create a new **Collection**, perhaps to contain a specific type of `model`.
|
|
41
|
+
* If a `comparator` is specified, the Collection will maintain
|
|
42
|
+
* its models in sort order, as they're added and removed.
|
|
43
|
+
* @param {Model[]} [models]
|
|
44
|
+
* @param {CollectionOptions} [options]
|
|
45
|
+
*/
|
|
46
|
+
constructor(models?: Model[], options?: CollectionOptions, ...args: any[]);
|
|
47
|
+
_model: any;
|
|
48
|
+
comparator: any;
|
|
49
|
+
/**
|
|
50
|
+
* @param {Storage} storage
|
|
51
|
+
*/
|
|
52
|
+
set browserStorage(storage: Storage);
|
|
53
|
+
/**
|
|
54
|
+
* @returns {Storage} storage
|
|
55
|
+
*/
|
|
56
|
+
get browserStorage(): Storage;
|
|
57
|
+
_browserStorage: import("./storage.js").default;
|
|
58
|
+
/**
|
|
59
|
+
* @param {Model} model
|
|
60
|
+
*/
|
|
61
|
+
set model(model: Model);
|
|
62
|
+
/**
|
|
63
|
+
* The default model for a collection is just a **Model**.
|
|
64
|
+
* This should be overridden in most cases.
|
|
65
|
+
* @returns {typeof Model}
|
|
66
|
+
*/
|
|
67
|
+
get model(): typeof Model;
|
|
68
|
+
get length(): any;
|
|
69
|
+
/**
|
|
70
|
+
* preinitialize is an empty function by default. You can override it with a function
|
|
71
|
+
* or object. preinitialize will run before any instantiation logic is run in the Collection.
|
|
72
|
+
*/
|
|
73
|
+
preinitialize(): void;
|
|
74
|
+
/**
|
|
75
|
+
* Initialize is an empty function by default. Override it with your own
|
|
76
|
+
* initialization logic.
|
|
77
|
+
*/
|
|
78
|
+
initialize(): void;
|
|
79
|
+
/**
|
|
80
|
+
* The JSON representation of a Collection is an array of the
|
|
81
|
+
* models' attributes.
|
|
82
|
+
*@param {Options} options
|
|
83
|
+
*/
|
|
84
|
+
toJSON(options: Options): any;
|
|
85
|
+
/**
|
|
86
|
+
*@param {string} method
|
|
87
|
+
*@param {Model|Collection} model
|
|
88
|
+
*@param {Options} options
|
|
89
|
+
*/
|
|
90
|
+
sync(method: string, model: Model | Collection, options: Options): any;
|
|
91
|
+
/**
|
|
92
|
+
* Add a model, or list of models to the set. `models` may be
|
|
93
|
+
* Models or raw JavaScript objects to be converted to Models, or any
|
|
94
|
+
* combination of the two.
|
|
95
|
+
*@param {Model[]|Model|Attributes|Attributes[]} models
|
|
96
|
+
*@param {Options} options
|
|
97
|
+
*/
|
|
98
|
+
add(models: Model[] | Model | Attributes | Attributes[], options: Options): any;
|
|
99
|
+
/**
|
|
100
|
+
* Remove a model, or a list of models from the set.
|
|
101
|
+
* @param {Model|Model[]} models
|
|
102
|
+
* @param {Options} options
|
|
103
|
+
*/
|
|
104
|
+
remove(models: Model | Model[], options: Options): any;
|
|
105
|
+
/**
|
|
106
|
+
* Update a collection by `set`-ing a new list of models, adding new ones,
|
|
107
|
+
* removing models that are no longer present, and merging models that
|
|
108
|
+
* already exist in the collection, as necessary. Similar to **Model#set**,
|
|
109
|
+
* the core operation for updating the data contained by the collection.
|
|
110
|
+
*@param {Model[]|Model|Attributes|Attributes[]} models
|
|
111
|
+
* @param {Options} options
|
|
112
|
+
*/
|
|
113
|
+
set(models: Model[] | Model | Attributes | Attributes[], options: Options): any;
|
|
114
|
+
clearStore(options?: {}, filter?: (o: any) => any): Promise<void>;
|
|
115
|
+
/**
|
|
116
|
+
* When you have more items than you want to add or remove individually,
|
|
117
|
+
* you can reset the entire set with a new list of models, without firing
|
|
118
|
+
* any granular `add` or `remove` events. Fires `reset` when finished.
|
|
119
|
+
* Useful for bulk operations and optimizations.
|
|
120
|
+
* @param {Model|Model[]} [models]
|
|
121
|
+
* @param {Options} [options]
|
|
122
|
+
*/
|
|
123
|
+
reset(models?: Model | Model[], options?: Options): Model | Model[];
|
|
124
|
+
/**
|
|
125
|
+
* Add a model to the end of the collection.
|
|
126
|
+
* @param {Model} model
|
|
127
|
+
* @param {Options} [options]
|
|
128
|
+
*/
|
|
129
|
+
push(model: Model, options?: Options): any;
|
|
130
|
+
/**
|
|
131
|
+
* Remove a model from the end of the collection.
|
|
132
|
+
* @param {Options} [options]
|
|
133
|
+
*/
|
|
134
|
+
pop(options?: Options): any;
|
|
135
|
+
/**
|
|
136
|
+
* Add a model to the beginning of the collection.
|
|
137
|
+
* @param {Model} model
|
|
138
|
+
* @param {Options} [options]
|
|
139
|
+
*/
|
|
140
|
+
unshift(model: Model, options?: Options): any;
|
|
141
|
+
/**
|
|
142
|
+
* Remove a model from the beginning of the collection.
|
|
143
|
+
* @param {Options} [options]
|
|
144
|
+
*/
|
|
145
|
+
shift(options?: Options): any;
|
|
146
|
+
/** Slice out a sub-array of models from the collection. */
|
|
147
|
+
slice(...args: any[]): any;
|
|
148
|
+
/**
|
|
149
|
+
* @param {Function|Object} callback
|
|
150
|
+
* @param {any} thisArg
|
|
151
|
+
*/
|
|
152
|
+
filter(callback: Function | any, thisArg: any): any;
|
|
153
|
+
/**
|
|
154
|
+
* @param {Function} pred
|
|
155
|
+
*/
|
|
156
|
+
every(pred: Function): any;
|
|
157
|
+
/**
|
|
158
|
+
* @param {Model[]} values
|
|
159
|
+
*/
|
|
160
|
+
difference(values: Model[]): any;
|
|
161
|
+
max(): any;
|
|
162
|
+
min(): any;
|
|
163
|
+
drop(n?: number): any;
|
|
164
|
+
/**
|
|
165
|
+
* @param {Function|Object} pred
|
|
166
|
+
*/
|
|
167
|
+
some(pred: Function | any): any;
|
|
168
|
+
sortBy(iteratee: any): any;
|
|
169
|
+
isEmpty(): boolean;
|
|
170
|
+
keyBy(iteratee: any): any;
|
|
171
|
+
each(callback: any, thisArg: any): any;
|
|
172
|
+
forEach(callback: any, thisArg: any): any;
|
|
173
|
+
includes(item: any): any;
|
|
174
|
+
size(): any;
|
|
175
|
+
countBy(f: any): any;
|
|
176
|
+
groupBy(pred: any): any;
|
|
177
|
+
/**
|
|
178
|
+
* @param {number} fromIndex
|
|
179
|
+
*/
|
|
180
|
+
indexOf(fromIndex: number): any;
|
|
181
|
+
/**
|
|
182
|
+
* @param {Function|string|RegExp} pred
|
|
183
|
+
* @param {number} fromIndex
|
|
184
|
+
*/
|
|
185
|
+
findLastIndex(pred: Function | string | RegExp, fromIndex: number): any;
|
|
186
|
+
/**
|
|
187
|
+
* @param {number} fromIndex
|
|
188
|
+
*/
|
|
189
|
+
lastIndexOf(fromIndex: number): any;
|
|
190
|
+
/**
|
|
191
|
+
* @param {Function|string|RegExp} pred
|
|
192
|
+
*/
|
|
193
|
+
findIndex(pred: Function | string | RegExp): any;
|
|
194
|
+
last(): any;
|
|
195
|
+
head(): any;
|
|
196
|
+
first(): any;
|
|
197
|
+
map(cb: any, thisArg: any): any;
|
|
198
|
+
reduce(callback: any, initialValue: any): any;
|
|
199
|
+
reduceRight(callback: any, initialValue: any): any;
|
|
200
|
+
toArray(): any[];
|
|
201
|
+
/**
|
|
202
|
+
* Get a model from the set by id, cid, model object with id or cid
|
|
203
|
+
* properties, or an attributes object that is transformed through modelId.
|
|
204
|
+
* @param {string|number|Object|Model} obj
|
|
205
|
+
*/
|
|
206
|
+
get(obj: string | number | any | Model): any;
|
|
207
|
+
/**
|
|
208
|
+
* Returns `true` if the model is in the collection.
|
|
209
|
+
* @param {string|number|Object|Model} obj
|
|
210
|
+
*/
|
|
211
|
+
has(obj: string | number | any | Model): boolean;
|
|
212
|
+
/**
|
|
213
|
+
* Get the model at the given index.
|
|
214
|
+
* @param {number} index
|
|
215
|
+
*/
|
|
216
|
+
at(index: number): any;
|
|
217
|
+
/**
|
|
218
|
+
* Return models with matching attributes. Useful for simple cases of
|
|
219
|
+
* `filter`.
|
|
220
|
+
* @param {Attributes} attrs
|
|
221
|
+
* @param {boolean} [first]
|
|
222
|
+
*/
|
|
223
|
+
where(attrs: Attributes, first?: boolean): any;
|
|
224
|
+
/**
|
|
225
|
+
* Return the first model with matching attributes. Useful for simple cases
|
|
226
|
+
* of `find`.
|
|
227
|
+
* @param {Attributes} attrs
|
|
228
|
+
*/
|
|
229
|
+
findWhere(attrs: Attributes): any;
|
|
230
|
+
/**
|
|
231
|
+
* @param {Attributes} predicate
|
|
232
|
+
* @param {number} [fromIndex]
|
|
233
|
+
*/
|
|
234
|
+
find(predicate: Attributes, fromIndex?: number): any;
|
|
235
|
+
/**
|
|
236
|
+
* Force the collection to re-sort itself. You don't need to call this under
|
|
237
|
+
* normal circumstances, as the set will maintain sort order as each item
|
|
238
|
+
* is added.
|
|
239
|
+
* @param {Options} [options]
|
|
240
|
+
*/
|
|
241
|
+
sort(options?: Options): this;
|
|
242
|
+
models: any;
|
|
243
|
+
/**
|
|
244
|
+
* Pluck an attribute from each model in the collection.
|
|
245
|
+
* @param {string} attr
|
|
246
|
+
*/
|
|
247
|
+
pluck(attr: string): any;
|
|
248
|
+
/**
|
|
249
|
+
* Fetch the default set of models for this collection, resetting the
|
|
250
|
+
* collection when they arrive. If `reset: true` is passed, the response
|
|
251
|
+
* data will be passed through the `reset` method instead of `set`.
|
|
252
|
+
* @param {Options} options
|
|
253
|
+
*/
|
|
254
|
+
fetch(options: Options): any;
|
|
255
|
+
/**
|
|
256
|
+
* Create a new instance of a model in this collection. Add the model to the
|
|
257
|
+
* collection immediately, unless `wait: true` is passed, in which case we
|
|
258
|
+
* wait for the server to agree.
|
|
259
|
+
* @param {Model|Attributes} model
|
|
260
|
+
* @param {Options} [options]
|
|
261
|
+
*/
|
|
262
|
+
create(model: Model | Attributes, options?: Options): false | Model | (Promise<any> & {
|
|
263
|
+
isResolved: boolean;
|
|
264
|
+
isPending: boolean;
|
|
265
|
+
isRejected: boolean;
|
|
266
|
+
resolve: Function;
|
|
267
|
+
reject: Function;
|
|
268
|
+
}) | Attributes;
|
|
269
|
+
/**
|
|
270
|
+
* **parse** converts a response into a list of models to be added to the
|
|
271
|
+
* collection. The default implementation is just to pass it through.
|
|
272
|
+
* @param {Object} resp
|
|
273
|
+
* @param {Options} [options]
|
|
274
|
+
*/
|
|
275
|
+
parse(resp: any, options?: Options): any;
|
|
276
|
+
/**
|
|
277
|
+
* Define how to uniquely identify models in the collection.
|
|
278
|
+
* @param {Attributes} attrs
|
|
279
|
+
*/
|
|
280
|
+
modelId(attrs: Attributes): any;
|
|
281
|
+
/** Get an iterator of all models in this collection. */
|
|
282
|
+
values(): CollectionIterator;
|
|
283
|
+
/** Get an iterator of all model IDs in this collection. */
|
|
284
|
+
keys(): CollectionIterator;
|
|
285
|
+
/** Get an iterator of all [ID, model] tuples in this collection. */
|
|
286
|
+
entries(): CollectionIterator;
|
|
287
|
+
/**
|
|
288
|
+
* Private method to reset all internal state. Called when the collection
|
|
289
|
+
* is first initialized or reset.
|
|
290
|
+
*/
|
|
291
|
+
_reset(): void;
|
|
292
|
+
_byId: {};
|
|
293
|
+
/**
|
|
294
|
+
* @param {Attributes} attrs
|
|
295
|
+
* @param {Options} [options]
|
|
296
|
+
*/
|
|
297
|
+
createModel(attrs: Attributes, options?: Options): Model;
|
|
298
|
+
/**
|
|
299
|
+
* Prepare a hash of attributes (or other model) to be added to this
|
|
300
|
+
* collection.
|
|
301
|
+
* @param {Attributes|Model} attrs
|
|
302
|
+
* @param {Options} [options]
|
|
303
|
+
* @return {Model}
|
|
304
|
+
*/
|
|
305
|
+
_prepareModel(attrs: Attributes | Model, options?: Options): Model;
|
|
306
|
+
/**
|
|
307
|
+
* Internal method called by both remove and set.
|
|
308
|
+
* @param {Model[]} models
|
|
309
|
+
* @param {Options} [options]
|
|
310
|
+
*/
|
|
311
|
+
_removeModels(models: Model[], options?: Options): any[];
|
|
312
|
+
/**
|
|
313
|
+
* Method for checking whether an object should be considered a model for
|
|
314
|
+
* the purposes of adding to the collection.
|
|
315
|
+
* @param {any} model
|
|
316
|
+
*/
|
|
317
|
+
_isModel(model: any): model is Model;
|
|
318
|
+
/**
|
|
319
|
+
* Internal method to create a model's ties to a collection.
|
|
320
|
+
* @param {Model} model
|
|
321
|
+
* @param {Options} [options]
|
|
322
|
+
*/
|
|
323
|
+
_addReference(model: Model, options?: Options): void;
|
|
324
|
+
/**
|
|
325
|
+
* Internal method to sever a model's ties to a collection.
|
|
326
|
+
* @private
|
|
327
|
+
* @param {Model} model
|
|
328
|
+
* @param {Options} [options]
|
|
329
|
+
*/
|
|
330
|
+
private _removeReference;
|
|
331
|
+
/**
|
|
332
|
+
* Internal method called every time a model in the set fires an event.
|
|
333
|
+
* Sets need to update their indexes when models change ids. All other
|
|
334
|
+
* events simply proxy through. "add" and "remove" events that originate
|
|
335
|
+
* in other collections are ignored.
|
|
336
|
+
* @private
|
|
337
|
+
* @param {any} event
|
|
338
|
+
* @param {Model} model
|
|
339
|
+
* @param {Collection} collection
|
|
340
|
+
* @param {Options} [options]
|
|
341
|
+
*/
|
|
342
|
+
private _onModelEvent;
|
|
343
|
+
[Symbol.iterator]: () => CollectionIterator;
|
|
344
|
+
}
|
|
345
|
+
import { Model } from './model.js';
|
|
346
|
+
declare class CollectionIterator {
|
|
347
|
+
/**
|
|
348
|
+
* A CollectionIterator implements JavaScript's Iterator protocol, allowing the
|
|
349
|
+
* use of `for of` loops in modern browsers and interoperation between
|
|
350
|
+
* Collection and other JavaScript functions and third-party libraries
|
|
351
|
+
* which can operate on Iterables.
|
|
352
|
+
* @param {Collection} collection
|
|
353
|
+
* @param {Number} kind
|
|
354
|
+
*/
|
|
355
|
+
constructor(collection: Collection, kind: number);
|
|
356
|
+
_collection: Collection;
|
|
357
|
+
_kind: number;
|
|
358
|
+
_index: number;
|
|
359
|
+
next(): {
|
|
360
|
+
value: any;
|
|
361
|
+
done: boolean;
|
|
362
|
+
};
|
|
363
|
+
[Symbol.iterator](): this;
|
|
364
|
+
}
|
|
365
|
+
export {};
|
|
366
|
+
//# sourceMappingURL=collection.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"collection.d.ts","sourceRoot":"","sources":["../collection.js"],"names":[],"mappings":"sBAkBa,MAAM,CAAE,MAAM,EAAE,GAAG,CAAC;yBACpB,MAAM,CAAE,MAAM,EAAE,GAAG,CAAC;sBAEpB,OAAO,cAAc,EAAE,OAAO;gC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MG;IACH,qBAJW,UAAU,GAAC,KAAK,YAChB,OAAO,GACN,KAAK,CAahB;IAED;;;;OAIG;IACH,sBAHW,KAAK,EAAE,YACP,OAAO,SA0BjB;IAED;;;;OAIG;IACH,gBAFW,GAAG,kBAIb;IAED;;;;OAIG;IACH,qBAHW,KAAK,YACL,OAAO,QAOjB;IAED;;;;;OAKG;IACH,yBAMC;IAED;;;;;;;;;;OAUG;IACH,sBAcC;IAjwBC,4CAAmC;CAkwBtC;sBAvzBqB,YAAY;AAg0BlC;IACE;;;;;;;OAOG;IACH,wBAHW,UAAU,gBAOpB;IAHC,wBAA6B;IAC7B,cAAiB;IACjB,eAAe;IAGjB;;;MA6BC;IAED,0BAEC;CACF"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
export default sessionStorageWrapper;
|
|
2
|
+
declare namespace sessionStorageWrapper {
|
|
3
|
+
export let _driver: string;
|
|
4
|
+
export { _initStorage };
|
|
5
|
+
export let _support: boolean;
|
|
6
|
+
export { iterate };
|
|
7
|
+
export { getItem };
|
|
8
|
+
export { setItem };
|
|
9
|
+
export { removeItem };
|
|
10
|
+
export { clear };
|
|
11
|
+
export { length };
|
|
12
|
+
export { key };
|
|
13
|
+
export { keys };
|
|
14
|
+
export { dropInstance };
|
|
15
|
+
}
|
|
16
|
+
declare function _initStorage(options: any): void;
|
|
17
|
+
declare function iterate(iterator: any, callback: any): any;
|
|
18
|
+
declare function getItem(key: any, callback: any): any;
|
|
19
|
+
/**
|
|
20
|
+
* Set a key's value and run an optional callback once the value is set.
|
|
21
|
+
* Unlike Gaia's implementation, the callback function is passed the value,
|
|
22
|
+
* in case you want to operate on that value only after you're sure it
|
|
23
|
+
* saved, or something like that.
|
|
24
|
+
* @template T
|
|
25
|
+
* @param {string} key - The key under which the value is stored.
|
|
26
|
+
* @param {T} value - The value to be stored, can be of any type.
|
|
27
|
+
* @param {(err: any, value: T) => void} [callback] - Optional callback function to be called after the value is set.
|
|
28
|
+
* @returns {Promise<T>}
|
|
29
|
+
*/
|
|
30
|
+
declare function setItem<T>(key: string, value: T, callback?: (err: any, value: T) => void): Promise<T>;
|
|
31
|
+
declare function removeItem(key: any, callback: any): any;
|
|
32
|
+
declare function clear(callback: any): any;
|
|
33
|
+
declare function length(callback: any): any;
|
|
34
|
+
declare function key(n: any, callback: any): any;
|
|
35
|
+
declare function keys(callback: any): any;
|
|
36
|
+
declare function dropInstance(options: any, callback: any, ...args: any[]): Promise<void>;
|
|
37
|
+
//# sourceMappingURL=sessionStorage.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sessionStorage.d.ts","sourceRoot":"","sources":["../../drivers/sessionStorage.js"],"names":[],"mappings":";;;;;;;;;;;;;;;AA0DA,kDAQC;AA2CD,4DA0CC;AA7DD,uDAgBC;AA8GD;;;;;;;;;;GAUG;AACH,yBANa,CAAC,OACH,MAAM,SACN,CAAC,aACD,CAAC,GAAG,EAAE,GAAG,EAAE,KAAK,EAAE,CAAC,KAAK,IAAI,GAC1B,OAAO,CAAC,CAAC,CAAC,CA+BtB;AAjDD,0DAOC;AAhJD,2CAeC;AA+GD,4CAQC;AAlDD,iDAoBC;AAED,0CAiBC;AAiED,0FAiCC"}
|
|
@@ -0,0 +1,115 @@
|
|
|
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
|
|
@@ -0,0 +1 @@
|
|
|
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"}
|
|
@@ -0,0 +1,93 @@
|
|
|
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
|
|
@@ -0,0 +1 @@
|
|
|
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"}
|