tiny-essentials 1.20.0 → 1.20.2

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.
Files changed (55) hide show
  1. package/README.md +5 -0
  2. package/dist/v1/TinyBasicsEs.min.js +1 -1
  3. package/dist/v1/TinyDragger.min.js +1 -1
  4. package/dist/v1/TinyEssentials.min.js +1 -1
  5. package/dist/v1/TinyHtml.min.js +1 -1
  6. package/dist/v1/TinySmartScroller.min.js +1 -1
  7. package/dist/v1/TinyUploadClicker.min.js +1 -1
  8. package/dist/v1/basics/html.cjs +33 -2
  9. package/dist/v1/basics/html.d.mts +14 -4
  10. package/dist/v1/basics/html.mjs +27 -2
  11. package/dist/v1/basics/index.cjs +2 -0
  12. package/dist/v1/basics/index.d.mts +3 -1
  13. package/dist/v1/basics/index.mjs +3 -3
  14. package/dist/v1/basics/simpleMath.cjs +23 -4
  15. package/dist/v1/basics/simpleMath.d.mts +18 -4
  16. package/dist/v1/basics/simpleMath.mjs +22 -4
  17. package/dist/v1/index.cjs +2 -0
  18. package/dist/v1/index.d.mts +3 -1
  19. package/dist/v1/index.mjs +3 -3
  20. package/dist/v1/libs/TinyDragger.cjs +1 -1
  21. package/dist/v1/libs/TinyDragger.mjs +1 -1
  22. package/dist/v1/libs/TinyHtml.cjs +500 -105
  23. package/dist/v1/libs/TinyHtml.d.mts +251 -42
  24. package/dist/v1/libs/TinyHtml.mjs +448 -96
  25. package/dist/v1/libs/TinyIframeEvents.cjs +2 -1
  26. package/dist/v1/libs/TinyNewWinEvents.cjs +4 -2
  27. package/docs/v1/basics/html.md +78 -22
  28. package/docs/v1/basics/simpleMath.md +22 -4
  29. package/docs/v1/libs/TinyHtml.md +268 -6
  30. package/package.json +1 -1
  31. package/dist/v1/ColorSafeStringify.js +0 -235
  32. package/dist/v1/TinyAfterScrollWatcher.js +0 -219
  33. package/dist/v1/TinyBasicsEs.js +0 -9334
  34. package/dist/v1/TinyClipboard.js +0 -459
  35. package/dist/v1/TinyColorConverter.js +0 -617
  36. package/dist/v1/TinyDomReadyManager.js +0 -213
  37. package/dist/v1/TinyDragDropDetector.js +0 -307
  38. package/dist/v1/TinyDragger.js +0 -6569
  39. package/dist/v1/TinyEssentials.js +0 -20792
  40. package/dist/v1/TinyEvents.js +0 -402
  41. package/dist/v1/TinyHtml.js +0 -5545
  42. package/dist/v1/TinyIframeEvents.js +0 -854
  43. package/dist/v1/TinyLevelUp.js +0 -291
  44. package/dist/v1/TinyLocalStorage.js +0 -1440
  45. package/dist/v1/TinyNewWinEvents.js +0 -888
  46. package/dist/v1/TinyNotifications.js +0 -408
  47. package/dist/v1/TinyNotifyCenter.js +0 -493
  48. package/dist/v1/TinyPromiseQueue.js +0 -299
  49. package/dist/v1/TinyRateLimiter.js +0 -611
  50. package/dist/v1/TinySmartScroller.js +0 -7039
  51. package/dist/v1/TinyTextRangeEditor.js +0 -497
  52. package/dist/v1/TinyTimeout.js +0 -233
  53. package/dist/v1/TinyToastNotify.js +0 -441
  54. package/dist/v1/TinyUploadClicker.js +0 -14353
  55. package/dist/v1/UltraRandomMsgGen.js +0 -995
@@ -49,21 +49,31 @@ export function saveJsonFile(filename: string, data: any, spaces?: number): void
49
49
  * Loads and parses a JSON from a remote URL using Fetch API.
50
50
  *
51
51
  * @param {string} url - The full URL to fetch JSON from.
52
- * @param {Object} [options] - Optional settings.
52
+ * @param {FetchTemplateOptions} [options] - Optional settings.
53
53
  * @returns {Promise<any[] | Record<string | number | symbol, unknown>>} Parsed JSON object.
54
54
  * @throws {Error} Throws if fetch fails, times out, or returns invalid JSON.
55
55
  */
56
- export function fetchJson(url: string, options?: Object): Promise<any[] | Record<string | number | symbol, unknown>>;
56
+ export function fetchJson(url: string, options?: FetchTemplateOptions): Promise<any[] | Record<string | number | symbol, unknown>>;
57
57
  /**
58
58
  * Loads a remote file as a Blob using Fetch API.
59
59
  *
60
60
  * @param {string} url - The full URL to fetch the file from.
61
- * @param {Object} [options] - Optional fetch options.
61
+ * @param {FetchTemplateOptions} [options] - Optional fetch options.
62
62
  * @param {string[]} [allowedMimeTypes] - Optional list of accepted MIME types (e.g., ['image/jpeg']).
63
63
  * @returns {Promise<Blob>} - The fetched file as a Blob.
64
64
  * @throws {Error} Throws if fetch fails, response is not ok, or MIME type is not allowed.
65
65
  */
