@kamen/create-webapp 1.0.38 → 1.0.40

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.
Files changed (3) hide show
  1. package/index.js +49 -1
  2. package/package.json +6 -2
  3. package/temporal.js +55 -0
package/index.js CHANGED
@@ -1,5 +1,6 @@
1
1
  const primitiveTypeRe = /^string|number|bigint|boolean|symbol$/;
2
2
  const objectTypeRe = /^object|function$/;
3
+ export {default as temporal} from './temporal.js';
3
4
 
4
5
  /**
5
6
  * @param {*} value
@@ -298,6 +299,53 @@ export class URLBuilder {
298
299
  }
299
300
  }
300
301
 
302
+ export class WrappedIndexManager 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
+
301
349
  export const introspection = {
302
350
  isPrimitive,
303
351
  isObject
@@ -316,4 +364,4 @@ export const randomness = {
316
364
  createRandomFromList,
317
365
  randomColorFromSaturationLightnessAlpha,
318
366
  createRandomColorFromSaturationLightnessAlpha
319
- };
367
+ };
package/package.json CHANGED
@@ -1,11 +1,15 @@
1
1
  {
2
2
  "name": "@kamen/create-webapp",
3
- "version": "1.0.38",
3
+ "version": "1.0.40",
4
4
  "description": "npm init @kamen/webapp",
5
5
  "homepage": "https://www.npmjs.com/package/@kamen/create-webapp",
6
6
  "license": "GPL-2.0-only",
7
7
  "private": false,
8
- "keywords": ["init", "utlity", "web"],
8
+ "keywords": [
9
+ "init",
10
+ "utlity",
11
+ "web"
12
+ ],
9
13
  "type": "module",
10
14
  "main": "index.js",
11
15
  "bin": {
package/temporal.js ADDED
@@ -0,0 +1,55 @@
1
+ const WEEKS_PER_YEAR = 52;
2
+
3
+ const DAYS_PER_WEEK = 7;
4
+ const DAYS_PER_YEAR = DAYS_PER_WEEK * WEEKS_PER_YEAR;
5
+
6
+ const HOURS_PER_DAY = 24;
7
+ const HOURS_PER_WEEK = HOURS_PER_DAY * DAYS_PER_WEEK;
8
+ const HOURS_PER_YEAR = HOURS_PER_WEEK * WEEKS_PER_YEAR;
9
+
10
+ const MINUTES_PER_HOUR = 60;
11
+ const MINUTES_PER_DAY = MINUTES_PER_HOUR * HOURS_PER_DAY;
12
+ const MINUTES_PER_WEEK = MINUTES_PER_DAY * DAYS_PER_WEEK;
13
+ const MINUTES_PER_YEAR = MINUTES_PER_WEEK * WEEKS_PER_YEAR;
14
+
15
+ const SECONDS_PER_MINUTE = 60;
16
+ const SECONDS_PER_HOUR = SECONDS_PER_MINUTE * MINUTES_PER_HOUR;
17
+ const SECONDS_PER_DAY = SECONDS_PER_HOUR * HOURS_PER_DAY;
18
+ const SECONDS_PER_WEEK = SECONDS_PER_DAY * DAYS_PER_WEEK;
19
+ const SECONDS_PER_YEAR = SECONDS_PER_WEEK * WEEKS_PER_YEAR;
20
+
21
+ const MILLISECONDS_PER_SECOND = 1000;
22
+ const MILLISECONDS_PER_MINUTE = MILLISECONDS_PER_SECOND * SECONDS_PER_MINUTE;
23
+ const MILLISECONDS_PER_HOUR = MILLISECONDS_PER_MINUTE * MINUTES_PER_HOUR;
24
+ const MILLISECONDS_PER_DAY = MILLISECONDS_PER_HOUR * HOURS_PER_DAY;
25
+ const MILLISECONDS_PER_WEEK = MILLISECONDS_PER_DAY * DAYS_PER_WEEK;
26
+ const MILLISECONDS_PER_YEAR = MILLISECONDS_PER_WEEK * WEEKS_PER_YEAR;
27
+
28
+ export default {
29
+ WEEKS_PER_YEAR,
30
+
31
+ DAYS_PER_WEEK,
32
+ DAYS_PER_YEAR,
33
+
34
+ HOURS_PER_DAY,
35
+ HOURS_PER_WEEK,
36
+ HOURS_PER_YEAR,
37
+
38
+ MINUTES_PER_HOUR,
39
+ MINUTES_PER_DAY,
40
+ MINUTES_PER_WEEK,
41
+ MINUTES_PER_YEAR,
42
+
43
+ SECONDS_PER_MINUTE,
44
+ SECONDS_PER_HOUR,
45
+ SECONDS_PER_DAY,
46
+ SECONDS_PER_WEEK,
47
+ SECONDS_PER_YEAR,
48
+
49
+ MILLISECONDS_PER_SECOND,
50
+ MILLISECONDS_PER_MINUTE,
51
+ MILLISECONDS_PER_HOUR,
52
+ MILLISECONDS_PER_DAY,
53
+ MILLISECONDS_PER_WEEK,
54
+ MILLISECONDS_PER_YEAR
55
+ };