@frybynite/image-cloud 0.2.8 → 0.3.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/index.d.ts CHANGED
@@ -251,9 +251,8 @@ export declare interface CompositeLoaderConfig {
251
251
  debugLogging?: boolean;
252
252
  }
253
253
 
254
- export declare interface CompositeLoaderConfigJson {
255
- loaders: LoaderConfig[];
256
- debugLogging?: boolean;
254
+ export declare interface ConfigSection {
255
+ loaders?: SharedLoaderConfig;
257
256
  }
258
257
 
259
258
  export declare interface ContainerBounds {
@@ -261,11 +260,12 @@ export declare interface ContainerBounds {
261
260
  height: number;
262
261
  }
263
262
 
263
+ export declare const DEFAULT_CONFIG: ImageCloudConfig;
264
+
264
265
  /**
265
- * Default configuration object
266
- * Frozen to prevent accidental modifications
266
+ * Default shared loader configuration
267
267
  */
268
- export declare const DEFAULT_CONFIG: ImageCloudConfig;
268
+ export declare const DEFAULT_SHARED_LOADER_CONFIG: SharedLoaderConfig;
269
269
 
270
270
  declare interface DropShadowConfig {
271
271
  x: number;
@@ -553,13 +553,11 @@ declare interface GestureInteractionConfig {
553
553
  doubleTapToFocus?: boolean;
554
554
  }
555
555
 
556
- declare interface GoogleDriveFilesSource {
557
- type: 'files';
556
+ export declare interface GoogleDriveFilesSource {
558
557
  files: string[];
559
558
  }
560
559
 
561
- declare interface GoogleDriveFolderSource {
562
- type: 'folder';
560
+ export declare interface GoogleDriveFolderSource {
563
561
  folders: string[];
564
562
  recursive?: boolean;
565
563
  }
@@ -571,7 +569,7 @@ export declare class GoogleDriveLoader implements ImageLoader {
571
569
  private sources;
572
570
  private _prepared;
573
571
  private _discoveredUrls;
574
- constructor(config?: Partial<GoogleDriveLoaderConfig>);
572
+ constructor(config: GoogleDriveLoaderInnerConfig);
575
573
  /**
576
574
  * Prepare the loader by discovering all images from configured sources
577
575
  * @param filter - Filter to apply to discovered images
@@ -653,7 +651,11 @@ export declare class GoogleDriveLoader implements ImageLoader {
653
651
  private log;
654
652
  }
655
653
 
656
- export declare interface GoogleDriveLoaderConfig {
654
+ export declare interface GoogleDriveLoaderEntry {
655
+ googleDrive: GoogleDriveLoaderInnerConfig;
656
+ }
657
+
658
+ export declare interface GoogleDriveLoaderInnerConfig {
657
659
  apiKey: string;
658
660
  sources: GoogleDriveSource[];
659
661
  apiEndpoint?: string;
@@ -661,7 +663,7 @@ export declare interface GoogleDriveLoaderConfig {
661
663
  debugLogging?: boolean;
662
664
  }
663
665
 
664
- declare type GoogleDriveSource = GoogleDriveFolderSource | GoogleDriveFilesSource;
666
+ export declare type GoogleDriveSource = GoogleDriveFolderSource | GoogleDriveFilesSource;
665
667
 
666
668
  export declare interface GridAlgorithmConfig {
667
669
  columns: number | 'auto';
@@ -740,17 +742,18 @@ declare class ImageCloud {
740
742
  private errorEl;
741
743
  constructor(options?: ImageCloudOptions);
742
744
  /**
743
- * Create image filter based on config
745
+ * Create image filter based on shared loader config
744
746
  */
745
747
  private createImageFilter;
746
748
  /**
747
749
  * Create appropriate image loader based on config
750
+ * Processes loaders array, merges shared config, wraps in CompositeLoader if needed
748
751
  */
749
752
  private createLoader;
750
753
  /**
751
- * Create a loader from a LoaderConfig object (supports recursive composite loaders)
754
+ * Create a single loader from a LoaderEntry, merging shared config
752
755
  */
753
- private createLoaderFromConfig;
756
+ private createLoaderFromEntry;
754
757
  /**
755
758
  * Initialize the gallery
756
759
  */
@@ -801,7 +804,8 @@ export { ImageCloud }
801
804
  export { ImageCloud as ImageGallery }
802
805
 
803
806
  export declare interface ImageCloudConfig {
804
- loader: LoaderConfig;
807
+ loaders: LoaderEntry[];
808
+ config: ConfigSection;
805
809
  image: ImageConfig;
806
810
  layout: LayoutConfig;
807
811
  animation: AnimationConfig;
@@ -813,7 +817,9 @@ export declare interface ImageCloudConfig {
813
817
 
814
818
  export declare interface ImageCloudOptions {
815
819
  container?: string | HTMLElement;
816
- loader?: Partial<LoaderConfig>;
820
+ images?: string[];
821
+ loaders?: LoaderEntry[];
822
+ config?: ConfigSection;
817
823
  image?: Partial<ImageConfig>;
818
824
  layout?: Partial<LayoutConfig>;
819
825
  animation?: Partial<AnimationConfig>;
@@ -1072,12 +1078,7 @@ declare interface LayoutSpacingConfig {
1072
1078
  minGap: number;
1073
1079
  }
1074
1080
 
1075
- export declare interface LoaderConfig {
1076
- type: 'googleDrive' | 'static' | 'composite';
1077
- googleDrive?: GoogleDriveLoaderConfig;
1078
- static?: StaticLoaderConfig;
1079
- composite?: CompositeLoaderConfigJson;
1080
- }
1081
+ export declare type LoaderEntry = StaticLoaderEntry | GoogleDriveLoaderEntry;
1081
1082
 
1082
1083
  declare interface NavigationInteractionConfig {
1083
1084
  keyboard?: boolean;
@@ -1221,6 +1222,15 @@ export declare interface ResponsiveRenderingConfig {
1221
1222
 
1222
1223
  declare type ShadowPreset = 'none' | 'sm' | 'md' | 'lg' | 'glow';
1223
1224
 
1225
+ export declare interface SharedLoaderConfig {
1226
+ validateUrls?: boolean;
1227
+ validationTimeout?: number;
1228
+ validationMethod?: 'head' | 'simple' | 'none';
1229
+ failOnAllMissing?: boolean;
1230
+ allowedExtensions?: string[];
1231
+ debugLogging?: boolean;
1232
+ }
1233
+
1224
1234
  /**
1225
1235
  * Sizing mode:
1226
1236
  * - 'fixed': single explicit height for all breakpoints
@@ -1293,7 +1303,7 @@ export declare class StaticImageLoader implements ImageLoader {
1293
1303
  private debugLogging;
1294
1304
  private _prepared;
1295
1305
  private _discoveredUrls;
1296
- constructor(config?: Partial<StaticLoaderConfig>);
1306
+ constructor(config: StaticLoaderInnerConfig);
1297
1307
  /**
1298
1308
  * Prepare the loader by discovering all images from configured sources
1299
1309
  * @param filter - Filter to apply to discovered images
@@ -1314,8 +1324,8 @@ export declare class StaticImageLoader implements ImageLoader {
1314
1324
  */
1315
1325
  isPrepared(): boolean;
1316
1326
  /**
1317
- * Process a single source object
1318
- * @param source - Source configuration with type, urls, basePath, files
1327
+ * Process a single source object using shape-based detection
1328
+ * @param source - Source configuration detected by key presence
1319
1329
  * @param filter - Filter to apply to discovered images
1320
1330
  * @returns Promise resolving to array of valid URLs from this source
1321
1331
  */
@@ -1335,6 +1345,14 @@ export declare class StaticImageLoader implements ImageLoader {
1335
1345
  * @returns Promise resolving to array of validated URLs
1336
1346
  */
1337
1347
  private processPath;
1348
+ /**
1349
+ * Process a JSON endpoint source
1350
+ * Fetches a JSON endpoint that returns { images: string[] }
1351
+ * @param url - JSON endpoint URL
1352
+ * @param filter - Filter to apply to discovered images
1353
+ * @returns Promise resolving to array of validated URLs
1354
+ */
1355
+ private processJson;
1338
1356
  /**
1339
1357
  * Validate a single URL using HEAD request
1340
1358
  * @param url - URL to validate
@@ -1361,7 +1379,15 @@ export declare class StaticImageLoader implements ImageLoader {
1361
1379
  private log;
1362
1380
  }
1363
1381
 
1364
- export declare interface StaticLoaderConfig {
1382
+ export declare interface StaticJsonSource {
1383
+ json: string;
1384
+ }
1385
+
1386
+ export declare interface StaticLoaderEntry {
1387
+ static: StaticLoaderInnerConfig;
1388
+ }
1389
+
1390
+ export declare interface StaticLoaderInnerConfig {
1365
1391
  sources: StaticSource[];
1366
1392
  validateUrls?: boolean;
1367
1393
  validationTimeout?: number;
@@ -1371,14 +1397,16 @@ export declare interface StaticLoaderConfig {
1371
1397
  debugLogging?: boolean;
1372
1398
  }
1373
1399
 
1374
- export declare interface StaticSource {
1375
- type: StaticSourceType;
1376
- urls?: string[];
1377
- basePath?: string;
1378
- files?: string[];
1400
+ export declare interface StaticPathSource {
1401
+ path: string;
1402
+ files: string[];
1379
1403
  }
1380
1404
 
1381
- declare type StaticSourceType = 'urls' | 'path';
1405
+ export declare type StaticSource = StaticUrlsSource | StaticPathSource | StaticJsonSource;
1406
+
1407
+ export declare interface StaticUrlsSource {
1408
+ urls: string[];
1409
+ }
1382
1410
 
1383
1411
  export declare interface TransformParams {
1384
1412
  x?: number;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@frybynite/image-cloud",
3
- "version": "0.2.8",
3
+ "version": "0.3.0",
4
4
  "description": "Javascript/TypeScript image cloud library with custom loaders, various layouts, full images styling, with animation and zoom effects",
5
5
  "type": "module",
6
6
  "main": "./dist/image-cloud.umd.js",