66
- export function fetchBlob(url: string, allowedMimeTypes?: string[], options?: Object): Promise<Blob>;
66
+ export function fetchBlob(url: string, allowedMimeTypes?: string[], options?: FetchTemplateOptions): Promise<Blob>;
67
+ /**
68
+ * Loads a remote file as a text using Fetch API.
69
+ *
70
+ * @param {string} url - The full URL to fetch the file from.
71
+ * @param {FetchTemplateOptions} [options] - Optional fetch options.
72
+ * @param {string[]} [allowedMimeTypes] - Optional list of accepted MIME types (e.g., ['image/jpeg']).
73
+ * @returns {Promise<string>} - The fetched file as a text.
74
+ * @throws {Error} Throws if fetch fails, response is not ok, or MIME type is not allowed.
75
+ */
76
+ export function fetchText(url: string, allowedMimeTypes?: string[], options?: FetchTemplateOptions): Promise<string>;
67
77
  /**
68
78
  * Installs a script that toggles CSS classes on a given element
69
79
  * based on the page's visibility or focus state, and optionally
@@ -188,7 +188,7 @@ async function fetchTemplate(url, { method = 'GET', body, timeout = 0, retries =
188
188
  * Loads and parses a JSON from a remote URL using Fetch API.
189
189
  *
190
190
  * @param {string} url - The full URL to fetch JSON from.
191
- * @param {Object} [options] - Optional settings.
191
+ * @param {FetchTemplateOptions} [options] - Optional settings.
192
192
  * @returns {Promise<any[] | Record<string | number | symbol, unknown>>} Parsed JSON object.
193
193
  * @throws {Error} Throws if fetch fails, times out, or returns invalid JSON.
194
194
  */
@@ -211,7 +211,7 @@ export async function fetchJson(url, options) {
211
211
  * Loads a remote file as a Blob using Fetch API.
212
212
  *
213
213
  * @param {string} url - The full URL to fetch the file from.
214
- * @param {Object} [options] - Optional fetch options.
214
+ * @param {FetchTemplateOptions} [options] - Optional fetch options.
215
215
  * @param {string[]} [allowedMimeTypes] - Optional list of accepted MIME types (e.g., ['image/jpeg']).
216
216
  * @returns {Promise<Blob>} - The fetched file as a Blob.
217
217
  * @throws {Error} Throws if fetch fails, response is not ok, or MIME type is not allowed.
@@ -232,6 +232,31 @@ export async function fetchBlob(url, allowedMimeTypes, options) {
232
232
  .catch(reject);
233
233
  });
234
234
  }
235
+ /**
236
+ * Loads a remote file as a text using Fetch API.
237
+ *
238
+ * @param {string} url - The full URL to fetch the file from.
239
+ * @param {FetchTemplateOptions} [options] - Optional fetch options.
240
+ * @param {string[]} [allowedMimeTypes] - Optional list of accepted MIME types (e.g., ['image/jpeg']).
241
+ * @returns {Promise<string>} - The fetched file as a text.
242
+ * @throws {Error} Throws if fetch fails, response is not ok, or MIME type is not allowed.
243
+ */
244
+ export async function fetchText(url, allowedMimeTypes, options) {
245
+ return new Promise((resolve, reject) => {
246
+ fetchTemplate(url, options)
247
+ .then(async (res) => {
248
+ const contentType = res.headers.get('content-type') || '';
249
+ if (Array.isArray(allowedMimeTypes) &&
250
+ allowedMimeTypes.length > 0 &&
251
+ !allowedMimeTypes.some((type) => contentType.includes(type))) {
252
+ throw new Error(`Blocked MIME type: ${contentType}`);
253
+ }
254
+ const data = await res.text();
255
+ return resolve(data);
256
+ })
257
+ .catch(reject);
258
+ });
259
+ }
235
260
  ///////////////////////////////////////////////////////////////////////////////
