@mantine-vue/lightbox 3.3.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.
Files changed (48) hide show
  1. package/README.md +14 -0
  2. package/cjs/index.cjs +1482 -0
  3. package/cjs/index.cjs.map +1 -0
  4. package/esm/index.mjs +1431 -0
  5. package/esm/index.mjs.map +1 -0
  6. package/lib/Lightbox.d.ts +35 -0
  7. package/lib/Lightbox.props.d.ts +57 -0
  8. package/lib/Lightbox.vue.d.ts +52 -0
  9. package/lib/LightboxCaption/LightboxCaption.d.ts +5 -0
  10. package/lib/LightboxCaption/LightboxCaption.vue.d.ts +3 -0
  11. package/lib/LightboxCaption/index.d.ts +1 -0
  12. package/lib/LightboxCloseButton/LightboxCloseButton.d.ts +9 -0
  13. package/lib/LightboxCloseButton/LightboxCloseButton.vue.d.ts +13 -0
  14. package/lib/LightboxCloseButton/index.d.ts +1 -0
  15. package/lib/LightboxNavigation/LightboxNavigation.d.ts +5 -0
  16. package/lib/LightboxNavigation/LightboxNavigation.vue.d.ts +3 -0
  17. package/lib/LightboxNavigation/index.d.ts +1 -0
  18. package/lib/LightboxProvider/LightboxProvider.d.ts +7 -0
  19. package/lib/LightboxProvider/LightboxProvider.vue.d.ts +8 -0
  20. package/lib/LightboxProvider/index.d.ts +1 -0
  21. package/lib/LightboxRoot/LightboxRoot.d.ts +4 -0
  22. package/lib/LightboxRoot/LightboxRoot.types.d.ts +73 -0
  23. package/lib/LightboxRoot/LightboxRoot.vue.d.ts +35 -0
  24. package/lib/LightboxRoot/index.d.ts +1 -0
  25. package/lib/LightboxSlide/LightboxSlide.d.ts +3 -0
  26. package/lib/LightboxSlide/LightboxSlide.types.d.ts +16 -0
  27. package/lib/LightboxSlide/LightboxSlide.vue.d.ts +11 -0
  28. package/lib/LightboxSlide/index.d.ts +1 -0
  29. package/lib/LightboxSlides/LightboxSlides.d.ts +9 -0
  30. package/lib/LightboxSlides/LightboxSlides.vue.d.ts +13 -0
  31. package/lib/LightboxSlides/index.d.ts +1 -0
  32. package/lib/LightboxThumbnails/LightboxThumbnails.d.ts +5 -0
  33. package/lib/LightboxThumbnails/LightboxThumbnails.vue.d.ts +3 -0
  34. package/lib/LightboxThumbnails/index.d.ts +1 -0
  35. package/lib/LightboxToolbar/LightboxToolbar.d.ts +9 -0
  36. package/lib/LightboxToolbar/LightboxToolbar.vue.d.ts +7 -0
  37. package/lib/LightboxToolbar/index.d.ts +1 -0
  38. package/lib/LightboxToolbar/toolbar-items.d.ts +5 -0
  39. package/lib/default-labels.d.ts +2 -0
  40. package/lib/hooks/use-lightbox-zoom.d.ts +38 -0
  41. package/lib/index.d.mts +13 -0
  42. package/lib/index.d.ts +13 -0
  43. package/lib/lightbox.context.d.ts +21 -0
  44. package/lib/lightbox.store.d.ts +54 -0
  45. package/lib/types.d.ts +75 -0
  46. package/package.json +50 -0
  47. package/styles.css +201 -0
  48. package/styles.layer.css +203 -0
