tiny-essentials 1.16.0 → 1.16.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.
@@ -2886,6 +2886,7 @@ __webpack_require__.r(__webpack_exports__);
2886
2886
  // EXPORTS
2887
2887
  __webpack_require__.d(__webpack_exports__, {
2888
2888
  ColorSafeStringify: () => (/* reexport */ libs_ColorSafeStringify),
2889
+ TinyAfterScrollWatcher: () => (/* reexport */ libs_TinyAfterScrollWatcher),
2889
2890
  TinyDomReadyManager: () => (/* reexport */ libs_TinyDomReadyManager),
2890
2891
  TinyDragDropDetector: () => (/* reexport */ libs_TinyDragDropDetector),
2891
2892
  TinyDragger: () => (/* reexport */ libs_TinyDragger),
@@ -8634,6 +8635,494 @@ class TinyHtml_TinyHtml {
8634
8635
 
8635
8636
  //////////////////////////////////////////////////////////////////////
8636
8637
 
8638
+ /**
8639
+ * Stores camelCase to kebab-case CSS property aliases.
8640
+ *
8641
+ * Used to normalize property names when interacting with `element.style` or `getComputedStyle`.
8642
+ *
8643
+ * ⚠️ This object should not be modified directly. Use `TinyHtml.cssPropAliases` instead to ensure reverse mappings stay in sync.
8644
+ *
8645
+ * Example of how to add a new alias:
8646
+ *
8647
+ * ```js
8648
+ * TinyHtml.cssPropAliases.tinyPudding = 'tiny-pudding';
8649
+ * ```
8650
+ *
8651
+ * This will automatically update `TinyHtml.cssPropRevAliases['tiny-pudding']` with `'tinyPudding'`.
8652
+ *
8653
+ * @type {Record<string | symbol, string>}
8654
+ */
8655
+ static #cssPropAliases = {
8656
+ alignContent: 'align-content',
8657
+ alignItems: 'align-items',
8658
+ alignSelf: 'align-self',
8659
+ animationDelay: 'animation-delay',
8660
+ animationDirection: 'animation-direction',
8661
+ animationDuration: 'animation-duration',
8662
+ animationFillMode: 'animation-fill-mode',
8663
+ animationIterationCount: 'animation-iteration-count',
8664
+ animationName: 'animation-name',
8665
+ animationPlayState: 'animation-play-state',
8666
+ animationTimingFunction: 'animation-timing-function',
8667
+ backfaceVisibility: 'backface-visibility',
8668
+ backgroundAttachment: 'background-attachment',
8669
+ backgroundBlendMode: 'background-blend-mode',
8670
+ backgroundClip: 'background-clip',
8671
+ backgroundColor: 'background-color',
8672
+ backgroundImage: 'background-image',
8673
+ backgroundOrigin: 'background-origin',
8674
+ backgroundPosition: 'background-position',
8675
+ backgroundRepeat: 'background-repeat',
8676
+ backgroundSize: 'background-size',
8677
+ borderBottom: 'border-bottom',
8678
+ borderBottomColor: 'border-bottom-color',
8679
+ borderBottomLeftRadius: 'border-bottom-left-radius',
8680
+ borderBottomRightRadius: 'border-bottom-right-radius',
8681
+ borderBottomStyle: 'border-bottom-style',
8682
+ borderBottomWidth: 'border-bottom-width',
8683
+ borderCollapse: 'border-collapse',
8684
+ borderColor: 'border-color',
8685
+ borderImage: 'border-image',
8686
+ borderImageOutset: 'border-image-outset',
8687
+ borderImageRepeat: 'border-image-repeat',
8688
+ borderImageSlice: 'border-image-slice',
8689
+ borderImageSource: 'border-image-source',
8690
+ borderImageWidth: 'border-image-width',
8691
+ borderLeft: 'border-left',
8692
+ borderLeftColor: 'border-left-color',
8693
+ borderLeftStyle: 'border-left-style',
8694
+ borderLeftWidth: 'border-left-width',
8695
+ borderRadius: 'border-radius',
8696
+ borderRight: 'border-right',
8697
+ borderRightColor: 'border-right-color',
8698
+ borderRightStyle: 'border-right-style',
8699
+ borderRightWidth: 'border-right-width',
8700
+ borderSpacing: 'border-spacing',
8701
+ borderStyle: 'border-style',
8702
+ borderTop: 'border-top',
8703
+ borderTopColor: 'border-top-color',
8704
+ borderTopLeftRadius: 'border-top-left-radius',
8705
+ borderTopRightRadius: 'border-top-right-radius',
8706
+ borderTopStyle: 'border-top-style',
8707
+ borderTopWidth: 'border-top-width',
8708
+ borderWidth: 'border-width',
8709
+ boxDecorationBreak: 'box-decoration-break',
8710
+ boxShadow: 'box-shadow',
8711
+ boxSizing: 'box-sizing',
8712
+ breakAfter: 'break-after',
8713
+ breakBefore: 'break-before',
8714
+ breakInside: 'break-inside',
8715
+ captionSide: 'caption-side',
8716
+ caretColor: 'caret-color',
8717
+ clipPath: 'clip-path',
8718
+ columnCount: 'column-count',
8719
+ columnFill: 'column-fill',
8720
+ columnGap: 'column-gap',
8721
+ columnRule: 'column-rule',
8722
+ columnRuleColor: 'column-rule-color',
8723
+ columnRuleStyle: 'column-rule-style',
8724
+ columnRuleWidth: 'column-rule-width',
8725
+ columnSpan: 'column-span',
8726
+ columnWidth: 'column-width',
8727
+ counterIncrement: 'counter-increment',
8728
+ counterReset: 'counter-reset',
8729
+ emptyCells: 'empty-cells',
8730
+ flexBasis: 'flex-basis',
8731
+ flexDirection: 'flex-direction',
8732
+ flexFlow: 'flex-flow',
8733
+ flexGrow: 'flex-grow',
8734
+ flexShrink: 'flex-shrink',
8735
+ flexWrap: 'flex-wrap',
8736
+ fontFamily: 'font-family',
8737
+ fontFeatureSettings: 'font-feature-settings',
8738
+ fontKerning: 'font-kerning',
8739
+ fontLanguageOverride: 'font-language-override',
8740
+ fontSize: 'font-size',
8741
+ fontSizeAdjust: 'font-size-adjust',
8742
+ fontStretch: 'font-stretch',
8743
+ fontStyle: 'font-style',
8744
+ fontSynthesis: 'font-synthesis',
8745
+ fontVariant: 'font-variant',
8746
+ fontVariantAlternates: 'font-variant-alternates',
8747
+ fontVariantCaps: 'font-variant-caps',
8748
+ fontVariantEastAsian: 'font-variant-east-asian',
8749
+ fontVariantLigatures: 'font-variant-ligatures',
8750
+ fontVariantNumeric: 'font-variant-numeric',
8751
+ fontVariantPosition: 'font-variant-position',
8752
+ fontWeight: 'font-weight',
8753
+ gridArea: 'grid-area',
8754
+ gridAutoColumns: 'grid-auto-columns',
8755
+ gridAutoFlow: 'grid-auto-flow',
8756
+ gridAutoRows: 'grid-auto-rows',
8757
+ gridColumn: 'grid-column',
8758
+ gridColumnEnd: 'grid-column-end',
8759
+ gridColumnGap: 'grid-column-gap',
8760
+ gridColumnStart: 'grid-column-start',
8761
+ gridGap: 'grid-gap',
8762
+ gridRow: 'grid-row',
8763
+ gridRowEnd: 'grid-row-end',
8764
+ gridRowGap: 'grid-row-gap',
8765
+ gridRowStart: 'grid-row-start',
8766
+ gridTemplate: 'grid-template',
8767
+ gridTemplateAreas: 'grid-template-areas',
8768
+ gridTemplateColumns: 'grid-template-columns',
8769
+ gridTemplateRows: 'grid-template-rows',
8770
+ imageRendering: 'image-rendering',
8771
+ justifyContent: 'justify-content',
8772
+ letterSpacing: 'letter-spacing',
8773
+ lineBreak: 'line-break',
8774
+ lineHeight: 'line-height',
8775
+ listStyle: 'list-style',
8776
+ listStyleImage: 'list-style-image',
8777
+ listStylePosition: 'list-style-position',
8778
+ listStyleType: 'list-style-type',
8779
+ marginBottom: 'margin-bottom',
8780
+ marginLeft: 'margin-left',
8781
+ marginRight: 'margin-right',
8782
+ marginTop: 'margin-top',
8783
+ maskClip: 'mask-clip',
8784
+ maskComposite: 'mask-composite',
8785
+ maskImage: 'mask-image',
8786
+ maskMode: 'mask-mode',
8787
+ maskOrigin: 'mask-origin',
8788
+ maskPosition: 'mask-position',
8789
+ maskRepeat: 'mask-repeat',
8790
+ maskSize: 'mask-size',
8791
+ maskType: 'mask-type',
8792
+ maxHeight: 'max-height',
8793
+ maxWidth: 'max-width',
8794
+ minHeight: 'min-height',
8795
+ minWidth: 'min-width',
8796
+ mixBlendMode: 'mix-blend-mode',
8797
+ objectFit: 'object-fit',
8798
+ objectPosition: 'object-position',
8799
+ offsetAnchor: 'offset-anchor',
8800
+ offsetDistance: 'offset-distance',
8801
+ offsetPath: 'offset-path',
8802
+ offsetRotate: 'offset-rotate',
8803
+ outlineColor: 'outline-color',
8804
+ outlineOffset: 'outline-offset',
8805
+ outlineStyle: 'outline-style',
8806
+ outlineWidth: 'outline-width',
8807
+ overflowAnchor: 'overflow-anchor',
8808
+ overflowWrap: 'overflow-wrap',
8809
+ overflowX: 'overflow-x',
8810
+ overflowY: 'overflow-y',
8811
+ paddingBottom: 'padding-bottom',
8812
+ paddingLeft: 'padding-left',
8813
+ paddingRight: 'padding-right',
8814
+ paddingTop: 'padding-top',
8815
+ pageBreakAfter: 'page-break-after',
8816
+ pageBreakBefore: 'page-break-before',
8817
+ pageBreakInside: 'page-break-inside',
8818
+ perspectiveOrigin: 'perspective-origin',
8819
+ placeContent: 'place-content',
8820
+ placeItems: 'place-items',
8821
+ placeSelf: 'place-self',
8822
+ pointerEvents: 'pointer-events',
8823
+ rowGap: 'row-gap',
8824
+ scrollBehavior: 'scroll-behavior',
8825
+ scrollMargin: 'scroll-margin',
8826
+ scrollMarginBlock: 'scroll-margin-block',
8827
+ scrollMarginBlockEnd: 'scroll-margin-block-end',
8828
+ scrollMarginBlockStart: 'scroll-margin-block-start',
8829
+ scrollMarginBottom: 'scroll-margin-bottom',
8830
+ scrollMarginInline: 'scroll-margin-inline',
8831
+ scrollMarginInlineEnd: 'scroll-margin-inline-end',
8832
+ scrollMarginInlineStart: 'scroll-margin-inline-start',
8833
+ scrollMarginLeft: 'scroll-margin-left',
8834
+ scrollMarginRight: 'scroll-margin-right',
8835
+ scrollMarginTop: 'scroll-margin-top',
8836
+ scrollPadding: 'scroll-padding',
8837
+ scrollPaddingBlock: 'scroll-padding-block',
8838
+ scrollPaddingBlockEnd: 'scroll-padding-block-end',
8839
+ scrollPaddingBlockStart: 'scroll-padding-block-start',
8840
+ scrollPaddingBottom: 'scroll-padding-bottom',
8841
+ scrollPaddingInline: 'scroll-padding-inline',
8842
+ scrollPaddingInlineEnd: 'scroll-padding-inline-end',
8843
+ scrollPaddingInlineStart: 'scroll-padding-inline-start',
8844
+ scrollPaddingLeft: 'scroll-padding-left',
8845
+ scrollPaddingRight: 'scroll-padding-right',
8846
+ scrollPaddingTop: 'scroll-padding-top',
8847
+ scrollSnapAlign: 'scroll-snap-align',
8848
+ scrollSnapStop: 'scroll-snap-stop',
8849
+ scrollSnapType: 'scroll-snap-type',
8850
+ shapeImageThreshold: 'shape-image-threshold',
8851
+ shapeMargin: 'shape-margin',
8852
+ shapeOutside: 'shape-outside',
8853
+ tabSize: 'tab-size',
8854
+ tableLayout: 'table-layout',
8855
+ textAlign: 'text-align',
8856
+ textAlignLast: 'text-align-last',
8857
+ textCombineUpright: 'text-combine-upright',
8858
+ textDecoration: 'text-decoration',
8859
+ textDecorationColor: 'text-decoration-color',
8860
+ textDecorationLine: 'text-decoration-line',
8861
+ textDecorationStyle: 'text-decoration-style',
8862
+ textIndent: 'text-indent',
8863
+ textJustify: 'text-justify',
8864
+ textOrientation: 'text-orientation',
8865
+ textOverflow: 'text-overflow',
8866
+ textShadow: 'text-shadow',
8867
+ textTransform: 'text-transform',
8868
+ transformBox: 'transform-box',
8869
+ transformOrigin: 'transform-origin',
8870
+ transformStyle: 'transform-style',
8871
+ transitionDelay: 'transition-delay',
8872
+ transitionDuration: 'transition-duration',
8873
+ transitionProperty: 'transition-property',
8874
+ transitionTimingFunction: 'transition-timing-function',
8875
+ unicodeBidi: 'unicode-bidi',
8876
+ userSelect: 'user-select',
8877
+ verticalAlign: 'vertical-align',
8878
+ whiteSpace: 'white-space',
8879
+ willChange: 'will-change',
8880
+ wordBreak: 'word-break',
8881
+ wordSpacing: 'word-spacing',
8882
+ wordWrap: 'word-wrap',
8883
+ writingMode: 'writing-mode',
8884
+ zIndex: 'z-index',
8885
+ WebkitTransform: '-webkit-transform',
8886
+ WebkitTransition: '-webkit-transition',
8887
+ WebkitBoxShadow: '-webkit-box-shadow',
8888
+ MozBoxShadow: '-moz-box-shadow',
8889
+ MozTransform: '-moz-transform',
8890
+ MozTransition: '-moz-transition',
8891
+ msTransform: '-ms-transform',
8892
+ msTransition: '-ms-transition',
8893
+ };
8894
+
8895
+ /** @type {Record<string | symbol, string>} */
8896
+ static cssPropAliases = new Proxy(TinyHtml_TinyHtml.#cssPropAliases, {
8897
+ set(target, camelCaseKey, kebabValue) {
8898
+ target[camelCaseKey] = kebabValue;
8899
+ // @ts-ignore
8900
+ TinyHtml_TinyHtml.cssPropRevAliases[kebabValue] = camelCaseKey;
8901
+ return true;
8902
+ },
8903
+ });
8904
+
8905
+ /** @type {Record<string | symbol, string>} */
8906
+ static cssPropRevAliases = Object.fromEntries(
8907
+ Object.entries(TinyHtml_TinyHtml.#cssPropAliases).map(([camel, kebab]) => [kebab, camel]),
8908
+ );
8909
+
8910
+ /**
8911
+ * Converts a camelCase string to kebab-case
8912
+ * @param {string} str
8913
+ * @returns {string}
8914
+ */
8915
+ static toStyleKc(str) {
8916
+ if (typeof TinyHtml_TinyHtml.cssPropAliases[str] === 'string') return TinyHtml_TinyHtml.cssPropAliases[str];
8917
+ return str;
8918
+ }
8919
+
8920
+ /**
8921
+ * Converts a kebab-case string to camelCase
8922
+ * @param {string} str
8923
+ * @returns {string}
8924
+ */
8925
+ static toStyleCc(str) {
8926
+ if (typeof TinyHtml_TinyHtml.cssPropRevAliases[str] === 'string') return TinyHtml_TinyHtml.cssPropRevAliases[str];
8927
+ return str;
8928
+ }
8929
+
8930
+ /**
8931
+ * Sets one or more CSS inline style properties on the given element(s).
8932
+ *
8933
+ * - If `prop` is a string, the `value` will be applied to that property.
8934
+ * - If `prop` is an object, each key-value pair will be applied as a CSS property and value.
8935
+ *
8936
+ * @param {TinyHtmlElement|TinyHtmlElement[]} el - The element to inspect.
8937
+ * @param {string|Object} prop - The property name or an object with key-value pairs
8938
+ * @param {string|null} [value=null] - The value to set (if `prop` is a string)
8939
+ */
8940
+ static setStyle(el, prop, value = null) {
8941
+ TinyHtml_TinyHtml._preHtmlElems(el, 'setStyle').forEach((elem) => {
8942
+ if (typeof prop === 'object') {
8943
+ for (const [k, v] of Object.entries(prop)) {
8944
+ elem.style.setProperty(
8945
+ TinyHtml_TinyHtml.toStyleKc(k),
8946
+ typeof v === 'string' ? v : typeof v === 'number' ? `${v}px` : String(v),
8947
+ );
8948
+ }
8949
+ } else elem.style.setProperty(TinyHtml_TinyHtml.toStyleKc(prop), value);
8950
+ });
8951
+ }
8952
+
8953
+ /**
8954
+ * Sets one or more CSS inline style properties on the given element(s).
8955
+ *
8956
+ * - If `prop` is a string, the `value` will be applied to that property.
8957
+ * - If `prop` is an object, each key-value pair will be applied as a CSS property and value.
8958
+ *
8959
+ * @param {string|Object} prop - The property name or an object with key-value pairs
8960
+ * @param {string|null} [value=null] - The value to set (if `prop` is a string)
8961
+ */
8962
+ setStyle(prop, value) {
8963
+ return TinyHtml_TinyHtml.setStyle(this, prop, value);
8964
+ }
8965
+
8966
+ /**
8967
+ * Gets the value of a specific inline style property.
8968
+ *
8969
+ * Returns only the value set directly via the `style` attribute.
8970
+ *
8971
+ * @param {TinyHtmlElement|TinyHtmlElement[]} el - A single element to inspect.
8972
+ * @param {string} prop - The style property name to retrieve.
8973
+ * @returns {string} The style value of the specified property.
8974
+ */
8975
+ static getStyle(el, prop) {
8976
+ return TinyHtml_TinyHtml._preHtmlElem(el, 'getStyle').style.getPropertyValue(TinyHtml_TinyHtml.toStyleKc(prop));
8977
+ }
8978
+
8979
+ /**
8980
+ * Gets the value of a specific inline style property.
8981
+ *
8982
+ * Returns only the value set directly via the `style` attribute.
8983
+ *
8984
+ * @param {string} prop - The style property name to retrieve.
8985
+ * @returns {string} The style value of the specified property.
8986
+ */
8987
+ getStyle(prop) {
8988
+ return TinyHtml_TinyHtml.getStyle(this, prop);
8989
+ }
8990
+
8991
+ /**
8992
+ * Gets all inline styles defined directly on the element (`style` attribute).
8993
+ *
8994
+ * Returns an object with all property-value pairs in kebab-case format.
8995
+ *
8996
+ * @param {TinyHtmlElement|TinyHtmlElement[]} el - A single element to inspect.
8997
+ * @param {Object} [settings={}] - Optional configuration settings.
8998
+ * @param {boolean} [settings.camelCase=false] - If `true`, the property names will be converted to camelCase.
8999
+ * @param {boolean} [settings.rawAttr=false] - If `true`, reads the style string from the `style` attribute instead of using the style object.
9000
+ * @returns {Record<string, string>} All inline styles as an object.
9001
+ *
9002
+ * @throws {TypeError} If `camelCase` or `rawAttr` is not a boolean.
9003
+ */
9004
+ static style(el, { camelCase = false, rawAttr = false } = {}) {
9005
+ if (typeof camelCase !== 'boolean')
9006
+ throw new TypeError(`"camelCase" must be a boolean. Received: ${typeof camelCase}`);
9007
+ if (typeof rawAttr !== 'boolean')
9008
+ throw new TypeError(`"rawAttr" must be a boolean. Received: ${typeof rawAttr}`);
9009
+
9010
+ const elem = TinyHtml_TinyHtml._preHtmlElem(el, 'style');
9011
+ /** @type {Record<string, string>} */
9012
+ const result = {};
9013
+
9014
+ if (rawAttr) {
9015
+ const raw = elem.getAttribute('style') || '';
9016
+ const entries = raw.split(';');
9017
+ for (const entry of entries) {
9018
+ const [rawProp, rawVal] = entry.split(':');
9019
+ if (!rawProp || !rawVal) continue;
9020
+
9021
+ const prop = rawProp.trim();
9022
+ const value = rawVal.trim();
9023
+ result[camelCase ? TinyHtml_TinyHtml.toStyleCc(prop) : prop] = value;
9024
+ }
9025
+ } else {
9026
+ const styles = elem.style;
9027
+ for (let i = 0; i < styles.length; i++) {
9028
+ const prop = styles[i]; // Already in kebab-case
9029
+ const value = styles.getPropertyValue(prop);
9030
+ result[camelCase ? TinyHtml_TinyHtml.toStyleCc(prop) : prop] = value;
9031
+ }
9032
+ }
9033
+
9034
+ return result;
9035
+ }
9036
+
9037
+ /**
9038
+ * Gets all inline styles defined directly on the element (`style` attribute).
9039
+ *
9040
+ * Returns an object with all property-value pairs in kebab-case format.
9041
+ *
9042
+ * @param {Object} [settings={}] - Optional configuration settings.
9043
+ * @param {boolean} [settings.camelCase=false] - If `true`, the property names will be converted to camelCase.
9044
+ * @param {boolean} [settings.rawAttr=false] - If `true`, reads the style string from the `style` attribute instead of using the style object.
9045
+ * @returns {Record<string, string>} All inline styles as an object.
9046
+ */
9047
+ style(settings) {
9048
+ return TinyHtml_TinyHtml.style(this, settings);
9049
+ }
9050
+
9051
+ /**
9052
+ * Removes one or more inline CSS properties from the given element(s).
9053
+ *
9054
+ * @param {TinyHtmlElement|TinyHtmlElement[]} el - A single element or an array of elements.
9055
+ * @param {string|string[]} prop - A property name or an array of property names to remove.
9056
+ */
9057
+ static removeStyle(el, prop) {
9058
+ TinyHtml_TinyHtml._preHtmlElems(el, 'removeStyle').forEach((elem) => {
9059
+ if (Array.isArray(prop)) {
9060
+ for (const p of prop) {
9061
+ elem.style.removeProperty(TinyHtml_TinyHtml.toStyleKc(p));
9062
+ }
9063
+ } else elem.style.removeProperty(TinyHtml_TinyHtml.toStyleKc(prop));
9064
+ });
9065
+ }
9066
+
9067
+ /**
9068
+ * Removes one or more inline CSS properties from the given element(s).
9069
+ *
9070
+ * @param {string|string[]} prop - A property name or an array of property names to remove.
9071
+ */
9072
+ removeStyle(prop) {
9073
+ return TinyHtml_TinyHtml.removeStyle(this, prop);
9074
+ }
9075
+
9076
+ /**
9077
+ * Toggles a CSS property value between two given values.
9078
+ *
9079
+ * The current computed value is compared to `val1`. If it matches, the property is set to `val2`. Otherwise, it is set to `val1`.
9080
+ *
9081
+ * @param {TinyHtmlElement|TinyHtmlElement[]} el - A single element or an array of elements.
9082
+ * @param {string} prop - The CSS property to toggle.
9083
+ * @param {string} val1 - The first value (used as "current" check).
9084
+ * @param {string} val2 - The second value (used as the "alternative").
9085
+ */
9086
+ static toggleStyle(el, prop, val1, val2) {
9087
+ TinyHtml_TinyHtml._preHtmlElems(el, 'toggleStyle').forEach((elem) => {
9088
+ const current = TinyHtml_TinyHtml.getStyle(elem, prop).trim();
9089
+ const newVal = current === TinyHtml_TinyHtml.toStyleKc(val1) ? val2 : val1;
9090
+ TinyHtml_TinyHtml.setStyle(elem, prop, newVal);
9091
+ });
9092
+ }
9093
+
9094
+ /**
9095
+ * Toggles a CSS property value between two given values.
9096
+ *
9097
+ * The current computed value is compared to `val1`. If it matches, the property is set to `val2`. Otherwise, it is set to `val1`.
9098
+ *
9099
+ * @param {string} prop - The CSS property to toggle.
9100
+ * @param {string} val1 - The first value (used as "current" check).
9101
+ * @param {string} val2 - The second value (used as the "alternative").
9102
+ */
9103
+ toggleStyle(prop, val1, val2) {
9104
+ return TinyHtml_TinyHtml.toggleStyle(this, prop, val1, val2);
9105
+ }
9106
+
9107
+ /**
9108
+ * Removes all inline styles (`style` attribute) from the given element(s).
9109
+ *
9110
+ * @param {TinyElement|TinyElement[]} el - A single element or an array of elements.
9111
+ */
9112
+ static clearStyle(el) {
9113
+ TinyHtml_TinyHtml._preElems(el, 'clearStyle').forEach((elem) => elem.removeAttribute('style'));
9114
+ }
9115
+
9116
+ /**
9117
+ * Removes all inline styles (`style` attribute) from the given element(s).
9118
+ *
9119
+ */
9120
+ clearStyle() {
9121
+ return TinyHtml_TinyHtml.clearStyle(this);
9122
+ }
9123
+
9124
+ //////////////////////////////////////////////////////////////////////
9125
+
8637
9126
  /**
8638
9127
  * Focus the element.
8639
9128
  *
@@ -13282,6 +13771,163 @@ class TinyNotifications {
13282
13771
 
13283
13772
  /* harmony default export */ const libs_TinyNotifications = (TinyNotifications);
13284
13773
 
13774
+ ;// ./src/v1/libs/TinyAfterScrollWatcher.mjs
13775
+ /**
13776
+ * @typedef {(() => void)} FnData - Function with no arguments and no return value
13777
+ */
13778
+
13779
+ /**
13780
+ * A function that handles a scroll event.
13781
+ * It receives a standard `Event` object when a scroll occurs.
13782
+ *
13783
+ * @typedef {(ev: Event) => void} OnScrollFunc
13784
+ */
13785
+
13786
+ /**
13787
+ * A scroll tracker that queues functions to be executed
13788
+ * after the user stops scrolling a specific element or the window.
13789
+ */
13790
+ class TinyAfterScrollWatcher {
13791
+ /** @type {Element|Window} */
13792
+ #scrollTarget;
13793
+
13794
+ /** @type {number} */
13795
+ lastScrollTime = 0;
13796
+
13797
+ /** @type {FnData[]} */
13798
+ #afterScrollQueue = [];
13799
+
13800
+ /** @type {number} */
13801
+ #inactivityTime = 100;
13802
+
13803
+ /** @type {Set<OnScrollFunc>} */
13804
+ #externalScrollListeners = new Set();
13805
+
13806
+ /** @type {boolean} */
13807
+ #destroyed = false;
13808
+
13809
+ /**
13810
+ * @param {Element|Window} scrollTarget - The element or window to track scrolling on
13811
+ * @param {number} [inactivityTime=100] - Time in milliseconds to wait after scroll ends before executing the queue
13812
+ * @throws {TypeError} If scrollTarget is not a valid Element or Window
13813
+ * @throws {TypeError} If inactivityTime is not a positive number
13814
+ */
13815
+ constructor(scrollTarget = window, inactivityTime = 100) {
13816
+ if (!(scrollTarget instanceof Element) && !(scrollTarget instanceof Window))
13817
+ throw new TypeError('scrollTarget must be an Element or the Window object.');
13818
+ this.#scrollTarget = scrollTarget;
13819
+
13820
+ this._onScroll = this._onScroll.bind(this);
13821
+ this._checkQueue = this._checkQueue.bind(this);
13822
+
13823
+ this.#scrollTarget.addEventListener('scroll', this._onScroll);
13824
+ this.#inactivityTime = inactivityTime;
13825
+
13826
+ requestAnimationFrame(this._checkQueue);
13827
+ }
13828
+
13829
+ /**
13830
+ * Gets the current inactivity time in milliseconds.
13831
+ * @returns {number}
13832
+ */
13833
+ get inactivityTime() {
13834
+ return this.#inactivityTime;
13835
+ }
13836
+
13837
+ /**
13838
+ * Sets a new inactivity time.
13839
+ * Must be a positive number (in milliseconds).
13840
+ * @param {number} value
13841
+ * @throws {Error} If value is not a positive number
13842
+ */
13843
+ set inactivityTime(value) {
13844
+ if (typeof value !== 'number' || value <= 0 || !Number.isFinite(value))
13845
+ throw new Error('inactivityTime must be a positive number in milliseconds.');
13846
+ this.#inactivityTime = value;
13847
+ }
13848
+
13849
+ /**
13850
+ * Internal handler for scroll events.
13851
+ * Updates the last scroll timestamp.
13852
+ * @private
13853
+ */
13854
+ _onScroll() {
13855
+ this.lastScrollTime = Date.now();
13856
+ }
13857
+
13858
+ /**
13859
+ * Continuously checks whether the user has stopped scrolling,
13860
+ * and if so, runs all queued functions.
13861
+ * @private
13862
+ */
13863
+ _checkQueue() {
13864
+ if (this.#destroyed) return;
13865
+ requestAnimationFrame(this._checkQueue);
13866
+
13867
+ if (Date.now() - this.lastScrollTime > this.#inactivityTime) {
13868
+ while (this.#afterScrollQueue.length) {
13869
+ const fn = this.#afterScrollQueue.pop();
13870
+ if (typeof fn === 'function') fn();
13871
+ }
13872
+ }
13873
+ }
13874
+
13875
+ /**
13876
+ * Adds a function to be executed after scroll has stopped.
13877
+ * The scroll is considered "stopped" after the configured inactivity time.
13878
+ *
13879
+ * @param {() => void} fn - A function to execute once scrolling has stopped.
13880
+ * @throws {TypeError} If the argument is not a function.
13881
+ */
13882
+ doAfterScroll(fn) {
13883
+ if (typeof fn !== 'function') throw new TypeError('Argument must be a function.');
13884
+ this.lastScrollTime = Date.now();
13885
+ this.#afterScrollQueue.push(fn);
13886
+ }
13887
+
13888
+ /**
13889
+ * Registers an external scroll listener on the tracked element.
13890
+ *
13891
+ * @param {OnScrollFunc} fn - The scroll listener to add
13892
+ * @throws {TypeError} If the argument is not a function.
13893
+ */
13894
+ onScroll(fn) {
13895
+ if (typeof fn !== 'function') throw new TypeError('Argument must be a function.');
13896
+ this.#scrollTarget.addEventListener('scroll', fn);
13897
+ this.#externalScrollListeners.add(fn);
13898
+ }
13899
+
13900
+ /**
13901
+ * Removes a previously registered scroll listener from the tracked element.
13902
+ *
13903
+ * @param {OnScrollFunc} fn - The scroll listener to remove
13904
+ * @throws {TypeError} If the argument is not a function.
13905
+ */
13906
+ offScroll(fn) {
13907
+ if (typeof fn !== 'function') throw new TypeError('Argument must be a function.');
13908
+ if (this.#externalScrollListeners.has(fn)) {
13909
+ this.#scrollTarget.removeEventListener('scroll', fn);
13910
+ this.#externalScrollListeners.delete(fn);
13911
+ }
13912
+ }
13913
+
13914
+ /**
13915
+ * Destroys the watcher by removing internal listeners and clearing data.
13916
+ */
13917
+ destroy() {
13918
+ if (this.#destroyed) return;
13919
+ this.#destroyed = true;
13920
+
13921
+ this.#scrollTarget.removeEventListener('scroll', this._onScroll);
13922
+ for (const fn of this.#externalScrollListeners)
13923
+ this.#scrollTarget.removeEventListener('scroll', fn);
13924
+
13925
+ this.#externalScrollListeners.clear();
13926
+ }
13927
+ }
13928
+
13929
+ /* harmony default export */ const libs_TinyAfterScrollWatcher = (TinyAfterScrollWatcher);
13930
+
13285
13931
  ;// ./src/v1/index.mjs
13286
13932
 
13287
13933
 
@@ -13311,6 +13957,7 @@ class TinyNotifications {
13311
13957
 
13312
13958
 
13313
13959
 
13960
+
13314
13961
 
13315
13962
 
13316
13963
  })();