@kamen/create-webapp 1.0.39 → 1.0.41
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/index.js +48 -1
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -299,6 +299,53 @@ export class URLBuilder {
|
|
|
299
299
|
}
|
|
300
300
|
}
|
|
301
301
|
|
|
302
|
+
export class WrappedListIndexManager extends EventTarget {
|
|
303
|
+
#counter = 0;
|
|
304
|
+
#length = 16;
|
|
305
|
+
#step = 1;
|
|
306
|
+
|
|
307
|
+
static create() {
|
|
308
|
+
return new this;
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
#dispatchEvent(detail = this.getIndex()) {
|
|
312
|
+
return this.dispatchEvent(new CustomEvent('change', {detail}));
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
setCounter(counter = 0) {
|
|
316
|
+
this.#counter = counter;
|
|
317
|
+
this.#dispatchEvent();
|
|
318
|
+
return this;
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
setLength(length = 16) {
|
|
322
|
+
this.#length = length;
|
|
323
|
+
this.#dispatchEvent();
|
|
324
|
+
return this;
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
setStep(step = 1) {
|
|
328
|
+
this.#step = step;
|
|
329
|
+
return this;
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
increment(step = this.#step) {
|
|
333
|
+
this.#counter += step;
|
|
334
|
+
this.#dispatchEvent();
|
|
335
|
+
return this;
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
decrement(step = this.#step) {
|
|
339
|
+
this.#counter -= step;
|
|
340
|
+
this.#dispatchEvent();
|
|
341
|
+
return this;
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
getIndex() {
|
|
345
|
+
return modulo(this.#counter, this.#length);
|
|
346
|
+
}
|
|
347
|
+
}
|
|
348
|
+
|
|
302
349
|
export const introspection = {
|
|
303
350
|
isPrimitive,
|
|
304
351
|
isObject
|
|
@@ -317,4 +364,4 @@ export const randomness = {
|
|
|
317
364
|
createRandomFromList,
|
|
318
365
|
randomColorFromSaturationLightnessAlpha,
|
|
319
366
|
createRandomColorFromSaturationLightnessAlpha
|
|
320
|
-
};
|
|
367
|
+
};
|