tiny-essentials 1.21.10 โ†’ 1.22.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (40) hide show
  1. package/.vscode/extensions.json +30 -0
  2. package/.vscode/settings.json +53 -0
  3. package/LICENSE +160 -669
  4. package/dist/v1/TinyBasicsEs.min.js +1 -1
  5. package/dist/v1/TinyDragger.min.js +1 -1
  6. package/dist/v1/TinyElementObserver.min.js +1 -0
  7. package/dist/v1/TinyEssentials.min.js +1 -1
  8. package/dist/v1/TinyHtml.min.js +1 -1
  9. package/dist/v1/TinySmartScroller.min.js +1 -1
  10. package/dist/v1/TinyUploadClicker.min.js +1 -1
  11. package/dist/v1/basics/array.cjs +12 -0
  12. package/dist/v1/basics/array.d.mts +9 -0
  13. package/dist/v1/basics/array.mjs +10 -0
  14. package/dist/v1/basics/index.cjs +2 -0
  15. package/dist/v1/basics/index.d.mts +3 -1
  16. package/dist/v1/basics/index.mjs +3 -3
  17. package/dist/v1/basics/text.cjs +44 -9
  18. package/dist/v1/basics/text.d.mts +14 -2
  19. package/dist/v1/basics/text.mjs +38 -9
  20. package/dist/v1/build/TinyElementObserver.cjs +7 -0
  21. package/dist/v1/build/TinyElementObserver.d.mts +3 -0
  22. package/dist/v1/build/TinyElementObserver.mjs +2 -0
  23. package/dist/v1/index.cjs +4 -0
  24. package/dist/v1/index.d.mts +4 -1
  25. package/dist/v1/index.mjs +4 -3
  26. package/dist/v1/libs/TinyElementObserver.cjs +292 -0
  27. package/dist/v1/libs/TinyElementObserver.d.mts +154 -0
  28. package/dist/v1/libs/TinyElementObserver.mjs +266 -0
  29. package/dist/v1/libs/TinyGamepad.d.mts +1 -1
  30. package/dist/v1/libs/TinyHtml.cjs +1418 -131
  31. package/dist/v1/libs/TinyHtml.d.mts +513 -12
  32. package/dist/v1/libs/TinyHtml.mjs +1129 -14
  33. package/dist/v1/libs/TinyInventory.d.mts +1 -1
  34. package/dist/v1/libs/UltraRandomMsgGen.d.mts +7 -7
  35. package/docs/v1/README.md +1 -0
  36. package/docs/v1/basics/array.md +20 -0
  37. package/docs/v1/basics/text.md +38 -7
  38. package/docs/v1/libs/TinyElementObserver.md +107 -0
  39. package/docs/v1/libs/TinyHtml.md +797 -3
  40. package/package.json +2 -2
@@ -16,6 +16,55 @@ TinyHtml.createElement('div')
16
16
 
17
17
  This design keeps your code concise while maintaining clarity and control over the DOM structure.
18
18
 
