tiny-essentials 1.27.1 → 1.28.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/README.md +1 -0
- package/changelog/1/28/0.md +16 -0
- package/changelog/1/28/1.md +23 -0
- package/dist/v1/TinyAdvancedRaffle.min.js +1 -1
- package/dist/v1/TinyAfterScrollWatcher.min.js +1 -1
- package/dist/v1/TinyAnalogClock.min.js +1 -1
- package/dist/v1/TinyBasicsEs.min.js +1 -2
- package/dist/v1/TinyDayNightCycle.min.js +1 -1
- package/dist/v1/TinyDragDropDetector.min.js +1 -1
- package/dist/v1/TinyDragger.min.js +1 -1
- package/dist/v1/TinyElementObserver.min.js +1 -1
- package/dist/v1/TinyEssentials.min.js +1 -2
- package/dist/v1/TinyGamepad.min.js +1 -1
- package/dist/v1/TinyHtml.min.js +1 -1
- package/dist/v1/TinyI18.min.js +1 -1
- package/dist/v1/TinyIframeEvents.min.js +1 -1
- package/dist/v1/TinyLocalStorage.min.js +1 -1
- package/dist/v1/TinyMediaPlayer.min.js +1 -1
- package/dist/v1/TinyNewWinEvents.min.js +1 -1
- package/dist/v1/TinyNotifyCenter.min.js +1 -1
- package/dist/v1/TinyRadioFm.min.js +1 -1
- package/dist/v1/TinyRateLimiter.min.js +1 -1
- package/dist/v1/TinySmartScroller.min.js +1 -1
- package/dist/v1/TinyTextDiffer.min.js +1 -1
- package/dist/v1/TinyTextarea.min.js +1 -1
- package/dist/v1/TinyTimeout.min.js +1 -1
- package/dist/v1/TinyToastNotify.min.js +1 -1
- package/dist/v1/TinyUploadClicker.min.js +1 -2
- package/dist/v1/UltraRandomMsgGen.min.js +1 -1
- package/dist/v1/basics/array.cjs +57 -9
- package/dist/v1/basics/array.d.mts +27 -11
- package/dist/v1/basics/array.mjs +51 -9
- package/dist/v1/basics/clock.cjs +94 -42
- package/dist/v1/basics/clock.d.mts +10 -10
- package/dist/v1/basics/clock.mjs +91 -54
- package/dist/v1/basics/deprecated/html.cjs +246 -0
- package/dist/v1/basics/deprecated/html.d.mts +63 -0
- package/dist/v1/basics/deprecated/html.mjs +190 -0
- package/dist/v1/basics/extendObjType/Buffer.cjs +13 -0
- package/dist/v1/basics/extendObjType/Buffer.d.mts +4 -0
- package/dist/v1/basics/extendObjType/Buffer.mjs +8 -0
- package/dist/v1/basics/html.cjs +149 -130
- package/dist/v1/basics/html.d.mts +26 -61
- package/dist/v1/basics/html.mjs +113 -105
- package/dist/v1/basics/index.cjs +2 -0
- package/dist/v1/basics/index.d.mts +3 -1
- package/dist/v1/basics/index.mjs +3 -3
- package/dist/v1/basics/mediaContent.cjs +51 -9
- package/dist/v1/basics/mediaContent.d.mts +0 -87
- package/dist/v1/basics/mediaContent.mjs +40 -10
- package/dist/v1/basics/objChecker.cjs +7 -5
- package/dist/v1/basics/objChecker.d.mts +3 -2
- package/dist/v1/basics/objChecker.mjs +6 -6
- package/dist/v1/basics/objFilter.cjs +40 -18
- package/dist/v1/basics/objFilter.d.mts +6 -6
- package/dist/v1/basics/objFilter.mjs +32 -17
- package/dist/v1/basics/simpleMath.cjs +81 -25
- package/dist/v1/basics/simpleMath.d.mts +2 -2
- package/dist/v1/basics/simpleMath.mjs +70 -27
- package/dist/v1/basics/text.cjs +76 -31
- package/dist/v1/basics/text.d.mts +69 -7
- package/dist/v1/basics/text.mjs +62 -31
- package/dist/v1/index.cjs +4 -2
- package/dist/v1/index.d.mts +4 -2
- package/dist/v1/index.mjs +4 -4
- package/dist/v1/libs/TinyAdvancedRaffle.cjs +71 -255
- package/dist/v1/libs/TinyAdvancedRaffle.d.mts +6 -134
- package/dist/v1/libs/TinyAdvancedRaffle.mjs +69 -228
- package/dist/v1/libs/TinyAfterScrollWatcher.cjs +17 -1
- package/dist/v1/libs/TinyAfterScrollWatcher.d.mts +4 -1
- package/dist/v1/libs/TinyAfterScrollWatcher.mjs +15 -1
- package/dist/v1/libs/TinyAnalogClock.cjs +60 -0
- package/dist/v1/libs/TinyAnalogClock.d.mts +6 -0
- package/dist/v1/libs/TinyAnalogClock.mjs +57 -0
- package/dist/v1/libs/TinyClipboard.cjs +2 -0
- package/dist/v1/libs/TinyClipboard.d.mts +4 -2
- package/dist/v1/libs/TinyClipboard.mjs +2 -0
- package/dist/v1/libs/TinyColorConverter.cjs +1 -0
- package/dist/v1/libs/TinyColorConverter.d.mts +2 -1
- package/dist/v1/libs/TinyColorConverter.mjs +1 -0
- package/dist/v1/libs/TinyDayNightCycle.cjs +67 -42
- package/dist/v1/libs/TinyDayNightCycle.d.mts +2 -7
- package/dist/v1/libs/TinyDayNightCycle.mjs +65 -41
- package/dist/v1/libs/TinyDragDropDetector.cjs +25 -0
- package/dist/v1/libs/TinyDragDropDetector.d.mts +6 -0
- package/dist/v1/libs/TinyDragDropDetector.mjs +22 -0
- package/dist/v1/libs/TinyDragger.cjs +46 -19
- package/dist/v1/libs/TinyDragger.mjs +45 -18
- package/dist/v1/libs/TinyElementObserver.cjs +39 -0
- package/dist/v1/libs/TinyElementObserver.d.mts +6 -0
- package/dist/v1/libs/TinyElementObserver.mjs +36 -0
- package/dist/v1/libs/TinyGamepad.cjs +131 -1
- package/dist/v1/libs/TinyGamepad.mjs +129 -1
- package/dist/v1/libs/TinyHtml.cjs +1 -1
- package/dist/v1/libs/TinyHtml.mjs +2 -2
- package/dist/v1/libs/TinyI18.cjs +61 -0
- package/dist/v1/libs/TinyI18.d.mts +14 -0
- package/dist/v1/libs/TinyI18.mjs +55 -0
- package/dist/v1/libs/TinyIframeEvents.cjs +26 -196
- package/dist/v1/libs/TinyIframeEvents.d.mts +3 -122
- package/dist/v1/libs/TinyIframeEvents.mjs +26 -171
- package/dist/v1/libs/TinyLocalStorage.cjs +53 -205
- package/dist/v1/libs/TinyLocalStorage.d.mts +6 -127
- package/dist/v1/libs/TinyLocalStorage.mjs +50 -178
- package/dist/v1/libs/TinyMediaPlayer.cjs +74 -2
- package/dist/v1/libs/TinyMediaPlayer.d.mts +12 -2
- package/dist/v1/libs/TinyMediaPlayer.mjs +68 -2
- package/dist/v1/libs/TinyNewWinEvents.cjs +39 -197
- package/dist/v1/libs/TinyNewWinEvents.d.mts +6 -119
- package/dist/v1/libs/TinyNewWinEvents.mjs +36 -172
- package/dist/v1/libs/TinyNotifyCenter.cjs +36 -0
- package/dist/v1/libs/TinyNotifyCenter.d.mts +6 -0
- package/dist/v1/libs/TinyNotifyCenter.mjs +32 -0
- package/dist/v1/libs/TinyRadioFm.cjs +40 -3
- package/dist/v1/libs/TinyRadioFm.d.mts +3 -3
- package/dist/v1/libs/TinyRadioFm.mjs +37 -3
- package/dist/v1/libs/TinyRateLimiter.cjs +52 -0
- package/dist/v1/libs/TinyRateLimiter.d.mts +6 -0
- package/dist/v1/libs/TinyRateLimiter.mjs +48 -0
- package/dist/v1/libs/TinySmartScroller.cjs +56 -205
- package/dist/v1/libs/TinySmartScroller.d.mts +19 -152
- package/dist/v1/libs/TinySmartScroller.mjs +55 -181
- package/dist/v1/libs/TinyTextDiffer.cjs +19 -18
- package/dist/v1/libs/TinyTextDiffer.d.mts +1 -0
- package/dist/v1/libs/TinyTextDiffer.mjs +16 -17
- package/dist/v1/libs/TinyTextarea.cjs +19 -0
- package/dist/v1/libs/TinyTextarea.d.mts +6 -0
- package/dist/v1/libs/TinyTextarea.mjs +17 -0
- package/dist/v1/libs/TinyTimeout.cjs +11 -1
- package/dist/v1/libs/TinyTimeout.mjs +9 -1
- package/dist/v1/libs/TinyToastNotify.cjs +35 -0
- package/dist/v1/libs/TinyToastNotify.d.mts +6 -0
- package/dist/v1/libs/TinyToastNotify.mjs +31 -0
- package/dist/v1/libs/TinyUploadClicker.cjs +20 -0
- package/dist/v1/libs/TinyUploadClicker.d.mts +6 -0
- package/dist/v1/libs/TinyUploadClicker.mjs +17 -0
- package/dist/v1/libs/UltraRandomMsgGen.cjs +148 -35
- package/dist/v1/libs/UltraRandomMsgGen.d.mts +17 -3
- package/dist/v1/libs/UltraRandomMsgGen.mjs +133 -34
- package/dist/v1/libs/utils.cjs +21 -0
- package/dist/v1/libs/utils.d.mts +2 -0
- package/dist/v1/libs/utils.mjs +16 -0
- package/docs/v1/Exports.md +0 -1
- package/docs/v1/README.md +1 -1
- package/docs/v1/basics/array.md +2 -2
- package/docs/v1/basics/deprecated/html.md +17 -0
- package/docs/v1/basics/fullScreen.md +1 -1
- package/docs/v1/basics/html.md +12 -26
- package/docs/v1/basics/mediaContent.md +1 -1
- package/docs/v1/basics/objChecker.md +1 -1
- package/docs/v1/basics/objFilter.md +1 -1
- package/docs/v1/basics/text.md +2 -2
- package/docs/v1/fileManager/main.md +1 -1
- package/docs/v1/libs/ColorSafeStringify.md +1 -1
- package/docs/v1/libs/TinyAfterScrollWatcher.md +1 -1
- package/docs/v1/libs/TinyAnalogClock.md +1 -1
- package/docs/v1/libs/TinyArrayComparator.md +1 -1
- package/docs/v1/libs/TinyArrayPaginator.md +1 -1
- package/docs/v1/libs/TinyClassManager/TinyPluginInliner.md +2 -2
- package/docs/v1/libs/TinyClassManager.md +1 -1
- package/docs/v1/libs/TinyClipboard.md +1 -1
- package/docs/v1/libs/TinyCookieConsent.md +1 -1
- package/docs/v1/libs/TinyDomReadyManager.md +1 -1
- package/docs/v1/libs/TinyDragDropDetector.md +1 -1
- package/docs/v1/libs/TinyDragger.md +1 -1
- package/docs/v1/libs/TinyElementObserver.md +1 -1
- package/docs/v1/libs/TinyHtml.md +1 -1
- package/docs/v1/libs/TinyIframeEvents.md +10 -10
- package/docs/v1/libs/TinyLevelUp.md +1 -1
- package/docs/v1/libs/TinyLoadingScreen.md +1 -1
- package/docs/v1/libs/TinyLocalStorage.md +3 -3
- package/docs/v1/libs/TinyNewWinEvents.md +10 -11
- package/docs/v1/libs/TinyNotifications.md +1 -1
- package/docs/v1/libs/TinyPromiseQueue.md +2 -2
- package/docs/v1/libs/TinyTextDiffer.md +1 -1
- package/docs/v1/libs/TinyTextarea.md +1 -1
- package/package.json +15 -5
- package/dist/v1/TinyBasicsEs.min.js.LICENSE.txt +0 -8
- package/dist/v1/TinyEssentials.min.js.LICENSE.txt +0 -8
- package/dist/v1/TinyEvents.min.js +0 -1
- package/dist/v1/TinyUploadClicker.min.js.LICENSE.txt +0 -8
- package/dist/v1/build/TinyEvents.cjs +0 -7
- package/dist/v1/build/TinyEvents.d.mts +0 -3
- package/dist/v1/build/TinyEvents.mjs +0 -2
- package/dist/v1/libs/TinyEvents.cjs +0 -395
- package/dist/v1/libs/TinyEvents.d.mts +0 -164
- package/dist/v1/libs/TinyEvents.mjs +0 -360
- package/docs/v1/libs/TinyEvents.md +0 -187
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { createCheckDestroyed } from './utils.mjs';
|
|
2
|
+
const checkDestroy = createCheckDestroyed('UltraRandomMsgGen');
|
|
1
3
|
const defaultWords = [
|
|
2
4
|
'lorem',
|
|
3
5
|
'ipsum',
|
|
@@ -51,6 +53,33 @@ const defaultEmojis = [
|
|
|
51
53
|
'🎮',
|
|
52
54
|
'🥓',
|
|
53
55
|
'🍮',
|
|
56
|
+
'🍬',
|
|
57
|
+
'🍓',
|
|
58
|
+
'🍒',
|
|
59
|
+
'🥝',
|
|
60
|
+
'🥑',
|
|
61
|
+
'🍄',
|
|
62
|
+
'🌊',
|
|
63
|
+
'☁️',
|
|
64
|
+
'🌟',
|
|
65
|
+
'🌙',
|
|
66
|
+
'🧚',
|
|
67
|
+
'🐾',
|
|
68
|
+
'🐥',
|
|
69
|
+
'🐼',
|
|
70
|
+
'🐨',
|
|
71
|
+
'🐳',
|
|
72
|
+
'✨',
|
|
73
|
+
'🧁',
|
|
74
|
+
'🌸',
|
|
75
|
+
'🍃',
|
|
76
|
+
'💎',
|
|
77
|
+
'🎐',
|
|
78
|
+
'🎀',
|
|
79
|
+
'🫧',
|
|
80
|
+
'☄️',
|
|
81
|
+
'🛸',
|
|
82
|
+
'🔮',
|
|
54
83
|
];
|
|
55
84
|
const defaultNouns = [
|
|
56
85
|
'pudding',
|
|
@@ -234,6 +263,14 @@ const defaultTemplates = [
|
|
|
234
263
|
'Do {noun}s have feelings? Asking for a {adj} friend.',
|
|
235
264
|
'I trusted the {noun} and all I got was a glitter-covered sock.',
|
|
236
265
|
'Plot twist: the {adj} {noun} was inside us all along.',
|
|
266
|
+
// ✨ Magical/Dreamy (New Category)
|
|
267
|
+
'In the glow of the {adj} moon, the {noun} began to {verb}.',
|
|
268
|
+
'A sprinkle of {adj} dust made the {noun} {verb} through the air.',
|
|
269
|
+
'The {noun} whispered a {adj} secret that made everyone {verb}.',
|
|
270
|
+
'Everything felt {adj} and {adj}, especially when the {noun} {verb}ed.',
|
|
271
|
+
// 🌀 Chaos/Glitch (New Category)
|
|
272
|
+
'The {noun} is {verb}ing! The {noun} is {verb}ing! AAAAA!',
|
|
273
|
+
'Glitch in the {noun}: the {adj} {noun} just {verb}ed out of existence.',
|
|
237
274
|
// Mini cute explosions and chaos
|
|
238
275
|
'The {adj} {noun} {verb} and {verb} all over the {adj} {noun}!',
|
|
239
276
|
'Oops! {noun}s {verb}ed into the {adj} {noun} while {verb}ing crazily.',
|
|
@@ -429,8 +466,21 @@ class UltraRandomMsgGen {
|
|
|
429
466
|
this.#validateArray(value, 'defaultTemplates');
|
|
430
467
|
this.#defaultTemplates = [...value];
|
|
431
468
|
}
|
|
469
|
+
/**
|
|
470
|
+
* Tracks whether the instance has been destroyed.
|
|
471
|
+
* @type {boolean}
|
|
472
|
+
*/
|
|
473
|
+
#destroyed = false;
|
|
474
|
+
/**
|
|
475
|
+
* Gets the current destruction status of the instance.
|
|
476
|
+
*
|
|
477
|
+
* @returns {boolean} True if the instance is destroyed, false otherwise.
|
|
478
|
+
*/
|
|
479
|
+
get destroyed() {
|
|
480
|
+
return this.#destroyed;
|
|
481
|
+
}
|
|
432
482
|
/** @type {MsgGenConfig} */
|
|
433
|
-
config = {
|
|
483
|
+
#config = {
|
|
434
484
|
minLength: 10,
|
|
435
485
|
maxLength: 300,
|
|
436
486
|
readable: true,
|
|
@@ -455,6 +505,15 @@ class UltraRandomMsgGen {
|
|
|
455
505
|
emojiChance: 0.3, // 30% chance per line
|
|
456
506
|
},
|
|
457
507
|
};
|
|
508
|
+
get config() {
|
|
509
|
+
checkDestroy(this.#destroyed);
|
|
510
|
+
return structuredClone(this.#config);
|
|
511
|
+
}
|
|
512
|
+
#symbols = '!@#$%^&*()-_=+[]{}|;:,.<>?/\\~'.split('');
|
|
513
|
+
get symbols() {
|
|
514
|
+
checkDestroy(this.#destroyed);
|
|
515
|
+
return structuredClone(this.#symbols);
|
|
516
|
+
}
|
|
458
517
|
/**
|
|
459
518
|
* Creates an instance of UltraRandomMsgGen.
|
|
460
519
|
*
|
|
@@ -485,7 +544,6 @@ class UltraRandomMsgGen {
|
|
|
485
544
|
* @param {number} [config.line.emojiChance=0.3] - Probability (0–1) of placing emoji per line.
|
|
486
545
|
*/
|
|
487
546
|
constructor(config = {}) {
|
|
488
|
-
this.symbols = '!@#$%^&*()-_=+[]{}|;:,.<>?/\\~'.split('');
|
|
489
547
|
const { minLength, maxLength, readable, useEmojis, includeNumbers, includeSymbols, allowWeirdSpacing, emojiSet, wordSet, mode, grammar, repeatWords, emojiPlacement, paragraphs, line, } = config;
|
|
490
548
|
// Validations
|
|
491
549
|
if (minLength !== undefined && (!Number.isInteger(minLength) || minLength < 1)) {
|
|
@@ -579,13 +637,13 @@ class UltraRandomMsgGen {
|
|
|
579
637
|
throw new RangeError('config.line.emojiChance must be a number between 0 and 1');
|
|
580
638
|
}
|
|
581
639
|
}
|
|
582
|
-
this
|
|
583
|
-
this
|
|
584
|
-
this
|
|
585
|
-
this
|
|
586
|
-
this
|
|
587
|
-
this
|
|
588
|
-
Object.assign(this
|
|
640
|
+
this.#config.emojiSet = [...UltraRandomMsgGen.#defaultEmojis];
|
|
641
|
+
this.#config.wordSet = [...UltraRandomMsgGen.#defaultWords];
|
|
642
|
+
this.#config.grammar.templates = [...UltraRandomMsgGen.#defaultTemplates];
|
|
643
|
+
this.#config.grammar.nouns = [...UltraRandomMsgGen.#defaultNouns];
|
|
644
|
+
this.#config.grammar.verbs = [...UltraRandomMsgGen.#defaultVerbs];
|
|
645
|
+
this.#config.grammar.adjectives = [...UltraRandomMsgGen.#defaultAdjectives];
|
|
646
|
+
Object.assign(this.#config, config);
|
|
589
647
|
}
|
|
590
648
|
/**
|
|
591
649
|
* Merges new configuration values into the current instance.
|
|
@@ -593,7 +651,8 @@ class UltraRandomMsgGen {
|
|
|
593
651
|
* @returns {this} - The instance for chaining.
|
|
594
652
|
*/
|
|
595
653
|
configure(newConfig = {}) {
|
|
596
|
-
|
|
654
|
+
checkDestroy(this.#destroyed);
|
|
655
|
+
Object.assign(this.#config, newConfig);
|
|
597
656
|
return this;
|
|
598
657
|
}
|
|
599
658
|
/**
|
|
@@ -602,7 +661,8 @@ class UltraRandomMsgGen {
|
|
|
602
661
|
* @returns {this} - The instance for chaining.
|
|
603
662
|
*/
|
|
604
663
|
setGrammarTemplates(...templates) {
|
|
605
|
-
this
|
|
664
|
+
checkDestroy(this.#destroyed);
|
|
665
|
+
this.#config.grammar.templates = templates.flat();
|
|
606
666
|
return this;
|
|
607
667
|
}
|
|
608
668
|
/**
|
|
@@ -611,7 +671,8 @@ class UltraRandomMsgGen {
|
|
|
611
671
|
* @returns {this} - The instance for chaining.
|
|
612
672
|
*/
|
|
613
673
|
addGrammarTemplates(...templates) {
|
|
614
|
-
this
|
|
674
|
+
checkDestroy(this.#destroyed);
|
|
675
|
+
this.#config.grammar.templates.push(...templates.flat());
|
|
615
676
|
return this;
|
|
616
677
|
}
|
|
617
678
|
/**
|
|
@@ -620,7 +681,8 @@ class UltraRandomMsgGen {
|
|
|
620
681
|
* @returns {this} - The instance for chaining.
|
|
621
682
|
*/
|
|
622
683
|
setGrammarNouns(...nouns) {
|
|
623
|
-
this
|
|
684
|
+
checkDestroy(this.#destroyed);
|
|
685
|
+
this.#config.grammar.nouns = nouns.flat();
|
|
624
686
|
return this;
|
|
625
687
|
}
|
|
626
688
|
/**
|
|
@@ -629,7 +691,8 @@ class UltraRandomMsgGen {
|
|
|
629
691
|
* @returns {this} - The instance for chaining.
|
|
630
692
|
*/
|
|
631
693
|
addGrammarNouns(...nouns) {
|
|
632
|
-
this
|
|
694
|
+
checkDestroy(this.#destroyed);
|
|
695
|
+
this.#config.grammar.nouns.push(...nouns.flat());
|
|
633
696
|
return this;
|
|
634
697
|
}
|
|
635
698
|
/**
|
|
@@ -638,7 +701,8 @@ class UltraRandomMsgGen {
|
|
|
638
701
|
* @returns {this} - The instance for chaining.
|
|
639
702
|
*/
|
|
640
703
|
setGrammarVerbs(...verbs) {
|
|
641
|
-
this
|
|
704
|
+
checkDestroy(this.#destroyed);
|
|
705
|
+
this.#config.grammar.verbs = verbs.flat();
|
|
642
706
|
return this;
|
|
643
707
|
}
|
|
644
708
|
/**
|
|
@@ -647,7 +711,8 @@ class UltraRandomMsgGen {
|
|
|
647
711
|
* @returns {this} - The instance for chaining.
|
|
648
712
|
*/
|
|
649
713
|
addGrammarVerbs(...verbs) {
|
|
650
|
-
this
|
|
714
|
+
checkDestroy(this.#destroyed);
|
|
715
|
+
this.#config.grammar.verbs.push(...verbs.flat());
|
|
651
716
|
return this;
|
|
652
717
|
}
|
|
653
718
|
/**
|
|
@@ -656,7 +721,8 @@ class UltraRandomMsgGen {
|
|
|
656
721
|
* @returns {this} - The instance for chaining.
|
|
657
722
|
*/
|
|
658
723
|
setGrammarAdjectives(...adjectives) {
|
|
659
|
-
this
|
|
724
|
+
checkDestroy(this.#destroyed);
|
|
725
|
+
this.#config.grammar.adjectives = adjectives.flat();
|
|
660
726
|
return this;
|
|
661
727
|
}
|
|
662
728
|
/**
|
|
@@ -665,7 +731,8 @@ class UltraRandomMsgGen {
|
|
|
665
731
|
* @returns {this} - The instance for chaining.
|
|
666
732
|
*/
|
|
667
733
|
addGrammarAdjectives(...adjectives) {
|
|
668
|
-
this
|
|
734
|
+
checkDestroy(this.#destroyed);
|
|
735
|
+
this.#config.grammar.adjectives.push(...adjectives.flat());
|
|
669
736
|
return this;
|
|
670
737
|
}
|
|
671
738
|
/**
|
|
@@ -674,8 +741,9 @@ class UltraRandomMsgGen {
|
|
|
674
741
|
* @returns {this} - The instance for chaining.
|
|
675
742
|
*/
|
|
676
743
|
removeGrammarTemplates(...templates) {
|
|
744
|
+
checkDestroy(this.#destroyed);
|
|
677
745
|
const removeSet = new Set(templates.flat());
|
|
678
|
-
this
|
|
746
|
+
this.#config.grammar.templates = this.#config.grammar.templates.filter((t) => !removeSet.has(t));
|
|
679
747
|
return this;
|
|
680
748
|
}
|
|
681
749
|
/**
|
|
@@ -684,8 +752,9 @@ class UltraRandomMsgGen {
|
|
|
684
752
|
* @returns {this} - The instance for chaining.
|
|
685
753
|
*/
|
|
686
754
|
removeGrammarNouns(...nouns) {
|
|
755
|
+
checkDestroy(this.#destroyed);
|
|
687
756
|
const removeSet = new Set(nouns.flat());
|
|
688
|
-
this
|
|
757
|
+
this.#config.grammar.nouns = this.#config.grammar.nouns.filter((n) => !removeSet.has(n));
|
|
689
758
|
return this;
|
|
690
759
|
}
|
|
691
760
|
/**
|
|
@@ -694,8 +763,9 @@ class UltraRandomMsgGen {
|
|
|
694
763
|
* @returns {this} - The instance for chaining.
|
|
695
764
|
*/
|
|
696
765
|
removeGrammarVerbs(...verbs) {
|
|
766
|
+
checkDestroy(this.#destroyed);
|
|
697
767
|
const removeSet = new Set(verbs.flat());
|
|
698
|
-
this
|
|
768
|
+
this.#config.grammar.verbs = this.#config.grammar.verbs.filter((v) => !removeSet.has(v));
|
|
699
769
|
return this;
|
|
700
770
|
}
|
|
701
771
|
/**
|
|
@@ -704,8 +774,9 @@ class UltraRandomMsgGen {
|
|
|
704
774
|
* @returns {this} - The instance for chaining.
|
|
705
775
|
*/
|
|
706
776
|
removeGrammarAdjectives(...adjectives) {
|
|
777
|
+
checkDestroy(this.#destroyed);
|
|
707
778
|
const removeSet = new Set(adjectives.flat());
|
|
708
|
-
this
|
|
779
|
+
this.#config.grammar.adjectives = this.#config.grammar.adjectives.filter((a) => !removeSet.has(a));
|
|
709
780
|
return this;
|
|
710
781
|
}
|
|
711
782
|
/**
|
|
@@ -714,7 +785,8 @@ class UltraRandomMsgGen {
|
|
|
714
785
|
* @returns {this} - The instance for chaining.
|
|
715
786
|
*/
|
|
716
787
|
setWords(...words) {
|
|
717
|
-
this
|
|
788
|
+
checkDestroy(this.#destroyed);
|
|
789
|
+
this.#config.wordSet = words.flat();
|
|
718
790
|
return this;
|
|
719
791
|
}
|
|
720
792
|
/**
|
|
@@ -723,7 +795,8 @@ class UltraRandomMsgGen {
|
|
|
723
795
|
* @returns {this} - The instance for chaining.
|
|
724
796
|
*/
|
|
725
797
|
addWords(...words) {
|
|
726
|
-
this
|
|
798
|
+
checkDestroy(this.#destroyed);
|
|
799
|
+
this.#config.wordSet.push(...words.flat());
|
|
727
800
|
return this;
|
|
728
801
|
}
|
|
729
802
|
/**
|
|
@@ -732,8 +805,9 @@ class UltraRandomMsgGen {
|
|
|
732
805
|
* @returns {this} - The instance for chaining.
|
|
733
806
|
*/
|
|
734
807
|
removeWords(...words) {
|
|
808
|
+
checkDestroy(this.#destroyed);
|
|
735
809
|
const removeSet = new Set(words.flat());
|
|
736
|
-
this
|
|
810
|
+
this.#config.wordSet = this.#config.wordSet.filter((word) => !removeSet.has(word));
|
|
737
811
|
return this;
|
|
738
812
|
}
|
|
739
813
|
/**
|
|
@@ -742,7 +816,8 @@ class UltraRandomMsgGen {
|
|
|
742
816
|
* @returns {this} - The instance for chaining.
|
|
743
817
|
*/
|
|
744
818
|
setEmojis(...emojis) {
|
|
745
|
-
this
|
|
819
|
+
checkDestroy(this.#destroyed);
|
|
820
|
+
this.#config.emojiSet = emojis.flat();
|
|
746
821
|
return this;
|
|
747
822
|
}
|
|
748
823
|
/**
|
|
@@ -751,7 +826,8 @@ class UltraRandomMsgGen {
|
|
|
751
826
|
* @returns {this} - The instance for chaining.
|
|
752
827
|
*/
|
|
753
828
|
addEmojis(...emojis) {
|
|
754
|
-
this
|
|
829
|
+
checkDestroy(this.#destroyed);
|
|
830
|
+
this.#config.emojiSet.push(...emojis.flat());
|
|
755
831
|
return this;
|
|
756
832
|
}
|
|
757
833
|
/**
|
|
@@ -760,8 +836,9 @@ class UltraRandomMsgGen {
|
|
|
760
836
|
* @returns {this} - The instance for chaining.
|
|
761
837
|
*/
|
|
762
838
|
removeEmojis(...emojis) {
|
|
839
|
+
checkDestroy(this.#destroyed);
|
|
763
840
|
const removeSet = new Set(emojis.flat());
|
|
764
|
-
this
|
|
841
|
+
this.#config.emojiSet = this.#config.emojiSet.filter((emoji) => !removeSet.has(emoji));
|
|
765
842
|
return this;
|
|
766
843
|
}
|
|
767
844
|
/**
|
|
@@ -779,7 +856,7 @@ class UltraRandomMsgGen {
|
|
|
779
856
|
* @returns {string} - A chunk (word, emoji, symbol, number, etc.).
|
|
780
857
|
*/
|
|
781
858
|
_generateChunk() {
|
|
782
|
-
const { wordSet, emojiSet, includeNumbers, includeSymbols, useEmojis, readable, mode, emojiPlacement, } = this
|
|
859
|
+
const { wordSet, emojiSet, includeNumbers, includeSymbols, useEmojis, readable, mode, emojiPlacement, } = this.#config;
|
|
783
860
|
if (mode === 'natural') {
|
|
784
861
|
return this._generateNaturalSentence();
|
|
785
862
|
}
|
|
@@ -794,7 +871,7 @@ class UltraRandomMsgGen {
|
|
|
794
871
|
pools.push(Math.floor(Math.random() * 99999).toString());
|
|
795
872
|
}
|
|
796
873
|
if (includeSymbols) {
|
|
797
|
-
pools.push(this._getRandomItem(this
|
|
874
|
+
pools.push(this._getRandomItem(this.#symbols));
|
|
798
875
|
}
|
|
799
876
|
if (emojiPlacement === 'inline' && useEmojis && emojiSet.length) {
|
|
800
877
|
pools.push(this._getRandomItem(emojiSet));
|
|
@@ -807,7 +884,7 @@ class UltraRandomMsgGen {
|
|
|
807
884
|
* @returns {string} - A generated sentence.
|
|
808
885
|
*/
|
|
809
886
|
_generateNaturalSentence() {
|
|
810
|
-
const { templates, nouns, verbs, adjectives } = this
|
|
887
|
+
const { templates, nouns, verbs, adjectives } = this.#config.grammar;
|
|
811
888
|
let template = this._getRandomItem(templates);
|
|
812
889
|
return template
|
|
813
890
|
.replace(/{noun}/g, () => this._getRandomItem(nouns))
|
|
@@ -822,7 +899,7 @@ class UltraRandomMsgGen {
|
|
|
822
899
|
* @returns {string} - A generated line.
|
|
823
900
|
*/
|
|
824
901
|
_generateLine(targetLength, seenWords) {
|
|
825
|
-
const { allowWeirdSpacing, repeatWords, readable, emojiSet, useEmojis, emojiPlacement, line } = this
|
|
902
|
+
const { allowWeirdSpacing, repeatWords, readable, emojiSet, useEmojis, emojiPlacement, line } = this.#config;
|
|
826
903
|
const parts = [];
|
|
827
904
|
seenWords ??= new Set();
|
|
828
905
|
while (parts.join(' ').length < targetLength) {
|
|
@@ -856,7 +933,7 @@ class UltraRandomMsgGen {
|
|
|
856
933
|
* @returns {string[]} - Array of lines that form the paragraph.
|
|
857
934
|
*/
|
|
858
935
|
_generateParagraphLines(totalLength) {
|
|
859
|
-
const { line } = this
|
|
936
|
+
const { line } = this.#config;
|
|
860
937
|
const lines = [];
|
|
861
938
|
const seenWords = new Set();
|
|
862
939
|
let currentTotal = 0;
|
|
@@ -874,7 +951,8 @@ class UltraRandomMsgGen {
|
|
|
874
951
|
* @returns {string} - A full generated message.
|
|
875
952
|
*/
|
|
876
953
|
generate() {
|
|
877
|
-
|
|
954
|
+
checkDestroy(this.#destroyed);
|
|
955
|
+
const { minLength, maxLength, paragraphs } = this.#config;
|
|
878
956
|
const totalLength = Math.floor(Math.random() * (maxLength - minLength + 1)) + minLength;
|
|
879
957
|
if (paragraphs && typeof paragraphs === 'object') {
|
|
880
958
|
const paraCount = Math.floor(Math.random() * (paragraphs.max - paragraphs.min + 1)) + paragraphs.min;
|
|
@@ -888,5 +966,26 @@ class UltraRandomMsgGen {
|
|
|
888
966
|
}
|
|
889
967
|
return this._generateParagraphLines(totalLength).join('\n');
|
|
890
968
|
}
|
|
969
|
+
/**
|
|
970
|
+
* Safely destroys the instance by clearing references to aid garbage collection.
|
|
971
|
+
* Once destroyed, the instance cannot be used to generate new messages.
|
|
972
|
+
*
|
|
973
|
+
* @throws {Error} If the instance has already been destroyed.
|
|
974
|
+
* @returns {void}
|
|
975
|
+
*/
|
|
976
|
+
destroy() {
|
|
977
|
+
if (this.destroyed)
|
|
978
|
+
return;
|
|
979
|
+
// Clear primary memory references
|
|
980
|
+
this.#symbols = [];
|
|
981
|
+
this.#config.emojiSet = [];
|
|
982
|
+
this.#config.wordSet = [];
|
|
983
|
+
this.#config.grammar.templates = [];
|
|
984
|
+
this.#config.grammar.nouns = [];
|
|
985
|
+
this.#config.grammar.verbs = [];
|
|
986
|
+
this.#config.grammar.adjectives = [];
|
|
987
|
+
// Lock the instance
|
|
988
|
+
this.#destroyed = true;
|
|
989
|
+
}
|
|
891
990
|
}
|
|
892
991
|
export default UltraRandomMsgGen;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Creates a internal method to verify if the instance was been destroyed.
|
|
5
|
+
* @param {string} name
|
|
6
|
+
*/
|
|
7
|
+
const createCheckDestroyed =
|
|
8
|
+
(name) =>
|
|
9
|
+
/**
|
|
10
|
+
* Internal method to verify if the instance has been destroyed.
|
|
11
|
+
* Throws an error if any operation is attempted after destruction.
|
|
12
|
+
* @param {boolean} isDestroyed
|
|
13
|
+
* @throws {Error}
|
|
14
|
+
* @returns {void}
|
|
15
|
+
*/
|
|
16
|
+
(isDestroyed) => {
|
|
17
|
+
if (isDestroyed)
|
|
18
|
+
throw new Error(`This ${name} instance has been destroyed and can no longer be used.`);
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
exports.createCheckDestroyed = createCheckDestroyed;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Creates a internal method to verify if the instance was been destroyed.
|
|
3
|
+
* @param {string} name
|
|
4
|
+
*/
|
|
5
|
+
export const createCheckDestroyed = (name) =>
|
|
6
|
+
/**
|
|
7
|
+
* Internal method to verify if the instance has been destroyed.
|
|
8
|
+
* Throws an error if any operation is attempted after destruction.
|
|
9
|
+
* @param {boolean} isDestroyed
|
|
10
|
+
* @throws {Error}
|
|
11
|
+
* @returns {void}
|
|
12
|
+
*/
|
|
13
|
+
(isDestroyed) => {
|
|
14
|
+
if (isDestroyed)
|
|
15
|
+
throw new Error(`This ${name} instance has been destroyed and can no longer be used.`);
|
|
16
|
+
};
|
package/docs/v1/Exports.md
CHANGED
package/docs/v1/README.md
CHANGED
|
@@ -41,7 +41,6 @@ Here, you can navigate through different sections of the project. Below are the
|
|
|
41
41
|
- ✍️ **[TinyTextRangeEditor](./libs/TinyTextRangeEditor.md)** — An flexible text range manipulation utility for `input` and `textarea` elements. Supports selection, cursor control, tag insertion, attribute handling, inline editing, formatting, and advanced wrap/toggle logic with optional spacing auto-completion.
|
|
42
42
|
- ⏳ **[TinyTimeout](./libs/TinyTimeout.md)** — A dynamic timeout and delay manager with support for usage-based throttling, delay scaling, configurable decay intervals, and asynchronous polling for conditions.
|
|
43
43
|
- 🌈 **[TinyColorConverter](./libs/TinyColorConverter.md)** — A complete color conversion toolkit supporting hex, RGB(A), HSL(A), and integer formats, with smooth gradient generation, color parsing, and multi-format output conversion.
|
|
44
|
-
- 📡 **[TinyEvents](./libs/TinyEvents.md)** — A lightweight and dependency-free event emitter inspired by Node.js, supporting persistent and one-time listeners, listener inspection, and max listener limits.
|
|
45
44
|
- 📦 **[TinyLocalStorage](./libs/TinyLocalStorage.md)** — A tiny wrapper for `localStorage` with full support for objects, arrays, `Map`, `Set`, and typed value helpers like string, number, and boolean.
|
|
46
45
|
- 🖼️ **[TinyIframeEvents](./libs/TinyIframeEvents.md)** — A structured `postMessage`-based event router for secure and reliable communication between a parent window and its embedded iframe. Supports directional filtering, origin enforcement, payload transport, and listener lifecycle.
|
|
47
46
|
- 🪟 **[TinyNewWinEvents](./libs/TinyNewWinEvents.md)** — A smart, route-based `postMessage` system for structured communication between a main window and a popup (`window.open`). Includes queueing, origin enforcement, and lifecycle tracking.
|
|
@@ -63,6 +62,7 @@ Here, you can navigate through different sections of the project. Below are the
|
|
|
63
62
|
* 🕒 **[TinyAnalogClock](./libs/TinyAnalogClock.md)** — A lightweight analog clock engine for managing time-based rotations, supporting custom offsets, smooth transitions, and easy binding to CSS variables rendering.
|
|
64
63
|
* 🔍 **[TinyArrayComparator](./libs/TinyArrayComparator.md)** — A lightweight, highly optimized JavaScript utility class designed to compare two arrays and efficiently detect which items were **added** or **deleted**.
|
|
65
64
|
* 🧠 **[TinyMamdaniInferenceSystem](./libs/TinyMamdaniInferenceSystem.md)** — A implementation of a Mamdani Inference System, allowing you to model logic using trapezoidal membership functions.
|
|
65
|
+
* 📻 **[TinyRadioFm](./libs/TinyRadioFm.md)** — It is designed to handle complex playback sequences, including music and voice playlists, scheduled timeline mutations, and custom content injections, all while maintaining absolute reproducibility through a mathematical seed.
|
|
66
66
|
* ⏯️ **[TinyMediaPlayer](./libs/TinyMediaPlayer.md)** — A universal media player architecture utilizing an adapter pattern to orchestrate multiple platform APIs, featuring robust playlist management, playback controls, and weighted random selection.
|
|
67
67
|
|
|
68
68
|
### 2.1. **`libs/TinyClassManager`**
|
package/docs/v1/basics/array.md
CHANGED
|
@@ -15,7 +15,7 @@ A minimal and handy module offering a couple of focused utilities for working wi
|
|
|
15
15
|
### 🚀 Usage
|
|
16
16
|
|
|
17
17
|
```js
|
|
18
|
-
import { shuffleArray } from '
|
|
18
|
+
import { shuffleArray } from 'tiny-essentials/basics/array';
|
|
19
19
|
|
|
20
20
|
const fruits = ['apple', 'banana', 'cherry', 'date'];
|
|
21
21
|
shuffleArray(fruits);
|
|
@@ -37,7 +37,7 @@ You can find the original discussion here:
|
|
|
37
37
|
### 📌 Function Signature
|
|
38
38
|
|
|
39
39
|
```js
|
|
40
|
-
arraySortPositions(item
|
|
40
|
+
arraySortPositions(item?: string, isReverse?: boolean): (a: Object<string|number, *>, b: Object<string|number, *>) => number
|
|
41
41
|
```
|
|
42
42
|
|
|
43
43
|
### 🧠 Parameters
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
### 🌐 `fetchTemplate(...)`
|
|
2
|
+
|
|
3
|
+
Loads data from a remote URL using the Fetch API, with support for custom HTTP methods, retries, timeouts, headers, and even external abort controllers.
|
|
4
|
+
|
|
5
|
+
#### 📥 Parameters
|
|
6
|
+
|
|
7
|
+
* `url` *(string)*: The full URL to fetch from (must start with `http://`, `https://`, `/`, `./`, or `../`).
|
|
8
|
+
* `options` *(object)* *(optional)*:
|
|
9
|
+
|
|
10
|
+
* `signal` *(`AbortSignal` | `null`)*: Custom abort signal.
|
|
11
|
+
* `method` *(string)*: The HTTP method to use (e.g., `GET`, `POST`, `PUT`, `DELETE`, etc.).
|
|
12
|
+
* `timeout` *(number)*: Request timeout in milliseconds. Default is `0` (no timeout).
|
|
13
|
+
* `retries` *(number)*: Number of retry attempts if the request fails. Default is `0`.
|
|
14
|
+
* `headers` *(object)*: Additional headers to include in the request.
|
|
15
|
+
* `body` *(object)*: Request body. If the value is a plain object, it will be automatically stringified as JSON.
|
|
16
|
+
* `onProgress` *((loaded: number, total: number) => void)*: Track the load progress.
|
|
17
|
+
* `returnResponse` *((res: Response) => ResponseInit)* *(optional)*: The callback function to return the ResponseInit to ReadableStream.
|
package/docs/v1/basics/html.md
CHANGED
|
@@ -140,24 +140,7 @@ const data = { name: 'Yasmin', type: 'dev' };
|
|
|
140
140
|
saveJsonFile('yasmin.json', data);
|
|
141
141
|
```
|
|
142
142
|
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
Loads data from a remote URL using the Fetch API, with support for custom HTTP methods, retries, timeouts, headers, and even external abort controllers.
|
|
146
|
-
|
|
147
|
-
#### 📥 Parameters
|
|
148
|
-
|
|
149
|
-
* `url` *(string)*: The full URL to fetch from (must start with `http://`, `https://`, `/`, `./`, or `../`).
|
|
150
|
-
* `options` *(object)* *(optional)*:
|
|
151
|
-
|
|
152
|
-
* `signal` *(`AbortSignal` | `null`)*: Custom abort signal.
|
|
153
|
-
* `method` *(string)*: The HTTP method to use (e.g., `GET`, `POST`, `PUT`, `DELETE`, etc.).
|
|
154
|
-
* `timeout` *(number)*: Request timeout in milliseconds. Default is `0` (no timeout).
|
|
155
|
-
* `retries` *(number)*: Number of retry attempts if the request fails. Default is `0`.
|
|
156
|
-
* `headers` *(object)*: Additional headers to include in the request.
|
|
157
|
-
* `body` *(object)*: Request body. If the value is a plain object, it will be automatically stringified as JSON.
|
|
158
|
-
* `onProgress` *((loaded: number, total: number) => void)*: Track the load progress.
|
|
159
|
-
|
|
160
|
-
#### `trackFetchProgress(response, onProgress)`
|
|
143
|
+
#### `trackFetchProgress(response, onProgress, returnResponse?)`
|
|
161
144
|
|
|
162
145
|
Intercepts a standard Fetch API Response to track the download progress of its body stream.
|
|
163
146
|
|
|
@@ -171,14 +154,15 @@ Intercepts a standard Fetch API Response to track the download progress of its b
|
|
|
171
154
|
|
|
172
155
|
---
|
|
173
156
|
|
|
174
|
-
#### `fetchJson(url, options?)`
|
|
157
|
+
#### `fetchJson(url, options?, onProgress?)`
|
|
175
158
|
|
|
176
159
|
Loads and parses a remote JSON file.
|
|
177
160
|
|
|
178
161
|
* **Parameters**:
|
|
179
162
|
|
|
180
163
|
* `url` *(string)*: URL to fetch the JSON from.
|
|
181
|
-
* `options` *(object)* *(optional)*: Same structure as `
|
|
164
|
+
* `options` *(object)* *(optional)*: Same structure as `fetch`.
|
|
165
|
+
* `onProgress` *(callback)* *(optional)*: Same structure as `FetchOnProgressResult`.
|
|
182
166
|
|
|
183
167
|
* **Returns**:
|
|
184
168
|
`Promise<any[] | Record<string | number | symbol, unknown>>` — The parsed JSON data.
|
|
@@ -190,7 +174,7 @@ Loads and parses a remote JSON file.
|
|
|
190
174
|
|
|
191
175
|
---
|
|
192
176
|
|
|
193
|
-
#### `fetchBlob(url, allowedMimeTypes?, options?)`
|
|
177
|
+
#### `fetchBlob(url, allowedMimeTypes?, options?, onProgress?)`
|
|
194
178
|
|
|
195
179
|
Loads a remote file as a Blob object.
|
|
196
180
|
|
|
@@ -198,7 +182,8 @@ Loads a remote file as a Blob object.
|
|
|
198
182
|
|
|
199
183
|
* `url` *(string)*: URL of the remote file.
|
|
200
184
|
* `allowedMimeTypes` *(string\[])* *(optional)*: List of accepted MIME types.
|
|
201
|
-
* `options` *(object)* *(optional)*: Same structure as `
|
|
185
|
+
* `options` *(object)* *(optional)*: Same structure as `fetch`.
|
|
186
|
+
* `onProgress` *(callback)* *(optional)*: Same structure as `FetchOnProgressResult`.
|
|
202
187
|
|
|
203
188
|
* **Returns**:
|
|
204
189
|
`Promise<Blob>`
|
|
@@ -210,7 +195,7 @@ Loads a remote file as a Blob object.
|
|
|
210
195
|
|
|
211
196
|
---
|
|
212
197
|
|
|
213
|
-
#### `fetchText(url, allowedMimeTypes?, options?)`
|
|
198
|
+
#### `fetchText(url, allowedMimeTypes?, options?, onProgress?)`
|
|
214
199
|
|
|
215
200
|
Loads a remote file as **plain text** using the Fetch API.
|
|
216
201
|
|
|
@@ -218,7 +203,8 @@ Loads a remote file as **plain text** using the Fetch API.
|
|
|
218
203
|
|
|
219
204
|
* `url` *(string)*: Full URL of the file to fetch.
|
|
220
205
|
* `allowedMimeTypes` *(string\[])* *(optional)*: List of accepted MIME types (e.g., `['text/plain']`).
|
|
221
|
-
* `options` *(object)* *(optional)*: Same structure as `
|
|
206
|
+
* `options` *(object)* *(optional)*: Same structure as `fetch`.
|
|
207
|
+
* `onProgress` *(callback)* *(optional)*: Same structure as `FetchOnProgressResult`.
|
|
222
208
|
|
|
223
209
|
* **Returns**:
|
|
224
210
|
`Promise<string>` — The content of the file as a text string.
|
|
@@ -317,7 +303,7 @@ Perfect for UI states like dimming, pausing animations, or showing "away" status
|
|
|
317
303
|
#### 🧪 Usage
|
|
318
304
|
|
|
319
305
|
```js
|
|
320
|
-
import { installWindowHiddenScript } from 'tiny-essentials';
|
|
306
|
+
import { installWindowHiddenScript } from 'tiny-essentials/basics/html';
|
|
321
307
|
|
|
322
308
|
const uninstall = installWindowHiddenScript({
|
|
323
309
|
element: document.getElementById('app'),
|
|
@@ -425,7 +411,7 @@ The promise resolves to an object containing:
|
|
|
425
411
|
#### 🧪 Example
|
|
426
412
|
|
|
427
413
|
```javascript
|
|
428
|
-
import { loadImage } from '
|
|
414
|
+
import { loadImage } from 'tiny-essentials/basics/html';
|
|
429
415
|
|
|
430
416
|
const handleLoading = (event, startTime) => {
|
|
431
417
|
console.log('Started loading at:', startTime);
|
|
@@ -100,7 +100,7 @@ Downloads an audio file and uses a provided parser to extract its internal metad
|
|
|
100
100
|
|
|
101
101
|
**1. Using a simple URL with manual overrides:**
|
|
102
102
|
```javascript
|
|
103
|
-
import { parseMediaMetadata } from '
|
|
103
|
+
import { parseMediaMetadata } from 'tiny-essentials/basics/mediaContent';
|
|
104
104
|
import { parseBlob } from 'music-metadata';
|
|
105
105
|
|
|
106
106
|
// Note: We pass empty objects for default/manual if we want to jump straight to the parser
|
|
@@ -12,7 +12,7 @@ Whether you’re validating inputs, writing schema validators, or building tools
|
|
|
12
12
|
|
|
13
13
|
## Features
|
|
14
14
|
|
|
15
|
-
- ✅ Precise type detection (`undefined`, `null`, `array`, `
|
|
15
|
+
- ✅ Precise type detection (`undefined`, `null`, `array`, `date`, etc.)
|
|
16
16
|
- ➕ Custom type extensions with ordering
|
|
17
17
|
- 🔄 Reorder type checking priority
|
|
18
18
|
- 🔍 Safe and predictable type checks
|
package/docs/v1/basics/text.md
CHANGED
|
@@ -162,7 +162,7 @@ console.log(safeTextTrim(longText, 30));
|
|
|
162
162
|
|
|
163
163
|
---
|
|
164
164
|
|
|
165
|
-
## 🔎 `
|
|
165
|
+
## 🔎 `diffObjList(oldStrings, newStrings)`
|
|
166
166
|
|
|
167
167
|
Compares two **style objects** and identifies which properties were **added**, **removed**, or **modified**.
|
|
168
168
|
|
|
@@ -177,7 +177,7 @@ Compares two **style objects** and identifies which properties were **added**, *
|
|
|
177
177
|
**Example:**
|
|
178
178
|
|
|
179
179
|
```js
|
|
180
|
-
|
|
180
|
+
diffObjList(
|
|
181
181
|
{ color: 'red', display: 'block' },
|
|
182
182
|
{ color: 'blue', visibility: 'hidden' }
|
|
183
183
|
);
|
|
@@ -221,7 +221,7 @@ renameFilePadNumbers('./screenshots', 4, ['.jpg']);
|
|
|
221
221
|
## 📦 More Example Use
|
|
222
222
|
|
|
223
223
|
```js
|
|
224
|
-
import { readJsonFile, writeJsonFile, listFiles, backupFile } from '
|
|
224
|
+
import { readJsonFile, writeJsonFile, listFiles, backupFile } from 'tiny-essentials/fileManager';
|
|
225
225
|
|
|
226
226
|
const data = readJsonFile('./config/settings.json');
|
|
227
227
|
data.debug = false;
|