@frybynite/image-cloud 0.10.3 → 0.11.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.
@@ -138,6 +138,17 @@ declare interface AnimationSnapshot {
138
138
  scale: number;
139
139
  }
140
140
 
141
+ export declare interface BeforeLoadContext {
142
+ url: string;
143
+ index: number;
144
+ totalImages: number;
145
+ }
146
+
147
+ export declare interface BeforeLoadResult {
148
+ url?: string;
149
+ fetch?: RequestInit;
150
+ }
151
+
141
152
  export declare interface BorderConfig {
142
153
  width?: number;
143
154
  color?: string;
@@ -456,11 +467,34 @@ export declare class EntryAnimationEngine {
456
467
  private easeOutQuad;
457
468
  }
458
469
 
470
+ export declare interface EntryAnimPoint {
471
+ x: number;
472
+ y: number;
473
+ rotation: number;
474
+ scale: number;
475
+ }
476
+
459
477
  declare interface EntryCircularConfig {
460
478
  radius?: number | string;
461
479
  distribution?: 'even' | 'random';
462
480
  }
463
481
 
482
+ export declare interface EntryCompleteContext {
483
+ element: HTMLElement;
484
+ index: number;
485
+ layout: ImageLayout;
486
+ startTime: number;
487
+ endTime: number;
488
+ duration: number;
489
+ }
490
+
491
+ declare interface EntryCurrentState {
492
+ x: number;
493
+ y: number;
494
+ rotation: number;
495
+ scale: number;
496
+ }
497
+
464
498
  export declare interface EntryPathConfig {
465
499
  type: EntryPathType;
466
500
  bouncePreset?: BouncePreset;
@@ -473,6 +507,13 @@ export declare interface EntryPathConfig {
473
507
 
474
508
  export declare type EntryPathType = 'linear' | 'bounce' | 'elastic' | 'wave';
475
509
 
510
+ export declare interface EntryProgressContext extends EntryStartContext {
511
+ progress: number;
512
+ rawProgress: number;
513
+ elapsed: number;
514
+ current: EntryAnimPoint;
515
+ }
516
+
476
517
  export declare interface EntryRotationConfig {
477
518
  mode: EntryRotationMode;
478
519
  startRotation?: number | {
@@ -513,6 +554,17 @@ declare interface EntryStartConfig {
513
554
  circular?: EntryCircularConfig;
514
555
  }
515
556
 
557
+ export declare interface EntryStartContext {
558
+ element: HTMLElement;
559
+ index: number;
560
+ totalImages: number;
561
+ layout: ImageLayout;
562
+ from: EntryAnimPoint;
563
+ to: EntryAnimPoint;
564
+ startTime: number;
565
+ duration: number;
566
+ }
567
+
516
568
  declare type EntryStartPosition = 'nearest-edge' | 'top' | 'bottom' | 'left' | 'right' | 'center' | 'random-edge' | 'circular';
517
569
 
518
570
  declare interface EntryTimingConfig {
@@ -554,6 +606,12 @@ declare interface FocusInteractionConfig {
554
606
  */
555
607
  export declare const FUNCTIONAL_CSS = "\n.fbn-ic-gallery {\n position: relative;\n width: 100%;\n height: 100%;\n overflow: hidden;\n perspective: 1000px;\n}\n\n.fbn-ic-image {\n position: absolute;\n cursor: pointer;\n transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1),\n box-shadow 0.6s cubic-bezier(0.4, 0, 0.2, 1),\n filter 0.3s cubic-bezier(0.4, 0, 0.2, 1),\n opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1),\n border 0.3s cubic-bezier(0.4, 0, 0.2, 1),\n outline 0.3s cubic-bezier(0.4, 0, 0.2, 1),\n z-index 0s 0.6s;\n will-change: transform;\n user-select: none;\n backface-visibility: hidden;\n -webkit-backface-visibility: hidden;\n}\n\n.fbn-ic-image.fbn-ic-focused {\n z-index: 1000;\n transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1),\n box-shadow 0.6s cubic-bezier(0.4, 0, 0.2, 1),\n filter 0.3s cubic-bezier(0.4, 0, 0.2, 1),\n opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1),\n border 0.3s cubic-bezier(0.4, 0, 0.2, 1),\n outline 0.3s cubic-bezier(0.4, 0, 0.2, 1),\n z-index 0s 0s;\n will-change: auto;\n}\n\n.fbn-ic-counter {\n position: fixed;\n bottom: 24px;\n left: 50%;\n transform: translateX(-50%);\n z-index: 10001;\n pointer-events: none;\n}\n\n.fbn-ic-gallery:focus,\n.fbn-ic-gallery.fbn-ic-has-focus {\n outline: 2px solid rgba(147, 197, 253, 0.8);\n outline-offset: -4px;\n}\n.fbn-ic-gallery.fbn-ic-suppress-outline:focus {\n outline: none;\n}\n.fbn-ic-gallery.fbn-ic-suppress-outline.fbn-ic-has-focus {\n outline: 2px solid rgba(99, 102, 241, 0.6);\n outline-offset: -4px;\n}\n\n.fbn-ic-nav-btn {\n position: absolute;\n top: 50%;\n transform: translateY(-50%);\n z-index: 10001;\n cursor: pointer;\n border: none;\n background: none;\n padding: 0;\n line-height: 1;\n}\n.fbn-ic-nav-btn-prev {\n left: 12px;\n}\n.fbn-ic-nav-btn-next {\n right: 12px;\n}\n\n.fbn-ic-hidden {\n display: none !important;\n}\n";
556
608
 
609
+ export declare interface GalleryReadyContext {
610
+ totalImages: number;
611
+ failedImages: number;
612
+ loadDuration: number;
613
+ }
614
+
557
615
  export declare interface GoogleDriveFilesSource {
558
616
  files: string[];
559
617
  }
@@ -734,9 +792,9 @@ export declare interface IdleBlinkConfig {
734
792
  style: 'snap' | 'fade';
735
793
  }
736
794
 
737
- declare type IdleCustomAnimationFn = (ctx: IdleCustomContext) => Animation | (() => void);
795
+ export declare type IdleCustomAnimationFn = (ctx: IdleCustomContext) => Animation | (() => void);
738
796
 
739
- declare interface IdleCustomContext {
797
+ export declare interface IdleCustomContext {
740
798
  element: HTMLElement;
741
799
  index: number;
742
800
  totalImages: number;
@@ -796,6 +854,7 @@ export declare class ImageCloud {
796
854
  private swipeEngine;
797
855
  private imageLoader;
798
856
  private imageFilter;
857
+ private callbacks;
799
858
  private containerEl;
800
859
  private loadingEl;
801
860
  private errorEl;
@@ -881,6 +940,22 @@ export declare class ImageCloud {
881
940
 
882
941
  export declare function imageCloud(options: ImageCloudOptions): Promise<ImageCloud>;
883
942
 
943
+ export declare interface ImageCloudCallbacks {
944
+ onImageHover?: (ctx: ImageStateContext) => void;
945
+ onImageUnhover?: (ctx: ImageStateContext) => void;
946
+ onImageFocus?: (ctx: ImageStateContext) => void;
947
+ onImageUnfocus?: (ctx: ImageStateContext) => void;
948
+ onBeforeImageLoad?: (ctx: BeforeLoadContext) => BeforeLoadResult | void | Promise<BeforeLoadResult | void>;
949
+ onImageLoaded?: (ctx: ImageLoadedContext) => void;
950
+ onImageError?: (ctx: ImageErrorContext) => void;
951
+ onLoadProgress?: (ctx: LoadProgressContext) => void;
952
+ onGalleryReady?: (ctx: GalleryReadyContext) => void;
953
+ onLayoutComplete?: (ctx: LayoutCompleteContext) => void;
954
+ onEntryStart?: (ctx: EntryStartContext) => void;
955
+ onEntryProgress?: (ctx: EntryProgressContext) => void;
956
+ onEntryComplete?: (ctx: EntryCompleteContext) => void;
957
+ }
958
+
884
959
  export declare interface ImageCloudConfig {
885
960
  loaders: LoaderEntry[];
886
961
  config: ConfigSection;
@@ -903,6 +978,7 @@ export declare interface ImageCloudOptions {
903
978
  interaction?: Partial<InteractionConfig>;
904
979
  ui?: Partial<UIConfig>;
905
980
  styling?: Partial<ImageStylingConfig>;
981
+ on?: ImageCloudCallbacks;
906
982
  }
907
983
 
908
984
  /**
@@ -913,6 +989,12 @@ export declare interface ImageConfig {
913
989
  rotation?: ImageRotationConfig;
914
990
  }
915
991
 
992
+ export declare interface ImageErrorContext {
993
+ url: string;
994
+ index: number;
995
+ totalImages: number;
996
+ }
997
+
916
998
  /**
917
999
  * ImageFilter.ts
918
1000
  * Filters images by extension, designed for future extensibility
@@ -952,6 +1034,14 @@ export declare interface ImageLayout {
952
1034
  zIndex?: number;
953
1035
  }
954
1036
 
1037
+ export declare interface ImageLoadedContext {
1038
+ element: HTMLImageElement;
1039
+ url: string;
1040
+ index: number;
1041
+ totalImages: number;
1042
+ loadTime: number;
1043
+ }
1044
+
955
1045
  /**
956
1046
  * ImageLoader interface with consistent lifecycle pattern:
957
1047
  * 1. Constructor - Initialize with required parameters, throw if missing
@@ -1014,6 +1104,13 @@ export declare interface ImageSizingConfig {
1014
1104
  variance?: ImageVarianceConfig;
1015
1105
  }
1016
1106
 
1107
+ export declare interface ImageStateContext {
1108
+ element: HTMLElement;
1109
+ index: number;
1110
+ url: string;
1111
+ layout: ImageLayout;
1112
+ }
1113
+
1017
1114
  export declare interface ImageStyleState {
1018
1115
  className?: string | string[];
1019
1116
  border?: BorderConfig;
@@ -1064,6 +1161,13 @@ export declare interface InteractionConfig {
1064
1161
 
1065
1162
  export declare type LayoutAlgorithm = 'random' | 'radial' | 'grid' | 'spiral' | 'cluster' | 'wave' | 'honeycomb';
1066
1163
 
1164
+ export declare interface LayoutCompleteContext {
1165
+ layouts: ImageLayout[];
1166
+ containerBounds: ContainerBounds;
1167
+ algorithm: LayoutAlgorithm;
1168
+ imageCount: number;
1169
+ }
1170
+
1067
1171
  export declare interface LayoutConfig {
1068
1172
  algorithm: LayoutAlgorithm;
1069
1173
  spacing: LayoutSpacingConfig;
@@ -1159,6 +1263,13 @@ declare interface LayoutSpacingConfig {
1159
1263
 
1160
1264
  export declare type LoaderEntry = StaticLoaderEntry | GoogleDriveLoaderEntry;
1161
1265
 
1266
+ export declare interface LoadProgressContext {
1267
+ loaded: number;
1268
+ failed: number;
1269
+ total: number;
1270
+ percent: number;
1271
+ }
1272
+
1162
1273
  declare interface NavigationInteractionConfig {
1163
1274
  keyboard?: boolean;
1164
1275
  swipe?: boolean;
@@ -1182,6 +1293,7 @@ declare interface PathAnimationOptions {
1182
1293
  rotation: number;
1183
1294
  scale: number;
1184
1295
  onComplete?: () => void;
1296
+ onProgress?: (t: number, elapsed: number, current: EntryCurrentState) => void;
1185
1297
  rotationConfig?: EntryRotationConfig;
1186
1298
  startRotation?: number;
1187
1299
  scaleConfig?: EntryScaleConfig;