package/cjs/index.cjs ADDED
@@ -0,0 +1,1482 @@
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
+ //#region \0rolldown/runtime.js
3
+ var __create = Object.create;
4
+ var __defProp = Object.defineProperty;
5
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
6
+ var __getOwnPropNames = Object.getOwnPropertyNames;
7
+ var __getProtoOf = Object.getPrototypeOf;
8
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
11
+ key = keys[i];
12
+ if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
13
+ get: ((k) => from[k]).bind(null, key),
14
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
15
+ });
16
+ }
17
+ return to;
18
+ };
19
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
20
+ value: mod,
21
+ enumerable: true
22
+ }) : target, mod));
23
+ //#endregion
24
+ let _mantine_vue_core = require("@mantine-vue/core");
25
+ let vue = require("vue");
26
+ let embla_carousel_vue = require("embla-carousel-vue");
27
+ embla_carousel_vue = __toESM(embla_carousel_vue);
28
+ //#region src/lightbox.context.ts
29
+ var [provideLightboxContext, useLightboxContext] = (0, _mantine_vue_core.createSafeContext)("Lightbox component was not found in tree");
30
+ //#endregion
31
+ //#region src/LightboxCaption/LightboxCaption.vue
32
+ var LightboxCaption_default = /* @__PURE__ */ (0, vue.defineComponent)({
33
+ name: "LightboxCaption",
34
+ inheritAttrs: false,
35
+ __name: "LightboxCaption",
36
+ setup(__props) {
37
+ const attrs = (0, vue.useAttrs)();
38
+ const ctx = useLightboxContext();
39
+ const caption = (0, vue.computed)(() => ctx.slides[ctx.currentIndex]?.caption);
40
+ return (_ctx, _cache) => {
41
+ return caption.value ? ((0, vue.openBlock)(), (0, vue.createBlock)((0, vue.unref)(_mantine_vue_core.Box), (0, vue.normalizeProps)((0, vue.mergeProps)({ key: 0 }, {
42
+ ...(0, vue.unref)(attrs),
43
+ ...(0, vue.unref)(ctx).getStyles("caption")
44
+ })), {
45
+ default: (0, vue.withCtx)(() => [((0, vue.openBlock)(), (0, vue.createBlock)((0, vue.resolveDynamicComponent)(() => caption.value)))]),
46
+ _: 1
47
+ }, 16)) : (0, vue.createCommentVNode)("", true);
48
+ };
49
+ }
50
+ });
51
+ //#endregion
52
+ //#region src/LightboxNavigation/LightboxNavigation.vue?vue&type=script&setup=true&lang.ts
53
+ var _hoisted_1$3 = {
54
+ xmlns: "http://www.w3.org/2000/svg",
55
+ viewBox: "0 0 24 24",
56
+ width: "36",
57
+ height: "36",
58
+ fill: "none",
59
+ stroke: "currentColor",
60
+ "stroke-width": "2",
61
+ "stroke-linecap": "round",
62
+ "stroke-linejoin": "round",
63
+ "aria-hidden": "true"
64
+ };
65
+ var _hoisted_2$2 = ["points"];
66
+ var _hoisted_3$1 = {
67
+ xmlns: "http://www.w3.org/2000/svg",
68
+ viewBox: "0 0 24 24",
69
+ width: "36",
70
+ height: "36",
71
+ fill: "none",
72
+ stroke: "currentColor",
73
+ "stroke-width": "2",
74
+ "stroke-linecap": "round",
75
+ "stroke-linejoin": "round",
76
+ "aria-hidden": "true"
77
+ };
78
+ var _hoisted_4 = ["points"];
79
+ //#endregion
80
+ //#region src/LightboxNavigation/LightboxNavigation.vue
81
+ var LightboxNavigation_default = /* @__PURE__ */ (0, vue.defineComponent)({
82
+ name: "LightboxNavigation",
83
+ inheritAttrs: false,
84
+ __name: "LightboxNavigation",
85
+ setup(__props) {
86
+ const attrs = (0, vue.useAttrs)();
87
+ const ctx = useLightboxContext();
88
+ const { dir } = (0, _mantine_vue_core.useDirection)();
89
+ const canPrev = (0, vue.computed)(() => ctx.loop ? ctx.slides.length > 1 : ctx.currentIndex > 0);
90
+ const canNext = (0, vue.computed)(() => ctx.loop ? ctx.slides.length > 1 : ctx.currentIndex < ctx.slides.length - 1);
91
+ return (_ctx, _cache) => {
92
+ return (0, vue.openBlock)(), (0, vue.createBlock)((0, vue.unref)(_mantine_vue_core.Box), (0, vue.normalizeProps)((0, vue.guardReactiveProps)({
93
+ ...(0, vue.unref)(attrs),
94
+ ...(0, vue.unref)(ctx).getStyles("navigation")
95
+ })), {
96
+ default: (0, vue.withCtx)(() => [(0, vue.createVNode)((0, vue.unref)(_mantine_vue_core.UnstyledButton), (0, vue.mergeProps)((0, vue.unref)(ctx).getStyles("navigationButton"), {
97
+ "data-inactive": !canPrev.value || void 0,
98
+ "aria-disabled": !canPrev.value || void 0,
99
+ "aria-label": (0, vue.unref)(ctx).labels.previousSlideLabel,
100
+ tabindex: canPrev.value ? 0 : -1,
101
+ onClick: (0, vue.unref)(ctx).prev
102
+ }), {
103
+ default: (0, vue.withCtx)(() => [((0, vue.openBlock)(), (0, vue.createElementBlock)("svg", _hoisted_1$3, [(0, vue.createElementVNode)("polyline", { points: (0, vue.unref)(dir) === "rtl" ? "9 18 15 12 9 6" : "15 18 9 12 15 6" }, null, 8, _hoisted_2$2)]))]),
104
+ _: 1
105
+ }, 16, [
106
+ "data-inactive",
107
+ "aria-disabled",
108
+ "aria-label",
109
+ "tabindex",
110
+ "onClick"
111
+ ]), (0, vue.createVNode)((0, vue.unref)(_mantine_vue_core.UnstyledButton), (0, vue.mergeProps)((0, vue.unref)(ctx).getStyles("navigationButton"), {
112
+ "data-inactive": !canNext.value || void 0,
113
+ "aria-disabled": !canNext.value || void 0,
114
+ "aria-label": (0, vue.unref)(ctx).labels.nextSlideLabel,
115
+ tabindex: canNext.value ? 0 : -1,
116
+ onClick: (0, vue.unref)(ctx).next
117
+ }), {
118
+ default: (0, vue.withCtx)(() => [((0, vue.openBlock)(), (0, vue.createElementBlock)("svg", _hoisted_3$1, [(0, vue.createElementVNode)("polyline", { points: (0, vue.unref)(dir) === "rtl" ? "15 18 9 12 15 6" : "9 18 15 12 9 6" }, null, 8, _hoisted_4)]))]),
119
+ _: 1
120
+ }, 16, [
121
+ "data-inactive",
122
+ "aria-disabled",
123
+ "aria-label",
124
+ "tabindex",
125
+ "onClick"
126
+ ])]),
127
+ _: 1
128
+ }, 16);
129
+ };
130
+ }
131
+ });
132
+ //#endregion
133
+ //#region src/default-labels.ts
134
+ var DEFAULT_LABELS = {
135
+ lightboxLabel: "Gallery",
136
+ slideLabel: (index, total) => `Slide ${index} of ${total}`,
137
+ slidesLabel: "Slides",
138
+ previousSlideLabel: "Previous slide",
139
+ nextSlideLabel: "Next slide",
140
+ thumbnailLabel: (index) => `Go to slide ${index}`,
141
+ enterFullscreenLabel: "Enter fullscreen",
142
+ exitFullscreenLabel: "Exit fullscreen",
143
+ showThumbnailsLabel: "Show thumbnails",
144
+ hideThumbnailsLabel: "Hide thumbnails",
145
+ downloadLabel: "Download",
146
+ closeLabel: "Close"
147
+ };
148
+ //#endregion
149
+ //#region src/hooks/use-lightbox-zoom.ts
150
+ var INITIAL_ZOOM_STATE = {
151
+ scale: 1,
152
+ translateX: 0,
153
+ translateY: 0,
154
+ isZoomed: false
155
+ };
156
+ function clampTranslate(state, image) {
157
+ if (!image) return state;
158
+ const maxX = image.offsetWidth * (state.scale - 1) / 2;
159
+ const maxY = image.offsetHeight * (state.scale - 1) / 2;
160
+ return {
161
+ ...state,
162
+ translateX: Math.max(-maxX, Math.min(maxX, state.translateX)),
163
+ translateY: Math.max(-maxY, Math.min(maxY, state.translateY))
164
+ };
165
+ }
166
+ function useLightboxZoom({ enabled, maxScale, currentIndex }) {
167
+ const state = (0, vue.reactive)({ ...INITIAL_ZOOM_STATE });
168
+ const imageRef = (0, vue.ref)(null);
169
+ const isDragging = (0, vue.ref)(false);
170
+ const isAdjusting = (0, vue.ref)(false);
171
+ const didDrag = (0, vue.ref)(false);
172
+ const dragStart = {
173
+ x: 0,
174
+ y: 0
175
+ };
176
+ const translateStart = {
177
+ x: 0,
178
+ y: 0
179
+ };
180
+ const lastPinchDistance = (0, vue.ref)(null);
181
+ const lastPointerType = (0, vue.ref)("mouse");
182
+ const lastClickPointerType = (0, vue.ref)("mouse");
183
+ let adjustTimeout = -1;
184
+ const setState = (next) => Object.assign(state, next);
185
+ const resetZoom = () => {
186
+ setState(INITIAL_ZOOM_STATE);
187
+ isDragging.value = false;
188
+ };
189
+ const beginAdjust = () => {
190
+ isAdjusting.value = true;
191
+ window.clearTimeout(adjustTimeout);
192
+ adjustTimeout = window.setTimeout(() => {
193
+ isAdjusting.value = false;
194
+ }, 120);
195
+ };
196
+ const toggleZoom = () => {
197
+ if (!enabled()) return;
198
+ setState(state.isZoomed ? INITIAL_ZOOM_STATE : {
199
+ scale: Math.min(2, maxScale()),
200
+ translateX: 0,
201
+ translateY: 0,
202
+ isZoomed: true
203
+ });
204
+ };
205
+ const zoomAtPoint = (deltaScale, clientX, clientY) => {
206
+ const nextScale = Math.max(1, Math.min(maxScale(), state.scale + deltaScale));
207
+ if (nextScale === 1) {
208
+ resetZoom();
209
+ return;
210
+ }
211
+ const image = imageRef.value;
212
+ let translateX = state.translateX;
213
+ let translateY = state.translateY;
214
+ if (image && clientX !== void 0 && clientY !== void 0) {
215
+ const rect = image.getBoundingClientRect();
216
+ const scaleRatio = nextScale / state.scale;
217
+ const offsetX = clientX - (rect.left + rect.width / 2) + state.translateX;
218
+ const offsetY = clientY - (rect.top + rect.height / 2) + state.translateY;
219
+ translateX = offsetX * (1 - scaleRatio) + state.translateX * scaleRatio;
220
+ translateY = offsetY * (1 - scaleRatio) + state.translateY * scaleRatio;
221
+ }
222
+ setState(clampTranslate({
223
+ scale: nextScale,
224
+ translateX,
225
+ translateY,
226
+ isZoomed: true
227
+ }, image));
228
+ };
229
+ const panZoom = (deltaX, deltaY) => {
230
+ if (!state.isZoomed) return false;
231
+ setState(clampTranslate({
232
+ ...state,
233
+ translateX: state.translateX + deltaX,
234
+ translateY: state.translateY + deltaY
235
+ }, imageRef.value));
236
+ return true;
237
+ };
238
+ const handleWheel = (event) => {
239
+ if (event.deltaY === 0) return;
240
+ event.preventDefault();
241
+ beginAdjust();
242
+ zoomAtPoint(event.deltaY > 0 ? -.2 : .2, event.clientX, event.clientY);
243
+ };
244
+ const setImageRef = (node) => {
245
+ imageRef.value?.removeEventListener("wheel", handleWheel);
246
+ imageRef.value = node instanceof HTMLImageElement ? node : null;
247
+ imageRef.value?.addEventListener("wheel", handleWheel, { passive: false });
248
+ };
249
+ const handlePointerDown = (event) => {
250
+ lastPointerType.value = event.pointerType || "mouse";
251
+ if (!state.isZoomed || !enabled()) return;
252
+ isDragging.value = true;
253
+ didDrag.value = false;
254
+ dragStart.x = event.clientX;
255
+ dragStart.y = event.clientY;
256
+ translateStart.x = state.translateX;
257
+ translateStart.y = state.translateY;
258
+ if (typeof event.target?.setPointerCapture === "function") event.target.setPointerCapture(event.pointerId);
259
+ };
260
+ const handlePointerMove = (event) => {
261
+ if (!isDragging.value || !enabled()) return;
262
+ const dx = event.clientX - dragStart.x;
263
+ const dy = event.clientY - dragStart.y;
264
+ if (Math.abs(dx) > 3 || Math.abs(dy) > 3) didDrag.value = true;
265
+ setState(clampTranslate({
266
+ ...state,
267
+ translateX: translateStart.x + dx,
268
+ translateY: translateStart.y + dy
269
+ }, imageRef.value));
270
+ };
271
+ const handlePointerUp = () => {
272
+ isDragging.value = false;
273
+ };
274
+ const handlePointerCancel = () => {
275
+ isDragging.value = false;
276
+ didDrag.value = false;
277
+ lastPinchDistance.value = null;
278
+ };
279
+ const handleTouchMove = (event) => {
280
+ if (!enabled() || event.touches.length !== 2) {
281
+ lastPinchDistance.value = null;
282
+ return;
283
+ }
284
+ const [touch1, touch2] = event.touches;
285
+ const distance = Math.hypot(touch1.clientX - touch2.clientX, touch1.clientY - touch2.clientY);
286
+ if (lastPinchDistance.value !== null) {
287
+ beginAdjust();
288
+ zoomAtPoint((distance - lastPinchDistance.value) * .01, (touch1.clientX + touch2.clientX) / 2, (touch1.clientY + touch2.clientY) / 2);
289
+ }
290
+ lastPinchDistance.value = distance;
291
+ };
292
+ const handleTouchEnd = () => {
293
+ lastPinchDistance.value = null;
294
+ };
295
+ const handleClick = (event) => {
296
+ if (!enabled() || event.detail > 1) return;
297
+ if (didDrag.value) {
298
+ didDrag.value = false;
299
+ return;
300
+ }
301
+ const pointerType = lastPointerType.value;
302
+ lastPointerType.value = "mouse";
303
+ lastClickPointerType.value = pointerType;
304
+ if (pointerType !== "touch") toggleZoom();
305
+ };
306
+ const handleDoubleClick = () => {
307
+ if (enabled() && lastClickPointerType.value === "touch") toggleZoom();
308
+ };
309
+ const imageStyle = (0, vue.computed)(() => ({ transform: `scale(${state.scale}) translate(${state.translateX / state.scale}px, ${state.translateY / state.scale}px)` }));
310
+ const publicState = (0, vue.computed)(() => ({
311
+ scale: state.scale,
312
+ isZoomed: state.isZoomed
313
+ }));
314
+ const getImageProps = () => ({
315
+ ref: setImageRef,
316
+ style: imageStyle.value,
317
+ "data-zoom-enabled": enabled() || void 0,
318
+ "data-zoomed": state.isZoomed || void 0,
319
+ "data-dragging": isDragging.value || isAdjusting.value || void 0,
320
+ onPointerdown: handlePointerDown,
321
+ onPointermove: handlePointerMove,
322
+ onPointerup: handlePointerUp,
323
+ onPointercancel: handlePointerCancel,
324
+ onLostpointercapture: handlePointerUp,
325
+ onClick: handleClick,
326
+ onDblclick: handleDoubleClick,
327
+ onTouchmove: handleTouchMove,
328
+ onTouchend: handleTouchEnd
329
+ });
330
+ (0, vue.watch)([currentIndex, enabled], ([, isEnabled]) => {
331
+ if (!isEnabled || state.isZoomed) resetZoom();
332
+ if (!isEnabled) {
333
+ lastPinchDistance.value = null;
334
+ didDrag.value = false;
335
+ }
336
+ });
337
+ (0, vue.onBeforeUnmount)(() => {
338
+ window.clearTimeout(adjustTimeout);
339
+ imageRef.value?.removeEventListener("wheel", handleWheel);
340
+ });
341
+ return {
342
+ zoomState: publicState,
343
+ toggleZoom,
344
+ resetZoom,
345
+ panZoom,
346
+ getImageProps
347
+ };
348
+ }
349
+ var Lightbox_module_default = {
350
+ root: "_root_13vd4_1",
351
+ overlay: "_overlay_13vd4_9",
352
+ content: "_content_13vd4_15",
353
+ toolbar: "_toolbar_13vd4_24",
354
+ toolbarGroup: "_toolbarGroup_13vd4_33",
355
+ toolbarButton: "_toolbarButton_13vd4_38",
356
+ counter: "_counter_13vd4_55",
357
+ slides: "_slides_13vd4_61",
358
+ slidesViewport: "_slidesViewport_13vd4_67",
359
+ slidesContainer: "_slidesContainer_13vd4_72",
360
+ slide: "_slide_13vd4_61",
361
+ slideImage: "_slideImage_13vd4_85",
362
+ slideVideo: "_slideVideo_13vd4_108",
363
+ thumbnails: "_thumbnails_13vd4_115",
364
+ thumbnailsViewport: "_thumbnailsViewport_13vd4_121",
365
+ thumbnailsContainer: "_thumbnailsContainer_13vd4_128",
366
+ thumbnail: "_thumbnail_13vd4_115",
367
+ thumbnailImage: "_thumbnailImage_13vd4_156",
368
+ navigation: "_navigation_13vd4_161",
369
+ navigationButton: "_navigationButton_13vd4_172",
370
+ caption: "_caption_13vd4_190",
371
+ closeButton: "_closeButton_13vd4_198"
372
+ };
373
+ //#endregion
374
+ //#region src/LightboxRoot/LightboxRoot.vue?vue&type=script&setup=true&lang.ts
375
+ var _hoisted_1$2 = ["aria-label"];
376
+ var _hoisted_2$1 = {
377
+ key: 0,
378
+ "data-autofocus": "",
379
+ tabindex: "0",
380
+ style: {
381
+ "position": "fixed",
382
+ "width": "1px",
383
+ "height": "1px",
384
+ "overflow": "hidden"
385
+ }
386
+ };
387
+ var lightboxRootDefaultProps = {
388
+ withZoom: false,
389
+ withThumbnails: false,
390
+ withFullscreen: false,
391
+ withDownload: false,
392
+ loop: false,
393
+ closeOnClickOutside: false,
394
+ closeOnSwipeDown: true,
395
+ withKeyboardEvents: true,
396
+ returnFocus: true,
397
+ withInitialFocusPlaceholder: true,
398
+ withinPortal: true,
399
+ transitionDuration: 200,
400
+ zoomMaxScale: 3,
401
+ withSlideTransition: false
402
+ };
403
+ //#endregion
404
+ //#region src/LightboxRoot/LightboxRoot.vue
405
+ var LightboxRoot_default = /* @__PURE__ */ (0, vue.defineComponent)({
406
+ name: "LightboxRoot",
407
+ inheritAttrs: false,
408
+ __name: "LightboxRoot",
409
+ props: {
410
+ opened: { type: Boolean },
411
+ slides: {},
412
+ currentIndex: { default: void 0 },
413
+ labels: { default: void 0 },
414
+ withZoom: {
415
+ type: Boolean,
416
+ default: void 0
417
+ },
418
+ withThumbnails: {
419
+ type: Boolean,
420
+ default: void 0
421
+ },
422
+ withFullscreen: {
423
+ type: Boolean,
424
+ default: void 0
425
+ },
426
+ withDownload: {
427
+ type: Boolean,
428
+ default: void 0
429
+ },
430
+ loop: {
431
+ type: Boolean,
432
+ default: void 0
433
+ },
434
+ closeOnClickOutside: {
435
+ type: Boolean,
436
+ default: void 0
437
+ },
438
+ closeOnSwipeDown: {
439
+ type: Boolean,
440
+ default: void 0
441
+ },
442
+ withKeyboardEvents: {
443
+ type: Boolean,
444
+ default: void 0
445
+ },
446
+ returnFocus: {
447
+ type: Boolean,
448
+ default: void 0
449
+ },
450
+ withInitialFocusPlaceholder: {
451
+ type: Boolean,
452
+ default: void 0
453
+ },
454
+ withinPortal: {
455
+ type: Boolean,
456
+ default: void 0
457
+ },
458
+ zIndex: { default: void 0 },
459
+ transitionDuration: { default: void 0 },
460
+ transitionProps: { default: void 0 },
461
+ emblaOptions: { default: void 0 },
462
+ zoomMaxScale: { default: void 0 },
463
+ withSlideTransition: {
464
+ type: Boolean,
465
+ default: void 0
466
+ },
467
+ classNames: { default: void 0 },
468
+ styles: { default: void 0 },
469
+ vars: { default: void 0 },
470
+ unstyled: {
471
+ type: Boolean,
472
+ default: void 0
473
+ }
474
+ },
475
+ emits: [
476
+ "close",
477
+ "update:opened",
478
+ "indexChange",
479
+ "update:currentIndex"
480
+ ],
481
+ setup(__props, { emit: __emit }) {
482
+ const rawProps = __props;
483
+ const emit = __emit;
484
+ const props = (0, _mantine_vue_core.useProps)("LightboxRoot", lightboxRootDefaultProps, rawProps);
485
+ const attrs = (0, vue.useAttrs)();
486
+ const contentRef = (0, vue.ref)(null);
487
+ const internalIndex = (0, vue.ref)(props.currentIndex ?? 0);
488
+ const thumbnailsVisible = (0, vue.ref)(Boolean(props.withThumbnails));
489
+ const isFullscreen = (0, vue.ref)(false);
490
+ const ownsFullscreen = (0, vue.ref)(false);
491
+ const { dir } = (0, _mantine_vue_core.useDirection)();
492
+ let previousActive = null;
493
+ let previousOverflow = "";
494
+ const labels = (0, vue.computed)(() => ({
495
+ ...DEFAULT_LABELS,
496
+ ...props.labels
497
+ }));
498
+ const currentIndex = (0, vue.computed)(() => props.currentIndex ?? internalIndex.value);
499
+ const currentSlideLabel = (0, vue.computed)(() => {
500
+ const slide = props.slides[currentIndex.value];
501
+ if (!slide || slide.type === "custom") return void 0;
502
+ return slide.type === "video" ? slide.label : slide.alt;
503
+ });
504
+ const zoom = useLightboxZoom({
505
+ enabled: () => props.withZoom,
506
+ maxScale: () => props.zoomMaxScale,
507
+ currentIndex: () => currentIndex.value
508
+ });
509
+ const getStyles = (0, _mantine_vue_core.useStyles)({
510
+ name: "Lightbox",
511
+ props,
512
+ classes: Lightbox_module_default,
513
+ classNames: props.classNames,
514
+ styles: props.styles,
515
+ unstyled: props.unstyled,
516
+ vars: props.vars
517
+ });
518
+ const rootStyle = (0, vue.computed)(() => ({
519
+ "--lightbox-transition-duration": `${props.transitionDuration}ms`,
520
+ "--lightbox-z-index": props.zIndex == null ? void 0 : String(props.zIndex)
521
+ }));
522
+ const contentTransition = (0, vue.computed)(() => ({
523
+ transition: {
524
+ common: { transformOrigin: "center center" },
525
+ in: {
526
+ opacity: 1,
527
+ transform: "scale(1)"
528
+ },
529
+ out: {
530
+ opacity: 0,
531
+ transform: "scale(0.95)"
532
+ },
533
+ transitionProperty: "transform, opacity"
534
+ },
535
+ duration: props.transitionDuration,
536
+ timingFunction: "ease",
537
+ ...props.transitionProps
538
+ }));
539
+ const overlayTransition = (0, vue.computed)(() => ({
540
+ transition: "fade",
541
+ duration: contentTransition.value.duration,
542
+ exitDuration: contentTransition.value.exitDuration,
543
+ timingFunction: contentTransition.value.timingFunction,
544
+ enterDelay: contentTransition.value.enterDelay,
545
+ exitDelay: contentTransition.value.exitDelay,
546
+ keepMounted: contentTransition.value.keepMounted
547
+ }));
548
+ const setIndex = (index) => {
549
+ const next = Math.max(0, Math.min(Math.round(index), Math.max(0, props.slides.length - 1)));
550
+ if (next === currentIndex.value) return;
551
+ internalIndex.value = next;
552
+ emit("update:currentIndex", next);
553
+ emit("indexChange", next);
554
+ };
555
+ const next = () => setIndex(currentIndex.value + 1 < props.slides.length ? currentIndex.value + 1 : props.loop && props.slides.length ? 0 : currentIndex.value);
556
+ const prev = () => setIndex(currentIndex.value > 0 ? currentIndex.value - 1 : props.loop && props.slides.length ? props.slides.length - 1 : 0);
557
+ const close = () => {
558
+ emit("update:opened", false);
559
+ emit("close");
560
+ };
561
+ const toggleThumbnails = () => {
562
+ thumbnailsVisible.value = !thumbnailsVisible.value;
563
+ };
564
+ const toggleFullscreen = async () => {
565
+ if (!props.withFullscreen || typeof document === "undefined") return;
566
+ if (document.fullscreenElement) {
567
+ ownsFullscreen.value = false;
568
+ await document.exitFullscreen?.();
569
+ } else {
570
+ await contentRef.value?.requestFullscreen?.();
571
+ ownsFullscreen.value = document.fullscreenElement === contentRef.value;
572
+ }
573
+ isFullscreen.value = Boolean(document.fullscreenElement);
574
+ };
575
+ const handleKeydown = (event) => {
576
+ if (!props.opened) return;
577
+ if (event.key === "Escape") {
578
+ event.preventDefault();
579
+ close();
580
+ return;
581
+ }
582
+ if (!props.withKeyboardEvents || event.defaultPrevented || event.ctrlKey || event.metaKey || event.altKey) return;
583
+ if (event.target instanceof Element) {
584
+ if (event.target.closest("input, textarea, select, video, audio, [contenteditable]")) return;
585
+ if (event.target.closest("[data-lightbox-slide]") && event.target.closest("button, a[href], [role=\"button\"], [role=\"link\"], [role=\"slider\"], [role=\"textbox\"], [role=\"combobox\"], [role=\"listbox\"], [role=\"menu\"], [role=\"tablist\"], [role=\"tree\"], [role=\"grid\"]")) return;
586
+ }
587
+ const leading = dir.value === "rtl" ? next : prev;
588
+ const trailing = dir.value === "rtl" ? prev : next;
589
+ if (event.key === "ArrowLeft") {
590
+ event.preventDefault();
591
+ if (!zoom.panZoom(50, 0)) leading();
592
+ }
593
+ if (event.key === "ArrowRight") {
594
+ event.preventDefault();
595
+ if (!zoom.panZoom(-50, 0)) trailing();
596
+ }
597
+ if (event.key === "ArrowUp" && zoom.panZoom(0, 50)) event.preventDefault();
598
+ if (event.key === "ArrowDown" && zoom.panZoom(0, -50)) event.preventDefault();
599
+ if (event.key.toLowerCase() === "f" && props.withFullscreen) {
600
+ event.preventDefault();
601
+ toggleFullscreen();
602
+ }
603
+ if (event.key.toLowerCase() === "t" && props.withThumbnails) {
604
+ event.preventDefault();
605
+ toggleThumbnails();
606
+ }
607
+ if (event.key.toLowerCase() === "z" && props.withZoom) {
608
+ event.preventDefault();
609
+ zoom.toggleZoom();
610
+ }
611
+ };
612
+ const handleFullscreen = () => {
613
+ isFullscreen.value = Boolean(document.fullscreenElement);
614
+ if (!document.fullscreenElement) ownsFullscreen.value = false;
615
+ };
616
+ (0, vue.watch)(() => props.currentIndex, (value) => {
617
+ if (value != null) internalIndex.value = value;
618
+ });
619
+ (0, vue.watch)(() => props.withThumbnails, (value) => {
620
+ thumbnailsVisible.value = Boolean(value);
621
+ });
622
+ (0, vue.watch)(() => props.slides.length, (length) => {
623
+ if (length > 0 && currentIndex.value > length - 1) setIndex(length - 1);
624
+ });
625
+ (0, vue.watch)(() => props.opened, async (opened) => {
626
+ if (typeof document === "undefined") return;
627
+ if (opened) {
628
+ previousActive = document.activeElement instanceof HTMLElement ? document.activeElement : null;
629
+ previousOverflow = document.body.style.overflow;
630
+ document.body.style.overflow = "hidden";
631
+ document.addEventListener("keydown", handleKeydown);
632
+ document.addEventListener("fullscreenchange", handleFullscreen);
633
+ await (0, vue.nextTick)();
634
+ contentRef.value?.focus({ preventScroll: true });
635
+ } else {
636
+ zoom.resetZoom();
637
+ thumbnailsVisible.value = Boolean(props.withThumbnails);
638
+ if (ownsFullscreen.value && document.fullscreenElement) {
639
+ ownsFullscreen.value = false;
640
+ document.exitFullscreen?.().catch(() => {});
641
+ }
642
+ document.body.style.overflow = previousOverflow;
643
+ document.removeEventListener("keydown", handleKeydown);
644
+ document.removeEventListener("fullscreenchange", handleFullscreen);
645
+ if (props.returnFocus) previousActive?.focus({ preventScroll: true });
646
+ }
647
+ }, { immediate: true });
648
+ (0, vue.onBeforeUnmount)(() => {
649
+ if (typeof document !== "undefined") {
650
+ if (ownsFullscreen.value && document.fullscreenElement) document.exitFullscreen?.().catch(() => {});
651
+ document.body.style.overflow = previousOverflow;
652
+ document.removeEventListener("keydown", handleKeydown);
653
+ document.removeEventListener("fullscreenchange", handleFullscreen);
654
+ }
655
+ });
656
+ provideLightboxContext({
657
+ getStyles,
658
+ get labels() {
659
+ return labels.value;
660
+ },
661
+ get opened() {
662
+ return props.opened;
663
+ },
664
+ get slides() {
665
+ return props.slides;
666
+ },
667
+ get currentIndex() {
668
+ return currentIndex.value;
669
+ },
670
+ setIndex,
671
+ next,
672
+ prev,
673
+ close,
674
+ get thumbnailsVisible() {
675
+ return thumbnailsVisible.value;
676
+ },
677
+ toggleThumbnails,
678
+ get isFullscreen() {
679
+ return isFullscreen.value;
680
+ },
681
+ toggleFullscreen,
682
+ get zoomed() {
683
+ return zoom.zoomState.value.isZoomed;
684
+ },
685
+ toggleZoom: zoom.toggleZoom,
686
+ get zoomScale() {
687
+ return zoom.zoomState.value.scale;
688
+ },
689
+ panZoom: zoom.panZoom,
690
+ getImageZoomProps: zoom.getImageProps,
691
+ get withZoom() {
692
+ return props.withZoom;
693
+ },
694
+ get withThumbnails() {
695
+ return props.withThumbnails;
696
+ },
697
+ get withFullscreen() {
698
+ return props.withFullscreen;
699
+ },
700
+ get withDownload() {
701
+ return props.withDownload;
702
+ },
703
+ get loop() {
704
+ return props.loop;
705
+ },
706
+ get closeOnSwipeDown() {
707
+ return props.closeOnSwipeDown;
708
+ },
709
+ get closeOnClickOutside() {
710
+ return props.closeOnClickOutside;
711
+ },
712
+ get withSlideTransition() {
713
+ return props.withSlideTransition;
714
+ },
715
+ get transitionDuration() {
716
+ return props.transitionDuration;
717
+ },
718
+ get emblaOptions() {
719
+ return props.emblaOptions;
720
+ }
721
+ });
722
+ return (_ctx, _cache) => {
723
+ return (0, vue.openBlock)(), (0, vue.createBlock)(vue.Teleport, {
724
+ to: "body",
725
+ disabled: !(0, vue.unref)(props).withinPortal
726
+ }, [(0, vue.createVNode)((0, vue.unref)(_mantine_vue_core.Box), (0, vue.mergeProps)((0, vue.unref)(getStyles)("root"), { style: rootStyle.value }), {
727
+ default: (0, vue.withCtx)(() => [(0, vue.createVNode)((0, vue.unref)(_mantine_vue_core.Transition), (0, vue.mergeProps)({ mounted: (0, vue.unref)(props).opened }, overlayTransition.value), {
728
+ default: (0, vue.withCtx)((transitionStyles) => [(0, vue.createElementVNode)("div", (0, vue.mergeProps)((0, vue.unref)(getStyles)("overlay", { style: transitionStyles }), { onClick: _cache[0] || (_cache[0] = ($event) => (0, vue.unref)(props).closeOnClickOutside ? close() : void 0) }), null, 16)]),
729
+ _: 1
730
+ }, 16, ["mounted"]), (0, vue.createVNode)((0, vue.unref)(_mantine_vue_core.Transition), (0, vue.mergeProps)({ mounted: (0, vue.unref)(props).opened }, contentTransition.value), {
731
+ default: (0, vue.withCtx)((transitionStyles) => [(0, vue.createVNode)((0, vue.unref)(_mantine_vue_core.FocusTrap), { active: (0, vue.unref)(props).opened }, {
732
+ default: (0, vue.withCtx)(() => [(0, vue.createElementVNode)("div", (0, vue.mergeProps)({
733
+ ref_key: "contentRef",
734
+ ref: contentRef
735
+ }, {
736
+ ...(0, vue.unref)(attrs),
737
+ ...(0, vue.unref)(getStyles)("content", { style: transitionStyles })
738
+ }, {
739
+ role: "dialog",
740
+ "aria-modal": "true",
741
+ "aria-label": labels.value.lightboxLabel,
742
+ tabindex: "-1",
743
+ onClick: _cache[1] || (_cache[1] = (0, vue.withModifiers)(($event) => (0, vue.unref)(props).closeOnClickOutside ? close() : void 0, ["self"]))
744
+ }), [
745
+ (0, vue.unref)(props).withInitialFocusPlaceholder ? ((0, vue.openBlock)(), (0, vue.createElementBlock)("span", _hoisted_2$1)) : (0, vue.createCommentVNode)("", true),
746
+ (0, vue.createVNode)((0, vue.unref)(_mantine_vue_core.VisuallyHidden), {
747
+ role: "status",
748
+ "aria-live": "polite",
749
+ "aria-atomic": "true"
750
+ }, {
751
+ default: (0, vue.withCtx)(() => [(0, vue.unref)(props).slides.length ? ((0, vue.openBlock)(), (0, vue.createElementBlock)(vue.Fragment, { key: 0 }, [(0, vue.createTextVNode)((0, vue.toDisplayString)(labels.value.slideLabel(currentIndex.value + 1, (0, vue.unref)(props).slides.length)), 1), currentSlideLabel.value ? ((0, vue.openBlock)(), (0, vue.createElementBlock)(vue.Fragment, { key: 0 }, [(0, vue.createTextVNode)(": " + (0, vue.toDisplayString)(currentSlideLabel.value), 1)], 64)) : (0, vue.createCommentVNode)("", true)], 64)) : (0, vue.createCommentVNode)("", true)]),
752
+ _: 1
753
+ }),
754
+ (0, vue.renderSlot)(_ctx.$slots, "default")
755
+ ], 16, _hoisted_1$2)]),
756
+ _: 2
757
+ }, 1032, ["active"])]),
758
+ _: 3
759
+ }, 16, ["mounted"])]),
760
+ _: 3
761
+ }, 16, ["style"])], 8, ["disabled"]);
762
+ };
763
+ }
764
+ });
765
+ //#endregion
766
+ //#region src/LightboxSlide/LightboxSlide.vue?vue&type=script&setup=true&lang.ts
767
+ var _hoisted_1$1 = [
768
+ "src",
769
+ "poster",
770
+ "aria-label",
771
+ "autoplay",
772
+ "tabindex"
773
+ ];
774
+ var _hoisted_2 = [
775
+ "src",
776
+ "kind",
777
+ "srclang",
778
+ "label",
779
+ "default"
780
+ ];
781
+ var _hoisted_3 = [
782
+ "src",
783
+ "alt",
784
+ "srcset",
785
+ "sizes",
786
+ "loading"
787
+ ];
788
+ //#endregion
789
+ //#region src/LightboxSlide/LightboxSlide.vue
790
+ var LightboxSlide_default = /* @__PURE__ */ (0, vue.defineComponent)({
791
+ name: "LightboxSlide",
792
+ inheritAttrs: false,
793
+ __name: "LightboxSlide",
794
+ props: {
795
+ slide: {},
796
+ index: {}
797
+ },
798
+ setup(__props) {
799
+ const props = __props;
800
+ const attrs = (0, vue.useAttrs)();
801
+ const ctx = useLightboxContext();
802
+ const active = (0, vue.computed)(() => props.index === ctx.currentIndex);
803
+ const image = (0, vue.computed)(() => props.slide);
804
+ const video = (0, vue.computed)(() => props.slide);
805
+ const custom = (0, vue.computed)(() => props.slide);
806
+ const videoRef = (0, vue.ref)(null);
807
+ (0, vue.watch)(active, (isActive) => {
808
+ if (!videoRef.value) return;
809
+ if (!isActive) videoRef.value.pause();
810
+ else if (video.value.autoPlay) videoRef.value.play().catch(() => {});
811
+ }, { flush: "post" });
812
+ function handleClick(event) {
813
+ if (ctx.closeOnClickOutside && !event.defaultPrevented && event.target === event.currentTarget) ctx.close();
814
+ }
815
+ return (_ctx, _cache) => {
816
+ return (0, vue.openBlock)(), (0, vue.createBlock)((0, vue.unref)(_mantine_vue_core.Box), (0, vue.mergeProps)({
817
+ ...(0, vue.unref)(attrs),
818
+ ...(0, vue.unref)(ctx).getStyles("slide")
819
+ }, {
820
+ role: "group",
821
+ "aria-roledescription": "slide",
822
+ "data-lightbox-slide": "",
823
+ "aria-label": (0, vue.unref)(ctx).labels.slideLabel(__props.index + 1, (0, vue.unref)(ctx).slides.length),
824
+ "aria-hidden": !active.value || void 0,
825
+ inert: !active.value || void 0,
826
+ onClick: handleClick
827
+ }), {
828
+ default: (0, vue.withCtx)(() => [(0, vue.renderSlot)(_ctx.$slots, "default", {
829
+ slide: __props.slide,
830
+ active: active.value
831
+ }, () => [__props.slide.type === "custom" ? ((0, vue.openBlock)(), (0, vue.createBlock)((0, vue.resolveDynamicComponent)(() => custom.value.render({ active: active.value })), { key: 0 })) : __props.slide.type === "video" ? ((0, vue.openBlock)(), (0, vue.createElementBlock)("video", (0, vue.mergeProps)({
832
+ key: 1,
833
+ ref_key: "videoRef",
834
+ ref: videoRef
835
+ }, (0, vue.unref)(ctx).getStyles("slideVideo"), {
836
+ src: video.value.src,
837
+ poster: video.value.poster,
838
+ "aria-label": video.value.label,
839
+ autoplay: video.value.autoPlay && active.value,
840
+ controls: "",
841
+ tabindex: active.value ? 0 : -1
842
+ }), [((0, vue.openBlock)(true), (0, vue.createElementBlock)(vue.Fragment, null, (0, vue.renderList)(video.value.tracks, (track) => {
843
+ return (0, vue.openBlock)(), (0, vue.createElementBlock)("track", {
844
+ key: `${track.src}-${track.srcLang}`,
845
+ src: track.src,
846
+ kind: track.kind ?? "subtitles",
847
+ srclang: track.srcLang,
848
+ label: track.label,
849
+ default: track.default
850
+ }, null, 8, _hoisted_2);
851
+ }), 128))], 16, _hoisted_1$1)) : ((0, vue.openBlock)(), (0, vue.createElementBlock)("img", (0, vue.mergeProps)({ key: 2 }, {
852
+ ...(0, vue.unref)(ctx).getStyles("slideImage"),
853
+ ...active.value && (0, vue.unref)(ctx).withZoom ? (0, vue.unref)(ctx).getImageZoomProps() : {}
854
+ }, {
855
+ src: image.value.src,
856
+ alt: image.value.alt ?? "",
857
+ srcset: image.value.srcSet,
858
+ sizes: image.value.sizes,
859
+ loading: image.value.loading ?? (active.value ? "eager" : "lazy"),
860
+ draggable: "false"
861
+ }), null, 16, _hoisted_3))])]),
862
+ _: 3
863
+ }, 16, [
864
+ "aria-label",
865
+ "aria-hidden",
866
+ "inert"
867
+ ]);
868
+ };
869
+ }
870
+ });
871
+ //#endregion
872
+ //#region src/LightboxSlides/LightboxSlides.vue
873
+ var LightboxSlides_default = /* @__PURE__ */ (0, vue.defineComponent)({
874
+ name: "LightboxSlides",
875
+ inheritAttrs: false,
876
+ __name: "LightboxSlides",
877
+ setup(__props) {
878
+ const attrs = (0, vue.useAttrs)();
879
+ const ctx = useLightboxContext();
880
+ const { dir } = (0, _mantine_vue_core.useDirection)();
881
+ const swipeStart = (0, vue.ref)(null);
882
+ const startIndex = ctx.currentIndex;
883
+ const [emblaNode, emblaApi] = (0, embla_carousel_vue.default)((0, vue.computed)(() => {
884
+ const userWatchDrag = ctx.emblaOptions?.watchDrag;
885
+ return {
886
+ align: "center",
887
+ containScroll: false,
888
+ direction: dir.value,
889
+ ...ctx.emblaOptions,
890
+ axis: "x",
891
+ loop: ctx.loop,
892
+ startIndex,
893
+ watchDrag: (api, event) => {
894
+ if (ctx.zoomed) return false;
895
+ return typeof userWatchDrag === "function" ? userWatchDrag(api, event) : userWatchDrag ?? true;
896
+ }
897
+ };
898
+ }), (0, vue.computed)(() => []));
899
+ function handleSelect(api) {
900
+ const index = api.selectedScrollSnap();
901
+ if (index !== ctx.currentIndex) ctx.setIndex(index);
902
+ }
903
+ (0, vue.watch)(emblaApi, (api, previousApi) => {
904
+ previousApi?.off("select", handleSelect);
905
+ api?.on("select", handleSelect);
906
+ }, { immediate: true });
907
+ (0, vue.watch)(() => ctx.currentIndex, (index) => {
908
+ const api = emblaApi.value;
909
+ if (api && api.selectedScrollSnap() !== index) api.scrollTo(index, !ctx.withSlideTransition);
910
+ });
911
+ function handlePointerDown(event) {
912
+ swipeStart.value = {
913
+ x: event.clientX,
914
+ y: event.clientY
915
+ };
916
+ }
917
+ function handlePointerUp(event) {
918
+ if (!swipeStart.value || !ctx.closeOnSwipeDown || ctx.zoomed) return;
919
+ const x = event.clientX - swipeStart.value.x;
920
+ const y = event.clientY - swipeStart.value.y;
921
+ swipeStart.value = null;
922
+ if (y > 80 && y > Math.abs(x)) ctx.close();
923
+ }
924
+ (0, vue.onBeforeUnmount)(() => emblaApi.value?.off("select", handleSelect));
925
+ return (_ctx, _cache) => {
926
+ return (0, vue.openBlock)(), (0, vue.createBlock)((0, vue.unref)(_mantine_vue_core.Box), (0, vue.mergeProps)({
927
+ ...(0, vue.unref)(attrs),
928
+ ...(0, vue.unref)(ctx).getStyles("slides")
929
+ }, {
930
+ role: "region",
931
+ "aria-roledescription": "carousel",
932
+ "aria-label": (0, vue.unref)(ctx).labels.slidesLabel
933
+ }), {
934
+ default: (0, vue.withCtx)(() => [(0, vue.createElementVNode)("div", (0, vue.mergeProps)({
935
+ ref_key: "emblaNode",
936
+ ref: emblaNode
937
+ }, (0, vue.unref)(ctx).getStyles("slidesViewport"), {
938
+ onPointerdown: handlePointerDown,
939
+ onPointerup: handlePointerUp,
940
+ onPointercancel: _cache[0] || (_cache[0] = ($event) => swipeStart.value = null)
941
+ }), [(0, vue.createElementVNode)("div", (0, vue.normalizeProps)((0, vue.guardReactiveProps)((0, vue.unref)(ctx).getStyles("slidesContainer"))), [(0, vue.renderSlot)(_ctx.$slots, "default")], 16)], 16)]),
942
+ _: 3
943
+ }, 16, ["aria-label"]);
944
+ };
945
+ }
946
+ });
947
+ //#endregion
948
+ //#region src/LightboxThumbnails/LightboxThumbnails.vue?vue&type=script&setup=true&lang.ts
949
+ var _hoisted_1 = ["src"];
950
+ //#endregion
951
+ //#region src/LightboxThumbnails/LightboxThumbnails.vue
952
+ var LightboxThumbnails_default = /* @__PURE__ */ (0, vue.defineComponent)({
953
+ name: "LightboxThumbnails",
954
+ inheritAttrs: false,
955
+ __name: "LightboxThumbnails",
956
+ setup(__props) {
957
+ const attrs = (0, vue.useAttrs)();
958
+ const ctx = useLightboxContext();
959
+ const { dir } = (0, _mantine_vue_core.useDirection)();
960
+ const [emblaNode, emblaApi] = (0, embla_carousel_vue.default)((0, vue.computed)(() => ({
961
+ containScroll: "keepSnaps",
962
+ dragFree: true,
963
+ direction: dir.value,
964
+ active: ctx.withThumbnails
965
+ })), (0, vue.computed)(() => []));
966
+ function getThumbnailSource(slide) {
967
+ return slide.thumbSrc ?? (slide.type === "video" ? slide.poster : void 0) ?? (slide.type !== "custom" ? slide.src : void 0);
968
+ }
969
+ (0, vue.watch)([emblaApi, () => ctx.currentIndex], ([api, index]) => api?.scrollTo(index), { immediate: true });
970
+ return (_ctx, _cache) => {
971
+ return (0, vue.unref)(ctx).withThumbnails ? ((0, vue.openBlock)(), (0, vue.createBlock)((0, vue.unref)(_mantine_vue_core.Collapse), (0, vue.mergeProps)({
972
+ key: 0,
973
+ expanded: (0, vue.unref)(ctx).thumbnailsVisible,
974
+ "transition-duration": (0, vue.unref)(ctx).transitionDuration,
975
+ "keep-mounted": false
976
+ }, {
977
+ ...(0, vue.unref)(attrs),
978
+ ...(0, vue.unref)(ctx).getStyles("thumbnails")
979
+ }), {
980
+ default: (0, vue.withCtx)(() => [(0, vue.createElementVNode)("div", (0, vue.mergeProps)({
981
+ ref_key: "emblaNode",
982
+ ref: emblaNode
983
+ }, (0, vue.unref)(ctx).getStyles("thumbnailsViewport")), [(0, vue.createElementVNode)("div", (0, vue.normalizeProps)((0, vue.guardReactiveProps)((0, vue.unref)(ctx).getStyles("thumbnailsContainer"))), [((0, vue.openBlock)(true), (0, vue.createElementBlock)(vue.Fragment, null, (0, vue.renderList)((0, vue.unref)(ctx).slides, (slide, index) => {
984
+ return (0, vue.openBlock)(), (0, vue.createBlock)((0, vue.unref)(_mantine_vue_core.UnstyledButton), (0, vue.mergeProps)({ key: index }, { ref_for: true }, (0, vue.unref)(ctx).getStyles("thumbnail"), {
985
+ "data-active": index === (0, vue.unref)(ctx).currentIndex || void 0,
986
+ "aria-label": (0, vue.unref)(ctx).labels.thumbnailLabel(index + 1, (0, vue.unref)(ctx).slides.length),
987
+ "aria-current": index === (0, vue.unref)(ctx).currentIndex || void 0,
988
+ onClick: ($event) => (0, vue.unref)(ctx).setIndex(index)
989
+ }), {
990
+ default: (0, vue.withCtx)(() => [slide.type === "custom" && slide.renderThumb ? ((0, vue.openBlock)(), (0, vue.createBlock)((0, vue.resolveDynamicComponent)(() => slide.renderThumb?.()), { key: 0 })) : getThumbnailSource(slide) ? ((0, vue.openBlock)(), (0, vue.createElementBlock)("img", (0, vue.mergeProps)({
991
+ key: 1,
992
+ ref_for: true
993
+ }, (0, vue.unref)(ctx).getStyles("thumbnailImage"), {
994
+ src: getThumbnailSource(slide),
995
+ alt: "",
996
+ loading: "lazy",
997
+ draggable: "false"
998
+ }), null, 16, _hoisted_1)) : (0, vue.createCommentVNode)("", true)]),
999
+ _: 2
1000
+ }, 1040, [
1001
+ "data-active",
1002
+ "aria-label",
1003
+ "aria-current",
1004
+ "onClick"
1005
+ ]);
1006
+ }), 128))], 16)], 16)]),
1007
+ _: 1
1008
+ }, 16, ["expanded", "transition-duration"])) : (0, vue.createCommentVNode)("", true);
1009
+ };
1010
+ }
1011
+ });
1012
+ //#endregion
1013
+ //#region src/LightboxToolbar/toolbar-items.ts
1014
+ var ALLOWED_DOWNLOAD_PROTOCOLS = [
1015
+ "http:",
1016
+ "https:",
1017
+ "blob:",
1018
+ "data:"
1019
+ ];
1020
+ var downloadsInProgress = /* @__PURE__ */ new Set();
1021
+ var icon = (path) => (0, vue.h)("svg", {
1022
+ viewBox: "0 0 24 24",
1023
+ width: 20,
1024
+ height: 20,
1025
+ fill: "currentColor",
1026
+ "aria-hidden": "true"
1027
+ }, [(0, vue.h)("path", { d: path })]);
1028
+ function parseDownloadUrl(src) {
1029
+ try {
1030
+ const url = new URL(src, window.location.href);
1031
+ return ALLOWED_DOWNLOAD_PROTOCOLS.includes(url.protocol) ? url : null;
1032
+ } catch {
1033
+ return null;
1034
+ }
1035
+ }
1036
+ function getDownloadFileName(url) {
1037
+ if (url.protocol === "data:") return "download";
1038
+ const lastSegment = url.pathname.split("/").pop() || "";
1039
+ try {
1040
+ return decodeURIComponent(lastSegment) || "download";
1041
+ } catch {
1042
+ return lastSegment || "download";
1043
+ }
1044
+ }
1045
+ function openInNewTab(src) {
1046
+ const link = document.createElement("a");
1047
+ link.href = src;
1048
+ link.target = "_blank";
1049
+ link.rel = "noopener noreferrer";
1050
+ document.body.appendChild(link);
1051
+ link.click();
1052
+ link.remove();
1053
+ }
1054
+ function downloadFile(src) {
1055
+ const url = parseDownloadUrl(src);
1056
+ if (!url || downloadsInProgress.has(src)) return;
1057
+ if ((url.protocol === "http:" || url.protocol === "https:") && url.origin !== window.location.origin) {
1058
+ openInNewTab(src);
1059
+ return;
1060
+ }
1061
+ downloadsInProgress.add(src);
1062
+ fetch(src).then((response) => {
1063
+ if (!response.ok) throw new Error(`Failed to download ${src}: ${response.status}`);
1064
+ return response.blob();
1065
+ }).then((blob) => {
1066
+ const objectUrl = URL.createObjectURL(blob);
1067
+ const link = document.createElement("a");
1068
+ link.href = objectUrl;
1069
+ link.download = getDownloadFileName(url);
1070
+ document.body.appendChild(link);
1071
+ link.click();
1072
+ link.remove();
1073
+ window.setTimeout(() => URL.revokeObjectURL(objectUrl), 1e3);
1074
+ }).catch(() => openInNewTab(src)).finally(() => downloadsInProgress.delete(src));
1075
+ }
1076
+ function createFullscreenToolbarItem(toggle, isFullscreen, labels = DEFAULT_LABELS) {
1077
+ return {
1078
+ key: "fullscreen",
1079
+ icon: icon(isFullscreen ? "M9 3v6H3V7h4V3h2zm6 0h2v4h4v2h-6V3zM3 15h6v6H7v-4H3v-2zm12 0h6v2h-4v4h-2v-6z" : "M3 3h6v2H5v4H3V3zm12 0h6v6h-2V5h-4V3zM3 15h2v4h4v2H3v-6zm18 0v6h-6v-2h4v-4h2z"),
1080
+ label: isFullscreen ? labels.exitFullscreenLabel : labels.enterFullscreenLabel,
1081
+ onClick: toggle,
1082
+ position: "right"
1083
+ };
1084
+ }
1085
+ function createThumbnailsToolbarItem(toggle, visible, labels = DEFAULT_LABELS) {
1086
+ return {
1087
+ key: "thumbnails",
1088
+ icon: icon("M3 3h8v8H3V3zm0 10h8v8H3v-8zm10-10h8v8h-8V3zm0 10h8v8h-8v-8z"),
1089
+ label: visible ? labels.hideThumbnailsLabel : labels.showThumbnailsLabel,
1090
+ onClick: toggle,
1091
+ position: "left"
1092
+ };
1093
+ }
1094
+ function createDownloadToolbarItem(src, labels = DEFAULT_LABELS) {
1095
+ return {
1096
+ key: "download",
1097
+ icon: icon("M12 16l-6-6h4V4h4v6h4l-6 6zm-8 2h16v2H4v-2z"),
1098
+ label: labels.downloadLabel,
1099
+ position: "right",
1100
+ onClick: () => downloadFile(src)
1101
+ };
1102
+ }
1103
+ function createCloseToolbarItem(onClose, labels = DEFAULT_LABELS) {
1104
+ return {
1105
+ key: "close",
1106
+ icon: icon("M18.3 5.7a1 1 0 0 0-1.4 0L12 10.6 7.1 5.7a1 1 0 0 0-1.4 1.4L10.6 12l-4.9 4.9a1 1 0 1 0 1.4 1.4L12 13.4l4.9 4.9a1 1 0 0 0 1.4-1.4L13.4 12l4.9-4.9a1 1 0 0 0 0-1.4z"),
1107
+ label: labels.closeLabel,
1108
+ onClick: onClose,
1109
+ position: "right"
1110
+ };
1111
+ }
1112
+ //#endregion
1113
+ //#region src/LightboxToolbar/LightboxToolbar.vue
1114
+ var LightboxToolbar_default = /* @__PURE__ */ (0, vue.defineComponent)({
1115
+ name: "LightboxToolbar",
1116
+ inheritAttrs: false,
1117
+ __name: "LightboxToolbar",
1118
+ props: { toolbarItems: { type: [Array, Function] } },
1119
+ setup(__props) {
1120
+ const props = __props;
1121
+ const attrs = (0, vue.useAttrs)();
1122
+ const ctx = useLightboxContext();
1123
+ const payload = (0, vue.computed)(() => ({
1124
+ slides: ctx.slides,
1125
+ currentIndex: ctx.currentIndex,
1126
+ setIndex: ctx.setIndex,
1127
+ next: ctx.next,
1128
+ prev: ctx.prev,
1129
+ close: ctx.close,
1130
+ thumbnailsVisible: ctx.thumbnailsVisible,
1131
+ toggleThumbnails: ctx.toggleThumbnails,
1132
+ isFullscreen: ctx.isFullscreen,
1133
+ toggleFullscreen: ctx.toggleFullscreen,
1134
+ zoomed: ctx.zoomed,
1135
+ toggleZoom: ctx.toggleZoom,
1136
+ labels: ctx.labels
1137
+ }));
1138
+ const items = (0, vue.computed)(() => {
1139
+ if (typeof props.toolbarItems === "function") return props.toolbarItems(payload.value);
1140
+ if (props.toolbarItems) return props.toolbarItems;
1141
+ const result = [];
1142
+ if (ctx.withThumbnails) result.push(createThumbnailsToolbarItem(ctx.toggleThumbnails, ctx.thumbnailsVisible, ctx.labels));
1143
+ if (ctx.withFullscreen) result.push(createFullscreenToolbarItem(ctx.toggleFullscreen, ctx.isFullscreen, ctx.labels));
1144
+ const slide = ctx.slides[ctx.currentIndex];
1145
+ if (ctx.withDownload && slide && slide.type !== "custom") result.push(createDownloadToolbarItem(slide.src, ctx.labels));
1146
+ result.push(createCloseToolbarItem(ctx.close, ctx.labels));
1147
+ return result;
1148
+ });
1149
+ const left = (0, vue.computed)(() => items.value.filter((item) => item.position === "left"));
1150
+ const right = (0, vue.computed)(() => items.value.filter((item) => item.position !== "left"));
1151
+ return (_ctx, _cache) => {
1152
+ return (0, vue.openBlock)(), (0, vue.createBlock)((0, vue.unref)(_mantine_vue_core.Box), (0, vue.normalizeProps)((0, vue.guardReactiveProps)({
1153
+ ...(0, vue.unref)(attrs),
1154
+ ...(0, vue.unref)(ctx).getStyles("toolbar")
1155
+ })), {
1156
+ default: (0, vue.withCtx)(() => [
1157
+ (0, vue.createElementVNode)("div", (0, vue.normalizeProps)((0, vue.guardReactiveProps)((0, vue.unref)(ctx).getStyles("toolbarGroup"))), [((0, vue.openBlock)(true), (0, vue.createElementBlock)(vue.Fragment, null, (0, vue.renderList)(left.value, (item) => {
1158
+ return (0, vue.openBlock)(), (0, vue.createBlock)((0, vue.unref)(_mantine_vue_core.UnstyledButton), (0, vue.mergeProps)({ key: item.key }, { ref_for: true }, (0, vue.unref)(ctx).getStyles("toolbarButton"), {
1159
+ "aria-label": item.label,
1160
+ onClick: item.onClick
1161
+ }), {
1162
+ default: (0, vue.withCtx)(() => [((0, vue.openBlock)(), (0, vue.createBlock)((0, vue.resolveDynamicComponent)(() => item.icon)))]),
1163
+ _: 2
1164
+ }, 1040, ["aria-label", "onClick"]);
1165
+ }), 128))], 16),
1166
+ (0, vue.createElementVNode)("span", (0, vue.mergeProps)((0, vue.unref)(ctx).getStyles("counter"), { "aria-hidden": "true" }), (0, vue.toDisplayString)((0, vue.unref)(ctx).slides.length ? `${(0, vue.unref)(ctx).currentIndex + 1} / ${(0, vue.unref)(ctx).slides.length}` : ""), 17),
1167
+ (0, vue.createElementVNode)("div", (0, vue.normalizeProps)((0, vue.guardReactiveProps)((0, vue.unref)(ctx).getStyles("toolbarGroup"))), [((0, vue.openBlock)(true), (0, vue.createElementBlock)(vue.Fragment, null, (0, vue.renderList)(right.value, (item) => {
1168
+ return (0, vue.openBlock)(), (0, vue.createBlock)((0, vue.unref)(_mantine_vue_core.UnstyledButton), (0, vue.mergeProps)({ key: item.key }, { ref_for: true }, (0, vue.unref)(ctx).getStyles("toolbarButton"), {
1169
+ "aria-label": item.label,
1170
+ onClick: item.onClick
1171
+ }), {
1172
+ default: (0, vue.withCtx)(() => [((0, vue.openBlock)(), (0, vue.createBlock)((0, vue.resolveDynamicComponent)(() => item.icon)))]),
1173
+ _: 2
1174
+ }, 1040, ["aria-label", "onClick"]);
1175
+ }), 128))], 16)
1176
+ ]),
1177
+ _: 1
1178
+ }, 16);
1179
+ };
1180
+ }
1181
+ });
1182
+ //#endregion
1183
+ //#region src/Lightbox.vue
1184
+ var Lightbox_default = /* @__PURE__ */ (0, vue.defineComponent)({
1185
+ name: "Lightbox",
1186
+ inheritAttrs: false,
1187
+ __name: "Lightbox",
1188
+ props: {
1189
+ opened: { type: Boolean },
1190
+ slides: {},
1191
+ currentIndex: {},
1192
+ labels: {},
1193
+ withZoom: {
1194
+ type: Boolean,
1195
+ default: void 0
1196
+ },
1197
+ withThumbnails: {
1198
+ type: Boolean,
1199
+ default: void 0
1200
+ },
1201
+ withFullscreen: {
1202
+ type: Boolean,
1203
+ default: void 0
1204
+ },
1205
+ withDownload: {
1206
+ type: Boolean,
1207
+ default: void 0
1208
+ },
1209
+ loop: {
1210
+ type: Boolean,
1211
+ default: void 0
1212
+ },
1213
+ closeOnClickOutside: {
1214
+ type: Boolean,
1215
+ default: void 0
1216
+ },
1217
+ closeOnSwipeDown: {
1218
+ type: Boolean,
1219
+ default: void 0
1220
+ },
1221
+ withKeyboardEvents: {
1222
+ type: Boolean,
1223
+ default: void 0
1224
+ },
1225
+ returnFocus: {
1226
+ type: Boolean,
1227
+ default: void 0
1228
+ },
1229
+ withInitialFocusPlaceholder: {
1230
+ type: Boolean,
1231
+ default: void 0
1232
+ },
1233
+ withinPortal: {
1234
+ type: Boolean,
1235
+ default: void 0
1236
+ },
1237
+ zIndex: {},
1238
+ transitionDuration: {},
1239
+ transitionProps: {},
1240
+ emblaOptions: {},
1241
+ zoomMaxScale: {},
1242
+ withSlideTransition: {
1243
+ type: Boolean,
1244
+ default: void 0
1245
+ },
1246
+ toolbarItems: {},
1247
+ withNavigation: {
1248
+ type: Boolean,
1249
+ default: true
1250
+ },
1251
+ classNames: {},
1252
+ styles: {},
1253
+ vars: {},
1254
+ unstyled: {
1255
+ type: Boolean,
1256
+ default: void 0
1257
+ }
1258
+ },
1259
+ emits: [
1260
+ "close",
1261
+ "update:opened",
1262
+ "indexChange",
1263
+ "update:currentIndex"
1264
+ ],
1265
+ setup(__props, { emit: __emit }) {
1266
+ const props = __props;
1267
+ const emit = __emit;
1268
+ const slots = (0, vue.useSlots)();
1269
+ const attrs = (0, vue.useAttrs)();
1270
+ return (_ctx, _cache) => {
1271
+ return (0, vue.openBlock)(), (0, vue.createBlock)((0, vue.unref)(LightboxRoot_default), (0, vue.mergeProps)({
1272
+ ...(0, vue.unref)(attrs),
1273
+ ...props
1274
+ }, {
1275
+ onClose: _cache[0] || (_cache[0] = ($event) => emit("close")),
1276
+ "onUpdate:opened": _cache[1] || (_cache[1] = ($event) => emit("update:opened", $event)),
1277
+ onIndexChange: _cache[2] || (_cache[2] = ($event) => emit("indexChange", $event)),
1278
+ "onUpdate:currentIndex": _cache[3] || (_cache[3] = ($event) => emit("update:currentIndex", $event))
1279
+ }), {
1280
+ default: (0, vue.withCtx)(() => [(0, vue.renderSlot)(_ctx.$slots, "default", {}, () => [
1281
+ (0, vue.createVNode)((0, vue.unref)(LightboxToolbar_default), { "toolbar-items": props.toolbarItems }, null, 8, ["toolbar-items"]),
1282
+ (0, vue.createVNode)((0, vue.unref)(LightboxSlides_default), null, {
1283
+ default: (0, vue.withCtx)(() => [((0, vue.openBlock)(true), (0, vue.createElementBlock)(vue.Fragment, null, (0, vue.renderList)(props.slides, (slide, index) => {
1284
+ return (0, vue.openBlock)(), (0, vue.createBlock)((0, vue.unref)(LightboxSlide_default), {
1285
+ key: index,
1286
+ slide,
1287
+ index
1288
+ }, (0, vue.createSlots)({ _: 2 }, [(0, vue.unref)(slots).slide ? {
1289
+ name: "default",
1290
+ fn: (0, vue.withCtx)((payload) => [(0, vue.renderSlot)(_ctx.$slots, "slide", (0, vue.mergeProps)({ ref_for: true }, {
1291
+ ...payload,
1292
+ index
1293
+ }))]),
1294
+ key: "0"
1295
+ } : void 0]), 1032, ["slide", "index"]);
1296
+ }), 128))]),
1297
+ _: 3
1298
+ }),
1299
+ props.withNavigation ? ((0, vue.openBlock)(), (0, vue.createBlock)((0, vue.unref)(LightboxNavigation_default), { key: 0 })) : (0, vue.createCommentVNode)("", true),
1300
+ (0, vue.createVNode)((0, vue.unref)(LightboxCaption_default)),
1301
+ (0, vue.createVNode)((0, vue.unref)(LightboxThumbnails_default))
1302
+ ])]),
1303
+ _: 3
1304
+ }, 16);
1305
+ };
1306
+ }
1307
+ });
1308
+ //#endregion
1309
+ //#region src/lightbox.store.ts
1310
+ var clampIndex = (index, count) => Math.max(0, Math.min(Number.isFinite(index) ? Math.round(index) : 0, Math.max(0, count - 1)));
1311
+ var createLightboxStore = () => {
1312
+ const state = (0, vue.shallowReactive)({
1313
+ opened: false,
1314
+ slides: [],
1315
+ currentIndex: 0,
1316
+ loop: false
1317
+ });
1318
+ return {
1319
+ state,
1320
+ getState: () => state,
1321
+ setState: (next) => Object.assign(state, next)
1322
+ };
1323
+ };
1324
+ var useLightboxStore = (store) => store.state;
1325
+ function updateLightboxStateAction(update, store) {
1326
+ const state = store.getState();
1327
+ store.setState({
1328
+ ...state,
1329
+ ...update(state)
1330
+ });
1331
+ }
1332
+ var openLightboxAction = (payload, store) => updateLightboxStateAction(() => ({
1333
+ opened: true,
1334
+ slides: payload.slides,
1335
+ currentIndex: clampIndex(payload.startIndex ?? 0, payload.slides.length)
1336
+ }), store);
1337
+ var closeLightboxAction = (store) => updateLightboxStateAction(() => ({ opened: false }), store);
1338
+ var nextLightboxAction = (store) => {
1339
+ updateLightboxStateAction((state) => {
1340
+ const next = state.currentIndex + 1;
1341
+ return { currentIndex: next < state.slides.length ? next : state.loop && state.slides.length ? 0 : state.currentIndex };
1342
+ }, store);
1343
+ };
1344
+ var prevLightboxAction = (store) => {
1345
+ updateLightboxStateAction((state) => {
1346
+ const prev = state.currentIndex - 1;
1347
+ return { currentIndex: prev >= 0 ? prev : state.loop && state.slides.length ? state.slides.length - 1 : 0 };
1348
+ }, store);
1349
+ };
1350
+ var setLightboxIndexAction = (index, store) => {
1351
+ updateLightboxStateAction((state) => ({ currentIndex: clampIndex(index, state.slides.length) }), store);
1352
+ };
1353
+ var lightboxActions = {
1354
+ open: openLightboxAction,
1355
+ close: closeLightboxAction,
1356
+ next: nextLightboxAction,
1357
+ prev: prevLightboxAction,
1358
+ setIndex: setLightboxIndexAction,
1359
+ updateState: updateLightboxStateAction
1360
+ };
1361
+ function createLightbox() {
1362
+ const store = createLightboxStore();
1363
+ return [store, {
1364
+ open: (payload) => openLightboxAction(payload, store),
1365
+ close: () => closeLightboxAction(store),
1366
+ next: () => nextLightboxAction(store),
1367
+ prev: () => prevLightboxAction(store),
1368
+ setIndex: (index) => setLightboxIndexAction(index, store)
1369
+ }];
1370
+ }
1371
+ var [lightboxStore, lightbox] = createLightbox();
1372
+ //#endregion
1373
+ //#region src/LightboxCloseButton/LightboxCloseButton.vue
1374
+ var LightboxCloseButton_default = /* @__PURE__ */ (0, vue.defineComponent)({
1375
+ name: "LightboxCloseButton",
1376
+ inheritAttrs: false,
1377
+ __name: "LightboxCloseButton",
1378
+ setup(__props) {
1379
+ const attrs = (0, vue.useAttrs)();
1380
+ const ctx = useLightboxContext();
1381
+ return (_ctx, _cache) => {
1382
+ return (0, vue.openBlock)(), (0, vue.createBlock)((0, vue.unref)(_mantine_vue_core.UnstyledButton), (0, vue.mergeProps)({
1383
+ ...(0, vue.unref)(attrs),
1384
+ ...(0, vue.unref)(ctx).getStyles("closeButton")
1385
+ }, {
1386
+ "aria-label": (0, vue.unref)(ctx).labels.closeLabel,
1387
+ onClick: (0, vue.unref)(ctx).close
1388
+ }), {
1389
+ default: (0, vue.withCtx)(() => [(0, vue.renderSlot)(_ctx.$slots, "default", {}, () => [_cache[0] || (_cache[0] = (0, vue.createTextVNode)("×", -1))])]),
1390
+ _: 3
1391
+ }, 16, ["aria-label", "onClick"]);
1392
+ };
1393
+ }
1394
+ });
1395
+ //#endregion
1396
+ //#region src/LightboxProvider/LightboxProvider.vue
1397
+ var LightboxProvider_default = /* @__PURE__ */ (0, vue.defineComponent)({
1398
+ name: "LightboxProvider",
1399
+ __name: "LightboxProvider",
1400
+ props: {
1401
+ store: { default: () => lightboxStore },
1402
+ loop: {
1403
+ type: Boolean,
1404
+ default: void 0
1405
+ }
1406
+ },
1407
+ setup(__props) {
1408
+ const props = __props;
1409
+ const attrs = (0, vue.useAttrs)();
1410
+ const state = useLightboxStore(props.store);
1411
+ (0, vue.watch)(() => props.loop, (loop) => props.store.setState({
1412
+ ...props.store.getState(),
1413
+ loop: Boolean(loop)
1414
+ }), { immediate: true });
1415
+ return (_ctx, _cache) => {
1416
+ return (0, vue.openBlock)(), (0, vue.createBlock)(Lightbox_default, (0, vue.mergeProps)({
1417
+ ...(0, vue.unref)(attrs),
1418
+ loop: props.loop
1419
+ }, {
1420
+ opened: (0, vue.unref)(state).opened,
1421
+ slides: (0, vue.unref)(state).slides,
1422
+ "current-index": (0, vue.unref)(state).currentIndex,
1423
+ onClose: _cache[0] || (_cache[0] = ($event) => (0, vue.unref)(lightboxActions).close(props.store)),
1424
+ onIndexChange: _cache[1] || (_cache[1] = ($event) => (0, vue.unref)(lightboxActions).setIndex($event, props.store))
1425
+ }), null, 16, [
1426
+ "opened",
1427
+ "slides",
1428
+ "current-index"
1429
+ ]);
1430
+ };
1431
+ }
1432
+ });
1433
+ //#endregion
1434
+ //#region src/Lightbox.ts
1435
+ var Lightbox = (0, _mantine_vue_core.factory)(Lightbox_default, {
1436
+ classes: Lightbox_module_default,
1437
+ Root: LightboxRoot_default,
1438
+ Toolbar: LightboxToolbar_default,
1439
+ Slides: LightboxSlides_default,
1440
+ Slide: LightboxSlide_default,
1441
+ Thumbnails: LightboxThumbnails_default,
1442
+ Navigation: LightboxNavigation_default,
1443
+ Caption: LightboxCaption_default,
1444
+ CloseButton: LightboxCloseButton_default,
1445
+ Provider: LightboxProvider_default,
1446
+ open: lightbox.open,
1447
+ close: lightbox.close,
1448
+ next: lightbox.next,
1449
+ prev: lightbox.prev,
1450
+ setIndex: lightbox.setIndex
1451
+ });
1452
+ //#endregion
1453
+ exports.DEFAULT_LABELS = DEFAULT_LABELS;
1454
+ exports.Lightbox = Lightbox;
1455
+ exports.LightboxCaption = LightboxCaption_default;
1456
+ exports.LightboxCloseButton = LightboxCloseButton_default;
1457
+ exports.LightboxNavigation = LightboxNavigation_default;
1458
+ exports.LightboxProviderComponent = LightboxProvider_default;
1459
+ exports.LightboxRoot = LightboxRoot_default;
1460
+ exports.LightboxSlide = LightboxSlide_default;
1461
+ exports.LightboxSlides = LightboxSlides_default;
1462
+ exports.LightboxThumbnails = LightboxThumbnails_default;
1463
+ exports.LightboxToolbar = LightboxToolbar_default;
1464
+ exports.closeLightboxAction = closeLightboxAction;
1465
+ exports.createCloseToolbarItem = createCloseToolbarItem;
1466
+ exports.createDownloadToolbarItem = createDownloadToolbarItem;
1467
+ exports.createFullscreenToolbarItem = createFullscreenToolbarItem;
1468
+ exports.createLightbox = createLightbox;
1469
+ exports.createLightboxStore = createLightboxStore;
1470
+ exports.createThumbnailsToolbarItem = createThumbnailsToolbarItem;
1471
+ exports.lightbox = lightbox;
1472
+ exports.lightboxActions = lightboxActions;
1473
+ exports.lightboxRootDefaultProps = lightboxRootDefaultProps;
1474
+ exports.lightboxStore = lightboxStore;
1475
+ exports.nextLightboxAction = nextLightboxAction;
1476
+ exports.openLightboxAction = openLightboxAction;
1477
+ exports.prevLightboxAction = prevLightboxAction;
1478
+ exports.setLightboxIndexAction = setLightboxIndexAction;
1479
+ exports.updateLightboxStateAction = updateLightboxStateAction;
1480
+ exports.useLightboxStore = useLightboxStore;
1481
+
1482
+ //# sourceMappingURL=index.cjs.map