tiny-essentials 1.21.9 → 1.22.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.vscode/extensions.json +30 -0
- package/.vscode/settings.json +53 -0
- package/LICENSE +160 -669
- package/dist/v1/TinyBasicsEs.min.js +1 -1
- package/dist/v1/TinyDragger.min.js +1 -1
- package/dist/v1/TinyElementObserver.min.js +1 -0
- package/dist/v1/TinyEssentials.min.js +1 -1
- package/dist/v1/TinyHtml.min.js +1 -1
- package/dist/v1/TinySmartScroller.min.js +1 -1
- package/dist/v1/TinyUploadClicker.min.js +1 -1
- package/dist/v1/basics/array.cjs +12 -0
- package/dist/v1/basics/array.d.mts +9 -0
- package/dist/v1/basics/array.mjs +10 -0
- 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/text.cjs +44 -9
- package/dist/v1/basics/text.d.mts +14 -2
- package/dist/v1/basics/text.mjs +38 -9
- package/dist/v1/build/TinyElementObserver.cjs +7 -0
- package/dist/v1/build/TinyElementObserver.d.mts +3 -0
- package/dist/v1/build/TinyElementObserver.mjs +2 -0
- package/dist/v1/index.cjs +4 -0
- package/dist/v1/index.d.mts +4 -1
- package/dist/v1/index.mjs +4 -3
- package/dist/v1/libs/TinyElementObserver.cjs +292 -0
- package/dist/v1/libs/TinyElementObserver.d.mts +154 -0
- package/dist/v1/libs/TinyElementObserver.mjs +266 -0
- package/dist/v1/libs/TinyGamepad.d.mts +1 -1
- package/dist/v1/libs/TinyHtml.cjs +1489 -173
- package/dist/v1/libs/TinyHtml.d.mts +543 -42
- package/dist/v1/libs/TinyHtml.mjs +1200 -61
- package/dist/v1/libs/TinyInventory.d.mts +1 -1
- package/dist/v1/libs/UltraRandomMsgGen.d.mts +7 -7
- package/docs/v1/README.md +9 -0
- package/docs/v1/Regex-Helpers.md +72 -0
- package/docs/v1/basics/array.md +20 -0
- package/docs/v1/basics/text.md +38 -7
- package/docs/v1/libs/TinyElementObserver.md +107 -0
- package/docs/v1/libs/TinyHtml.md +803 -8
- package/package.json +2 -2
package/dist/v1/basics/array.cjs
CHANGED
|
@@ -48,5 +48,17 @@ function multiplyArrayBlocks(phases, counts) {
|
|
|
48
48
|
return result;
|
|
49
49
|
}
|
|
50
50
|
|
|
51
|
+
/**
|
|
52
|
+
* Diff two class lists.
|
|
53
|
+
* @param {any[]} oldItems
|
|
54
|
+
* @param {any[]} newItems
|
|
55
|
+
*/
|
|
56
|
+
function diffArrayList(oldItems, newItems) {
|
|
57
|
+
const removed = oldItems.filter((c) => !newItems.includes(c));
|
|
58
|
+
const added = newItems.filter((c) => !oldItems.includes(c));
|
|
59
|
+
return { added, removed };
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
exports.diffArrayList = diffArrayList;
|
|
51
63
|
exports.multiplyArrayBlocks = multiplyArrayBlocks;
|
|
52
64
|
exports.shuffleArray = shuffleArray;
|
|
@@ -16,4 +16,13 @@ export function shuffleArray(items: any[]): any[];
|
|
|
16
16
|
* @returns {string[]} - Flattened array containing phases repeated according to counts, concatenated in order.
|
|
17
17
|
*/
|
|
18
18
|
export function multiplyArrayBlocks(phases: string[], counts: number[]): string[];
|
|
19
|
+
/**
|
|
20
|
+
* Diff two class lists.
|
|
21
|
+
* @param {any[]} oldItems
|
|
22
|
+
* @param {any[]} newItems
|
|
23
|
+
*/
|
|
24
|
+
export function diffArrayList(oldItems: any[], newItems: any[]): {
|
|
25
|
+
added: any[];
|
|
26
|
+
removed: any[];
|
|
27
|
+
};
|
|
19
28
|
//# sourceMappingURL=array.d.mts.map
|
package/dist/v1/basics/array.mjs
CHANGED
|
@@ -38,3 +38,13 @@ export function multiplyArrayBlocks(phases, counts) {
|
|
|
38
38
|
}
|
|
39
39
|
return result;
|
|
40
40
|
}
|
|
41
|
+
/**
|
|
42
|
+
* Diff two class lists.
|
|
43
|
+
* @param {any[]} oldItems
|
|
44
|
+
* @param {any[]} newItems
|
|
45
|
+
*/
|
|
46
|
+
export function diffArrayList(oldItems, newItems) {
|
|
47
|
+
const removed = oldItems.filter((c) => !newItems.includes(c));
|
|
48
|
+
const added = newItems.filter((c) => !oldItems.includes(c));
|
|
49
|
+
return { added, removed };
|
|
50
|
+
}
|
package/dist/v1/basics/index.cjs
CHANGED
|
@@ -16,6 +16,7 @@ var collision = require('./collision.cjs');
|
|
|
16
16
|
|
|
17
17
|
exports.arraySortPositions = arraySortPositions;
|
|
18
18
|
exports.asyncReplace = replaceAsync;
|
|
19
|
+
exports.diffArrayList = array.diffArrayList;
|
|
19
20
|
exports.shuffleArray = array.shuffleArray;
|
|
20
21
|
exports.breakdownDuration = clock.breakdownDuration;
|
|
21
22
|
exports.formatCustomTimer = clock.formatCustomTimer;
|
|
@@ -51,6 +52,7 @@ exports.getPercentage = simpleMath.getPercentage;
|
|
|
51
52
|
exports.getSimplePerc = simpleMath.getSimplePerc;
|
|
52
53
|
exports.ruleOfThree = simpleMath.ruleOfThree;
|
|
53
54
|
exports.addAiMarkerShortcut = text.addAiMarkerShortcut;
|
|
55
|
+
exports.diffStrings = text.diffStrings;
|
|
54
56
|
exports.safeTextTrim = text.safeTextTrim;
|
|
55
57
|
exports.toTitleCase = text.toTitleCase;
|
|
56
58
|
exports.toTitleCaseLowerFirst = text.toTitleCaseLowerFirst;
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { diffStrings } from './text.mjs';
|
|
2
|
+
import { diffArrayList } from './array.mjs';
|
|
1
3
|
import { breakdownDuration } from './clock.mjs';
|
|
2
4
|
import { calculateMarketcap } from './simpleMath.mjs';
|
|
3
5
|
import { compareMarketcap } from './simpleMath.mjs';
|
|
@@ -56,5 +58,5 @@ import { getTimeDuration } from './clock.mjs';
|
|
|
56
58
|
import { shuffleArray } from './array.mjs';
|
|
57
59
|
import { toTitleCase } from './text.mjs';
|
|
58
60
|
import { toTitleCaseLowerFirst } from './text.mjs';
|
|
59
|
-
export { 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 };
|
|
61
|
+
export { 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 };
|
|
60
62
|
//# sourceMappingURL=index.d.mts.map
|
package/dist/v1/basics/index.mjs
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import arraySortPositions from '../../legacy/libs/arraySortPositions.mjs';
|
|
2
2
|
import asyncReplace from '../../legacy/libs/replaceAsync.mjs';
|
|
3
|
-
import { shuffleArray } from './array.mjs';
|
|
3
|
+
import { diffArrayList, shuffleArray } from './array.mjs';
|
|
4
4
|
import { breakdownDuration, formatCustomTimer, formatDayTimer, formatTimer, getTimeDuration, } from './clock.mjs';
|
|
5
5
|
import { readJsonBlob, saveJsonFile, fetchJson, installWindowHiddenScript, readFileBlob, readBase64Blob, fetchText, } from './html.mjs';
|
|
6
6
|
import { extendObjType, reorderObjTypeOrder, cloneObjTypeOrder, objType } from './objFilter.mjs';
|
|
7
7
|
import { countObj, isJsonObject } from './objChecker.mjs';
|
|
8
8
|
import { documentIsFullScreen, isScreenFilled, requestFullScreen, exitFullScreen, isFullScreenMode, onFullScreenChange, offFullScreenChange, } from './fullScreen.mjs';
|
|
9
9
|
import { calculateMarketcap, compareMarketcap, formatBytes, genFibonacciSeq, getAge, getPercentage, getSimplePerc, ruleOfThree, } from './simpleMath.mjs';
|
|
10
|
-
import { addAiMarkerShortcut, safeTextTrim, toTitleCase, toTitleCaseLowerFirst } from './text.mjs';
|
|
10
|
+
import { addAiMarkerShortcut, diffStrings, safeTextTrim, toTitleCase, toTitleCaseLowerFirst } from './text.mjs';
|
|
11
11
|
import { areElsCollTop, areElsCollBottom, areElsCollLeft, areElsCollRight, areElsCollPerfTop, areElsCollPerfBottom, areElsCollPerfLeft, areElsCollPerfRight, areElsColliding, areElsPerfColliding, getElsColliding, getElsPerfColliding, getElsCollOverlap, getElsCollOverlapPos, getRectCenter, getElsRelativeCenterOffset, getElsCollDirDepth, getElsCollDetails, } from './collision.mjs';
|
|
12
|
-
export { 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, };
|
|
12
|
+
export { 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, };
|
package/dist/v1/basics/text.cjs
CHANGED
|
@@ -41,16 +41,19 @@ function toTitleCaseLowerFirst(str) {
|
|
|
41
41
|
* If executed outside of a browser environment (e.g., in Node.js), the function logs an error and exits.
|
|
42
42
|
* If the `<body>` is not available at the moment the shortcut is triggered, a warning is logged.
|
|
43
43
|
*
|
|
44
|
-
* @param {
|
|
44
|
+
* @param {Object} [config={}] - Configuration object.
|
|
45
|
+
* @param {string} [config.key='a'] - The lowercase character key to be used in combination with `Ctrl` and `Alt`.
|
|
46
|
+
* @param {string} [config.className='detect-made-by-ai'] - The CSS class to toggle on the `<body>` element.
|
|
47
|
+
* @returns {(this: Document, ev: KeyboardEvent) => any} The event handler attached to `document`.
|
|
45
48
|
*/
|
|
46
|
-
function addAiMarkerShortcut(key = 'a') {
|
|
47
|
-
if (typeof HTMLElement === 'undefined')
|
|
48
|
-
|
|
49
|
+
function addAiMarkerShortcut({ key = 'a', className = 'detect-made-by-ai' } = {}) {
|
|
50
|
+
if (typeof HTMLElement === 'undefined')
|
|
51
|
+
throw new Error(
|
|
49
52
|
'[AiMarkerShortcut] Environment does not support the DOM. This function must be run in a browser.',
|
|
50
53
|
);
|
|
51
|
-
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
+
|
|
55
|
+
/** @type {(this: Document, ev: KeyboardEvent) => any} */
|
|
56
|
+
const keydownEvent = function (event) {
|
|
54
57
|
if (event.ctrlKey && event.altKey && event.key.toLowerCase() === key) {
|
|
55
58
|
event.preventDefault(); // Prevent any default behavior
|
|
56
59
|
if (!document.body) {
|
|
@@ -59,9 +62,12 @@ function addAiMarkerShortcut(key = 'a') {
|
|
|
59
62
|
);
|
|
60
63
|
return;
|
|
61
64
|
}
|
|
62
|
-
document.body.classList.toggle(
|
|
65
|
+
document.body.classList.toggle(className);
|
|
63
66
|
}
|
|
64
|
-
}
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
document.addEventListener('keydown', keydownEvent);
|
|
70
|
+
return keydownEvent;
|
|
65
71
|
}
|
|
66
72
|
|
|
67
73
|
/**
|
|
@@ -106,6 +112,34 @@ function safeTextTrim(text, limit, safeCutZone = 0.6) {
|
|
|
106
112
|
return result;
|
|
107
113
|
}
|
|
108
114
|
|
|
115
|
+
/**
|
|
116
|
+
* Diff two string objects.
|
|
117
|
+
* @param {Record<string,string>} oldStrings
|
|
118
|
+
* @param {Record<string,string>} newStrings
|
|
119
|
+
*/
|
|
120
|
+
function diffStrings(oldStrings, newStrings) {
|
|
121
|
+
/** @type {Record<string,Record<string,string|Record<string,string>>>}} */
|
|
122
|
+
const changes = { added: {}, removed: {}, modified: {} };
|
|
123
|
+
|
|
124
|
+
// detect removed and modified
|
|
125
|
+
for (const prop in oldStrings) {
|
|
126
|
+
if (!(prop in newStrings)) {
|
|
127
|
+
changes.removed[prop] = oldStrings[prop];
|
|
128
|
+
} else if (oldStrings[prop] !== newStrings[prop]) {
|
|
129
|
+
changes.modified[prop] = { old: oldStrings[prop], new: newStrings[prop] };
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
// detect added
|
|
134
|
+
for (const prop in newStrings) {
|
|
135
|
+
if (!(prop in oldStrings)) {
|
|
136
|
+
changes.added[prop] = newStrings[prop];
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
return changes;
|
|
141
|
+
}
|
|
142
|
+
|
|
109
143
|
/*
|
|
110
144
|
import { useEffect } from "react";
|
|
111
145
|
|
|
@@ -131,6 +165,7 @@ export default KeyPressHandler;
|
|
|
131
165
|
*/
|
|
132
166
|
|
|
133
167
|
exports.addAiMarkerShortcut = addAiMarkerShortcut;
|
|
168
|
+
exports.diffStrings = diffStrings;
|
|
134
169
|
exports.safeTextTrim = safeTextTrim;
|
|
135
170
|
exports.toTitleCase = toTitleCase;
|
|
136
171
|
exports.toTitleCaseLowerFirst = toTitleCaseLowerFirst;
|
|
@@ -29,9 +29,15 @@ export function toTitleCaseLowerFirst(str: string): string;
|
|
|
29
29
|
* If executed outside of a browser environment (e.g., in Node.js), the function logs an error and exits.
|
|
30
30
|
* If the `<body>` is not available at the moment the shortcut is triggered, a warning is logged.
|
|
31
31
|
*
|
|
32
|
-
* @param {
|
|
32
|
+
* @param {Object} [config={}] - Configuration object.
|
|
33
|
+
* @param {string} [config.key='a'] - The lowercase character key to be used in combination with `Ctrl` and `Alt`.
|
|
34
|
+
* @param {string} [config.className='detect-made-by-ai'] - The CSS class to toggle on the `<body>` element.
|
|
35
|
+
* @returns {(this: Document, ev: KeyboardEvent) => any} The event handler attached to `document`.
|
|
33
36
|
*/
|
|
34
|
-
export function addAiMarkerShortcut(key?:
|
|
37
|
+
export function addAiMarkerShortcut({ key, className }?: {
|
|
38
|
+
key?: string | undefined;
|
|
39
|
+
className?: string | undefined;
|
|
40
|
+
}): (this: Document, ev: KeyboardEvent) => any;
|
|
35
41
|
/**
|
|
36
42
|
* Trims a text string to a specified character limit, attempting to avoid cutting words in half.
|
|
37
43
|
* If a space is found before the limit and it's not too far from the limit (at least 60%),
|
|
@@ -48,4 +54,10 @@ export function addAiMarkerShortcut(key?: string): void;
|
|
|
48
54
|
* @throws {TypeError} - Throws if `safeCutZone` is not a number between 0 and 1 (inclusive).
|
|
49
55
|
*/
|
|
50
56
|
export function safeTextTrim(text: string, limit: number, safeCutZone?: number): string;
|
|
57
|
+
/**
|
|
58
|
+
* Diff two string objects.
|
|
59
|
+
* @param {Record<string,string>} oldStrings
|
|
60
|
+
* @param {Record<string,string>} newStrings
|
|
61
|
+
*/
|
|
62
|
+
export function diffStrings(oldStrings: Record<string, string>, newStrings: Record<string, string>): Record<string, Record<string, string | Record<string, string>>>;
|
|
51
63
|
//# sourceMappingURL=text.d.mts.map
|
package/dist/v1/basics/text.mjs
CHANGED
|
@@ -34,23 +34,27 @@ export function toTitleCaseLowerFirst(str) {
|
|
|
34
34
|
* If executed outside of a browser environment (e.g., in Node.js), the function logs an error and exits.
|
|
35
35
|
* If the `<body>` is not available at the moment the shortcut is triggered, a warning is logged.
|
|
36
36
|
*
|
|
37
|
-
* @param {
|
|
37
|
+
* @param {Object} [config={}] - Configuration object.
|
|
38
|
+
* @param {string} [config.key='a'] - The lowercase character key to be used in combination with `Ctrl` and `Alt`.
|
|
39
|
+
* @param {string} [config.className='detect-made-by-ai'] - The CSS class to toggle on the `<body>` element.
|
|
40
|
+
* @returns {(this: Document, ev: KeyboardEvent) => any} The event handler attached to `document`.
|
|
38
41
|
*/
|
|
39
|
-
export function addAiMarkerShortcut(key = 'a') {
|
|
40
|
-
if (typeof HTMLElement === 'undefined')
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
document.addEventListener('keydown', function (event) {
|
|
42
|
+
export function addAiMarkerShortcut({ key = 'a', className = 'detect-made-by-ai' } = {}) {
|
|
43
|
+
if (typeof HTMLElement === 'undefined')
|
|
44
|
+
throw new Error('[AiMarkerShortcut] Environment does not support the DOM. This function must be run in a browser.');
|
|
45
|
+
/** @type {(this: Document, ev: KeyboardEvent) => any} */
|
|
46
|
+
const keydownEvent = function (event) {
|
|
45
47
|
if (event.ctrlKey && event.altKey && event.key.toLowerCase() === key) {
|
|
46
48
|
event.preventDefault(); // Prevent any default behavior
|
|
47
49
|
if (!document.body) {
|
|
48
50
|
console.warn('[AiMarkerShortcut] <body> element not found. Cannot toggle class. Ensure the DOM is fully loaded when using the shortcut.');
|
|
49
51
|
return;
|
|
50
52
|
}
|
|
51
|
-
document.body.classList.toggle(
|
|
53
|
+
document.body.classList.toggle(className);
|
|
52
54
|
}
|
|
53
|
-
}
|
|
55
|
+
};
|
|
56
|
+
document.addEventListener('keydown', keydownEvent);
|
|
57
|
+
return keydownEvent;
|
|
54
58
|
}
|
|
55
59
|
/**
|
|
56
60
|
* Trims a text string to a specified character limit, attempting to avoid cutting words in half.
|
|
@@ -89,6 +93,31 @@ export function safeTextTrim(text, limit, safeCutZone = 0.6) {
|
|
|
89
93
|
}
|
|
90
94
|
return result;
|
|
91
95
|
}
|
|
96
|
+
/**
|
|
97
|
+
* Diff two string objects.
|
|
98
|
+
* @param {Record<string,string>} oldStrings
|
|
99
|
+
* @param {Record<string,string>} newStrings
|
|
100
|
+
*/
|
|
101
|
+
export function diffStrings(oldStrings, newStrings) {
|
|
102
|
+
/** @type {Record<string,Record<string,string|Record<string,string>>>}} */
|
|
103
|
+
const changes = { added: {}, removed: {}, modified: {} };
|
|
104
|
+
// detect removed and modified
|
|
105
|
+
for (const prop in oldStrings) {
|
|
106
|
+
if (!(prop in newStrings)) {
|
|
107
|
+
changes.removed[prop] = oldStrings[prop];
|
|
108
|
+
}
|
|
109
|
+
else if (oldStrings[prop] !== newStrings[prop]) {
|
|
110
|
+
changes.modified[prop] = { old: oldStrings[prop], new: newStrings[prop] };
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
// detect added
|
|
114
|
+
for (const prop in newStrings) {
|
|
115
|
+
if (!(prop in oldStrings)) {
|
|
116
|
+
changes.added[prop] = newStrings[prop];
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
return changes;
|
|
120
|
+
}
|
|
92
121
|
/*
|
|
93
122
|
import { useEffect } from "react";
|
|
94
123
|
|
package/dist/v1/index.cjs
CHANGED
|
@@ -46,12 +46,14 @@ var TinyCookieConsent = require('./libs/TinyCookieConsent.cjs');
|
|
|
46
46
|
var TinyI18 = require('./libs/TinyI18.cjs');
|
|
47
47
|
var TinyNeedBar = require('./libs/TinyNeedBar.cjs');
|
|
48
48
|
var TinySimpleDice = require('./libs/TinySimpleDice.cjs');
|
|
49
|
+
var TinyElementObserver = require('./libs/TinyElementObserver.cjs');
|
|
49
50
|
|
|
50
51
|
|
|
51
52
|
|
|
52
53
|
exports.asyncReplace = replaceAsync;
|
|
53
54
|
exports.TinyLevelUp = userLevel;
|
|
54
55
|
exports.arraySortPositions = arraySortPositions;
|
|
56
|
+
exports.diffArrayList = array.diffArrayList;
|
|
55
57
|
exports.shuffleArray = array.shuffleArray;
|
|
56
58
|
exports.breakdownDuration = clock.breakdownDuration;
|
|
57
59
|
exports.formatCustomTimer = clock.formatCustomTimer;
|
|
@@ -81,6 +83,7 @@ exports.getPercentage = simpleMath.getPercentage;
|
|
|
81
83
|
exports.getSimplePerc = simpleMath.getSimplePerc;
|
|
82
84
|
exports.ruleOfThree = simpleMath.ruleOfThree;
|
|
83
85
|
exports.addAiMarkerShortcut = text.addAiMarkerShortcut;
|
|
86
|
+
exports.diffStrings = text.diffStrings;
|
|
84
87
|
exports.safeTextTrim = text.safeTextTrim;
|
|
85
88
|
exports.toTitleCase = text.toTitleCase;
|
|
86
89
|
exports.toTitleCaseLowerFirst = text.toTitleCaseLowerFirst;
|
|
@@ -169,3 +172,4 @@ exports.TinyCookieConsent = TinyCookieConsent;
|
|
|
169
172
|
exports.TinyI18 = TinyI18;
|
|
170
173
|
exports.TinyNeedBar = TinyNeedBar;
|
|
171
174
|
exports.TinySimpleDice = TinySimpleDice;
|
|
175
|
+
exports.TinyElementObserver = TinyElementObserver;
|
package/dist/v1/index.d.mts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import TinyElementObserver from './libs/TinyElementObserver.mjs';
|
|
1
2
|
import TinySimpleDice from './libs/TinySimpleDice.mjs';
|
|
2
3
|
import TinyNeedBar from './libs/TinyNeedBar.mjs';
|
|
3
4
|
import TinyI18 from './libs/TinyI18.mjs';
|
|
@@ -31,6 +32,8 @@ import TinyRateLimiter from './libs/TinyRateLimiter.mjs';
|
|
|
31
32
|
import ColorSafeStringify from './libs/ColorSafeStringify.mjs';
|
|
32
33
|
import TinyPromiseQueue from './libs/TinyPromiseQueue.mjs';
|
|
33
34
|
import TinyLevelUp from '../legacy/libs/userLevel.mjs';
|
|
35
|
+
import { diffArrayList } from './basics/array.mjs';
|
|
36
|
+
import { diffStrings } from './basics/text.mjs';
|
|
34
37
|
import { breakdownDuration } from './basics/clock.mjs';
|
|
35
38
|
import { calculateMarketcap } from './basics/simpleMath.mjs';
|
|
36
39
|
import { compareMarketcap } from './basics/simpleMath.mjs';
|
|
@@ -118,5 +121,5 @@ import { getTimeDuration } from './basics/clock.mjs';
|
|
|
118
121
|
import { shuffleArray } from './basics/array.mjs';
|
|
119
122
|
import { toTitleCase } from './basics/text.mjs';
|
|
120
123
|
import { toTitleCaseLowerFirst } from './basics/text.mjs';
|
|
121
|
-
export { TinySimpleDice, TinyNeedBar, TinyI18, TinyCookieConsent, TinyInventory, TinyInventoryTrader, TinyArrayPaginator, TinyAdvancedRaffle, TinyDayNightCycle, TinyGamepad, TinyTextarea, TinyNewWinEvents, TinyIframeEvents, TinyLocalStorage, TinyEvents, TinyTimeout, TinyColorConverter, TinyClipboard, TinyTextRangeEditor, TinySmartScroller, UltraRandomMsgGen, TinyAfterScrollWatcher, TinyHtml, TinyNotifications, TinyDomReadyManager, TinyDragger, TinyDragDropDetector, TinyToastNotify, TinyNotifyCenter, TinyRateLimiter, ColorSafeStringify, TinyPromiseQueue, TinyLevelUp, 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, isDirEmptyAsync, fileSizeAsync, dirSizeAsync, listFilesAsync, listDirsAsync, 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, isJsonObject, arraySortPositions, formatBytes, addAiMarkerShortcut, extendObjType, reorderObjTypeOrder, cloneObjTypeOrder, countObj, checkObj, objType, ruleOfThree, getSimplePerc, asyncReplace, getAge, formatCustomTimer, formatDayTimer, formatTimer, getTimeDuration, shuffleArray, toTitleCase, toTitleCaseLowerFirst };
|
|
124
|
+
export { TinyElementObserver, TinySimpleDice, TinyNeedBar, TinyI18, TinyCookieConsent, TinyInventory, TinyInventoryTrader, TinyArrayPaginator, TinyAdvancedRaffle, TinyDayNightCycle, TinyGamepad, TinyTextarea, TinyNewWinEvents, TinyIframeEvents, TinyLocalStorage, TinyEvents, TinyTimeout, TinyColorConverter, TinyClipboard, TinyTextRangeEditor, TinySmartScroller, UltraRandomMsgGen, TinyAfterScrollWatcher, TinyHtml, TinyNotifications, TinyDomReadyManager, TinyDragger, TinyDragDropDetector, TinyToastNotify, TinyNotifyCenter, TinyRateLimiter, ColorSafeStringify, TinyPromiseQueue, TinyLevelUp, diffArrayList, diffStrings, 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, isDirEmptyAsync, fileSizeAsync, dirSizeAsync, listFilesAsync, listDirsAsync, 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, isJsonObject, arraySortPositions, formatBytes, addAiMarkerShortcut, extendObjType, reorderObjTypeOrder, cloneObjTypeOrder, countObj, checkObj, objType, ruleOfThree, getSimplePerc, asyncReplace, getAge, formatCustomTimer, formatDayTimer, formatTimer, getTimeDuration, shuffleArray, toTitleCase, toTitleCaseLowerFirst };
|
|
122
125
|
//# sourceMappingURL=index.d.mts.map
|
package/dist/v1/index.mjs
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import asyncReplace from '../legacy/libs/replaceAsync.mjs';
|
|
2
2
|
import TinyLevelUp from '../legacy/libs/userLevel.mjs';
|
|
3
3
|
import arraySortPositions from '../legacy/libs/arraySortPositions.mjs';
|
|
4
|
-
import { shuffleArray } from './basics/array.mjs';
|
|
4
|
+
import { diffArrayList, shuffleArray } from './basics/array.mjs';
|
|
5
5
|
import { breakdownDuration, formatCustomTimer, formatDayTimer, formatTimer, getTimeDuration, } from './basics/clock.mjs';
|
|
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
9
|
import { calculateMarketcap, compareMarketcap, formatBytes, genFibonacciSeq, getAge, getPercentage, getSimplePerc, ruleOfThree, } from './basics/simpleMath.mjs';
|
|
10
|
-
import { addAiMarkerShortcut, safeTextTrim, toTitleCase, toTitleCaseLowerFirst, } from './basics/text.mjs';
|
|
10
|
+
import { addAiMarkerShortcut, diffStrings, 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';
|
|
@@ -44,4 +44,5 @@ import TinyCookieConsent from './libs/TinyCookieConsent.mjs';
|
|
|
44
44
|
import TinyI18 from './libs/TinyI18.mjs';
|
|
45
45
|
import TinyNeedBar from './libs/TinyNeedBar.mjs';
|
|
46
46
|
import TinySimpleDice from './libs/TinySimpleDice.mjs';
|
|
47
|
-
|
|
47
|
+
import TinyElementObserver from './libs/TinyElementObserver.mjs';
|
|
48
|
+
export { TinyElementObserver, TinySimpleDice, TinyNeedBar, TinyI18, TinyCookieConsent, TinyInventory, TinyInventoryTrader, TinyArrayPaginator, TinyAdvancedRaffle, TinyDayNightCycle, TinyGamepad, TinyTextarea, TinyNewWinEvents, TinyIframeEvents, TinyLocalStorage, TinyEvents, TinyTimeout, TinyColorConverter, TinyClipboard, TinyTextRangeEditor, TinySmartScroller, UltraRandomMsgGen, TinyAfterScrollWatcher, TinyHtml, TinyNotifications, TinyDomReadyManager, TinyDragger, TinyDragDropDetector, TinyToastNotify, TinyNotifyCenter, TinyRateLimiter, ColorSafeStringify, TinyPromiseQueue, TinyLevelUp, diffArrayList, diffStrings, 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, isDirEmptyAsync, fileSizeAsync, dirSizeAsync, listFilesAsync, listDirsAsync, 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, isJsonObject, arraySortPositions, formatBytes, addAiMarkerShortcut, extendObjType, reorderObjTypeOrder, cloneObjTypeOrder, countObj, checkObj, objType, ruleOfThree, getSimplePerc, asyncReplace, getAge, formatCustomTimer, formatDayTimer, formatTimer, getTimeDuration, shuffleArray, toTitleCase, toTitleCaseLowerFirst, };
|