236
261
  /**
237
262
  * Installs a script that toggles CSS classes on a given element
@@ -23,6 +23,7 @@ exports.formatDayTimer = clock.formatDayTimer;
23
23
  exports.formatTimer = clock.formatTimer;
24
24
  exports.getTimeDuration = clock.getTimeDuration;
25
25
  exports.fetchJson = html.fetchJson;
26
+ exports.fetchText = html.fetchText;
26
27
  exports.installWindowHiddenScript = html.installWindowHiddenScript;
27
28
  exports.readBase64Blob = html.readBase64Blob;
28
29
  exports.readFileBlob = html.readFileBlob;
@@ -51,6 +52,7 @@ exports.requestFullScreen = fullScreen.requestFullScreen;
51
52
  exports.formatBytes = simpleMath.formatBytes;
52
53
  exports.genFibonacciSeq = simpleMath.genFibonacciSeq;
53
54
  exports.getAge = simpleMath.getAge;
55
+ exports.getPercentage = simpleMath.getPercentage;
54
56
  exports.getSimplePerc = simpleMath.getSimplePerc;
55
57
  exports.ruleOfThree = simpleMath.ruleOfThree;
56
58
  exports.addAiMarkerShortcut = text.addAiMarkerShortcut;
@@ -1,3 +1,4 @@
1
+ import { getPercentage } from './simpleMath.mjs';
1
2
  import { areElsCollTop } from './collision.mjs';
2
3
  import { areElsCollBottom } from './collision.mjs';
3
4
  import { areElsCollLeft } from './collision.mjs';
@@ -26,6 +27,7 @@ import { getHtmlElBordersWidth } from './html_deprecated.mjs';
26
27
  import { getHtmlElMargin } from './html_deprecated.mjs';
27
28
  import { getHtmlElPadding } from './html_deprecated.mjs';
28
29
  import { fetchJson } from './html.mjs';
30
+ import { fetchText } from './html.mjs';
29
31
  import { readJsonBlob } from './html.mjs';
30
32
  import { readFileBlob } from './html.mjs';
31
33
  import { readBase64Blob } from './html.mjs';
@@ -58,5 +60,5 @@ import { getTimeDuration } from './clock.mjs';
58
60
  import { shuffleArray } from './array.mjs';
59
61
  import { toTitleCase } from './text.mjs';
60
62
  import { toTitleCaseLowerFirst } from './text.mjs';
61
- export { areElsCollTop, areElsCollBottom, areElsCollLeft, areElsCollRight, areElsCollPerfTop, areElsCollPerfBottom, areElsCollPerfLeft, areElsCollPerfRight, areElsColliding, areElsPerfColliding, getElsColliding, getElsPerfColliding, getElsCollOverlap, getElsCollOverlapPos, getRectCenter, getElsRelativeCenterOffset, getElsCollDirDepth, getElsCollDetails, isInViewport, isScrolledIntoView, safeTextTrim, installWindowHiddenScript, genFibonacciSeq, getHtmlElBorders, getHtmlElBordersWidth, getHtmlElMargin, getHtmlElPadding, fetchJson, readJsonBlob, readFileBlob, readBase64Blob, saveJsonFile, documentIsFullScreen, isScreenFilled, requestFullScreen, exitFullScreen, isFullScreenMode, onFullScreenChange, offFullScreenChange, areHtmlElsColliding, isJsonObject, arraySortPositions, formatBytes, addAiMarkerShortcut, extendObjType, reorderObjTypeOrder, cloneObjTypeOrder, countObj, objType, ruleOfThree, getSimplePerc, asyncReplace, getAge, formatCustomTimer, formatDayTimer, formatTimer, getTimeDuration, shuffleArray, toTitleCase, toTitleCaseLowerFirst };
63
+ export { getPercentage, areElsCollTop, areElsCollBottom, areElsCollLeft, areElsCollRight, areElsCollPerfTop, areElsCollPerfBottom, areElsCollPerfLeft, areElsCollPerfRight, areElsColliding, areElsPerfColliding, getElsColliding, getElsPerfColliding, getElsCollOverlap, getElsCollOverlapPos, getRectCenter, getElsRelativeCenterOffset, getElsCollDirDepth, getElsCollDetails, isInViewport, isScrolledIntoView, safeTextTrim, installWindowHiddenScript, genFibonacciSeq, getHtmlElBorders, getHtmlElBordersWidth, getHtmlElMargin, getHtmlElPadding, fetchJson, fetchText, readJsonBlob, readFileBlob, readBase64Blob, saveJsonFile, documentIsFullScreen, isScreenFilled, requestFullScreen, exitFullScreen, isFullScreenMode, onFullScreenChange, offFullScreenChange, areHtmlElsColliding, isJsonObject, arraySortPositions, formatBytes, addAiMarkerShortcut, extendObjType, reorderObjTypeOrder, cloneObjTypeOrder, countObj, objType, ruleOfThree, getSimplePerc, asyncReplace, getAge, formatCustomTimer, formatDayTimer, formatTimer, getTimeDuration, shuffleArray, toTitleCase, toTitleCaseLowerFirst };
62
64
  //# sourceMappingURL=index.d.mts.map
@@ -2,12 +2,12 @@ import arraySortPositions from '../../legacy/libs/arraySortPositions.mjs';
2
2
  import asyncReplace from '../../legacy/libs/replaceAsync.mjs';
3
3
  import { shuffleArray } from './array.mjs';
4
4
  import { formatCustomTimer, formatDayTimer, formatTimer, getTimeDuration } from './clock.mjs';
5
- import { readJsonBlob, saveJsonFile, fetchJson, installWindowHiddenScript, readFileBlob, readBase64Blob, } from './html.mjs';
5
+ import { readJsonBlob, saveJsonFile, fetchJson, installWindowHiddenScript, readFileBlob, readBase64Blob, fetchText, } from './html.mjs';
6
6
  import { areHtmlElsColliding, getHtmlElBorders, getHtmlElBordersWidth, getHtmlElMargin, getHtmlElPadding, isInViewport, isScrolledIntoView, } from './html_deprecated.mjs';
7
7
  import { extendObjType, reorderObjTypeOrder, cloneObjTypeOrder, objType } from './objFilter.mjs';
8
8
  import { countObj, isJsonObject } from './objChecker.mjs';
9
9
  import { documentIsFullScreen, isScreenFilled, requestFullScreen, exitFullScreen, isFullScreenMode, onFullScreenChange, offFullScreenChange, } from './fullScreen.mjs';
10
- import { formatBytes, genFibonacciSeq, getAge, getSimplePerc, ruleOfThree } from './simpleMath.mjs';
10
+ import { formatBytes, genFibonacciSeq, getAge, getPercentage, getSimplePerc, ruleOfThree } from './simpleMath.mjs';
11
11
  import { addAiMarkerShortcut, safeTextTrim, toTitleCase, toTitleCaseLowerFirst } from './text.mjs';
12
12
  import { areElsCollTop, areElsCollBottom, areElsCollLeft, areElsCollRight, areElsCollPerfTop, areElsCollPerfBottom, areElsCollPerfLeft, areElsCollPerfRight, areElsColliding, areElsPerfColliding, getElsColliding, getElsPerfColliding, getElsCollOverlap, getElsCollOverlapPos, getRectCenter, getElsRelativeCenterOffset, getElsCollDirDepth, getElsCollDetails, } from './collision.mjs';
13
- export { areElsCollTop, areElsCollBottom, areElsCollLeft, areElsCollRight, areElsCollPerfTop, areElsCollPerfBottom, areElsCollPerfLeft, areElsCollPerfRight, areElsColliding, areElsPerfColliding, getElsColliding, getElsPerfColliding, getElsCollOverlap, getElsCollOverlapPos, getRectCenter, getElsRelativeCenterOffset, getElsCollDirDepth, getElsCollDetails, isInViewport, isScrolledIntoView, safeTextTrim, installWindowHiddenScript, genFibonacciSeq, getHtmlElBorders, getHtmlElBordersWidth, getHtmlElMargin, getHtmlElPadding, fetchJson, readJsonBlob, readFileBlob, readBase64Blob, saveJsonFile, documentIsFullScreen, isScreenFilled, requestFullScreen, exitFullScreen, isFullScreenMode, onFullScreenChange, offFullScreenChange, areHtmlElsColliding, isJsonObject, arraySortPositions, formatBytes, addAiMarkerShortcut, extendObjType, reorderObjTypeOrder, cloneObjTypeOrder, countObj, objType, ruleOfThree, getSimplePerc, asyncReplace, getAge, formatCustomTimer, formatDayTimer, formatTimer, getTimeDuration, shuffleArray, toTitleCase, toTitleCaseLowerFirst, };
13
+ export { getPercentage, areElsCollTop, areElsCollBottom, areElsCollLeft, areElsCollRight, areElsCollPerfTop, areElsCollPerfBottom, areElsCollPerfLeft, areElsCollPerfRight, areElsColliding, areElsPerfColliding, getElsColliding, getElsPerfColliding, getElsCollOverlap, getElsCollOverlapPos, getRectCenter, getElsRelativeCenterOffset, getElsCollDirDepth, getElsCollDetails, isInViewport, isScrolledIntoView, safeTextTrim, installWindowHiddenScript, genFibonacciSeq, getHtmlElBorders, getHtmlElBordersWidth, getHtmlElMargin, getHtmlElPadding, fetchJson, fetchText, readJsonBlob, readFileBlob, readBase64Blob, saveJsonFile, documentIsFullScreen, isScreenFilled, requestFullScreen, exitFullScreen, isFullScreenMode, onFullScreenChange, offFullScreenChange, areHtmlElsColliding, isJsonObject, arraySortPositions, formatBytes, addAiMarkerShortcut, extendObjType, reorderObjTypeOrder, cloneObjTypeOrder, countObj, objType, ruleOfThree, getSimplePerc, asyncReplace, getAge, formatCustomTimer, formatDayTimer, formatTimer, getTimeDuration, shuffleArray, toTitleCase, toTitleCaseLowerFirst, };
@@ -40,10 +40,13 @@ function ruleOfThree(val1, val2, val3, inverse = false) {
40
40
  }
41
41
 
42
42
  /**
43
- * Calculates a percentage of a given base value.
44
- * @param {number} price - The base value.
45
- * @param {number} percentage - The percentage to apply.
46
- * @returns {number} The result of the percentage calculation.
43
+ * Calculates the actual value that corresponds to a percentage of a base number.
44
+ * Unlike `getPercentage`, which tells how much something represents in percent,
45
+ * this function tells how much a given percentage *is worth* in value.
46
+ *
47
+ * @param {number} price - The base number to apply the percentage to.
48
+ * @param {number} percentage - The percentage to calculate from the base.
49
+ * @returns {number} The resulting value of the percentage.
47
50
  *
48
51
  * @example
49
52
  * getSimplePerc(200, 15); // 30
@@ -52,6 +55,21 @@ function getSimplePerc(price, percentage) {
52
55
  return price * (percentage / 100);
53
56
  }
54
57
 
58
+ /**
59
+ * Calculates how much percent a partial value represents of the total value.
60
+ *
61
+ * @param {number} part - The partial value to compare.
62
+ * @param {number} total - The total or maximum value.
63
+ * @returns {number} The percentage that 'part' represents of 'total'.
64
+ *
65
+ * @example
66
+ * getPercentage(5, 100); // 5
67
+ */
68
+ function getPercentage(part, total) {
69
+ if (total === 0) return 0;
70
+ return (part / total) * 100;
71
+ }
72
+
55
73
  /**
56
74
  * Calculates the age based on the given date.
57
75
  *
@@ -166,5 +184,6 @@ function genFibonacciSeq({
166
184
  exports.formatBytes = formatBytes;
167
185
  exports.genFibonacciSeq = genFibonacciSeq;
168
186
  exports.getAge = getAge;
187
+ exports.getPercentage = getPercentage;
169
188
  exports.getSimplePerc = getSimplePerc;
170
189
  exports.ruleOfThree = ruleOfThree;
@@ -35,15 +35,29 @@
35
35
  */
