@frybynite/image-cloud 0.1.0 → 0.1.2
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/README.md +29 -187
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -63,9 +63,9 @@ const cloud = new ImageCloud({
|
|
|
63
63
|
{
|
|
64
64
|
type: 'urls',
|
|
65
65
|
urls: [
|
|
66
|
-
'https://
|
|
67
|
-
'https://
|
|
68
|
-
'https://
|
|
66
|
+
'https://images.pexels.com/photos/1261728/pexels-photo-1261728.jpeg?auto=compress&w=600',
|
|
67
|
+
'https://images.pexels.com/photos/3225517/pexels-photo-3225517.jpeg?auto=compress&w=600',
|
|
68
|
+
'https://images.pexels.com/photos/1402787/pexels-photo-1402787.jpeg?auto=compress&w=600'
|
|
69
69
|
]
|
|
70
70
|
}
|
|
71
71
|
]
|
|
@@ -96,9 +96,9 @@ await cloud.init();
|
|
|
96
96
|
"sources": [{
|
|
97
97
|
"type": "urls",
|
|
98
98
|
"urls": [
|
|
99
|
-
"https://
|
|
100
|
-
"https://
|
|
101
|
-
"https://
|
|
99
|
+
"https://images.pexels.com/photos/1261728/pexels-photo-1261728.jpeg?auto=compress&w=600",
|
|
100
|
+
"https://images.pexels.com/photos/3225517/pexels-photo-3225517.jpeg?auto=compress&w=600",
|
|
101
|
+
"https://images.pexels.com/photos/1402787/pexels-photo-1402787.jpeg?auto=compress&w=600"
|
|
102
102
|
]
|
|
103
103
|
}]
|
|
104
104
|
}
|
|
@@ -110,206 +110,48 @@ await cloud.init();
|
|
|
110
110
|
></div>
|
|
111
111
|
|
|
112
112
|
<!-- No CSS link needed — auto-init injects styles automatically -->
|
|
113
|
-
<script type="module" src="
|
|
113
|
+
<script type="module" src="https://cdn.jsdelivr.net/npm/@frybynite/image-cloud@latest/dist/image-cloud-auto-init.js"></script>
|
|
114
114
|
</body>
|
|
115
115
|
</html>
|
|
116
116
|
```
|
|
117
117
|
|
|
118
|
-
##
|
|
118
|
+
## Getting Started
|
|
119
119
|
|
|
120
|
-
|
|
120
|
+
For detailed configuration, see the documentation in the `docs/` folder:
|
|
121
121
|
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
static: {
|
|
128
|
-
sources: [
|
|
129
|
-
{
|
|
130
|
-
type: 'urls',
|
|
131
|
-
urls: [
|
|
132
|
-
'https://picsum.photos/400/300',
|
|
133
|
-
'https://picsum.photos/500/350',
|
|
134
|
-
'https://picsum.photos/450/320'
|
|
135
|
-
]
|
|
136
|
-
}
|
|
137
|
-
]
|
|
138
|
-
}
|
|
139
|
-
}
|
|
140
|
-
});
|
|
122
|
+
1. **[Loaders](docs/LOADERS.md)** — Configure image sources (static URLs, local paths, Google Drive folders)
|
|
123
|
+
2. **[Layout Generators](docs/GENERATORS.md)** — Choose and customize layout algorithms (radial, grid, spiral, cluster, random)
|
|
124
|
+
3. **[Image Sizing](docs/IMAGE_SIZING.md)** — Control base sizes, variance, and responsive/adaptive behavior
|
|
125
|
+
4. **[Full Parameter Reference](docs/PARAMETERS.md)** — Complete configuration options for animation, interaction, styling, and more
|
|
126
|
+
5. **[API Reference](docs/api/README.md)** — TypeScript API documentation for the ImageCloud class, types, loaders, and generators
|
|
141
127
|
|
|
142
|
-
|
|
143
|
-
```
|
|
128
|
+
### Using the Configurator
|
|
144
129
|
|
|
145
|
-
|
|
130
|
+
The easiest way to create a custom configuration is with the interactive Configurator tool:
|
|
146
131
|
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
container: 'cloud',
|
|
150
|
-
loader: {
|
|
151
|
-
type: 'static',
|
|
152
|
-
static: {
|
|
153
|
-
sources: [
|
|
154
|
-
{
|
|
155
|
-
type: 'path',
|
|
156
|
-
basePath: '/images',
|
|
157
|
-
files: ['photo1.jpg', 'photo2.jpg', 'photo3.jpg']
|
|
158
|
-
}
|
|
159
|
-
]
|
|
160
|
-
}
|
|
161
|
-
}
|
|
162
|
-
});
|
|
132
|
+
- **Online**: [Image Cloud Configurator](https://frybynite.github.io/image-cloud/configurator/index.html)
|
|
133
|
+
- **Local**: Run a local server from the `configurator/` directory
|
|
163
134
|
|
|
164
|
-
|
|
165
|
-
```
|
|
166
|
-
|
|
167
|
-
### Google Drive Folder
|
|
168
|
-
|
|
169
|
-
```typescript
|
|
170
|
-
const cloud = new ImageCloud({
|
|
171
|
-
container: 'cloud',
|
|
172
|
-
loader: {
|
|
173
|
-
type: 'googleDrive',
|
|
174
|
-
googleDrive: {
|
|
175
|
-
apiKey: 'YOUR_GOOGLE_API_KEY',
|
|
176
|
-
sources: [
|
|
177
|
-
{
|
|
178
|
-
type: 'folder',
|
|
179
|
-
folders: ['YOUR_FOLDER_ID']
|
|
180
|
-
}
|
|
181
|
-
]
|
|
182
|
-
}
|
|
183
|
-
}
|
|
184
|
-
});
|
|
135
|
+
The Configurator lets you visually adjust all settings and exports a ready-to-use JSON configuration.
|
|
185
136
|
|
|
186
|
-
|
|
187
|
-
```
|
|
137
|
+
## Events & Interactions
|
|
188
138
|
|
|
189
|
-
###
|
|
190
|
-
|
|
191
|
-
```typescript
|
|
192
|
-
const cloud = new ImageCloud({
|
|
193
|
-
container: 'cloud',
|
|
194
|
-
loader: {
|
|
195
|
-
type: 'static',
|
|
196
|
-
static: {
|
|
197
|
-
sources: [{ type: 'urls', urls: ['img1.jpg', 'img2.jpg'] }]
|
|
198
|
-
}
|
|
199
|
-
},
|
|
200
|
-
layout: {
|
|
201
|
-
algorithm: 'radial', // 'radial' | 'grid' | 'spiral' | 'cluster' | 'random'
|
|
202
|
-
sizing: {
|
|
203
|
-
base: 250
|
|
204
|
-
},
|
|
205
|
-
rotation: {
|
|
206
|
-
range: { max: 20, min: -20 }
|
|
207
|
-
},
|
|
208
|
-
spacing: {
|
|
209
|
-
padding: 60
|
|
210
|
-
}
|
|
211
|
-
},
|
|
212
|
-
animation: {
|
|
213
|
-
duration: 800,
|
|
214
|
-
queue: {
|
|
215
|
-
interval: 200
|
|
216
|
-
}
|
|
217
|
-
},
|
|
218
|
-
interaction: {
|
|
219
|
-
focus: {
|
|
220
|
-
scale: 3.0,
|
|
221
|
-
zIndex: 1000
|
|
222
|
-
}
|
|
223
|
-
}
|
|
224
|
-
});
|
|
225
|
-
|
|
226
|
-
await cloud.init();
|
|
227
|
-
```
|
|
228
|
-
|
|
229
|
-
## Configuration Options
|
|
230
|
-
|
|
231
|
-
See `docs/PARAMETERS.md` for full documentation of the configuration object.
|
|
232
|
-
|
|
233
|
-
### ImageCloudOptions
|
|
234
|
-
|
|
235
|
-
```typescript
|
|
236
|
-
interface ImageCloudOptions {
|
|
237
|
-
container?: string; // HTML element ID (default: 'imageCloud')
|
|
238
|
-
loader?: Partial<LoaderConfig>;
|
|
239
|
-
layout?: Partial<LayoutConfig>;
|
|
240
|
-
animation?: Partial<AnimationConfig>;
|
|
241
|
-
interaction?: Partial<InteractionConfig>;
|
|
242
|
-
rendering?: Partial<RenderingConfig>;
|
|
243
|
-
debug?: boolean;
|
|
244
|
-
}
|
|
245
|
-
```
|
|
246
|
-
|
|
247
|
-
## API Reference
|
|
248
|
-
|
|
249
|
-
### ImageCloud Class
|
|
250
|
-
|
|
251
|
-
#### Methods
|
|
252
|
-
|
|
253
|
-
- `init(): Promise<void>` - Initialize the cloud and load images
|
|
254
|
-
- `clearImageCloud(): void` - Clear all images and reset state
|
|
255
|
-
- `destroy(): void` - Clean up resources and event listeners
|
|
256
|
-
|
|
257
|
-
### Events & Interactions
|
|
139
|
+
### Mouse
|
|
258
140
|
|
|
259
141
|
- **Click image**: Focus/zoom the image
|
|
260
142
|
- **Click outside**: Unfocus current image
|
|
261
|
-
- **
|
|
262
|
-
- **Window resize**: Responsive layout adjustment
|
|
263
|
-
|
|
264
|
-
## Advanced Usage
|
|
265
|
-
|
|
266
|
-
### Custom Placement Generator
|
|
267
|
-
|
|
268
|
-
```typescript
|
|
269
|
-
import { PlacementGenerator, ImageLayout, ContainerBounds } from '@frybynite/image-cloud';
|
|
143
|
+
- **Hover**: Apply hover styling
|
|
270
144
|
|
|
271
|
-
|
|
272
|
-
generate(count: number, bounds: ContainerBounds): ImageLayout[] {
|
|
273
|
-
// Your custom layout algorithm
|
|
274
|
-
return layouts;
|
|
275
|
-
}
|
|
276
|
-
}
|
|
277
|
-
```
|
|
145
|
+
### Keyboard
|
|
278
146
|
|
|
279
|
-
|
|
147
|
+
- **Arrow Right**: Navigate to next image (when focused)
|
|
148
|
+
- **Arrow Left**: Navigate to previous image (when focused)
|
|
149
|
+
- **Enter / Space**: Focus hovered image
|
|
150
|
+
- **Escape**: Unfocus current image
|
|
280
151
|
|
|
281
|
-
|
|
282
|
-
import { useEffect, useRef } from 'react';
|
|
283
|
-
import { ImageCloud } from '@frybynite/image-cloud';
|
|
284
|
-
import '@frybynite/image-cloud/style.css';
|
|
152
|
+
### Window
|
|
285
153
|
|
|
286
|
-
|
|
287
|
-
const containerRef = useRef<HTMLDivElement>(null);
|
|
288
|
-
const cloudRef = useRef<ImageCloud | null>(null);
|
|
289
|
-
|
|
290
|
-
useEffect(() => {
|
|
291
|
-
if (containerRef.current) {
|
|
292
|
-
cloudRef.current = new ImageCloud({
|
|
293
|
-
container: containerRef.current.id,
|
|
294
|
-
loader: {
|
|
295
|
-
type: 'static',
|
|
296
|
-
static: {
|
|
297
|
-
sources: [{ type: 'urls', urls: ['img1.jpg', 'img2.jpg'] }]
|
|
298
|
-
}
|
|
299
|
-
}
|
|
300
|
-
});
|
|
301
|
-
|
|
302
|
-
cloudRef.current.init();
|
|
303
|
-
}
|
|
304
|
-
|
|
305
|
-
return () => {
|
|
306
|
-
cloudRef.current?.destroy();
|
|
307
|
-
};
|
|
308
|
-
}, []);
|
|
309
|
-
|
|
310
|
-
return <div id="cloud" ref={containerRef} />;
|
|
311
|
-
}
|
|
312
|
-
```
|
|
154
|
+
- **Resize**: Responsive layout adjustment (debounced)
|
|
313
155
|
|
|
314
156
|
## Browser Support
|
|
315
157
|
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@frybynite/image-cloud",
|
|
3
|
-
"version": "0.1.
|
|
4
|
-
"description": "TypeScript image cloud library with
|
|
3
|
+
"version": "0.1.2",
|
|
4
|
+
"description": "TypeScript image cloud library with custom loaders, various layouts, full images styling, what animation and zoom effects",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/image-cloud.umd.js",
|
|
7
7
|
"module": "./dist/image-cloud.js",
|