@drincs/nqtr 0.1.0 → 0.1.1

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/dist/index.mjs CHANGED
@@ -60,6 +60,7 @@ var TimeManager = class _TimeManager {
60
60
  }
61
61
  /**
62
62
  * Get time settings
63
+ * @default {}
63
64
  */
64
65
  static get settings() {
65
66
  let settings = GameStorageManager.getVariable(TIME_SETTINGS_KEY) || {};
@@ -182,12 +183,13 @@ var TimeManager = class _TimeManager {
182
183
  /**
183
184
  * Get the current week day name. If the week days names are not defined, then it will return undefined.
184
185
  * For example, if the week days names are ['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday'] and the current day is 10, then the result will be 'Thursday'.
186
+ * @default ""
185
187
  */
186
188
  static get currentDayName() {
187
189
  let weekDayNumber = _TimeManager.currentWeekDayNumber - 1;
188
190
  if (weekDayNumber >= _TimeManager.weekDaysNames.length) {
189
191
  console.warn(`[NQTR] Week day name is not defined for day ${weekDayNumber}`, _TimeManager.weekDaysNames);
190
- return void 0;
192
+ return "";
191
193
  }
192
194
  return _TimeManager.weekDaysNames[weekDayNumber];
193
195
  }
@@ -217,7 +219,7 @@ var TimeManager = class _TimeManager {
217
219
  }
218
220
  }
219
221
  }
220
- return 0;
222
+ return _TimeManager.timeSlots.length - 1;
221
223
  }