36
36
  export function ruleOfThree(val1: number, val2: number, val3: number, inverse?: boolean): number;
37
37
  /**
38
- * Calculates a percentage of a given base value.
39
- * @param {number} price - The base value.
40
- * @param {number} percentage - The percentage to apply.
41
- * @returns {number} The result of the percentage calculation.
38
+ * Calculates the actual value that corresponds to a percentage of a base number.
39
+ * Unlike `getPercentage`, which tells how much something represents in percent,
40
+ * this function tells how much a given percentage *is worth* in value.
41
+ *
42
+ * @param {number} price - The base number to apply the percentage to.
43
+ * @param {number} percentage - The percentage to calculate from the base.
44
+ * @returns {number} The resulting value of the percentage.
42
45
  *
43
46
  * @example
44
47
  * getSimplePerc(200, 15); // 30
45
48
  */
46
49
  export function getSimplePerc(price: number, percentage: number): number;
50
+ /**
51
+ * Calculates how much percent a partial value represents of the total value.
52
+ *
53
+ * @param {number} part - The partial value to compare.
54
+ * @param {number} total - The total or maximum value.
55
+ * @returns {number} The percentage that 'part' represents of 'total'.
56
+ *
57
+ * @example
58
+ * getPercentage(5, 100); // 5
59
+ */
60
+ export function getPercentage(part: number, total: number): number;
47
61
  /**
48
62
  * Calculates the age based on the given date.
49
63
  *
@@ -37,10 +37,13 @@ export function ruleOfThree(val1, val2, val3, inverse = false) {
37
37
  return inverse ? Number(val1 * val2) / val3 : Number(val3 * val2) / val1;
38
38
  }
39
39
  /**
40
- * Calculates a percentage of a given base value.
41
- * @param {number} price - The base value.
42
- * @param {number} percentage - The percentage to apply.
43
- * @returns {number} The result of the percentage calculation.
40
+ * Calculates the actual value that corresponds to a percentage of a base number.
41
+ * Unlike `getPercentage`, which tells how much something represents in percent,
42
+ * this function tells how much a given percentage *is worth* in value.
43
+ *
44
+ * @param {number} price - The base number to apply the percentage to.
45
+ * @param {number} percentage - The percentage to calculate from the base.
46
+ * @returns {number} The resulting value of the percentage.
44
47
  *
45
48
  * @example
46
49
  * getSimplePerc(200, 15); // 30
@@ -48,6 +51,21 @@ export function ruleOfThree(val1, val2, val3, inverse = false) {
48
51
  export function getSimplePerc(price, percentage) {
49
52
  return price * (percentage / 100);
50
53
  }
54
+ /**
55
+ * Calculates how much percent a partial value represents of the total value.
56
+ *
57
+ * @param {number} part - The partial value to compare.
58
+ * @param {number} total - The total or maximum value.
59
+ * @returns {number} The percentage that 'part' represents of 'total'.
60
+ *
61
+ * @example
62
+ * getPercentage(5, 100); // 5
63
+ */
64
+ export function getPercentage(part, total) {
65
+ if (total === 0)
66
+ return 0;
67
+ return (part / total) * 100;
68
+ }
51
69
  /**
52
70
  * Calculates the age based on the given date.
53
71
  *
package/dist/v1/index.cjs CHANGED
@@ -64,6 +64,7 @@ exports.requestFullScreen = fullScreen.requestFullScreen;
64
64
  exports.formatBytes = simpleMath.formatBytes;
65
65
  exports.genFibonacciSeq = simpleMath.genFibonacciSeq;
66
66
  exports.getAge = simpleMath.getAge;
67
+ exports.getPercentage = simpleMath.getPercentage;
67
68
  exports.getSimplePerc = simpleMath.getSimplePerc;
68
69
  exports.ruleOfThree = simpleMath.ruleOfThree;
69
70
  exports.addAiMarkerShortcut = text.addAiMarkerShortcut;
@@ -76,6 +77,7 @@ exports.TinyRateLimiter = TinyRateLimiter;
76
77
  exports.TinyNotifyCenter = TinyNotifyCenter;
77
78
  exports.TinyToastNotify = TinyToastNotify;
78
79
  exports.fetchJson = html.fetchJson;
80
+ exports.fetchText = html.fetchText;
79
81
  exports.installWindowHiddenScript = html.installWindowHiddenScript;
80
82
  exports.readBase64Blob = html.readBase64Blob;
81
83
  exports.readFileBlob = html.readFileBlob;
@@ -20,6 +20,7 @@ import TinyRateLimiter from './libs/TinyRateLimiter.mjs';
20
20
  import ColorSafeStringify from './libs/ColorSafeStringify.mjs';
21
21
  import TinyPromiseQueue from './libs/TinyPromiseQueue.mjs';
22
22
  import TinyLevelUp from '../legacy/libs/userLevel.mjs';
23
+ import { getPercentage } from './basics/simpleMath.mjs';
23
24
  import { areElsCollTop } from './basics/collision.mjs';
24
25
  import { areElsCollBottom } from './basics/collision.mjs';
25
26
  import { areElsCollLeft } from './basics/collision.mjs';
@@ -54,6 +55,7 @@ import { getHtmlElMargin } from './basics/html_deprecated.mjs';
54
55
  import { getHtmlElPadding } from './basics/html_deprecated.mjs';
55
56
  import { getLatestBackupPath } from './fileManager/normalFuncs.mjs';
56
57
  import { fetchJson } from './basics/html.mjs';
58
+ import { fetchText } from './basics/html.mjs';
57
59
  import { readJsonBlob } from './basics/html.mjs';
58
60
  import { readFileBlob } from './basics/html.mjs';
59
61
  import { readBase64Blob } from './basics/html.mjs';
@@ -109,5 +111,5 @@ import { getTimeDuration } from './basics/clock.mjs';
109
111
  import { shuffleArray } from './basics/array.mjs';
110
112
  import { toTitleCase } from './basics/text.mjs';
111
113
  import { toTitleCaseLowerFirst } from './basics/text.mjs';
112
- export { TinyNewWinEvents, TinyIframeEvents, TinyLocalStorage, TinyEvents, TinyTimeout, TinyColorConverter, TinyClipboard, TinyTextRangeEditor, TinySmartScroller, UltraRandomMsgGen, TinyAfterScrollWatcher, TinyHtml, TinyNotifications, TinyDomReadyManager, TinyDragger, TinyDragDropDetector, TinyToastNotify, TinyNotifyCenter, TinyRateLimiter, ColorSafeStringify, TinyPromiseQueue, TinyLevelUp, areElsCollTop, areElsCollBottom, areElsCollLeft, areElsCollRight, areElsCollPerfTop, areElsCollPerfBottom, areElsCollPerfLeft, areElsCollPerfRight, areElsColliding, areElsPerfColliding, getElsColliding, getElsPerfColliding, getElsCollOverlap, getElsCollOverlapPos, getRectCenter, getElsRelativeCenterOffset, getElsCollDirDepth, getElsCollDetails, isInViewport, isScrolledIntoView, safeTextTrim, installWindowHiddenScript, genFibonacciSeq, isDirEmptyAsync, fileSizeAsync, dirSizeAsync, listFilesAsync, listDirsAsync, getHtmlElBorders, getHtmlElBordersWidth, getHtmlElMargin, getHtmlElPadding, getLatestBackupPath, fetchJson, readJsonBlob, readFileBlob, readBase64Blob, saveJsonFile, readJsonFile, writeJsonFile, ensureDirectory, clearDirectoryAsync, clearDirectory, fileExists, dirExists, isDirEmpty, ensureCopyFile, tryDeleteFile, writeTextFile, listFiles, listDirs, fileSize, dirSize, backupFile, restoreLatestBackup, renameFileBatch, renameFileRegex, renameFileAddPrefixSuffix, renameFileNormalizeCase, renameFilePadNumbers, documentIsFullScreen, isScreenFilled, requestFullScreen, exitFullScreen, isFullScreenMode, onFullScreenChange, offFullScreenChange, areHtmlElsColliding, isJsonObject, arraySortPositions, formatBytes, addAiMarkerShortcut, extendObjType, reorderObjTypeOrder, cloneObjTypeOrder, countObj, checkObj, objType, ruleOfThree, getSimplePerc, asyncReplace, getAge, formatCustomTimer, formatDayTimer, formatTimer, getTimeDuration, shuffleArray, toTitleCase, toTitleCaseLowerFirst };
114
+ export { TinyNewWinEvents, TinyIframeEvents, TinyLocalStorage, TinyEvents, TinyTimeout, TinyColorConverter, TinyClipboard, TinyTextRangeEditor, TinySmartScroller, UltraRandomMsgGen, TinyAfterScrollWatcher, TinyHtml, TinyNotifications, TinyDomReadyManager, TinyDragger, TinyDragDropDetector, TinyToastNotify, TinyNotifyCenter, TinyRateLimiter, ColorSafeStringify, TinyPromiseQueue, TinyLevelUp, getPercentage, areElsCollTop, areElsCollBottom, areElsCollLeft, areElsCollRight, areElsCollPerfTop, areElsCollPerfBottom, areElsCollPerfLeft, areElsCollPerfRight, areElsColliding, areElsPerfColliding, getElsColliding, getElsPerfColliding, getElsCollOverlap, getElsCollOverlapPos, getRectCenter, getElsRelativeCenterOffset, getElsCollDirDepth, getElsCollDetails, isInViewport, isScrolledIntoView, safeTextTrim, installWindowHiddenScript, genFibonacciSeq, isDirEmptyAsync, fileSizeAsync, dirSizeAsync, listFilesAsync, listDirsAsync, getHtmlElBorders, getHtmlElBordersWidth, getHtmlElMargin, getHtmlElPadding, getLatestBackupPath, fetchJson, fetchText, readJsonBlob, readFileBlob, readBase64Blob, saveJsonFile, readJsonFile, writeJsonFile, ensureDirectory, clearDirectoryAsync, clearDirectory, fileExists, dirExists, isDirEmpty, ensureCopyFile, tryDeleteFile, writeTextFile, listFiles, listDirs, fileSize, dirSize, backupFile, restoreLatestBackup, renameFileBatch, renameFileRegex, renameFileAddPrefixSuffix, renameFileNormalizeCase, renameFilePadNumbers, documentIsFullScreen, isScreenFilled, requestFullScreen, exitFullScreen, isFullScreenMode, onFullScreenChange, offFullScreenChange, areHtmlElsColliding, isJsonObject, arraySortPositions, formatBytes, addAiMarkerShortcut, extendObjType, reorderObjTypeOrder, cloneObjTypeOrder, countObj, checkObj, objType, ruleOfThree, getSimplePerc, asyncReplace, getAge, formatCustomTimer, formatDayTimer, formatTimer, getTimeDuration, shuffleArray, toTitleCase, toTitleCaseLowerFirst };
113
115
  //# sourceMappingURL=index.d.mts.map
package/dist/v1/index.mjs CHANGED
@@ -6,14 +6,14 @@ import { formatCustomTimer, formatDayTimer, formatTimer, getTimeDuration, } from
6
6
  import { extendObjType, reorderObjTypeOrder, cloneObjTypeOrder, objType, checkObj, } from './basics/objFilter.mjs';
7
7
  import { countObj, isJsonObject } from './basics/objChecker.mjs';
8
8
  import { documentIsFullScreen, isScreenFilled, requestFullScreen, exitFullScreen, isFullScreenMode, onFullScreenChange, offFullScreenChange, } from './basics/fullScreen.mjs';
9
- import { formatBytes, genFibonacciSeq, getAge, getSimplePerc, ruleOfThree, } from './basics/simpleMath.mjs';
9
+ import { formatBytes, genFibonacciSeq, getAge, getPercentage, getSimplePerc, ruleOfThree, } from './basics/simpleMath.mjs';
10
10
  import { addAiMarkerShortcut, safeTextTrim, toTitleCase, toTitleCaseLowerFirst, } from './basics/text.mjs';
11
11
  import ColorSafeStringify from './libs/ColorSafeStringify.mjs';
12
12
  import TinyPromiseQueue from './libs/TinyPromiseQueue.mjs';
13
13
  import TinyRateLimiter from './libs/TinyRateLimiter.mjs';
14
14
  import TinyNotifyCenter from './libs/TinyNotifyCenter.mjs';
15
15
  import TinyToastNotify from './libs/TinyToastNotify.mjs';
16
- import { readJsonBlob, saveJsonFile, fetchJson, installWindowHiddenScript, readFileBlob, readBase64Blob, } from './basics/html.mjs';
16
+ import { readJsonBlob, saveJsonFile, fetchJson, installWindowHiddenScript, readFileBlob, readBase64Blob, fetchText, } from './basics/html.mjs';
17
17
  import { getHtmlElBorders, getHtmlElBordersWidth, getHtmlElMargin, getHtmlElPadding, areHtmlElsColliding, isInViewport, isScrolledIntoView, } from './basics/html_deprecated.mjs';
18
18
  import TinyDragDropDetector from './libs/TinyDragDropDetector.mjs';
19
19
  import { readJsonFile, writeJsonFile, ensureDirectory, clearDirectory, fileExists, dirExists, isDirEmpty, ensureCopyFile, tryDeleteFile, writeTextFile, listFiles, listDirs, fileSize, dirSize, backupFile, restoreLatestBackup, renameFileBatch, renameFileRegex, renameFileAddPrefixSuffix, renameFileNormalizeCase, renameFilePadNumbers, getLatestBackupPath, } from './fileManager/normalFuncs.mjs';
@@ -34,4 +34,4 @@ import TinyEvents from './libs/TinyEvents.mjs';
34
34
  import TinyLocalStorage from './libs/TinyLocalStorage.mjs';
35
35
  import TinyIframeEvents from './libs/TinyIframeEvents.mjs';
36
36
  import TinyNewWinEvents from './libs/TinyNewWinEvents.mjs';
37
- export { TinyNewWinEvents, TinyIframeEvents, TinyLocalStorage, TinyEvents, TinyTimeout, TinyColorConverter, TinyClipboard, TinyTextRangeEditor, TinySmartScroller, UltraRandomMsgGen, TinyAfterScrollWatcher, TinyHtml, TinyNotifications, TinyDomReadyManager, TinyDragger, TinyDragDropDetector, TinyToastNotify, TinyNotifyCenter, TinyRateLimiter, ColorSafeStringify, TinyPromiseQueue, TinyLevelUp, areElsCollTop, areElsCollBottom, areElsCollLeft, areElsCollRight, areElsCollPerfTop, areElsCollPerfBottom, areElsCollPerfLeft, areElsCollPerfRight, areElsColliding, areElsPerfColliding, getElsColliding, getElsPerfColliding, getElsCollOverlap, getElsCollOverlapPos, getRectCenter, getElsRelativeCenterOffset, getElsCollDirDepth, getElsCollDetails, isInViewport, isScrolledIntoView, safeTextTrim, installWindowHiddenScript, genFibonacciSeq, isDirEmptyAsync, fileSizeAsync, dirSizeAsync, listFilesAsync, listDirsAsync, getHtmlElBorders, getHtmlElBordersWidth, getHtmlElMargin, getHtmlElPadding, getLatestBackupPath, fetchJson, readJsonBlob, readFileBlob, readBase64Blob, saveJsonFile, readJsonFile, writeJsonFile, ensureDirectory, clearDirectoryAsync, clearDirectory, fileExists, dirExists, isDirEmpty, ensureCopyFile, tryDeleteFile, writeTextFile, listFiles, listDirs, fileSize, dirSize, backupFile, restoreLatestBackup, renameFileBatch, renameFileRegex, renameFileAddPrefixSuffix, renameFileNormalizeCase, renameFilePadNumbers, documentIsFullScreen, isScreenFilled, requestFullScreen, exitFullScreen, isFullScreenMode, onFullScreenChange, offFullScreenChange, areHtmlElsColliding, isJsonObject, arraySortPositions, formatBytes, addAiMarkerShortcut, extendObjType, reorderObjTypeOrder, cloneObjTypeOrder, countObj, checkObj, objType, ruleOfThree, getSimplePerc, asyncReplace, getAge, formatCustomTimer, formatDayTimer, formatTimer, getTimeDuration, shuffleArray, toTitleCase, toTitleCaseLowerFirst, };
37
+ export { TinyNewWinEvents, TinyIframeEvents, TinyLocalStorage, TinyEvents, TinyTimeout, TinyColorConverter, TinyClipboard, TinyTextRangeEditor, TinySmartScroller, UltraRandomMsgGen, TinyAfterScrollWatcher, TinyHtml, TinyNotifications, TinyDomReadyManager, TinyDragger, TinyDragDropDetector, TinyToastNotify, TinyNotifyCenter, TinyRateLimiter, ColorSafeStringify, TinyPromiseQueue, TinyLevelUp, getPercentage, areElsCollTop, areElsCollBottom, areElsCollLeft, areElsCollRight, areElsCollPerfTop, areElsCollPerfBottom, areElsCollPerfLeft, areElsCollPerfRight, areElsColliding, areElsPerfColliding, getElsColliding, getElsPerfColliding, getElsCollOverlap, getElsCollOverlapPos, getRectCenter, getElsRelativeCenterOffset, getElsCollDirDepth, getElsCollDetails, isInViewport, isScrolledIntoView, safeTextTrim, installWindowHiddenScript, genFibonacciSeq, isDirEmptyAsync, fileSizeAsync, dirSizeAsync, listFilesAsync, listDirsAsync, getHtmlElBorders, getHtmlElBordersWidth, getHtmlElMargin, getHtmlElPadding, getLatestBackupPath, fetchJson, fetchText, readJsonBlob, readFileBlob, readBase64Blob, saveJsonFile, readJsonFile, writeJsonFile, ensureDirectory, clearDirectoryAsync, clearDirectory, fileExists, dirExists, isDirEmpty, ensureCopyFile, tryDeleteFile, writeTextFile, listFiles, listDirs, fileSize, dirSize, backupFile, restoreLatestBackup, renameFileBatch, renameFileRegex, renameFileAddPrefixSuffix, renameFileNormalizeCase, renameFilePadNumbers, documentIsFullScreen, isScreenFilled, requestFullScreen, exitFullScreen, isFullScreenMode, onFullScreenChange, offFullScreenChange, areHtmlElsColliding, isJsonObject, arraySortPositions, formatBytes, addAiMarkerShortcut, extendObjType, reorderObjTypeOrder, cloneObjTypeOrder, countObj, checkObj, objType, ruleOfThree, getSimplePerc, asyncReplace, getAge, formatCustomTimer, formatDayTimer, formatTimer, getTimeDuration, shuffleArray, toTitleCase, toTitleCaseLowerFirst, };
@@ -83,7 +83,7 @@ class TinyDragger {
83
83
  * @throws {Error} If any option has an invalid type.
84
84
  */
85
85
  constructor(targetElement, options = {}) {
86
- const targetElem = !(targetElement instanceof TinyHtml) ? targetElement : targetElement.get();
86
+ const targetElem = !(targetElement instanceof TinyHtml) ? targetElement : targetElement.get(0);
87
87
  if (!(targetElem instanceof HTMLElement))
88
88
  throw new Error('TinyDragger requires a valid target HTMLElement to initialize.');
89
89
 
@@ -67,7 +67,7 @@ class TinyDragger {
67
67
  * @throws {Error} If any option has an invalid type.
68
68
  */
69
69
  constructor(targetElement, options = {}) {
70
- const targetElem = !(targetElement instanceof TinyHtml) ? targetElement : targetElement.get();
70
+ const targetElem = !(targetElement instanceof TinyHtml) ? targetElement : targetElement.get(0);
71
71
  if (!(targetElem instanceof HTMLElement))
72
72
  throw new Error('TinyDragger requires a valid target HTMLElement to initialize.');
73
73
  this.#target = targetElem;