@fiddle-digital/string-tune 1.1.28 → 1.1.29

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/dist/index.d.mts CHANGED
@@ -1378,6 +1378,21 @@ declare class StringModule implements IStringModule {
1378
1378
  onDOMMutate(added: NodeList, removed: NodeList): void;
1379
1379
  }
1380
1380
 
1381
+ /**
1382
+ * StringCursor Module
1383
+ *
1384
+ * Handles cursor tracking and hover states for StringTune objects.
1385
+ *
1386
+ * Safari Navigation Fix:
1387
+ * Safari has an issue where mouseleave events are not fired when navigation occurs
1388
+ * (especially with NuxtLink/router navigation). This module includes several
1389
+ * workarounds to ensure proper cleanup:
1390
+ *
1391
+ * 1. MutationObserver - detects when elements are removed from DOM
1392
+ * 2. beforeunload/pagehide - captures traditional navigation
1393
+ * 3. visibilitychange - captures modern SPA navigation
1394
+ * 4. DOM existence checks - prevents operations on removed elements
1395
+ */
1381
1396
  declare class StringCursor extends StringModule {
1382
1397
  protected enterObjectsMap: Map<string, StringObject>;
1383
1398
  protected enterObjects: Array<StringObject>;
@@ -1394,6 +1409,9 @@ declare class StringCursor extends StringModule {
1394
1409
  onMouseLeave(object: StringObject): void;
1395
1410
  private onEnterObject;
1396
1411
  private onLeaveObject;
1412
+ private safariNavigationCleanup;
1413
+ private onElementRemovedFromDOM;
1414
+ onObjectDisconnected(object: StringObject): void;
1397
1415
  private setMouseCoordinates;
1398
1416
  private calculateOffset;
1399
1417
  }
@@ -1448,17 +1466,23 @@ declare class StringSpotlight extends CursorReactiveModule {
1448
1466
 
1449
1467
  /**
1450
1468
  * Module that handles lazy-loading of images with `string-lazy` attribute.
1451
- * It loads the image only once, calculates its aspect-ratio to prevent layout shift,
1452
- * and then displays it.
1469
+ * Aspect ratios are precomputed before the real source is revealed in view.
1453
1470
  */
1454
1471
  declare class StringLazy extends StringModule {
1455
1472
  private isStartLoaded;
1456
1473
  private loadingCount;
1474
+ private imageStates;
1457
1475
  constructor(context: StringContext);
1458
1476
  onInit(): void;
1459
1477
  onObjectConnected(object: StringObject): void;
1460
- private loadImage;
1461
- private handleLoadingCompletion;
1478
+ onObjectDisconnected(object: StringObject): void;
1479
+ private ensureState;
1480
+ private readSource;
1481
+ private prepareAspectRatio;
1482
+ private loadIntrinsicSize;
1483
+ private handleInView;
1484
+ private maybeActivateImage;
1485
+ private activateImage;
1462
1486
  }
1463
1487
 
1464
1488
  /**
@@ -1990,6 +2014,7 @@ declare class StringTune {
1990
2014
  /** Tracks hover states of string objects. */
1991
2015
  private hoverManager;
1992
2016
  private observerContainerResize;
2017
+ canRebuild: boolean;
1993
2018
  /**
1994
2019
  * Sets the scroll position manually.
1995
2020
  * This overrides all internal scroll states including target and lerped values.
@@ -2013,6 +2038,8 @@ declare class StringTune {
2013
2038
  * This is typically updated every frame.
2014
2039
  */
2015
2040
  get scrollPosition(): number;
2041
+ get scrollHeight(): number;
2042
+ get containerHeight(): number;
2016
2043
  /**
2017
2044
  * Sets the base scroll speed for smooth scrolling.
2018
2045
  * Typically a value between 0 and 1.
package/dist/index.d.ts CHANGED
@@ -1378,6 +1378,21 @@ declare class StringModule implements IStringModule {
1378
1378
  onDOMMutate(added: NodeList, removed: NodeList): void;
1379
1379
  }
1380
1380
 
1381
+ /**
1382
+ * StringCursor Module
1383
+ *
1384
+ * Handles cursor tracking and hover states for StringTune objects.
1385
+ *
1386
+ * Safari Navigation Fix:
1387
+ * Safari has an issue where mouseleave events are not fired when navigation occurs
1388
+ * (especially with NuxtLink/router navigation). This module includes several
1389
+ * workarounds to ensure proper cleanup:
1390
+ *
1391
+ * 1. MutationObserver - detects when elements are removed from DOM
1392
+ * 2. beforeunload/pagehide - captures traditional navigation
1393
+ * 3. visibilitychange - captures modern SPA navigation
1394
+ * 4. DOM existence checks - prevents operations on removed elements
1395
+ */
1381
1396
  declare class StringCursor extends StringModule {
1382
1397
  protected enterObjectsMap: Map<string, StringObject>;
1383
1398
  protected enterObjects: Array<StringObject>;
@@ -1394,6 +1409,9 @@ declare class StringCursor extends StringModule {
1394
1409
  onMouseLeave(object: StringObject): void;
1395
1410
  private onEnterObject;
1396
1411
  private onLeaveObject;
1412
+ private safariNavigationCleanup;
1413
+ private onElementRemovedFromDOM;
1414
+ onObjectDisconnected(object: StringObject): void;
1397
1415
  private setMouseCoordinates;
1398
1416
  private calculateOffset;
1399
1417
  }
@@ -1448,17 +1466,23 @@ declare class StringSpotlight extends CursorReactiveModule {
1448
1466
 
1449
1467
  /**
1450
1468
  * Module that handles lazy-loading of images with `string-lazy` attribute.
1451
- * It loads the image only once, calculates its aspect-ratio to prevent layout shift,
1452
- * and then displays it.
1469
+ * Aspect ratios are precomputed before the real source is revealed in view.
1453
1470
  */
1454
1471
  declare class StringLazy extends StringModule {
1455
1472
  private isStartLoaded;
1456
1473
  private loadingCount;
1474
+ private imageStates;
1457
1475
  constructor(context: StringContext);
1458
1476
  onInit(): void;
1459
1477
  onObjectConnected(object: StringObject): void;
1460
- private loadImage;
1461
- private handleLoadingCompletion;
1478
+ onObjectDisconnected(object: StringObject): void;
1479
+ private ensureState;
1480
+ private readSource;
1481
+ private prepareAspectRatio;
1482
+ private loadIntrinsicSize;
1483
+ private handleInView;
1484
+ private maybeActivateImage;
1485
+ private activateImage;
1462
1486
  }
1463
1487
 
1464
1488
  /**
@@ -1990,6 +2014,7 @@ declare class StringTune {
1990
2014
  /** Tracks hover states of string objects. */
1991
2015
  private hoverManager;
1992
2016
  private observerContainerResize;
2017
+ canRebuild: boolean;
1993
2018
  /**
1994
2019
  * Sets the scroll position manually.
1995
2020
  * This overrides all internal scroll states including target and lerped values.
@@ -2013,6 +2038,8 @@ declare class StringTune {
2013
2038
  * This is typically updated every frame.
2014
2039
  */
2015
2040
  get scrollPosition(): number;
2041
+ get scrollHeight(): number;
2042
+ get containerHeight(): number;
2016
2043
  /**
2017
2044
  * Sets the base scroll speed for smooth scrolling.
2018
2045
  * Typically a value between 0 and 1.