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,35 +1,36 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Reads the contents of a file using the specified FileReader method.
|
|
3
3
|
*
|
|
4
|
-
* @param {File} file - The file to be read.
|
|
4
|
+
* @param {File|Blob} file - The file to be read.
|
|
5
5
|
* @param {'readAsArrayBuffer'|'readAsDataURL'|'readAsText'|'readAsBinaryString'} method -
|
|
6
|
-
*
|
|
6
|
+
* The FileReader method to use for reading the file.
|
|
7
7
|
* @returns {Promise<any>} - A promise that resolves with the file content, according to the chosen method.
|
|
8
|
+
* @throws {TypeError} - If arguments don't match expected types.
|
|
8
9
|
* @throws {Error} - If an unexpected error occurs while handling the result.
|
|
9
10
|
* @throws {DOMException} - If the FileReader encounters an error while reading the file.
|
|
10
11
|
*/
|
|
11
|
-
export function readFileBlob(file: File, method: "readAsArrayBuffer" | "readAsDataURL" | "readAsText" | "readAsBinaryString"): Promise<any>;
|
|
12
|
+
export function readFileBlob(file: File | Blob, method: "readAsArrayBuffer" | "readAsDataURL" | "readAsText" | "readAsBinaryString"): Promise<any>;
|
|
12
13
|
/**
|
|
13
14
|
* Reads a file as a Base64 string using FileReader, and optionally formats it as a full data URL.
|
|
14
15
|
*
|
|
15
16
|
* Performs strict validation to ensure the result is a valid Base64 string or a proper data URL.
|
|
16
17
|
*
|
|
17
|
-
* @param {File} file - The file to be read.
|
|
18
|
+
* @param {File|Blob} file - The file to be read.
|
|
18
19
|
* @param {boolean|string} [isDataUrl=false] - If true, returns a full data URL; if false, returns only the Base64 string;
|
|
19
|
-
*
|
|
20
|
+
* if a string is passed, it is used as the MIME type in the data URL.
|
|
20
21
|
* @returns {Promise<string>} - A promise that resolves with the Base64 string or data URL.
|
|
21
22
|
*
|
|
22
23
|
* @throws {TypeError} - If the result is not a string or if `isDataUrl` is not a valid type.
|
|
23
24
|
* @throws {Error} - If the result does not match the expected data URL format or Base64 structure.
|
|
24
25
|
* @throws {DOMException} - If the FileReader fails to read the file.
|
|
25
26
|
*/
|
|
26
|
-
export function readBase64Blob(file: File, isDataUrl?: boolean | string): Promise<string>;
|
|
27
|
+
export function readBase64Blob(file: File | Blob, isDataUrl?: boolean | string): Promise<string>;
|
|
27
28
|
/**
|
|
28
29
|
* Reads a file and strictly validates its content as proper JSON using FileReader.
|
|
29
30
|
*
|
|
30
31
|
* Performs several checks to ensure the file contains valid, parsable JSON data.
|
|
31
32
|
*
|
|
32
|
-
* @param {File} file - The file to be read. It must contain valid JSON as plain text.
|
|
33
|
+
* @param {File|Blob} file - The file to be read. It must contain valid JSON as plain text.
|
|
33
34
|
* @returns {Promise<Record<string|number|symbol, any>|any[]>} - A promise that resolves with the parsed JSON object.
|
|
34
35
|
*
|
|
35
36
|
* @throws {SyntaxError} - If the file content is not valid JSON syntax.
|
|
@@ -37,24 +38,15 @@ export function readBase64Blob(file: File, isDataUrl?: boolean | string): Promis
|
|
|
37
38
|
* @throws {Error} - If the result is empty or structurally invalid as JSON.
|
|
38
39
|
* @throws {DOMException} - If the FileReader fails to read the file.
|
|
39
40
|
*/
|
|
40
|
-
export function readJsonBlob(file: File): Promise<Record<string | number | symbol, any> | any[]>;
|
|
41
|
+
export function readJsonBlob(file: File | Blob): Promise<Record<string | number | symbol, any> | any[]>;
|
|
41
42
|
/**
|
|
42
43
|
* Saves a JSON object as a downloadable file.
|
|
43
44
|
* @param {string} filename
|
|
44
45
|
* @param {any} data
|
|
45
46
|
* @param {number} [spaces=2]
|
|
47
|
+
* @throws {TypeError} - If arguments do not match expected types.
|
|
46
48
|
*/
|
|
47
49
|
export function saveJsonFile(filename: string, data: any, spaces?: number): void;
|
|
48
|
-
/**
|
|
49
|
-
* @typedef {Object} FetchTemplateOptions
|
|
50
|
-
* @property {string} [method="GET"] - HTTP method to use (GET, POST, etc.).
|
|
51
|
-
* @property {any} [body] - Request body (only for methods like POST, PUT).
|
|
52
|
-
* @property {number} [timeout=0] - Timeout in milliseconds (ignored if signal is provided).
|
|
53
|
-
* @property {number} [retries=0] - Number of retry attempts (ignored if signal is provided).
|
|
54
|
-
* @property {Headers|Record<string, *>} [headers={}] - Additional headers.
|
|
55
|
-
* @property {AbortSignal|null} [signal] - External AbortSignal; disables timeout and retries.
|
|
56
|
-
* @property {FetchOnProgressResult} [onProgress] - Track the load progress.
|
|
57
|
-
*/
|
|
58
50
|
/**
|
|
59
51
|
* Callback function used to report the progress of a data download.
|
|
60
52
|
*
|
|
@@ -72,38 +64,41 @@ export function saveJsonFile(filename: string, data: any, spaces?: number): void
|
|
|
72
64
|
*
|
|
73
65
|
* @param {Response} response - The original response object to be tracked.
|
|
74
66
|
* @param {FetchOnProgressResult} onProgress - The callback function to handle progress events.
|
|
67
|
+
* @param {(res: Response) => ResponseInit} [returnResponse] - The callback function to return the ResponseInit to ReadableStream.
|
|
75
68
|
* @returns {Response} A new Response object with the tracked stream.
|
|
76
69
|
*/
|
|
77
|
-
export function trackFetchProgress(response: Response, onProgress: FetchOnProgressResult): Response;
|
|
70
|
+
export function trackFetchProgress(response: Response, onProgress: FetchOnProgressResult, returnResponse?: (res: Response) => ResponseInit): Response;
|
|
78
71
|
/**
|
|
79
72
|
* Loads and parses a JSON from a remote URL using Fetch API.
|
|
80
73
|
*
|
|
81
|
-
* @param {string} url - The full URL to fetch JSON from.
|
|
82
|
-
* @param {
|
|
74
|
+
* @param {string | URL | Request} url - The full URL to fetch JSON from.
|
|
75
|
+
* @param {RequestInit|null} [options] - Optional settings.
|
|
76
|
+
* @param {FetchOnProgressResult} [onProgress] - Track the load progress.
|
|
83
77
|
* @returns {Promise<any[] | Record<string | number | symbol, unknown>>} Parsed JSON object.
|
|
84
78
|
* @throws {Error} Throws if fetch fails, times out, or returns invalid JSON.
|
|
85
79
|
*/
|
|
86
|
-
export function fetchJson(url: string, options?:
|
|
80
|
+
export function fetchJson(url: string | URL | Request, options?: RequestInit | null, onProgress?: FetchOnProgressResult): Promise<any[] | Record<string | number | symbol, unknown>>;
|
|
87
81
|
/**
|
|
88
82
|
* Loads a remote file as a Blob using Fetch API.
|
|
89
83
|
*
|
|
90
|
-
* @param {string} url - The full URL to fetch the file from.
|
|
91
|
-
* @param {FetchTemplateOptions} [options] - Optional fetch options.
|
|
84
|
+
* @param {string | URL | Request} url - The full URL to fetch the file from.
|
|
92
85
|
* @param {string[]} [allowedMimeTypes] - Optional list of accepted MIME types (e.g., ['image/jpeg']).
|
|
86
|
+
* @param {RequestInit|null} [options] - Optional fetch options.
|
|
87
|
+
* @param {FetchOnProgressResult} [onProgress] - Track the load progress.
|
|
93
88
|
* @returns {Promise<Blob>} - The fetched file as a Blob.
|
|
94
89
|
* @throws {Error} Throws if fetch fails, response is not ok, or MIME type is not allowed.
|
|
95
90
|
*/
|
|
96
|
-
export function fetchBlob(url: string, allowedMimeTypes?: string[], options?:
|
|
91
|
+
export function fetchBlob(url: string | URL | Request, allowedMimeTypes?: string[], options?: RequestInit | null, onProgress?: FetchOnProgressResult): Promise<Blob>;
|
|
97
92
|
/**
|
|
98
93
|
* Loads a remote file as a text using Fetch API.
|
|
99
|
-
*
|
|
100
|
-
* @param {string} url - The full URL to fetch the file from.
|
|
101
|
-
* @param {FetchTemplateOptions} [options] - Optional fetch options.
|
|
94
|
+
* @param {string | URL | Request} url - The full URL to fetch the file from.
|
|
102
95
|
* @param {string[]} [allowedMimeTypes] - Optional list of accepted MIME types (e.g., ['image/jpeg']).
|
|
96
|
+
* @param {RequestInit|null} [options] - Optional fetch options.
|
|
97
|
+
* @param {FetchOnProgressResult} [onProgress] - Track the load progress.
|
|
103
98
|
* @returns {Promise<string>} - The fetched file as a text.
|
|
104
99
|
* @throws {Error} Throws if fetch fails, response is not ok, or MIME type is not allowed.
|
|
105
100
|
*/
|
|
106
|
-
export function fetchText(url: string, allowedMimeTypes?: string[], options?:
|
|
101
|
+
export function fetchText(url: string | URL | Request, allowedMimeTypes?: string[], options?: RequestInit | null, onProgress?: FetchOnProgressResult): Promise<string>;
|
|
107
102
|
/**
|
|
108
103
|
* Represents the final state and metadata of an attempted image load.
|
|
109
104
|
* @typedef {Object} ImageLoadResult
|
|
@@ -132,7 +127,7 @@ export function fetchText(url: string, allowedMimeTypes?: string[], options?: Fe
|
|
|
132
127
|
* @param {(event: Event, startTime: number) => void} [options.onLoading]
|
|
133
128
|
* @returns {Promise<ImageLoadResult>}
|
|
134
129
|
*/
|
|
135
|
-
export function loadImage(
|
|
130
|
+
export function loadImage(options: {
|
|
136
131
|
url: string;
|
|
137
132
|
crossOrigin?: string | undefined;
|
|
138
133
|
onLoading?: ((event: Event, startTime: number) => void) | undefined;
|
|
@@ -151,7 +146,7 @@ export function loadImage({ url, onLoading, crossOrigin }: {
|
|
|
151
146
|
* @returns {() => void} Function that removes all installed event listeners.
|
|
152
147
|
* @throws {TypeError} If any provided setting is invalid.
|
|
153
148
|
*/
|
|
154
|
-
export function installWindowHiddenScript(
|
|
149
|
+
export function installWindowHiddenScript(settings?: {
|
|
155
150
|
element?: Element | undefined;
|
|
156
151
|
hiddenClass?: string | undefined;
|
|
157
152
|
visibleClass?: string | undefined;
|
|
@@ -166,36 +161,6 @@ export function installWindowHiddenScript({ element, hiddenClass, visibleClass,
|
|
|
166
161
|
oldClass: string;
|
|
167
162
|
}) => void) | undefined;
|
|
168
163
|
}): () => void;
|
|
169
|
-
export type FetchTemplateOptions = {
|
|
170
|
-
/**
|
|
171
|
-
* - HTTP method to use (GET, POST, etc.).
|
|
172
|
-
*/
|
|
173
|
-
method?: string | undefined;
|
|
174
|
-
/**
|
|
175
|
-
* - Request body (only for methods like POST, PUT).
|
|
176
|
-
*/
|
|
177
|
-
body?: any;
|
|
178
|
-
/**
|
|
179
|
-
* - Timeout in milliseconds (ignored if signal is provided).
|
|
180
|
-
*/
|
|
181
|
-
timeout?: number | undefined;
|
|
182
|
-
/**
|
|
183
|
-
* - Number of retry attempts (ignored if signal is provided).
|
|
184
|
-
*/
|
|
185
|
-
retries?: number | undefined;
|
|
186
|
-
/**
|
|
187
|
-
* - Additional headers.
|
|
188
|
-
*/
|
|
189
|
-
headers?: Headers | Record<string, any> | undefined;
|
|
190
|
-
/**
|
|
191
|
-
* - External AbortSignal; disables timeout and retries.
|
|
192
|
-
*/
|
|
193
|
-
signal?: AbortSignal | null | undefined;
|
|
194
|
-
/**
|
|
195
|
-
* - Track the load progress.
|
|
196
|
-
*/
|
|
197
|
-
onProgress?: FetchOnProgressResult | undefined;
|
|
198
|
-
};
|
|
199
164
|
/**
|
|
200
165
|
* Callback function used to report the progress of a data download.
|
|
201
166
|
*/
|
package/dist/v1/basics/html.mjs
CHANGED
|
@@ -3,14 +3,22 @@ import { isJsonObject } from './objChecker.mjs';
|
|
|
3
3
|
/**
|
|
4
4
|
* Reads the contents of a file using the specified FileReader method.
|
|
5
5
|
*
|
|
6
|
-
* @param {File} file - The file to be read.
|
|
6
|
+
* @param {File|Blob} file - The file to be read.
|
|
7
7
|
* @param {'readAsArrayBuffer'|'readAsDataURL'|'readAsText'|'readAsBinaryString'} method -
|
|
8
|
-
*
|
|
8
|
+
* The FileReader method to use for reading the file.
|
|
9
9
|
* @returns {Promise<any>} - A promise that resolves with the file content, according to the chosen method.
|
|
10
|
+
* @throws {TypeError} - If arguments don't match expected types.
|
|
10
11
|
* @throws {Error} - If an unexpected error occurs while handling the result.
|
|
11
12
|
* @throws {DOMException} - If the FileReader encounters an error while reading the file.
|
|
12
13
|
*/
|
|
13
14
|
export function readFileBlob(file, method) {
|
|
15
|
+
if (!(file instanceof Blob)) {
|
|
16
|
+
return Promise.reject(new TypeError('The "file" argument must be an instance of Blob or File.'));
|
|
17
|
+
}
|
|
18
|
+
const validMethods = ['readAsArrayBuffer', 'readAsDataURL', 'readAsText', 'readAsBinaryString'];
|
|
19
|
+
if (typeof method !== 'string' || !validMethods.includes(method)) {
|
|
20
|
+
return Promise.reject(new TypeError(`The "method" argument must be one of: ${validMethods.join(', ')}.`));
|
|
21
|
+
}
|
|
14
22
|
return new Promise((resolve, reject) => {
|
|
15
23
|
const reader = new FileReader();
|
|
16
24
|
reader.onload = () => {
|
|
@@ -32,9 +40,9 @@ export function readFileBlob(file, method) {
|
|
|
32
40
|
*
|
|
33
41
|
* Performs strict validation to ensure the result is a valid Base64 string or a proper data URL.
|
|
34
42
|
*
|
|
35
|
-
* @param {File} file - The file to be read.
|
|
43
|
+
* @param {File|Blob} file - The file to be read.
|
|
36
44
|
* @param {boolean|string} [isDataUrl=false] - If true, returns a full data URL; if false, returns only the Base64 string;
|
|
37
|
-
*
|
|
45
|
+
* if a string is passed, it is used as the MIME type in the data URL.
|
|
38
46
|
* @returns {Promise<string>} - A promise that resolves with the Base64 string or data URL.
|
|
39
47
|
*
|
|
40
48
|
* @throws {TypeError} - If the result is not a string or if `isDataUrl` is not a valid type.
|
|
@@ -42,9 +50,14 @@ export function readFileBlob(file, method) {
|
|
|
42
50
|
* @throws {DOMException} - If the FileReader fails to read the file.
|
|
43
51
|
*/
|
|
44
52
|
export function readBase64Blob(file, isDataUrl = false) {
|
|
53
|
+
// Validação do argumento 'file'
|
|
54
|
+
if (!(file instanceof Blob)) {
|
|
55
|
+
return Promise.reject(new TypeError('The "file" argument must be an instance of Blob or File.'));
|
|
56
|
+
}
|
|
57
|
+
if (typeof isDataUrl !== 'string' && typeof isDataUrl !== 'boolean') {
|
|
58
|
+
return Promise.reject(new TypeError('The isDataUrl parameter must be a boolean or a string.'));
|
|
59
|
+
}
|
|
45
60
|
return new Promise((resolve, reject) => {
|
|
46
|
-
if (typeof isDataUrl !== 'string' && typeof isDataUrl !== 'boolean')
|
|
47
|
-
reject(new TypeError('The isDataUrl parameter must be a boolean or a string.'));
|
|
48
61
|
readFileBlob(file, 'readAsDataURL')
|
|
49
62
|
.then(
|
|
50
63
|
/**
|
|
@@ -73,7 +86,7 @@ export function readBase64Blob(file, isDataUrl = false) {
|
|
|
73
86
|
*
|
|
74
87
|
* Performs several checks to ensure the file contains valid, parsable JSON data.
|
|
75
88
|
*
|
|
76
|
-
* @param {File} file - The file to be read. It must contain valid JSON as plain text.
|
|
89
|
+
* @param {File|Blob} file - The file to be read. It must contain valid JSON as plain text.
|
|
77
90
|
* @returns {Promise<Record<string|number|symbol, any>|any[]>} - A promise that resolves with the parsed JSON object.
|
|
78
91
|
*
|
|
79
92
|
* @throws {SyntaxError} - If the file content is not valid JSON syntax.
|
|
@@ -82,6 +95,9 @@ export function readBase64Blob(file, isDataUrl = false) {
|
|
|
82
95
|
* @throws {DOMException} - If the FileReader fails to read the file.
|
|
83
96
|
*/
|
|
84
97
|
export function readJsonBlob(file) {
|
|
98
|
+
if (!(file instanceof Blob)) {
|
|
99
|
+
return Promise.reject(new TypeError('The "file" argument must be an instance of Blob or File.'));
|
|
100
|
+
}
|
|
85
101
|
return new Promise((resolve, reject) => readFileBlob(file, 'readAsText')
|
|
86
102
|
.then((data) => {
|
|
87
103
|
if (typeof data !== 'string')
|
|
@@ -101,8 +117,15 @@ export function readJsonBlob(file) {
|
|
|
101
117
|
* @param {string} filename
|
|
102
118
|
* @param {any} data
|
|
103
119
|
* @param {number} [spaces=2]
|
|
120
|
+
* @throws {TypeError} - If arguments do not match expected types.
|
|
104
121
|
*/
|
|
105
122
|
export function saveJsonFile(filename, data, spaces = 2) {
|
|
123
|
+
if (typeof filename !== 'string') {
|
|
124
|
+
throw new TypeError('The "filename" argument must be a string.');
|
|
125
|
+
}
|
|
126
|
+
if (typeof spaces !== 'number' || !Number.isInteger(spaces) || spaces < 0) {
|
|
127
|
+
throw new TypeError('The "spaces" argument must be a non-negative integer.');
|
|
128
|
+
}
|
|
106
129
|
const json = JSON.stringify(data, null, spaces);
|
|
107
130
|
const blob = new Blob([json], { type: 'application/json' });
|
|
108
131
|
const url = URL.createObjectURL(blob);
|
|
@@ -114,16 +137,6 @@ export function saveJsonFile(filename, data, spaces = 2) {
|
|
|
114
137
|
document.body.removeChild(link);
|
|
115
138
|
URL.revokeObjectURL(url);
|
|
116
139
|
}
|
|
117
|
-
/**
|
|
118
|
-
* @typedef {Object} FetchTemplateOptions
|
|
119
|
-
* @property {string} [method="GET"] - HTTP method to use (GET, POST, etc.).
|
|
120
|
-
* @property {any} [body] - Request body (only for methods like POST, PUT).
|
|
121
|
-
* @property {number} [timeout=0] - Timeout in milliseconds (ignored if signal is provided).
|
|
122
|
-
* @property {number} [retries=0] - Number of retry attempts (ignored if signal is provided).
|
|
123
|
-
* @property {Headers|Record<string, *>} [headers={}] - Additional headers.
|
|
124
|
-
* @property {AbortSignal|null} [signal] - External AbortSignal; disables timeout and retries.
|
|
125
|
-
* @property {FetchOnProgressResult} [onProgress] - Track the load progress.
|
|
126
|
-
*/
|
|
127
140
|
/**
|
|
128
141
|
* Callback function used to report the progress of a data download.
|
|
129
142
|
*
|
|
@@ -141,9 +154,17 @@ export function saveJsonFile(filename, data, spaces = 2) {
|
|
|
141
154
|
*
|
|
142
155
|
* @param {Response} response - The original response object to be tracked.
|
|
143
156
|
* @param {FetchOnProgressResult} onProgress - The callback function to handle progress events.
|
|
157
|
+
* @param {(res: Response) => ResponseInit} [returnResponse] - The callback function to return the ResponseInit to ReadableStream.
|
|
144
158
|
* @returns {Response} A new Response object with the tracked stream.
|
|
145
159
|
*/
|
|
146
|
-
export function trackFetchProgress(response, onProgress) {
|
|
160
|
+
export function trackFetchProgress(response, onProgress, returnResponse = (res) => ({
|
|
161
|
+
headers: res.headers,
|
|
162
|
+
status: res.status,
|
|
163
|
+
statusText: res.statusText,
|
|
164
|
+
})) {
|
|
165
|
+
if (!(response instanceof Response)) {
|
|
166
|
+
throw new TypeError('The "response" argument must be an instance of Response.');
|
|
167
|
+
}
|
|
147
168
|
if (typeof onProgress !== 'function')
|
|
148
169
|
throw new TypeError('The "onProgress" argument must be a function.');
|
|
149
170
|
if (!response.body)
|
|
@@ -166,88 +187,31 @@ export function trackFetchProgress(response, onProgress) {
|
|
|
166
187
|
controller.close();
|
|
167
188
|
},
|
|
168
189
|
});
|
|
169
|
-
return new Response(stream,
|
|
170
|
-
headers: response.headers,
|
|
171
|
-
status: response.status,
|
|
172
|
-
statusText: response.statusText,
|
|
173
|
-
});
|
|
174
|
-
}
|
|
175
|
-
/**
|
|
176
|
-
* @param {string} url - The full URL to fetch data from.
|
|
177
|
-
* @param {FetchTemplateOptions} [options] - Optional settings.
|
|
178
|
-
* @returns {Promise<Response>} Result data.
|
|
179
|
-
* @throws {Error} Throws if fetch fails, times out.
|
|
180
|
-
*/
|
|
181
|
-
async function fetchTemplate(url, { method = 'GET', body, timeout = 0, retries = 0, headers = {}, signal = null, onProgress } = {}) {
|
|
182
|
-
if (typeof url !== 'string' ||
|
|
183
|
-
(!url.startsWith('../') &&
|
|
184
|
-
!url.startsWith('./') &&
|
|
185
|
-
!url.startsWith('/') &&
|
|
186
|
-
!url.startsWith('https://') &&
|
|
187
|
-
!url.startsWith('http://')))
|
|
188
|
-
throw new Error('Invalid URL: must be a valid http or https address.');
|
|
189
|
-
if (typeof method !== 'string' || !method.trim())
|
|
190
|
-
throw new Error('Invalid method: must be a non-empty string.');
|
|
191
|
-
if (!signal) {
|
|
192
|
-
if (typeof timeout !== 'number' ||
|
|
193
|
-
!Number.isFinite(timeout) ||
|
|
194
|
-
Number.isNaN(timeout) ||
|
|
195
|
-
timeout < 0)
|
|
196
|
-
throw new Error('Invalid timeout: must be a positive number.');
|
|
197
|
-
if (typeof retries !== 'number' ||
|
|
198
|
-
!Number.isFinite(retries) ||
|
|
199
|
-
Number.isNaN(retries) ||
|
|
200
|
-
retries < 0)
|
|
201
|
-
throw new Error('Invalid retries: must be a positive number.');
|
|
202
|
-
}
|
|
203
|
-
const attempts = signal ? 1 : retries + 1;
|
|
204
|
-
/** @type {Error|null} */
|
|
205
|
-
let lastError = null;
|
|
206
|
-
for (let attempt = 0; attempt < attempts; attempt++) {
|
|
207
|
-
const controller = signal ? null : new AbortController();
|
|
208
|
-
const localSignal = signal || (controller?.signal ?? null);
|
|
209
|
-
const timer = !signal && timeout && controller ? setTimeout(() => controller.abort(), timeout) : null;
|
|
210
|
-
try {
|
|
211
|
-
const response = await fetch(url, {
|
|
212
|
-
method: method.toUpperCase(),
|
|
213
|
-
headers: {
|
|
214
|
-
Accept: 'application/json',
|
|
215
|
-
...headers,
|
|
216
|
-
},
|
|
217
|
-
body: body !== undefined ? (isJsonObject(body) ? JSON.stringify(body) : body) : undefined,
|
|
218
|
-
signal: localSignal,
|
|
219
|
-
});
|
|
220
|
-
if (timer)
|
|
221
|
-
clearTimeout(timer);
|
|
222
|
-
if (!response.ok)
|
|
223
|
-
throw new Error(`HTTP error: ${response.status} ${response.statusText}`);
|
|
224
|
-
// If onProgress is not provided or body is null, return original response
|
|
225
|
-
if (!onProgress)
|
|
226
|
-
return response;
|
|
227
|
-
return trackFetchProgress(response, onProgress);
|
|
228
|
-
}
|
|
229
|
-
catch (err) {
|
|
230
|
-
lastError = /** @type {Error} */ (err);
|
|
231
|
-
if (signal)
|
|
232
|
-
break; // if an external signal came, it does not retry
|
|
233
|
-
if (attempt < retries)
|
|
234
|
-
await new Promise((resolve) => setTimeout(resolve, 300 * (attempt + 1)));
|
|
235
|
-
}
|
|
236
|
-
}
|
|
237
|
-
throw new Error(`Failed to fetch JSON from "${url}"${lastError ? `: ${lastError.message}` : '.'}`);
|
|
190
|
+
return new Response(stream, returnResponse(response));
|
|
238
191
|
}
|
|
239
192
|
/**
|
|
240
193
|
* Loads and parses a JSON from a remote URL using Fetch API.
|
|
241
194
|
*
|
|
242
|
-
* @param {string} url - The full URL to fetch JSON from.
|
|
243
|
-
* @param {
|
|
195
|
+
* @param {string | URL | Request} url - The full URL to fetch JSON from.
|
|
196
|
+
* @param {RequestInit|null} [options] - Optional settings.
|
|
197
|
+
* @param {FetchOnProgressResult} [onProgress] - Track the load progress.
|
|
244
198
|
* @returns {Promise<any[] | Record<string | number | symbol, unknown>>} Parsed JSON object.
|
|
245
199
|
* @throws {Error} Throws if fetch fails, times out, or returns invalid JSON.
|
|
246
200
|
*/
|
|
247
|
-
export async function fetchJson(url, options) {
|
|
201
|
+
export async function fetchJson(url, options, onProgress) {
|
|
202
|
+
if (typeof url !== 'string') {
|
|
203
|
+
return Promise.reject(new TypeError('The "url" argument must be a string.'));
|
|
204
|
+
}
|
|
205
|
+
if (options !== undefined && typeof options !== 'object') {
|
|
206
|
+
return Promise.reject(new TypeError('The "options" argument must be an object.'));
|
|
207
|
+
}
|
|
208
|
+
if (onProgress !== undefined && typeof onProgress !== 'function') {
|
|
209
|
+
return Promise.reject(new TypeError('The "onProgress" option must be a function.'));
|
|
210
|
+
}
|
|
248
211
|
return new Promise((resolve, reject) => {
|
|
249
|
-
|
|
250
|
-
.then(async (
|
|
212
|
+
fetch(url, options ?? undefined)
|
|
213
|
+
.then(async (response) => {
|
|
214
|
+
const res = onProgress ? trackFetchProgress(response, onProgress) : response;
|
|
251
215
|
const contentType = res.headers.get('content-type') || '';
|
|
252
216
|
if (!contentType.includes('application/json'))
|
|
253
217
|
throw new Error(`Unexpected content-type: ${contentType}`);
|
|
@@ -262,16 +226,30 @@ export async function fetchJson(url, options) {
|
|
|
262
226
|
/**
|
|
263
227
|
* Loads a remote file as a Blob using Fetch API.
|
|
264
228
|
*
|
|
265
|
-
* @param {string} url - The full URL to fetch the file from.
|
|
266
|
-
* @param {FetchTemplateOptions} [options] - Optional fetch options.
|
|
229
|
+
* @param {string | URL | Request} url - The full URL to fetch the file from.
|
|
267
230
|
* @param {string[]} [allowedMimeTypes] - Optional list of accepted MIME types (e.g., ['image/jpeg']).
|
|
231
|
+
* @param {RequestInit|null} [options] - Optional fetch options.
|
|
232
|
+
* @param {FetchOnProgressResult} [onProgress] - Track the load progress.
|
|
268
233
|
* @returns {Promise<Blob>} - The fetched file as a Blob.
|
|
269
234
|
* @throws {Error} Throws if fetch fails, response is not ok, or MIME type is not allowed.
|
|
270
235
|
*/
|
|
271
|
-
export async function fetchBlob(url, allowedMimeTypes, options) {
|
|
236
|
+
export async function fetchBlob(url, allowedMimeTypes, options, onProgress) {
|
|
237
|
+
if (typeof url !== 'string') {
|
|
238
|
+
return Promise.reject(new TypeError('The "url" argument must be a string.'));
|
|
239
|
+
}
|
|
240
|
+
if (allowedMimeTypes !== undefined && !Array.isArray(allowedMimeTypes)) {
|
|
241
|
+
return Promise.reject(new TypeError('The "allowedMimeTypes" argument must be an array of strings.'));
|
|
242
|
+
}
|
|
243
|
+
if (options !== undefined && typeof options !== 'object') {
|
|
244
|
+
return Promise.reject(new TypeError('The "options" argument must be an object.'));
|
|
245
|
+
}
|
|
246
|
+
if (onProgress !== undefined && typeof onProgress !== 'function') {
|
|
247
|
+
return Promise.reject(new TypeError('The "onProgress" option must be a function.'));
|
|
248
|
+
}
|
|
272
249
|
return new Promise((resolve, reject) => {
|
|
273
|
-
|
|
274
|
-
.then(async (
|
|
250
|
+
fetch(url, options ?? undefined)
|
|
251
|
+
.then(async (response) => {
|
|
252
|
+
const res = onProgress ? trackFetchProgress(response, onProgress) : response;
|
|
275
253
|
const contentType = res.headers.get('content-type') || '';
|
|
276
254
|
if (Array.isArray(allowedMimeTypes) &&
|
|
277
255
|
allowedMimeTypes.length > 0 &&
|
|
@@ -286,17 +264,30 @@ export async function fetchBlob(url, allowedMimeTypes, options) {
|
|
|
286
264
|
}
|
|
287
265
|
/**
|
|
288
266
|
* Loads a remote file as a text using Fetch API.
|
|
289
|
-
*
|
|
290
|
-
* @param {string} url - The full URL to fetch the file from.
|
|
291
|
-
* @param {FetchTemplateOptions} [options] - Optional fetch options.
|
|
267
|
+
* @param {string | URL | Request} url - The full URL to fetch the file from.
|
|
292
268
|
* @param {string[]} [allowedMimeTypes] - Optional list of accepted MIME types (e.g., ['image/jpeg']).
|
|
269
|
+
* @param {RequestInit|null} [options] - Optional fetch options.
|
|
270
|
+
* @param {FetchOnProgressResult} [onProgress] - Track the load progress.
|
|
293
271
|
* @returns {Promise<string>} - The fetched file as a text.
|
|
294
272
|
* @throws {Error} Throws if fetch fails, response is not ok, or MIME type is not allowed.
|
|
295
273
|
*/
|
|
296
|
-
export async function fetchText(url, allowedMimeTypes, options) {
|
|
274
|
+
export async function fetchText(url, allowedMimeTypes, options, onProgress) {
|
|
275
|
+
if (typeof url !== 'string') {
|
|
276
|
+
return Promise.reject(new TypeError('The "url" argument must be a string.'));
|
|
277
|
+
}
|
|
278
|
+
if (allowedMimeTypes !== undefined && !Array.isArray(allowedMimeTypes)) {
|
|
279
|
+
return Promise.reject(new TypeError('The "allowedMimeTypes" argument must be an array of strings.'));
|
|
280
|
+
}
|
|
281
|
+
if (options !== undefined && typeof options !== 'object') {
|
|
282
|
+
return Promise.reject(new TypeError('The "options" argument must be an object.'));
|
|
283
|
+
}
|
|
284
|
+
if (onProgress !== undefined && typeof onProgress !== 'function') {
|
|
285
|
+
return Promise.reject(new TypeError('The "onProgress" option must be a function.'));
|
|
286
|
+
}
|
|
297
287
|
return new Promise((resolve, reject) => {
|
|
298
|
-
|
|
299
|
-
.then(async (
|
|
288
|
+
fetch(url, options ?? undefined)
|
|
289
|
+
.then(async (response) => {
|
|
290
|
+
const res = onProgress ? trackFetchProgress(response, onProgress) : response;
|
|
300
291
|
const contentType = res.headers.get('content-type') || '';
|
|
301
292
|
if (Array.isArray(allowedMimeTypes) &&
|
|
302
293
|
allowedMimeTypes.length > 0 &&
|
|
@@ -338,7 +329,20 @@ export async function fetchText(url, allowedMimeTypes, options) {
|
|
|
338
329
|
* @param {(event: Event, startTime: number) => void} [options.onLoading]
|
|
339
330
|
* @returns {Promise<ImageLoadResult>}
|
|
340
331
|
*/
|
|
341
|
-
export async function loadImage(
|
|
332
|
+
export async function loadImage(options) {
|
|
333
|
+
if (options === null || typeof options !== 'object') {
|
|
334
|
+
return Promise.reject(new TypeError('The "options" argument must be an object.'));
|
|
335
|
+
}
|
|
336
|
+
const { url, onLoading, crossOrigin = 'anonymous' } = options;
|
|
337
|
+
if (typeof url !== 'string') {
|
|
338
|
+
return Promise.reject(new TypeError('The "url" option must be a string.'));
|
|
339
|
+
}
|
|
340
|
+
if (typeof crossOrigin !== 'string') {
|
|
341
|
+
return Promise.reject(new TypeError('The "crossOrigin" option must be a string.'));
|
|
342
|
+
}
|
|
343
|
+
if (onLoading !== undefined && typeof onLoading !== 'function') {
|
|
344
|
+
return Promise.reject(new TypeError('The "onLoading" option must be a function.'));
|
|
345
|
+
}
|
|
342
346
|
return new Promise((resolve, reject) => {
|
|
343
347
|
const img = new Image();
|
|
344
348
|
let startTime = performance.now();
|
|
@@ -405,7 +409,11 @@ export async function loadImage({ url, onLoading, crossOrigin = 'anonymous' }) {
|
|
|
405
409
|
* @returns {() => void} Function that removes all installed event listeners.
|
|
406
410
|
* @throws {TypeError} If any provided setting is invalid.
|
|
407
411
|
*/
|
|
408
|
-
export function installWindowHiddenScript(
|
|
412
|
+
export function installWindowHiddenScript(settings = {}) {
|
|
413
|
+
if (settings === null || typeof settings !== 'object') {
|
|
414
|
+
throw new TypeError('The "settings" argument must be an object.');
|
|
415
|
+
}
|
|
416
|
+
const { element = document.body, hiddenClass = 'windowHidden', visibleClass = 'windowVisible', onVisible, onHidden, } = settings;
|
|
409
417
|
if (!(element instanceof Element))
|
|
410
418
|
throw new TypeError(`"element" must be an instance of Element.`);
|
|
411
419
|
if (typeof hiddenClass !== 'string')
|
package/dist/v1/basics/index.cjs
CHANGED
|
@@ -15,6 +15,7 @@ var mediaContent = require('./mediaContent.cjs');
|
|
|
15
15
|
|
|
16
16
|
exports.arraySortPositions = array.arraySortPositions;
|
|
17
17
|
exports.diffArrayList = array.diffArrayList;
|
|
18
|
+
exports.multiplyArrayBlocks = array.multiplyArrayBlocks;
|
|
18
19
|
exports.shuffleArray = array.shuffleArray;
|
|
19
20
|
exports.breakdownDuration = clock.breakdownDuration;
|
|
20
21
|
exports.formatCustomTimer = clock.formatCustomTimer;
|
|
@@ -51,6 +52,7 @@ exports.getSimplePerc = simpleMath.getSimplePerc;
|
|
|
51
52
|
exports.ruleOfThree = simpleMath.ruleOfThree;
|
|
52
53
|
exports.addAiMarkerShortcut = text.addAiMarkerShortcut;
|
|
53
54
|
exports.asyncReplace = text.asyncReplace;
|
|
55
|
+
exports.diffObjList = text.diffObjList;
|
|
54
56
|
exports.diffStrings = text.diffStrings;
|
|
55
57
|
exports.safeTextTrim = text.safeTextTrim;
|
|
56
58
|
exports.toTitleCase = text.toTitleCase;
|
|
@@ -1,8 +1,10 @@
|
|
|
1
|
+
import { multiplyArrayBlocks } from './array.mjs';
|
|
1
2
|
import { valMediaContentMetadata } from './mediaContent.mjs';
|
|
2
3
|
import { valMediaContentMetadataPartial } from './mediaContent.mjs';
|
|
3
4
|
import { parseMediaMetadata } from './mediaContent.mjs';
|
|
4
5
|
import { extractMediaId3Tags } from './mediaContent.mjs';
|
|
5
6
|
import { diffStrings } from './text.mjs';
|
|
7
|
+
import { diffObjList } from './text.mjs';
|
|
6
8
|
import { diffArrayList } from './array.mjs';
|
|
7
9
|
import { breakdownDuration } from './clock.mjs';
|
|
8
10
|
import { calculateMarketcap } from './simpleMath.mjs';
|
|
@@ -62,5 +64,5 @@ import { getTimeDuration } from './clock.mjs';
|
|
|
62
64
|
import { shuffleArray } from './array.mjs';
|
|
63
65
|
import { toTitleCase } from './text.mjs';
|
|
64
66
|
import { toTitleCaseLowerFirst } from './text.mjs';
|
|
65
|
-
export { valMediaContentMetadata, valMediaContentMetadataPartial, parseMediaMetadata, extractMediaId3Tags, diffStrings, diffArrayList, breakdownDuration, calculateMarketcap, compareMarketcap, getPercentage, areElsCollTop, areElsCollBottom, areElsCollLeft, areElsCollRight, areElsCollPerfTop, areElsCollPerfBottom, areElsCollPerfLeft, areElsCollPerfRight, areElsColliding, areElsPerfColliding, getElsColliding, getElsPerfColliding, getElsCollOverlap, getElsCollOverlapPos, getRectCenter, getElsRelativeCenterOffset, getElsCollDirDepth, getElsCollDetails, safeTextTrim, installWindowHiddenScript, genFibonacciSeq, fetchJson, fetchText, readJsonBlob, readFileBlob, readBase64Blob, saveJsonFile, documentIsFullScreen, isScreenFilled, requestFullScreen, exitFullScreen, isFullScreenMode, onFullScreenChange, offFullScreenChange, isJsonObject, arraySortPositions, formatBytes, addAiMarkerShortcut, extendObjType, reorderObjTypeOrder, cloneObjTypeOrder, countObj, objType, ruleOfThree, getSimplePerc, asyncReplace, getAge, formatCustomTimer, formatDayTimer, formatTimer, getTimeDuration, shuffleArray, toTitleCase, toTitleCaseLowerFirst };
|
|
67
|
+
export { multiplyArrayBlocks, valMediaContentMetadata, valMediaContentMetadataPartial, parseMediaMetadata, extractMediaId3Tags, diffStrings, diffObjList, diffArrayList, breakdownDuration, calculateMarketcap, compareMarketcap, getPercentage, areElsCollTop, areElsCollBottom, areElsCollLeft, areElsCollRight, areElsCollPerfTop, areElsCollPerfBottom, areElsCollPerfLeft, areElsCollPerfRight, areElsColliding, areElsPerfColliding, getElsColliding, getElsPerfColliding, getElsCollOverlap, getElsCollOverlapPos, getRectCenter, getElsRelativeCenterOffset, getElsCollDirDepth, getElsCollDetails, safeTextTrim, installWindowHiddenScript, genFibonacciSeq, fetchJson, fetchText, readJsonBlob, readFileBlob, readBase64Blob, saveJsonFile, documentIsFullScreen, isScreenFilled, requestFullScreen, exitFullScreen, isFullScreenMode, onFullScreenChange, offFullScreenChange, isJsonObject, arraySortPositions, formatBytes, addAiMarkerShortcut, extendObjType, reorderObjTypeOrder, cloneObjTypeOrder, countObj, objType, ruleOfThree, getSimplePerc, asyncReplace, getAge, formatCustomTimer, formatDayTimer, formatTimer, getTimeDuration, shuffleArray, toTitleCase, toTitleCaseLowerFirst };
|
|
66
68
|
//# sourceMappingURL=index.d.mts.map
|
package/dist/v1/basics/index.mjs
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { diffArrayList, shuffleArray, arraySortPositions } from './array.mjs';
|
|
1
|
+
import { diffArrayList, shuffleArray, arraySortPositions, multiplyArrayBlocks } from './array.mjs';
|
|
2
2
|
import { breakdownDuration, formatCustomTimer, formatDayTimer, formatTimer, getTimeDuration, } from './clock.mjs';
|
|
3
3
|
import { readJsonBlob, saveJsonFile, fetchJson, installWindowHiddenScript, readFileBlob, readBase64Blob, fetchText, } from './html.mjs';
|
|
4
4
|
import { extendObjType, reorderObjTypeOrder, cloneObjTypeOrder, objType } from './objFilter.mjs';
|
|
5
5
|
import { countObj, isJsonObject } from './objChecker.mjs';
|
|
6
6
|
import { documentIsFullScreen, isScreenFilled, requestFullScreen, exitFullScreen, isFullScreenMode, onFullScreenChange, offFullScreenChange, } from './fullScreen.mjs';
|
|
7
7
|
import { calculateMarketcap, compareMarketcap, formatBytes, genFibonacciSeq, getAge, getPercentage, getSimplePerc, ruleOfThree, } from './simpleMath.mjs';
|
|
8
|
-
import { addAiMarkerShortcut, diffStrings, safeTextTrim, toTitleCase, toTitleCaseLowerFirst, asyncReplace, } from './text.mjs';
|
|
8
|
+
import { addAiMarkerShortcut, diffStrings, diffObjList, safeTextTrim, toTitleCase, toTitleCaseLowerFirst, asyncReplace, } from './text.mjs';
|
|
9
9
|
import { areElsCollTop, areElsCollBottom, areElsCollLeft, areElsCollRight, areElsCollPerfTop, areElsCollPerfBottom, areElsCollPerfLeft, areElsCollPerfRight, areElsColliding, areElsPerfColliding, getElsColliding, getElsPerfColliding, getElsCollOverlap, getElsCollOverlapPos, getRectCenter, getElsRelativeCenterOffset, getElsCollDirDepth, getElsCollDetails, } from './collision.mjs';
|
|
10
10
|
import { extractMediaId3Tags, parseMediaMetadata, valMediaContentMetadata, valMediaContentMetadataPartial, } from './mediaContent.mjs';
|
|
11
|
-
export { valMediaContentMetadata, valMediaContentMetadataPartial, parseMediaMetadata, extractMediaId3Tags, diffStrings, diffArrayList, breakdownDuration, calculateMarketcap, compareMarketcap, getPercentage, areElsCollTop, areElsCollBottom, areElsCollLeft, areElsCollRight, areElsCollPerfTop, areElsCollPerfBottom, areElsCollPerfLeft, areElsCollPerfRight, areElsColliding, areElsPerfColliding, getElsColliding, getElsPerfColliding, getElsCollOverlap, getElsCollOverlapPos, getRectCenter, getElsRelativeCenterOffset, getElsCollDirDepth, getElsCollDetails, safeTextTrim, installWindowHiddenScript, genFibonacciSeq, fetchJson, fetchText, readJsonBlob, readFileBlob, readBase64Blob, saveJsonFile, documentIsFullScreen, isScreenFilled, requestFullScreen, exitFullScreen, isFullScreenMode, onFullScreenChange, offFullScreenChange, isJsonObject, arraySortPositions, formatBytes, addAiMarkerShortcut, extendObjType, reorderObjTypeOrder, cloneObjTypeOrder, countObj, objType, ruleOfThree, getSimplePerc, asyncReplace, getAge, formatCustomTimer, formatDayTimer, formatTimer, getTimeDuration, shuffleArray, toTitleCase, toTitleCaseLowerFirst, };
|
|
11
|
+
export { multiplyArrayBlocks, valMediaContentMetadata, valMediaContentMetadataPartial, parseMediaMetadata, extractMediaId3Tags, diffStrings, diffObjList, diffArrayList, breakdownDuration, calculateMarketcap, compareMarketcap, getPercentage, areElsCollTop, areElsCollBottom, areElsCollLeft, areElsCollRight, areElsCollPerfTop, areElsCollPerfBottom, areElsCollPerfLeft, areElsCollPerfRight, areElsColliding, areElsPerfColliding, getElsColliding, getElsPerfColliding, getElsCollOverlap, getElsCollOverlapPos, getRectCenter, getElsRelativeCenterOffset, getElsCollDirDepth, getElsCollDetails, safeTextTrim, installWindowHiddenScript, genFibonacciSeq, fetchJson, fetchText, readJsonBlob, readFileBlob, readBase64Blob, saveJsonFile, documentIsFullScreen, isScreenFilled, requestFullScreen, exitFullScreen, isFullScreenMode, onFullScreenChange, offFullScreenChange, isJsonObject, arraySortPositions, formatBytes, addAiMarkerShortcut, extendObjType, reorderObjTypeOrder, cloneObjTypeOrder, countObj, objType, ruleOfThree, getSimplePerc, asyncReplace, getAge, formatCustomTimer, formatDayTimer, formatTimer, getTimeDuration, shuffleArray, toTitleCase, toTitleCaseLowerFirst, };
|