tiny-essentials 1.22.5 → 1.22.7
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/1/0.md +1 -0
- package/changelog/1/10/0.md +19 -0
- package/changelog/1/10/2.md +23 -0
- package/changelog/1/11/0.md +66 -0
- package/changelog/1/12/0.md +54 -0
- package/changelog/1/12/1.md +37 -0
- package/changelog/1/12/2.md +29 -0
- package/changelog/1/13/0.md +41 -0
- package/changelog/1/13/1.md +7 -0
- package/changelog/1/13/2.md +13 -0
- package/changelog/1/14/0.md +33 -0
- package/changelog/1/15/0.md +39 -0
- package/changelog/1/16/0.md +42 -0
- package/changelog/1/16/1.md +43 -0
- package/changelog/1/16/2.md +29 -0
- package/changelog/1/17/0.md +28 -0
- package/changelog/1/17/1.md +40 -0
- package/changelog/1/18/0.md +43 -0
- package/changelog/1/18/1.md +12 -0
- package/changelog/1/19/1.md +21 -0
- package/changelog/1/19/2.md +23 -0
- package/changelog/1/19/3.md +15 -0
- package/changelog/1/2/0.md +5 -0
- package/changelog/1/2/1.md +5 -0
- package/changelog/1/20/0.md +9 -0
- package/changelog/1/20/1.md +40 -0
- package/changelog/1/20/2.md +22 -0
- package/changelog/1/20/3.md +39 -0
- package/changelog/1/21/0.md +23 -0
- package/changelog/1/21/1.md +12 -0
- package/changelog/1/21/10.md +23 -0
- package/changelog/1/21/2.md +9 -0
- package/changelog/1/21/3.md +9 -0
- package/changelog/1/21/4.md +9 -0
- package/changelog/1/21/6.md +23 -0
- package/changelog/1/21/7.md +16 -0
- package/changelog/1/21/8.md +5 -0
- package/changelog/1/21/9.md +17 -0
- package/changelog/1/22/1.md +28 -0
- package/changelog/1/22/2.md +17 -0
- package/changelog/1/22/3.md +11 -0
- package/changelog/1/22/4.md +35 -0
- package/changelog/1/22/5.md +23 -0
- package/changelog/1/22/6.md +27 -0
- package/changelog/1/22/7.md +5 -0
- package/changelog/1/3/1.md +4 -0
- package/changelog/1/3/2.md +2 -0
- package/changelog/1/4/0.md +5 -0
- package/changelog/1/5/0.md +4 -0
- package/changelog/1/5/1.md +2 -0
- package/changelog/1/6/0.md +6 -0
- package/changelog/1/7/0.md +3 -0
- package/changelog/1/7/1.md +3 -0
- package/changelog/1/8/0.md +3 -0
- package/changelog/1/8/1.md +2 -0
- package/changelog/1/8/2.md +2 -0
- package/changelog/1/8/3.md +3 -0
- package/changelog/1/8/4.md +2 -0
- package/changelog/1/8/5.md +6 -0
- package/changelog/1/9/0.md +27 -0
- package/changelog/1/9/1.md +5 -0
- package/changelog/1/9/2.md +14 -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 +129 -17
- package/dist/v1/libs/TinyHtml.d.mts +110 -22
- package/dist/v1/libs/TinyHtml.mjs +122 -17
- package/docs/v1/libs/TinyHtml.md +105 -0
- package/package.json +1 -1
|
@@ -20,6 +20,12 @@ const {
|
|
|
20
20
|
* @typedef {TinyHtml<ConstructorElValues>} TinyHtmlAny
|
|
21
21
|
*/
|
|
22
22
|
|
|
23
|
+
/**
|
|
24
|
+
* Represents the valid values that can be appended to a TinyNode.
|
|
25
|
+
*
|
|
26
|
+
* @typedef {TinyNode | TinyNode[] | string | false | null | undefined} AppendCheckerValues
|
|
27
|
+
*/
|
|
28
|
+
|
|
23
29
|
/**
|
|
24
30
|
* Callback function used for hover events.
|
|
25
31
|
* @callback HoverEventCallback
|
|
@@ -339,6 +345,94 @@ class TinyHtml {
|
|
|
339
345
|
|
|
340
346
|
static Utils = { ...collision };
|
|
341
347
|
|
|
348
|
+
/**
|
|
349
|
+
* Controls whether TinyHtml emits detailed debug output to the console.
|
|
350
|
+
* When enabled, helper methods print structured diagnostics for easier troubleshooting.
|
|
351
|
+
* @type {boolean}
|
|
352
|
+
*/
|
|
353
|
+
static #elemDebug = false;
|
|
354
|
+
|
|
355
|
+
/**
|
|
356
|
+
* Gets whether debug output is enabled.
|
|
357
|
+
* @returns {boolean} True if debug output is enabled; otherwise, false.
|
|
358
|
+
*/
|
|
359
|
+
static get elemDebug() {
|
|
360
|
+
return TinyHtml.#elemDebug;
|
|
361
|
+
}
|
|
362
|
+
|
|
363
|
+
/**
|
|
364
|
+
* Enables or disables debug output.
|
|
365
|
+
* @param {boolean} value True to enable debug output; false to disable.
|
|
366
|
+
* @throws {TypeError} Thrown if the provided value is not a boolean.
|
|
367
|
+
* @returns {void}
|
|
368
|
+
*/
|
|
369
|
+
static set elemDebug(value) {
|
|
370
|
+
if (typeof value !== 'boolean') throw new TypeError('Expected a boolean value for elemDebug');
|
|
371
|
+
TinyHtml.#elemDebug = value;
|
|
372
|
+
}
|
|
373
|
+
|
|
374
|
+
/**
|
|
375
|
+
* Logs a standardized debug error for element validation, including a console.table
|
|
376
|
+
* with the involved elements. Use this when an element argument is invalid, unexpected,
|
|
377
|
+
* or fails a guard/validation.
|
|
378
|
+
*
|
|
379
|
+
* The output includes:
|
|
380
|
+
* - A concise error header
|
|
381
|
+
* - A stack trace (when supported)
|
|
382
|
+
* - A table of elements (index, typeof, constructor, summary, value)
|
|
383
|
+
* - The specific problematic element, if provided
|
|
384
|
+
*
|
|
385
|
+
* @param {(ConstructorElValues | EventTarget | TinyElement | null)[]} elems
|
|
386
|
+
* A list of elements participating in the operation (may include nulls).
|
|
387
|
+
* @param {ConstructorElValues | EventTarget | TinyElement | null} [elem]
|
|
388
|
+
* The specific element that triggered the error, if available.
|
|
389
|
+
* @returns {void}
|
|
390
|
+
*/
|
|
391
|
+
static _debugElemError(elems, elem) {
|
|
392
|
+
if (!TinyHtml.#elemDebug) return;
|
|
393
|
+
const header = '[TinyHtml Debug] Element validation error';
|
|
394
|
+
|
|
395
|
+
console.groupCollapsed(`${header}${elem ? ' — details below' : ''}`);
|
|
396
|
+
console.error(header);
|
|
397
|
+
|
|
398
|
+
// Stack trace for call-site visibility
|
|
399
|
+
if (typeof Error !== 'undefined' && typeof Error.captureStackTrace === 'function') {
|
|
400
|
+
const err = new Error(header);
|
|
401
|
+
Error.captureStackTrace(err, TinyHtml._debugElemError);
|
|
402
|
+
console.error(err.stack);
|
|
403
|
+
} else {
|
|
404
|
+
console.trace(header);
|
|
405
|
+
}
|
|
406
|
+
|
|
407
|
+
// Tabular overview of provided elements
|
|
408
|
+
if (Array.isArray(elems)) {
|
|
409
|
+
const rows = elems.map((el, index) => {
|
|
410
|
+
const typeOf = el === null ? 'null' : typeof el;
|
|
411
|
+
const ctor = el?.constructor?.name ?? (el === null ? 'null' : 'primitive');
|
|
412
|
+
const isDomEl = typeof Element !== 'undefined' && el instanceof Element;
|
|
413
|
+
const summary = isDomEl
|
|
414
|
+
? `${el.tagName?.toLowerCase?.() ?? 'element'}#${el.id || ''}.${String(el.className || '')
|
|
415
|
+
.trim()
|
|
416
|
+
.replace(/\s+/g, '.')}`
|
|
417
|
+
: el && typeof el === 'object' && 'nodeType' in el
|
|
418
|
+
? `nodeType:${/** @type {any} */ (el).nodeType}`
|
|
419
|
+
: '';
|
|
420
|
+
return { index, typeOf, constructor: ctor, summary, value: el };
|
|
421
|
+
});
|
|
422
|
+
console.table(rows);
|
|
423
|
+
} else {
|
|
424
|
+
console.warn('[TinyHtml Debug] "elems" is not an array:', elems);
|
|
425
|
+
}
|
|
426
|
+
|
|
427
|
+
// Highlight the specific problematic element, if any
|
|
428
|
+
if (arguments.length > 1) {
|
|
429
|
+
console.error('[TinyHtml Debug] Problematic element:', elem);
|
|
430
|
+
if (elem && typeof elem === 'object') console.dir(elem);
|
|
431
|
+
}
|
|
432
|
+
|
|
433
|
+
console.groupEnd();
|
|
434
|
+
}
|
|
435
|
+
|
|
342
436
|
/**
|
|
343
437
|
* Parse inline styles into an object.
|
|
344
438
|
* @param {string} styleText
|
|
@@ -943,8 +1037,10 @@ class TinyHtml {
|
|
|
943
1037
|
!(this.#el[index] instanceof Window) &&
|
|
944
1038
|
!(this.#el[index] instanceof Document) &&
|
|
945
1039
|
!(this.#el[index] instanceof Text)
|
|
946
|
-
)
|
|
1040
|
+
) {
|
|
1041
|
+
TinyHtml._debugElemError([...this.#el], this.#el[index]);
|
|
947
1042
|
throw new Error(`[TinyHtml] Invalid Element in ${where}().`);
|
|
1043
|
+
}
|
|
948
1044
|
return this.#el[index];
|
|
949
1045
|
}
|
|
950
1046
|
|
|
@@ -964,8 +1060,10 @@ class TinyHtml {
|
|
|
964
1060
|
el instanceof Document ||
|
|
965
1061
|
el instanceof Text,
|
|
966
1062
|
)
|
|
967
|
-
)
|
|
1063
|
+
) {
|
|
1064
|
+
TinyHtml._debugElemError([...this.#el]);
|
|
968
1065
|
throw new Error(`[TinyHtml] Invalid Element in ${where}().`);
|
|
1066
|
+
}
|
|
969
1067
|
return [...this.#el];
|
|
970
1068
|
}
|
|
971
1069
|
|
|
@@ -998,10 +1096,12 @@ class TinyHtml {
|
|
|
998
1096
|
break;
|
|
999
1097
|
}
|
|
1000
1098
|
}
|
|
1001
|
-
if (!allowed)
|
|
1099
|
+
if (!allowed) {
|
|
1100
|
+
TinyHtml._debugElemError([...item], result);
|
|
1002
1101
|
throw new Error(
|
|
1003
1102
|
`[TinyHtml] Invalid element of the list "${elemName.join(',')}" in ${where}().`,
|
|
1004
1103
|
);
|
|
1104
|
+
}
|
|
1005
1105
|
results.push(result);
|
|
1006
1106
|
return result;
|
|
1007
1107
|
}),
|
|
@@ -1029,10 +1129,12 @@ class TinyHtml {
|
|
|
1029
1129
|
const checkElement = (item) => {
|
|
1030
1130
|
const elem = item[0];
|
|
1031
1131
|
const result = elem instanceof TinyHtml ? elem._getElements(where) : [elem];
|
|
1032
|
-
if (result.length > 1)
|
|
1132
|
+
if (result.length > 1) {
|
|
1133
|
+
TinyHtml._debugElemError([...item]);
|
|
1033
1134
|
throw new Error(
|
|
1034
1135
|
`[TinyHtml] Invalid element amount in ${where}() (Received ${result.length}/1).`,
|
|
1035
1136
|
);
|
|
1137
|
+
}
|
|
1036
1138
|
|
|
1037
1139
|
let allowed = false;
|
|
1038
1140
|
for (const TheTinyElement of TheTinyElements) {
|
|
@@ -1047,17 +1149,21 @@ class TinyHtml {
|
|
|
1047
1149
|
allowed = true;
|
|
1048
1150
|
}
|
|
1049
1151
|
|
|
1050
|
-
if (!allowed)
|
|
1152
|
+
if (!allowed) {
|
|
1153
|
+
TinyHtml._debugElemError([...item], result[0]);
|
|
1051
1154
|
throw new Error(
|
|
1052
1155
|
`[TinyHtml] Invalid element of the list "${elemName.join(',')}" in ${where}().`,
|
|
1053
1156
|
);
|
|
1157
|
+
}
|
|
1054
1158
|
return result[0];
|
|
1055
1159
|
};
|
|
1056
1160
|
if (!Array.isArray(elems)) return checkElement([elems]);
|
|
1057
|
-
if (elems.length > 1)
|
|
1161
|
+
if (elems.length > 1) {
|
|
1162
|
+
TinyHtml._debugElemError([...elems]);
|
|
1058
1163
|
throw new Error(
|
|
1059
1164
|
`[TinyHtml] Invalid element amount in ${where}() (Received ${elems.length}/1).`,
|
|
1060
1165
|
);
|
|
1166
|
+
}
|
|
1061
1167
|
return checkElement(elems);
|
|
1062
1168
|
}
|
|
1063
1169
|
|
|
@@ -2042,13 +2148,19 @@ class TinyHtml {
|
|
|
2042
2148
|
/**
|
|
2043
2149
|
* Normalize and validate nodes before DOM insertion.
|
|
2044
2150
|
* Converts TinyNode-like structures or strings into DOM-compatible nodes.
|
|
2045
|
-
* @type {(where: string, ...nodes:
|
|
2151
|
+
* @type {(where: string, ...nodes: AppendCheckerValues[]) => (Node | string)[]}
|
|
2046
2152
|
* @readonly
|
|
2047
2153
|
*/
|
|
2048
2154
|
static _appendChecker(where, ...nodes) {
|
|
2049
2155
|
const results = [];
|
|
2050
2156
|
const nds = [...nodes];
|
|
2051
2157
|
for (const index in nds) {
|
|
2158
|
+
if (
|
|
2159
|
+
typeof nds[index] === 'undefined' ||
|
|
2160
|
+
nds[index] === null ||
|
|
2161
|
+
nds[index] === false
|
|
2162
|
+
)
|
|
2163
|
+
continue;
|
|
2052
2164
|
if (typeof nds[index] !== 'string') {
|
|
2053
2165
|
results.push(TinyHtml._preNodeElem(nds[index], where));
|
|
2054
2166
|
} else results.push(nds[index]);
|
|
@@ -2061,7 +2173,7 @@ class TinyHtml {
|
|
|
2061
2173
|
*
|
|
2062
2174
|
* @template {TinyElement} T
|
|
2063
2175
|
* @param {T} el - The target element(s) to receive children.
|
|
2064
|
-
* @param {...
|
|
2176
|
+
* @param {...AppendCheckerValues} children - The child elements or text to append.
|
|
2065
2177
|
* @returns {T}
|
|
2066
2178
|
*/
|
|
2067
2179
|
static append(el, ...children) {
|
|
@@ -2073,7 +2185,7 @@ class TinyHtml {
|
|
|
2073
2185
|
/**
|
|
2074
2186
|
* Appends child elements or strings to the end of the target element(s).
|
|
2075
2187
|
*
|
|
2076
|
-
* @param {...
|
|
2188
|
+
* @param {...AppendCheckerValues} children - The child elements or text to append.
|
|
2077
2189
|
* @returns {this}
|
|
2078
2190
|
*/
|
|
2079
2191
|
append(...children) {
|
|
@@ -2085,7 +2197,7 @@ class TinyHtml {
|
|
|
2085
2197
|
*
|
|
2086
2198
|
* @template {TinyElement} T
|
|
2087
2199
|
* @param {T} el - The target element(s) to receive children.
|
|
2088
|
-
* @param {...
|
|
2200
|
+
* @param {...AppendCheckerValues} children - The child elements or text to prepend.
|
|
2089
2201
|
* @returns {T}
|
|
2090
2202
|
*/
|
|
2091
2203
|
static prepend(el, ...children) {
|
|
@@ -2097,7 +2209,7 @@ class TinyHtml {
|
|
|
2097
2209
|
/**
|
|
2098
2210
|
* Prepends child elements or strings to the beginning of the target element(s).
|
|
2099
2211
|
*
|
|
2100
|
-
* @param {...
|
|
2212
|
+
* @param {...AppendCheckerValues} children - The child elements or text to prepend.
|
|
2101
2213
|
* @returns {this}
|
|
2102
2214
|
*/
|
|
2103
2215
|
prepend(...children) {
|
|
@@ -2109,7 +2221,7 @@ class TinyHtml {
|
|
|
2109
2221
|
*
|
|
2110
2222
|
* @template {TinyElement} T
|
|
2111
2223
|
* @param {T} el - The target element(s) before which new content is inserted.
|
|
2112
|
-
* @param {...
|
|
2224
|
+
* @param {...AppendCheckerValues} children - Elements or text to insert before the target.
|
|
2113
2225
|
* @returns {T}
|
|
2114
2226
|
*/
|
|
2115
2227
|
static before(el, ...children) {
|
|
@@ -2121,7 +2233,7 @@ class TinyHtml {
|
|
|
2121
2233
|
/**
|
|
2122
2234
|
* Inserts elements or strings immediately before the target element(s) in the DOM.
|
|
2123
2235
|
*
|
|
2124
|
-
* @param {...
|
|
2236
|
+
* @param {...AppendCheckerValues} children - Elements or text to insert before the target.
|
|
2125
2237
|
* @returns {this}
|
|
2126
2238
|
*/
|
|
2127
2239
|
before(...children) {
|
|
@@ -2133,7 +2245,7 @@ class TinyHtml {
|
|
|
2133
2245
|
*
|
|
2134
2246
|
* @template {TinyElement} T
|
|
2135
2247
|
* @param {T} el - The target element(s) after which new content is inserted.
|
|
2136
|
-
* @param {...
|
|
2248
|
+
* @param {...AppendCheckerValues} children - Elements or text to insert after the target.
|
|
2137
2249
|
* @returns {T}
|
|
2138
2250
|
*/
|
|
2139
2251
|
static after(el, ...children) {
|
|
@@ -2145,7 +2257,7 @@ class TinyHtml {
|
|
|
2145
2257
|
/**
|
|
2146
2258
|
* Inserts elements or strings immediately after the target element(s) in the DOM.
|
|
2147
2259
|
*
|
|
2148
|
-
* @param {...
|
|
2260
|
+
* @param {...AppendCheckerValues} children - Elements or text to insert after the target.
|
|
2149
2261
|
* @returns {this}
|
|
2150
2262
|
*/
|
|
2151
2263
|
after(...children) {
|
|
@@ -2157,7 +2269,7 @@ class TinyHtml {
|
|
|
2157
2269
|
*
|
|
2158
2270
|
* @template {TinyElement} T
|
|
2159
2271
|
* @param {T} el - The element(s) to be replaced.
|
|
2160
|
-
* @param {...
|
|
2272
|
+
* @param {...AppendCheckerValues} newNodes - New elements or text to replace the target.
|
|
2161
2273
|
* @returns {T}
|
|
2162
2274
|
*/
|
|
2163
2275
|
static replaceWith(el, ...newNodes) {
|
|
@@ -2169,7 +2281,7 @@ class TinyHtml {
|
|
|
2169
2281
|
/**
|
|
2170
2282
|
* Replaces the target element(s) in the DOM with new elements or text.
|
|
2171
2283
|
*
|
|
2172
|
-
* @param {...
|
|
2284
|
+
* @param {...AppendCheckerValues} newNodes - New elements or text to replace the target.
|
|
2173
2285
|
* @returns {this}
|
|
2174
2286
|
*/
|
|
2175
2287
|
replaceWith(...newNodes) {
|
|
@@ -3,6 +3,10 @@ export default TinyHtml;
|
|
|
3
3
|
* Represents a TinyHtml instance with any constructor element values.
|
|
4
4
|
*/
|
|
5
5
|
export type TinyHtmlAny = TinyHtml<ConstructorElValues>;
|
|
6
|
+
/**
|
|
7
|
+
* Represents the valid values that can be appended to a TinyNode.
|
|
8
|
+
*/
|
|
9
|
+
export type AppendCheckerValues = TinyNode | TinyNode[] | string | false | null | undefined;
|
|
6
10
|
/**
|
|
7
11
|
* Callback function used for hover events.
|
|
8
12
|
*/
|
|
@@ -275,7 +279,55 @@ declare class TinyHtml<TinyHtmlT extends ConstructorElValues | ConstructorElValu
|
|
|
275
279
|
areElsCollPerfTop: (rect1: TinyCollision.ObjRect, rect2: TinyCollision.ObjRect) => boolean;
|
|
276
280
|
areElsCollPerfBottom: (rect1: TinyCollision.ObjRect, rect2: TinyCollision.ObjRect) => boolean;
|
|
277
281
|
areElsCollPerfLeft: (rect1: TinyCollision.ObjRect, rect2: TinyCollision.ObjRect) => boolean;
|
|
278
|
-
areElsCollPerfRight: (rect1: TinyCollision.ObjRect,
|
|
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;
|
|
279
331
|
areElsColliding: (rect1: TinyCollision.ObjRect, rect2: TinyCollision.ObjRect) => boolean;
|
|
280
332
|
areElsPerfColliding: (rect1: TinyCollision.ObjRect, rect2: TinyCollision.ObjRect) => boolean;
|
|
281
333
|
getElsColliding: (rect1: TinyCollision.ObjRect, rect2: TinyCollision.ObjRect) => string | null;
|
|
@@ -300,6 +352,42 @@ declare class TinyHtml<TinyHtmlT extends ConstructorElValues | ConstructorElValu
|
|
|
300
352
|
y: number;
|
|
301
353
|
};
|
|
302
354
|
};
|
|
355
|
+
/**
|
|
356
|
+
* Controls whether TinyHtml emits detailed debug output to the console.
|
|
357
|
+
* When enabled, helper methods print structured diagnostics for easier troubleshooting.
|
|
358
|
+
* @type {boolean}
|
|
359
|
+
*/
|
|
360
|
+
static "__#8@#elemDebug": boolean;
|
|
361
|
+
/**
|
|
362
|
+
* Enables or disables debug output.
|
|
363
|
+
* @param {boolean} value True to enable debug output; false to disable.
|
|
364
|
+
* @throws {TypeError} Thrown if the provided value is not a boolean.
|
|
365
|
+
* @returns {void}
|
|
366
|
+
*/
|
|
367
|
+
static set elemDebug(value: boolean);
|
|
368
|
+
/**
|
|
369
|
+
* Gets whether debug output is enabled.
|
|
370
|
+
* @returns {boolean} True if debug output is enabled; otherwise, false.
|
|
371
|
+
*/
|
|
372
|
+
static get elemDebug(): boolean;
|
|
373
|
+
/**
|
|
374
|
+
* Logs a standardized debug error for element validation, including a console.table
|
|
375
|
+
* with the involved elements. Use this when an element argument is invalid, unexpected,
|
|
376
|
+
* or fails a guard/validation.
|
|
377
|
+
*
|
|
378
|
+
* The output includes:
|
|
379
|
+
* - A concise error header
|
|
380
|
+
* - A stack trace (when supported)
|
|
381
|
+
* - A table of elements (index, typeof, constructor, summary, value)
|
|
382
|
+
* - The specific problematic element, if provided
|
|
383
|
+
*
|
|
384
|
+
* @param {(ConstructorElValues | EventTarget | TinyElement | null)[]} elems
|
|
385
|
+
* A list of elements participating in the operation (may include nulls).
|
|
386
|
+
* @param {ConstructorElValues | EventTarget | TinyElement | null} [elem]
|
|
387
|
+
* The specific element that triggered the error, if available.
|
|
388
|
+
* @returns {void}
|
|
389
|
+
*/
|
|
390
|
+
static _debugElemError(elems: (ConstructorElValues | EventTarget | TinyElement | null)[], elem?: ConstructorElValues | EventTarget | TinyElement | null, ...args: any[]): void;
|
|
303
391
|
/**
|
|
304
392
|
* Parse inline styles into an object.
|
|
305
393
|
* @param {string} styleText
|
|
@@ -933,52 +1021,52 @@ declare class TinyHtml<TinyHtmlT extends ConstructorElValues | ConstructorElValu
|
|
|
933
1021
|
* @returns {Node[]}
|
|
934
1022
|
*/
|
|
935
1023
|
static clone(el: TinyNode | TinyNode[], deep?: boolean): Node[];
|
|
936
|
-
static readonly _appendChecker(where: string, ...nodes:
|
|
1024
|
+
static readonly _appendChecker(where: string, ...nodes: AppendCheckerValues[]): (Node | string)[];
|
|
937
1025
|
/**
|
|
938
1026
|
* Appends child elements or strings to the end of the target element(s).
|
|
939
1027
|
*
|
|
940
1028
|
* @template {TinyElement} T
|
|
941
1029
|
* @param {T} el - The target element(s) to receive children.
|
|
942
|
-
* @param {...
|
|
1030
|
+
* @param {...AppendCheckerValues} children - The child elements or text to append.
|
|
943
1031
|
* @returns {T}
|
|
944
1032
|
*/
|
|
945
|
-
static append<T extends TinyElement>(el: T, ...children:
|
|
1033
|
+
static append<T extends TinyElement>(el: T, ...children: AppendCheckerValues[]): T;
|
|
946
1034
|
/**
|
|
947
1035
|
* Prepends child elements or strings to the beginning of the target element(s).
|
|
948
1036
|
*
|
|
949
1037
|
* @template {TinyElement} T
|
|
950
1038
|
* @param {T} el - The target element(s) to receive children.
|
|
951
|
-
* @param {...
|
|
1039
|
+
* @param {...AppendCheckerValues} children - The child elements or text to prepend.
|
|
952
1040
|
* @returns {T}
|
|
953
1041
|
*/
|
|
954
|
-
static prepend<T extends TinyElement>(el: T, ...children:
|
|
1042
|
+
static prepend<T extends TinyElement>(el: T, ...children: AppendCheckerValues[]): T;
|
|
955
1043
|
/**
|
|
956
1044
|
* Inserts elements or strings immediately before the target element(s) in the DOM.
|
|
957
1045
|
*
|
|
958
1046
|
* @template {TinyElement} T
|
|
959
1047
|
* @param {T} el - The target element(s) before which new content is inserted.
|
|
960
|
-
* @param {...
|
|
1048
|
+
* @param {...AppendCheckerValues} children - Elements or text to insert before the target.
|
|
961
1049
|
* @returns {T}
|
|
962
1050
|
*/
|
|
963
|
-
static before<T extends TinyElement>(el: T, ...children:
|
|
1051
|
+
static before<T extends TinyElement>(el: T, ...children: AppendCheckerValues[]): T;
|
|
964
1052
|
/**
|
|
965
1053
|
* Inserts elements or strings immediately after the target element(s) in the DOM.
|
|
966
1054
|
*
|
|
967
1055
|
* @template {TinyElement} T
|
|
968
1056
|
* @param {T} el - The target element(s) after which new content is inserted.
|
|
969
|
-
* @param {...
|
|
1057
|
+
* @param {...AppendCheckerValues} children - Elements or text to insert after the target.
|
|
970
1058
|
* @returns {T}
|
|
971
1059
|
*/
|
|
972
|
-
static after<T extends TinyElement>(el: T, ...children:
|
|
1060
|
+
static after<T extends TinyElement>(el: T, ...children: AppendCheckerValues[]): T;
|
|
973
1061
|
/**
|
|
974
1062
|
* Replaces the target element(s) in the DOM with new elements or text.
|
|
975
1063
|
*
|
|
976
1064
|
* @template {TinyElement} T
|
|
977
1065
|
* @param {T} el - The element(s) to be replaced.
|
|
978
|
-
* @param {...
|
|
1066
|
+
* @param {...AppendCheckerValues} newNodes - New elements or text to replace the target.
|
|
979
1067
|
* @returns {T}
|
|
980
1068
|
*/
|
|
981
|
-
static replaceWith<T extends TinyElement>(el: T, ...newNodes:
|
|
1069
|
+
static replaceWith<T extends TinyElement>(el: T, ...newNodes: AppendCheckerValues[]): T;
|
|
982
1070
|
/**
|
|
983
1071
|
* Appends the given element(s) to each target element in sequence.
|
|
984
1072
|
*
|
|
@@ -2908,38 +2996,38 @@ declare class TinyHtml<TinyHtmlT extends ConstructorElValues | ConstructorElValu
|
|
|
2908
2996
|
/**
|
|
2909
2997
|
* Appends child elements or strings to the end of the target element(s).
|
|
2910
2998
|
*
|
|
2911
|
-
* @param {...
|
|
2999
|
+
* @param {...AppendCheckerValues} children - The child elements or text to append.
|
|
2912
3000
|
* @returns {this}
|
|
2913
3001
|
*/
|
|
2914
|
-
append(...children:
|
|
3002
|
+
append(...children: AppendCheckerValues[]): this;
|
|
2915
3003
|
/**
|
|
2916
3004
|
* Prepends child elements or strings to the beginning of the target element(s).
|
|
2917
3005
|
*
|
|
2918
|
-
* @param {...
|
|
3006
|
+
* @param {...AppendCheckerValues} children - The child elements or text to prepend.
|
|
2919
3007
|
* @returns {this}
|
|
2920
3008
|
*/
|
|
2921
|
-
prepend(...children:
|
|
3009
|
+
prepend(...children: AppendCheckerValues[]): this;
|
|
2922
3010
|
/**
|
|
2923
3011
|
* Inserts elements or strings immediately before the target element(s) in the DOM.
|
|
2924
3012
|
*
|
|
2925
|
-
* @param {...
|
|
3013
|
+
* @param {...AppendCheckerValues} children - Elements or text to insert before the target.
|
|
2926
3014
|
* @returns {this}
|
|
2927
3015
|
*/
|
|
2928
|
-
before(...children:
|
|
3016
|
+
before(...children: AppendCheckerValues[]): this;
|
|
2929
3017
|
/**
|
|
2930
3018
|
* Inserts elements or strings immediately after the target element(s) in the DOM.
|
|
2931
3019
|
*
|
|
2932
|
-
* @param {...
|
|
3020
|
+
* @param {...AppendCheckerValues} children - Elements or text to insert after the target.
|
|
2933
3021
|
* @returns {this}
|
|
2934
3022
|
*/
|
|
2935
|
-
after(...children:
|
|
3023
|
+
after(...children: AppendCheckerValues[]): this;
|
|
2936
3024
|
/**
|
|
2937
3025
|
* Replaces the target element(s) in the DOM with new elements or text.
|
|
2938
3026
|
*
|
|
2939
|
-
* @param {...
|
|
3027
|
+
* @param {...AppendCheckerValues} newNodes - New elements or text to replace the target.
|
|
2940
3028
|
* @returns {this}
|
|
2941
3029
|
*/
|
|
2942
|
-
replaceWith(...newNodes:
|
|
3030
|
+
replaceWith(...newNodes: AppendCheckerValues[]): this;
|
|
2943
3031
|
/**
|
|
2944
3032
|
* Appends the given element(s) to each target element in sequence.
|
|
2945
3033
|
*
|