@jjlmoya/utils-audiovisual 1.5.0 → 1.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.
@@ -73,24 +73,24 @@ const { ui } = Astro.props;
73
73
  import { extractExif, createCleanImage } from './logic';
74
74
  import type { ExifCleanerUI } from './index';
75
75
 
76
- function renderMetadata(tags: Record<string, string | number | boolean | undefined>, container: HTMLElement, riskTitle: string) {
77
- const keys = Object.keys(tags);
78
- if (keys.length === 0) {
79
- container.innerHTML = '<div class="ec-no-metadata">No se encontraron metadatos.</div>';
80
- return;
81
- }
82
- let html = `<div class="ec-metadata-title">${riskTitle}</div><ul class="ec-metadata-list">`;
83
- if (tags.GPSLocation) html += `<li><span>GPS:</span> <span>${tags.GPSLocation}</span></li>`;
84
- if (tags.Model) html += `<li><span>CÁMARA:</span> <span>${tags.Model}</span></li>`;
85
- if (tags.DateTimeOriginal) html += `<li><span>FECHA:</span> <span>${tags.DateTimeOriginal}</span></li>`;
86
- container.innerHTML = html + '</ul>';
87
- }
88
-
89
76
  function init() {
90
77
  const root = document.getElementById('ec-root');
91
78
  if (!root) return;
92
79
 
93
80
  const ui = JSON.parse(root.dataset.ui ?? '{}') as ExifCleanerUI;
81
+
82
+ function renderMetadata(tags: Record<string, string | number | boolean | undefined>, container: HTMLElement, riskTitle: string) {
83
+ const keys = Object.keys(tags);
84
+ if (keys.length === 0) {
85
+ container.innerHTML = `<div class="ec-no-metadata">${ui.noMetadataFound}</div>`;
86
+ return;
87
+ }
88
+ let html = `<div class="ec-metadata-title">${riskTitle}</div><ul class="ec-metadata-list">`;
89
+ if (tags.GPSLocation) html += `<li><span>${ui.gpsLabel}</span> <span>${tags.GPSLocation}</span></li>`;
90
+ if (tags.Model) html += `<li><span>${ui.cameraLabel}</span> <span>${tags.Model}</span></li>`;
91
+ if (tags.DateTimeOriginal) html += `<li><span>${ui.dateLabel}</span> <span>${tags.DateTimeOriginal}</span></li>`;
92
+ container.innerHTML = html + '</ul>';
93
+ }
94
94
  const initial = root.querySelector('#ec-initial') as HTMLElement;
95
95
  const processing = root.querySelector('#ec-processing') as HTMLElement;
96
96
  const result = root.querySelector('#ec-result') as HTMLElement;
@@ -114,6 +114,7 @@ const { ui } = Astro.props;
114
114
  const blob = await createCleanImage(img);
115
115
 
116
116
  downloadBtn.onclick = () => {
117
+ if (!blob) return;
117
118
  const url = URL.createObjectURL(blob);
118
119
  const a = document.createElement('a');
119
120
  a.href = url;
@@ -161,7 +162,7 @@ const { ui } = Astro.props;
161
162
  </script>
162
163
 
163
164
  <style>
164
- .ec-root {
165
+ :global(.ec-root) {
165
166
  --ec-bg: #fff;
166
167
  --ec-bg-elevated: #f8fafc;
167
168
  --ec-border: #e2e8f0;
@@ -177,7 +178,7 @@ const { ui } = Astro.props;
177
178
  margin: 0 auto;
178
179
  }
179
180
 
180
- :global(.theme-dark) .ec-root {
181
+ :global(.theme-dark .ec-root) {
181
182
  --ec-bg: #18181b;
182
183
  --ec-bg-elevated: #27272a;
183
184
  --ec-border: #3f3f46;
@@ -189,7 +190,7 @@ const { ui } = Astro.props;
189
190
  --ec-shadow: rgba(0, 0, 0, 0.3);
190
191
  }
191
192
 
192
- .ec-card {
193
+ :global(.ec-card) {
193
194
  background: var(--ec-bg);
194
195
  border: 1px solid var(--ec-border);
195
196
  border-radius: 3rem;
@@ -199,7 +200,7 @@ const { ui } = Astro.props;
199
200
  overflow: hidden;
200
201
  }
201
202
 
202
- .ec-drop {
203
+ :global(.ec-drop) {
203
204
  padding: 4rem 2rem;
204
205
  border: 3px dashed var(--ec-border);
205
206
  border-radius: 2.5rem;
@@ -212,13 +213,13 @@ const { ui } = Astro.props;
212
213
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
213
214
  }
214
215
 
215
- .ec-drop:hover,
216
- .ec-drop-active {
216
+ :global(.ec-drop:hover),
217
+ :global(.ec-drop-active) {
217
218
  border-color: var(--ec-accent);
218
219
  background: var(--ec-accent-alpha-hover);
219
220
  }
220
221
 
221
- .ec-drop-icon {
222
+ :global(.ec-drop-icon) {
222
223
  width: 6rem;
223
224
  height: 6rem;
224
225
  background: var(--ec-accent-alpha);
@@ -229,19 +230,19 @@ const { ui } = Astro.props;
229
230
  color: var(--ec-accent);
230
231
  }
231
232
 
232
- .ec-drop-icon svg {
233
+ :global(.ec-drop-icon svg) {
233
234
  width: 3rem;
234
235
  height: 3rem;
235
236
  }
236
237
 
237
- .ec-title {
238
+ :global(.ec-title) {
238
239
  font-size: 2.5rem;
239
240
  font-weight: 950;
240
241
  color: var(--ec-text);
241
242
  margin: 0;
242
243
  }
243
244
 
244
- .ec-subtitle {
245
+ :global(.ec-subtitle) {
245
246
  font-size: 1.15rem;
246
247
  color: var(--ec-text-muted);
247
248
  max-width: 500px;
@@ -249,14 +250,14 @@ const { ui } = Astro.props;
249
250
  font-weight: 700;
250
251
  }
251
252
 
252
- .ec-badges {
253
+ :global(.ec-badges) {
253
254
  display: flex;
254
255
  gap: 1rem;
255
256
  flex-wrap: wrap;
256
257
  justify-content: center;
257
258
  }
258
259
 
259
- .ec-badge {
260
+ :global(.ec-badge) {
260
261
  padding: 0.6rem 1.25rem;
261
262
  background: var(--ec-bg-elevated);
262
263
  border-radius: 2rem;
@@ -268,13 +269,13 @@ const { ui } = Astro.props;
268
269
  gap: 0.5rem;
269
270
  }
270
271
 
271
- .ec-badge svg {
272
+ :global(.ec-badge svg) {
272
273
  width: 1rem;
273
274
  height: 1rem;
274
275
  flex-shrink: 0;
275
276
  }
276
277
 
277
- .ec-processing {
278
+ :global(.ec-processing) {
278
279
  padding: 5rem;
279
280
  display: flex;
280
281
  flex-direction: column;
@@ -283,7 +284,7 @@ const { ui } = Astro.props;
283
284
  gap: 1.5rem;
284
285
  }
285
286
 
286
- .ec-spinner {
287
+ :global(.ec-spinner) {
287
288
  width: 4rem;
288
289
  height: 4rem;
289
290
  border: 4px solid var(--ec-accent-alpha);
@@ -292,45 +293,45 @@ const { ui } = Astro.props;
292
293
  animation: ec-spin 0.8s linear infinite;
293
294
  }
294
295
 
295
- .ec-processing-text {
296
+ :global(.ec-processing-text) {
296
297
  font-weight: 800;
297
298
  color: var(--ec-text);
298
299
  margin: 0;
299
300
  }
300
301
 
301
- .ec-result {
302
+ :global(.ec-result) {
302
303
  padding: 2.5rem;
303
304
  display: flex;
304
305
  flex-direction: column;
305
306
  animation: ec-slide-up 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
306
307
  }
307
308
 
308
- .ec-result-layout {
309
+ :global(.ec-result-layout) {
309
310
  display: grid;
310
311
  grid-template-columns: 1fr 1fr;
311
312
  gap: 3rem;
312
313
  }
313
314
 
314
315
  @media (max-width: 800px) {
315
- .ec-result-layout {
316
+ :global(.ec-result-layout) {
316
317
  grid-template-columns: 1fr;
317
318
  }
318
319
  }
319
320
 
320
- .ec-preview-col {
321
+ :global(.ec-preview-col) {
321
322
  display: flex;
322
323
  flex-direction: column;
323
324
  gap: 1.5rem;
324
325
  }
325
326
 
326
- .ec-preview-img {
327
+ :global(.ec-preview-img) {
327
328
  width: 100%;
328
329
  border-radius: 1.5rem;
329
330
  box-shadow: 0 20px 50px var(--ec-shadow);
330
331
  display: block;
331
332
  }
332
333
 
333
- .ec-metadata {
334
+ :global(.ec-metadata) {
334
335
  background: var(--ec-bg-elevated);
335
336
  border: 1px solid var(--ec-border);
336
337
  border-radius: 1.25rem;
@@ -341,7 +342,7 @@ const { ui } = Astro.props;
341
342
  justify-content: center;
342
343
  }
343
344
 
344
- .ec-no-metadata {
345
+ :global(.ec-no-metadata) {
345
346
  display: flex;
346
347
  align-items: center;
347
348
  justify-content: center;
@@ -350,14 +351,14 @@ const { ui } = Astro.props;
350
351
  text-align: center;
351
352
  }
352
353
 
353
- .ec-metadata-title {
354
+ :global(.ec-metadata-title) {
354
355
  color: var(--ec-accent);
355
356
  font-weight: 700;
356
357
  margin-bottom: 1rem;
357
358
  font-size: 0.9rem;
358
359
  }
359
360
 
360
- .ec-metadata-list {
361
+ :global(.ec-metadata-list) {
361
362
  list-style: none;
362
363
  padding: 0;
363
364
  margin: 0;
@@ -366,7 +367,7 @@ const { ui } = Astro.props;
366
367
  gap: 0.75rem;
367
368
  }
368
369
 
369
- .ec-metadata-list li {
370
+ :global(.ec-metadata-list li) {
370
371
  display: flex;
371
372
  justify-content: space-between;
372
373
  gap: 1rem;
@@ -375,21 +376,21 @@ const { ui } = Astro.props;
375
376
  color: var(--ec-text);
376
377
  }
377
378
 
378
- .ec-metadata-list li span:first-child {
379
+ :global(.ec-metadata-list li span:first-child) {
379
380
  font-weight: 700;
380
381
  }
381
382
 
382
- .ec-metadata-list li span:last-child {
383
+ :global(.ec-metadata-list li span:last-child) {
383
384
  color: var(--ec-text-muted);
384
385
  }
385
386
 
386
- .ec-actions-col {
387
+ :global(.ec-actions-col) {
387
388
  display: flex;
388
389
  flex-direction: column;
389
390
  gap: 1.5rem;
390
391
  }
391
392
 
392
- .ec-btn {
393
+ :global(.ec-btn) {
393
394
  padding: 1.25rem;
394
395
  border-radius: 1.5rem;
395
396
  font-weight: 950;
@@ -403,29 +404,29 @@ const { ui } = Astro.props;
403
404
  transition: all 0.2s;
404
405
  }
405
406
 
406
- .ec-btn svg {
407
+ :global(.ec-btn svg) {
407
408
  width: 1.25rem;
408
409
  height: 1.25rem;
409
410
  }
410
411
 
411
- .ec-btn-primary {
412
+ :global(.ec-btn-primary) {
412
413
  background: var(--ec-accent);
413
414
  color: #fff;
414
415
  box-shadow: 0 15px 35px -10px var(--ec-accent);
415
416
  }
416
417
 
417
- .ec-btn-primary:hover {
418
+ :global(.ec-btn-primary:hover) {
418
419
  transform: translateY(-2px);
419
420
  box-shadow: 0 20px 45px -10px var(--ec-accent);
420
421
  }
421
422
 
422
- .ec-btn-secondary {
423
+ :global(.ec-btn-secondary) {
423
424
  background: var(--ec-bg-elevated);
424
425
  border: 1px solid var(--ec-border);
425
426
  color: var(--ec-text);
426
427
  }
427
428
 
428
- .ec-btn-secondary:hover {
429
+ :global(.ec-btn-secondary:hover) {
429
430
  border-color: var(--ec-accent);
430
431
  color: var(--ec-accent);
431
432
  }