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
|
@@ -3,6 +3,37 @@ 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
|
+
* Callback function used for hover events.
|
|
8
|
+
*/
|
|
9
|
+
export type HoverEventCallback = (ev: MouseEvent) => void;
|
|
10
|
+
/**
|
|
11
|
+
* Represents a collection of active style-based animations.
|
|
12
|
+
*
|
|
13
|
+
* Each HTMLElement is associated with an array of its currently running
|
|
14
|
+
* `Animation` objects (from the Web Animations API).
|
|
15
|
+
*/
|
|
16
|
+
export type StyleFxResult = Map<HTMLElement, Animation | null>;
|
|
17
|
+
/**
|
|
18
|
+
* Represents a collection of animation keyframe data mapped by CSS property.
|
|
19
|
+
*
|
|
20
|
+
* - The **key** is the CSS property name (e.g. `"height"`, `"opacity"`).
|
|
21
|
+
* - The **value** is an array of values representing the start and end
|
|
22
|
+
* states of the property during the animation.
|
|
23
|
+
*/
|
|
24
|
+
export type AnimationSfxData = Record<string, (string | number)[]>;
|
|
25
|
+
/**
|
|
26
|
+
* Function signature for style effects repeat detectors.
|
|
27
|
+
*/
|
|
28
|
+
export type StyleEffectsRdFn = (effects: AnimationSfxData) => boolean;
|
|
29
|
+
/**
|
|
30
|
+
* Function signature for style effect property handlers.
|
|
31
|
+
*/
|
|
32
|
+
export type StyleEffectsFn = (el: HTMLElement, keyframes: AnimationSfxData, prop: string, style: CSSStyleDeclaration) => void;
|
|
33
|
+
/**
|
|
34
|
+
* A collection of style effect property handlers.
|
|
35
|
+
*/
|
|
36
|
+
export type StyleEffectsProps = Record<string, StyleEffectsFn>;
|
|
6
37
|
/**
|
|
7
38
|
* Callback invoked on each animation frame with the current scroll position,
|
|
8
39
|
* normalized animation time (`0` to `1`), and a completion flag.
|
|
@@ -122,6 +153,11 @@ export type EventRegistryList = Record<string, EventRegistryItem[]>;
|
|
|
122
153
|
* Keys are strings, and values can be of any type.
|
|
123
154
|
*/
|
|
124
155
|
export type ElementDataStore = Record<string, any>;
|
|
156
|
+
/**
|
|
157
|
+
* Mapping of animation shortcuts to their effect definitions.
|
|
158
|
+
* Similar to jQuery's predefined effects (slideDown, fadeIn, etc.).
|
|
159
|
+
*/
|
|
160
|
+
export type StyleEffects = Record<string, string | (string | number)[]>;
|
|
125
161
|
/**
|
|
126
162
|
* Possible directions from which a collision was detected and locked.
|
|
127
163
|
*/
|
|
@@ -264,6 +300,31 @@ declare class TinyHtml<TinyHtmlT extends ConstructorElValues | ConstructorElValu
|
|
|
264
300
|
y: number;
|
|
265
301
|
};
|
|
266
302
|
};
|
|
303
|
+
/**
|
|
304
|
+
* Parse inline styles into an object.
|
|
305
|
+
* @param {string} styleText
|
|
306
|
+
* @returns {Record<string,string>}
|
|
307
|
+
*/
|
|
308
|
+
static parseStyle(styleText: string): Record<string, string>;
|
|
309
|
+
/**
|
|
310
|
+
* Flag to determine if element observer should start automatically.
|
|
311
|
+
* @type {boolean}
|
|
312
|
+
*/
|
|
313
|
+
static "__#8@#autoStartElemObserver": boolean;
|
|
314
|
+
/**
|
|
315
|
+
* Set the auto-start flag for the observer.
|
|
316
|
+
* @param {boolean} value
|
|
317
|
+
*/
|
|
318
|
+
static set autoStartElemObserver(value: boolean);
|
|
319
|
+
/**
|
|
320
|
+
* Get the auto-start flag for the observer.
|
|
321
|
+
* @returns {boolean}
|
|
322
|
+
*/
|
|
323
|
+
static get autoStartElemObserver(): boolean;
|
|
324
|
+
/** @type {TinyElementObserver} */
|
|
325
|
+
static "__#8@#tinyObserver": TinyElementObserver;
|
|
326
|
+
/** @returns {TinyElementObserver} */
|
|
327
|
+
static get tinyObserver(): TinyElementObserver;
|
|
267
328
|
/**
|
|
268
329
|
* Fetches an HTML file from the given URL, parses it to JSON.
|
|
269
330
|
*
|
|
@@ -1026,7 +1087,7 @@ declare class TinyHtml<TinyHtmlT extends ConstructorElValues | ConstructorElValu
|
|
|
1026
1087
|
*
|
|
1027
1088
|
* @type {Record<string | symbol, string>}
|
|
1028
1089
|
*/
|
|
1029
|
-
static "__#
|
|
1090
|
+
static "__#8@#cssPropAliases": Record<string | symbol, string>;
|
|
1030
1091
|
/**
|
|
1031
1092
|
* Public proxy to manage camelCase ➝ kebab-case CSS property aliasing.
|
|
1032
1093
|
*
|
|
@@ -1272,16 +1333,371 @@ declare class TinyHtml<TinyHtmlT extends ConstructorElValues | ConstructorElValu
|
|
|
1272
1333
|
* @returns {number}
|
|
1273
1334
|
*/
|
|
1274
1335
|
static outerWidth(el: TinyElementAndWinAndDoc, includeMargin?: boolean): number;
|
|
1336
|
+
/**
|
|
1337
|
+
* Retrieves stored animation data for a given element and key.
|
|
1338
|
+
* If no data exists yet, initializes storage for that element.
|
|
1339
|
+
*
|
|
1340
|
+
* @param {HTMLElement} el - The element whose data should be retrieved.
|
|
1341
|
+
* @param {string} where - The key to read (e.g., "origHeight").
|
|
1342
|
+
* @returns {string|number|undefined} - The stored value, or undefined.
|
|
1343
|
+
*/
|
|
1344
|
+
static getAnimateData(el: HTMLElement, where: string): string | number | undefined;
|
|
1345
|
+
/**
|
|
1346
|
+
* Stores animation data for a given element and key.
|
|
1347
|
+
* Used to cache original size/values for animations.
|
|
1348
|
+
*
|
|
1349
|
+
* @param {HTMLElement} el - The element whose data should be set.
|
|
1350
|
+
* @param {string} where - The key to store under (e.g., "origHeight").
|
|
1351
|
+
* @param {string|number} value - The value to store.
|
|
1352
|
+
*/
|
|
1353
|
+
static setAnimateData(el: HTMLElement, where: string, value: string | number): void;
|
|
1354
|
+
/**
|
|
1355
|
+
* Global configuration flag controlling whether old style-based animations
|
|
1356
|
+
* are cancelled before a new one starts. Defaults to true.
|
|
1357
|
+
*
|
|
1358
|
+
* @type {boolean}
|
|
1359
|
+
*/
|
|
1360
|
+
static "__#8@#cancelOldStyleFx": boolean;
|
|
1361
|
+
/**
|
|
1362
|
+
* Updates the global setting that determines whether old style-based animations
|
|
1363
|
+
* are cancelled before new ones start.
|
|
1364
|
+
*
|
|
1365
|
+
* @param {boolean} value - True to cancel old animations by default, false to keep them running.
|
|
1366
|
+
* @throws {TypeError} If the value is not a boolean.
|
|
1367
|
+
*/
|
|
1368
|
+
static set cancelOldStyleFx(value: boolean);
|
|
1369
|
+
/**
|
|
1370
|
+
* Returns the current global setting for cancelling old style-based animations.
|
|
1371
|
+
*
|
|
1372
|
+
* @returns {boolean} True if old animations are cancelled by default, false otherwise.
|
|
1373
|
+
*/
|
|
1374
|
+
static get cancelOldStyleFx(): boolean;
|
|
1375
|
+
/**
|
|
1376
|
+
* Predefined animation speed options, inspired by jQuery.fx.speeds.
|
|
1377
|
+
* Each entry can be either a number (duration in ms) or a KeyframeAnimationOptions object.
|
|
1378
|
+
*
|
|
1379
|
+
* Usage example:
|
|
1380
|
+
* TinyHtml.animate(el, keyframes, TinyHtml.#fxSpeeds.fast);
|
|
1381
|
+
* TinyHtml.slideDown(el, TinyHtml.#fxSpeeds.slow);
|
|
1382
|
+
*
|
|
1383
|
+
* @type {Record<string, number | KeyframeAnimationOptions>}
|
|
1384
|
+
*/
|
|
1385
|
+
static "__#8@#styleFxSpeeds": Record<string, number | KeyframeAnimationOptions>;
|
|
1386
|
+
/**
|
|
1387
|
+
* Replace the predefined animation speeds.
|
|
1388
|
+
* @param {Record<string, number | KeyframeAnimationOptions>} speeds
|
|
1389
|
+
* @throws {TypeError} If input is not a valid object of speed definitions.
|
|
1390
|
+
*/
|
|
1391
|
+
static set styleFxSpeeds(speeds: Record<string, number | KeyframeAnimationOptions>);
|
|
1392
|
+
/**
|
|
1393
|
+
* Get a cloned copy of predefined animation speeds.
|
|
1394
|
+
* @returns {Record<string, number | KeyframeAnimationOptions>}
|
|
1395
|
+
*/
|
|
1396
|
+
static get styleFxSpeeds(): Record<string, number | KeyframeAnimationOptions>;
|
|
1397
|
+
/**
|
|
1398
|
+
* Get a predefined animation speed by name.
|
|
1399
|
+
*
|
|
1400
|
+
* @param {string} name - The name of the speed entry.
|
|
1401
|
+
* @returns {number | KeyframeAnimationOptions | undefined} A cloned value of the speed entry, or undefined if not found.
|
|
1402
|
+
*/
|
|
1403
|
+
static getStyleFxSpeed(name: string): number | KeyframeAnimationOptions | undefined;
|
|
1404
|
+
/**
|
|
1405
|
+
* Set or overwrite a predefined animation speed.
|
|
1406
|
+
*
|
|
1407
|
+
* @param {string} name - The name of the speed entry.
|
|
1408
|
+
* @param {number | KeyframeAnimationOptions} value - The value to store.
|
|
1409
|
+
* @throws {TypeError} If value is not a number or KeyframeAnimationOptions object.
|
|
1410
|
+
*/
|
|
1411
|
+
static setStyleFxSpeed(name: string, value: number | KeyframeAnimationOptions): void;
|
|
1412
|
+
/**
|
|
1413
|
+
* Delete a predefined animation speed by name.
|
|
1414
|
+
*
|
|
1415
|
+
* @param {string} name - The name of the speed entry to delete.
|
|
1416
|
+
* @returns {boolean} True if the property was deleted, false otherwise.
|
|
1417
|
+
*/
|
|
1418
|
+
static deleteStyleFxSpeed(name: string): boolean;
|
|
1419
|
+
/**
|
|
1420
|
+
* Check if a predefined animation speed exists.
|
|
1421
|
+
*
|
|
1422
|
+
* @param {string} name - The name of the speed entry to check.
|
|
1423
|
+
* @returns {boolean} True if the speed entry exists, false otherwise.
|
|
1424
|
+
*/
|
|
1425
|
+
static hasStyleFxSpeed(name: string): boolean;
|
|
1426
|
+
/**
|
|
1427
|
+
* CSS expansion shorthand used by genStyleFx to include margin/padding values.
|
|
1428
|
+
* @typedef {['Top', 'Right', 'Bottom', 'Left']}
|
|
1429
|
+
*/
|
|
1430
|
+
static "__#8@#cssExpand": string[];
|
|
1431
|
+
/**
|
|
1432
|
+
* Generate shortcuts
|
|
1433
|
+
* @type {Record<string, StyleEffects>}
|
|
1434
|
+
*/
|
|
1435
|
+
static "__#8@#styleEffects": Record<string, StyleEffects>;
|
|
1436
|
+
/**
|
|
1437
|
+
* Replace the entire styleEffects map with a new one.
|
|
1438
|
+
*
|
|
1439
|
+
* @param {Record<string, StyleEffects>} value
|
|
1440
|
+
*/
|
|
1441
|
+
static set styleEffects(value: Record<string, StyleEffects>);
|
|
1442
|
+
/**
|
|
1443
|
+
* Returns a deep-cloned copy of the registered style effects.
|
|
1444
|
+
*
|
|
1445
|
+
* @returns {Record<string, StyleEffects>}
|
|
1446
|
+
*/
|
|
1447
|
+
static get styleEffects(): Record<string, StyleEffects>;
|
|
1448
|
+
/**
|
|
1449
|
+
* Get a deep-cloned style effect by name.
|
|
1450
|
+
* @param {string} name
|
|
1451
|
+
* @returns {StyleEffects|undefined}
|
|
1452
|
+
*/
|
|
1453
|
+
static getStyleEffect(name: string): StyleEffects | undefined;
|
|
1454
|
+
/**
|
|
1455
|
+
* Set or replace a style effect.
|
|
1456
|
+
* @param {string} name
|
|
1457
|
+
* @param {StyleEffects} value
|
|
1458
|
+
*/
|
|
1459
|
+
static setStyleEffect(name: string, value: StyleEffects): void;
|
|
1460
|
+
/**
|
|
1461
|
+
* Delete a style effect.
|
|
1462
|
+
* @param {string} name
|
|
1463
|
+
* @returns {boolean} True if deleted.
|
|
1464
|
+
*/
|
|
1465
|
+
static deleteStyleEffect(name: string): boolean;
|
|
1466
|
+
/**
|
|
1467
|
+
* Check if a style effect exists.
|
|
1468
|
+
* @param {string} name
|
|
1469
|
+
* @returns {boolean}
|
|
1470
|
+
*/
|
|
1471
|
+
static hasStyleEffect(name: string): boolean;
|
|
1472
|
+
/**
|
|
1473
|
+
* Style Effect Inverse Values
|
|
1474
|
+
* @type {Record<string, string>}
|
|
1475
|
+
*/
|
|
1476
|
+
static "__#8@#styleEffectInverse": Record<string, string>;
|
|
1477
|
+
/**
|
|
1478
|
+
* Replace the style inverse values.
|
|
1479
|
+
* @param {Record<string, string>} values
|
|
1480
|
+
* @throws {TypeError} If not a valid object with functions as values.
|
|
1481
|
+
*/
|
|
1482
|
+
static set styleEffectInverse(values: Record<string, string>);
|
|
1483
|
+
/**
|
|
1484
|
+
* Get a cloned copy of style inverse values.
|
|
1485
|
+
* @returns {Record<string, string>}
|
|
1486
|
+
*/
|
|
1487
|
+
static get styleEffectInverse(): Record<string, string>;
|
|
1488
|
+
/**
|
|
1489
|
+
* Get a registered inverse values.
|
|
1490
|
+
*
|
|
1491
|
+
* @param {string} name - The detector name.
|
|
1492
|
+
* @returns {string | null} The value if found, otherwise undefined.
|
|
1493
|
+
*/
|
|
1494
|
+
static getStyleEffectInverse(name: string): string | null;
|
|
1495
|
+
/**
|
|
1496
|
+
* Register or overwrite a inverse value.
|
|
1497
|
+
*
|
|
1498
|
+
* @param {string} name - The detector name.
|
|
1499
|
+
* @param {string} value - The inverse value.
|
|
1500
|
+
* @throws {TypeError} If fn is not a string.
|
|
1501
|
+
*/
|
|
1502
|
+
static setStyleEffectInverse(name: string, value: string): void;
|
|
1503
|
+
/**
|
|
1504
|
+
* Delete a inverse value by name.
|
|
1505
|
+
*
|
|
1506
|
+
* @param {string} name - The inverse value name to delete.
|
|
1507
|
+
* @returns {boolean} True if deleted, false otherwise.
|
|
1508
|
+
*/
|
|
1509
|
+
static deleteStyleEffectInverse(name: string): boolean;
|
|
1510
|
+
/**
|
|
1511
|
+
* Check if a inverse value is registered.
|
|
1512
|
+
*
|
|
1513
|
+
* @param {string} name - The inverse value name to check.
|
|
1514
|
+
* @returns {boolean} True if registered, false otherwise.
|
|
1515
|
+
*/
|
|
1516
|
+
static hasStyleEffectInverse(name: string): boolean;
|
|
1517
|
+
/**
|
|
1518
|
+
* Style Effect Repeat Detector
|
|
1519
|
+
* @type {Record<string, StyleEffectsRdFn>}
|
|
1520
|
+
*/
|
|
1521
|
+
static "__#8@#styleEffectsRd": Record<string, StyleEffectsRdFn>;
|
|
1522
|
+
/**
|
|
1523
|
+
* Replace the style effects repeat detectors.
|
|
1524
|
+
* @param {Record<string, StyleEffectsRdFn>} detectors
|
|
1525
|
+
* @throws {TypeError} If not a valid object with functions as values.
|
|
1526
|
+
*/
|
|
1527
|
+
static set styleEffectsRd(detectors: Record<string, StyleEffectsRdFn>);
|
|
1528
|
+
/**
|
|
1529
|
+
* Get a cloned copy of style effects repeat detectors.
|
|
1530
|
+
* @returns {Record<string, StyleEffectsRdFn>}
|
|
1531
|
+
*/
|
|
1532
|
+
static get styleEffectsRd(): Record<string, StyleEffectsRdFn>;
|
|
1533
|
+
/**
|
|
1534
|
+
* Get a registered repeat detector function by name.
|
|
1535
|
+
*
|
|
1536
|
+
* @param {string} name - The detector name.
|
|
1537
|
+
* @returns {StyleEffectsRdFn | null} The function if found, otherwise undefined.
|
|
1538
|
+
*/
|
|
1539
|
+
static getStyleEffectRd(name: string): StyleEffectsRdFn | null;
|
|
1540
|
+
/**
|
|
1541
|
+
* Register or overwrite a repeat detector function.
|
|
1542
|
+
*
|
|
1543
|
+
* @param {string} name - The detector name.
|
|
1544
|
+
* @param {StyleEffectsRdFn} fn - The detector function.
|
|
1545
|
+
* @throws {TypeError} If fn is not a function.
|
|
1546
|
+
*/
|
|
1547
|
+
static setStyleEffectRd(name: string, fn: StyleEffectsRdFn): void;
|
|
1548
|
+
/**
|
|
1549
|
+
* Delete a repeat detector function by name.
|
|
1550
|
+
*
|
|
1551
|
+
* @param {string} name - The detector name to delete.
|
|
1552
|
+
* @returns {boolean} True if deleted, false otherwise.
|
|
1553
|
+
*/
|
|
1554
|
+
static deleteStyleEffectRd(name: string): boolean;
|
|
1555
|
+
/**
|
|
1556
|
+
* Check if a repeat detector function is registered.
|
|
1557
|
+
*
|
|
1558
|
+
* @param {string} name - The detector name to check.
|
|
1559
|
+
* @returns {boolean} True if registered, false otherwise.
|
|
1560
|
+
*/
|
|
1561
|
+
static hasStyleEffectRd(name: string): boolean;
|
|
1562
|
+
/**
|
|
1563
|
+
* Effect property handlers for show, hide, and toggle.
|
|
1564
|
+
* Each function builds keyframes depending on the property being animated.
|
|
1565
|
+
*
|
|
1566
|
+
* @type {StyleEffectsProps}
|
|
1567
|
+
*/
|
|
1568
|
+
static "__#8@#styleEffectsProps": StyleEffectsProps;
|
|
1569
|
+
/**
|
|
1570
|
+
* Replace the entire styleEffectsProps map with a new one.
|
|
1571
|
+
*
|
|
1572
|
+
* @param {StyleEffectsProps} value
|
|
1573
|
+
*/
|
|
1574
|
+
static set styleEffectsProps(value: StyleEffectsProps);
|
|
1575
|
+
/**
|
|
1576
|
+
* Returns a shallow-cloned copy of the property effect handlers.
|
|
1577
|
+
*
|
|
1578
|
+
* @returns {StyleEffectsProps}
|
|
1579
|
+
*/
|
|
1580
|
+
static get styleEffectsProps(): StyleEffectsProps;
|
|
1581
|
+
/**
|
|
1582
|
+
* Get a style effect property handler by name.
|
|
1583
|
+
*
|
|
1584
|
+
* @param {string} name - The property handler name.
|
|
1585
|
+
* @returns {StyleEffectsFn | null} The handler function, or undefined if not found.
|
|
1586
|
+
*/
|
|
1587
|
+
static getStyleEffectProp(name: string): StyleEffectsFn | null;
|
|
1588
|
+
/**
|
|
1589
|
+
* Register or overwrite a style effect property handler.
|
|
1590
|
+
*
|
|
1591
|
+
* @param {string} name - The property handler name.
|
|
1592
|
+
* @param {StyleEffectsFn} fn - The handler function.
|
|
1593
|
+
* @throws {TypeError} If fn is not a function.
|
|
1594
|
+
*/
|
|
1595
|
+
static setStyleEffectProp(name: string, fn: StyleEffectsFn): void;
|
|
1596
|
+
/**
|
|
1597
|
+
* Delete a style effect property handler by name.
|
|
1598
|
+
*
|
|
1599
|
+
* @param {string} name - The property handler name to delete.
|
|
1600
|
+
* @returns {boolean} True if deleted, false otherwise.
|
|
1601
|
+
*/
|
|
1602
|
+
static deleteStyleEffectProp(name: string): boolean;
|
|
1603
|
+
/**
|
|
1604
|
+
* Check if a style effect property handler exists.
|
|
1605
|
+
*
|
|
1606
|
+
* @param {string} name - The property handler name to check.
|
|
1607
|
+
* @returns {boolean} True if the handler exists, false otherwise.
|
|
1608
|
+
*/
|
|
1609
|
+
static hasStyleEffectProp(name: string): boolean;
|
|
1610
|
+
/**
|
|
1611
|
+
* Generates effect parameters to create standard animations.
|
|
1612
|
+
*
|
|
1613
|
+
* @param {string} type - The effect type.
|
|
1614
|
+
* @param {boolean} [includeWidth=false] - Whether width (and opacity) should be included.
|
|
1615
|
+
* @returns {Record<string, string>} - A mapping of CSS properties to effect type.
|
|
1616
|
+
*/
|
|
1617
|
+
static genStyleFx(type: string, includeWidth?: boolean): Record<string, string>;
|
|
1618
|
+
/**
|
|
1619
|
+
* Applies style-based effects (slide, fade) to one or more elements.
|
|
1620
|
+
* Converts abstract effect definitions (e.g., `{ height: "show" }`)
|
|
1621
|
+
* into concrete Web Animations API keyframes.
|
|
1622
|
+
*
|
|
1623
|
+
* @param {TinyHtmlElement|TinyHtmlElement[]} el - A single element or an array of elements.
|
|
1624
|
+
* @param {string} id - The style effect id.
|
|
1625
|
+
* @param {StyleEffects} props - The style effect definition.
|
|
1626
|
+
* @param {number | KeyframeAnimationOptions | string} [ops] - Timing options.
|
|
1627
|
+
* @returns {StyleFxResult}
|
|
1628
|
+
*/
|
|
1629
|
+
static applyStyleFx(el: TinyHtmlElement | TinyHtmlElement[], id: string, props: StyleEffects, ops?: number | KeyframeAnimationOptions | string): StyleFxResult;
|
|
1630
|
+
/**
|
|
1631
|
+
* Get the current animation entry for a given element.
|
|
1632
|
+
* @param {HTMLElement} el - The target element.
|
|
1633
|
+
* @returns {string|null|undefined} Returns string or null to animation.
|
|
1634
|
+
*/
|
|
1635
|
+
static getCurrentAnimationId(el: HTMLElement): string | null | undefined;
|
|
1275
1636
|
/**
|
|
1276
1637
|
* Applies an animation to one or multiple TinyElement instances.
|
|
1277
1638
|
*
|
|
1278
|
-
*
|
|
1279
|
-
*
|
|
1280
|
-
*
|
|
1281
|
-
* @param {
|
|
1282
|
-
* @
|
|
1639
|
+
* If `cancelOldAnim` is true, any currently running animation on the same element
|
|
1640
|
+
* will be cancelled before the new one starts.
|
|
1641
|
+
*
|
|
1642
|
+
* @param {TinyHtmlElement|TinyHtmlElement[]} el - A single TinyElement or an array of TinyElements to animate.
|
|
1643
|
+
* @param {Keyframe[] | PropertyIndexedKeyframes | null} keyframes - Keyframes that define the animation.
|
|
1644
|
+
* @param {number | KeyframeAnimationOptions | string} [ops] - Timing or configuration options for the animation.
|
|
1645
|
+
* @param {string|null} [id] - The style effect id.
|
|
1646
|
+
* @param {boolean} [cancelOldAnim=TinyHtml.cancelOldStyleFx] - Whether to cancel previous animations on the same element.
|
|
1647
|
+
* @returns {Animation[]}
|
|
1648
|
+
*/
|
|
1649
|
+
static animate(el: TinyHtmlElement | TinyHtmlElement[], keyframes: Keyframe[] | PropertyIndexedKeyframes | null, ops?: number | KeyframeAnimationOptions | string, id?: string | null, cancelOldAnim?: boolean): Animation[];
|
|
1650
|
+
/**
|
|
1651
|
+
* Stops the current animation(s) on one or multiple TinyElement instances.
|
|
1652
|
+
*
|
|
1653
|
+
* If an animation is running on the element(s), it will be cancelled immediately.
|
|
1654
|
+
*
|
|
1655
|
+
* @param {TinyHtmlElement|TinyHtmlElement[]} el - A single TinyElement or an array of TinyElements.
|
|
1656
|
+
* @returns {boolean[]} The same element(s) provided as input, for chaining.
|
|
1657
|
+
*/
|
|
1658
|
+
static stop(el: TinyHtmlElement | TinyHtmlElement[]): boolean[];
|
|
1659
|
+
/**
|
|
1660
|
+
* Show animation (slideDown).
|
|
1661
|
+
* @param {TinyHtmlElement|TinyHtmlElement[]} el
|
|
1662
|
+
* @param {number | KeyframeAnimationOptions | string} [ops]
|
|
1663
|
+
* @returns {StyleFxResult}
|
|
1664
|
+
*/
|
|
1665
|
+
static slideDown(el: TinyHtmlElement | TinyHtmlElement[], ops?: number | KeyframeAnimationOptions | string): StyleFxResult;
|
|
1666
|
+
/**
|
|
1667
|
+
* Hide animation (slideUp).
|
|
1668
|
+
* @param {TinyHtmlElement|TinyHtmlElement[]} el
|
|
1669
|
+
* @param {number | KeyframeAnimationOptions | string} [ops]
|
|
1670
|
+
* @returns {StyleFxResult}
|
|
1671
|
+
*/
|
|
1672
|
+
static slideUp(el: TinyHtmlElement | TinyHtmlElement[], ops?: number | KeyframeAnimationOptions | string): StyleFxResult;
|
|
1673
|
+
/**
|
|
1674
|
+
* Toggle slide animation.
|
|
1675
|
+
* @param {TinyHtmlElement|TinyHtmlElement[]} el
|
|
1676
|
+
* @param {number | KeyframeAnimationOptions | string} [ops]
|
|
1677
|
+
* @returns {StyleFxResult}
|
|
1283
1678
|
*/
|
|
1284
|
-
static
|
|
1679
|
+
static slideToggle(el: TinyHtmlElement | TinyHtmlElement[], ops?: number | KeyframeAnimationOptions | string): StyleFxResult;
|
|
1680
|
+
/**
|
|
1681
|
+
* Fade in animation.
|
|
1682
|
+
* @param {TinyHtmlElement|TinyHtmlElement[]} el
|
|
1683
|
+
* @param {number | KeyframeAnimationOptions | string} [ops]
|
|
1684
|
+
* @returns {StyleFxResult}
|
|
1685
|
+
*/
|
|
1686
|
+
static fadeIn(el: TinyHtmlElement | TinyHtmlElement[], ops?: number | KeyframeAnimationOptions | string): StyleFxResult;
|
|
1687
|
+
/**
|
|
1688
|
+
* Fade out animation.
|
|
1689
|
+
* @param {TinyHtmlElement|TinyHtmlElement[]} el
|
|
1690
|
+
* @param {number | KeyframeAnimationOptions | string} [ops]
|
|
1691
|
+
* @returns {StyleFxResult}
|
|
1692
|
+
*/
|
|
1693
|
+
static fadeOut(el: TinyHtmlElement | TinyHtmlElement[], ops?: number | KeyframeAnimationOptions | string): StyleFxResult;
|
|
1694
|
+
/**
|
|
1695
|
+
* Fade toggle animation.
|
|
1696
|
+
* @param {TinyHtmlElement|TinyHtmlElement[]} el
|
|
1697
|
+
* @param {number | KeyframeAnimationOptions | string} [ops]
|
|
1698
|
+
* @returns {StyleFxResult}
|
|
1699
|
+
*/
|
|
1700
|
+
static fadeToggle(el: TinyHtmlElement | TinyHtmlElement[], ops?: number | KeyframeAnimationOptions | string): StyleFxResult;
|
|
1285
1701
|
/**
|
|
1286
1702
|
* Gets the offset of the element relative to the document.
|
|
1287
1703
|
* @param {TinyElement} el - Target element.
|
|
@@ -1794,6 +2210,20 @@ declare class TinyHtml<TinyHtmlT extends ConstructorElValues | ConstructorElValu
|
|
|
1794
2210
|
* @returns {boolean}
|
|
1795
2211
|
*/
|
|
1796
2212
|
static hasExactEventListener(el: TinyEventTarget, event: string, handler: EventListenerOrEventListenerObject): boolean;
|
|
2213
|
+
/**
|
|
2214
|
+
* Hover event shortcut.
|
|
2215
|
+
*
|
|
2216
|
+
* Adds `mouseenter` and `mouseleave` event listeners to the target.
|
|
2217
|
+
*
|
|
2218
|
+
* @template {TinyEventTarget|TinyEventTarget[]} T
|
|
2219
|
+
* @param {T} el - The target element(s) to attach the hover handlers.
|
|
2220
|
+
* @param {HoverEventCallback} fnOver - Callback executed when the mouse enters the target.
|
|
2221
|
+
* @param {HoverEventCallback|null} [fnOut] - Optional callback executed when the mouse leaves
|
|
2222
|
+
* the target. If not provided, `fnOver` will be used for both events.
|
|
2223
|
+
* @param {EventRegistryOptions} [options] - Optional event listener options.
|
|
2224
|
+
* @returns {T}
|
|
2225
|
+
*/
|
|
2226
|
+
static hover<T extends TinyEventTarget | TinyEventTarget[]>(el: T, fnOver: HoverEventCallback, fnOut?: HoverEventCallback | null, options?: EventRegistryOptions): T;
|
|
1797
2227
|
/**
|
|
1798
2228
|
* Registers an event listener on the specified element.
|
|
1799
2229
|
*
|
|
@@ -1866,7 +2296,7 @@ declare class TinyHtml<TinyHtmlT extends ConstructorElValues | ConstructorElValu
|
|
|
1866
2296
|
*
|
|
1867
2297
|
* @type {Record<string | symbol, string>}
|
|
1868
2298
|
*/
|
|
1869
|
-
static "__#
|
|
2299
|
+
static "__#8@#propFix": Record<string | symbol, string>;
|
|
1870
2300
|
/**
|
|
1871
2301
|
* Public proxy for normalized DOM property names.
|
|
1872
2302
|
*
|
|
@@ -1911,14 +2341,14 @@ declare class TinyHtml<TinyHtmlT extends ConstructorElValues | ConstructorElValu
|
|
|
1911
2341
|
*/
|
|
1912
2342
|
static attr(el: TinyElement, name: string): string | null;
|
|
1913
2343
|
/**
|
|
1914
|
-
* Set
|
|
2344
|
+
* Set one or multiple attributes on an element.
|
|
1915
2345
|
* @template {TinyElement|TinyElement[]} T
|
|
1916
|
-
* @param {T} el
|
|
1917
|
-
* @param {string} name
|
|
1918
|
-
* @param {string|null} [value=null]
|
|
2346
|
+
* @param {T} el - Target element(s).
|
|
2347
|
+
* @param {string|Record<string, string|null>} name - Attribute name or an object of attributes.
|
|
2348
|
+
* @param {string|null} [value=null] - Attribute value (ignored if "name" is an object).
|
|
1919
2349
|
* @returns {T}
|
|
1920
2350
|
*/
|
|
1921
|
-
static setAttr<T extends TinyElement | TinyElement[]>(el: T, name: string, value?: string | null): T;
|
|
2351
|
+
static setAttr<T extends TinyElement | TinyElement[]>(el: T, name: string | Record<string, string | null>, value?: string | null): T;
|
|
1922
2352
|
/**
|
|
1923
2353
|
* Remove attribute(s) from an element.
|
|
1924
2354
|
* @template {TinyElement|TinyElement[]} T
|
|
@@ -1942,30 +2372,30 @@ declare class TinyHtml<TinyHtmlT extends ConstructorElValues | ConstructorElValu
|
|
|
1942
2372
|
*/
|
|
1943
2373
|
static hasProp(el: TinyElement, name: string): boolean;
|
|
1944
2374
|
/**
|
|
1945
|
-
* Set
|
|
2375
|
+
* Set one or multiple properties on an element.
|
|
1946
2376
|
* @template {TinyElement|TinyElement[]} T
|
|
1947
|
-
* @param {T} el
|
|
1948
|
-
* @param {string} name
|
|
2377
|
+
* @param {T} el - Target element(s).
|
|
2378
|
+
* @param {...string} names - Property name(s).
|
|
1949
2379
|
* @returns {T}
|
|
1950
2380
|
*/
|
|
1951
|
-
static addProp<T extends TinyElement | TinyElement[]>(el: T,
|
|
2381
|
+
static addProp<T extends TinyElement | TinyElement[]>(el: T, ...names: string[]): T;
|
|
1952
2382
|
/**
|
|
1953
|
-
* Remove
|
|
2383
|
+
* Remove one or multiple properties from an element.
|
|
1954
2384
|
* @template {TinyElement|TinyElement[]} T
|
|
1955
|
-
* @param {T} el
|
|
1956
|
-
* @param {string} name
|
|
2385
|
+
* @param {T} el - Target element(s).
|
|
2386
|
+
* @param {...string} names - Property name(s).
|
|
1957
2387
|
* @returns {T}
|
|
1958
2388
|
*/
|
|
1959
|
-
static removeProp<T extends TinyElement | TinyElement[]>(el: T,
|
|
2389
|
+
static removeProp<T extends TinyElement | TinyElement[]>(el: T, ...names: string[]): T;
|
|
1960
2390
|
/**
|
|
1961
|
-
* Toggle
|
|
2391
|
+
* Toggle one or multiple boolean properties.
|
|
1962
2392
|
* @template {TinyElement|TinyElement[]} T
|
|
1963
|
-
* @param {T} el
|
|
1964
|
-
* @param {string} name
|
|
1965
|
-
* @param {boolean} [force]
|
|
2393
|
+
* @param {T} el - Target element(s).
|
|
2394
|
+
* @param {string|string[]} name - Property name or a list of property names.
|
|
2395
|
+
* @param {boolean} [force] - Force true/false instead of toggling.
|
|
1966
2396
|
* @returns {T}
|
|
1967
2397
|
*/
|
|
1968
|
-
static toggleProp<T extends TinyElement | TinyElement[]>(el: T, name: string, force?: boolean): T;
|
|
2398
|
+
static toggleProp<T extends TinyElement | TinyElement[]>(el: T, name: string | string[], force?: boolean): T;
|
|
1969
2399
|
/**
|
|
1970
2400
|
* Removes an element from the DOM.
|
|
1971
2401
|
* @template {TinyElement|TinyElement[]} T
|
|
@@ -2574,14 +3004,72 @@ declare class TinyHtml<TinyHtmlT extends ConstructorElValues | ConstructorElValu
|
|
|
2574
3004
|
* @returns {number}
|
|
2575
3005
|
*/
|
|
2576
3006
|
outerWidth(includeMargin?: boolean): number;
|
|
3007
|
+
/**
|
|
3008
|
+
* Applies style-based effects (slide, fade) to one or more elements.
|
|
3009
|
+
* Converts abstract effect definitions (e.g., `{ height: "show" }`)
|
|
3010
|
+
* into concrete Web Animations API keyframes.
|
|
3011
|
+
*
|
|
3012
|
+
* @param {string} id - The style effect id.
|
|
3013
|
+
* @param {StyleEffects} props - The style effect definition.
|
|
3014
|
+
* @param {number | KeyframeAnimationOptions} [ops] - Timing options.
|
|
3015
|
+
* @returns {StyleFxResult}
|
|
3016
|
+
*/
|
|
3017
|
+
applyStyleFx(id: string, props: StyleEffects, ops?: number | KeyframeAnimationOptions): StyleFxResult;
|
|
2577
3018
|
/**
|
|
2578
3019
|
* Applies an animation to one or multiple TinyElement instances.
|
|
2579
3020
|
*
|
|
2580
|
-
*
|
|
2581
|
-
*
|
|
2582
|
-
*
|
|
3021
|
+
* If `cancelOldAnim` is true, any currently running animation on the same element
|
|
3022
|
+
* will be cancelled before the new one starts.
|
|
3023
|
+
*
|
|
3024
|
+
* @param {Keyframe[] | PropertyIndexedKeyframes | null} keyframes - Keyframes that define the animation.
|
|
3025
|
+
* @param {number | KeyframeAnimationOptions | string} [ops] - Timing or configuration options for the animation.
|
|
3026
|
+
* @param {string|null} [id] - The style effect id.
|
|
3027
|
+
* @param {boolean} [cancelOldAnim=TinyHtml.cancelOldStyleFx] - Whether to cancel previous animations on the same element.
|
|
3028
|
+
* @returns {Animation[]}
|
|
3029
|
+
*/
|
|
3030
|
+
animate(keyframes: Keyframe[] | PropertyIndexedKeyframes | null, ops?: number | KeyframeAnimationOptions | string, id?: string | null, cancelOldAnim?: boolean): Animation[];
|
|
3031
|
+
/**
|
|
3032
|
+
* Stops the current animation(s) on this TinyElement instance.
|
|
3033
|
+
*
|
|
3034
|
+
* @returns {boolean[]}
|
|
3035
|
+
*/
|
|
3036
|
+
stop(): boolean[];
|
|
3037
|
+
/**
|
|
3038
|
+
* Show animation (slideDown).
|
|
3039
|
+
* @param {number | KeyframeAnimationOptions | string} [ops]
|
|
3040
|
+
* @returns {StyleFxResult}
|
|
3041
|
+
*/
|
|
3042
|
+
slideDown(ops?: number | KeyframeAnimationOptions | string): StyleFxResult;
|
|
3043
|
+
/**
|
|
3044
|
+
* Hide animation (slideUp).
|
|
3045
|
+
* @param {number | KeyframeAnimationOptions | string} [ops]
|
|
3046
|
+
* @returns {StyleFxResult}
|
|
3047
|
+
*/
|
|
3048
|
+
slideUp(ops?: number | KeyframeAnimationOptions | string): StyleFxResult;
|
|
3049
|
+
/**
|
|
3050
|
+
* Toggle slide animation.
|
|
3051
|
+
* @param {number | KeyframeAnimationOptions | string} [ops]
|
|
3052
|
+
* @returns {StyleFxResult}
|
|
3053
|
+
*/
|
|
3054
|
+
slideToggle(ops?: number | KeyframeAnimationOptions | string): StyleFxResult;
|
|
3055
|
+
/**
|
|
3056
|
+
* Fade in animation.
|
|
3057
|
+
* @param {number | KeyframeAnimationOptions | string} [ops]
|
|
3058
|
+
* @returns {StyleFxResult}
|
|
3059
|
+
*/
|
|
3060
|
+
fadeIn(ops?: number | KeyframeAnimationOptions | string): StyleFxResult;
|
|
3061
|
+
/**
|
|
3062
|
+
* Fade out animation.
|
|
3063
|
+
* @param {number | KeyframeAnimationOptions | string} [ops]
|
|
3064
|
+
* @returns {StyleFxResult}
|
|
3065
|
+
*/
|
|
3066
|
+
fadeOut(ops?: number | KeyframeAnimationOptions | string): StyleFxResult;
|
|
3067
|
+
/**
|
|
3068
|
+
* Fade toggle animation.
|
|
3069
|
+
* @param {number | KeyframeAnimationOptions | string} [ops]
|
|
3070
|
+
* @returns {StyleFxResult}
|
|
2583
3071
|
*/
|
|
2584
|
-
|
|
3072
|
+
fadeToggle(ops?: number | KeyframeAnimationOptions | string): StyleFxResult;
|
|
2585
3073
|
/**
|
|
2586
3074
|
* Gets the offset of the element relative to the document.
|
|
2587
3075
|
* @returns {{top: number, left: number}}
|
|
@@ -2929,6 +3417,18 @@ declare class TinyHtml<TinyHtmlT extends ConstructorElValues | ConstructorElValu
|
|
|
2929
3417
|
* @returns {boolean}
|
|
2930
3418
|
*/
|
|
2931
3419
|
hasExactEventListener(event: string, handler: EventListenerOrEventListenerObject): boolean;
|
|
3420
|
+
/**
|
|
3421
|
+
* Hover event shortcut.
|
|
3422
|
+
*
|
|
3423
|
+
* Adds `mouseenter` and `mouseleave` event listeners to the target.
|
|
3424
|
+
*
|
|
3425
|
+
* @param {HoverEventCallback} fnOver - Callback executed when the mouse enters the target.
|
|
3426
|
+
* @param {HoverEventCallback|null} [fnOut] - Optional callback executed when the mouse leaves
|
|
3427
|
+
* the target. If not provided, `fnOver` will be used for both events.
|
|
3428
|
+
* @param {EventRegistryOptions} [options] - Optional event listener options.
|
|
3429
|
+
* @returns {this}
|
|
3430
|
+
*/
|
|
3431
|
+
hover(fnOver: HoverEventCallback, fnOut?: HoverEventCallback | null, options?: EventRegistryOptions): this;
|
|
2932
3432
|
/**
|
|
2933
3433
|
* Registers an event listener on the specified element.
|
|
2934
3434
|
*
|
|
@@ -2986,12 +3486,12 @@ declare class TinyHtml<TinyHtmlT extends ConstructorElValues | ConstructorElValu
|
|
|
2986
3486
|
*/
|
|
2987
3487
|
attr(name: string): string | null;
|
|
2988
3488
|
/**
|
|
2989
|
-
* Set
|
|
2990
|
-
* @param {string} name
|
|
2991
|
-
* @param {string|null} [value=null]
|
|
3489
|
+
* Set one or multiple attributes on an element.
|
|
3490
|
+
* @param {string|Record<string, string|null>} name - Attribute name or an object of attributes.
|
|
3491
|
+
* @param {string|null} [value=null] - Attribute value (ignored if "name" is an object).
|
|
2992
3492
|
* @returns {this}
|
|
2993
3493
|
*/
|
|
2994
|
-
setAttr(name: string, value?: string | null): this;
|
|
3494
|
+
setAttr(name: string | Record<string, string | null>, value?: string | null): this;
|
|
2995
3495
|
/**
|
|
2996
3496
|
* Remove attribute(s) from an element.
|
|
2997
3497
|
* @param {string} name Space-separated list of attributes.
|
|
@@ -3012,23 +3512,23 @@ declare class TinyHtml<TinyHtmlT extends ConstructorElValues | ConstructorElValu
|
|
|
3012
3512
|
hasProp(name: string): boolean;
|
|
3013
3513
|
/**
|
|
3014
3514
|
* Set a property on an element.
|
|
3015
|
-
* @param {string} name
|
|
3515
|
+
* @param {...string} names - Property name(s).
|
|
3016
3516
|
* @returns {this}
|
|
3017
3517
|
*/
|
|
3018
|
-
addProp(
|
|
3518
|
+
addProp(...names: string[]): this;
|
|
3019
3519
|
/**
|
|
3020
3520
|
* Remove a property from an element.
|
|
3021
|
-
* @param {string} name
|
|
3521
|
+
* @param {...string} names - Property name(s).
|
|
3022
3522
|
* @returns {this}
|
|
3023
3523
|
*/
|
|
3024
|
-
removeProp(
|
|
3524
|
+
removeProp(...names: string[]): this;
|
|
3025
3525
|
/**
|
|
3026
|
-
* Toggle
|
|
3027
|
-
* @param {string} name
|
|
3028
|
-
* @param {boolean} [force]
|
|
3526
|
+
* Toggle one or multiple boolean properties.
|
|
3527
|
+
* @param {string|string[]} name - Property name or a list of property names.
|
|
3528
|
+
* @param {boolean} [force] - Force true/false instead of toggling.
|
|
3029
3529
|
* @returns {this}
|
|
3030
3530
|
*/
|
|
3031
|
-
toggleProp(name: string, force?: boolean): this;
|
|
3531
|
+
toggleProp(name: string | string[], force?: boolean): this;
|
|
3032
3532
|
/**
|
|
3033
3533
|
* Removes the element from the DOM.
|
|
3034
3534
|
* @returns {this}
|
|
@@ -3131,4 +3631,5 @@ declare class TinyHtml<TinyHtmlT extends ConstructorElValues | ConstructorElValu
|
|
|
3131
3631
|
#private;
|
|
3132
3632
|
}
|
|
3133
3633
|
import * as TinyCollision from '../basics/collision.mjs';
|
|
3634
|
+
import TinyElementObserver from './TinyElementObserver.mjs';
|
|
3134
3635
|
//# sourceMappingURL=TinyHtml.d.mts.map
|