@progressive-development/pd-content 1.0.3 → 1.1.1
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/dist/index.d.ts +2 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +0 -4
- package/dist/node_modules/.pnpm/@codemirror_autocomplete@6.20.1/node_modules/@codemirror/autocomplete/dist/index.js +550 -0
- package/dist/node_modules/.pnpm/@codemirror_lang-css@6.3.1/node_modules/@codemirror/lang-css/dist/index.js +264 -0
- package/dist/node_modules/.pnpm/@codemirror_lang-html@6.4.11/node_modules/@codemirror/lang-html/dist/index.js +661 -0
- package/dist/node_modules/.pnpm/@codemirror_lang-java@6.0.2/node_modules/@codemirror/lang-java/dist/index.js +44 -0
- package/dist/node_modules/.pnpm/@codemirror_lang-javascript@6.2.5/node_modules/@codemirror/lang-javascript/dist/index.js +346 -0
- package/dist/node_modules/.pnpm/@codemirror_lang-json@6.0.2/node_modules/@codemirror/lang-json/dist/index.js +32 -0
- package/dist/node_modules/.pnpm/@codemirror_lang-markdown@6.5.0/node_modules/@codemirror/lang-markdown/dist/index.js +492 -0
- package/dist/node_modules/.pnpm/@codemirror_lang-python@6.2.1/node_modules/@codemirror/lang-python/dist/index.js +308 -0
- package/dist/node_modules/.pnpm/@codemirror_language@6.12.3/node_modules/@codemirror/language/dist/index.js +1572 -0
- package/dist/node_modules/.pnpm/@codemirror_state@6.6.0/node_modules/@codemirror/state/dist/index.js +3881 -0
- package/dist/node_modules/.pnpm/@codemirror_view@6.40.0/node_modules/@codemirror/view/dist/index.js +9657 -0
- package/dist/node_modules/.pnpm/@lezer_common@1.5.1/node_modules/@lezer/common/dist/index.js +2196 -0
- package/dist/node_modules/.pnpm/@lezer_css@1.3.3/node_modules/@lezer/css/dist/index.js +147 -0
- package/dist/node_modules/.pnpm/@lezer_highlight@1.2.3/node_modules/@lezer/highlight/dist/index.js +898 -0
- package/dist/node_modules/.pnpm/@lezer_html@1.3.13/node_modules/@lezer/html/dist/index.js +349 -0
- package/dist/node_modules/.pnpm/@lezer_java@1.1.3/node_modules/@lezer/java/dist/index.js +67 -0
- package/dist/node_modules/.pnpm/@lezer_javascript@1.5.4/node_modules/@lezer/javascript/dist/index.js +192 -0
- package/dist/node_modules/.pnpm/@lezer_json@1.0.3/node_modules/@lezer/json/dist/index.js +37 -0
- package/dist/node_modules/.pnpm/@lezer_lr@1.4.8/node_modules/@lezer/lr/dist/index.js +1884 -0
- package/dist/node_modules/.pnpm/@lezer_markdown@1.6.3/node_modules/@lezer/markdown/dist/index.js +2335 -0
- package/dist/node_modules/.pnpm/@lezer_python@1.1.18/node_modules/@lezer/python/dist/index.js +326 -0
- package/dist/node_modules/.pnpm/@marijn_find-cluster-break@1.0.2/node_modules/@marijn/find-cluster-break/src/index.js +82 -0
- package/dist/node_modules/.pnpm/style-mod@4.1.3/node_modules/style-mod/src/style-mod.js +174 -0
- package/dist/node_modules/.pnpm/w3c-keyname@2.2.8/node_modules/w3c-keyname/index.js +121 -0
- package/dist/pd-badge-order/PdBadgeItem.d.ts +11 -0
- package/dist/pd-badge-order/PdBadgeItem.d.ts.map +1 -1
- package/dist/pd-badge-order/PdBadgeItem.js +162 -10
- package/dist/pd-badge-order/PdBadgeOrder.d.ts +56 -17
- package/dist/pd-badge-order/PdBadgeOrder.d.ts.map +1 -1
- package/dist/pd-badge-order/PdBadgeOrder.js +308 -153
- package/dist/pd-badge-order/types.js +3 -1
- package/dist/pd-code-snippet/PdCodeSnippet.d.ts +29 -0
- package/dist/pd-code-snippet/PdCodeSnippet.d.ts.map +1 -1
- package/dist/pd-code-snippet/PdCodeSnippet.js +117 -67
- package/dist/pd-code-snippet/codemirror-setup.d.ts +10 -0
- package/dist/pd-code-snippet/codemirror-setup.d.ts.map +1 -0
- package/dist/pd-code-snippet/codemirror-setup.js +101 -0
- package/dist/pd-loading-state/PdLoadingState.d.ts +4 -1
- package/dist/pd-loading-state/PdLoadingState.d.ts.map +1 -1
- package/dist/pd-loading-state/pd-loading-state.d.ts +1 -1
- package/dist/pd-loading-state/pd-loading-state.d.ts.map +1 -1
- package/dist/pd-loading-state/pd-logo-loader.js +2 -2
- package/dist/pd-more-info/PdMoreInfo.d.ts +52 -4
- package/dist/pd-more-info/PdMoreInfo.d.ts.map +1 -1
- package/dist/pd-more-info/PdMoreInfo.js +146 -24
- package/dist/pd-notice-box/PdNoticeBox.d.ts +8 -1
- package/dist/pd-notice-box/PdNoticeBox.d.ts.map +1 -1
- package/dist/pd-notice-box/PdNoticeBox.js +41 -2
- package/dist/pd-panel-viewer/PdPanel.d.ts +3 -0
- package/dist/pd-panel-viewer/PdPanel.d.ts.map +1 -1
- package/dist/pd-panel-viewer/PdPanel.js +8 -1
- package/dist/pd-panel-viewer/PdPanelViewer.d.ts +3 -0
- package/dist/pd-panel-viewer/PdPanelViewer.d.ts.map +1 -1
- package/dist/pd-panel-viewer/PdPanelViewer.js +59 -26
- package/dist/pd-tab/PdTab.d.ts +8 -5
- package/dist/pd-tab/PdTab.d.ts.map +1 -1
- package/dist/pd-tab/PdTab.js +110 -56
- package/dist/pd-timeline/PdTimeline.d.ts +2 -0
- package/dist/pd-timeline/PdTimeline.d.ts.map +1 -1
- package/dist/pd-timeline/PdTimeline.js +50 -19
- package/dist/types.d.ts +2 -2
- package/dist/types.d.ts.map +1 -1
- package/package.json +16 -8
- package/dist/pd-gallery/PdGallery.d.ts +0 -72
- package/dist/pd-gallery/PdGallery.d.ts.map +0 -1
- package/dist/pd-gallery/PdGallery.js +0 -660
- package/dist/pd-gallery/PdGalleryLightbox.d.ts +0 -53
- package/dist/pd-gallery/PdGalleryLightbox.d.ts.map +0 -1
- package/dist/pd-gallery/PdGalleryLightbox.js +0 -530
- package/dist/pd-gallery/index.d.ts +0 -4
- package/dist/pd-gallery/index.d.ts.map +0 -1
- package/dist/pd-gallery/pd-gallery-lightbox.d.ts +0 -3
- package/dist/pd-gallery/pd-gallery-lightbox.d.ts.map +0 -1
- package/dist/pd-gallery/pd-gallery.d.ts +0 -3
- package/dist/pd-gallery/pd-gallery.d.ts.map +0 -1
- package/dist/pd-gallery/types.d.ts +0 -23
- package/dist/pd-gallery/types.d.ts.map +0 -1
- package/dist/pd-gallery-lightbox.d.ts +0 -2
- package/dist/pd-gallery-lightbox.js +0 -8
- package/dist/pd-gallery.d.ts +0 -2
- package/dist/pd-gallery.js +0 -8
|
@@ -1,530 +0,0 @@
|
|
|
1
|
-
import { LitElement, css, nothing, html } from 'lit';
|
|
2
|
-
import { property, state, query } from 'lit/decorators.js';
|
|
3
|
-
import '@progressive-development/pd-dialog/pd-popup';
|
|
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 PdGalleryLightbox extends LitElement {
|
|
15
|
-
constructor() {
|
|
16
|
-
super(...arguments);
|
|
17
|
-
this.images = [];
|
|
18
|
-
this.currentIndex = 0;
|
|
19
|
-
this.open = false;
|
|
20
|
-
this._imageLoaded = false;
|
|
21
|
-
/** @ignore */
|
|
22
|
-
this._touchStartX = 0;
|
|
23
|
-
/** @ignore */
|
|
24
|
-
this._touchStartY = 0;
|
|
25
|
-
/** @ignore */
|
|
26
|
-
this._touchDeltaX = 0;
|
|
27
|
-
this._handleKeyDown = (e) => {
|
|
28
|
-
if (!this.open) return;
|
|
29
|
-
switch (e.key) {
|
|
30
|
-
case "ArrowLeft":
|
|
31
|
-
e.preventDefault();
|
|
32
|
-
this._prev();
|
|
33
|
-
break;
|
|
34
|
-
case "ArrowRight":
|
|
35
|
-
e.preventDefault();
|
|
36
|
-
this._next();
|
|
37
|
-
break;
|
|
38
|
-
}
|
|
39
|
-
};
|
|
40
|
-
}
|
|
41
|
-
static {
|
|
42
|
-
this.styles = [
|
|
43
|
-
css`
|
|
44
|
-
:host {
|
|
45
|
-
display: contents;
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
.lightbox-wrapper {
|
|
49
|
-
--pd-popup-default-display: none;
|
|
50
|
-
--pd-popup-modal-padding: 0;
|
|
51
|
-
--pd-popup-modal-padding-top: 0;
|
|
52
|
-
--pd-popup-modal-padding-bottom: 0;
|
|
53
|
-
--pd-popup-content-bg: transparent;
|
|
54
|
-
--pd-popup-max-width: 100vw;
|
|
55
|
-
--pd-popup-width: 100%;
|
|
56
|
-
--pd-popup-modal-slot-max-width: none;
|
|
57
|
-
--pd-popup-modal-slot-margin: 0;
|
|
58
|
-
--pd-popup-border-radius: 0;
|
|
59
|
-
--pd-popup-content-height: 100vh;
|
|
60
|
-
--pd-popup-modal-bg-rgba: var(
|
|
61
|
-
--pd-gallery-overlay-bg,
|
|
62
|
-
rgba(0, 0, 0, 0.92)
|
|
63
|
-
);
|
|
64
|
-
--pd-popup-z-index: var(--pd-gallery-lightbox-z, 200);
|
|
65
|
-
--pd-border-width: 0;
|
|
66
|
-
--pd-shadow-xl: none;
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
.lightbox {
|
|
70
|
-
display: flex;
|
|
71
|
-
flex-direction: column;
|
|
72
|
-
height: 100vh;
|
|
73
|
-
width: 100%;
|
|
74
|
-
position: relative;
|
|
75
|
-
user-select: none;
|
|
76
|
-
-webkit-user-select: none;
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
/* Top bar */
|
|
80
|
-
.lb-top-bar {
|
|
81
|
-
display: flex;
|
|
82
|
-
align-items: center;
|
|
83
|
-
justify-content: space-between;
|
|
84
|
-
padding: 0.75rem 1rem;
|
|
85
|
-
color: #fff;
|
|
86
|
-
font-size: 0.875rem;
|
|
87
|
-
flex-shrink: 0;
|
|
88
|
-
z-index: 2;
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
.lb-counter {
|
|
92
|
-
opacity: 0.8;
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
.lb-close {
|
|
96
|
-
background: none;
|
|
97
|
-
border: none;
|
|
98
|
-
color: #fff;
|
|
99
|
-
font-size: 1.75rem;
|
|
100
|
-
cursor: pointer;
|
|
101
|
-
padding: 0.25rem 0.5rem;
|
|
102
|
-
line-height: 1;
|
|
103
|
-
border-radius: 4px;
|
|
104
|
-
transition: background-color 0.15s ease;
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
.lb-close:hover,
|
|
108
|
-
.lb-close:focus-visible {
|
|
109
|
-
background-color: rgba(255, 255, 255, 0.15);
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
.lb-close:focus-visible {
|
|
113
|
-
outline: 2px solid rgba(255, 255, 255, 0.6);
|
|
114
|
-
outline-offset: 2px;
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
/* Navigation arrows */
|
|
118
|
-
.lb-nav {
|
|
119
|
-
position: absolute;
|
|
120
|
-
top: 50%;
|
|
121
|
-
transform: translateY(-50%);
|
|
122
|
-
z-index: 2;
|
|
123
|
-
background: rgba(0, 0, 0, 0.4);
|
|
124
|
-
border: none;
|
|
125
|
-
color: #fff;
|
|
126
|
-
width: var(--pd-gallery-nav-size, 44px);
|
|
127
|
-
height: var(--pd-gallery-nav-size, 44px);
|
|
128
|
-
border-radius: 50%;
|
|
129
|
-
cursor: pointer;
|
|
130
|
-
display: flex;
|
|
131
|
-
align-items: center;
|
|
132
|
-
justify-content: center;
|
|
133
|
-
font-size: 1.25rem;
|
|
134
|
-
transition: background-color 0.15s ease;
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
.lb-nav:hover {
|
|
138
|
-
background: rgba(0, 0, 0, 0.6);
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
.lb-nav:focus-visible {
|
|
142
|
-
outline: 2px solid rgba(255, 255, 255, 0.6);
|
|
143
|
-
outline-offset: 2px;
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
.lb-nav:disabled {
|
|
147
|
-
opacity: 0.3;
|
|
148
|
-
cursor: default;
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
.lb-prev {
|
|
152
|
-
left: 1rem;
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
.lb-next {
|
|
156
|
-
right: 1rem;
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
/* Main image area */
|
|
160
|
-
.lb-main {
|
|
161
|
-
flex: 1;
|
|
162
|
-
display: flex;
|
|
163
|
-
align-items: center;
|
|
164
|
-
justify-content: center;
|
|
165
|
-
overflow: hidden;
|
|
166
|
-
position: relative;
|
|
167
|
-
min-height: 0;
|
|
168
|
-
touch-action: pan-y;
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
.lb-main img {
|
|
172
|
-
max-width: calc(100% - 6rem);
|
|
173
|
-
max-height: 100%;
|
|
174
|
-
object-fit: contain;
|
|
175
|
-
opacity: 0;
|
|
176
|
-
transition: opacity 0.2s ease;
|
|
177
|
-
}
|
|
178
|
-
|
|
179
|
-
.lb-main img.loaded {
|
|
180
|
-
opacity: 1;
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
/* Caption */
|
|
184
|
-
.lb-caption {
|
|
185
|
-
text-align: center;
|
|
186
|
-
padding: 0.5rem 1rem;
|
|
187
|
-
color: var(--pd-gallery-caption-color, #fff);
|
|
188
|
-
flex-shrink: 0;
|
|
189
|
-
}
|
|
190
|
-
|
|
191
|
-
.lb-caption-title {
|
|
192
|
-
font-weight: 600;
|
|
193
|
-
font-size: 0.9375rem;
|
|
194
|
-
}
|
|
195
|
-
|
|
196
|
-
.lb-caption-desc {
|
|
197
|
-
font-size: 0.8125rem;
|
|
198
|
-
opacity: 0.75;
|
|
199
|
-
margin-top: 0.25rem;
|
|
200
|
-
}
|
|
201
|
-
|
|
202
|
-
/* Thumbnail strip */
|
|
203
|
-
.lb-thumbs {
|
|
204
|
-
display: flex;
|
|
205
|
-
gap: 0.5rem;
|
|
206
|
-
padding: 0.75rem 1rem;
|
|
207
|
-
overflow-x: auto;
|
|
208
|
-
justify-content: center;
|
|
209
|
-
flex-shrink: 0;
|
|
210
|
-
scrollbar-width: thin;
|
|
211
|
-
scrollbar-color: rgba(255, 255, 255, 0.3) transparent;
|
|
212
|
-
}
|
|
213
|
-
|
|
214
|
-
.lb-thumbs::-webkit-scrollbar {
|
|
215
|
-
height: 4px;
|
|
216
|
-
}
|
|
217
|
-
|
|
218
|
-
.lb-thumbs::-webkit-scrollbar-thumb {
|
|
219
|
-
background: rgba(255, 255, 255, 0.3);
|
|
220
|
-
border-radius: 2px;
|
|
221
|
-
}
|
|
222
|
-
|
|
223
|
-
.lb-thumb {
|
|
224
|
-
width: var(--pd-gallery-thumb-size, 56px);
|
|
225
|
-
height: var(--pd-gallery-thumb-size, 56px);
|
|
226
|
-
flex-shrink: 0;
|
|
227
|
-
border-radius: 4px;
|
|
228
|
-
object-fit: cover;
|
|
229
|
-
cursor: pointer;
|
|
230
|
-
opacity: 0.5;
|
|
231
|
-
border: 2px solid transparent;
|
|
232
|
-
transition:
|
|
233
|
-
opacity 0.15s ease,
|
|
234
|
-
border-color 0.15s ease;
|
|
235
|
-
padding: 0;
|
|
236
|
-
background: none;
|
|
237
|
-
}
|
|
238
|
-
|
|
239
|
-
.lb-thumb:hover {
|
|
240
|
-
opacity: 0.8;
|
|
241
|
-
}
|
|
242
|
-
|
|
243
|
-
.lb-thumb:focus-visible {
|
|
244
|
-
outline: 2px solid rgba(255, 255, 255, 0.6);
|
|
245
|
-
outline-offset: 2px;
|
|
246
|
-
}
|
|
247
|
-
|
|
248
|
-
.lb-thumb.active {
|
|
249
|
-
opacity: 1;
|
|
250
|
-
border-color: var(--pd-gallery-thumb-active-border, #fff);
|
|
251
|
-
}
|
|
252
|
-
|
|
253
|
-
.lb-thumb img {
|
|
254
|
-
width: 100%;
|
|
255
|
-
height: 100%;
|
|
256
|
-
object-fit: cover;
|
|
257
|
-
border-radius: 2px;
|
|
258
|
-
pointer-events: none;
|
|
259
|
-
}
|
|
260
|
-
|
|
261
|
-
@media (max-width: 768px) {
|
|
262
|
-
.lb-nav {
|
|
263
|
-
width: 36px;
|
|
264
|
-
height: 36px;
|
|
265
|
-
font-size: 1rem;
|
|
266
|
-
}
|
|
267
|
-
|
|
268
|
-
.lb-prev {
|
|
269
|
-
left: 0.5rem;
|
|
270
|
-
}
|
|
271
|
-
|
|
272
|
-
.lb-next {
|
|
273
|
-
right: 0.5rem;
|
|
274
|
-
}
|
|
275
|
-
|
|
276
|
-
.lb-main img {
|
|
277
|
-
max-width: calc(100% - 4rem);
|
|
278
|
-
}
|
|
279
|
-
|
|
280
|
-
.lb-thumbs {
|
|
281
|
-
padding: 0.5rem;
|
|
282
|
-
gap: 0.375rem;
|
|
283
|
-
}
|
|
284
|
-
|
|
285
|
-
.lb-thumb {
|
|
286
|
-
width: 44px;
|
|
287
|
-
height: 44px;
|
|
288
|
-
}
|
|
289
|
-
}
|
|
290
|
-
|
|
291
|
-
@media (prefers-reduced-motion: reduce) {
|
|
292
|
-
.lb-main img {
|
|
293
|
-
transition: none;
|
|
294
|
-
}
|
|
295
|
-
|
|
296
|
-
.lb-thumb {
|
|
297
|
-
transition: none;
|
|
298
|
-
}
|
|
299
|
-
}
|
|
300
|
-
`
|
|
301
|
-
];
|
|
302
|
-
}
|
|
303
|
-
show(index) {
|
|
304
|
-
if (index >= 0 && index < this.images.length) {
|
|
305
|
-
this.currentIndex = index;
|
|
306
|
-
this._imageLoaded = false;
|
|
307
|
-
this.open = true;
|
|
308
|
-
this._popup?.showPopup();
|
|
309
|
-
document.addEventListener("keydown", this._handleKeyDown);
|
|
310
|
-
this._preloadNeighbors();
|
|
311
|
-
}
|
|
312
|
-
}
|
|
313
|
-
hide() {
|
|
314
|
-
this.open = false;
|
|
315
|
-
this._popup?.hidePopup();
|
|
316
|
-
document.removeEventListener("keydown", this._handleKeyDown);
|
|
317
|
-
this.dispatchEvent(
|
|
318
|
-
new CustomEvent("gallery-close", {
|
|
319
|
-
bubbles: true,
|
|
320
|
-
composed: true,
|
|
321
|
-
detail: { index: this.currentIndex }
|
|
322
|
-
})
|
|
323
|
-
);
|
|
324
|
-
}
|
|
325
|
-
disconnectedCallback() {
|
|
326
|
-
super.disconnectedCallback();
|
|
327
|
-
document.removeEventListener("keydown", this._handleKeyDown);
|
|
328
|
-
}
|
|
329
|
-
render() {
|
|
330
|
-
if (!this.images.length) return nothing;
|
|
331
|
-
const current = this.images[this.currentIndex];
|
|
332
|
-
if (!current) return nothing;
|
|
333
|
-
const hasPrev = this.currentIndex > 0;
|
|
334
|
-
const hasNext = this.currentIndex < this.images.length - 1;
|
|
335
|
-
const showThumbs = this.images.length > 1;
|
|
336
|
-
return html`
|
|
337
|
-
<div class="lightbox-wrapper">
|
|
338
|
-
<pd-popup
|
|
339
|
-
hideCloseIcon
|
|
340
|
-
closeByEscape
|
|
341
|
-
closeByBackdrop
|
|
342
|
-
blockScroll
|
|
343
|
-
popupLabel="Image gallery lightbox"
|
|
344
|
-
@popup-close=${this._onPopupClose}
|
|
345
|
-
>
|
|
346
|
-
<div slot="content" class="lightbox">
|
|
347
|
-
<div class="lb-top-bar">
|
|
348
|
-
<span class="lb-counter" aria-live="polite">
|
|
349
|
-
${this.currentIndex + 1} / ${this.images.length}
|
|
350
|
-
</span>
|
|
351
|
-
<button
|
|
352
|
-
class="lb-close"
|
|
353
|
-
aria-label="Close lightbox"
|
|
354
|
-
@click=${this.hide}
|
|
355
|
-
>
|
|
356
|
-
×
|
|
357
|
-
</button>
|
|
358
|
-
</div>
|
|
359
|
-
|
|
360
|
-
${hasPrev ? html`<button
|
|
361
|
-
class="lb-nav lb-prev"
|
|
362
|
-
aria-label="Previous image"
|
|
363
|
-
@click=${this._prev}
|
|
364
|
-
>
|
|
365
|
-
‹
|
|
366
|
-
</button>` : nothing}
|
|
367
|
-
${hasNext ? html`<button
|
|
368
|
-
class="lb-nav lb-next"
|
|
369
|
-
aria-label="Next image"
|
|
370
|
-
@click=${this._next}
|
|
371
|
-
>
|
|
372
|
-
›
|
|
373
|
-
</button>` : nothing}
|
|
374
|
-
|
|
375
|
-
<div
|
|
376
|
-
class="lb-main"
|
|
377
|
-
@touchstart=${this._onTouchStart}
|
|
378
|
-
@touchmove=${this._onTouchMove}
|
|
379
|
-
@touchend=${this._onTouchEnd}
|
|
380
|
-
>
|
|
381
|
-
<img
|
|
382
|
-
src=${current.src}
|
|
383
|
-
alt=${current.alt}
|
|
384
|
-
srcset=${current.srcset || ""}
|
|
385
|
-
class=${this._imageLoaded ? "loaded" : ""}
|
|
386
|
-
@load=${this._onImageLoad}
|
|
387
|
-
draggable="false"
|
|
388
|
-
/>
|
|
389
|
-
</div>
|
|
390
|
-
|
|
391
|
-
${current.title || current.description ? html`
|
|
392
|
-
<div class="lb-caption">
|
|
393
|
-
${current.title ? html`<div class="lb-caption-title">
|
|
394
|
-
${current.title}
|
|
395
|
-
</div>` : nothing}
|
|
396
|
-
${current.description ? html`<div class="lb-caption-desc">
|
|
397
|
-
${current.description}
|
|
398
|
-
</div>` : nothing}
|
|
399
|
-
</div>
|
|
400
|
-
` : nothing}
|
|
401
|
-
${showThumbs ? html`
|
|
402
|
-
<div
|
|
403
|
-
class="lb-thumbs"
|
|
404
|
-
role="tablist"
|
|
405
|
-
aria-label="Thumbnail navigation"
|
|
406
|
-
>
|
|
407
|
-
${this.images.map(
|
|
408
|
-
(img, i) => html`
|
|
409
|
-
<button
|
|
410
|
-
class="lb-thumb ${i === this.currentIndex ? "active" : ""}"
|
|
411
|
-
role="tab"
|
|
412
|
-
aria-selected=${i === this.currentIndex}
|
|
413
|
-
aria-label="Image ${i + 1}"
|
|
414
|
-
@click=${() => this._goTo(i)}
|
|
415
|
-
>
|
|
416
|
-
<img
|
|
417
|
-
src=${img.thumbnail || img.src}
|
|
418
|
-
alt=""
|
|
419
|
-
loading="lazy"
|
|
420
|
-
/>
|
|
421
|
-
</button>
|
|
422
|
-
`
|
|
423
|
-
)}
|
|
424
|
-
</div>
|
|
425
|
-
` : nothing}
|
|
426
|
-
</div>
|
|
427
|
-
</pd-popup>
|
|
428
|
-
</div>
|
|
429
|
-
`;
|
|
430
|
-
}
|
|
431
|
-
_next() {
|
|
432
|
-
if (this.currentIndex < this.images.length - 1) {
|
|
433
|
-
this._goTo(this.currentIndex + 1);
|
|
434
|
-
this._dispatchNavigate("next");
|
|
435
|
-
}
|
|
436
|
-
}
|
|
437
|
-
_prev() {
|
|
438
|
-
if (this.currentIndex > 0) {
|
|
439
|
-
this._goTo(this.currentIndex - 1);
|
|
440
|
-
this._dispatchNavigate("prev");
|
|
441
|
-
}
|
|
442
|
-
}
|
|
443
|
-
_goTo(index) {
|
|
444
|
-
if (index < 0 || index >= this.images.length) return;
|
|
445
|
-
this.currentIndex = index;
|
|
446
|
-
this._imageLoaded = false;
|
|
447
|
-
this._preloadNeighbors();
|
|
448
|
-
this._scrollActiveThumb();
|
|
449
|
-
}
|
|
450
|
-
_preloadNeighbors() {
|
|
451
|
-
const indices = [this.currentIndex - 1, this.currentIndex + 1];
|
|
452
|
-
for (const i of indices) {
|
|
453
|
-
if (i >= 0 && i < this.images.length) {
|
|
454
|
-
const img = new Image();
|
|
455
|
-
img.src = this.images[i].src;
|
|
456
|
-
}
|
|
457
|
-
}
|
|
458
|
-
}
|
|
459
|
-
_scrollActiveThumb() {
|
|
460
|
-
requestAnimationFrame(() => {
|
|
461
|
-
const active = this._thumbsContainer?.querySelector(".lb-thumb.active");
|
|
462
|
-
active?.scrollIntoView({
|
|
463
|
-
behavior: "smooth",
|
|
464
|
-
block: "nearest",
|
|
465
|
-
inline: "center"
|
|
466
|
-
});
|
|
467
|
-
});
|
|
468
|
-
}
|
|
469
|
-
_onImageLoad() {
|
|
470
|
-
this._imageLoaded = true;
|
|
471
|
-
}
|
|
472
|
-
_onPopupClose() {
|
|
473
|
-
if (this.open) {
|
|
474
|
-
this.hide();
|
|
475
|
-
}
|
|
476
|
-
}
|
|
477
|
-
_dispatchNavigate(direction) {
|
|
478
|
-
this.dispatchEvent(
|
|
479
|
-
new CustomEvent("gallery-navigate", {
|
|
480
|
-
bubbles: true,
|
|
481
|
-
composed: true,
|
|
482
|
-
detail: { index: this.currentIndex, direction }
|
|
483
|
-
})
|
|
484
|
-
);
|
|
485
|
-
}
|
|
486
|
-
// Touch/swipe handling
|
|
487
|
-
_onTouchStart(e) {
|
|
488
|
-
if (e.touches.length !== 1) return;
|
|
489
|
-
this._touchStartX = e.touches[0].clientX;
|
|
490
|
-
this._touchStartY = e.touches[0].clientY;
|
|
491
|
-
this._touchDeltaX = 0;
|
|
492
|
-
}
|
|
493
|
-
_onTouchMove(e) {
|
|
494
|
-
if (e.touches.length !== 1) return;
|
|
495
|
-
this._touchDeltaX = e.touches[0].clientX - this._touchStartX;
|
|
496
|
-
const deltaY = Math.abs(e.touches[0].clientY - this._touchStartY);
|
|
497
|
-
if (Math.abs(this._touchDeltaX) > deltaY) {
|
|
498
|
-
e.preventDefault();
|
|
499
|
-
}
|
|
500
|
-
}
|
|
501
|
-
_onTouchEnd() {
|
|
502
|
-
const threshold = 50;
|
|
503
|
-
if (this._touchDeltaX > threshold) {
|
|
504
|
-
this._prev();
|
|
505
|
-
} else if (this._touchDeltaX < -threshold) {
|
|
506
|
-
this._next();
|
|
507
|
-
}
|
|
508
|
-
this._touchDeltaX = 0;
|
|
509
|
-
}
|
|
510
|
-
}
|
|
511
|
-
__decorateClass([
|
|
512
|
-
property({ type: Array, attribute: false })
|
|
513
|
-
], PdGalleryLightbox.prototype, "images");
|
|
514
|
-
__decorateClass([
|
|
515
|
-
property({ type: Number })
|
|
516
|
-
], PdGalleryLightbox.prototype, "currentIndex");
|
|
517
|
-
__decorateClass([
|
|
518
|
-
property({ type: Boolean, reflect: true })
|
|
519
|
-
], PdGalleryLightbox.prototype, "open");
|
|
520
|
-
__decorateClass([
|
|
521
|
-
state()
|
|
522
|
-
], PdGalleryLightbox.prototype, "_imageLoaded");
|
|
523
|
-
__decorateClass([
|
|
524
|
-
query("pd-popup")
|
|
525
|
-
], PdGalleryLightbox.prototype, "_popup");
|
|
526
|
-
__decorateClass([
|
|
527
|
-
query(".lb-thumbs")
|
|
528
|
-
], PdGalleryLightbox.prototype, "_thumbsContainer");
|
|
529
|
-
|
|
530
|
-
export { PdGalleryLightbox };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/pd-gallery/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAC7D,YAAY,EACV,YAAY,EACZ,WAAW,EACX,iBAAiB,EACjB,kBAAkB,EAClB,qBAAqB,GACtB,MAAM,YAAY,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"pd-gallery-lightbox.d.ts","sourceRoot":"","sources":["../../src/pd-gallery/pd-gallery-lightbox.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAO3D,OAAO,EAAE,iBAAiB,EAAE,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"pd-gallery.d.ts","sourceRoot":"","sources":["../../src/pd-gallery/pd-gallery.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAO3C,OAAO,EAAE,SAAS,EAAE,CAAC"}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
export interface GalleryImage {
|
|
2
|
-
src: string;
|
|
3
|
-
alt: string;
|
|
4
|
-
title?: string;
|
|
5
|
-
description?: string;
|
|
6
|
-
thumbnail?: string;
|
|
7
|
-
srcset?: string;
|
|
8
|
-
width?: number;
|
|
9
|
-
height?: number;
|
|
10
|
-
}
|
|
11
|
-
export type GalleryMode = "grid" | "carousel" | "featured";
|
|
12
|
-
export interface GalleryOpenDetail {
|
|
13
|
-
index: number;
|
|
14
|
-
image: GalleryImage;
|
|
15
|
-
}
|
|
16
|
-
export interface GalleryCloseDetail {
|
|
17
|
-
index: number;
|
|
18
|
-
}
|
|
19
|
-
export interface GalleryNavigateDetail {
|
|
20
|
-
index: number;
|
|
21
|
-
direction: "prev" | "next";
|
|
22
|
-
}
|
|
23
|
-
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/pd-gallery/types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,YAAY;IAC3B,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,MAAM,WAAW,GAAG,MAAM,GAAG,UAAU,GAAG,UAAU,CAAC;AAE3D,MAAM,WAAW,iBAAiB;IAChC,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,YAAY,CAAC;CACrB;AAED,MAAM,WAAW,kBAAkB;IACjC,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,qBAAqB;IACpC,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,MAAM,GAAG,MAAM,CAAC;CAC5B"}
|
package/dist/pd-gallery.d.ts
DELETED