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
|
@@ -26,7 +26,7 @@ Then import both the stable stringifier and `ColorSafeStringify`:
|
|
|
26
26
|
|
|
27
27
|
```js
|
|
28
28
|
import stringify from 'safe-stable-stringify';
|
|
29
|
-
import
|
|
29
|
+
import ColorSafeStringify from 'tiny-essentials/libs/ColorSafeStringify';
|
|
30
30
|
```
|
|
31
31
|
|
|
32
32
|
---
|
|
@@ -19,7 +19,7 @@ Perfect for optimizing logic that should only run **after** the user has finishe
|
|
|
19
19
|
## 📦 Import
|
|
20
20
|
|
|
21
21
|
```js
|
|
22
|
-
import TinyAfterScrollWatcher from '
|
|
22
|
+
import TinyAfterScrollWatcher from 'tiny-essentials/libs/TinyAfterScrollWatcher';
|
|
23
23
|
```
|
|
24
24
|
|
|
25
25
|
---
|
|
@@ -18,7 +18,7 @@ A lightweight, highly optimized JavaScript utility class designed to compare two
|
|
|
18
18
|
Since this project uses modern ES6 modules, simply import it into your working file.
|
|
19
19
|
|
|
20
20
|
```javascript
|
|
21
|
-
import TinyArrayComparator from '
|
|
21
|
+
import TinyArrayComparator from 'tiny-essentials/libs/TinyArrayComparator';
|
|
22
22
|
```
|
|
23
23
|
|
|
24
24
|
### 2. Prepare Your Arrays
|
|
@@ -121,7 +121,7 @@ Filters and paginates the stored data.
|
|
|
121
121
|
### 📌 Example Usage
|
|
122
122
|
|
|
123
123
|
```js
|
|
124
|
-
import TinyArrayPaginator from '
|
|
124
|
+
import TinyArrayPaginator from 'tiny-essentials/libs/TinyArrayPaginator';
|
|
125
125
|
|
|
126
126
|
const paginator = new TinyArrayPaginator([
|
|
127
127
|
{ id: 1, category: 'fruit' },
|
|
@@ -55,7 +55,7 @@ This is the file that uses the `TinyClassManager` to compose your final class.
|
|
|
55
55
|
|
|
56
56
|
```javascript
|
|
57
57
|
// src/main.mjs
|
|
58
|
-
import TinyClassManager from '
|
|
58
|
+
import TinyClassManager from 'tiny-essentials/libs/TinyClassManager';
|
|
59
59
|
import { LoggerPlugin } from './plugins/LoggerPlugin.mjs';
|
|
60
60
|
|
|
61
61
|
class BaseUser {}
|
|
@@ -72,7 +72,7 @@ export default User;
|
|
|
72
72
|
Create a build script (e.g., `build.mjs`) to trigger the process.
|
|
73
73
|
|
|
74
74
|
```javascript
|
|
75
|
-
import TinyPluginInliner from '
|
|
75
|
+
import TinyPluginInliner from 'tiny-essentials/libs/TinyClassManager/TinyPluginInliner';
|
|
76
76
|
|
|
77
77
|
const builder = new TinyPluginInliner({
|
|
78
78
|
entryPoint: 'src/main.mjs',
|
|
@@ -42,7 +42,7 @@ Let's break down exactly how to design, extend, and instantiate a class structur
|
|
|
42
42
|
Every structure needs a solid foundation. The core class is the absolute minimum requirement and contains properties that every subsequent plugin might rely on.
|
|
43
43
|
|
|
44
44
|
```javascript
|
|
45
|
-
import TinyClassManager from '
|
|
45
|
+
import TinyClassManager from 'tiny-essentials/libs/TinyClassManager';
|
|
46
46
|
|
|
47
47
|
// The foundational class
|
|
48
48
|
class EntityCore {
|
|
@@ -192,7 +192,7 @@ Gets the current function used for copying blobs.
|
|
|
192
192
|
## 🧠 Usage Example
|
|
193
193
|
|
|
194
194
|
```ts
|
|
195
|
-
import TinyClipboard from '
|
|
195
|
+
import TinyClipboard from 'tiny-essentials/libs/TinyClipboard';
|
|
196
196
|
|
|
197
197
|
const clipboard = new TinyClipboard();
|
|
198
198
|
|
|
@@ -135,7 +135,7 @@ Returns `false` if preferences are missing or category is not allowed.
|
|
|
135
135
|
## 🧩 Example Usage
|
|
136
136
|
|
|
137
137
|
```js
|
|
138
|
-
import TinyCookieConsent from '
|
|
138
|
+
import TinyCookieConsent from 'tiny-essentials/libs/TinyCookieConsent';
|
|
139
139
|
|
|
140
140
|
const consent = new TinyCookieConsent({
|
|
141
141
|
message: "We use cookies to personalize your experience.",
|
|
@@ -133,7 +133,7 @@ Returns `false` if the DOM is still loading.
|
|
|
133
133
|
### Basic Usage
|
|
134
134
|
|
|
135
135
|
```js
|
|
136
|
-
import TinyDomReadyManager from '
|
|
136
|
+
import TinyDomReadyManager from 'tiny-essentials/libs/TinyDomReadyManager';
|
|
137
137
|
|
|
138
138
|
const manager = new TinyDomReadyManager();
|
|
139
139
|
|
|
@@ -18,7 +18,7 @@ A lightweight JavaScript utility for detecting drag-and-drop file operations on
|
|
|
18
18
|
## 🔧 Usage Example
|
|
19
19
|
|
|
20
20
|
```javascript
|
|
21
|
-
import TinyDragDropDetector from '
|
|
21
|
+
import TinyDragDropDetector from 'tiny-essentials/libs/TinyDragDropDetector';
|
|
22
22
|
|
|
23
23
|
const dnd = new TinyDragDropDetector({
|
|
24
24
|
target: document.getElementById('drop-area'),
|
|
@@ -75,7 +75,7 @@ new TinyElementObserver(el, {
|
|
|
75
75
|
## 🔹 Example Usage
|
|
76
76
|
|
|
77
77
|
```js
|
|
78
|
-
import TinyElementObserver from '
|
|
78
|
+
import TinyElementObserver from 'tiny-essentials/libs/TinyElementObserver';
|
|
79
79
|
|
|
80
80
|
// Define a detector
|
|
81
81
|
const logDetector = (mutation, index, mutations) => {
|
package/docs/v1/libs/TinyHtml.md
CHANGED
|
@@ -782,7 +782,7 @@ It is configured to observe the **document root element** (`document.documentEle
|
|
|
782
782
|
* 🎨 **Style Detector (`tinyStyleEvent`)**
|
|
783
783
|
Detects changes to inline styles (`style` attribute).
|
|
784
784
|
|
|
785
|
-
* Compares old vs new styles using `
|
|
785
|
+
* Compares old vs new styles using `diffObjList`.
|
|
786
786
|
* Dispatches:
|
|
787
787
|
|
|
788
788
|
```js
|
|
@@ -23,7 +23,7 @@ This module abstracts the complexity of cross-origin communication by establishi
|
|
|
23
23
|
### In the parent:
|
|
24
24
|
|
|
25
25
|
```js
|
|
26
|
-
import TinyIframeEvents from '
|
|
26
|
+
import TinyIframeEvents from 'tiny-essentials/libs/TinyIframeEvents';
|
|
27
27
|
|
|
28
28
|
const iframe = document.querySelector('iframe');
|
|
29
29
|
|
|
@@ -36,14 +36,14 @@ const parentEvents = new TinyIframeEvents({
|
|
|
36
36
|
|
|
37
37
|
// You can safely emit before the iframe is ready.
|
|
38
38
|
// It will be queued and sent automatically!
|
|
39
|
-
parentEvents.
|
|
39
|
+
parentEvents.winEmit('hello:iframe', { text: '👋 From parent!' });
|
|
40
40
|
|
|
41
41
|
// Wait for the secure channel to be fully established
|
|
42
42
|
parentEvents.onReady(() => {
|
|
43
43
|
console.log('✅ Secure connection established with iframe!');
|
|
44
44
|
});
|
|
45
45
|
|
|
46
|
-
parentEvents.on('reply:fromIframe', (data, event) => {
|
|
46
|
+
parentEvents.on('win:reply:fromIframe', (data, event) => {
|
|
47
47
|
console.log('📨 Received from iframe:', data, event);
|
|
48
48
|
});
|
|
49
49
|
```
|
|
@@ -53,7 +53,7 @@ parentEvents.on('reply:fromIframe', (data, event) => {
|
|
|
53
53
|
### In the iframe:
|
|
54
54
|
|
|
55
55
|
```js
|
|
56
|
-
import TinyIframeEvents from '
|
|
56
|
+
import TinyIframeEvents from 'tiny-essentials/libs/TinyIframeEvents';
|
|
57
57
|
|
|
58
58
|
const iframeEvents = new TinyIframeEvents({
|
|
59
59
|
// Make sure these match the parent's config if you changed them!
|
|
@@ -62,10 +62,10 @@ const iframeEvents = new TinyIframeEvents({
|
|
|
62
62
|
|
|
63
63
|
iframeEvents.onReady(() => {
|
|
64
64
|
console.log('✅ Secure connection established with parent!');
|
|
65
|
-
iframeEvents.
|
|
65
|
+
iframeEvents.winEmit('reply:fromIframe', { text: '🙋♀️ Hi parent!' });
|
|
66
66
|
});
|
|
67
67
|
|
|
68
|
-
iframeEvents.on('hello:iframe', (data, event) => {
|
|
68
|
+
iframeEvents.on('win:hello:iframe', (data, event) => {
|
|
69
69
|
console.log('📥 Message from parent:', data);
|
|
70
70
|
});
|
|
71
71
|
```
|
|
@@ -102,7 +102,7 @@ iframeEvents.onReady(() => {
|
|
|
102
102
|
|
|
103
103
|
---
|
|
104
104
|
|
|
105
|
-
### `
|
|
105
|
+
### `winEmit(eventName, payload)`
|
|
106
106
|
|
|
107
107
|
Sends a message to the target frame through the secure port. If the port is not ready yet, the message is queued.
|
|
108
108
|
|
|
@@ -119,10 +119,10 @@ Sends a message to the target frame through the secure port. If the port is not
|
|
|
119
119
|
|
|
120
120
|
### `on(eventName, handler)`
|
|
121
121
|
|
|
122
|
-
Registers a listener for a specific event.
|
|
122
|
+
Registers a listener for a specific event (using `win:` to external events).
|
|
123
123
|
|
|
124
124
|
```js
|
|
125
|
-
iframeEvents.on('my:event', (payload, event) => {
|
|
125
|
+
iframeEvents.on('win:my:event', (payload, event) => {
|
|
126
126
|
// Access data via `payload`
|
|
127
127
|
});
|
|
128
128
|
```
|
|
@@ -162,7 +162,7 @@ if (events.isDestroyed()) {
|
|
|
162
162
|
|
|
163
163
|
This class internally wraps:
|
|
164
164
|
* `MessageChannel` and `MessagePort` for isolated communication.
|
|
165
|
-
* A minimal event router
|
|
165
|
+
* A minimal event router.
|
|
166
166
|
|
|
167
167
|
---
|
|
168
168
|
|
|
@@ -227,7 +227,7 @@ console.log(`You need ${missing} more XP to level up! 🚀`);
|
|
|
227
227
|
## 🌟 Example Usage
|
|
228
228
|
|
|
229
229
|
```js
|
|
230
|
-
import TinyLevelUp from '
|
|
230
|
+
import TinyLevelUp from 'tiny-essentials/libs/TinyLevelUp';
|
|
231
231
|
|
|
232
232
|
const levelSystem = new TinyLevelUp(15, 10);
|
|
233
233
|
const user = levelSystem.createUser();
|
|
@@ -121,7 +121,7 @@ loader.onChange = (status) => {
|
|
|
121
121
|
### Basic Example
|
|
122
122
|
|
|
123
123
|
```js
|
|
124
|
-
import TinyLoadingScreen from '
|
|
124
|
+
import TinyLoadingScreen from 'tiny-essentials/libs/TinyLoadingScreen';
|
|
125
125
|
|
|
126
126
|
const loader = new TinyLoadingScreen();
|
|
127
127
|
loader.defaultMessage = 'Loading...';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# 📦 TinyLocalStorage
|
|
2
2
|
|
|
3
|
-
Tiny wrapper for `localStorage` with full support for complex structures like `Map`, `Set`, `Date`, `RegExp`, `BigInt`, and even custom types. Offers a type-safe interface and a powerful event system
|
|
3
|
+
Tiny wrapper for `localStorage` with full support for complex structures like `Map`, `Set`, `Date`, `RegExp`, `BigInt`, and even custom types. Offers a type-safe interface and a powerful event system.
|
|
4
4
|
|
|
5
5
|
---
|
|
6
6
|
|
|
@@ -27,7 +27,7 @@ console.log(storage.getDate('today') instanceof Date); // true
|
|
|
27
27
|
* ✅ Store & restore `Map`, `Set`, `Date`, `RegExp`, `BigInt`, `Symbol`, `null`, `undefined`.
|
|
28
28
|
* ✅ Custom type encoding and decoding system.
|
|
29
29
|
* ✅ Type-safe methods for string, number and boolean.
|
|
30
|
-
* ✅ Built-in event system
|
|
30
|
+
* ✅ Built-in event system with optional native `storage` listener.
|
|
31
31
|
* ✅ Optional fallback when decoding fails.
|
|
32
32
|
|
|
33
33
|
---
|
|
@@ -344,7 +344,7 @@ Returns `true` if the type has both encoder and decoder registered, otherwise `f
|
|
|
344
344
|
|
|
345
345
|
---
|
|
346
346
|
|
|
347
|
-
## 🔥 Events
|
|
347
|
+
## 🔥 Events
|
|
348
348
|
|
|
349
349
|
### Built-in Events
|
|
350
350
|
|
|
@@ -21,7 +21,7 @@ Ideal for secure, bidirectional messaging with route-based logic.
|
|
|
21
21
|
### In the main window:
|
|
22
22
|
|
|
23
23
|
```js
|
|
24
|
-
import TinyNewWinEvents from '
|
|
24
|
+
import TinyNewWinEvents from 'tiny-essentials/libs/TinyNewWinEvents';
|
|
25
25
|
|
|
26
26
|
const events = new TinyNewWinEvents({
|
|
27
27
|
url: '/popup.html',
|
|
@@ -30,11 +30,11 @@ const events = new TinyNewWinEvents({
|
|
|
30
30
|
targetOrigin: window.location.origin
|
|
31
31
|
});
|
|
32
32
|
|
|
33
|
-
events.on('user:reply', (payload) => {
|
|
33
|
+
events.on('win:user:reply', (payload) => {
|
|
34
34
|
console.log('📩 From popup:', payload);
|
|
35
35
|
});
|
|
36
36
|
|
|
37
|
-
events.
|
|
37
|
+
events.winEmit('init:data', { id: 123 });
|
|
38
38
|
```
|
|
39
39
|
|
|
40
40
|
---
|
|
@@ -42,15 +42,15 @@ events.emit('init:data', { id: 123 });
|
|
|
42
42
|
### In the popup window:
|
|
43
43
|
|
|
44
44
|
```js
|
|
45
|
-
import TinyNewWinEvents from '
|
|
45
|
+
import TinyNewWinEvents from 'tiny-essentials/libs/TinyNewWinEvents';
|
|
46
46
|
|
|
47
47
|
const events = new TinyNewWinEvents();
|
|
48
48
|
|
|
49
|
-
events.on('init:data', (payload) => {
|
|
49
|
+
events.on('win:init:data', (payload) => {
|
|
50
50
|
console.log('📦 Init payload from main window:', payload);
|
|
51
51
|
});
|
|
52
52
|
|
|
53
|
-
events.
|
|
53
|
+
events.winEmit('user:reply', { msg: '👋 Hello from popup!' });
|
|
54
54
|
```
|
|
55
55
|
|
|
56
56
|
---
|
|
@@ -74,7 +74,7 @@ Creates a new communication instance.
|
|
|
74
74
|
|
|
75
75
|
---
|
|
76
76
|
|
|
77
|
-
### `
|
|
77
|
+
### `winEmit(route, payload)`
|
|
78
78
|
|
|
79
79
|
Sends a message on a specific route.
|
|
80
80
|
|
|
@@ -89,10 +89,10 @@ Sends a message on a specific route.
|
|
|
89
89
|
|
|
90
90
|
### `on(route, handler)`
|
|
91
91
|
|
|
92
|
-
Registers a callback for a specific route.
|
|
92
|
+
Registers a callback for a specific route (using `win:` to external events).
|
|
93
93
|
|
|
94
94
|
```js
|
|
95
|
-
events.on('data:sync', (payload, event) => {
|
|
95
|
+
events.on('win:data:sync', (payload, event) => {
|
|
96
96
|
console.log(payload, event.origin);
|
|
97
97
|
});
|
|
98
98
|
```
|
|
@@ -159,7 +159,6 @@ Destroys the instance, cleans up all resources:
|
|
|
159
159
|
| Concept | Purpose |
|
|
160
160
|
| --------------- | ------------------------------------------- |
|
|
161
161
|
| `postMessage` | Core transport for messaging |
|
|
162
|
-
| `TinyEvents` | Internal event emitter and listener manager |
|
|
163
162
|
| `__TNE_READY__` | Handshake trigger message type |
|
|
164
163
|
| `__TNE_ROUTE__` | Route-based message delivery type |
|
|
165
164
|
|
|
@@ -180,7 +179,7 @@ type handler = (
|
|
|
180
179
|
|
|
181
180
|
## 🛡️ Safety and Validation
|
|
182
181
|
|
|
183
|
-
* 💥 Throws if `
|
|
182
|
+
* 💥 Throws if `winEmit()` is called after `.destroy()`
|
|
184
183
|
* 💣 Throws if the popup was opened with `_blank` name
|
|
185
184
|
* ✅ Only communicates with expected `targetOrigin`
|
|
186
185
|
* 🧼 Automatically detects closed windows and emits `WINDOW_REF_CLOSED`
|
|
@@ -164,7 +164,7 @@ Set or retrieve the default click handler for all notifications.
|
|
|
164
164
|
## 📦 Example
|
|
165
165
|
|
|
166
166
|
```js
|
|
167
|
-
import TinyNotifications from '
|
|
167
|
+
import TinyNotifications from 'tiny-essentials/libs/TinyNotifications';
|
|
168
168
|
|
|
169
169
|
const notify = new TinyNotifications({
|
|
170
170
|
audio: '/sounds/ping.mp3',
|
|
@@ -108,7 +108,7 @@ Cancels a scheduled delay and removes the task from the queue. Adds the ID to a
|
|
|
108
108
|
## Usage Example 💻
|
|
109
109
|
|
|
110
110
|
```js
|
|
111
|
-
import { TinyPromiseQueue } from '
|
|
111
|
+
import { TinyPromiseQueue } from 'tiny-essentials/libs/TinyPromiseQueue';
|
|
112
112
|
|
|
113
113
|
const queue = new TinyPromiseQueue();
|
|
114
114
|
|
|
@@ -142,7 +142,7 @@ setTimeout(() => {
|
|
|
142
142
|
```
|
|
143
143
|
|
|
144
144
|
```js
|
|
145
|
-
import { TinyPromiseQueue } from '
|
|
145
|
+
import { TinyPromiseQueue } from 'tiny-essentials/libs/TinyPromiseQueue';
|
|
146
146
|
|
|
147
147
|
const queue = new TinyPromiseQueue();
|
|
148
148
|
await new Promise((resolve) => {
|
|
@@ -21,7 +21,7 @@ It uses the **Longest Common Subsequence (LCS)** algorithm to ensure that change
|
|
|
21
21
|
Since this is an ES Module, you can simply import it into your project:
|
|
22
22
|
|
|
23
23
|
```javascript
|
|
24
|
-
import TinyTextDiffer from '
|
|
24
|
+
import TinyTextDiffer from 'tiny-essentials/libs/TinyTextDiffer';
|
|
25
25
|
|
|
26
26
|
const differ = new TinyTextDiffer(["Initial text", "Updated text!"]);
|
|
27
27
|
|
|
@@ -17,7 +17,7 @@ A lightweight JavaScript utility for automatically resizing `<textarea>` element
|
|
|
17
17
|
## 🚀 Usage
|
|
18
18
|
|
|
19
19
|
```js
|
|
20
|
-
import TinyTextarea from '
|
|
20
|
+
import TinyTextarea from 'tiny-essentials/libs/TinyTextarea';
|
|
21
21
|
|
|
22
22
|
const textarea = document.querySelector('textarea');
|
|
23
23
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "tiny-essentials",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.28.1",
|
|
4
4
|
"description": "Collection of small, essential scripts designed to be used across various projects. These simple utilities are crafted for speed, ease of use, and versatility.",
|
|
5
5
|
"bin": {
|
|
6
6
|
"tiny-essentials-fork": "./TinyFork.mjs"
|
|
@@ -84,6 +84,10 @@
|
|
|
84
84
|
"require": "./dist/v1/basics/html.cjs",
|
|
85
85
|
"import": "./dist/v1/basics/html.mjs"
|
|
86
86
|
},
|
|
87
|
+
"./basics/deprecated/html": {
|
|
88
|
+
"require": "./dist/v1/basics/deprecated/html.cjs",
|
|
89
|
+
"import": "./dist/v1/basics/deprecated/html.mjs"
|
|
90
|
+
},
|
|
87
91
|
"./basics/objChecker": {
|
|
88
92
|
"require": "./dist/v1/basics/objChecker.cjs",
|
|
89
93
|
"import": "./dist/v1/basics/objChecker.mjs"
|
|
@@ -92,6 +96,10 @@
|
|
|
92
96
|
"require": "./dist/v1/basics/objFilter.cjs",
|
|
93
97
|
"import": "./dist/v1/basics/objFilter.mjs"
|
|
94
98
|
},
|
|
99
|
+
"./basics/extendObjType/Buffer": {
|
|
100
|
+
"require": "./dist/v1/basics/extendObjType/Buffer.mjs.cjs",
|
|
101
|
+
"import": "./dist/v1/basics/extendObjType/Buffer.mjs.mjs"
|
|
102
|
+
},
|
|
95
103
|
"./basics/simpleMath": {
|
|
96
104
|
"require": "./dist/v1/basics/simpleMath.cjs",
|
|
97
105
|
"import": "./dist/v1/basics/simpleMath.mjs"
|
|
@@ -112,6 +120,10 @@
|
|
|
112
120
|
"require": "./dist/v1/fileManager/normalFuncs.cjs",
|
|
113
121
|
"import": "./dist/v1/fileManager/normalFuncs.mjs"
|
|
114
122
|
},
|
|
123
|
+
"./libs/utils": {
|
|
124
|
+
"require": "./dist/v1/libs/utils.cjs",
|
|
125
|
+
"import": "./dist/v1/libs/utils.mjs"
|
|
126
|
+
},
|
|
115
127
|
"./libs/ColorSafeStringify": {
|
|
116
128
|
"require": "./dist/v1/libs/ColorSafeStringify.cjs",
|
|
117
129
|
"import": "./dist/v1/libs/ColorSafeStringify.mjs"
|
|
@@ -220,10 +232,6 @@
|
|
|
220
232
|
"require": "./dist/v1/libs/TinyGamepad.cjs",
|
|
221
233
|
"import": "./dist/v1/libs/TinyGamepad.mjs"
|
|
222
234
|
},
|
|
223
|
-
"./libs/TinyEvents": {
|
|
224
|
-
"require": "./dist/v1/libs/TinyEvents.cjs",
|
|
225
|
-
"import": "./dist/v1/libs/TinyEvents.mjs"
|
|
226
|
-
},
|
|
227
235
|
"./libs/TinyElementObserver": {
|
|
228
236
|
"require": "./dist/v1/libs/TinyElementObserver.cjs",
|
|
229
237
|
"import": "./dist/v1/libs/TinyElementObserver.mjs"
|
|
@@ -535,8 +543,10 @@
|
|
|
535
543
|
"@types/node": "^26.1.0",
|
|
536
544
|
"@types/node-fetch": "^2.6.12",
|
|
537
545
|
"babel-preset-es2015": "^6.24.1",
|
|
546
|
+
"buffer": "^6.0.3",
|
|
538
547
|
"esbuild": "^0.28.1",
|
|
539
548
|
"express": "^5.1.0",
|
|
549
|
+
"jquery": "^3.7.1",
|
|
540
550
|
"lodash": "^4.17.21",
|
|
541
551
|
"marked": "^18.0.5",
|
|
542
552
|
"node-polyfill-webpack-plugin": "^4.1.0",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
(()=>{"use strict";const e={d:(t,n)=>{if(Array.isArray(n))for(var r=0;r<n.length;){var s=n[r++],i=n[r++];e.o(t,s)?0===i&&r++:0===i?Object.defineProperty(t,s,{enumerable:!0,value:n[r++]}):Object.defineProperty(t,s,{enumerable:!0,get:i})}else for(var s in n)e.o(n,s)&&!e.o(t,s)&&Object.defineProperty(t,s,{enumerable:!0,get:n[s]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t)};let t={};e.d(t,{TinyEvents:()=>n});const n=class{#e=new Map;#t=10;#n=!1;#r(e,t){if("string"==typeof e)return[e];if(Array.isArray(e)&&e.every(e=>"string"==typeof e))return e;throw new TypeError(`${t}(event): event must be a string or string[]`)}setThrowOnMaxListeners(e){if("boolean"!=typeof e)throw new TypeError("setThrowOnMaxListeners(value): value must be a boolean");this.#n=e}getThrowOnMaxListeners(){return this.#n}#s(e,t,{once:n=!1}={}){let r=this.#e.get(e);Array.isArray(r)||(r=[],this.#e.set(e,r)),r.unshift({handler:t,config:{once:n}});const s=this.#t;if(s>0&&r.length>s){const t=`Possible memory leak detected. ${r.length} "${e}" listeners added. Use setMaxListeners() to increase limit.`;if(this.#n)throw new Error(t);console.warn(t)}}prependListener(e,t){const n=this.#r(e,"prependListener");if("function"!=typeof t)throw new TypeError("prependListener(event, handler): handler must be a function");for(const e of n)this.#s(e,t)}prependListenerOnce(e,t){const n=this.#r(e,"prependListenerOnce");if("function"!=typeof t)throw new TypeError("prependListenerOnce(event, handler): handler must be a function");const r=[];for(const e of n){const n=(...r)=>{this.off(e,n),t(...r)};this.#s(e,n,{once:!0}),r.push(n)}return r}#i(e,t,{once:n=!1}={}){const r=this.#r(e,"on");for(const e of r){let r=this.#e.get(e);Array.isArray(r)||(r=[],this.#e.set(e,r)),r.push({handler:t,config:{once:n}});const s=this.#t;if(s>0&&r.length>s){const t=`Possible memory leak detected. ${r.length} "${e}" listeners added. Use setMaxListeners() to increase limit.`;if(this.#n)throw new Error(t);console.warn(t)}}}on(e,t){if("function"!=typeof t)throw new TypeError("on(event, handler): handler must be a function");return this.#i(e,t)}once(e,t){const n=this.#r(e,"once");if("function"!=typeof t)throw new TypeError("once(event, handler): handler must be a function");const r=[];for(const e of n){const n=(...r)=>{this.off(e,n),t(...r)};this.#i(e,n,{once:!0}),r.push(n)}return r}appendListener(e,t){return this.on(e,t)}appendListenerOnce(e,t){return this.once(e,t)}off(e,t){const n=this.#r(e,"off");if("function"!=typeof t)throw new TypeError("off(event, handler): handler must be a function");for(const e of n){const n=this.#e.get(e);if(!Array.isArray(n))continue;const r=n.findIndex(e=>e.handler===t);-1!==r&&n.splice(r,1),0===n.length&&this.#e.delete(e)}}offAll(e){const t=this.#r(e,"offAll");for(const e of t)this.#e.delete(e)}offAllTypes(){this.#e.clear()}removeAllListeners(){return this.offAllTypes()}listenerCount(e){if("string"!=typeof e)throw new TypeError("listenerCount(event): event name must be a string");const t=this.#e.get(e);return Array.isArray(t)?t.length:0}listeners(e){if("string"!=typeof e)throw new TypeError("listeners(event): event name must be a string");const t=this.#e.get(e);return Array.isArray(t)?[...t].filter(e=>!e.config.once).map(e=>e.handler):[]}onceListeners(e){if("string"!=typeof e)throw new TypeError("onceListeners(event): event name must be a string");const t=this.#e.get(e);return Array.isArray(t)?[...t].filter(e=>e.config.once).map(e=>e.handler):[]}allListeners(e){if("string"!=typeof e)throw new TypeError("allListeners(event): event name must be a string");const t=this.#e.get(e);return Array.isArray(t)?[...t].map(e=>e.handler):[]}eventNames(){return[...this.#e.keys()]}emit(e,...t){const n=this.#r(e,"emit"),r=[];for(const e of n){const n=this.#e.get(e);Array.isArray(n)&&0!==n.length?(n.forEach(e=>e.handler(...t)),r.push(!0)):r.push(!1)}return r}setMaxListeners(e){if(!Number.isInteger(e)||e<0)throw new TypeError("setMaxListeners(n): n must be a non-negative integer");this.#t=e}getMaxListeners(){return this.#t}};window.TinyEvents=t.TinyEvents})();
|