@frybynite/image-cloud 0.5.0 → 0.6.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/README.md +46 -13
- package/dist/composite-CtUxtN2l.js +96 -0
- package/dist/composite-CtUxtN2l.js.map +1 -0
- package/dist/google-drive-CC-qFSV1.js +260 -0
- package/dist/google-drive-CC-qFSV1.js.map +1 -0
- package/dist/image-cloud-auto-init.js +399 -842
- package/dist/image-cloud-auto-init.js.map +1 -1
- package/dist/image-cloud.js +1356 -1341
- package/dist/image-cloud.js.map +1 -1
- package/dist/image-cloud.umd.js +5 -5
- package/dist/image-cloud.umd.js.map +1 -1
- package/dist/index.d.ts +17 -0
- package/dist/loaders/all.d.ts +1654 -0
- package/dist/loaders/all.js +496 -0
- package/dist/loaders/all.js.map +1 -0
- package/dist/loaders/composite.d.ts +1654 -0
- package/dist/loaders/composite.js +96 -0
- package/dist/loaders/composite.js.map +1 -0
- package/dist/loaders/google-drive.d.ts +1654 -0
- package/dist/loaders/google-drive.js +260 -0
- package/dist/loaders/google-drive.js.map +1 -0
- package/dist/loaders/static.d.ts +1654 -0
- package/dist/loaders/static.js +219 -0
- package/dist/loaders/static.js.map +1 -0
- package/dist/react.d.ts +17 -0
- package/dist/react.js +575 -1018
- package/dist/react.js.map +1 -1
- package/dist/static-ejylHtQ4.js +219 -0
- package/dist/static-ejylHtQ4.js.map +1 -0
- package/dist/vue.d.ts +17 -0
- package/dist/vue.js +507 -950
- package/dist/vue.js.map +1 -1
- package/dist/web-component.d.ts +17 -0
- package/dist/web-component.js +513 -956
- package/dist/web-component.js.map +1 -1
- package/package.json +24 -5
|
@@ -0,0 +1,219 @@
|
|
|
1
|
+
const a = class a {
|
|
2
|
+
/**
|
|
3
|
+
* Register a loader implementation with the registry
|
|
4
|
+
* @param name - Loader identifier (e.g., 'static', 'google-drive', 'composite')
|
|
5
|
+
* @param Loader - Loader class constructor to register
|
|
6
|
+
*/
|
|
7
|
+
static registerLoader(e, t) {
|
|
8
|
+
a.registry.set(e, t);
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Get a registered loader implementation
|
|
12
|
+
* @param name - Loader identifier
|
|
13
|
+
* @returns Loader class constructor
|
|
14
|
+
* @throws Error if loader is not registered
|
|
15
|
+
*/
|
|
16
|
+
static getLoader(e) {
|
|
17
|
+
const t = a.registry.get(e);
|
|
18
|
+
if (!t)
|
|
19
|
+
throw new Error(
|
|
20
|
+
`Loader "${e}" is not registered. Import "@frybynite/image-cloud/loaders/${e}" or "@frybynite/image-cloud/loaders/all".`
|
|
21
|
+
);
|
|
22
|
+
return t;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Check if a loader is registered
|
|
26
|
+
* @param name - Loader identifier
|
|
27
|
+
* @returns True if the loader is registered, false otherwise
|
|
28
|
+
*/
|
|
29
|
+
static isRegistered(e) {
|
|
30
|
+
return a.registry.has(e);
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
a.registry = /* @__PURE__ */ new Map();
|
|
34
|
+
let n = a;
|
|
35
|
+
class l {
|
|
36
|
+
constructor(e) {
|
|
37
|
+
if (this._prepared = !1, this._discoveredUrls = [], this.validateUrls = e.validateUrls !== !1, this.validationTimeout = e.validationTimeout ?? 5e3, this.validationMethod = e.validationMethod ?? "head", this.debugLogging = e.debugLogging ?? !1, this.sources = e.sources ?? [], !this.sources || this.sources.length === 0)
|
|
38
|
+
throw new Error("StaticImageLoader requires at least one source to be configured");
|
|
39
|
+
this.log("StaticImageLoader initialized with config:", e);
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Prepare the loader by discovering all images from configured sources
|
|
43
|
+
* @param filter - Filter to apply to discovered images
|
|
44
|
+
*/
|
|
45
|
+
async prepare(e) {
|
|
46
|
+
this._discoveredUrls = [], this.log(`Processing ${this.sources.length} source(s)`);
|
|
47
|
+
for (const t of this.sources)
|
|
48
|
+
try {
|
|
49
|
+
const r = await this.processSource(t, e);
|
|
50
|
+
this._discoveredUrls.push(...r);
|
|
51
|
+
} catch (r) {
|
|
52
|
+
console.warn("Failed to process source:", t, r);
|
|
53
|
+
}
|
|
54
|
+
this._prepared = !0, this.log(`Successfully loaded ${this._discoveredUrls.length} image(s)`);
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Get the number of discovered images
|
|
58
|
+
* @throws Error if called before prepare()
|
|
59
|
+
*/
|
|
60
|
+
imagesLength() {
|
|
61
|
+
if (!this._prepared)
|
|
62
|
+
throw new Error("StaticImageLoader.imagesLength() called before prepare()");
|
|
63
|
+
return this._discoveredUrls.length;
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Get the ordered list of image URLs
|
|
67
|
+
* @throws Error if called before prepare()
|
|
68
|
+
*/
|
|
69
|
+
imageURLs() {
|
|
70
|
+
if (!this._prepared)
|
|
71
|
+
throw new Error("StaticImageLoader.imageURLs() called before prepare()");
|
|
72
|
+
return [...this._discoveredUrls];
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Check if the loader has been prepared
|
|
76
|
+
*/
|
|
77
|
+
isPrepared() {
|
|
78
|
+
return this._prepared;
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Process a single source object using shape-based detection
|
|
82
|
+
* @param source - Source configuration detected by key presence
|
|
83
|
+
* @param filter - Filter to apply to discovered images
|
|
84
|
+
* @returns Promise resolving to array of valid URLs from this source
|
|
85
|
+
*/
|
|
86
|
+
async processSource(e, t) {
|
|
87
|
+
return e ? "urls" in e ? await this.processUrls(e.urls, t) : "path" in e ? await this.processPath(e.path, e.files, t) : "json" in e ? await this.processJson(e.json, t) : (console.warn("Unknown source shape:", e), []) : (console.warn("Invalid source object:", e), []);
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Process a list of direct URLs
|
|
91
|
+
* @param urls - Array of image URLs
|
|
92
|
+
* @param filter - Filter to apply to discovered images
|
|
93
|
+
* @returns Promise resolving to array of validated URLs
|
|
94
|
+
*/
|
|
95
|
+
async processUrls(e, t) {
|
|
96
|
+
if (!Array.isArray(e))
|
|
97
|
+
return console.warn("URLs must be an array:", e), [];
|
|
98
|
+
const r = [];
|
|
99
|
+
for (const i of e) {
|
|
100
|
+
const s = i.split("/").pop() || i;
|
|
101
|
+
if (!t.isAllowed(s)) {
|
|
102
|
+
this.log(`Skipping filtered URL: ${i}`);
|
|
103
|
+
continue;
|
|
104
|
+
}
|
|
105
|
+
this.validateUrls ? await this.validateUrl(i) ? r.push(i) : console.warn(`Skipping invalid/missing URL: ${i}`) : r.push(i);
|
|
106
|
+
}
|
|
107
|
+
return r;
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* Process a path-based source
|
|
111
|
+
* @param basePath - Base path (relative or absolute)
|
|
112
|
+
* @param files - Array of filenames
|
|
113
|
+
* @param filter - Filter to apply to discovered images
|
|
114
|
+
* @returns Promise resolving to array of validated URLs
|
|
115
|
+
*/
|
|
116
|
+
async processPath(e, t, r) {
|
|
117
|
+
if (!Array.isArray(t))
|
|
118
|
+
return console.warn("files must be an array:", t), [];
|
|
119
|
+
const i = [];
|
|
120
|
+
for (const s of t) {
|
|
121
|
+
if (!r.isAllowed(s)) {
|
|
122
|
+
this.log(`Skipping filtered file: ${s}`);
|
|
123
|
+
continue;
|
|
124
|
+
}
|
|
125
|
+
const o = this.constructUrl(e, s);
|
|
126
|
+
this.validateUrls ? await this.validateUrl(o) ? i.push(o) : console.warn(`Skipping invalid/missing file: ${o}`) : i.push(o);
|
|
127
|
+
}
|
|
128
|
+
return i;
|
|
129
|
+
}
|
|
130
|
+
/**
|
|
131
|
+
* Process a JSON endpoint source
|
|
132
|
+
* Fetches a JSON endpoint that returns { images: string[] }
|
|
133
|
+
* @param url - JSON endpoint URL
|
|
134
|
+
* @param filter - Filter to apply to discovered images
|
|
135
|
+
* @returns Promise resolving to array of validated URLs
|
|
136
|
+
*/
|
|
137
|
+
async processJson(e, t) {
|
|
138
|
+
this.log(`Fetching JSON endpoint: ${e}`);
|
|
139
|
+
const r = new AbortController(), i = setTimeout(() => r.abort(), 1e4);
|
|
140
|
+
try {
|
|
141
|
+
const s = await fetch(e, { signal: r.signal });
|
|
142
|
+
if (clearTimeout(i), !s.ok)
|
|
143
|
+
throw new Error(`HTTP ${s.status} fetching ${e}`);
|
|
144
|
+
const o = await s.json();
|
|
145
|
+
if (!o || !Array.isArray(o.images))
|
|
146
|
+
throw new Error('JSON source must return JSON with shape { "images": ["url1", "url2", ...] }');
|
|
147
|
+
return this.log(`JSON endpoint returned ${o.images.length} image(s)`), await this.processUrls(o.images, t);
|
|
148
|
+
} catch (s) {
|
|
149
|
+
throw clearTimeout(i), s instanceof Error && s.name === "AbortError" ? new Error(`Timeout fetching JSON endpoint: ${e}`) : s;
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
/**
|
|
153
|
+
* Validate a single URL using HEAD request
|
|
154
|
+
* @param url - URL to validate
|
|
155
|
+
* @returns Promise resolving to true if valid and accessible
|
|
156
|
+
*/
|
|
157
|
+
async validateUrl(e) {
|
|
158
|
+
if (this.validationMethod === "none")
|
|
159
|
+
return !0;
|
|
160
|
+
if (this.validationMethod === "simple")
|
|
161
|
+
try {
|
|
162
|
+
return typeof window < "u" ? new URL(e, window.location.origin) : new URL(e), !0;
|
|
163
|
+
} catch {
|
|
164
|
+
return !1;
|
|
165
|
+
}
|
|
166
|
+
if (typeof window > "u")
|
|
167
|
+
return !0;
|
|
168
|
+
if (!(e.startsWith(window.location.origin) || e.startsWith("/")))
|
|
169
|
+
return this.log(`Skipping validation for cross-origin URL: ${e}`), !0;
|
|
170
|
+
try {
|
|
171
|
+
const r = new AbortController(), i = setTimeout(() => r.abort(), this.validationTimeout), s = await fetch(e, {
|
|
172
|
+
method: "HEAD",
|
|
173
|
+
signal: r.signal
|
|
174
|
+
});
|
|
175
|
+
return clearTimeout(i), s.ok ? !0 : (this.log(`Validation failed for ${e}: HTTP ${s.status}`), !1);
|
|
176
|
+
} catch (r) {
|
|
177
|
+
return r instanceof Error && (r.name === "AbortError" ? this.log(`Validation timeout for ${e}`) : this.log(`Validation failed for ${e}:`, r.message)), !1;
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
/**
|
|
181
|
+
* Construct full URL from basePath and filename
|
|
182
|
+
* @param basePath - Base path (relative or absolute)
|
|
183
|
+
* @param filename - Filename to append
|
|
184
|
+
* @returns Complete URL
|
|
185
|
+
*/
|
|
186
|
+
constructUrl(e, t) {
|
|
187
|
+
const r = e.replace(/\/$/, "");
|
|
188
|
+
if (this.isAbsoluteUrl(e))
|
|
189
|
+
return `${r}/${t}`;
|
|
190
|
+
if (typeof window > "u")
|
|
191
|
+
return `${r}/${t}`;
|
|
192
|
+
const i = window.location.origin, o = (e.startsWith("/") ? e : "/" + e).replace(/\/$/, "");
|
|
193
|
+
return `${i}${o}/${t}`;
|
|
194
|
+
}
|
|
195
|
+
/**
|
|
196
|
+
* Check if URL is absolute (contains protocol)
|
|
197
|
+
* @param url - URL to check
|
|
198
|
+
* @returns True if absolute URL
|
|
199
|
+
*/
|
|
200
|
+
isAbsoluteUrl(e) {
|
|
201
|
+
try {
|
|
202
|
+
return new URL(e), !0;
|
|
203
|
+
} catch {
|
|
204
|
+
return !1;
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
/**
|
|
208
|
+
* Debug logging helper
|
|
209
|
+
* @param args - Arguments to log
|
|
210
|
+
*/
|
|
211
|
+
log(...e) {
|
|
212
|
+
this.debugLogging && typeof console < "u" && console.log(...e);
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
n.registerLoader("static", l);
|
|
216
|
+
export {
|
|
217
|
+
l as StaticImageLoader
|
|
218
|
+
};
|
|
219
|
+
//# sourceMappingURL=static.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"static.js","sources":["../../src/engines/LoaderRegistry.ts","../../src/loaders/StaticImageLoader.ts","../../src/loaders/index-static.ts"],"sourcesContent":["/**\n * Loader Registry - Manages registration and lookup of image loader implementations\n *\n * This registry enables dynamic loading of loaders through separate bundles\n * while maintaining a central registry of available loaders. It mirrors the\n * LayoutEngine registry pattern for consistency.\n *\n * Public API:\n * - registerLoader(name, LoaderClass)\n * - getLoader(name)\n * - isRegistered(name)\n */\n\nimport type { ImageLoader, StaticLoaderInnerConfig, GoogleDriveLoaderInnerConfig } from '../config/types';\n\n/**\n * Constructor signature for loader classes\n * Supports both simple loaders and composite loaders with their respective config types\n */\nexport type LoaderConstructor =\n | (new (config: StaticLoaderInnerConfig) => ImageLoader)\n | (new (config: GoogleDriveLoaderInnerConfig) => ImageLoader)\n | (new (config: any) => ImageLoader);\n\nexport class LoaderRegistry {\n private static readonly registry = new Map<string, LoaderConstructor>();\n\n /**\n * Register a loader implementation with the registry\n * @param name - Loader identifier (e.g., 'static', 'google-drive', 'composite')\n * @param Loader - Loader class constructor to register\n */\n static registerLoader(name: string, Loader: LoaderConstructor): void {\n LoaderRegistry.registry.set(name, Loader);\n }\n\n /**\n * Get a registered loader implementation\n * @param name - Loader identifier\n * @returns Loader class constructor\n * @throws Error if loader is not registered\n */\n static getLoader(name: string): LoaderConstructor {\n const Loader = LoaderRegistry.registry.get(name);\n\n if (!Loader) {\n throw new Error(\n `Loader \"${name}\" is not registered. ` +\n `Import \"@frybynite/image-cloud/loaders/${name}\" or \"@frybynite/image-cloud/loaders/all\".`\n );\n }\n\n return Loader;\n }\n\n /**\n * Check if a loader is registered\n * @param name - Loader identifier\n * @returns True if the loader is registered, false otherwise\n */\n static isRegistered(name: string): boolean {\n return LoaderRegistry.registry.has(name);\n }\n}\n","/**\n * StaticImageLoader.ts\n * Loads images from predefined URL sources and local paths\n * Compatible with ImageCloud's loader interface\n *\n * Public API:\n * - prepare(filter) - Async discovery of images\n * - imagesLength() - Get count of discovered images\n * - imageURLs() - Get ordered list of image URLs\n * - isPrepared() - Check if loader has been prepared\n */\n\nimport type { ImageLoader, IImageFilter, StaticSource, StaticLoaderInnerConfig } from '../config/types';\n\nexport class StaticImageLoader implements ImageLoader {\n private validateUrls: boolean;\n private validationTimeout: number;\n private validationMethod: 'head' | 'simple' | 'none';\n private sources: StaticSource[];\n private debugLogging: boolean;\n\n // State for new interface\n private _prepared: boolean = false;\n private _discoveredUrls: string[] = [];\n\n constructor(config: StaticLoaderInnerConfig) {\n this.validateUrls = config.validateUrls !== false;\n this.validationTimeout = config.validationTimeout ?? 5000;\n this.validationMethod = config.validationMethod ?? 'head';\n this.debugLogging = config.debugLogging ?? false;\n this.sources = config.sources ?? [];\n\n // Validate that we have sources configured\n if (!this.sources || this.sources.length === 0) {\n throw new Error('StaticImageLoader requires at least one source to be configured');\n }\n\n this.log('StaticImageLoader initialized with config:', config);\n }\n\n /**\n * Prepare the loader by discovering all images from configured sources\n * @param filter - Filter to apply to discovered images\n */\n async prepare(filter: IImageFilter): Promise<void> {\n this._discoveredUrls = [];\n\n this.log(`Processing ${this.sources.length} source(s)`);\n\n // Process sources sequentially to preserve order\n for (const source of this.sources) {\n try {\n const urls = await this.processSource(source, filter);\n this._discoveredUrls.push(...urls);\n } catch (error) {\n console.warn('Failed to process source:', source, error);\n // Continue processing other sources\n }\n }\n\n this._prepared = true;\n this.log(`Successfully loaded ${this._discoveredUrls.length} image(s)`);\n }\n\n /**\n * Get the number of discovered images\n * @throws Error if called before prepare()\n */\n imagesLength(): number {\n if (!this._prepared) {\n throw new Error('StaticImageLoader.imagesLength() called before prepare()');\n }\n return this._discoveredUrls.length;\n }\n\n /**\n * Get the ordered list of image URLs\n * @throws Error if called before prepare()\n */\n imageURLs(): string[] {\n if (!this._prepared) {\n throw new Error('StaticImageLoader.imageURLs() called before prepare()');\n }\n return [...this._discoveredUrls];\n }\n\n /**\n * Check if the loader has been prepared\n */\n isPrepared(): boolean {\n return this._prepared;\n }\n\n /**\n * Process a single source object using shape-based detection\n * @param source - Source configuration detected by key presence\n * @param filter - Filter to apply to discovered images\n * @returns Promise resolving to array of valid URLs from this source\n */\n private async processSource(source: StaticSource, filter: IImageFilter): Promise<string[]> {\n if (!source) {\n console.warn('Invalid source object:', source);\n return [];\n }\n\n if ('urls' in source) {\n return await this.processUrls(source.urls, filter);\n } else if ('path' in source) {\n return await this.processPath(source.path, source.files, filter);\n } else if ('json' in source) {\n return await this.processJson(source.json, filter);\n } else {\n console.warn('Unknown source shape:', source);\n return [];\n }\n }\n\n /**\n * Process a list of direct URLs\n * @param urls - Array of image URLs\n * @param filter - Filter to apply to discovered images\n * @returns Promise resolving to array of validated URLs\n */\n private async processUrls(urls: string[], filter: IImageFilter): Promise<string[]> {\n if (!Array.isArray(urls)) {\n console.warn('URLs must be an array:', urls);\n return [];\n }\n\n const validUrls: string[] = [];\n\n for (const url of urls) {\n // Apply filter based on URL filename\n const filename = url.split('/').pop() || url;\n if (!filter.isAllowed(filename)) {\n this.log(`Skipping filtered URL: ${url}`);\n continue;\n }\n\n if (this.validateUrls) {\n const isValid = await this.validateUrl(url);\n if (isValid) {\n validUrls.push(url);\n } else {\n console.warn(`Skipping invalid/missing URL: ${url}`);\n }\n } else {\n // No validation - add all URLs\n validUrls.push(url);\n }\n }\n\n return validUrls;\n }\n\n /**\n * Process a path-based source\n * @param basePath - Base path (relative or absolute)\n * @param files - Array of filenames\n * @param filter - Filter to apply to discovered images\n * @returns Promise resolving to array of validated URLs\n */\n private async processPath(basePath: string, files: string[], filter: IImageFilter): Promise<string[]> {\n\n if (!Array.isArray(files)) {\n console.warn('files must be an array:', files);\n return [];\n }\n\n const validUrls: string[] = [];\n\n for (const file of files) {\n // Apply filter based on filename\n if (!filter.isAllowed(file)) {\n this.log(`Skipping filtered file: ${file}`);\n continue;\n }\n\n const url = this.constructUrl(basePath, file);\n\n if (this.validateUrls) {\n const isValid = await this.validateUrl(url);\n if (isValid) {\n validUrls.push(url);\n } else {\n console.warn(`Skipping invalid/missing file: ${url}`);\n }\n } else {\n // No validation - add all URLs\n validUrls.push(url);\n }\n }\n\n return validUrls;\n }\n\n /**\n * Process a JSON endpoint source\n * Fetches a JSON endpoint that returns { images: string[] }\n * @param url - JSON endpoint URL\n * @param filter - Filter to apply to discovered images\n * @returns Promise resolving to array of validated URLs\n */\n private async processJson(url: string, filter: IImageFilter): Promise<string[]> {\n\n this.log(`Fetching JSON endpoint: ${url}`);\n\n const controller = new AbortController();\n const timeoutId = setTimeout(() => controller.abort(), 10000);\n\n try {\n const response = await fetch(url, { signal: controller.signal });\n clearTimeout(timeoutId);\n\n if (!response.ok) {\n throw new Error(`HTTP ${response.status} fetching ${url}`);\n }\n\n const data = await response.json();\n\n if (!data || !Array.isArray(data.images)) {\n throw new Error(`JSON source must return JSON with shape { \"images\": [\"url1\", \"url2\", ...] }`);\n }\n\n this.log(`JSON endpoint returned ${data.images.length} image(s)`);\n\n // Process the URLs through the standard URL processing pipeline\n return await this.processUrls(data.images, filter);\n } catch (error) {\n clearTimeout(timeoutId);\n if (error instanceof Error && error.name === 'AbortError') {\n throw new Error(`Timeout fetching JSON endpoint: ${url}`);\n }\n throw error;\n }\n }\n\n /**\n * Validate a single URL using HEAD request\n * @param url - URL to validate\n * @returns Promise resolving to true if valid and accessible\n */\n private async validateUrl(url: string): Promise<boolean> {\n if (this.validationMethod === 'none') {\n return true;\n }\n\n if (this.validationMethod === 'simple') {\n // Basic URL format check\n try {\n if (typeof window !== 'undefined') {\n new URL(url, window.location.origin);\n } else {\n new URL(url);\n }\n return true;\n } catch {\n return false;\n }\n }\n\n // validationMethod === 'head' (default)\n // For cross-origin URLs, we can't validate due to CORS\n // So we only validate same-origin URLs\n if (typeof window === 'undefined') {\n return true; // In non-browser environment, assume valid\n }\n\n const isSameOrigin = url.startsWith(window.location.origin) ||\n url.startsWith('/');\n\n if (!isSameOrigin) {\n // Cross-origin URL - assume valid, can't validate due to CORS\n this.log(`Skipping validation for cross-origin URL: ${url}`);\n return true;\n }\n\n // Same-origin URL - validate with HEAD request\n try {\n const controller = new AbortController();\n const timeoutId = setTimeout(() => controller.abort(), this.validationTimeout);\n\n const response = await fetch(url, {\n method: 'HEAD',\n signal: controller.signal\n });\n\n clearTimeout(timeoutId);\n\n if (response.ok) {\n return true;\n } else {\n this.log(`Validation failed for ${url}: HTTP ${response.status}`);\n return false;\n }\n\n } catch (error) {\n if (error instanceof Error) {\n if (error.name === 'AbortError') {\n this.log(`Validation timeout for ${url}`);\n } else {\n this.log(`Validation failed for ${url}:`, error.message);\n }\n }\n return false;\n }\n }\n\n /**\n * Construct full URL from basePath and filename\n * @param basePath - Base path (relative or absolute)\n * @param filename - Filename to append\n * @returns Complete URL\n */\n private constructUrl(basePath: string, filename: string): string {\n // Remove trailing slash from basePath\n const cleanBase = basePath.replace(/\\/$/, '');\n\n // Check if basePath is absolute URL\n if (this.isAbsoluteUrl(basePath)) {\n return `${cleanBase}/${filename}`;\n }\n\n // Relative path - prepend current origin\n if (typeof window === 'undefined') {\n return `${cleanBase}/${filename}`; // In non-browser environment, return as-is\n }\n\n const origin = window.location.origin;\n // Ensure basePath starts with /\n const normalizedPath = basePath.startsWith('/') ? basePath : '/' + basePath;\n const cleanPath = normalizedPath.replace(/\\/$/, '');\n\n return `${origin}${cleanPath}/${filename}`;\n }\n\n /**\n * Check if URL is absolute (contains protocol)\n * @param url - URL to check\n * @returns True if absolute URL\n */\n private isAbsoluteUrl(url: string): boolean {\n try {\n new URL(url);\n return true;\n } catch {\n return false;\n }\n }\n\n /**\n * Debug logging helper\n * @param args - Arguments to log\n */\n private log(...args: unknown[]): void {\n if (this.debugLogging && typeof console !== 'undefined') {\n console.log(...args);\n }\n }\n}\n","import { LoaderRegistry } from '../engines/LoaderRegistry';\nimport { StaticImageLoader } from './StaticImageLoader';\n\nLoaderRegistry.registerLoader('static', StaticImageLoader);\n\nexport { StaticImageLoader };\n"],"names":["_LoaderRegistry","name","Loader","LoaderRegistry","StaticImageLoader","config","filter","source","urls","error","validUrls","url","filename","basePath","files","file","controller","timeoutId","response","data","cleanBase","origin","cleanPath","args"],"mappings":"AAwBO,MAAMA,IAAN,MAA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AA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQQ,aAAaI,GAAkBD,GAA0B;AAE/D,UAAMQ,IAAYP,EAAS,QAAQ,OAAO,EAAE;AAG5C,QAAI,KAAK,cAAcA,CAAQ;AAC7B,aAAO,GAAGO,CAAS,IAAIR,CAAQ;AAIjC,QAAI,OAAO,SAAW;AACpB,aAAO,GAAGQ,CAAS,IAAIR,CAAQ;AAGjC,UAAMS,IAAS,OAAO,SAAS,QAGzBC,KADiBT,EAAS,WAAW,GAAG,IAAIA,IAAW,MAAMA,GAClC,QAAQ,OAAO,EAAE;AAElD,WAAO,GAAGQ,CAAM,GAAGC,CAAS,IAAIV,CAAQ;AAAA,EAC1C;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOQ,cAAcD,GAAsB;AAC1C,QAAI;AACF,iBAAI,IAAIA,CAAG,GACJ;AAAA,IACT,QAAQ;AACN,aAAO;AAAA,IACT;AAAA,EACF;AAAA;AAAA;AAAA;AAAA;AAAA,EAMQ,OAAOY,GAAuB;AACpC,IAAI,KAAK,gBAAgB,OAAO,UAAY,OAC1C,QAAQ,IAAI,GAAGA,CAAI;AAAA,EAEvB;AACF;ACpWApB,EAAe,eAAe,UAAUC,CAAiB;"}
|
package/dist/react.d.ts
CHANGED
|
@@ -757,10 +757,12 @@ declare class ImageCloud {
|
|
|
757
757
|
/**
|
|
758
758
|
* Create appropriate image loader based on config
|
|
759
759
|
* Processes loaders array, merges shared config, wraps in CompositeLoader if needed
|
|
760
|
+
* Uses dynamic imports to trigger loader registration and enable tree-shaking
|
|
760
761
|
*/
|
|
761
762
|
private createLoader;
|
|
762
763
|
/**
|
|
763
764
|
* Create a single loader from a LoaderEntry, merging shared config
|
|
765
|
+
* Uses dynamic imports to trigger loader registration and enable tree-shaking
|
|
764
766
|
*/
|
|
765
767
|
private createLoaderFromEntry;
|
|
766
768
|
/**
|
|
@@ -1567,6 +1569,21 @@ export declare class ZoomEngine {
|
|
|
1567
1569
|
* @param fromDimensions - Optional starting dimensions (for mid-animation reversals)
|
|
1568
1570
|
*/
|
|
1569
1571
|
private startUnfocusAnimation;
|
|
1572
|
+
/**
|
|
1573
|
+
* Capture the current visual state of an element mid-animation, BEFORE cancelling.
|
|
1574
|
+
*
|
|
1575
|
+
* The computed matrix.e/f include the -50%/-50% centering offset resolved to pixels.
|
|
1576
|
+
* buildDimensionZoomTransform prepends its own translate(-50%,-50%), so passing raw
|
|
1577
|
+
* matrix.e/f doubles the centering and produces the wrong starting position.
|
|
1578
|
+
*
|
|
1579
|
+
* This method extracts the PURE positional offset (pureX = matrix.e + 0.5*midWidth)
|
|
1580
|
+
* and commits width/height/transform to inline styles before the animation is cancelled,
|
|
1581
|
+
* preventing any visual snap.
|
|
1582
|
+
*
|
|
1583
|
+
* Must be called while the animation is still running (offsetWidth reflects animated size).
|
|
1584
|
+
* Caller is responsible for calling animationEngine.cancelAllAnimations() afterwards.
|
|
1585
|
+
*/
|
|
1586
|
+
private captureMidAnimationState;
|
|
1570
1587
|
/**
|
|
1571
1588
|
* Handle animation completion
|
|
1572
1589
|
*/
|