tiny-essentials 1.22.7 → 1.22.9
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/changelog/1/22/{7.md → 8.md} +5 -1
- package/changelog/1/22/9.md +9 -0
- package/dist/v1/TinyDragger.min.js +1 -1
- 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/libs/TinyHtml.cjs +14 -12
- package/dist/v1/libs/TinyHtml.d.mts +6 -50
- package/dist/v1/libs/TinyHtml.mjs +15 -9
- package/package.json +1 -1
|
@@ -23,7 +23,13 @@ const {
|
|
|
23
23
|
/**
|
|
24
24
|
* Represents the valid values that can be appended to a TinyNode.
|
|
25
25
|
*
|
|
26
|
-
* @typedef {TinyNode | TinyNode[] | string | false | null | undefined}
|
|
26
|
+
* @typedef {TinyNode | TinyNode[] | string | false | null | undefined} AppendCheckerTemplate
|
|
27
|
+
*/
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Represents the the collection of values that can be appended to a TinyNode.
|
|
31
|
+
*
|
|
32
|
+
* @typedef {AppendCheckerTemplate|AppendCheckerTemplate[]} AppendCheckerValues
|
|
27
33
|
*/
|
|
28
34
|
|
|
29
35
|
/**
|
|
@@ -2152,18 +2158,14 @@ class TinyHtml {
|
|
|
2152
2158
|
* @readonly
|
|
2153
2159
|
*/
|
|
2154
2160
|
static _appendChecker(where, ...nodes) {
|
|
2161
|
+
/** @type {(string | Node)[]} */
|
|
2155
2162
|
const results = [];
|
|
2156
|
-
const
|
|
2157
|
-
|
|
2158
|
-
if (
|
|
2159
|
-
|
|
2160
|
-
|
|
2161
|
-
|
|
2162
|
-
)
|
|
2163
|
-
continue;
|
|
2164
|
-
if (typeof nds[index] !== 'string') {
|
|
2165
|
-
results.push(TinyHtml._preNodeElem(nds[index], where));
|
|
2166
|
-
} else results.push(nds[index]);
|
|
2163
|
+
for (const item of nodes) {
|
|
2164
|
+
if (typeof item === 'undefined' || item === null || item === false) continue;
|
|
2165
|
+
if (typeof item !== 'string') {
|
|
2166
|
+
if (!Array.isArray(item)) results.push(TinyHtml._preNodeElems(item, where)[0]);
|
|
2167
|
+
else results.push(...TinyHtml._appendChecker(where, ...item));
|
|
2168
|
+
} else results.push(item);
|
|
2167
2169
|
}
|
|
2168
2170
|
return results;
|
|
2169
2171
|
}
|
|
@@ -6,7 +6,11 @@ export type TinyHtmlAny = TinyHtml<ConstructorElValues>;
|
|
|
6
6
|
/**
|
|
7
7
|
* Represents the valid values that can be appended to a TinyNode.
|
|
8
8
|
*/
|
|
9
|
-
export type
|
|
9
|
+
export type AppendCheckerTemplate = TinyNode | TinyNode[] | string | false | null | undefined;
|
|
10
|
+
/**
|
|
11
|
+
* Represents the the collection of values that can be appended to a TinyNode.
|
|
12
|
+
*/
|
|
13
|
+
export type AppendCheckerValues = AppendCheckerTemplate | AppendCheckerTemplate[];
|
|
10
14
|
/**
|
|
11
15
|
* Callback function used for hover events.
|
|
12
16
|
*/
|
|
@@ -279,55 +283,7 @@ declare class TinyHtml<TinyHtmlT extends ConstructorElValues | ConstructorElValu
|
|
|
279
283
|
areElsCollPerfTop: (rect1: TinyCollision.ObjRect, rect2: TinyCollision.ObjRect) => boolean;
|
|
280
284
|
areElsCollPerfBottom: (rect1: TinyCollision.ObjRect, rect2: TinyCollision.ObjRect) => boolean;
|
|
281
285
|
areElsCollPerfLeft: (rect1: TinyCollision.ObjRect, rect2: TinyCollision.ObjRect) => boolean;
|
|
282
|
-
areElsCollPerfRight: (rect1: TinyCollision.ObjRect,
|
|
283
|
-
/**
|
|
284
|
-
* Represents a value that can be either a DOM Element, or the document object.
|
|
285
|
-
* Useful for functions that operate generically on measurable targets.
|
|
286
|
-
*
|
|
287
|
-
* @typedef {Element|Document} ElementWithDoc
|
|
288
|
-
*/
|
|
289
|
-
/**
|
|
290
|
-
* A parameter type used for filtering or matching elements.
|
|
291
|
-
* It can be:
|
|
292
|
-
* - A string (CSS selector),
|
|
293
|
-
* - A raw DOM element,
|
|
294
|
-
* - An array of raw DOM elements,
|
|
295
|
-
* - A filtering function that receives an index and element,
|
|
296
|
-
* and returns true if it matches.
|
|
297
|
-
*
|
|
298
|
-
* @typedef {string|Element|Element[]|((index: number, el: Element) => boolean)} WinnowRequest
|
|
299
|
-
*/
|
|
300
|
-
/**
|
|
301
|
-
* Elements accepted as constructor values for TinyHtml.
|
|
302
|
-
* These include common DOM elements and root containers.
|
|
303
|
-
*
|
|
304
|
-
* @typedef {Window|Element|Document|Text} ConstructorElValues
|
|
305
|
-
*/
|
|
306
|
-
/**
|
|
307
|
-
* Options passed to `addEventListener` or `removeEventListener`.
|
|
308
|
-
* Can be a boolean or an object of type `AddEventListenerOptions`.
|
|
309
|
-
*
|
|
310
|
-
* @typedef {boolean|AddEventListenerOptions} EventRegistryOptions
|
|
311
|
-
*/
|
|
312
|
-
/**
|
|
313
|
-
* Structure describing a registered event callback and its options.
|
|
314
|
-
*
|
|
315
|
-
* @typedef {Object} EventRegistryItem
|
|
316
|
-
* @property {EventListenerOrEventListenerObject|null} handler - The function to be executed when the event is triggered.
|
|
317
|
-
* @property {EventRegistryOptions} [options] - Optional configuration passed to the listener.
|
|
318
|
-
*/
|
|
319
|
-
/**
|
|
320
|
-
* Maps event names (e.g., `"click"`, `"keydown"`) to a list of registered handlers and options.
|
|
321
|
-
*
|
|
322
|
-
* @typedef {Record<string, EventRegistryItem[]>} EventRegistryList
|
|
323
|
-
*/
|
|
324
|
-
/**
|
|
325
|
-
* WeakMap storing all event listeners per element.
|
|
326
|
-
* Each element has a registry mapping event names to their handler lists.
|
|
327
|
-
*
|
|
328
|
-
* @type {WeakMap<ConstructorElValues|EventTarget, EventRegistryList>}
|
|
329
|
-
*/
|
|
330
|
-
rect2: TinyCollision.ObjRect) => boolean;
|
|
286
|
+
areElsCollPerfRight: (rect1: TinyCollision.ObjRect, rect2: TinyCollision.ObjRect) => boolean;
|
|
331
287
|
areElsColliding: (rect1: TinyCollision.ObjRect, rect2: TinyCollision.ObjRect) => boolean;
|
|
332
288
|
areElsPerfColliding: (rect1: TinyCollision.ObjRect, rect2: TinyCollision.ObjRect) => boolean;
|
|
333
289
|
getElsColliding: (rect1: TinyCollision.ObjRect, rect2: TinyCollision.ObjRect) => string | null;
|
|
@@ -11,7 +11,12 @@ const { areElsColliding, areElsPerfColliding, areElsCollTop, areElsCollBottom, a
|
|
|
11
11
|
/**
|
|
12
12
|
* Represents the valid values that can be appended to a TinyNode.
|
|
13
13
|
*
|
|
14
|
-
* @typedef {TinyNode | TinyNode[] | string | false | null | undefined}
|
|
14
|
+
* @typedef {TinyNode | TinyNode[] | string | false | null | undefined} AppendCheckerTemplate
|
|
15
|
+
*/
|
|
16
|
+
/**
|
|
17
|
+
* Represents the the collection of values that can be appended to a TinyNode.
|
|
18
|
+
*
|
|
19
|
+
* @typedef {AppendCheckerTemplate|AppendCheckerTemplate[]} AppendCheckerValues
|
|
15
20
|
*/
|
|
16
21
|
/**
|
|
17
22
|
* Callback function used for hover events.
|
|
@@ -1877,18 +1882,19 @@ class TinyHtml {
|
|
|
1877
1882
|
* @readonly
|
|
1878
1883
|
*/
|
|
1879
1884
|
static _appendChecker(where, ...nodes) {
|
|
1885
|
+
/** @type {(string | Node)[]} */
|
|
1880
1886
|
const results = [];
|
|
1881
|
-
const
|
|
1882
|
-
|
|
1883
|
-
if (typeof nds[index] === 'undefined' ||
|
|
1884
|
-
nds[index] === null ||
|
|
1885
|
-
nds[index] === false)
|
|
1887
|
+
for (const item of nodes) {
|
|
1888
|
+
if (typeof item === 'undefined' || item === null || item === false)
|
|
1886
1889
|
continue;
|
|
1887
|
-
if (typeof
|
|
1888
|
-
|
|
1890
|
+
if (typeof item !== 'string') {
|
|
1891
|
+
if (!Array.isArray(item))
|
|
1892
|
+
results.push(TinyHtml._preNodeElems(item, where)[0]);
|
|
1893
|
+
else
|
|
1894
|
+
results.push(...TinyHtml._appendChecker(where, ...item));
|
|
1889
1895
|
}
|
|
1890
1896
|
else
|
|
1891
|
-
results.push(
|
|
1897
|
+
results.push(item);
|
|
1892
1898
|
}
|
|
1893
1899
|
return results;
|
|
1894
1900
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "tiny-essentials",
|
|
3
|
-
"version": "1.22.
|
|
3
|
+
"version": "1.22.9",
|
|
4
4
|
"description": "Collection of small, essential scripts designed to be used across various projects. These simple utilities are crafted for speed, ease of use, and versatility.",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"test": "npm run test:mjs && npm run test:cjs && npm run test:js",
|