@frybynite/image-cloud 0.10.1 → 0.11.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/dist/react.d.ts CHANGED
@@ -138,7 +138,18 @@ declare interface AnimationSnapshot {
138
138
  scale: number;
139
139
  }
140
140
 
141
- declare interface BorderConfig {
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
+
152
+ export declare interface BorderConfig {
142
153
  width?: number;
143
154
  color?: string;
144
155
  radius?: number;
@@ -160,7 +171,7 @@ export declare interface BouncePathConfig {
160
171
 
161
172
  export declare type BouncePreset = 'energetic' | 'playful' | 'subtle';
162
173
 
163
- declare interface ClipPathConfig {
174
+ export declare interface ClipPathConfig {
164
175
  shape: ClipPathShape;
165
176
  mode?: ClipPathMode;
166
177
  }
@@ -277,7 +288,7 @@ export declare const DEFAULT_CONFIG: ImageCloudConfig;
277
288
  */
278
289
  export declare const DEFAULT_SHARED_LOADER_CONFIG: SharedLoaderConfig;
279
290
 
280
- declare interface DropShadowConfig {
291
+ export declare interface DropShadowConfig {
281
292
  x: number;
282
293
  y: number;
283
294
  blur: number;
@@ -298,7 +309,7 @@ export declare interface ElasticPathConfig {
298
309
 
299
310
  export declare type ElasticPreset = 'gentle' | 'bouncy' | 'wobbly' | 'snappy';
300
311
 
301
- declare interface EntryAnimationConfig {
312
+ export declare interface EntryAnimationConfig {
302
313
  start: EntryStartConfig;
303
314
  timing: EntryTimingConfig;
304
315
  easing: 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;
@@ -471,9 +505,16 @@ export declare interface EntryPathConfig {
471
505
  wave?: Partial<WavePathConfig>;
472
506
  }
473
507
 
474
- export declare type EntryPathType = 'linear' | 'arc' | 'bounce' | 'elastic' | 'wave';
508
+ export declare type EntryPathType = 'linear' | 'bounce' | 'elastic' | 'wave';
475
509
 
476
- declare interface EntryRotationConfig {
510
+ export declare interface EntryProgressContext extends EntryStartContext {
511
+ progress: number;
512
+ rawProgress: number;
513
+ elapsed: number;
514
+ current: EntryAnimPoint;
515
+ }
516
+
517
+ export declare interface EntryRotationConfig {
477
518
  mode: EntryRotationMode;
478
519
  startRotation?: number | {
479
520
  min: number;
@@ -490,7 +531,7 @@ declare interface EntryRotationConfig {
490
531
 
491
532
  declare type EntryRotationMode = 'none' | 'settle' | 'spin' | 'wobble' | 'random';
492
533
 
493
- declare interface EntryScaleConfig {
534
+ export declare interface EntryScaleConfig {
494
535
  mode: EntryScaleMode;
495
536
  startScale?: number;
496
537
  range?: {
@@ -513,13 +554,24 @@ 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 {
519
571
  duration: number;
520
572
  }
521
573
 
522
- declare interface FilterConfig {
574
+ export declare interface FilterConfig {
523
575
  grayscale?: number;
524
576
  blur?: number;
525
577
  brightness?: number;
@@ -554,7 +606,11 @@ 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
 
557
- export declare type GalleryConfig = ImageCloudConfig;
609
+ export declare interface GalleryReadyContext {
610
+ totalImages: number;
611
+ failedImages: number;
612
+ loadDuration: number;
613
+ }
558
614
 
559
615
  export declare interface GoogleDriveFilesSource {
560
616
  files: string[];
@@ -706,7 +762,7 @@ export declare class GridPlacementLayout implements PlacementLayout {
706
762
  private random;
707
763
  }
708
764
 
709
- declare interface HoneycombAlgorithmConfig {
765
+ export declare interface HoneycombAlgorithmConfig {
710
766
  spacing?: number;
711
767
  }
712
768
 
@@ -718,7 +774,7 @@ export declare class HoneycombPlacementLayout implements PlacementLayout {
718
774
  }): ImageLayout[];
719
775
  }
720
776
 
721
- declare interface IdleAnimationConfig {
777
+ export declare interface IdleAnimationConfig {
722
778
  type: IdleAnimationType;
723
779
  wiggle?: IdleWiggleConfig;
724
780
  pulse?: IdlePulseConfig;
@@ -730,35 +786,35 @@ declare interface IdleAnimationConfig {
730
786
 
731
787
  declare type IdleAnimationType = 'wiggle' | 'pulse' | 'blink' | 'spin' | 'custom' | 'none';
732
788
 
733
- declare interface IdleBlinkConfig {
789
+ export declare interface IdleBlinkConfig {
734
790
  onRatio: number;
735
791
  speed: number;
736
792
  style: 'snap' | 'fade';
737
793
  }
738
794
 
739
- declare type IdleCustomAnimationFn = (ctx: IdleCustomContext) => Animation | (() => void);
795
+ export declare type IdleCustomAnimationFn = (ctx: IdleCustomContext) => Animation | (() => void);
740
796
 
741
- declare interface IdleCustomContext {
797
+ export declare interface IdleCustomContext {
742
798
  element: HTMLElement;
743
799
  index: number;
744
800
  totalImages: number;
745
801
  }
746
802
 
747
- declare interface IdlePulseConfig {
803
+ export declare interface IdlePulseConfig {
748
804
  minScale: number;
749
805
  maxScale: number;
750
806
  speed: number;
751
807
  sync: IdleSyncMode;
752
808
  }
753
809
 
754
- declare interface IdleSpinConfig {
810
+ export declare interface IdleSpinConfig {
755
811
  speed: number;
756
812
  direction: 'clockwise' | 'counterclockwise';
757
813
  }
758
814
 
759
815
  declare type IdleSyncMode = 'together' | 'random';
760
816
 
761
- declare interface IdleWiggleConfig {
817
+ export declare interface IdleWiggleConfig {
762
818
  maxAngle: number;
763
819
  speed: number;
764
820
  sync: IdleSyncMode;
@@ -773,7 +829,7 @@ export declare interface IImageFilter {
773
829
  getAllowedExtensions(): string[];
774
830
  }
775
831
 
776
- declare class ImageCloud {
832
+ export declare class ImageCloud {
777
833
  private containerId;
778
834
  private containerRef;
779
835
  private fullConfig;
@@ -798,6 +854,7 @@ declare class ImageCloud {
798
854
  private swipeEngine;
799
855
  private imageLoader;
800
856
  private imageFilter;
857
+ private callbacks;
801
858
  private containerEl;
802
859
  private loadingEl;
803
860
  private errorEl;
@@ -880,11 +937,25 @@ declare class ImageCloud {
880
937
  */
881
938
  destroy(): void;
882
939
  }
883
- export { ImageCloud }
884
- export { ImageCloud as ImageGallery }
885
940
 
886
941
  export declare function imageCloud(options: ImageCloudOptions): Promise<ImageCloud>;
887
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
+
888
959
  export declare interface ImageCloudConfig {
889
960
  loaders: LoaderEntry[];
890
961
  config: ConfigSection;
@@ -906,21 +977,24 @@ export declare interface ImageCloudOptions {
906
977
  animation?: Partial<AnimationConfig>;
907
978
  interaction?: Partial<InteractionConfig>;
908
979
  ui?: Partial<UIConfig>;
909
- /** @deprecated Use `ui` instead of `rendering.ui` */
910
- rendering?: {
911
- ui?: Partial<UIConfig>;
912
- };
913
980
  styling?: Partial<ImageStylingConfig>;
981
+ on?: ImageCloudCallbacks;
914
982
  }
915
983
 
916
984
  /**
917
985
  * Combined image configuration
918
986
  */
919
- declare interface ImageConfig {
987
+ export declare interface ImageConfig {
920
988
  sizing?: ImageSizingConfig;
921
989
  rotation?: ImageRotationConfig;
922
990
  }
923
991
 
992
+ export declare interface ImageErrorContext {
993
+ url: string;
994
+ index: number;
995
+ totalImages: number;
996
+ }
997
+
924
998
  /**
925
999
  * ImageFilter.ts
926
1000
  * Filters images by extension, designed for future extensibility
@@ -947,8 +1021,6 @@ export declare class ImageFilter {
947
1021
  getAllowedExtensions(): string[];
948
1022
  }
949
1023
 
950
- export declare type ImageGalleryOptions = ImageCloudOptions;
951
-
952
1024
  /**
953
1025
  * Type definitions for Image Gallery Library
954
1026
  */
@@ -962,6 +1034,14 @@ export declare interface ImageLayout {
962
1034
  zIndex?: number;
963
1035
  }
964
1036
 
1037
+ export declare interface ImageLoadedContext {
1038
+ element: HTMLImageElement;
1039
+ url: string;
1040
+ index: number;
1041
+ totalImages: number;
1042
+ loadTime: number;
1043
+ }
1044
+
965
1045
  /**
966
1046
  * ImageLoader interface with consistent lifecycle pattern:
967
1047
  * 1. Constructor - Initialize with required parameters, throw if missing
@@ -995,7 +1075,7 @@ export declare interface ImageLoader {
995
1075
  /**
996
1076
  * Image rotation configuration
997
1077
  */
998
- declare interface ImageRotationConfig {
1078
+ export declare interface ImageRotationConfig {
999
1079
  mode: ImageRotationMode;
1000
1080
  range?: ImageRotationRange;
1001
1081
  }
@@ -1016,7 +1096,7 @@ declare interface ImageRotationRange {
1016
1096
  /**
1017
1097
  * Image sizing configuration
1018
1098
  */
1019
- declare interface ImageSizingConfig {
1099
+ export declare interface ImageSizingConfig {
1020
1100
  mode: SizingMode;
1021
1101
  height?: number | FixedModeHeight;
1022
1102
  minSize?: number;
@@ -1024,7 +1104,14 @@ declare interface ImageSizingConfig {
1024
1104
  variance?: ImageVarianceConfig;
1025
1105
  }
1026
1106
 
1027
- declare interface ImageStyleState {
1107
+ export declare interface ImageStateContext {
1108
+ element: HTMLElement;
1109
+ index: number;
1110
+ url: string;
1111
+ layout: ImageLayout;
1112
+ }
1113
+
1114
+ export declare interface ImageStyleState {
1028
1115
  className?: string | string[];
1029
1116
  border?: BorderConfig;
1030
1117
  borderTop?: Partial<BorderConfig>;
@@ -1045,7 +1132,7 @@ declare interface ImageStyleState {
1045
1132
  clipPath?: ClipPathShape | string | ClipPathConfig;
1046
1133
  }
1047
1134
 
1048
- declare interface ImageStylingConfig {
1135
+ export declare interface ImageStylingConfig {
1049
1136
  default?: ImageStyleState;
1050
1137
  hover?: Partial<ImageStyleState>;
1051
1138
  focused?: Partial<ImageStyleState>;
@@ -1066,7 +1153,7 @@ declare interface ImageVarianceConfig {
1066
1153
  */
1067
1154
  export declare function injectFunctionalStyles(): void;
1068
1155
 
1069
- declare interface InteractionConfig {
1156
+ export declare interface InteractionConfig {
1070
1157
  focus: FocusInteractionConfig;
1071
1158
  navigation?: NavigationInteractionConfig;
1072
1159
  dragging?: boolean;
@@ -1074,6 +1161,13 @@ declare interface InteractionConfig {
1074
1161
 
1075
1162
  export declare type LayoutAlgorithm = 'random' | 'radial' | 'grid' | 'spiral' | 'cluster' | 'wave' | 'honeycomb';
1076
1163
 
1164
+ export declare interface LayoutCompleteContext {
1165
+ layouts: ImageLayout[];
1166
+ containerBounds: ContainerBounds;
1167
+ algorithm: LayoutAlgorithm;
1168
+ imageCount: number;
1169
+ }
1170
+
1077
1171
  export declare interface LayoutConfig {
1078
1172
  algorithm: LayoutAlgorithm;
1079
1173
  spacing: LayoutSpacingConfig;
@@ -1169,13 +1263,19 @@ declare interface LayoutSpacingConfig {
1169
1263
 
1170
1264
  export declare type LoaderEntry = StaticLoaderEntry | GoogleDriveLoaderEntry;
1171
1265
 
1266
+ export declare interface LoadProgressContext {
1267
+ loaded: number;
1268
+ failed: number;
1269
+ total: number;
1270
+ percent: number;
1271
+ }
1272
+
1172
1273
  declare interface NavigationInteractionConfig {
1173
1274
  keyboard?: boolean;
1174
1275
  swipe?: boolean;
1175
- mouseWheel?: boolean;
1176
1276
  }
1177
1277
 
1178
- declare interface OutlineConfig {
1278
+ export declare interface OutlineConfig {
1179
1279
  width?: number;
1180
1280
  color?: string;
1181
1281
  style?: BorderStyle;
@@ -1193,6 +1293,7 @@ declare interface PathAnimationOptions {
1193
1293
  rotation: number;
1194
1294
  scale: number;
1195
1295
  onComplete?: () => void;
1296
+ onProgress?: (t: number, elapsed: number, current: EntryCurrentState) => void;
1196
1297
  rotationConfig?: EntryRotationConfig;
1197
1298
  startRotation?: number;
1198
1299
  scaleConfig?: EntryScaleConfig;
@@ -1208,7 +1309,7 @@ declare interface Point {
1208
1309
  y: number;
1209
1310
  }
1210
1311
 
1211
- declare interface RadialAlgorithmConfig {
1312
+ export declare interface RadialAlgorithmConfig {
1212
1313
  tightness: number;
1213
1314
  }
1214
1315
 
@@ -1501,7 +1602,7 @@ export declare interface UIConfig {
1501
1602
  */
1502
1603
  export declare const WAVE_PATH_PRESETS: Record<WavePathPreset, WavePathConfig>;
1503
1604
 
1504
- declare interface WaveAlgorithmConfig {
1605
+ export declare interface WaveAlgorithmConfig {
1505
1606
  rows: number;
1506
1607
  amplitude: number;
1507
1608
  frequency: number;