@responsive-ui/bottom-sheet
Advanced tools
Comparing version 1.1.0-alpha.32 to 1.1.0-alpha.37
@@ -200,10 +200,2 @@ 'use strict'; | ||
} | ||
function get_current_component() { | ||
if (!current_component) | ||
throw new Error('Function called outside component initialization'); | ||
return current_component; | ||
} | ||
function onMount(fn) { | ||
get_current_component().$$.on_mount.push(fn); | ||
} | ||
@@ -316,2 +308,8 @@ const dirty_components = []; | ||
const globals = (typeof window !== 'undefined' | ||
? window | ||
: typeof globalThis !== 'undefined' | ||
? globalThis | ||
: global); | ||
function get_spread_update(levels, updates) { | ||
@@ -623,4 +621,53 @@ const update = {}; | ||
/* components/bottom-sheet/src/BottomSheet.svelte generated by Svelte v3.48.0 */ | ||
/* components/bottom-sheet/src/BottomSheet.svelte generated by Svelte v3.46.4 */ | ||
const { setTimeout: setTimeout_1, window: window_1 } = globals; | ||
function create_if_block_2(ctx) { | ||
let div; | ||
let mounted; | ||
let dispose; | ||
return { | ||
c() { | ||
div = element("div"); | ||
attr(div, "class", "resp-bottom-sheet__overlay"); | ||
set_style(div, "opacity", /*offset*/ ctx[9], false); | ||
set_style(div, "visibility", /*offset*/ ctx[9] <= 0 ? "hidden" : "visible", false); | ||
}, | ||
m(target, anchor) { | ||
insert(target, div, anchor); | ||
if (!mounted) { | ||
dispose = listen(div, "click", function () { | ||
if (is_function(/*maskClosable*/ ctx[3] | ||
? /*click_handler*/ ctx[17] | ||
: noop)) (/*maskClosable*/ ctx[3] | ||
? /*click_handler*/ ctx[17] | ||
: noop).apply(this, arguments); | ||
}); | ||
mounted = true; | ||
} | ||
}, | ||
p(new_ctx, dirty) { | ||
ctx = new_ctx; | ||
if (dirty & /*offset*/ 512) { | ||
set_style(div, "opacity", /*offset*/ ctx[9], false); | ||
} | ||
if (dirty & /*offset*/ 512) { | ||
set_style(div, "visibility", /*offset*/ ctx[9] <= 0 ? "hidden" : "visible", false); | ||
} | ||
}, | ||
d(detaching) { | ||
if (detaching) detach(div); | ||
mounted = false; | ||
dispose(); | ||
} | ||
}; | ||
} | ||
// (55:2) {#if draggable} | ||
function create_if_block_1(ctx) { | ||
@@ -644,3 +691,3 @@ let div1; | ||
// (47:2) {#if closable} | ||
// (60:2) {#if closable} | ||
function create_if_block(ctx) { | ||
@@ -666,3 +713,3 @@ let span; | ||
if (!mounted) { | ||
dispose = listen(i, "click", /*click_handler_1*/ ctx[15]); | ||
dispose = listen(i, "click", /*click_handler_1*/ ctx[18]); | ||
mounted = true; | ||
@@ -681,31 +728,40 @@ } | ||
function create_fragment(ctx) { | ||
let div0; | ||
let scrolling = false; | ||
let clear_scrolling = () => { | ||
scrolling = false; | ||
}; | ||
let scrolling_timeout; | ||
let t0; | ||
let div1; | ||
let div; | ||
let t1; | ||
let t2; | ||
let div1_class_value; | ||
let div1_style_value; | ||
let div_class_value; | ||
let div_style_value; | ||
let current; | ||
let mounted; | ||
let dispose; | ||
let if_block0 = /*draggable*/ ctx[5] && create_if_block_1(); | ||
let if_block1 = /*closable*/ ctx[4] && create_if_block(ctx); | ||
const default_slot_template = /*#slots*/ ctx[13].default; | ||
const default_slot = create_slot(default_slot_template, ctx, /*$$scope*/ ctx[12], null); | ||
add_render_callback(/*onwindowresize*/ ctx[15]); | ||
add_render_callback(/*onwindowscroll*/ ctx[16]); | ||
let if_block0 = /*open*/ ctx[0] && create_if_block_2(ctx); | ||
let if_block1 = /*draggable*/ ctx[5] && create_if_block_1(); | ||
let if_block2 = /*closable*/ ctx[4] && create_if_block(ctx); | ||
const default_slot_template = /*#slots*/ ctx[14].default; | ||
const default_slot = create_slot(default_slot_template, ctx, /*$$scope*/ ctx[13], null); | ||
let div1_levels = [ | ||
let div_levels = [ | ||
{ | ||
class: div1_class_value = "resp-bottom-sheet " + /*className*/ ctx[2] | ||
class: div_class_value = "resp-bottom-sheet " + /*className*/ ctx[2] | ||
}, | ||
/*$$restProps*/ ctx[10], | ||
/*$$restProps*/ ctx[12], | ||
{ | ||
style: div1_style_value = `transform: translateY(${/*$tween*/ ctx[7] * 100}%); ${/*style*/ ctx[6]}` | ||
style: div_style_value = `transform: translateY(${/*$tween*/ ctx[10] * 100}%); ${/*style*/ ctx[6]}` | ||
} | ||
]; | ||
let div1_data = {}; | ||
let div_data = {}; | ||
for (let i = 0; i < div1_levels.length; i += 1) { | ||
div1_data = assign(div1_data, div1_levels[i]); | ||
for (let i = 0; i < div_levels.length; i += 1) { | ||
div_data = assign(div_data, div_levels[i]); | ||
} | ||
@@ -715,28 +771,25 @@ | ||
c() { | ||
div0 = element("div"); | ||
if (if_block0) if_block0.c(); | ||
t0 = space(); | ||
div1 = element("div"); | ||
if (if_block0) if_block0.c(); | ||
div = element("div"); | ||
if (if_block1) if_block1.c(); | ||
t1 = space(); | ||
if (if_block1) if_block1.c(); | ||
if (if_block2) if_block2.c(); | ||
t2 = space(); | ||
if (default_slot) default_slot.c(); | ||
attr(div0, "class", "resp-bottom-sheet__overlay"); | ||
set_style(div0, "opacity", /*offset*/ ctx[8], false); | ||
set_style(div0, "visibility", /*offset*/ ctx[8] <= 0 ? "hidden" : "visible", false); | ||
set_attributes(div1, div1_data); | ||
set_style(div1, "height", `${/*height*/ ctx[1]}px`, false); | ||
set_style(div1, "visibility", /*offset*/ ctx[8] <= 0 ? "hidden" : "visible", false); | ||
set_attributes(div, div_data); | ||
set_style(div, "height", `${/*height*/ ctx[1]}px`, false); | ||
set_style(div, "visibility", /*offset*/ ctx[9] <= 0 ? "hidden" : "visible", false); | ||
}, | ||
m(target, anchor) { | ||
insert(target, div0, anchor); | ||
if (if_block0) if_block0.m(target, anchor); | ||
insert(target, t0, anchor); | ||
insert(target, div1, anchor); | ||
if (if_block0) if_block0.m(div1, null); | ||
append(div1, t1); | ||
if (if_block1) if_block1.m(div1, null); | ||
append(div1, t2); | ||
insert(target, div, anchor); | ||
if (if_block1) if_block1.m(div, null); | ||
append(div, t1); | ||
if (if_block2) if_block2.m(div, null); | ||
append(div, t2); | ||
if (default_slot) { | ||
default_slot.m(div1, null); | ||
default_slot.m(div, null); | ||
} | ||
@@ -747,9 +800,11 @@ | ||
if (!mounted) { | ||
dispose = listen(div0, "click", function () { | ||
if (is_function(/*maskClosable*/ ctx[3] | ||
? /*click_handler*/ ctx[14] | ||
: noop)) (/*maskClosable*/ ctx[3] | ||
? /*click_handler*/ ctx[14] | ||
: noop).apply(this, arguments); | ||
}); | ||
dispose = [ | ||
listen(window_1, "resize", /*onwindowresize*/ ctx[15]), | ||
listen(window_1, "scroll", () => { | ||
scrolling = true; | ||
clearTimeout(scrolling_timeout); | ||
scrolling_timeout = setTimeout_1(clear_scrolling, 100); | ||
/*onwindowscroll*/ ctx[16](); | ||
}) | ||
]; | ||
@@ -759,18 +814,17 @@ mounted = true; | ||
}, | ||
p(new_ctx, [dirty]) { | ||
ctx = new_ctx; | ||
if (dirty & /*offset*/ 256) { | ||
set_style(div0, "opacity", /*offset*/ ctx[8], false); | ||
p(ctx, [dirty]) { | ||
if (dirty & /*scrollY*/ 256 && !scrolling) { | ||
scrolling = true; | ||
clearTimeout(scrolling_timeout); | ||
scrollTo(window_1.pageXOffset, /*scrollY*/ ctx[8]); | ||
scrolling_timeout = setTimeout_1(clear_scrolling, 100); | ||
} | ||
if (dirty & /*offset*/ 256) { | ||
set_style(div0, "visibility", /*offset*/ ctx[8] <= 0 ? "hidden" : "visible", false); | ||
} | ||
if (/*draggable*/ ctx[5]) { | ||
if (if_block0) ; else { | ||
if_block0 = create_if_block_1(); | ||
if (/*open*/ ctx[0]) { | ||
if (if_block0) { | ||
if_block0.p(ctx, dirty); | ||
} else { | ||
if_block0 = create_if_block_2(ctx); | ||
if_block0.c(); | ||
if_block0.m(div1, t1); | ||
if_block0.m(t0.parentNode, t0); | ||
} | ||
@@ -782,9 +836,7 @@ } else if (if_block0) { | ||
if (/*closable*/ ctx[4]) { | ||
if (if_block1) { | ||
if_block1.p(ctx, dirty); | ||
} else { | ||
if_block1 = create_if_block(ctx); | ||
if (/*draggable*/ ctx[5]) { | ||
if (if_block1) ; else { | ||
if_block1 = create_if_block_1(); | ||
if_block1.c(); | ||
if_block1.m(div1, t2); | ||
if_block1.m(div, t1); | ||
} | ||
@@ -796,4 +848,17 @@ } else if (if_block1) { | ||
if (/*closable*/ ctx[4]) { | ||
if (if_block2) { | ||
if_block2.p(ctx, dirty); | ||
} else { | ||
if_block2 = create_if_block(ctx); | ||
if_block2.c(); | ||
if_block2.m(div, t2); | ||
} | ||
} else if (if_block2) { | ||
if_block2.d(1); | ||
if_block2 = null; | ||
} | ||
if (default_slot) { | ||
if (default_slot.p && (!current || dirty & /*$$scope*/ 4096)) { | ||
if (default_slot.p && (!current || dirty & /*$$scope*/ 8192)) { | ||
update_slot_base( | ||
@@ -803,6 +868,6 @@ default_slot, | ||
ctx, | ||
/*$$scope*/ ctx[12], | ||
/*$$scope*/ ctx[13], | ||
!current | ||
? get_all_dirty_from_scope(/*$$scope*/ ctx[12]) | ||
: get_slot_changes(default_slot_template, /*$$scope*/ ctx[12], dirty, null), | ||
? get_all_dirty_from_scope(/*$$scope*/ ctx[13]) | ||
: get_slot_changes(default_slot_template, /*$$scope*/ ctx[13], dirty, null), | ||
null | ||
@@ -813,10 +878,10 @@ ); | ||
set_attributes(div1, div1_data = get_spread_update(div1_levels, [ | ||
(!current || dirty & /*className*/ 4 && div1_class_value !== (div1_class_value = "resp-bottom-sheet " + /*className*/ ctx[2])) && { class: div1_class_value }, | ||
dirty & /*$$restProps*/ 1024 && /*$$restProps*/ ctx[10], | ||
(!current || dirty & /*$tween, style*/ 192 && div1_style_value !== (div1_style_value = `transform: translateY(${/*$tween*/ ctx[7] * 100}%); ${/*style*/ ctx[6]}`)) && { style: div1_style_value } | ||
set_attributes(div, div_data = get_spread_update(div_levels, [ | ||
(!current || dirty & /*className*/ 4 && div_class_value !== (div_class_value = "resp-bottom-sheet " + /*className*/ ctx[2])) && { class: div_class_value }, | ||
dirty & /*$$restProps*/ 4096 && /*$$restProps*/ ctx[12], | ||
(!current || dirty & /*$tween, style*/ 1088 && div_style_value !== (div_style_value = `transform: translateY(${/*$tween*/ ctx[10] * 100}%); ${/*style*/ ctx[6]}`)) && { style: div_style_value } | ||
])); | ||
set_style(div1, "height", `${/*height*/ ctx[1]}px`, false); | ||
set_style(div1, "visibility", /*offset*/ ctx[8] <= 0 ? "hidden" : "visible", false); | ||
set_style(div, "height", `${/*height*/ ctx[1]}px`, false); | ||
set_style(div, "visibility", /*offset*/ ctx[9] <= 0 ? "hidden" : "visible", false); | ||
}, | ||
@@ -833,10 +898,10 @@ i(local) { | ||
d(detaching) { | ||
if (detaching) detach(div0); | ||
if (if_block0) if_block0.d(detaching); | ||
if (detaching) detach(t0); | ||
if (detaching) detach(div1); | ||
if (if_block0) if_block0.d(); | ||
if (detaching) detach(div); | ||
if (if_block1) if_block1.d(); | ||
if (if_block2) if_block2.d(); | ||
if (default_slot) default_slot.d(detaching); | ||
mounted = false; | ||
dispose(); | ||
run_all(dispose); | ||
} | ||
@@ -859,10 +924,14 @@ }; | ||
let { height = 0 } = $$props; | ||
let innerHeight = 0; | ||
let innerHeight = 0, scrollY = 0; | ||
const tween = tweened(1, { duration: 150 }); | ||
component_subscribe($$self, tween, value => $$invalidate(7, $tween = value)); | ||
component_subscribe($$self, tween, value => $$invalidate(10, $tween = value)); | ||
onMount(() => { | ||
$$invalidate(11, innerHeight = window.innerHeight); | ||
}); | ||
function onwindowresize() { | ||
$$invalidate(7, innerHeight = window_1.innerHeight); | ||
} | ||
function onwindowscroll() { | ||
$$invalidate(8, scrollY = window_1.pageYOffset); | ||
} | ||
const click_handler = () => $$invalidate(0, open = false); | ||
@@ -873,3 +942,3 @@ const click_handler_1 = () => $$invalidate(0, open = false); | ||
$$props = assign(assign({}, $$props), exclude_internal_props($$new_props)); | ||
$$invalidate(10, $$restProps = compute_rest_props($$props, omit_props_names)); | ||
$$invalidate(12, $$restProps = compute_rest_props($$props, omit_props_names)); | ||
if ('class' in $$new_props) $$invalidate(2, className = $$new_props.class); | ||
@@ -882,10 +951,34 @@ if ('open' in $$new_props) $$invalidate(0, open = $$new_props.open); | ||
if ('height' in $$new_props) $$invalidate(1, height = $$new_props.height); | ||
if ('$$scope' in $$new_props) $$invalidate(12, $$scope = $$new_props.$$scope); | ||
if ('$$scope' in $$new_props) $$invalidate(13, $$scope = $$new_props.$$scope); | ||
}; | ||
$$self.$$.update = () => { | ||
if ($$self.$$.dirty & /*open*/ 1) { | ||
if ($$self.$$.dirty & /*open, scrollY*/ 257) { | ||
if (open) { | ||
const bodyStyle = document.body.getAttribute("style") || ""; | ||
document.body.dataset.style = bodyStyle; | ||
document.body.dataset.scrollY = scrollY.toString(); | ||
setTimeout( | ||
() => { | ||
document.body.setAttribute("style", `position: fixed; top: -${scrollY}px; ${bodyStyle}`); | ||
}, | ||
0 | ||
); | ||
void tween.set(0); | ||
} else { | ||
const { style = "" } = document.body.dataset; | ||
// restore to original style | ||
document.body.setAttribute("style", style); | ||
setTimeout( | ||
() => { | ||
// restore to position scroll-y | ||
window.scrollTo(0, scrollY); | ||
}, | ||
0 | ||
); | ||
void tween.set(1); | ||
@@ -895,7 +988,3 @@ } | ||
if ($$self.$$.dirty & /*$tween*/ 128) { | ||
$$invalidate(8, offset = 1 - $tween); | ||
} | ||
if ($$self.$$.dirty & /*height, innerHeight*/ 2050) { | ||
if ($$self.$$.dirty & /*height, innerHeight*/ 130) { | ||
$$invalidate(1, height = height == 0 ? innerHeight * 0.85 : height); | ||
@@ -905,2 +994,4 @@ } | ||
$$invalidate(9, offset = 1 - 0); | ||
return [ | ||
@@ -914,9 +1005,12 @@ open, | ||
style, | ||
innerHeight, | ||
scrollY, | ||
offset, | ||
$tween, | ||
offset, | ||
tween, | ||
$$restProps, | ||
innerHeight, | ||
$$scope, | ||
slots, | ||
onwindowresize, | ||
onwindowscroll, | ||
click_handler, | ||
@@ -923,0 +1017,0 @@ click_handler_1 |
@@ -198,10 +198,2 @@ function noop() { } | ||
} | ||
function get_current_component() { | ||
if (!current_component) | ||
throw new Error('Function called outside component initialization'); | ||
return current_component; | ||
} | ||
function onMount(fn) { | ||
get_current_component().$$.on_mount.push(fn); | ||
} | ||
@@ -314,2 +306,8 @@ const dirty_components = []; | ||
const globals = (typeof window !== 'undefined' | ||
? window | ||
: typeof globalThis !== 'undefined' | ||
? globalThis | ||
: global); | ||
function get_spread_update(levels, updates) { | ||
@@ -621,4 +619,53 @@ const update = {}; | ||
/* components/bottom-sheet/src/BottomSheet.svelte generated by Svelte v3.48.0 */ | ||
/* components/bottom-sheet/src/BottomSheet.svelte generated by Svelte v3.46.4 */ | ||
const { setTimeout: setTimeout_1, window: window_1 } = globals; | ||
function create_if_block_2(ctx) { | ||
let div; | ||
let mounted; | ||
let dispose; | ||
return { | ||
c() { | ||
div = element("div"); | ||
attr(div, "class", "resp-bottom-sheet__overlay"); | ||
set_style(div, "opacity", /*offset*/ ctx[9], false); | ||
set_style(div, "visibility", /*offset*/ ctx[9] <= 0 ? "hidden" : "visible", false); | ||
}, | ||
m(target, anchor) { | ||
insert(target, div, anchor); | ||
if (!mounted) { | ||
dispose = listen(div, "click", function () { | ||
if (is_function(/*maskClosable*/ ctx[3] | ||
? /*click_handler*/ ctx[17] | ||
: noop)) (/*maskClosable*/ ctx[3] | ||
? /*click_handler*/ ctx[17] | ||
: noop).apply(this, arguments); | ||
}); | ||
mounted = true; | ||
} | ||
}, | ||
p(new_ctx, dirty) { | ||
ctx = new_ctx; | ||
if (dirty & /*offset*/ 512) { | ||
set_style(div, "opacity", /*offset*/ ctx[9], false); | ||
} | ||
if (dirty & /*offset*/ 512) { | ||
set_style(div, "visibility", /*offset*/ ctx[9] <= 0 ? "hidden" : "visible", false); | ||
} | ||
}, | ||
d(detaching) { | ||
if (detaching) detach(div); | ||
mounted = false; | ||
dispose(); | ||
} | ||
}; | ||
} | ||
// (55:2) {#if draggable} | ||
function create_if_block_1(ctx) { | ||
@@ -642,3 +689,3 @@ let div1; | ||
// (47:2) {#if closable} | ||
// (60:2) {#if closable} | ||
function create_if_block(ctx) { | ||
@@ -664,3 +711,3 @@ let span; | ||
if (!mounted) { | ||
dispose = listen(i, "click", /*click_handler_1*/ ctx[15]); | ||
dispose = listen(i, "click", /*click_handler_1*/ ctx[18]); | ||
mounted = true; | ||
@@ -679,31 +726,40 @@ } | ||
function create_fragment(ctx) { | ||
let div0; | ||
let scrolling = false; | ||
let clear_scrolling = () => { | ||
scrolling = false; | ||
}; | ||
let scrolling_timeout; | ||
let t0; | ||
let div1; | ||
let div; | ||
let t1; | ||
let t2; | ||
let div1_class_value; | ||
let div1_style_value; | ||
let div_class_value; | ||
let div_style_value; | ||
let current; | ||
let mounted; | ||
let dispose; | ||
let if_block0 = /*draggable*/ ctx[5] && create_if_block_1(); | ||
let if_block1 = /*closable*/ ctx[4] && create_if_block(ctx); | ||
const default_slot_template = /*#slots*/ ctx[13].default; | ||
const default_slot = create_slot(default_slot_template, ctx, /*$$scope*/ ctx[12], null); | ||
add_render_callback(/*onwindowresize*/ ctx[15]); | ||
add_render_callback(/*onwindowscroll*/ ctx[16]); | ||
let if_block0 = /*open*/ ctx[0] && create_if_block_2(ctx); | ||
let if_block1 = /*draggable*/ ctx[5] && create_if_block_1(); | ||
let if_block2 = /*closable*/ ctx[4] && create_if_block(ctx); | ||
const default_slot_template = /*#slots*/ ctx[14].default; | ||
const default_slot = create_slot(default_slot_template, ctx, /*$$scope*/ ctx[13], null); | ||
let div1_levels = [ | ||
let div_levels = [ | ||
{ | ||
class: div1_class_value = "resp-bottom-sheet " + /*className*/ ctx[2] | ||
class: div_class_value = "resp-bottom-sheet " + /*className*/ ctx[2] | ||
}, | ||
/*$$restProps*/ ctx[10], | ||
/*$$restProps*/ ctx[12], | ||
{ | ||
style: div1_style_value = `transform: translateY(${/*$tween*/ ctx[7] * 100}%); ${/*style*/ ctx[6]}` | ||
style: div_style_value = `transform: translateY(${/*$tween*/ ctx[10] * 100}%); ${/*style*/ ctx[6]}` | ||
} | ||
]; | ||
let div1_data = {}; | ||
let div_data = {}; | ||
for (let i = 0; i < div1_levels.length; i += 1) { | ||
div1_data = assign(div1_data, div1_levels[i]); | ||
for (let i = 0; i < div_levels.length; i += 1) { | ||
div_data = assign(div_data, div_levels[i]); | ||
} | ||
@@ -713,28 +769,25 @@ | ||
c() { | ||
div0 = element("div"); | ||
if (if_block0) if_block0.c(); | ||
t0 = space(); | ||
div1 = element("div"); | ||
if (if_block0) if_block0.c(); | ||
div = element("div"); | ||
if (if_block1) if_block1.c(); | ||
t1 = space(); | ||
if (if_block1) if_block1.c(); | ||
if (if_block2) if_block2.c(); | ||
t2 = space(); | ||
if (default_slot) default_slot.c(); | ||
attr(div0, "class", "resp-bottom-sheet__overlay"); | ||
set_style(div0, "opacity", /*offset*/ ctx[8], false); | ||
set_style(div0, "visibility", /*offset*/ ctx[8] <= 0 ? "hidden" : "visible", false); | ||
set_attributes(div1, div1_data); | ||
set_style(div1, "height", `${/*height*/ ctx[1]}px`, false); | ||
set_style(div1, "visibility", /*offset*/ ctx[8] <= 0 ? "hidden" : "visible", false); | ||
set_attributes(div, div_data); | ||
set_style(div, "height", `${/*height*/ ctx[1]}px`, false); | ||
set_style(div, "visibility", /*offset*/ ctx[9] <= 0 ? "hidden" : "visible", false); | ||
}, | ||
m(target, anchor) { | ||
insert(target, div0, anchor); | ||
if (if_block0) if_block0.m(target, anchor); | ||
insert(target, t0, anchor); | ||
insert(target, div1, anchor); | ||
if (if_block0) if_block0.m(div1, null); | ||
append(div1, t1); | ||
if (if_block1) if_block1.m(div1, null); | ||
append(div1, t2); | ||
insert(target, div, anchor); | ||
if (if_block1) if_block1.m(div, null); | ||
append(div, t1); | ||
if (if_block2) if_block2.m(div, null); | ||
append(div, t2); | ||
if (default_slot) { | ||
default_slot.m(div1, null); | ||
default_slot.m(div, null); | ||
} | ||
@@ -745,9 +798,11 @@ | ||
if (!mounted) { | ||
dispose = listen(div0, "click", function () { | ||
if (is_function(/*maskClosable*/ ctx[3] | ||
? /*click_handler*/ ctx[14] | ||
: noop)) (/*maskClosable*/ ctx[3] | ||
? /*click_handler*/ ctx[14] | ||
: noop).apply(this, arguments); | ||
}); | ||
dispose = [ | ||
listen(window_1, "resize", /*onwindowresize*/ ctx[15]), | ||
listen(window_1, "scroll", () => { | ||
scrolling = true; | ||
clearTimeout(scrolling_timeout); | ||
scrolling_timeout = setTimeout_1(clear_scrolling, 100); | ||
/*onwindowscroll*/ ctx[16](); | ||
}) | ||
]; | ||
@@ -757,18 +812,17 @@ mounted = true; | ||
}, | ||
p(new_ctx, [dirty]) { | ||
ctx = new_ctx; | ||
if (dirty & /*offset*/ 256) { | ||
set_style(div0, "opacity", /*offset*/ ctx[8], false); | ||
p(ctx, [dirty]) { | ||
if (dirty & /*scrollY*/ 256 && !scrolling) { | ||
scrolling = true; | ||
clearTimeout(scrolling_timeout); | ||
scrollTo(window_1.pageXOffset, /*scrollY*/ ctx[8]); | ||
scrolling_timeout = setTimeout_1(clear_scrolling, 100); | ||
} | ||
if (dirty & /*offset*/ 256) { | ||
set_style(div0, "visibility", /*offset*/ ctx[8] <= 0 ? "hidden" : "visible", false); | ||
} | ||
if (/*draggable*/ ctx[5]) { | ||
if (if_block0) ; else { | ||
if_block0 = create_if_block_1(); | ||
if (/*open*/ ctx[0]) { | ||
if (if_block0) { | ||
if_block0.p(ctx, dirty); | ||
} else { | ||
if_block0 = create_if_block_2(ctx); | ||
if_block0.c(); | ||
if_block0.m(div1, t1); | ||
if_block0.m(t0.parentNode, t0); | ||
} | ||
@@ -780,9 +834,7 @@ } else if (if_block0) { | ||
if (/*closable*/ ctx[4]) { | ||
if (if_block1) { | ||
if_block1.p(ctx, dirty); | ||
} else { | ||
if_block1 = create_if_block(ctx); | ||
if (/*draggable*/ ctx[5]) { | ||
if (if_block1) ; else { | ||
if_block1 = create_if_block_1(); | ||
if_block1.c(); | ||
if_block1.m(div1, t2); | ||
if_block1.m(div, t1); | ||
} | ||
@@ -794,4 +846,17 @@ } else if (if_block1) { | ||
if (/*closable*/ ctx[4]) { | ||
if (if_block2) { | ||
if_block2.p(ctx, dirty); | ||
} else { | ||
if_block2 = create_if_block(ctx); | ||
if_block2.c(); | ||
if_block2.m(div, t2); | ||
} | ||
} else if (if_block2) { | ||
if_block2.d(1); | ||
if_block2 = null; | ||
} | ||
if (default_slot) { | ||
if (default_slot.p && (!current || dirty & /*$$scope*/ 4096)) { | ||
if (default_slot.p && (!current || dirty & /*$$scope*/ 8192)) { | ||
update_slot_base( | ||
@@ -801,6 +866,6 @@ default_slot, | ||
ctx, | ||
/*$$scope*/ ctx[12], | ||
/*$$scope*/ ctx[13], | ||
!current | ||
? get_all_dirty_from_scope(/*$$scope*/ ctx[12]) | ||
: get_slot_changes(default_slot_template, /*$$scope*/ ctx[12], dirty, null), | ||
? get_all_dirty_from_scope(/*$$scope*/ ctx[13]) | ||
: get_slot_changes(default_slot_template, /*$$scope*/ ctx[13], dirty, null), | ||
null | ||
@@ -811,10 +876,10 @@ ); | ||
set_attributes(div1, div1_data = get_spread_update(div1_levels, [ | ||
(!current || dirty & /*className*/ 4 && div1_class_value !== (div1_class_value = "resp-bottom-sheet " + /*className*/ ctx[2])) && { class: div1_class_value }, | ||
dirty & /*$$restProps*/ 1024 && /*$$restProps*/ ctx[10], | ||
(!current || dirty & /*$tween, style*/ 192 && div1_style_value !== (div1_style_value = `transform: translateY(${/*$tween*/ ctx[7] * 100}%); ${/*style*/ ctx[6]}`)) && { style: div1_style_value } | ||
set_attributes(div, div_data = get_spread_update(div_levels, [ | ||
(!current || dirty & /*className*/ 4 && div_class_value !== (div_class_value = "resp-bottom-sheet " + /*className*/ ctx[2])) && { class: div_class_value }, | ||
dirty & /*$$restProps*/ 4096 && /*$$restProps*/ ctx[12], | ||
(!current || dirty & /*$tween, style*/ 1088 && div_style_value !== (div_style_value = `transform: translateY(${/*$tween*/ ctx[10] * 100}%); ${/*style*/ ctx[6]}`)) && { style: div_style_value } | ||
])); | ||
set_style(div1, "height", `${/*height*/ ctx[1]}px`, false); | ||
set_style(div1, "visibility", /*offset*/ ctx[8] <= 0 ? "hidden" : "visible", false); | ||
set_style(div, "height", `${/*height*/ ctx[1]}px`, false); | ||
set_style(div, "visibility", /*offset*/ ctx[9] <= 0 ? "hidden" : "visible", false); | ||
}, | ||
@@ -831,10 +896,10 @@ i(local) { | ||
d(detaching) { | ||
if (detaching) detach(div0); | ||
if (if_block0) if_block0.d(detaching); | ||
if (detaching) detach(t0); | ||
if (detaching) detach(div1); | ||
if (if_block0) if_block0.d(); | ||
if (detaching) detach(div); | ||
if (if_block1) if_block1.d(); | ||
if (if_block2) if_block2.d(); | ||
if (default_slot) default_slot.d(detaching); | ||
mounted = false; | ||
dispose(); | ||
run_all(dispose); | ||
} | ||
@@ -857,10 +922,14 @@ }; | ||
let { height = 0 } = $$props; | ||
let innerHeight = 0; | ||
let innerHeight = 0, scrollY = 0; | ||
const tween = tweened(1, { duration: 150 }); | ||
component_subscribe($$self, tween, value => $$invalidate(7, $tween = value)); | ||
component_subscribe($$self, tween, value => $$invalidate(10, $tween = value)); | ||
onMount(() => { | ||
$$invalidate(11, innerHeight = window.innerHeight); | ||
}); | ||
function onwindowresize() { | ||
$$invalidate(7, innerHeight = window_1.innerHeight); | ||
} | ||
function onwindowscroll() { | ||
$$invalidate(8, scrollY = window_1.pageYOffset); | ||
} | ||
const click_handler = () => $$invalidate(0, open = false); | ||
@@ -871,3 +940,3 @@ const click_handler_1 = () => $$invalidate(0, open = false); | ||
$$props = assign(assign({}, $$props), exclude_internal_props($$new_props)); | ||
$$invalidate(10, $$restProps = compute_rest_props($$props, omit_props_names)); | ||
$$invalidate(12, $$restProps = compute_rest_props($$props, omit_props_names)); | ||
if ('class' in $$new_props) $$invalidate(2, className = $$new_props.class); | ||
@@ -880,10 +949,34 @@ if ('open' in $$new_props) $$invalidate(0, open = $$new_props.open); | ||
if ('height' in $$new_props) $$invalidate(1, height = $$new_props.height); | ||
if ('$$scope' in $$new_props) $$invalidate(12, $$scope = $$new_props.$$scope); | ||
if ('$$scope' in $$new_props) $$invalidate(13, $$scope = $$new_props.$$scope); | ||
}; | ||
$$self.$$.update = () => { | ||
if ($$self.$$.dirty & /*open*/ 1) { | ||
if ($$self.$$.dirty & /*open, scrollY*/ 257) { | ||
if (open) { | ||
const bodyStyle = document.body.getAttribute("style") || ""; | ||
document.body.dataset.style = bodyStyle; | ||
document.body.dataset.scrollY = scrollY.toString(); | ||
setTimeout( | ||
() => { | ||
document.body.setAttribute("style", `position: fixed; top: -${scrollY}px; ${bodyStyle}`); | ||
}, | ||
0 | ||
); | ||
void tween.set(0); | ||
} else { | ||
const { style = "" } = document.body.dataset; | ||
// restore to original style | ||
document.body.setAttribute("style", style); | ||
setTimeout( | ||
() => { | ||
// restore to position scroll-y | ||
window.scrollTo(0, scrollY); | ||
}, | ||
0 | ||
); | ||
void tween.set(1); | ||
@@ -893,7 +986,3 @@ } | ||
if ($$self.$$.dirty & /*$tween*/ 128) { | ||
$$invalidate(8, offset = 1 - $tween); | ||
} | ||
if ($$self.$$.dirty & /*height, innerHeight*/ 2050) { | ||
if ($$self.$$.dirty & /*height, innerHeight*/ 130) { | ||
$$invalidate(1, height = height == 0 ? innerHeight * 0.85 : height); | ||
@@ -903,2 +992,4 @@ } | ||
$$invalidate(9, offset = 1 - 0); | ||
return [ | ||
@@ -912,9 +1003,12 @@ open, | ||
style, | ||
innerHeight, | ||
scrollY, | ||
offset, | ||
$tween, | ||
offset, | ||
tween, | ||
$$restProps, | ||
innerHeight, | ||
$$scope, | ||
slots, | ||
onwindowresize, | ||
onwindowscroll, | ||
click_handler, | ||
@@ -921,0 +1015,0 @@ click_handler_1 |
290
lib/index.js
@@ -201,10 +201,2 @@ var BottomSheet = (function () { | ||
} | ||
function get_current_component() { | ||
if (!current_component) | ||
throw new Error('Function called outside component initialization'); | ||
return current_component; | ||
} | ||
function onMount(fn) { | ||
get_current_component().$$.on_mount.push(fn); | ||
} | ||
@@ -317,2 +309,8 @@ const dirty_components = []; | ||
const globals = (typeof window !== 'undefined' | ||
? window | ||
: typeof globalThis !== 'undefined' | ||
? globalThis | ||
: global); | ||
function get_spread_update(levels, updates) { | ||
@@ -624,4 +622,53 @@ const update = {}; | ||
/* components/bottom-sheet/src/BottomSheet.svelte generated by Svelte v3.48.0 */ | ||
/* components/bottom-sheet/src/BottomSheet.svelte generated by Svelte v3.46.4 */ | ||
const { setTimeout: setTimeout_1, window: window_1 } = globals; | ||
function create_if_block_2(ctx) { | ||
let div; | ||
let mounted; | ||
let dispose; | ||
return { | ||
c() { | ||
div = element("div"); | ||
attr(div, "class", "resp-bottom-sheet__overlay"); | ||
set_style(div, "opacity", /*offset*/ ctx[9], false); | ||
set_style(div, "visibility", /*offset*/ ctx[9] <= 0 ? "hidden" : "visible", false); | ||
}, | ||
m(target, anchor) { | ||
insert(target, div, anchor); | ||
if (!mounted) { | ||
dispose = listen(div, "click", function () { | ||
if (is_function(/*maskClosable*/ ctx[3] | ||
? /*click_handler*/ ctx[17] | ||
: noop)) (/*maskClosable*/ ctx[3] | ||
? /*click_handler*/ ctx[17] | ||
: noop).apply(this, arguments); | ||
}); | ||
mounted = true; | ||
} | ||
}, | ||
p(new_ctx, dirty) { | ||
ctx = new_ctx; | ||
if (dirty & /*offset*/ 512) { | ||
set_style(div, "opacity", /*offset*/ ctx[9], false); | ||
} | ||
if (dirty & /*offset*/ 512) { | ||
set_style(div, "visibility", /*offset*/ ctx[9] <= 0 ? "hidden" : "visible", false); | ||
} | ||
}, | ||
d(detaching) { | ||
if (detaching) detach(div); | ||
mounted = false; | ||
dispose(); | ||
} | ||
}; | ||
} | ||
// (55:2) {#if draggable} | ||
function create_if_block_1(ctx) { | ||
@@ -645,3 +692,3 @@ let div1; | ||
// (47:2) {#if closable} | ||
// (60:2) {#if closable} | ||
function create_if_block(ctx) { | ||
@@ -667,3 +714,3 @@ let span; | ||
if (!mounted) { | ||
dispose = listen(i, "click", /*click_handler_1*/ ctx[15]); | ||
dispose = listen(i, "click", /*click_handler_1*/ ctx[18]); | ||
mounted = true; | ||
@@ -682,31 +729,40 @@ } | ||
function create_fragment(ctx) { | ||
let div0; | ||
let scrolling = false; | ||
let clear_scrolling = () => { | ||
scrolling = false; | ||
}; | ||
let scrolling_timeout; | ||
let t0; | ||
let div1; | ||
let div; | ||
let t1; | ||
let t2; | ||
let div1_class_value; | ||
let div1_style_value; | ||
let div_class_value; | ||
let div_style_value; | ||
let current; | ||
let mounted; | ||
let dispose; | ||
let if_block0 = /*draggable*/ ctx[5] && create_if_block_1(); | ||
let if_block1 = /*closable*/ ctx[4] && create_if_block(ctx); | ||
const default_slot_template = /*#slots*/ ctx[13].default; | ||
const default_slot = create_slot(default_slot_template, ctx, /*$$scope*/ ctx[12], null); | ||
add_render_callback(/*onwindowresize*/ ctx[15]); | ||
add_render_callback(/*onwindowscroll*/ ctx[16]); | ||
let if_block0 = /*open*/ ctx[0] && create_if_block_2(ctx); | ||
let if_block1 = /*draggable*/ ctx[5] && create_if_block_1(); | ||
let if_block2 = /*closable*/ ctx[4] && create_if_block(ctx); | ||
const default_slot_template = /*#slots*/ ctx[14].default; | ||
const default_slot = create_slot(default_slot_template, ctx, /*$$scope*/ ctx[13], null); | ||
let div1_levels = [ | ||
let div_levels = [ | ||
{ | ||
class: div1_class_value = "resp-bottom-sheet " + /*className*/ ctx[2] | ||
class: div_class_value = "resp-bottom-sheet " + /*className*/ ctx[2] | ||
}, | ||
/*$$restProps*/ ctx[10], | ||
/*$$restProps*/ ctx[12], | ||
{ | ||
style: div1_style_value = `transform: translateY(${/*$tween*/ ctx[7] * 100}%); ${/*style*/ ctx[6]}` | ||
style: div_style_value = `transform: translateY(${/*$tween*/ ctx[10] * 100}%); ${/*style*/ ctx[6]}` | ||
} | ||
]; | ||
let div1_data = {}; | ||
let div_data = {}; | ||
for (let i = 0; i < div1_levels.length; i += 1) { | ||
div1_data = assign(div1_data, div1_levels[i]); | ||
for (let i = 0; i < div_levels.length; i += 1) { | ||
div_data = assign(div_data, div_levels[i]); | ||
} | ||
@@ -716,28 +772,25 @@ | ||
c() { | ||
div0 = element("div"); | ||
if (if_block0) if_block0.c(); | ||
t0 = space(); | ||
div1 = element("div"); | ||
if (if_block0) if_block0.c(); | ||
div = element("div"); | ||
if (if_block1) if_block1.c(); | ||
t1 = space(); | ||
if (if_block1) if_block1.c(); | ||
if (if_block2) if_block2.c(); | ||
t2 = space(); | ||
if (default_slot) default_slot.c(); | ||
attr(div0, "class", "resp-bottom-sheet__overlay"); | ||
set_style(div0, "opacity", /*offset*/ ctx[8], false); | ||
set_style(div0, "visibility", /*offset*/ ctx[8] <= 0 ? "hidden" : "visible", false); | ||
set_attributes(div1, div1_data); | ||
set_style(div1, "height", `${/*height*/ ctx[1]}px`, false); | ||
set_style(div1, "visibility", /*offset*/ ctx[8] <= 0 ? "hidden" : "visible", false); | ||
set_attributes(div, div_data); | ||
set_style(div, "height", `${/*height*/ ctx[1]}px`, false); | ||
set_style(div, "visibility", /*offset*/ ctx[9] <= 0 ? "hidden" : "visible", false); | ||
}, | ||
m(target, anchor) { | ||
insert(target, div0, anchor); | ||
if (if_block0) if_block0.m(target, anchor); | ||
insert(target, t0, anchor); | ||
insert(target, div1, anchor); | ||
if (if_block0) if_block0.m(div1, null); | ||
append(div1, t1); | ||
if (if_block1) if_block1.m(div1, null); | ||
append(div1, t2); | ||
insert(target, div, anchor); | ||
if (if_block1) if_block1.m(div, null); | ||
append(div, t1); | ||
if (if_block2) if_block2.m(div, null); | ||
append(div, t2); | ||
if (default_slot) { | ||
default_slot.m(div1, null); | ||
default_slot.m(div, null); | ||
} | ||
@@ -748,9 +801,11 @@ | ||
if (!mounted) { | ||
dispose = listen(div0, "click", function () { | ||
if (is_function(/*maskClosable*/ ctx[3] | ||
? /*click_handler*/ ctx[14] | ||
: noop)) (/*maskClosable*/ ctx[3] | ||
? /*click_handler*/ ctx[14] | ||
: noop).apply(this, arguments); | ||
}); | ||
dispose = [ | ||
listen(window_1, "resize", /*onwindowresize*/ ctx[15]), | ||
listen(window_1, "scroll", () => { | ||
scrolling = true; | ||
clearTimeout(scrolling_timeout); | ||
scrolling_timeout = setTimeout_1(clear_scrolling, 100); | ||
/*onwindowscroll*/ ctx[16](); | ||
}) | ||
]; | ||
@@ -760,18 +815,17 @@ mounted = true; | ||
}, | ||
p(new_ctx, [dirty]) { | ||
ctx = new_ctx; | ||
if (dirty & /*offset*/ 256) { | ||
set_style(div0, "opacity", /*offset*/ ctx[8], false); | ||
p(ctx, [dirty]) { | ||
if (dirty & /*scrollY*/ 256 && !scrolling) { | ||
scrolling = true; | ||
clearTimeout(scrolling_timeout); | ||
scrollTo(window_1.pageXOffset, /*scrollY*/ ctx[8]); | ||
scrolling_timeout = setTimeout_1(clear_scrolling, 100); | ||
} | ||
if (dirty & /*offset*/ 256) { | ||
set_style(div0, "visibility", /*offset*/ ctx[8] <= 0 ? "hidden" : "visible", false); | ||
} | ||
if (/*draggable*/ ctx[5]) { | ||
if (if_block0) ; else { | ||
if_block0 = create_if_block_1(); | ||
if (/*open*/ ctx[0]) { | ||
if (if_block0) { | ||
if_block0.p(ctx, dirty); | ||
} else { | ||
if_block0 = create_if_block_2(ctx); | ||
if_block0.c(); | ||
if_block0.m(div1, t1); | ||
if_block0.m(t0.parentNode, t0); | ||
} | ||
@@ -783,9 +837,7 @@ } else if (if_block0) { | ||
if (/*closable*/ ctx[4]) { | ||
if (if_block1) { | ||
if_block1.p(ctx, dirty); | ||
} else { | ||
if_block1 = create_if_block(ctx); | ||
if (/*draggable*/ ctx[5]) { | ||
if (if_block1) ; else { | ||
if_block1 = create_if_block_1(); | ||
if_block1.c(); | ||
if_block1.m(div1, t2); | ||
if_block1.m(div, t1); | ||
} | ||
@@ -797,4 +849,17 @@ } else if (if_block1) { | ||
if (/*closable*/ ctx[4]) { | ||
if (if_block2) { | ||
if_block2.p(ctx, dirty); | ||
} else { | ||
if_block2 = create_if_block(ctx); | ||
if_block2.c(); | ||
if_block2.m(div, t2); | ||
} | ||
} else if (if_block2) { | ||
if_block2.d(1); | ||
if_block2 = null; | ||
} | ||
if (default_slot) { | ||
if (default_slot.p && (!current || dirty & /*$$scope*/ 4096)) { | ||
if (default_slot.p && (!current || dirty & /*$$scope*/ 8192)) { | ||
update_slot_base( | ||
@@ -804,6 +869,6 @@ default_slot, | ||
ctx, | ||
/*$$scope*/ ctx[12], | ||
/*$$scope*/ ctx[13], | ||
!current | ||
? get_all_dirty_from_scope(/*$$scope*/ ctx[12]) | ||
: get_slot_changes(default_slot_template, /*$$scope*/ ctx[12], dirty, null), | ||
? get_all_dirty_from_scope(/*$$scope*/ ctx[13]) | ||
: get_slot_changes(default_slot_template, /*$$scope*/ ctx[13], dirty, null), | ||
null | ||
@@ -814,10 +879,10 @@ ); | ||
set_attributes(div1, div1_data = get_spread_update(div1_levels, [ | ||
(!current || dirty & /*className*/ 4 && div1_class_value !== (div1_class_value = "resp-bottom-sheet " + /*className*/ ctx[2])) && { class: div1_class_value }, | ||
dirty & /*$$restProps*/ 1024 && /*$$restProps*/ ctx[10], | ||
(!current || dirty & /*$tween, style*/ 192 && div1_style_value !== (div1_style_value = `transform: translateY(${/*$tween*/ ctx[7] * 100}%); ${/*style*/ ctx[6]}`)) && { style: div1_style_value } | ||
set_attributes(div, div_data = get_spread_update(div_levels, [ | ||
(!current || dirty & /*className*/ 4 && div_class_value !== (div_class_value = "resp-bottom-sheet " + /*className*/ ctx[2])) && { class: div_class_value }, | ||
dirty & /*$$restProps*/ 4096 && /*$$restProps*/ ctx[12], | ||
(!current || dirty & /*$tween, style*/ 1088 && div_style_value !== (div_style_value = `transform: translateY(${/*$tween*/ ctx[10] * 100}%); ${/*style*/ ctx[6]}`)) && { style: div_style_value } | ||
])); | ||
set_style(div1, "height", `${/*height*/ ctx[1]}px`, false); | ||
set_style(div1, "visibility", /*offset*/ ctx[8] <= 0 ? "hidden" : "visible", false); | ||
set_style(div, "height", `${/*height*/ ctx[1]}px`, false); | ||
set_style(div, "visibility", /*offset*/ ctx[9] <= 0 ? "hidden" : "visible", false); | ||
}, | ||
@@ -834,10 +899,10 @@ i(local) { | ||
d(detaching) { | ||
if (detaching) detach(div0); | ||
if (if_block0) if_block0.d(detaching); | ||
if (detaching) detach(t0); | ||
if (detaching) detach(div1); | ||
if (if_block0) if_block0.d(); | ||
if (detaching) detach(div); | ||
if (if_block1) if_block1.d(); | ||
if (if_block2) if_block2.d(); | ||
if (default_slot) default_slot.d(detaching); | ||
mounted = false; | ||
dispose(); | ||
run_all(dispose); | ||
} | ||
@@ -860,10 +925,14 @@ }; | ||
let { height = 0 } = $$props; | ||
let innerHeight = 0; | ||
let innerHeight = 0, scrollY = 0; | ||
const tween = tweened(1, { duration: 150 }); | ||
component_subscribe($$self, tween, value => $$invalidate(7, $tween = value)); | ||
component_subscribe($$self, tween, value => $$invalidate(10, $tween = value)); | ||
onMount(() => { | ||
$$invalidate(11, innerHeight = window.innerHeight); | ||
}); | ||
function onwindowresize() { | ||
$$invalidate(7, innerHeight = window_1.innerHeight); | ||
} | ||
function onwindowscroll() { | ||
$$invalidate(8, scrollY = window_1.pageYOffset); | ||
} | ||
const click_handler = () => $$invalidate(0, open = false); | ||
@@ -874,3 +943,3 @@ const click_handler_1 = () => $$invalidate(0, open = false); | ||
$$props = assign(assign({}, $$props), exclude_internal_props($$new_props)); | ||
$$invalidate(10, $$restProps = compute_rest_props($$props, omit_props_names)); | ||
$$invalidate(12, $$restProps = compute_rest_props($$props, omit_props_names)); | ||
if ('class' in $$new_props) $$invalidate(2, className = $$new_props.class); | ||
@@ -883,10 +952,34 @@ if ('open' in $$new_props) $$invalidate(0, open = $$new_props.open); | ||
if ('height' in $$new_props) $$invalidate(1, height = $$new_props.height); | ||
if ('$$scope' in $$new_props) $$invalidate(12, $$scope = $$new_props.$$scope); | ||
if ('$$scope' in $$new_props) $$invalidate(13, $$scope = $$new_props.$$scope); | ||
}; | ||
$$self.$$.update = () => { | ||
if ($$self.$$.dirty & /*open*/ 1) { | ||
if ($$self.$$.dirty & /*open, scrollY*/ 257) { | ||
if (open) { | ||
const bodyStyle = document.body.getAttribute("style") || ""; | ||
document.body.dataset.style = bodyStyle; | ||
document.body.dataset.scrollY = scrollY.toString(); | ||
setTimeout( | ||
() => { | ||
document.body.setAttribute("style", `position: fixed; top: -${scrollY}px; ${bodyStyle}`); | ||
}, | ||
0 | ||
); | ||
void tween.set(0); | ||
} else { | ||
const { style = "" } = document.body.dataset; | ||
// restore to original style | ||
document.body.setAttribute("style", style); | ||
setTimeout( | ||
() => { | ||
// restore to position scroll-y | ||
window.scrollTo(0, scrollY); | ||
}, | ||
0 | ||
); | ||
void tween.set(1); | ||
@@ -896,7 +989,3 @@ } | ||
if ($$self.$$.dirty & /*$tween*/ 128) { | ||
$$invalidate(8, offset = 1 - $tween); | ||
} | ||
if ($$self.$$.dirty & /*height, innerHeight*/ 2050) { | ||
if ($$self.$$.dirty & /*height, innerHeight*/ 130) { | ||
$$invalidate(1, height = height == 0 ? innerHeight * 0.85 : height); | ||
@@ -906,2 +995,4 @@ } | ||
$$invalidate(9, offset = 1 - 0); | ||
return [ | ||
@@ -915,9 +1006,12 @@ open, | ||
style, | ||
innerHeight, | ||
scrollY, | ||
offset, | ||
$tween, | ||
offset, | ||
tween, | ||
$$restProps, | ||
innerHeight, | ||
$$scope, | ||
slots, | ||
onwindowresize, | ||
onwindowscroll, | ||
click_handler, | ||
@@ -924,0 +1018,0 @@ click_handler_1 |
{ | ||
"name": "@responsive-ui/bottom-sheet", | ||
"version": "1.1.0-alpha.32", | ||
"version": "1.1.0-alpha.37", | ||
"description": "A bottom sheet component of responsive-ui.", | ||
@@ -50,3 +50,3 @@ "author": "Si3nLoong <sianloong90@gmail.com> (https://github.com/si3nloong)", | ||
}, | ||
"gitHead": "823c7aecf182e95ab6c315dad06ef4514467446f" | ||
"gitHead": "9d2f82429ebda366755591a4538889799cee9842" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
101806
2907
9