19
+ ## ๐Ÿ“‘ Table of Contents
20
+
21
+ - [๐Ÿงฉ Type Definitions โ€“ Core Building Blocks](#-type-definitions--core-building-blocks)
22
+ - [๐Ÿ”จ Element Creation](#-element-creation)
23
+ - [๐Ÿ”Ž Static DOM Selectors](#-static-dom-selectors)
24
+ - [๐Ÿ” Element Observer](#-element-observer)
25
+ - [๐Ÿ“‘ HTML Parser](#-html-parser)
26
+ - [๐Ÿงฉ Internal Element Access](#-internal-element-access)
27
+ - [๐Ÿ› ๏ธ Static Pre-Validation Utilities](#-static-pre-validation-utilities)
28
+ - [๐Ÿ” Conversion Helpers](#-conversion-helpers)
29
+ - [๐Ÿงน Element Filtering & Matching](#-element-filtering--matching)
30
+ - [๐Ÿ’พ Element Data Store](#-element-data-store)
31
+ - [๐Ÿ”„ DOM Traversal Methods](#-dom-traversal-methods)
32
+ - [๐Ÿงฑ DOM Manipulation](#-dom-manipulation)
33
+ - [๐Ÿงฎ Easing Functions](#-easing-functions)
34
+ - [๐Ÿงญ Smooth Scrolling](#-smooth-scrolling)
35
+ - [โš™๏ธ Internal Scroll Mechanism](#-internal-scroll-mechanism)
36
+ - [๐Ÿ“ Dimensions (Size API)](#-dimensions-size-api)
37
+ - [๐Ÿ“Œ Position, Scroll & Box Spacing](#-position-scroll--box-spacing)
38
+ - [๐ŸŽจ Class Manipulation](#-class-manipulation)
39
+ - [๐Ÿ“„ Content & Element Info](#-content--element-info)
40
+ - [๐ŸŽ›๏ธ Form Value Handling & Input Hooks](#-form-value-handling--input-hooks)
41
+ - [๐ŸŽ‰ Event Handling](#-event-handling)
42
+ - [๐Ÿงฌ Attribute & Property Manipulation](#-attribute--property-manipulation)
43
+ - [๐Ÿ› ๏ธ Element Utilities](#-element-utilities)
44
+ - [๐Ÿ“ฆ Collision Detection](#-collision-detection)
45
+ - [๐Ÿ” Collision Locking System](#-collision-locking-system)
46
+ - [๐Ÿงผ Collision Lock Reset](#-collision-lock-reset)
47
+ - [๐Ÿ‘๏ธ Viewport Detection](#-viewport-detection)
48
+ - [๐Ÿง  Property Name Normalization](#-property-name-normalization)
49
+ - [๐Ÿ” Attribute โ†” Property Mapping](#-attribute--property-mapping)
50
+ - [๐ŸŽจ CSS Property Aliases (`cssPropAliases`)](#-css-property-aliases-csspropaliases)
51
+ - [โœ‚๏ธ Utility Functions](#-utility-functions)
52
+ - [๐Ÿงฉ Style Methods](#-style-methods)
53
+ - [๐Ÿงช Reading Computed Styles](#-reading-computed-styles)
54
+ - [๐ŸŽฌ Animate Stuff](#-animate-stuff)
55
+ - [๐ŸŽฌ Animate DOM (Data)](#-animate-dom-data)
56
+ - [โน Animate DOM (cancelOldStyleFx)](#-animate-dom-canceloldstylefx)
57
+ - [โฑ Animate DOM (styleFxSpeeds)](#-animate-dom-stylefxspeeds)
58
+ - [๐ŸŽจ Animate DOM (styleEffects)](#-animate-dom-styleeffects)
59
+ - [๐Ÿ”„ Animate DOM (styleEffectInverse)](#-animate-dom-styleeffectinverse)
60
+ - [๐Ÿ” Animate DOM (styleEffectsRd)](#-animate-dom-styleeffectsrd)
61
+ - [๐Ÿงฉ Animate DOM (styleEffectsProps)](#-animate-dom-styleeffectsprops)
62
+ - [๐ŸŽจ Style FX Manager](#-style-fx-manager)
63
+ - [โœจ Animate FXs](#-animate-fxs)
64
+ - [๐Ÿ–ฑ๏ธ Focus & Blur](#-focus--blur)
65
+ - [๐ŸŒ Window Scroll & Viewport Helpers](#-window-scroll--viewport-helpers)
66
+
67
+ ---
19
68
 
20
69
  ## ๐Ÿงฉ Type Definitions โ€“ Core Building Blocks
21
70
 
@@ -310,6 +359,172 @@ HTMLInputElement | HTMLSelectElement | HTMLTextAreaElement | HTMLOptionElement
310
359
 
311
360
  ---
312
361
 
362
+ ### ๐Ÿ’พ Internal Animation Storage
363
+
364
+ ```ts
365
+ /**
366
+ * Internal storage for animation-related data, associated with elements.
367
+ * Used to remember original dimensions (height/width) and other properties
368
+ * so that animations like `slideUp` and `slideDown` can restore or continue
369
+ * smoothly, mimicking jQuery's behavior.
370
+ *
371
+ * Each element is mapped to a plain object with keys such as `origHeight`,
372
+ * `origWidth`, etc.
373
+ *
374
+ * @type {WeakMap<HTMLElement, Record<string, string|number>>}
375
+ */
376
+ const __elementAnimateData = new WeakMap();
377
+ ```
378
+
379
+ * **Purpose:** Tracks original dimensions and properties of elements for smooth animations.
380
+ * **Type:** `WeakMap<HTMLElement, Record<string, string | number>>`
381
+ * **Notes:** Uses a `WeakMap` so that memory is automatically freed when elements are removed from the DOM.
382
+
383
+ ---
384
+
385
+ ### ๐ŸŽฌ Active Animation Tracking
386
+
387
+ ```ts
388
+ /**
389
+ * Stores the currently active animation for each element,
390
+ * allowing cancellation or replacement of ongoing animations.
391
+ *
392
+ * @type {WeakMap<HTMLElement, { animation: Animation, id: string }>}
393
+ */
394
+ const __elementCurrentAnimation = new WeakMap();
395
+ ```
396
+
397
+ * **Purpose:** Keeps track of the active animation per element.
398
+ * **Type:** `WeakMap<HTMLElement, { animation: Animation, id: string }>`
399
+ * **Notes:** Useful for stopping or replacing animations mid-flight.
400
+
401
+ ---
402
+
403
+ ### โœจ Style Effects Definitions
404
+
405
+ ```ts
406
+ /**
407
+ * Mapping of animation shortcuts to their effect definitions.
408
+ * Similar to jQuery's predefined effects (slideDown, fadeIn, etc.).
409
+ *
410
+ * @typedef {Record<string, string|(string|number)[]>} StyleEffects
411
+ */
412
+ ```
413
+
414
+ * **Purpose:** Defines reusable animation shortcuts.
415
+ * **Example:** `"fadeIn": ["opacity", 0, 1]`
416
+
417
+ ---
418
+
419
+ ### ๐Ÿ–ฑ๏ธ Hover Event Callback
420
+
421
+ ```ts
422
+ /**
423
+ * Callback function used for hover events.
424
+ * @callback HoverEventCallback
425
+ * @param {MouseEvent} ev - The mouse event triggered on enter or leave.
426
+ * @returns {void} Returns nothing.
427
+ */
428
+ ```
429
+
430
+ * **Purpose:** Defines the expected signature for hover event callbacks.
431
+ * **Parameters:** `MouseEvent ev`
432
+ * **Returns:** `void`
433
+
434
+ ---
435
+
436
+ ### ๐Ÿƒ Active Style Animation Collection
437
+
438
+ ```ts
439
+ /**
440
+ * Represents a collection of active style-based animations.
441
+ *
442
+ * Each HTMLElement is associated with an array of its currently running
443
+ * `Animation` objects (from the Web Animations API).
444
+ *
445
+ * @typedef {Map<HTMLElement, Animation|null>} StyleFxResult
446
+ */
447
+ ```
448
+
449
+ * **Purpose:** Tracks currently running Web Animations per element.
450
+ * **Type:** `Map<HTMLElement, Animation|null>`
451
+
452
+ ---
453
+
454
+ ### ๐Ÿ“Š Animation Keyframe Data
455
+
456
+ ```ts
457
+ /**
458
+ * Represents a collection of animation keyframe data mapped by CSS property.
459
+ *
460
+ * - The **key** is the CSS property name (e.g. `"height"`, `"opacity"`).
461
+ * - The **value** is an array of values representing the start and end
462
+ * states of the property during the animation.
463
+ *
464
+ * @typedef {Record<string, (string|number)[]>} AnimationSfxData
465
+ */
466
+ ```
467
+
468
+ * **Purpose:** Stores start and end states of CSS properties for animations.
469
+ * **Type:** `Record<string, (string|number)[]>`
470
+
471
+ ---
472
+
473
+ ### ๐Ÿ” Style Effects Repeat Detector
474
+
475
+ ```ts
476
+ /**
477
+ * Function signature for style effects repeat detectors.
478
+ *
479
+ * @typedef {(effects: AnimationSfxData) => boolean} StyleEffectsRdFn
480
+ */
481
+ ```
482
+
483
+ * **Purpose:** Determines if a style effect should repeat.
484
+ * **Type:** `(effects: AnimationSfxData) => boolean`
485
+
486
+ ---
487
+
488
+ ### โšก Style Effect Property Handler
489
+
490
+ ```ts
491
+ /**
492
+ * Function signature for style effect property handlers.
493
+ *
494
+ * @typedef {(
495
+ * el: HTMLElement,
496
+ * keyframes: AnimationSfxData,
497
+ * prop: string,
498
+ * style: CSSStyleDeclaration
499
+ * ) => void} StyleEffectsFn
500
+ */
501
+ ```
502
+
503
+ * **Purpose:** Handles applying keyframe data to a specific CSS property on an element.
504
+ * **Parameters:**
505
+
506
+ * `el: HTMLElement` โ€“ target element
507
+ * `keyframes: AnimationSfxData` โ€“ property keyframes
508
+ * `prop: string` โ€“ CSS property
509
+ * `style: CSSStyleDeclaration` โ€“ inline style object
510
+
511
+ ---
512
+
513
+ ### ๐Ÿ› ๏ธ Style Effect Property Handlers Collection
514
+
515
+ ```ts
516
+ /**
517
+ * A collection of style effect property handlers.
518
+ *
519
+ * @typedef {Record<string, StyleEffectsFn>} StyleEffectsProps
520
+ */
521
+ ```
522
+
523
+ * **Purpose:** Groups multiple property handlers for different CSS properties.
524
+ * **Type:** `Record<string, StyleEffectsFn>`
525
+
526
+ ---
527
+
313
528
  ## ๐Ÿ”จ Element Creation
314
529
 
315
530
  ### `TinyHtml.createFrom(tagName, attrs?)`
@@ -445,6 +660,107 @@ Finds elements by tag name in a namespace (defaults to XHTML).
445
660
 
446
661
  ---
447
662
 
663
+ ## ๐Ÿ” Element Observer
664
+
665
+ ### โšก `autoStartElemObserver`
666
+
667
+ A **flag** that determines whether the internal element observer should automatically start when some library code initializes.
668
+
669
+ * **Type** ๐Ÿ”˜ โ€” `boolean`
670
+ * **Default** ๐Ÿ โ€” `true`
671
+
672
+ #### ๐Ÿ“ฅ Getter
673
+
674
+ ```js
675
+ TinyHtml.autoStartElemObserver; // returns true or false
676
+ ```
677
+
678
+ Returns the current state of the auto-start flag.
679
+
680
+ #### ๐Ÿ“ค Setter
681
+
682
+ ```js
683
+ TinyHtml.autoStartElemObserver = false;
684
+ ```
685
+
686
+ Updates the flag.
687
+ โš ๏ธ Throws a `TypeError` if the value is not a boolean.
688
+
689
+ ---
690
+
691
+ ### ๐Ÿ‘€ `tinyObserver`
692
+
693
+ The internal **[`TinyElementObserver`](./TinyElementObserver.md)** instance used by TinyHtml to track DOM changes.
694
+ It is configured to observe the **document root element** (`document.documentElement`) and comes with **built-in detectors** for **style** and **class** attribute changes.
695
+
696
+ * **Type** ๐Ÿ“ฆ โ€” `TinyElementObserver`
697
+
698
+ #### ๐Ÿ”ง Configuration
699
+
700
+ * **Target element**: `document.documentElement` (if available).
701
+ * **Detectors**:
702
+
703
+ * ๐ŸŽจ **Style Detector (`tinyStyleEvent`)**
704
+ Detects changes to inline styles (`style` attribute).
705
+
706
+ * Compares old vs new styles using `diffStrings`.
707
+ * Dispatches:
708
+
709
+ ```js
710
+ new CustomEvent('tinyhtml.stylechanged', { detail: changes })
711
+ ```
712
+ * ๐Ÿท๏ธ **Class Detector (`tinyClassEvent`)**
713
+ Detects changes to the `class` attribute.
714
+
715
+ * Compares old vs new classes using `diffArrayList`.
716
+ * Dispatches:
717
+
718
+ ```js
719
+ new CustomEvent('tinyhtml.classchanged', { detail: changes })
720
+ ```
721
+ * **Observer config** โš™๏ธ:
722
+
723
+ ```js
724
+ {
725
+ attributeOldValue: true,
726
+ attributes: true,
727
+ subtree: true,
728
+ attributeFilter: ['style', 'class']
729
+ }
730
+ ```
731
+
732
+ #### ๐Ÿ“ฅ Getter
733
+
734
+ ```js
735
+ const observer = TinyHtml.tinyObserver;
736
+ ```
737
+
738
+ Retrieves the internal `TinyElementObserver` instance.
739
+
740
+ ---
741
+
742
+ ### โœจ Example Usage
743
+
744
+ ```js
745
+ // Listen for style changes on any element in the document
746
+ document.addEventListener('tinyhtml.stylechanged', (e) => {
747
+ console.log('๐ŸŽจ Style changed:', e.detail);
748
+ });
749
+
750
+ // Listen for class changes
751
+ document.addEventListener('tinyhtml.classchanged', (e) => {
752
+ console.log('๐Ÿท๏ธ Class changed:', e.detail);
753
+ });
754
+
755
+ // Disable auto-start (if needed)
756
+ TinyHtml.autoStartElemObserver = false;
757
+
758
+ // Manually start the observer
759
+ TinyHtml.tinyObserver.start();
760
+ ```
761
+
762
+ ---
763
+
448
764
  ## ๐Ÿ“‘ HTML Parser
449
765
 
450
766
  ### Type Definition
@@ -1144,9 +1460,6 @@ This API set focuses on **measuring element offsets**, **scroll positions**, and
1144
1460
 
1145
1461
  ### ๐Ÿ“ Element Positioning
1146
1462
 
1147
- #### `.animate(keyframes, ops?)` / `TinyHtml.animate(el, keyframes, ops?)`
1148
- Applies an animation to one or more TinyElement instances using the Web Animations API.
1149
-
1150
1463
  #### `.offset()` / `TinyHtml.offset(el)`
1151
1464
  Returns the coordinates `{ top, left }` of the element **relative to the document**.
1152
1465
 
@@ -1669,6 +1982,34 @@ TinyHtml.hasExactEventListener(el, "click", onClick);
1669
1982
 
1670
1983
  ---
1671
1984
 
1985
+ ### ๐Ÿญ `hover()`
1986
+
1987
+ Hover Event Shortcut
1988
+
1989
+ ```js
1990
+ element.hover(
1991
+ (e) => console.log("Mouse entered!"),
1992
+ (e) => console.log("Mouse left!")
1993
+ );
1994
+ ```
1995
+
1996
+ * `hover(fnOver, fnOut)`: Attaches a pair of event listeners for `mouseenter` and `mouseleave`.
1997
+
1998
+ * `fnOver`: Runs when the mouse enters the element.
1999
+ * `fnOut`: Runs when the mouse leaves. If omitted, `fnOver` is used for both.
2000
+ * `options`: Optional event listener options.
2001
+
2002
+ You can also use the static version:
2003
+
2004
+ ```js
2005
+ TinyHtml.hover([el1, el2],
2006
+ () => console.log("Hovered in!"),
2007
+ () => console.log("Hovered out!")
2008
+ );
2009
+ ```
2010
+
2011
+ ---
2012
+
1672
2013
  ### ๐Ÿ“ฅ `on()` / `once()`
1673
2014
 
1674
2015
  Registering Events
@@ -2275,6 +2616,22 @@ TinyHtml provides multiple utilities for reading CSS styles from elements, both
2275
2616
 
2276
2617
  ---
2277
2618
 
2619
+ ### ๐ŸŽจ `static parseStyle(styleText)`
2620
+
2621
+ Parses an inline CSS style string into an **object** representation.
2622
+
2623
+ * **`styleText`** ๐Ÿ“ โ€” CSS inline style string (e.g., `"color: red; font-size: 12px;"`).
2624
+ * **Returns** ๐Ÿ“ฆ โ€” An object mapping CSS properties to their values.
2625
+
2626
+ **Example:**
2627
+
2628
+ ```js
2629
+ parseStyle('color: red; font-size: 12px;');
2630
+ // โžก { color: 'red', 'font-size': '12px' }
2631
+ ```
2632
+
2633
+ ---
2634
+
2278
2635
  ### ๐Ÿงฌ `TinyHtml.css(el)` / `el.css()`
2279
2636
 
2280
2637
  Returns the full computed style object for a given element.
@@ -2347,6 +2704,443 @@ myTinyElem.cssFloats(['paddingTop', 'paddingBottom']);
2347
2704
 
2348
2705
  ---
2349
2706
 
2707
+ ## ๐ŸŽฌ Animate DOM (Data)
2708
+
2709
+ ### `getAnimateData(el, where)`
2710
+ ๐Ÿ” Retrieves stored animation data for a given element and key.
2711
+ If no data exists yet, it initializes storage for that element.
2712
+
2713
+ - **Parameters**:
2714
+ - `el` ๐Ÿ‘‰ `HTMLElement` โ€” The element whose data should be retrieved.
2715
+ - `where` ๐Ÿ‘‰ `string` โ€” The key to read (e.g., `"origHeight"`).
2716
+ - **Returns**: `string | number | undefined` โ€” The stored value, or `undefined`.
2717
+
2718
+ ---
2719
+
2720
+ ### `setAnimateData(el, where, value)`
2721
+ ๐Ÿ’พ Stores animation data for a given element and key.
2722
+ Used to cache original size/values for animations.
2723
+
2724
+ - **Parameters**:
2725
+ - `el` ๐Ÿ‘‰ `HTMLElement` โ€” The element whose data should be set.
2726
+ - `where` ๐Ÿ‘‰ `string` โ€” The key to store under (e.g., `"origHeight"`).
2727
+ - `value` ๐Ÿ‘‰ `string | number` โ€” The value to store.
2728
+ - **Throws**: `TypeError` if the arguments are invalid.
2729
+
2730
+ ---
2731
+
2732
+ ## โน Animate DOM (cancelOldStyleFx)
2733
+
2734
+ ### `#cancelOldStyleFx`
2735
+ โš™๏ธ Global configuration flag controlling whether old style-based animations
2736
+ are cancelled before a new one starts. Defaults to **true**.
2737
+
2738
+ - **Type**: `boolean`
2739
+
2740
+ ---
2741
+
2742
+ ### `cancelOldStyleFx` (getter / setter)
2743
+ ๐Ÿ›  Controls whether old animations are automatically cancelled before new ones begin.
2744
+
2745
+ - **Getter**: Returns a `boolean`.
2746
+ - **Setter**: Accepts a `boolean`. Throws `TypeError` otherwise.
2747
+
2748
+ ---
2749
+
2750
+ ## โฑ Animate DOM (styleFxSpeeds)
2751
+
2752
+ ### `#styleFxSpeeds`
2753
+ โšก Predefined animation speed options, inspired by `jQuery.fx.speeds`.
2754
+
2755
+ - **Example**:
2756
+ ```js
2757
+ TinyHtml.animate(el, keyframes, 'fast');
2758
+ TinyHtml.slideDown(el, 'slow');
2759
+ ```
2760
+
2761
+ * **Type**: `Record<string, number | KeyframeAnimationOptions>`
2762
+
2763
+ ---
2764
+
2765
+ ### `styleFxSpeeds` (getter / setter)
2766
+
2767
+ ๐Ÿ”„ Access or replace the full speed definitions.
2768
+
2769
+ * **Getter**: Returns a cloned copy of speeds.
2770
+ * **Setter**: Accepts a valid object. Throws `TypeError` otherwise.
2771
+
2772
+ ---
2773
+
2774
+ ### `getStyleFxSpeed(name)`
2775
+
2776
+ ๐Ÿ“ฅ Get a predefined speed by name.
2777
+
2778
+ * **Parameters**:
2779
+
2780
+ * `name` ๐Ÿ‘‰ `string` โ€” The name of the speed entry.
2781
+ * **Returns**: `number | KeyframeAnimationOptions | undefined`
2782
+
2783
+ ---
2784
+
2785
+ ### `setStyleFxSpeed(name, value)`
2786
+
2787
+ ๐Ÿ“ค Add or overwrite a speed entry.
2788
+
2789
+ * **Parameters**:
2790
+
2791
+ * `name` ๐Ÿ‘‰ `string`
2792
+ * `value` ๐Ÿ‘‰ `number | KeyframeAnimationOptions`
2793
+
2794
+ ---
2795
+
2796
+ ### `deleteStyleFxSpeed(name)`
2797
+
2798
+ ๐Ÿ—‘ Delete a predefined speed by name.
2799
+
2800
+ * **Returns**: `boolean`
2801
+
2802
+ ---
2803
+
2804
+ ### `hasStyleFxSpeed(name)`
2805
+
2806
+ โ“ Check if a predefined speed exists.
2807
+
2808
+ * **Returns**: `boolean`
2809
+
2810
+ ---
2811
+
2812
+ ## ๐ŸŽจ Animate DOM (styleEffects)
2813
+
2814
+ ### `#styleEffects`
2815
+
2816
+ ๐ŸŽญ Predefined style-based animation effects.
2817
+
2818
+ * **Default values**:
2819
+
2820
+ * `slideDown`
2821
+ * `slideUp`
2822
+ * `fadeIn`
2823
+ * `fadeOut`
2824
+
2825
+ ---
2826
+
2827
+ ### `styleEffects` (getter / setter)
2828
+
2829
+ ๐Ÿ“ฆ Manage the collection of style effects.
2830
+
2831
+ * **Getter**: Returns a deep-cloned copy.
2832
+ * **Setter**: Replaces all effects with validation.
2833
+
2834
+ ---
2835
+
2836
+ ### `getStyleEffect(name)`
2837
+
2838
+ ๐Ÿ“ฅ Retrieve a style effect by name.
2839
+
2840
+ * **Returns**: `StyleEffects | undefined`
2841
+
2842
+ ---
2843
+
2844
+ ### `setStyleEffect(name, value)`
2845
+
2846
+ ๐Ÿ“ Register or overwrite a style effect.
2847
+
2848
+ * **Throws**: `TypeError` if invalid.
2849
+
2850
+ ---
2851
+
2852
+ ### `deleteStyleEffect(name)`
2853
+
2854
+ ๐Ÿ—‘ Delete a style effect by name.
2855
+
2856
+ * **Returns**: `boolean`
2857
+
2858
+ ---
2859
+
2860
+ ### `hasStyleEffect(name)`
2861
+
2862
+ โ“ Check if a style effect exists.
2863
+
2864
+ * **Returns**: `boolean`
2865
+
2866
+ ---
2867
+
2868
+ ## ๐Ÿ”„ Animate DOM (styleEffectInverse)
2869
+
2870
+ ### `#styleEffectInverse`
2871
+
2872
+ โ†”๏ธ Maps effects to their inverse.
2873
+
2874
+ * **Default values**:
2875
+
2876
+ * `slideDown โ†” slideUp`
2877
+ * `fadeIn โ†” fadeOut`
2878
+
2879
+ ---
2880
+
2881
+ ### `styleEffectInverse` (getter / setter)
2882
+
2883
+ ๐Ÿ”€ Manage inverse mappings.
2884
+
2885
+ * **Getter**: Returns a cloned copy.
2886
+ * **Setter**: Replaces all inverse mappings.
2887
+
2888
+ ---
2889
+
2890
+ ### `getStyleEffectInverse(name)`
2891
+
2892
+ ๐Ÿ“ฅ Retrieve inverse effect by name.
2893
+
2894
+ * **Returns**: `string | null`
2895
+
2896
+ ---
2897
+
2898
+ ### `setStyleEffectInverse(name, value)`
2899
+
2900
+ ๐Ÿ“ Register or overwrite inverse mapping.
2901
+
2902
+ ---
2903
+
2904
+ ### `deleteStyleEffectInverse(name)`
2905
+
2906
+ ๐Ÿ—‘ Delete an inverse mapping.
2907
+
2908
+ * **Returns**: `boolean`
2909
+
2910
+ ---
2911
+
2912
+ ### `hasStyleEffectInverse(name)`
2913
+
2914
+ โ“ Check if an inverse mapping exists.
2915
+
2916
+ * **Returns**: `boolean`
2917
+
2918
+ ---
2919
+
2920
+ ## ๐Ÿ” Animate DOM (styleEffectsRd)
2921
+
2922
+ ### `#styleEffectsRd`
2923
+
2924
+ ๐Ÿ”Ž Repeat detector functions.
2925
+ Used to check if animations would produce no visible change.
2926
+
2927
+ ---
2928
+
2929
+ ### `styleEffectsRd` (getter / setter)
2930
+
2931
+ โš™๏ธ Manage repeat detectors.
2932
+
2933
+ ---
2934
+
2935
+ ### `getStyleEffectRd(name)`
2936
+
2937
+ ๐Ÿ“ฅ Retrieve a repeat detector.
2938
+
2939
+ * **Returns**: `StyleEffectsRdFn | null`
2940
+
2941
+ ---
2942
+
2943
+ ### `setStyleEffectRd(name, fn)`
2944
+
2945
+ ๐Ÿ“ Register or overwrite a repeat detector.
2946
+
2947
+ ---
2948
+
2949
+ ### `deleteStyleEffectRd(name)`
2950
+
2951
+ ๐Ÿ—‘ Delete a repeat detector by name.
2952
+
2953
+ ---
2954
+
2955
+ ### `hasStyleEffectRd(name)`
2956
+
2957
+ โ“ Check if a repeat detector exists.
2958
+
2959
+ * **Returns**: `boolean`
2960
+
2961
+ ---
2962
+
2963
+ ## ๐Ÿงฉ Animate DOM (styleEffectsProps)
2964
+
2965
+ ### `#styleEffectsProps`
2966
+
2967
+ ๐Ÿ›  Effect property handlers for **show** and **hide**.
2968
+ Each function generates appropriate keyframes depending on the property.
2969
+
2970
+ * **Supported props**:
2971
+
2972
+ * `height` / `width`
2973
+ * `margin*` / `padding*`
2974
+ * `opacity`
2975
+ * Any other style property
2976
+
2977
+ * **Type**: `StyleEffectsProps`
2978
+
2979
+ ---
2980
+
2981
+ ### `static get styleEffectsProps(): StyleEffectsProps`
2982
+
2983
+ Returns a shallow-cloned copy of the property effect handlers.
2984
+
2985
+ ---
2986
+
2987
+ ### `static set styleEffectsProps(value: StyleEffectsProps): void`
2988
+
2989
+ Replace the entire styleEffectsProps map with a new one.
2990
+ Throws a `TypeError` if `value` is not a plain object or if any property is not a function.
2991
+
2992
+ ---
2993
+
2994
+ ### `static getStyleEffectProp(name: string): StyleEffectsFn | null`
2995
+
2996
+ Get a style effect property handler by name.
2997
+ Returns the handler function or `null` if not found.
2998
+
2999
+ ---
3000
+
3001
+ ### `static setStyleEffectProp(name: string, fn: StyleEffectsFn): void`
3002
+
3003
+ Register or overwrite a style effect property handler.
3004
+ Throws a `TypeError` if `name` is not a string or `fn` is not a function.
3005
+
3006
+ ---
3007
+
3008
+ ### `static deleteStyleEffectProp(name: string): boolean`
3009
+
3010
+ Delete a style effect property handler by name.
3011
+ Returns `true` if deleted, `false` otherwise.
3012
+
3013
+ ---
3014
+
3015
+ ### `static hasStyleEffectProp(name: string): boolean`
3016
+
3017
+ Check if a style effect property handler exists.
3018
+
3019
+ ---
3020
+
3021
+ ## ๐ŸŽจ Style FX Manager
3022
+
3023
+ ### `static genStyleFx(type: string, includeWidth = false): Record<string, string>`
3024
+
3025
+ Generates effect parameters to create standard animations.
3026
+
3027
+ * `type`: Effect type (e.g. `"show"`, `"hide"`).
3028
+ * `includeWidth`: Whether to also include `width` and `opacity`.
3029
+
3030
+ ---
3031
+
3032
+ ### `static applyStyleFx(el, id, props, ops?): StyleFxResult`
3033
+
3034
+ Applies style-based effects (slide, fade) to one or more elements.
3035
+ Converts abstract effect definitions (e.g. `{ height: "show" }`) into Web Animations API keyframes.
3036
+
3037
+ ---
3038
+
3039
+ ### `applyStyleFx(id, props, ops?): StyleFxResult`
3040
+
3041
+ Instance method version of `applyStyleFx`.
3042
+
3043
+ ---
3044
+
3045
+ ## ๐ŸŽฌ Animate Stuff
3046
+
3047
+ ### `static getCurrentAnimationId(el: HTMLElement): string | null | undefined`
3048
+
3049
+ Get the current animation entry for a given element.
3050
+ Returns the animation `id`, `null`, or `undefined`.
3051
+
3052
+ ---
3053
+
3054
+ ### `static animate(el, keyframes, ops?, id?, cancelOldAnim?): Animation[]`
3055
+
3056
+ Applies an animation to one or multiple elements.
3057
+ Optionally cancels any currently running animation on the same element.
3058
+
3059
+ ---
3060
+
3061
+ ### `animate(keyframes, ops?, id?, cancelOldAnim?): Animation[]`
3062
+
3063
+ Instance method version of `animate`.
3064
+
3065
+ ---
3066
+
3067
+ ### `static stop(el): boolean[]`
3068
+
3069
+ Stops the current animation(s) on one or multiple elements.
3070
+ Returns an array of booleans indicating success per element.
3071
+
3072
+ ---
3073
+
3074
+ ### `stop(): boolean[]`
3075
+
3076
+ Instance method version of `stop`.
3077
+
3078
+ ---
3079
+
3080
+ ## โœจ Animate FXs
3081
+
3082
+ ### `static slideDown(el, ops?): StyleFxResult`
3083
+
3084
+ Show animation (`slideDown`).
3085
+
3086
+ ### `slideDown(ops?): StyleFxResult`
3087
+
3088
+ Instance method version.
3089
+
3090
+ ---
3091
+
3092
+ ### `static slideUp(el, ops?): StyleFxResult`
3093
+
3094
+ Hide animation (`slideUp`).
3095
+
3096
+ ### `slideUp(ops?): StyleFxResult`
3097
+
3098
+ Instance method version.
3099
+
3100
+ ---
3101
+
3102
+ ### `static slideToggle(el, ops?): StyleFxResult`
3103
+
3104
+ Toggle slide animation.
3105
+ Determines visibility and plays `slideDown` or `slideUp`.
3106
+
3107
+ ### `slideToggle(ops?): StyleFxResult`
3108
+
3109
+ Instance method version.
3110
+
3111
+ ---
3112
+
3113
+ ### `static fadeIn(el, ops?): StyleFxResult`
3114
+
3115
+ Fade in animation.
3116
+
3117
+ ### `fadeIn(ops?): StyleFxResult`
3118
+
3119
+ Instance method version.
3120
+
3121
+ ---
3122
+
3123
+ ### `static fadeOut(el, ops?): StyleFxResult`
3124
+
3125
+ Fade out animation.
3126
+
3127
+ ### `fadeOut(ops?): StyleFxResult`
3128
+
3129
+ Instance method version.
3130
+
3131
+ ---
3132
+
3133
+ ### `static fadeToggle(el, ops?): StyleFxResult`
3134
+
3135
+ Toggle fade animation.
3136
+ Determines visibility and plays `fadeIn` or `fadeOut`.
3137
+
3138
+ ### `fadeToggle(ops?): StyleFxResult`
3139
+
3140
+ Instance method version.
3141
+
3142
+ ---
3143
+
2350
3144
  ## ๐Ÿ–ฑ๏ธ Focus & Blur
2351
3145
 
2352
3146
  TinyHtml provides utility methods to programmatically focus or blur HTML elements.