@frybynite/image-cloud 0.1.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/LICENSE +21 -0
- package/README.md +345 -0
- package/dist/image-cloud-auto-init.js +3106 -0
- package/dist/image-cloud-auto-init.js.map +1 -0
- package/dist/image-cloud.js +3078 -0
- package/dist/image-cloud.js.map +1 -0
- package/dist/image-cloud.umd.js +5 -0
- package/dist/image-cloud.umd.js.map +1 -0
- package/dist/index.d.ts +1514 -0
- package/dist/style.css +1 -0
- package/package.json +70 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Fry By Nite
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,345 @@
|
|
|
1
|
+
# Image Cloud Library
|
|
2
|
+
|
|
3
|
+
A TypeScript library for creating interactive image clouds with animated scattered layouts and zoom effects. Supports multiple image sources (Google Drive, static URLs) and layout algorithms.
|
|
4
|
+
|
|
5
|
+
> [!WARNING]
|
|
6
|
+
> All minor versions of this library before 1.0 (e.g., 0.1, 0.2, ...) will include breaking changes during development. Please re-test every time before upgrading until we have published v1.0.
|
|
7
|
+
|
|
8
|
+
## Features
|
|
9
|
+
|
|
10
|
+
- ✨ Animated image layouts with smooth transitions
|
|
11
|
+
- 🎯 Multiple layout algorithms (radial, grid, spiral, cluster, wave, random)
|
|
12
|
+
- 🎬 Rich entry animations (bounce, elastic, wave paths; spin, wobble rotations)
|
|
13
|
+
- 🔍 Zoom/focus interactions with keyboard navigation
|
|
14
|
+
- 🎨 State-based image styling (borders, shadows, filters for default/hover/focused)
|
|
15
|
+
- 📱 Responsive design with adaptive sizing
|
|
16
|
+
- 🖼️ Multiple image sources (Google Drive, static URLs, composite loaders)
|
|
17
|
+
- 🛠️ Interactive configurator for visual configuration
|
|
18
|
+
- 📦 Zero runtime dependencies
|
|
19
|
+
- 🔷 Full TypeScript support
|
|
20
|
+
|
|
21
|
+
## Installation
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
npm install @frybynite/image-cloud
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
### CDN
|
|
28
|
+
|
|
29
|
+
No install needed — load directly from a CDN:
|
|
30
|
+
|
|
31
|
+
**jsDelivr**
|
|
32
|
+
```
|
|
33
|
+
https://cdn.jsdelivr.net/npm/@frybynite/image-cloud@0.1.0/dist/image-cloud.js (ESM)
|
|
34
|
+
https://cdn.jsdelivr.net/npm/@frybynite/image-cloud@0.1.0/dist/image-cloud.umd.js (UMD)
|
|
35
|
+
https://cdn.jsdelivr.net/npm/@frybynite/image-cloud@0.1.0/dist/image-cloud-auto-init.js
|
|
36
|
+
https://cdn.jsdelivr.net/npm/@frybynite/image-cloud@0.1.0/dist/style.css
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
**unpkg**
|
|
40
|
+
```
|
|
41
|
+
https://unpkg.com/@frybynite/image-cloud@0.1.0/dist/image-cloud.js (ESM)
|
|
42
|
+
https://unpkg.com/@frybynite/image-cloud@0.1.0/dist/image-cloud.umd.js (UMD)
|
|
43
|
+
https://unpkg.com/@frybynite/image-cloud@0.1.0/dist/image-cloud-auto-init.js
|
|
44
|
+
https://unpkg.com/@frybynite/image-cloud@0.1.0/dist/style.css
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
Replace `@0.1.0` with the desired version, or use `@latest` for the most recent release.
|
|
48
|
+
|
|
49
|
+
## Quick Start
|
|
50
|
+
|
|
51
|
+
### TypeScript/JavaScript (Programmatic API)
|
|
52
|
+
|
|
53
|
+
```typescript
|
|
54
|
+
import { ImageCloud } from '@frybynite/image-cloud';
|
|
55
|
+
import '@frybynite/image-cloud/style.css';
|
|
56
|
+
|
|
57
|
+
const cloud = new ImageCloud({
|
|
58
|
+
container: 'myCloud',
|
|
59
|
+
loader: {
|
|
60
|
+
type: 'static',
|
|
61
|
+
static: {
|
|
62
|
+
sources: [
|
|
63
|
+
{
|
|
64
|
+
type: 'urls',
|
|
65
|
+
urls: [
|
|
66
|
+
'https://example.com/image1.jpg',
|
|
67
|
+
'https://example.com/image2.jpg',
|
|
68
|
+
'https://example.com/image3.jpg'
|
|
69
|
+
]
|
|
70
|
+
}
|
|
71
|
+
]
|
|
72
|
+
}
|
|
73
|
+
},
|
|
74
|
+
layout: {
|
|
75
|
+
algorithm: 'radial'
|
|
76
|
+
}
|
|
77
|
+
});
|
|
78
|
+
|
|
79
|
+
await cloud.init();
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
### HTML (Auto-initialization)
|
|
83
|
+
|
|
84
|
+
```html
|
|
85
|
+
<!DOCTYPE html>
|
|
86
|
+
<html>
|
|
87
|
+
<body>
|
|
88
|
+
<div
|
|
89
|
+
id="cloud"
|
|
90
|
+
style="width: 100%; height: 100vh"
|
|
91
|
+
data-image-cloud
|
|
92
|
+
data-config='{
|
|
93
|
+
"loader": {
|
|
94
|
+
"type": "static",
|
|
95
|
+
"static": {
|
|
96
|
+
"sources": [{
|
|
97
|
+
"type": "urls",
|
|
98
|
+
"urls": [
|
|
99
|
+
"https://example.com/image1.jpg",
|
|
100
|
+
"https://example.com/image2.jpg",
|
|
101
|
+
"https://example.com/image3.jpg"
|
|
102
|
+
]
|
|
103
|
+
}]
|
|
104
|
+
}
|
|
105
|
+
},
|
|
106
|
+
"layout": {
|
|
107
|
+
"algorithm": "radial"
|
|
108
|
+
}
|
|
109
|
+
}'
|
|
110
|
+
></div>
|
|
111
|
+
|
|
112
|
+
<!-- No CSS link needed — auto-init injects styles automatically -->
|
|
113
|
+
<script type="module" src="node_modules/@frybynite/image-cloud/dist/image-cloud-auto-init.js"></script>
|
|
114
|
+
</body>
|
|
115
|
+
</html>
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
## Usage Examples
|
|
119
|
+
|
|
120
|
+
### Static Images from URLs
|
|
121
|
+
|
|
122
|
+
```typescript
|
|
123
|
+
const cloud = new ImageCloud({
|
|
124
|
+
container: 'cloud',
|
|
125
|
+
loader: {
|
|
126
|
+
type: 'static',
|
|
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
|
+
});
|
|
141
|
+
|
|
142
|
+
await cloud.init();
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
### Static Images from Local Path
|
|
146
|
+
|
|
147
|
+
```typescript
|
|
148
|
+
const cloud = new ImageCloud({
|
|
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
|
+
});
|
|
163
|
+
|
|
164
|
+
await cloud.init();
|
|
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
|
+
});
|
|
185
|
+
|
|
186
|
+
await cloud.init();
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
### Custom Configuration
|
|
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
|
|
258
|
+
|
|
259
|
+
- **Click image**: Focus/zoom the image
|
|
260
|
+
- **Click outside**: Unfocus current image
|
|
261
|
+
- **ESC key**: Unfocus current image
|
|
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';
|
|
270
|
+
|
|
271
|
+
class CustomGenerator implements PlacementGenerator {
|
|
272
|
+
generate(count: number, bounds: ContainerBounds): ImageLayout[] {
|
|
273
|
+
// Your custom layout algorithm
|
|
274
|
+
return layouts;
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
```
|
|
278
|
+
|
|
279
|
+
### React Integration
|
|
280
|
+
|
|
281
|
+
```tsx
|
|
282
|
+
import { useEffect, useRef } from 'react';
|
|
283
|
+
import { ImageCloud } from '@frybynite/image-cloud';
|
|
284
|
+
import '@frybynite/image-cloud/style.css';
|
|
285
|
+
|
|
286
|
+
function CloudComponent() {
|
|
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
|
+
```
|
|
313
|
+
|
|
314
|
+
## Browser Support
|
|
315
|
+
|
|
316
|
+
- Chrome/Edge: Latest 2 versions
|
|
317
|
+
- Firefox: Latest 2 versions
|
|
318
|
+
- Safari: Latest 2 versions
|
|
319
|
+
- Mobile: iOS Safari 12+, Chrome Android
|
|
320
|
+
|
|
321
|
+
## License
|
|
322
|
+
|
|
323
|
+
MIT
|
|
324
|
+
|
|
325
|
+
## Author
|
|
326
|
+
|
|
327
|
+
[frybynite](https://github.com/frybynite)
|
|
328
|
+
|
|
329
|
+
## Examples
|
|
330
|
+
|
|
331
|
+
Check out the `examples/` directory for various usage patterns:
|
|
332
|
+
- `esm-example.html` - Modern ES module usage
|
|
333
|
+
- `cdn-umd-example.html` - Traditional script tag / CDN usage
|
|
334
|
+
- `typescript-example.ts` - TypeScript examples with React and Vue
|
|
335
|
+
- See `examples/README.md` for detailed instructions
|
|
336
|
+
|
|
337
|
+
Also see:
|
|
338
|
+
- `index.html` - Production Google Drive cloud
|
|
339
|
+
- `index-static.html` - Static image sources example
|
|
340
|
+
|
|
341
|
+
## Contributing
|
|
342
|
+
|
|
343
|
+
Contributions are welcome! Please feel free to submit a Pull Request.
|
|
344
|
+
|
|
345
|
+
See [docs/DEVELOPER.md](docs/DEVELOPER.md) for build scripts, testing, and project structure.
|