estreui 1.0.7 → 1.2.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/scripts/jcodd.js CHANGED
@@ -30,7 +30,7 @@ SOFTWARE.
30
30
  //
31
31
  // The JSON based lite code format
32
32
  //
33
- // v0.8.2 / release 2025.11.23
33
+ // v0.9.0 / release 2026.01.12
34
34
  //
35
35
  // Take to be liten from JSON code to smaller converted characters for like as BASE64.
36
36
  //
@@ -43,6 +43,8 @@ SOFTWARE.
43
43
  // 1. null is n, true is t, false is f.
44
44
  // 2. No space and carriage return & line feed in the code. Only allowed for data definition.
45
45
  // 3. Omit "" (double quote) for variable name definition.
46
+ // 4. Unicode characters is escaped with %uXXXX or %XX format.
47
+ // 5. Single quote ' is not allowed in value of JCODD code when code is fallback(using ' instead " for value container) type.
46
48
 
47
49
  class Jcodd {
48
50
 
@@ -90,7 +92,7 @@ class Jcodd {
90
92
  let p3 = p2.replace(/([\[\,\:])true([\]\,\}])/g, "$1t$2").replace(/([\[\,\:])true([\]\,\}])/g, "$1t$2");
91
93
  //Convert false to f
92
94
  let p4 = p3.replace(/([\[\,\:])false([\]\,\}])/g, "$1f$2").replace(/([\[\,\:])false([\]\,\}])/g, "$1f$2");
93
- //Rem4ve ""
95
+ //Remove ""
94
96
  let p5 = p4.replace(/([\{\,])\"([^\"]*)\"\:/g, "$1$2:");
95
97
  //Check convert unicode
96
98
  if (p5.match(/[\u0000-\u001F|\u0080-\uFFFF]/g) != null) {
@@ -126,7 +128,7 @@ class Jcodd {
126
128
  *
127
129
  * @return {string} json
128
130
  */
129
- static toJson(codd) {
131
+ static toJson(codd, allowFallback = false) {
130
132
  switch (codd) {
131
133
  case "t": return "true";
132
134
  case "f": return "false";
@@ -134,14 +136,23 @@ class Jcodd {
134
136
  }
135
137
  //unescape
136
138
  let p1 = this.unescape(codd);//unescape(codd);//=> deprecated
137
- //Assign ""
139
+ //Replace ' to " (fallback)
140
+ if (p1.startsWith("'") && p1.endsWith("'")) p1 = '"' + p1.slice(1, -1) + '"';
141
+ else if (allowFallback) {
142
+ const fallbackRegex = /([\,\[\:])\'([^\']*)\'([\,\]\}])/g;
143
+ if (fallbackRegex.test(p1)) p1 = p1.replace(fallbackRegex, '$1"$2"$3').replace(fallbackRegex, '$1"$2"$3');
144
+ }
145
+ //Assign property names with ""
138
146
  let p2 = p1.replace(/(\{|\}\,|\]\,|\"\,|[eE]?[+\-]?[\d.]+\,|[ntf]\,|true\,|false\,)([^\"\{\}\[\]\,\:]*)\:/g, '$1"$2":');
139
147
  //Convert n to null
140
- let p3 = p2.replace(/([\[\,\:])n([\]\,\}])/g, "$1null$2").replace(/([\[\,\:])n([\]\,\}])/g, "$1null$2");
148
+ const nullRegex = /([\[\,\:])n([\]\,\}])/g;
149
+ let p3 = p2.replace(nullRegex, "$1null$2").replace(nullRegex, "$1null$2");
141
150
  //Convert t to true
142
- let p4 = p3.replace(/([\[\,\:])t([\]\,\}])/g, "$1true$2").replace(/([\[\,\:])t([\]\,\}])/g, "$1true$2");
151
+ const trueRegex = /([\[\,\:])t([\]\,\}])/g;
152
+ let p4 = p3.replace(trueRegex, "$1true$2").replace(trueRegex, "$1true$2");
143
153
  //Convert f to false
144
- let p5 = p4.replace(/([\[\,\:])f([\]\,\}])/g, "$1false$2").replace(/([\[\,\:])f([\]\,\}])/g, "$1false$2");
154
+ const falseRegex = /([\[\,\:])f([\]\,\}])/g;
155
+ let p5 = p4.replace(falseRegex, "$1false$2").replace(falseRegex, "$1false$2");
145
156
 
146
157
  return p5;
147
158
  }
