@progressive-development/pd-content 1.0.2 → 1.0.3

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.
Files changed (85) hide show
  1. package/dist/index.d.ts +5 -1
  2. package/dist/index.d.ts.map +1 -1
  3. package/dist/index.js +10 -1
  4. package/dist/pd-badge-order/DragController.d.ts +41 -0
  5. package/dist/pd-badge-order/DragController.d.ts.map +1 -0
  6. package/dist/pd-badge-order/DragController.js +239 -0
  7. package/dist/pd-badge-order/PdBadgeItem.d.ts +31 -0
  8. package/dist/pd-badge-order/PdBadgeItem.d.ts.map +1 -0
  9. package/dist/pd-badge-order/PdBadgeItem.js +320 -0
  10. package/dist/pd-badge-order/PdBadgeOrder.d.ts +68 -0
  11. package/dist/pd-badge-order/PdBadgeOrder.d.ts.map +1 -0
  12. package/dist/pd-badge-order/PdBadgeOrder.js +550 -0
  13. package/dist/pd-badge-order/flip-animator.d.ts +30 -0
  14. package/dist/pd-badge-order/flip-animator.d.ts.map +1 -0
  15. package/dist/pd-badge-order/flip-animator.js +39 -0
  16. package/dist/pd-badge-order/pd-badge-item.d.ts +3 -0
  17. package/dist/pd-badge-order/pd-badge-item.d.ts.map +1 -0
  18. package/dist/pd-badge-order/pd-badge-item.js +8 -0
  19. package/dist/pd-badge-order/pd-badge-order.d.ts +3 -0
  20. package/dist/pd-badge-order/pd-badge-order.d.ts.map +1 -0
  21. package/dist/pd-badge-order/types.d.ts +25 -0
  22. package/dist/pd-badge-order/types.d.ts.map +1 -0
  23. package/dist/pd-badge-order/types.js +3 -0
  24. package/dist/pd-badge-order.d.ts +2 -0
  25. package/dist/pd-badge-order.js +8 -0
  26. package/dist/pd-gallery/PdGallery.d.ts +72 -0
  27. package/dist/pd-gallery/PdGallery.d.ts.map +1 -0
  28. package/dist/pd-gallery/PdGallery.js +660 -0
  29. package/dist/pd-gallery/PdGalleryLightbox.d.ts +53 -0
  30. package/dist/pd-gallery/PdGalleryLightbox.d.ts.map +1 -0
  31. package/dist/pd-gallery/PdGalleryLightbox.js +530 -0
  32. package/dist/pd-gallery/index.d.ts +4 -0
  33. package/dist/pd-gallery/index.d.ts.map +1 -0
  34. package/dist/pd-gallery/pd-gallery-lightbox.d.ts +3 -0
  35. package/dist/pd-gallery/pd-gallery-lightbox.d.ts.map +1 -0
  36. package/dist/pd-gallery/pd-gallery.d.ts +3 -0
  37. package/dist/pd-gallery/pd-gallery.d.ts.map +1 -0
  38. package/dist/pd-gallery/types.d.ts +23 -0
  39. package/dist/pd-gallery/types.d.ts.map +1 -0
  40. package/dist/pd-gallery-lightbox.d.ts +2 -0
  41. package/dist/pd-gallery-lightbox.js +8 -0
  42. package/dist/pd-gallery.d.ts +2 -0
  43. package/dist/pd-gallery.js +8 -0
  44. package/dist/pd-loading-state/PdLoadingState.d.ts +25 -9
  45. package/dist/pd-loading-state/PdLoadingState.d.ts.map +1 -1
  46. package/dist/pd-loading-state/PdLoadingState.js +228 -83
  47. package/dist/pd-loading-state/pd-loading-state.d.ts.map +1 -1
  48. package/dist/pd-loading-state/pd-logo-loader.d.ts +25 -0
  49. package/dist/pd-loading-state/pd-logo-loader.d.ts.map +1 -0
  50. package/dist/pd-loading-state/pd-logo-loader.js +63 -0
  51. package/dist/pd-loading-state/register-pd-logo-loader.d.ts +6 -0
  52. package/dist/pd-loading-state/register-pd-logo-loader.d.ts.map +1 -0
  53. package/dist/pd-loading-state/register-pd-logo-loader.js +6 -0
  54. package/dist/pd-loading-state.js +8 -1
  55. package/dist/pd-panel-viewer/PdPanelViewer.d.ts.map +1 -1
  56. package/dist/pd-panel-viewer/PdPanelViewer.js +1 -1
  57. package/dist/types.d.ts +3 -0
  58. package/dist/types.d.ts.map +1 -1
  59. package/package.json +8 -3
  60. package/dist/pd-box-view/pd-box-view.stories.d.ts +0 -43
  61. package/dist/pd-box-view/pd-box-view.stories.d.ts.map +0 -1
  62. package/dist/pd-code-snippet/pd-code-snippet.stories.d.ts +0 -55
  63. package/dist/pd-code-snippet/pd-code-snippet.stories.d.ts.map +0 -1
  64. package/dist/pd-collapse/pd-collapse.stories.d.ts +0 -51
  65. package/dist/pd-collapse/pd-collapse.stories.d.ts.map +0 -1
  66. package/dist/pd-collapse-group/pd-collapse-group.stories.d.ts +0 -40
  67. package/dist/pd-collapse-group/pd-collapse-group.stories.d.ts.map +0 -1
  68. package/dist/pd-edit-content/pd-edit-content.stories.d.ts +0 -55
  69. package/dist/pd-edit-content/pd-edit-content.stories.d.ts.map +0 -1
  70. package/dist/pd-loading-state/pd-loading-state.stories.d.ts +0 -48
  71. package/dist/pd-loading-state/pd-loading-state.stories.d.ts.map +0 -1
  72. package/dist/pd-more-info/pd-more-info.stories.d.ts +0 -42
  73. package/dist/pd-more-info/pd-more-info.stories.d.ts.map +0 -1
  74. package/dist/pd-notice-box/pd-notice-box.stories.d.ts +0 -58
  75. package/dist/pd-notice-box/pd-notice-box.stories.d.ts.map +0 -1
  76. package/dist/pd-panel-viewer/pd-panel-viewer.stories.d.ts +0 -46
  77. package/dist/pd-panel-viewer/pd-panel-viewer.stories.d.ts.map +0 -1
  78. package/dist/pd-resize-content/pd-resize-content.stories.d.ts +0 -37
  79. package/dist/pd-resize-content/pd-resize-content.stories.d.ts.map +0 -1
  80. package/dist/pd-tab/pd-tab.stories.d.ts +0 -53
  81. package/dist/pd-tab/pd-tab.stories.d.ts.map +0 -1
  82. package/dist/pd-timeline/pd-timeline.stories.d.ts +0 -56
  83. package/dist/pd-timeline/pd-timeline.stories.d.ts.map +0 -1
  84. package/dist/pd-timeline-wizard/pd-timeline-wizard.stories.d.ts +0 -54
  85. package/dist/pd-timeline-wizard/pd-timeline-wizard.stories.d.ts.map +0 -1
