Skip to content

Commit

Permalink
release 1.1.16
Browse files Browse the repository at this point in the history
  • Loading branch information
henrygd committed Mar 12, 2024
1 parent 2c200ea commit ea4c110
Show file tree
Hide file tree
Showing 6 changed files with 180 additions and 117 deletions.
97 changes: 59 additions & 38 deletions dist/bigger-picture.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -699,7 +699,25 @@ const defaultTweenOptions = (duration) => ({
const getThumbBackground = (activeItem) =>
!activeItem.thumb || `url(${activeItem.thumb})`;

/* src/components/loading.svelte generated by Svelte v3.47.0 */
/**
* Adds attributes to the given node based on the provided object.
*
* @param {HTMLElement} node - The node to which attributes will be added
* @param {Record<string, string | boolean> | string} obj - The object containing key-value pairs of attributes to be added
*/
const addAttributes = (node, obj) => {
if (!obj) {
return
}
if (typeof obj === 'string') {
obj = JSON.parse(obj);
}
for (const key in obj) {
node.setAttribute(key, obj[key]);
}
};

/* src/components/loading.svelte generated by Svelte v3.55.1 */

function create_if_block_1$2(ctx) {
let div;
Expand Down Expand Up @@ -873,13 +891,11 @@ class Loading extends SvelteComponent {
}
}

/* src/components/image.svelte generated by Svelte v3.47.0 */
/* src/components/image.svelte generated by Svelte v3.55.1 */

function create_if_block_1$1(ctx) {
let img;
let img_srcset_value;
let img_sizes_value;
let img_alt_value;
let img_outro;
let current;
let mounted;
Expand All @@ -888,16 +904,19 @@ function create_if_block_1$1(ctx) {
return {
c() {
img = element("img");
attr(img, "srcset", img_srcset_value = /*activeItem*/ ctx[7].img);
attr(img, "sizes", img_sizes_value = /*opts*/ ctx[8].sizes || `${/*sizes*/ ctx[1]}px`);
attr(img, "alt", img_alt_value = /*activeItem*/ ctx[7].alt);
attr(img, "alt", /*activeItem*/ ctx[7].alt);
},
m(target, anchor) {
insert(target, img, anchor);
current = true;

if (!mounted) {
dispose = listen(img, "error", /*error_handler*/ ctx[26]);
dispose = [
action_destroyer(/*addSrc*/ ctx[21].call(null, img)),
listen(img, "error", /*error_handler*/ ctx[27])
];

mounted = true;
}
},
Expand All @@ -919,12 +938,12 @@ function create_if_block_1$1(ctx) {
if (detaching) detach(img);
if (detaching && img_outro) img_outro.end();
mounted = false;
dispose();
run_all(dispose);
}
};
}

// (374:10) {#if showLoader}
// (384:10) {#if showLoader}
function create_if_block$1(ctx) {
let loading;
let current;
Expand Down Expand Up @@ -1068,19 +1087,19 @@ function create_fragment$3(ctx) {
set_style(div0, "height", /*$imageDimensions*/ ctx[0][1] + "px");
}

if (dirty[0] & /*pointerDown*/ 16) {
if (!current || dirty[0] & /*pointerDown*/ 16) {
toggle_class(div0, "bp-drag", /*pointerDown*/ ctx[4]);
}

if (dirty[0] & /*maxZoom, $imageDimensions, naturalWidth*/ 6145) {
if (!current || dirty[0] & /*maxZoom, $imageDimensions, naturalWidth*/ 6145) {
toggle_class(div0, "bp-canzoom", /*maxZoom*/ ctx[11] > 1 && /*$imageDimensions*/ ctx[0][0] < /*naturalWidth*/ ctx[12]);
}

if (dirty[0] & /*$imageDimensions, $zoomDragTranslate*/ 65 && style_transform !== (style_transform = `translate3d(${/*$imageDimensions*/ ctx[0][0] / -2 + /*$zoomDragTranslate*/ ctx[6][0]}px, ${/*$imageDimensions*/ ctx[0][1] / -2 + /*$zoomDragTranslate*/ ctx[6][1]}px, 0)`)) {
set_style(div0, "transform", style_transform);
}

if (dirty[0] & /*closingWhileZoomed*/ 32) {
if (!current || dirty[0] & /*closingWhileZoomed*/ 32) {
toggle_class(div1, "bp-close", /*closingWhileZoomed*/ ctx[5]);
}
},
Expand Down Expand Up @@ -1110,11 +1129,11 @@ function instance$3($$self, $$props, $$invalidate) {
let $zoomDragTranslate;
let $closing;
let $imageDimensions;
component_subscribe($$self, closing, $$value => $$invalidate(25, $closing = $$value));
component_subscribe($$self, closing, $$value => $$invalidate(26, $closing = $$value));
let { props } = $$props;
let { smallScreen } = $$props;
let { activeItem, opts, prev, next, zoomed, container } = props;
component_subscribe($$self, zoomed, value => $$invalidate(24, $zoomed = value));
component_subscribe($$self, zoomed, value => $$invalidate(25, $zoomed = value));
let maxZoom = activeItem.maxZoom || opts.maxZoom || 10;
let calculatedDimensions = props.calculateDimensions(activeItem);

Expand Down Expand Up @@ -1429,7 +1448,7 @@ function instance$3($$self, $$props, $$invalidate) {

// handle globalThis resize
props.setResizeFunc(() => {
$$invalidate(23, calculatedDimensions = props.calculateDimensions(activeItem));
$$invalidate(24, calculatedDimensions = props.calculateDimensions(activeItem));

// adjust image size / zoom on resize, but not on mobile because
// some browsers (ios safari 15) constantly resize screen on drag
Expand All @@ -1454,19 +1473,24 @@ function instance$3($$self, $$props, $$invalidate) {
);
};

const addSrc = node => {
addAttributes(node, activeItem.attr);
node.srcset = activeItem.img;
};

const error_handler = error => opts.onError?.(container, activeItem, error);

$$self.$$set = $$props => {

if ('smallScreen' in $$props) $$invalidate(22, smallScreen = $$props.smallScreen);
if ('smallScreen' in $$props) $$invalidate(23, smallScreen = $$props.smallScreen);
};

$$self.$$.update = () => {
if ($$self.$$.dirty[0] & /*$imageDimensions, calculatedDimensions*/ 8388609) {
if ($$self.$$.dirty[0] & /*$imageDimensions, calculatedDimensions*/ 16777217) {
zoomed.set($imageDimensions[0] - 10 > calculatedDimensions[0]);
}

if ($$self.$$.dirty[0] & /*$closing, $zoomed, calculatedDimensions*/ 58720256) {
if ($$self.$$.dirty[0] & /*$closing, $zoomed, calculatedDimensions*/ 117440512) {
// if zoomed while closing, zoom out image and add class
// to change contain value on .bp-wrap to avoid cropping
if ($closing && $zoomed && !opts.intro) {
Expand Down Expand Up @@ -1500,6 +1524,7 @@ function instance$3($$self, $$props, $$invalidate) {
removeEventFromCache,
onPointerUp,
onMount,
addSrc,
props,
smallScreen,
calculatedDimensions,
Expand All @@ -1512,11 +1537,11 @@ function instance$3($$self, $$props, $$invalidate) {
class Image extends SvelteComponent {
constructor(options) {
super();
init(this, options, instance$3, create_fragment$3, not_equal, { props: 21, smallScreen: 22 }, null, [-1, -1]);
init(this, options, instance$3, create_fragment$3, not_equal, { props: 22, smallScreen: 23 }, null, [-1, -1]);
}
}

/* src/components/iframe.svelte generated by Svelte v3.47.0 */
/* src/components/iframe.svelte generated by Svelte v3.55.1 */

function create_fragment$2(ctx) {
let div;
Expand Down Expand Up @@ -1598,8 +1623,10 @@ function instance$2($$self, $$props, $$invalidate) {
setDimensions();
props.setResizeFunc(setDimensions);

// add src ourselves to avoid src_url_equal call (svelte stuff)
const addSrc = node => node.src = activeItem.iframe;
const addSrc = node => {
addAttributes(node, activeItem.attr);
node.src = activeItem.iframe;
};

const load_handler = () => $$invalidate(0, loaded = true);

Expand All @@ -1615,7 +1642,7 @@ class Iframe extends SvelteComponent {
}
}

/* src/components/video.svelte generated by Svelte v3.47.0 */
/* src/components/video.svelte generated by Svelte v3.55.1 */

function create_fragment$1(ctx) {
let div;
Expand Down Expand Up @@ -1689,13 +1716,6 @@ function instance$1($$self, $$props, $$invalidate) {
setDimensions();
props.setResizeFunc(setDimensions);

/** adds attributes to a node */
const addAttributes = (node, obj) => {
for (const key in obj) {
attr(node, key, obj[key]);
}
};

/** create audo / video element */
const onMount = node => {
let mediaElement;
Expand All @@ -1717,6 +1737,8 @@ function instance$1($$self, $$props, $$invalidate) {
playsinline: true,
tabindex: '0'
});

addAttributes(mediaElement, activeItem.attr);
}

// add sources / tracks to media element
Expand Down Expand Up @@ -1750,7 +1772,7 @@ class Video extends SvelteComponent {
}
}

/* src/bigger-picture.svelte generated by Svelte v3.47.0 */
/* src/bigger-picture.svelte generated by Svelte v3.55.1 */

function create_if_block(ctx) {
let div2;
Expand All @@ -1760,7 +1782,6 @@ function create_if_block(ctx) {
let div1;
let button;
let div1_outro;
let containerActions_action;
let current;
let mounted;
let dispose;
Expand Down Expand Up @@ -1797,7 +1818,7 @@ function create_if_block(ctx) {
if (!mounted) {
dispose = [
listen(button, "click", /*close*/ ctx[1]),
action_destroyer(containerActions_action = /*containerActions*/ ctx[14].call(null, div2))
action_destroyer(/*containerActions*/ ctx[14].call(null, div2))
];

mounted = true;
Expand All @@ -1810,7 +1831,7 @@ function create_if_block(ctx) {
check_outros();
key_block = create_key_block(ctx);
key_block.c();
transition_in(key_block);
transition_in(key_block, 1);
key_block.m(div2, div1);
} else {
key_block.p(ctx, dirty);
Expand All @@ -1829,19 +1850,19 @@ function create_if_block(ctx) {
if_block = null;
}

if (dirty[0] & /*$zoomed*/ 1024) {
if (!current || dirty[0] & /*$zoomed*/ 1024) {
toggle_class(div2, "bp-zoomed", /*$zoomed*/ ctx[10]);
}

if (dirty[0] & /*inline*/ 256) {
if (!current || dirty[0] & /*inline*/ 256) {
toggle_class(div2, "bp-inline", /*inline*/ ctx[8]);
}

if (dirty[0] & /*smallScreen*/ 128) {
if (!current || dirty[0] & /*smallScreen*/ 128) {
toggle_class(div2, "bp-small", /*smallScreen*/ ctx[7]);
}

if (dirty[0] & /*opts*/ 32) {
if (!current || dirty[0] & /*opts*/ 32) {
toggle_class(div2, "bp-noclose", /*opts*/ ctx[5].noClose);
}
},
Expand Down
2 changes: 1 addition & 1 deletion dist/bigger-picture.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/bigger-picture.min.mjs

Large diffs are not rendered by default.

Loading

0 comments on commit ea4c110

Please sign in to comment.