@@ -153,10 +164,23 @@ class Jcodd {
153
164
  *
154
165
  * @returns {*} object
155
166
  */
156
- static parse(codd) {
157
- let json = this.toJson(codd);
167
+ static parse(codd, allowFallback = true) {
168
+ let json = this.toJson(codd, false);
158
169
 
159
- return JSON.parse(json);
170
+ try {
171
+ return JSON.parse(json);
172
+ } catch (e) {
173
+ if (allowFallback) {
174
+ // try fallback
175
+ json = this.toJson(codd, true);
176
+
177
+ try {
178
+ return JSON.parse(json);
179
+ } catch (ef) {
180
+ throw e;
181
+ }
182
+ } else throw e;
183
+ }
160
184
  }
161
185
 
162
186
  /**
@@ -31,7 +31,7 @@ SOFTWARE.
31
31
  // Collections of bypass for process codes takes be inline,
32
32
  // and monkey patching like as modern languages.
33
33
  //
34
- // v0.6.0 / release 2026.01.03
34
+ // v0.7.0 / release 2026.02.06
35
35
  //
36
36
  // Author: Estre Soliette
37
37
  // Established: 2025.01.05
@@ -71,6 +71,7 @@ const _OBJECT = "Object";
71
71
 
72
72
  // frequent object types alias constant
73
73
  const _DATE = "Date";
74
+ const _TIME = "Time";
74
75
 
75
76
  const _ARRAY = "Array";
76
77
  const _SET = "Set";
@@ -78,6 +79,8 @@ const _MAP = "Map";
78
79
 
79
80
 
80
81
  // frequent assign types alias constant
82
+ const FORE_NOT_DEFAULT = "foreNotDefault";
83
+ const MORE_NOT_DEFAULT = "moreNotDefault";
81
84
  const DEFAULT = "default";
82
85
  const FINALLY = "finally";
83
86
 
@@ -277,57 +280,88 @@ const checkCount = (object, checker = (k, v) => true) => {
277
280
 
278
281
 
279
282
  // match case constant
280
- const matchCase = (val, cases = { [DEFAULT]: val => {}, [FINALLY]: (val, returns) => {} }, ignoreCase = false) => {
281
- let match;
282
- forin(cases, (k, v) => executeIf(k != DEFAULT && rx(k, ignoreCase ? "i" : "").test(val), () => doAndReturn(() => match = v, true)));
283
+ const matchCase = (val, cases = { [DEFAULT]: val => {}, [FINALLY]: (more, returns, fore, val, key) => {} }, ignoreCase = false) => {
284
+ let key, match;
285
+ forin(cases, (k, v) => executeIf(k != DEFAULT && k != FORE_NOT_DEFAULT && k != MORE_NOT_DEFAULT && rx(k, ignoreCase ? "i" : "").test(val), () => doAndReturn(() => { key = k; match = v; }, true)));
286
+ const isMatch = isNotNully(match);
287
+ const foreNotDefault = FORE_NOT_DEFAULT in cases ? cases[FORE_NOT_DEFAULT] : (val => val);
288
+ const moreNotDefault = MORE_NOT_DEFAULT in cases ? cases[MORE_NOT_DEFAULT] : (val => val);
283
289
  const defaultCase = cases[DEFAULT];
284
- const finallyCase = cases[FINALLY];
285
- const returns = isNotNully(match) ? (typeFunction(match) ? match(val) : match) : (typeFunction(defaultCase) ? defaultCase(val) : defaultCase);
286
- const returnFinal = typeFunction(finallyCase) ? finallyCase(val, returns) : finallyCase;
287
- return isUndefined(returnFinal) ? returns : returns ?? returnFinal;
290
+ const finallyCase = FINALLY in cases ? cases[FINALLY] : (val => val);
291
+ const fore = isMatch ? (typeFunction(foreNotDefault) ? foreNotDefault(val) : foreNotDefault) : val;
292
+ const returns = isMatch ? (typeFunction(match) ? match(fore, val) : match) : (typeFunction(defaultCase) ? defaultCase(val) : defaultCase);
293
+ const more = isMatch ? (typeFunction(moreNotDefault) ? moreNotDefault(returns, fore, val, key) : moreNotDefault) : returns;
294
+ const returnFinal = typeFunction(finallyCase) ? finallyCase(more, returns, fore, val, key) : finallyCase;
295
+ return returnFinal;
288
296
  };
289
- const equalCase = (val, cases = { [DEFAULT]: val => {}, [FINALLY]: (val, returns) => {} }, ignoreCase = false) => {
290
- let match;
297
+ const equalCase = (val, cases = { [DEFAULT]: val => {}, [FINALLY]: (more, returns, fore, val, key) => {} }, ignoreCase = false) => {
298
+ let key, match;
291
299
  const vlc = typeOf(val) == STRING ? val.toLowerCase() : val;
292
- forin(cases, (k, v) => executeIf(k != DEFAULT && (ignoreCase ? (typeOf(k) == STRING ? k.toLowerCase() : k) == vlc : k == val), () => doAndReturn(() => match = v, true)));
300
+ forin(cases, (k, v) => executeIf(k != DEFAULT && k != FORE_NOT_DEFAULT && k != MORE_NOT_DEFAULT && (ignoreCase ? (typeOf(k) == STRING ? k.toLowerCase() : k) == vlc : k == val), () => doAndReturn(() => { key = k; match = v; }, true)));
301
+ const isMatch = isNotNully(match);
302
+ const foreNotDefault = FORE_NOT_DEFAULT in cases ? cases[FORE_NOT_DEFAULT] : (val => val);
303
+ const moreNotDefault = MORE_NOT_DEFAULT in cases ? cases[MORE_NOT_DEFAULT] : (val => val);
293
304
  const defaultCase = cases[DEFAULT];
294
- const finallyCase = cases[FINALLY];
295
- const returns = isNotNully(match) ? (typeFunction(match) ? match(val) : match) : (typeFunction(defaultCase) ? defaultCase(val) : defaultCase);
296
- const returnFinal = typeFunction(finallyCase) ? finallyCase(val, returns) : finallyCase;
297
- return isUndefined(returnFinal) ? returns : returns ?? returnFinal;
305
+ const finallyCase = FINALLY in cases ? cases[FINALLY] : (val => val);
306
+ const fore = isMatch ? (typeFunction(foreNotDefault) ? foreNotDefault(val) : foreNotDefault) : val;
307
+ const returns = isMatch ? (typeFunction(match) ? match(fore, val) : match) : (typeFunction(defaultCase) ? defaultCase(val) : defaultCase);
308
+ const more = isMatch ? (typeFunction(moreNotDefault) ? moreNotDefault(returns, fore, val, key) : moreNotDefault) : returns;
309
+ const returnFinal = typeFunction(finallyCase) ? finallyCase(more, returns, fore, val, key) : finallyCase;
310
+ return returnFinal;
298
311
  };
299
- const exactCase = (val, cases = { [DEFAULT]: val => {}, [FINALLY]: (val, returns) => {} }) => {
312
+ const exactCase = (val, cases = { [DEFAULT]: val => {}, [FINALLY]: (more, returns, fore, val) => {} }) => {
300
313
  const match = cases[val];
314
+ const isMatch = isNotNully(match);
315
+ const foreNotDefault = FORE_NOT_DEFAULT in cases ? cases[FORE_NOT_DEFAULT] : (val => val);
316
+ const moreNotDefault = MORE_NOT_DEFAULT in cases ? cases[MORE_NOT_DEFAULT] : (val => val);
301
317
  const defaultCase = cases[DEFAULT];
302
- const finallyCase = cases[FINALLY];
303
- const returns = isNotNully(match) ? (typeFunction(match) ? match(val) : match) : (typeFunction(defaultCase) ? defaultCase(val) : defaultCase);
304
- const returnFinal = typeFunction(finallyCase) ? finallyCase(val, returns) : finallyCase;
305
- return isUndefined(returnFinal) ? returns : returns ?? returnFinal;
318
+ const finallyCase = FINALLY in cases ? cases[FINALLY] : (val => val);
319
+ const fore = isMatch ? (typeFunction(foreNotDefault) ? foreNotDefault(val) : foreNotDefault) : val;
320
+ const returns = isMatch ? (typeFunction(match) ? match(fore, val) : match) : (typeFunction(defaultCase) ? defaultCase(val) : defaultCase);
321
+ const more = isMatch ? (typeFunction(moreNotDefault) ? moreNotDefault(returns, fore, val) : moreNotDefault) : returns;
322
+ const returnFinal = typeFunction(finallyCase) ? finallyCase(more, returns, fore, val) : finallyCase;
323
+ return returnFinal;
306
324
  };
307
- const typeCase = (variable, cases = { [DEFAULT]: variable => {}, [FINALLY]: (variable, returns) => {} }) => {
325
+ const typeCase = (variable, cases = { [DEFAULT]: variable => {}, [FINALLY]: (more, returns, fore, variable, type) => {} }) => {
308
326
  const type = typeOf(variable);
309
327
  const match = cases[type];
328
+ const isMatch = isNotNully(match);
329
+ const foreNotDefault = FORE_NOT_DEFAULT in cases ? cases[FORE_NOT_DEFAULT] : (variable => variable);
330
+ const moreNotDefault = MORE_NOT_DEFAULT in cases ? cases[MORE_NOT_DEFAULT] : (variable => variable);
310
331
  const defaultCase = cases[DEFAULT];
311
- const finallyCase = cases[FINALLY];
312
- const returns = isNotNully(match) ? (typeFunction(match) ? match(variable) : match) : (typeFunction(defaultCase) ? defaultCase(variable) : defaultCase);
313
- const returnFinal = typeFunction(finallyCase) ? finallyCase(variable, returns) : finallyCase;
314
- return isUndefined(returnFinal) ? returns : returns ?? returnFinal;
332
+ const finallyCase = FINALLY in cases ? cases[FINALLY] : (variable => variable);
333
+ const fore = isMatch ? (typeFunction(foreNotDefault) ? foreNotDefault(variable) : foreNotDefault) : variable;
334
+ const returns = isMatch ? (typeFunction(match) ? match(fore, variable) : match) : (typeFunction(defaultCase) ? defaultCase(variable) : defaultCase);
335
+ const more = isMatch ? (typeFunction(moreNotDefault) ? moreNotDefault(returns, fore, variable, type) : moreNotDefault) : returns;
336
+ const returnFinal = typeFunction(finallyCase) ? finallyCase(more, returns, fore, variable, type) : finallyCase;
337
+ return returnFinal;
315
338
  };
316
- const classCase = (object, cases = { [DEFAULT]: object => {}, [FINALLY]: (object, returns) => {} }) => {
339
+ const classCase = (object, cases = { [DEFAULT]: object => {}, [FINALLY]: (more, returns, fore, object, className) => {} }) => {
317
340
  const className = object.constructor.name;
318
341
  const match = cases[className];
342
+ const isMatch = isNotNully(match);
343
+ const foreNotDefault = FORE_NOT_DEFAULT in cases ? cases[FORE_NOT_DEFAULT] : (object => object);
344
+ const moreNotDefault = MORE_NOT_DEFAULT in cases ? cases[MORE_NOT_DEFAULT] : (object => object);
319
345
  const defaultCase = cases[DEFAULT];
320
- const finallyCase = cases[FINALLY];
321
- const returns = isNotNully(match) ? (typeFunction(match) ? match(object) : match) : (typeFunction(defaultCase) ? defaultCase(object) : defaultCase);
322
- const returnFinal = typeFunction(finallyCase) ? finallyCase(object, returns) : finallyCase;
323
- return isUndefined(returnFinal) ? returns : returns ?? returnFinal;
346
+ const finallyCase = FINALLY in cases ? cases[FINALLY] : (object => object);
347
+ const fore = isMatch ? (typeFunction(foreNotDefault) ? foreNotDefault(object) : foreNotDefault) : object;
348
+ const returns = isMatch ? (typeFunction(match) ? match(fore, object) : match) : (typeFunction(defaultCase) ? defaultCase(object) : defaultCase);
349
+ const more = isMatch ? (typeFunction(moreNotDefault) ? moreNotDefault(returns, fore, object, className) : moreNotDefault) : returns;
350
+ const returnFinal = typeFunction(finallyCase) ? finallyCase(more, returns, fore, object, className) : finallyCase;
351
+ return returnFinal;
324
352
  };
325
- const kindCase = (kindFrom, cases = { [DEFAULT]: val => {}, [FINALLY]: val => { val, returns } }) => typeCase(kindFrom, { ...cases, [OBJECT]: () => classCase(kindFrom, { ...cases, [FINALLY]: undefined }) });
353
+ const kindCase = (kindFrom, cases = { [DEFAULT]: val => {}, [FINALLY]: (more, returns, fore, value, kind) => {} }) => typeCase(kindFrom, { ...cases, [OBJECT]: () => classCase(kindFrom, { ...cases, [FINALLY]: undefined }) });
326
354
 
327
355
 
328
356
  /** variable data copy */
329
357
  const copy = (from, dataOnly = true, primitiveOnly = false, recusive = true) => isNully(from) ? from : typeCase(from, {
330
358
  [OBJECT]: val => {
359
+ const proto = Object.getPrototypeOf(val);
360
+ if (proto != n && proto !== Object.prototype && !primitiveOnly) try {
361
+ return structuredClone(val);
362
+ } catch (e) {
363
+ // structuredClone not supported
364
+ }
331
365
  const object = new val.constructor();
332
366
  if (dataOnly || primitiveOnly) {
333
367
  for (const key in val) if (isNully(val) || typeCase(val[key], {
@@ -420,6 +454,267 @@ const postFrameQueue = (process = (...args) => args[0], ...args) => requestAnima
420
454
  const postFramePromise = (process = (rs, rj, ...args) => rs(args[0]), ...args) => new Promise((rs, rj) => requestAnimationFrame(() => process(rs, rj, ...args)));
421
455
 
422
456
 
457
+ // Additional classes
458
+ class Time {
459
+ static get dayMillis() { return 86400000; }
460
+ static get hourMillis() { return 3600000; }
461
+ static get minuteMillis() { return 60000; }
462
+ static get secondMillis() { return 1000; }
463
+
464
+ static get millisUnitsArray() { return [this.hourMillis, this.minuteMillis, this.secondMillis, 1]; }
465
+
466
+ static fromDate(date) { return new Time(date); }
467
+ static fromDateTime(date) { return new Time(date.time, null, null, null, date.zoneOffset); }
468
+ static fromString(str) { return new Time(str); }
469
+ static fromArray(arr) { return new Time(arr); }
470
+
471
+ static get now() { return Time.fromDate(new Date()); }
472
+
473
+
474
+ #time = 0;
475
+ #timezoneOffset = 0;
476
+
477
+ constructor(hours = 0, minutes = 0, seconds = 0, milliseconds = 0, timezoneOffset = (hours instanceof Date ? hours : Date.new).zoneOffset) {
478
+ this.#timezoneOffset = timezoneOffset;
479
+ kindCase(hours, {
480
+ [_DATE]: date => {
481
+ this.timeGMT = (((date.hours * 60) + date.minutes) * 60 + date.seconds) * 1000 + date.millis;
482
+ },
483
+ [_TIME]: time => {
484
+ this.#time = time.time;
485
+ },
486
+ [_ARRAY]: arr => {
487
+ const [h, m, s, ms] = arr;
488
+ this.timeGMT = ((((h ?? 0) * 60) + (m ?? 0)) * 60 + (s ?? 0)) * 1000 + (ms ?? 0);
489
+ },
490
+ [STRING]: str => {
491
+ let isNegative = false;
492
+ if (str.startsWith("-")) {
493
+ isNegative = true;
494
+ str = str.slice(1);
495
+ }
496
+ let daysPart = 0;
497
+ if (str.includes(" ")) {
498
+ const [daysStr, timeStr] = str.split(" ");
499
+ daysPart = Number(daysStr) * Time.dayMillis;
500
+ str = timeStr;
501
+ }
502
+ const [hms, ms] = str.split(".");
503
+ const parts = hms.split(":").map(it => Number(it));
504
+ const [h, m, s] = parts;
505
+ this.timeGMT = (daysPart + (((h * 60) + m) * 60 + s) * 1000 + Number(ms)) * (isNegative ? -1 : 1);
506
+ },
507
+ [NUMBER]: _ => {
508
+ if (isNully(minutes) && isNully(seconds) && isNully(milliseconds)) {
509
+ this.#time = hours;
510
+ } else {
511
+ this.timeGMT = (((hours * 60) + minutes) * 60 + seconds) * 1000 + milliseconds;
512
+ }
513
+ },
514
+ [NULL]: _ => {
515
+ const now = new Date();
516
+ this.timeGMT = (((now.hours * 60) + now.minutes) * 60 + now.seconds) * 1000 + now.millis;
517
+ },
518
+ [UNDEFINED]: _ => {
519
+ const now = new Date();
520
+ this.timeGMT = (((now.hours * 60) + now.minutes) * 60 + now.seconds) * 1000 + now.millis;
521
+ },
522
+ [DEFAULT]: _ => {
523
+ console.warn("Time constructor received unsupported type:", typeOf(hours));
524
+ },
525
+ });
526
+ }
527
+
528
+ get time() { return this.#time; }
529
+ set time(val) { this.#time = val; }
530
+
531
+ get timeAbsolute() { return Math.abs(this.#time); }
532
+ set timeAbsolute(val) {
533
+ const valAbs = Math.abs(val);
534
+ this.#time = this.isNegative ? -valAbs : valAbs;
535
+ }
536
+ get timeAbs() { return this.timeAbsolute; }
537
+ set timeAbs(val) {
538
+ const valAbs = Math.abs(val);
539
+ this.#time = this.isNegative ? -valAbs : valAbs;
540
+ }
541
+
542
+ get timeGMT() { return this.#time + (this.#timezoneOffset * Time.minuteMillis); }
543
+ set timeGMT(val) { this.#time = val - (this.#timezoneOffset * Time.minuteMillis); }
544
+
545
+ get isNegative() { return this.timeGMT < 0; }
546
+ set isNegative(val) {
547
+ if (val && this.isPositive) this.timeGMT = -this.timeGMT;
548
+ else if (!val && this.isNegative) this.timeGMT = -this.timeGMT;
549
+ }
550
+ get isPositive() { return this.timeGMT >= 0; }
551
+ set isPositive(val) {
552
+ if (val && this.isNegative) this.timeGMT = -this.timeGMT;
553
+ else if (!val && this.isPositive) this.timeGMT = -this.timeGMT;
554
+ }
555
+
556
+ get negativePrefix() { return this.isNegative ? "-" : ""; }
557
+ get positivePrefix() { return this.isPositive ? "+" : ""; }
558
+
559
+ get dayAndMillis() { return [Math.floor(this.timeGMT / Time.dayMillis), this.timeGMT % Time.dayMillis]; }
560
+ get hourAndMillis() { return [Math.floor(this.timeGMT / Time.hourMillis), this.timeGMT % Time.hourMillis]; }
561
+ get minuteAndMillis() { return [Math.floor(this.timeGMT / Time.minuteMillis), this.timeGMT % Time.minuteMillis]; }
562
+ get secondAndMillis() { return [Math.floor(this.timeGMT / Time.secondMillis), this.timeGMT % Time.secondMillis]; }
563
+
564
+ get days() { return Math.floor(this.timeGMT / Time.dayMillis); }
565
+ set days(val) { this.timeGMT = (val * Time.dayMillis) + this.millisInDay; }
566
+ get daysAbs() { return Math.abs(this.days); }
567
+ get millisInDay() { return this.timeGMT % Time.dayMillis; }
568
+ set millisInDay(val) { this.timeGMT = (this.days * Time.dayMillis) + val; }
569
+
570
+ get daysAndMillis() { return [this.days, this.millisInDay]; }
571
+ set daysAndMillis(val) {
572
+ const [days, millisInDay] = val;
573
+ this.timeGMT = (days * Time.dayMillis) + millisInDay;
574
+ }
575
+
576
+ get hours() { return Math.floor(this.millisInDay / Time.dayMillis); }
577
+ set hours(val) { this.timeGMT = (this.days * Time.dayMillis) + (val * Time.hourMillis) + this.millisInHour; }
578
+ get hoursAbs() { return Math.abs(this.hours); }
579
+ get hours12() { const hours = this.hours % 12; return hours == 0 ? (hours < 0 ? -12 : 12) : hours; }
580
+ get hours12Abs() { return Math.abs(this.hours12); }
581
+ get digitHours() { return this.hoursAbs.toString().padStart(2, "0"); }
582
+ set digitHours(val) { this.hours = Number(val); }
583
+ get digitHoursWithNegative() { return this.negativePrefix + this.digitHours; }
584
+ get millisInHour() { return this.millisInDay % Time.hourMillis; }
585
+ set millisInHour(val) { this.timeGMT = (this.days * Time.dayMillis) + (this.hours * Time.hourMillis) + val; }
586
+
587
+ get hoursAndMillis() { return [this.hours, this.millisInHour]; }
588
+ set hoursAndMillis(val) {
589
+ const [hours, millisInHour] = val;
590
+ this.timeGMT = (this.days * Time.dayMillis) + (hours * Time.hourMillis) + millisInHour;
591
+ }
592
+
593
+ get minutes() { return Math.floor(this.millisInHour / Time.minuteMillis); }
594
+ set minutes(val) { this.timeGMT = (this.days * Time.dayMillis) + (this.hours * Time.hourMillis) + (val * Time.minuteMillis) + this.millisInMinute; }
595
+ get minutesAbs() { return Math.abs(this.minutes); }
596
+ get digitMinutes() { return this.minutesAbs.toString().padStart(2, "0"); }
597
+ set digitMinutes(val) { this.minutes = Number(val); }
598
+ get digitMinutesWithNegative() { return this.negativePrefix + this.digitMinutes; }
599
+ get millisInMinute() { return this.millisInHour % Time.minuteMillis; }
600
+ set millisInMinute(val) { this.timeGMT = (this.days * Time.dayMillis) + (this.hours * Time.hourMillis) + (this.minutes * Time.minuteMillis) + val; }
601
+
602
+ get minutesAndMillis() { return [this.minutes, this.millisInMinute]; }
603
+ set minutesAndMillis(val) {
604
+ const [minutes, millisInMinute] = val;
605
+ this.timeGMT = (this.days * Time.dayMillis) + (this.hours * Time.hourMillis) + (minutes * Time.minuteMillis) + millisInMinute;
606
+ }
607
+
608
+ get seconds() { return Math.floor(this.millisInMinute / Time.secondMillis); }
609
+ set seconds(val) { this.timeGMT = (this.days * Time.dayMillis) + (this.hours * Time.hourMillis) + (this.minutes * Time.minuteMillis) + (val * Time.secondMillis) + this.milliseconds; }
610
+ get secondsAbs() { return Math.abs(this.seconds); }
611
+ get digitSeconds() { return this.secondsAbs.toString().padStart(2, "0"); }
612
+ set digitSeconds(val) { this.seconds = Number(val); }
613
+ get digitSecondsWithNegative() { return this.negativePrefix + this.digitSeconds; }
614
+
615
+ get secondsAndMillis() { return [this.seconds, this.milliseconds]; }
616
+ set secondsAndMillis(val) {
617
+ const [seconds, milliseconds] = val;
618
+ this.timeGMT = (this.days * Time.dayMillis) + (this.hours * Time.hourMillis) + (this.minutes * Time.minuteMillis) + (seconds * Time.secondMillis) + milliseconds;
619
+ }
620
+
621
+ get milliseconds() { return this.millisInMinute % Time.secondMillis; }
622
+ set milliseconds(val) { this.timeGMT = (this.days * Time.dayMillis) + (this.hours * Time.hourMillis) + (this.minutes * Time.minuteMillis) + (this.seconds * Time.secondMillis) + val; }
623
+ get millis() { return this.milliseconds; }
624
+ set millis(val) { this.milliseconds = val; }
625
+ get millisAbs() { return Math.abs(this.milliseconds); }
626
+ get digitMillis() { return this.millisAbs.toString().padStart(3, "0"); }
627
+ set digitMillis(val) { this.milliseconds = Number(val); }
628
+ get digitMillisWithNegative() { return this.negativePrefix + this.digitMillis; }
629
+
630
+
631
+ get array() {
632
+ const [hm, mm, sm] = Time.millisUnitsArray;
633
+ let totalMillis = this.timeAbsolute;
634
+ const hours = Math.floor(totalMillis / hm);
635
+ totalMillis -= hours * hm;
636
+ const minutes = Math.floor(totalMillis / mm);
637
+ totalMillis -= minutes * mm;
638
+ const seconds = Math.floor(totalMillis / sm);
639
+ const milliseconds = totalMillis - (seconds * sm);
640
+ return [hours, minutes, seconds, milliseconds];
641
+ }
642
+ set array(val) {
643
+ const [hours, minutes, seconds, milliseconds] = val;
644
+ this.timeGMT = (((hours * 60) + minutes) * 60 + seconds) * 1000 + milliseconds;
645
+ }
646
+
647
+ get hourMinutesIntArray() { return [this.hours, this.minutes]; }
648
+ get hourMinutesArray() { return [this.digitHours, this.digitMinutes]; }
649
+ get hourMinutes() { return this.hourMinutesArray.join(":"); }
650
+ get hourMinutesWithNegative() { return this.negativePrefix + this.hourMinutes; }
651
+ get minuteSecondsIntArray() { return [this.minutes, this.seconds]; }
652
+ get minuteSecondsArray() { return [this.digitMinutes, this.digitSeconds]; }
653
+ get minuteSeconds() { return this.minuteSecondsArray.join(":"); }
654
+ get minuteSecondsWithNegative() { return this.negativePrefix + this.minuteSeconds; }
655
+ get secondMillisIntArray() { return [this.seconds, this.milliseconds]; }
656
+ get secondMillisArray() { return [this.digitSeconds, this.digitMillis]; }
657
+ get secondMillis() { return this.secondMillisArray.join("."); }
658
+ get secondMillisWithNegative() { return this.negativePrefix + this.secondMillis; }
659
+
660
+ get timeArray() { return [this.hours, this.minutes, this.seconds]; }
661
+ get timeStringArray() { return [this.digitHours, this.digitMinutes, this.digitSeconds]; }
662
+ get timeString() { return this.timeArray.join(":"); }
663
+ get timeStringWithNegative() { return this.negativePrefix + this.timeString; }
664
+ get hmsArray() { return this.timeArray; }
665
+ get hhmmssArray() { return this.timeStringArray; }
666
+ get hhmmss() { return this.timeString; }
667
+ get hhmmssWithNegative() { return this.timeStringWithNegative; }
668
+ get hhmmssAndMillis() { return [this.hhmmss, this.digitMillis]; }
669
+
670
+ get timeArrayWithMillis() { return [this.hours, this.minutes, this.seconds, this.milliseconds]; }
671
+ get timeStringArrayWithMillis() { return [this.digitHours, this.digitMinutes, this.digitSeconds, this.digitMillis]; }
672
+ get timeStringWithMillis() { return this.timeString + "." + this.digitMillis; }
673
+ get timeStringWithMillisWithNegative() { return this.negativePrefix + this.timeStringWithMillis; }
674
+ get hmsmsArray() { return this.timeArrayWithMillis; }
675
+ get hhmmssmsArray() { return this.timeStringArrayWithMillis; }
676
+ get hhmmssms() { return this.timeStringWithMillis; }
677
+ get hhmmssmsWithNegative() { return this.timeStringWithMillisWithNegative; }
678
+
679
+
680
+ get digitArray() { return [this.digitHours, this.digitMinutes, this.digitSeconds, this.digitMillis]; }
681
+ set digitArray(val) {
682
+ const [hours, minutes, seconds, milliseconds] = val.map(it => Number(it));
683
+ this.timeGMT = (((hours * 60) + minutes) * 60 + seconds) * 1000 + milliseconds;
684
+ }
685
+
686
+ get arrayWithDays() { return [this.days, ...this.timeArray, ]; }
687
+ set arrayWithDays(val) {
688
+ const [days, hours, minutes, seconds, milliseconds] = val;
689
+ this.timeGMT = (days * Time.dayMillis) + (((hours * 60) + minutes) * 60 + seconds) * 1000 + milliseconds;
690
+ }
691
+
692
+ get digitArrayWithDays() { return [this.days.toString(), ...this.digitArray]; }
693
+ set digitArrayWithDays(val) {
694
+ const [days, hours, minutes, seconds, milliseconds] = val.map(it => Number(it));
695
+ this.timeGMT = (days * Time.dayMillis) + (((hours * 60) + minutes) * 60 + seconds) * 1000 + milliseconds;
696
+ }
697
+
698
+ toString() {
699
+ const days = this.daysAbs;
700
+ return this.negativePrefix + (days > 0 ? days + " " : "") + this.hhmmssAndMillis.join(".");
701
+ }
702
+ toArray() { return this.array; }
703
+ valueOf() { return this.toString(); }
704
+
705
+ dateOn(baseDate = new Date()) {
706
+ const date = new Date(baseDate);
707
+ date.setHours(...this.timeArrayWithMillis);
708
+ return date;
709
+ }
710
+ dateAddTo(baseDate = new Date()) {
711
+ const date = new Date(baseDate.getTime() + this.timeGMT);
712
+ return date;
713
+ }
714
+ }
715
+
716
+
717
+
423
718
  // Object function shortcut constants
424
719
  const defineStaticProperty = (cls, name, value, wa = true, ca = true, ea = false, extras = {}) => Object.defineProperty(cls, name, {
425
720
  value,
@@ -459,7 +754,7 @@ const defineGetterAndSetterPlex = (name, gets, sets, ca = true, ea = false, clas
459
754
 
460
755
 
461
756
  // additional static function for classes
462
- defineGetterAndSetter(Object, "new", function () { return new this.constructor(...arguments); });
757
+ defineGetterAndSetter(Function, "new", function () { return new this(); });
463
758
 
464
759
 
465
760
  // additional global prototype functions
@@ -528,6 +823,7 @@ definePropertyPlex("ifNotEquals", function (that, process = it => it, ornot = it
528
823
  // additional primitive prototype functions
529
824
  defineGetterAndSetter(Number, "abs", function () { return Math.abs(this.it); });
530
825
  defineGetterAndSetter(Number, "int", function () { return parseInt(this.it); });
826
+ defineProperty(Number, "divided", function (by) { return this.it.let(it => [(it / by).int, it % by]); });
531
827
  defineGetterAndSetter(Number, "string", function () { return this.it + ""; });
532
828
  defineGetterAndSetter(Number, "pricision", function () { return this.it - this.int; });
533
829
  defineGetterAndSetter(Number, "pricisionString", function () { return this.it.pricision.string.replace(/^0\./, ""); });
@@ -592,6 +888,7 @@ defineGetterAndSetter(Date, "YOUBI", function () { return this.it.dayJpn; });
592
888
  defineGetterAndSetter(Date, "zhou", function () { return this.it.dayChn; });
593
889
  defineGetterAndSetter(Date, "xingqi", function () { return this.it.dayChnX; });
594
890
  defineGetterAndSetter(Date, "hours", function () { return this.getHours(); }, function (val) { this.setHours(val); });
891
+ defineGetterAndSetter(Date, "hours12", function () { const hours = this.getHours() % 12; return hours == 0 ? 12 : hours; });
595
892
  defineGetterAndSetter(Date, "minutes", function () { return this.getMinutes(); }, function (val) { this.setMinutes(val); });
596
893
  defineGetterAndSetter(Date, "seconds", function () { return this.getSeconds(); }, function (val) { this.setSeconds(val); });
597
894
  defineGetterAndSetter(Date, "millis", function () { return this.getMilliseconds(); }, function (val) { this.setMilliseconds(val); });
@@ -603,21 +900,31 @@ defineGetterAndSetter(Date, "isPM", function () { return this.it.hours >= 12; },
603
900
  defineGetterAndSetter(Date, "time", function () { return this.getTime(); }, function (val) { this.setTime(val); });
604
901
  defineGetterAndSetter(Date, "unix", function () { return parseInt(this.it.time / 1000); });
605
902
  defineGetterAndSetter(Date, "minutePoints", function () { return parseInt(this.it.unix / 60); });
606
- defineGetterAndSetter(Date, "minutePointsLocal", function () { return this.it.minutePoints - this.it.zoneOffset; });
903
+ defineGetterAndSetter(Date, "minutePointsLocal", function () { return this.it.let(it => it.minutePoints - it.zoneOffset); });
607
904
  defineGetterAndSetter(Date, "hourPoints", function () { return parseInt(this.it.minutePoints / 60); });
608
- defineGetterAndSetter(Date, "hourPointsLocal", function () { return this.it.hourPoints - this.it.zoneHours; });
905
+ defineGetterAndSetter(Date, "hourPointsLocal", function () { return this.it.let(it => it.hourPoints - it.zoneHours); });
609
906
  defineGetterAndSetter(Date, "dateOffset", function () { return parseInt(this.it.hourPointsLocal / 24); });
610
- defineGetterAndSetter(Date, "dayMinutes", function () { return (this.it.hours * 60) + this.it.minutes; });
611
- defineGetterAndSetter(Date, "daySeconds", function () { return (this.it.dayMinutes * 60) + this.it.seconds; });
612
- defineGetterAndSetter(Date, "dayMillis", function () { return (this.it.daySeconds * 1000) + this.it.millis; });
613
- defineGetterAndSetter(Date, "yearMonthArray", function () { return [this.it.year.string, this.it.month.digit2]; });
907
+ defineGetterAndSetter(Date, "dayMinutes", function () { return this.it.let(it => (it.hours * 60) + it.minutes); });
908
+ defineGetterAndSetter(Date, "daySeconds", function () { return this.it.let(it => (it.dayMinutes * 60) + it.seconds); });
909
+ defineGetterAndSetter(Date, "dayMillis", function () { return this.it.let(it => (it.daySeconds * 1000) + it.millis); });
910
+ defineGetterAndSetter(Date, "yearMonthIntArray0", function () { return this.it.let(it => [it.year, it.month0]); });
911
+ defineGetterAndSetter(Date, "yearMonthIntArray", function () { return this.it.let(it => [it.year, it.month]); });
912
+ defineGetterAndSetter(Date, "yearMonthArray", function () { return this.it.let(it => [it.year.string, it.month.digit2]); });
614
913
  defineGetterAndSetter(Date, "yearMonth", function () { return this.it.yearMonthArray.join("-"); });
615
- defineGetterAndSetter(Date, "dateStringArray", function () { return [this.it.year.string, this.it.month.digit2, this.it.date.digit2]; });
914
+ defineGetterAndSetter(Date, "dateArray0", function () { return this.it.let(it => [it.year, it.month0, it.date]); });
915
+ defineGetterAndSetter(Date, "dateArray", function () { return this.it.let(it => [it.year, it.month, it.date]); });
916
+ defineGetterAndSetter(Date, "dateStringArray", function () { return this.it.let(it => [it.year.string, it.month.digit2, it.date.digit2]); });
616
917
  defineGetterAndSetter(Date, "dateString", function () { return this.it.dateStringArray.join("-"); });
617
- defineGetterAndSetter(Date, "hourMinutesArray", function () { return [this.it.hours.digit2, this.it.minutes.digit2]; });
918
+ defineGetterAndSetter(Date, "hourMinutesIntArray", function () { return this.it.let(it => [it.hours, it.minutes]); });
919
+ defineGetterAndSetter(Date, "hourMinutesArray", function () { return this.it.hourMinutesIntArray.map(it => it.digit2); });
618
920
  defineGetterAndSetter(Date, "hourMinutes", function () { return this.it.hourMinutesArray.join(":"); });
619
- defineGetterAndSetter(Date, "timeStringArray", function () { return [this.it.hours.digit2, this.it.minutes.digit2, this.it.seconds.digit2]; });
921
+ defineGetterAndSetter(Date, "timeArray", function () { return this.it.let(it => [it.hours, it.minutes, it.seconds]); });
922
+ defineGetterAndSetter(Date, "timeStringArray", function () { return this.it.timeArray.map(it => it.digit2); });
620
923
  defineGetterAndSetter(Date, "timeString", function () { return this.it.timeStringArray.join(":"); });
924
+ defineGetterAndSetter(Date, "timePart", function () { return new Time(this.it); });
925
+ defineGetterAndSetter(Date, "asTime", function () { return Time.fromDateTime(this.it); });
926
+ defineProperty(Date, "setDayTime", function (time, m, s, ms) { return this.it.setHours(...(time instanceof Time ? time.timeArrayWithMillis : arguments)); });
927
+ defineProperty(Date, "addTime", function (time) { return this.it.time += time instanceof Time ? time.time : new Time(...arguments).time; });
621
928
 
622
929
 
623
930
 
@@ -645,6 +952,7 @@ if (typeof window === UNDEFINED) {
645
952
  defineGlobal("_OBJECT", _OBJECT);
646
953
 
647
954
  defineGlobal("_DATE", _DATE);
955
+ defineGlobal("_TIME", _TIME);
648
956
 
649
957
  defineGlobal("_ARRAY", _ARRAY);
650
958
  defineGlobal("_SET", _SET);
@@ -819,3 +1127,7 @@ if (typeof window === UNDEFINED) {
819
1127
  defineGlobal("defineGetterAndSetter", defineGetterAndSetter);
820
1128
  defineGlobal("defineGetterAndSetterPlex", defineGetterAndSetterPlex);
821
1129
  }
1130
+
1131
+ if (typeof module !== UNDEFINED && module.exports) {
1132
+ module.exports.Time = Time;
1133
+ }
package/serviceWorker.js CHANGED
@@ -1,4 +1,4 @@
1
- const INSTALLATION_VERSION_NAME = "1.0.7-r20260103";
1
+ const INSTALLATION_VERSION_NAME = "1.2.0-r20260228";
2
2
  // ^^ Use for check new update "Native application(webview) version(or Android/iOS version combo) - PWA release version"
3
3
  // ex) "1.0.1/1.0.0-r20251101k"
4
4
 
@@ -21,7 +21,7 @@ const INSTALLATION_FILE_LIST = [
21
21
 
22
22
 
23
23
  // Common files cache - Be changes some time but, well not changed very often
24
- const CACHE_NAME_COMMON_FILES = "common-files-cache-v1-20260103";
24
+ const CACHE_NAME_COMMON_FILES = "common-files-cache-v1-20260228";
25
25
 
26
26
  const COMMON_FILES_TO_CACHE = [
27
27
  "./",
@@ -32,6 +32,7 @@ const COMMON_FILES_TO_CACHE = [
32
32
 
33
33
 
34
34
  "./styles/estreUiInitialize.css",
35
+ "./styles/estreUiEmoji.css",
35
36
  "./styles/estreUiRoot.css",
36
37
  "./styles/estreUiCore.css",
37
38
  "./styles/estreUiCore2.css",
@@ -51,7 +52,7 @@ const COMMON_FILES_TO_CACHE = [
51
52
 
52
53
 
53
54
  // Static files cache - Rarely changes after release
54
- const CACHE_NAME_STATIC_FILES = "static-files-cache-v1-20251101b";
55
+ const CACHE_NAME_STATIC_FILES = "static-files-cache-v1-20260221";
55
56
 
56
57
  const STATIC_FILES_TO_CACHE = [
57
58
  "./favicon.ico",
@@ -73,7 +74,9 @@ const STATIC_FILES_TO_CACHE = [
73
74
  "https://fonts.googleapis.com/css2?family=Cute+Font&family=Noto+Sans+KR:wght@100..900&display=swap",
74
75
 
75
76
 
76
- "https://code.jquery.com/jquery-3.7.1.js",
77
+ // "https://code.jquery.com/jquery-3.7.1.js",
78
+ // "https://code.jquery.com/jquery-4.0.0.slim.min.js",
79
+ "https://code.jquery.com/jquery-4.0.0.min.js",
77
80
  "https://unpkg.com/@dotlottie/player-component@latest/dist/dotlottie-player.mjs",
78
81
 
79
82