222
224
  /**
223
225
  * This function will increase the current hour by the given time spent.
@@ -263,6 +265,10 @@ var TimeManager = class _TimeManager {
263
265
 
264
266
  // src/classes/Activity.ts
265
267
  var ActivityStoredAbstract = class {
268
+ /**
269
+ * @param onRun The function that is called when the activity is runned. Have 2 parameters: the runned activity and the yourParams object, that is an object with the parameters that you want to pass to the onRun function.
270
+ * @param props The activity properties.
271
+ */
266
272
  constructor(onRun, props) {
267
273
  this.defaultName = props.name;
268
274
  this.defaultFromHour = props.fromHour;
@@ -274,36 +280,54 @@ var ActivityStoredAbstract = class {
274
280
  this._icon = props.icon;
275
281
  this._onRun = onRun;
276
282
  }
283
+ /**
284
+ * The name
285
+ */
277
286
  get name() {
278
287
  return this.getStorageProperty("name") || this.defaultName || "";
279
288
  }
280
289
  set name(value) {
281
290
  this.setStorageProperty("name", value);
282
291
  }
292
+ /**
293
+ * The hour when the activity starts. If the activity is not started yet, it will be hidden.
294
+ */
283
295
  get fromHour() {
284
296
  return this.getStorageProperty("fromHour") || this.defaultFromHour || TimeManager.minDayHours;
285
297
  }
286
298
  set fromHour(value) {
287
299
  this.setStorageProperty("fromHour", value);
288
300
  }
301
+ /**
302
+ * The hour when the activity ends. If the activity is ended yet, it will be hidden.
303
+ */
289
304
  get toHour() {
290
305
  return this.getStorageProperty("toHour") || this.defaultToHour || TimeManager.maxDayHours + 1;
291
306
  }
292
307
  set toHour(value) {
293
308
  this.setStorageProperty("toHour", value);
294
309
  }
310
+ /**
311
+ * The day when the activity starts. If the activity is not started yet, it will be hidden.
312
+ */
295
313
  get fromDay() {
296
314
  return this.getStorageProperty("fromDay") || this.defaultFromDay;
297
315
  }
298
316
  set fromDay(value) {
299
317
  this.setStorageProperty("fromDay", value);
300
318
  }
319
+ /**
320
+ * The day when the activity ends. If the activity is ended yet, it will be deleted or hidden.
321
+ */
301
322
  get toDay() {
302
323
  return this.getStorageProperty("toDay") || this.defaultToDay;
303
324
  }
304
325
  set toDay(value) {
305
326
  this.setStorageProperty("toDay", value);
306
327
  }
328
+ /**
329
+ * Whether is disabled.
330
+ */
307
331
  get disabled() {
308
332
  let value = this.getStorageProperty("disabled") || this.defaultDisabled;
309
333
  if (typeof value === "string") {
@@ -314,6 +338,9 @@ var ActivityStoredAbstract = class {
314
338
  set disabled(value) {
315
339
  this.setStorageProperty("disabled", value);
316
340
  }
341
+ /**
342
+ * Whether is hidden. If the activity is not started yet, it will be hidden.
343
+ */
317
344
  get hidden() {
318
345
  if (this.fromDay && this.fromDay > TimeManager.currentDay) {
319
346
  return true;
@@ -333,18 +360,32 @@ var ActivityStoredAbstract = class {
333
360
  set hidden(value) {
334
361
  this.setStorageProperty("hidden", value);
335
362
  }
363
+ /**
364
+ * The icon element.
365
+ */
336
366
  get icon() {
337
367
  return this._icon;
338
368
  }
369
+ /**
370
+ * The function that is called when the activity is runned.
371
+ */
339
372
  get onRun() {
340
373
  return () => this._onRun(this);
341
374
  }
375
+ /**
376
+ * Whether the activity is a deadline.
377
+ * @returns Whether the activity is a deadline.
378
+ */
342
379
  isExpired() {
343
380
  if (this.toDay && this.toDay <= TimeManager.currentDay) {
344
381
  return true;
345
382
  }
346
383
  return false;
347
384
  }
385
+ /**
386
+ * Export the activity properties.
387
+ * @returns The activity properties.
388
+ */
348
389
  export() {
349
390
  return {
350
391
  name: this.getStorageProperty("name") || this.defaultName,
@@ -359,6 +400,11 @@ var ActivityStoredAbstract = class {
359
400
  }
360
401
  };
361
402
  var ActivityModel = class {
403
+ /**
404
+ * @param id The activity id, that must be unique.
405
+ * @param onRun The function that is called when the activity is runned. Have 2 parameters: the runned activity and the yourParams object, that is an object with the parameters that you want to pass to the onRun function.
406
+ * @param props The activity properties.
407
+ */
362
408
  constructor(id, onRun, props) {
363
409
  this._id = id;
364
410
  this._name = props.name;
@@ -371,30 +417,54 @@ var ActivityModel = class {
371
417
  this._icon = props.icon;
372
418
  this._onRun = onRun;
373
419
  }
420
+ /**
421
+ * The activity id, that is unique.
422
+ */
374
423
  get id() {
375
424
  return this._id;
376
425
  }
426
+ /**
427
+ * The name
428
+ */
377
429
  get name() {
378
430
  return this._name;
379
431
  }
432
+ /**
433
+ * The hour when the activity starts. If the activity is not started yet, it will be hidden.
434
+ */
380
435
  get fromHour() {
381
436
  return this._fromHour;
382
437
  }
438
+ /**
439
+ * The hour when the activity ends. If the activity is ended yet, it will be hidden.
440
+ */
383
441
  get toHour() {
384
442
  return this._toHour;
385
443
  }
444
+ /**
445
+ * The day when the activity starts. If the activity is not started yet, it will be hidden.
446
+ */
386
447
  get fromDay() {
387
448
  return this._fromDay;
388
449
  }
450
+ /**
451
+ * The day when the activity ends. If the activity is ended yet, it will be deleted or hidden.
452
+ */
389
453
  get toDay() {
390
454
  return this._toDay;
391
455
  }
456
+ /**
457
+ * Whether is disabled.
458
+ */
392
459
  get disabled() {
393
460
  if (typeof this._disabled === "string") {
394
461
  return getFlag(this._disabled);
395
462
  }
396
463
  return this._disabled;
397
464
  }
465
+ /**
466
+ * Whether is hidden. If the activity is not started yet, it will be hidden.
467
+ */
398
468
  get hidden() {
399
469
  if (this.fromDay && this.fromDay > TimeManager.currentDay) {
400
470
  return true;
@@ -407,18 +477,32 @@ var ActivityModel = class {
407
477
  }
408
478
  return this._hidden;
409
479
  }
480
+ /**
481
+ * The icon element.
482
+ */
410
483
  get icon() {
411
484
  return this._icon;
412
485
  }
486
+ /**
487
+ * The function that is called when the activity is runned.
488
+ */
413
489
  get onRun() {
414
490
  return () => this._onRun(this);
415
491
  }
492
+ /**
493
+ * Whether the activity is a deadline.
494
+ * @returns Whether the activity is a deadline.
495
+ */
416
496
  isDeadline() {
417
497
  if (this.toDay && this.toDay <= TimeManager.currentDay) {
418
498
  return true;
419
499
  }
420
500
  return false;
421
501
  }
502
+ /**
503
+ * Export the activity properties.
504
+ * @returns The activity properties.
505
+ */
422
506
  export() {
423
507
  return {
424
508
  name: this._name,