@@ -0,0 +1,660 @@
1
+ import { LitElement, css, nothing, html } from 'lit';
2
+ import { property, state, query } from 'lit/decorators.js';
3
+ import '../pd-gallery-lightbox.js';
4
+
5
+ var __defProp = Object.defineProperty;
6
+ var __decorateClass = (decorators, target, key, kind) => {
7
+ var result = void 0 ;
8
+ for (var i = decorators.length - 1, decorator; i >= 0; i--)
9
+ if (decorator = decorators[i])
10
+ result = (decorator(target, key, result) ) || result;
11
+ if (result) __defProp(target, key, result);
12
+ return result;
13
+ };
14
+ class PdGallery extends LitElement {
15
+ constructor() {
16
+ super(...arguments);
17
+ this.images = [];
18
+ this.mode = "grid";
19
+ this.columns = 3;
20
+ this.aspectRatio = "1/1";
21
+ this.lightbox = true;
22
+ this.showCaptions = false;
23
+ this.maxHeight = "";
24
+ this.autoplay = false;
25
+ this.autoplayInterval = 5e3;
26
+ this.loop = true;
27
+ this.showProgress = true;
28
+ this._carouselIndex = 0;
29
+ /** @ignore */
30
+ this._hovered = false;
31
+ }
32
+ static {
33
+ this.styles = [
34
+ css`
35
+ :host {
36
+ display: block;
37
+ width: 100%;
38
+ }
39
+
40
+ /* ====================== GRID ====================== */
41
+
42
+ .gallery-grid {
43
+ display: grid;
44
+ grid-template-columns: repeat(var(--pd-gallery-columns, 3), 1fr);
45
+ gap: var(--pd-gallery-gap, 0.75rem);
46
+ }
47
+
48
+ .grid-item {
49
+ position: relative;
50
+ overflow: hidden;
51
+ border-radius: var(--pd-gallery-radius, 8px);
52
+ cursor: pointer;
53
+ list-style: none;
54
+ }
55
+
56
+ .grid-item:focus-visible {
57
+ outline: 2px solid var(--pd-default-col, #333);
58
+ outline-offset: 2px;
59
+ }
60
+
61
+ .grid-item img {
62
+ width: 100%;
63
+ aspect-ratio: var(--pd-gallery-aspect-ratio, 1/1);
64
+ object-fit: cover;
65
+ display: block;
66
+ transition: transform 0.25s ease;
67
+ }
68
+
69
+ .grid-item:hover img {
70
+ transform: scale(var(--pd-gallery-hover-scale, 1.03));
71
+ }
72
+
73
+ .grid-caption {
74
+ position: absolute;
75
+ bottom: 0;
76
+ left: 0;
77
+ right: 0;
78
+ padding: 0.5rem 0.75rem;
79
+ background: var(--pd-gallery-caption-bg, rgba(0, 0, 0, 0.6));
80
+ color: #fff;
81
+ font-size: 0.8125rem;
82
+ transform: translateY(100%);
83
+ transition: transform 0.2s ease;
84
+ }
85
+
86
+ .grid-item:hover .grid-caption,
87
+ .grid-caption.always-visible {
88
+ transform: translateY(0);
89
+ }
90
+
91
+ /* ===================== CAROUSEL ==================== */
92
+
93
+ .gallery-carousel {
94
+ position: relative;
95
+ width: 100%;
96
+ }
97
+
98
+ .carousel-track {
99
+ display: flex;
100
+ overflow-x: auto;
101
+ scroll-snap-type: x mandatory;
102
+ scroll-behavior: var(--pd-gallery-carousel-transition, smooth);
103
+ -webkit-overflow-scrolling: touch;
104
+ scrollbar-width: none;
105
+ gap: var(--pd-gallery-gap, 0.75rem);
106
+ }
107
+
108
+ .carousel-track::-webkit-scrollbar {
109
+ display: none;
110
+ }
111
+
112
+ .carousel-slide {
113
+ flex: 0 0 100%;
114
+ scroll-snap-align: center;
115
+ border-radius: var(--pd-gallery-radius, 8px);
116
+ overflow: hidden;
117
+ cursor: pointer;
118
+ }
119
+
120
+ .carousel-slide:focus-visible {
121
+ outline: 2px solid var(--pd-default-col, #333);
122
+ outline-offset: 2px;
123
+ }
124
+
125
+ .carousel-slide img {
126
+ width: 100%;
127
+ aspect-ratio: var(--pd-gallery-aspect-ratio, 16/9);
128
+ object-fit: cover;
129
+ display: block;
130
+ }
131
+
132
+ .carousel-nav {
133
+ position: absolute;
134
+ top: 50%;
135
+ transform: translateY(-50%);
136
+ background: rgba(255, 255, 255, 0.9);
137
+ border: none;
138
+ width: 40px;
139
+ height: 40px;
140
+ border-radius: 50%;
141
+ cursor: pointer;
142
+ display: flex;
143
+ align-items: center;
144
+ justify-content: center;
145
+ font-size: 1.25rem;
146
+ box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
147
+ transition:
148
+ background-color 0.15s ease,
149
+ opacity 0.15s ease;
150
+ z-index: 1;
151
+ }
152
+
153
+ .carousel-nav:hover {
154
+ background: #fff;
155
+ }
156
+
157
+ .carousel-nav:focus-visible {
158
+ outline: 2px solid var(--pd-default-col, #333);
159
+ outline-offset: 2px;
160
+ }
161
+
162
+ .carousel-nav:disabled {
163
+ opacity: 0.3;
164
+ cursor: default;
165
+ }
166
+
167
+ .carousel-prev {
168
+ left: 0.75rem;
169
+ }
170
+
171
+ .carousel-next {
172
+ right: 0.75rem;
173
+ }
174
+
175
+ .carousel-dots {
176
+ display: flex;
177
+ justify-content: center;
178
+ gap: 0.5rem;
179
+ padding: 0.75rem 0;
180
+ }
181
+
182
+ .carousel-dot {
183
+ width: var(--pd-gallery-dot-size, 10px);
184
+ height: var(--pd-gallery-dot-size, 10px);
185
+ border-radius: 50%;
186
+ border: none;
187
+ padding: 0;
188
+ cursor: pointer;
189
+ background: var(--pd-gallery-dot-color, rgba(0, 0, 0, 0.25));
190
+ transition: background-color 0.15s ease;
191
+ }
192
+
193
+ .carousel-dot:focus-visible {
194
+ outline: 2px solid var(--pd-default-col, #333);
195
+ outline-offset: 2px;
196
+ }
197
+
198
+ .carousel-dot.active {
199
+ background: var(
200
+ --pd-gallery-dot-active-color,
201
+ var(--pd-default-col, #333)
202
+ );
203
+ }
204
+
205
+ .carousel-caption {
206
+ text-align: center;
207
+ padding: 0.5rem 0.75rem 0;
208
+ font-size: 0.875rem;
209
+ }
210
+
211
+ .carousel-caption-title {
212
+ font-weight: 600;
213
+ }
214
+
215
+ .carousel-caption-desc {
216
+ opacity: 0.7;
217
+ margin-top: 0.125rem;
218
+ }
219
+
220
+ /* ==================== FEATURED ==================== */
221
+
222
+ .gallery-featured {
223
+ position: relative;
224
+ overflow: hidden;
225
+ border-radius: var(--pd-gallery-radius, 8px);
226
+ cursor: pointer;
227
+ }
228
+
229
+ .gallery-featured:focus-visible {
230
+ outline: 2px solid var(--pd-default-col, #333);
231
+ outline-offset: 2px;
232
+ }
233
+
234
+ .gallery-featured img {
235
+ width: 100%;
236
+ max-height: var(--pd-gallery-featured-max-height, 500px);
237
+ object-fit: cover;
238
+ display: block;
239
+ transition: transform 0.25s ease;
240
+ }
241
+
242
+ .gallery-featured:hover img {
243
+ transform: scale(var(--pd-gallery-hover-scale, 1.03));
244
+ }
245
+
246
+ .featured-caption {
247
+ position: absolute;
248
+ bottom: 0;
249
+ left: 0;
250
+ right: 0;
251
+ padding: 1rem 1.25rem;
252
+ background: linear-gradient(transparent, rgba(0, 0, 0, 0.7));
253
+ color: #fff;
254
+ }
255
+
256
+ .featured-caption-title {
257
+ font-size: 1.125rem;
258
+ font-weight: 600;
259
+ }
260
+
261
+ .featured-caption-desc {
262
+ font-size: 0.875rem;
263
+ opacity: 0.85;
264
+ margin-top: 0.25rem;
265
+ }
266
+
267
+ /* ================= RESPONSIVE ================= */
268
+
269
+ @media (max-width: 768px) {
270
+ .gallery-grid {
271
+ grid-template-columns: repeat(2, 1fr);
272
+ }
273
+
274
+ .carousel-nav {
275
+ width: 34px;
276
+ height: 34px;
277
+ font-size: 1rem;
278
+ }
279
+ }
280
+
281
+ @media (max-width: 480px) {
282
+ .gallery-grid {
283
+ grid-template-columns: 1fr;
284
+ }
285
+ }
286
+
287
+ @media (prefers-reduced-motion: reduce) {
288
+ .grid-item img,
289
+ .gallery-featured img {
290
+ transition: none;
291
+ }
292
+
293
+ .grid-caption {
294
+ transition: none;
295
+ }
296
+
297
+ .carousel-track {
298
+ scroll-behavior: auto;
299
+ }
300
+
301
+ .carousel-dot {
302
+ transition: none;
303
+ }
304
+ }
305
+ `
306
+ ];
307
+ }
308
+ connectedCallback() {
309
+ super.connectedCallback();
310
+ this._startAutoplay();
311
+ }
312
+ disconnectedCallback() {
313
+ super.disconnectedCallback();
314
+ this._stopAutoplay();
315
+ this._observer?.disconnect();
316
+ }
317
+ updated(changed) {
318
+ if (changed.has("mode") || changed.has("images")) {
319
+ this._carouselIndex = 0;
320
+ if (this.mode === "carousel") {
321
+ this._setupCarouselObserver();
322
+ this._startAutoplay();
323
+ } else {
324
+ this._stopAutoplay();
325
+ this._observer?.disconnect();
326
+ }
327
+ }
328
+ if (changed.has("columns")) {
329
+ this.style.setProperty("--pd-gallery-columns", String(this.columns));
330
+ }
331
+ if (changed.has("aspectRatio") && this.aspectRatio) {
332
+ this.style.setProperty("--pd-gallery-aspect-ratio", this.aspectRatio);
333
+ }
334
+ if (changed.has("maxHeight") && this.maxHeight) {
335
+ this.style.setProperty(
336
+ "--pd-gallery-featured-max-height",
337
+ this.maxHeight
338
+ );
339
+ }
340
+ }
341
+ render() {
342
+ if (!this.images.length) return nothing;
343
+ return html`
344
+ ${this._renderMode()}
345
+ ${this.lightbox ? html`<pd-gallery-lightbox
346
+ .images=${this.images}
347
+ ></pd-gallery-lightbox>` : nothing}
348
+ `;
349
+ }
350
+ _renderMode() {
351
+ switch (this.mode) {
352
+ case "carousel":
353
+ return this._renderCarousel();
354
+ case "featured":
355
+ return this._renderFeatured();
356
+ default:
357
+ return this._renderGrid();
358
+ }
359
+ }
360
+ // ==================== GRID ====================
361
+ _renderGrid() {
362
+ return html`
363
+ <div class="gallery-grid" role="list">
364
+ ${this.images.map(
365
+ (img, i) => html`
366
+ <div
367
+ class="grid-item"
368
+ role="listitem"
369
+ tabindex="0"
370
+ @click=${() => this._onImageClick(i)}
371
+ @keydown=${(e) => this._onItemKeyDown(e, i)}
372
+ >
373
+ <img
374
+ src=${img.src}
375
+ alt=${img.alt}
376
+ srcset=${img.srcset || ""}
377
+ loading="lazy"
378
+ draggable="false"
379
+ />
380
+ ${img.title ? html`<div
381
+ class="grid-caption ${this.showCaptions ? "always-visible" : ""}"
382
+ >
383
+ ${img.title}
384
+ </div>` : nothing}
385
+ </div>
386
+ `
387
+ )}
388
+ </div>
389
+ `;
390
+ }
391
+ // ================== CAROUSEL ==================
392
+ _renderCarousel() {
393
+ const hasPrev = this.loop || this._carouselIndex > 0;
394
+ const hasNext = this.loop || this._carouselIndex < this.images.length - 1;
395
+ const current = this.images[this._carouselIndex];
396
+ return html`
397
+ <div
398
+ class="gallery-carousel"
399
+ @mouseenter=${this._onCarouselEnter}
400
+ @mouseleave=${this._onCarouselLeave}
401
+ @focusin=${this._onCarouselEnter}
402
+ @focusout=${this._onCarouselLeave}
403
+ >
404
+ <div class="carousel-track" @keydown=${this._onCarouselKeyDown}>
405
+ ${this.images.map(
406
+ (img, i) => html`
407
+ <div
408
+ class="carousel-slide"
409
+ tabindex="0"
410
+ data-index=${i}
411
+ @click=${() => this._onImageClick(i)}
412
+ @keydown=${(e) => this._onItemKeyDown(e, i)}
413
+ >
414
+ <img
415
+ src=${img.src}
416
+ alt=${img.alt}
417
+ srcset=${img.srcset || ""}
418
+ loading=${i < 2 ? "eager" : "lazy"}
419
+ draggable="false"
420
+ />
421
+ </div>
422
+ `
423
+ )}
424
+ </div>
425
+
426
+ ${this.images.length > 1 ? html`
427
+ <button
428
+ class="carousel-nav carousel-prev"
429
+ ?disabled=${!hasPrev}
430
+ aria-label="Previous image"
431
+ @click=${this._carouselPrev}
432
+ >
433
+ &#8249;
434
+ </button>
435
+ <button
436
+ class="carousel-nav carousel-next"
437
+ ?disabled=${!hasNext}
438
+ aria-label="Next image"
439
+ @click=${this._carouselNext}
440
+ >
441
+ &#8250;
442
+ </button>
443
+ ` : nothing}
444
+ ${this.showCaptions && (current?.title || current?.description) ? html`
445
+ <div class="carousel-caption">
446
+ ${current.title ? html`<div class="carousel-caption-title">
447
+ ${current.title}
448
+ </div>` : nothing}
449
+ ${current.description ? html`<div class="carousel-caption-desc">
450
+ ${current.description}
451
+ </div>` : nothing}
452
+ </div>
453
+ ` : nothing}
454
+ ${this.showProgress && this.images.length > 1 ? html`
455
+ <div
456
+ class="carousel-dots"
457
+ role="tablist"
458
+ aria-label="Carousel navigation"
459
+ >
460
+ ${this.images.map(
461
+ (_, i) => html`
462
+ <button
463
+ class="carousel-dot ${i === this._carouselIndex ? "active" : ""}"
464
+ role="tab"
465
+ aria-selected=${i === this._carouselIndex}
466
+ aria-label="Image ${i + 1}"
467
+ @click=${() => this._carouselGoTo(i)}
468
+ ></button>
469
+ `
470
+ )}
471
+ </div>
472
+ ` : nothing}
473
+ </div>
474
+ `;
475
+ }
476
+ _setupCarouselObserver() {
477
+ this._observer?.disconnect();
478
+ this.updateComplete.then(() => {
479
+ const track = this._carouselTrack;
480
+ if (!track) return;
481
+ this._observer = new IntersectionObserver(
482
+ (entries) => {
483
+ for (const entry of entries) {
484
+ if (entry.isIntersecting) {
485
+ const index = Number(entry.target.dataset.index);
486
+ if (!isNaN(index)) {
487
+ this._carouselIndex = index;
488
+ }
489
+ }
490
+ }
491
+ },
492
+ { root: track, threshold: 0.5 }
493
+ );
494
+ track.querySelectorAll(".carousel-slide").forEach((slide) => {
495
+ this._observer.observe(slide);
496
+ });
497
+ });
498
+ }
499
+ _carouselPrev() {
500
+ if (this._carouselIndex > 0) {
501
+ this._carouselScrollTo(this._carouselIndex - 1);
502
+ } else if (this.loop) {
503
+ this._carouselScrollTo(this.images.length - 1);
504
+ }
505
+ }
506
+ _carouselNext() {
507
+ if (this._carouselIndex < this.images.length - 1) {
508
+ this._carouselScrollTo(this._carouselIndex + 1);
509
+ } else if (this.loop) {
510
+ this._carouselScrollTo(0);
511
+ }
512
+ }
513
+ _carouselGoTo(index) {
514
+ this._carouselScrollTo(index);
515
+ }
516
+ _carouselScrollTo(index) {
517
+ const track = this._carouselTrack;
518
+ if (!track) return;
519
+ const slide = track.children[index];
520
+ if (slide) {
521
+ slide.scrollIntoView({
522
+ behavior: "smooth",
523
+ block: "nearest",
524
+ inline: "center"
525
+ });
526
+ }
527
+ }
528
+ _onCarouselKeyDown(e) {
529
+ if (e.key === "ArrowLeft") {
530
+ e.preventDefault();
531
+ this._carouselPrev();
532
+ } else if (e.key === "ArrowRight") {
533
+ e.preventDefault();
534
+ this._carouselNext();
535
+ }
536
+ }
537
+ _onCarouselEnter() {
538
+ this._hovered = true;
539
+ this._stopAutoplay();
540
+ }
541
+ _onCarouselLeave() {
542
+ this._hovered = false;
543
+ this._startAutoplay();
544
+ }
545
+ // ================== FEATURED ==================
546
+ _renderFeatured() {
547
+ const img = this.images[0];
548
+ if (!img) return nothing;
549
+ return html`
550
+ <div
551
+ class="gallery-featured"
552
+ tabindex="0"
553
+ @click=${() => this._onImageClick(0)}
554
+ @keydown=${(e) => this._onItemKeyDown(e, 0)}
555
+ >
556
+ <img
557
+ src=${img.src}
558
+ alt=${img.alt}
559
+ srcset=${img.srcset || ""}
560
+ draggable="false"
561
+ />
562
+ ${img.title || img.description ? html`
563
+ <div class="featured-caption">
564
+ ${img.title ? html`<div class="featured-caption-title">${img.title}</div>` : nothing}
565
+ ${img.description ? html`<div class="featured-caption-desc">
566
+ ${img.description}
567
+ </div>` : nothing}
568
+ </div>
569
+ ` : nothing}
570
+ </div>
571
+ `;
572
+ }
573
+ // ================== SHARED ==================
574
+ _onImageClick(index) {
575
+ const image = this.images[index];
576
+ if (!image) return;
577
+ this.dispatchEvent(
578
+ new CustomEvent("gallery-image-click", {
579
+ bubbles: true,
580
+ composed: true,
581
+ detail: { index, image }
582
+ })
583
+ );
584
+ if (this.lightbox && this._lightbox) {
585
+ this.dispatchEvent(
586
+ new CustomEvent("gallery-open", {
587
+ bubbles: true,
588
+ composed: true,
589
+ detail: { index, image }
590
+ })
591
+ );
592
+ this._lightbox.show(index);
593
+ }
594
+ }
595
+ _onItemKeyDown(e, index) {
596
+ if (e.key === "Enter" || e.key === " ") {
597
+ e.preventDefault();
598
+ this._onImageClick(index);
599
+ }
600
+ }
601
+ // ================== AUTOPLAY ==================
602
+ _startAutoplay() {
603
+ this._stopAutoplay();
604
+ if (this.autoplay && this.mode === "carousel" && !this._hovered) {
605
+ this._autoplayTimer = setInterval(() => {
606
+ this._carouselNext();
607
+ }, this.autoplayInterval);
608
+ }
609
+ }
610
+ _stopAutoplay() {
611
+ if (this._autoplayTimer) {
612
+ clearInterval(this._autoplayTimer);
613
+ this._autoplayTimer = void 0;
614
+ }
615
+ }
616
+ }
617
+ __decorateClass([
618
+ property({ type: Array, attribute: false })
619
+ ], PdGallery.prototype, "images");
620
+ __decorateClass([
621
+ property({ type: String, reflect: true })
622
+ ], PdGallery.prototype, "mode");
623
+ __decorateClass([
624
+ property({ type: Number })
625
+ ], PdGallery.prototype, "columns");
626
+ __decorateClass([
627
+ property({ type: String })
628
+ ], PdGallery.prototype, "aspectRatio");
629
+ __decorateClass([
630
+ property({ type: Boolean })
631
+ ], PdGallery.prototype, "lightbox");
632
+ __decorateClass([
633
+ property({ type: Boolean })
634
+ ], PdGallery.prototype, "showCaptions");
635
+ __decorateClass([
636
+ property({ type: String })
637
+ ], PdGallery.prototype, "maxHeight");
638
+ __decorateClass([
639
+ property({ type: Boolean })
640
+ ], PdGallery.prototype, "autoplay");
641
+ __decorateClass([
642
+ property({ type: Number })
643
+ ], PdGallery.prototype, "autoplayInterval");
644
+ __decorateClass([
645
+ property({ type: Boolean })
646
+ ], PdGallery.prototype, "loop");
647
+ __decorateClass([
648
+ property({ type: Boolean })
649
+ ], PdGallery.prototype, "showProgress");
650
+ __decorateClass([
651
+ state()
652
+ ], PdGallery.prototype, "_carouselIndex");
653
+ __decorateClass([
654
+ query("pd-gallery-lightbox")
655
+ ], PdGallery.prototype, "_lightbox");
656
+ __decorateClass([
657
+ query(".carousel-track")
658
+ ], PdGallery.prototype, "_carouselTrack");
659
+
660
+ export { PdGallery };
@@ -0,0 +1,53 @@
1
+ import { LitElement, nothing, CSSResultGroup } from 'lit';
2
+ import { GalleryImage } from './types.js';
3
+ /**
4
+ * Fullscreen lightbox for image galleries. Wraps pd-popup with
5
+ * keyboard navigation, touch swipe, thumbnail strip, and preloading.
6
+ *
7
+ * @tagname pd-gallery-lightbox
8
+ *
9
+ * @event gallery-navigate - Fired on prev/next navigation.
10
+ * @event gallery-close - Fired when lightbox closes.
11
+ *
12
+ * @cssprop --pd-gallery-overlay-bg - Lightbox overlay background. Default: `rgba(0,0,0,0.92)`.
13
+ * @cssprop --pd-gallery-lightbox-z - Z-index for lightbox. Default: `200`.
14
+ * @cssprop --pd-gallery-thumb-size - Thumbnail size. Default: `56px`.
15
+ * @cssprop --pd-gallery-thumb-active-border - Active thumbnail border color. Default: `#fff`.
16
+ * @cssprop --pd-gallery-nav-size - Navigation arrow size. Default: `44px`.
17
+ * @cssprop --pd-gallery-caption-color - Caption text color. Default: `#fff`.
18
+ */
19
+ export declare class PdGalleryLightbox extends LitElement {
20
+ images: GalleryImage[];
21
+ currentIndex: number;
22
+ open: boolean;
23
+ /** @ignore */
24
+ private _imageLoaded;
25
+ /** @ignore */
26
+ private _popup;
27
+ /** @ignore */
28
+ private _thumbsContainer;
29
+ /** @ignore */
30
+ private _touchStartX;
31
+ /** @ignore */
32
+ private _touchStartY;
33
+ /** @ignore */
34
+ private _touchDeltaX;
35
+ static styles: CSSResultGroup;
36
+ show(index: number): void;
37
+ hide(): void;
38
+ disconnectedCallback(): void;
39
+ render(): import('lit').TemplateResult<1> | typeof nothing;
40
+ private _next;
41
+ private _prev;
42
+ private _goTo;
43
+ private _preloadNeighbors;
44
+ private _scrollActiveThumb;
45
+ private _onImageLoad;
46
+ private _onPopupClose;
47
+ private _dispatchNavigate;
48
+ private _handleKeyDown;
49
+ private _onTouchStart;
50
+ private _onTouchMove;
51
+ private _onTouchEnd;
52
+ }
53
+ //# sourceMappingURL=PdGalleryLightbox.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PdGalleryLightbox.d.ts","sourceRoot":"","sources":["../../src/pd-gallery/PdGalleryLightbox.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAa,OAAO,EAAE,cAAc,EAAE,MAAM,KAAK,CAAC;AAGrE,OAAO,6CAA6C,CAAC;AAErD,OAAO,KAAK,EACV,YAAY,EAGb,MAAM,YAAY,CAAC;AAEpB;;;;;;;;;;;;;;;GAeG;AACH,qBAAa,iBAAkB,SAAQ,UAAU;IAE/C,MAAM,EAAE,YAAY,EAAE,CAAM;IAG5B,YAAY,SAAK;IAGjB,IAAI,UAAS;IAEb,cAAc;IAEd,OAAO,CAAC,YAAY,CAAS;IAE7B,cAAc;IAEd,OAAO,CAAC,MAAM,CAGZ;IAEF,cAAc;IAEd,OAAO,CAAC,gBAAgB,CAAe;IAEvC,cAAc;IACd,OAAO,CAAC,YAAY,CAAK;IACzB,cAAc;IACd,OAAO,CAAC,YAAY,CAAK;IACzB,cAAc;IACd,OAAO,CAAC,YAAY,CAAK;IAEzB,OAAgB,MAAM,EAAE,cAAc,CAmQpC;IAEF,IAAI,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI;IAWzB,IAAI,IAAI,IAAI;IAaH,oBAAoB,IAAI,IAAI;IAK5B,MAAM;IAwHf,OAAO,CAAC,KAAK;IAOb,OAAO,CAAC,KAAK;IAOb,OAAO,CAAC,KAAK;IAQb,OAAO,CAAC,iBAAiB;IAUzB,OAAO,CAAC,kBAAkB;IAW1B,OAAO,CAAC,YAAY;IAIpB,OAAO,CAAC,aAAa;IAMrB,OAAO,CAAC,iBAAiB;IAUzB,OAAO,CAAC,cAAc,CAapB;IAGF,OAAO,CAAC,aAAa;IAOrB,OAAO,CAAC,YAAY;IAWpB,OAAO,CAAC,WAAW;CASpB"}