@tarnadas/svelte-simple-modal
Advanced tools
Comparing version 1.6.2 to 1.6.3
491
lib/index.js
@@ -22,3 +22,3 @@ import { SvelteComponent, init, safe_not_equal, append_styles, create_slot, space, insert, listen, transition_in, group_outros, transition_out, check_outros, update_slot_base, get_all_dirty_from_scope, get_slot_changes, detach, globals, construct_svelte_component, element, create_component, attr, null_to_empty, toggle_class, append, mount_component, is_function, destroy_component, add_render_callback, create_bidirectional_transition, run_all, empty, binding_callbacks, noop } from 'svelte/internal'; | ||
// (487:0) {#if Component} | ||
// (466:0) {#if Component} | ||
function create_if_block(ctx) { | ||
@@ -37,3 +37,2 @@ let div3; | ||
let div2_class_value; | ||
let div3_id_value; | ||
let div3_class_value; | ||
@@ -44,4 +43,4 @@ let div3_transition; | ||
let dispose; | ||
let if_block = /*state*/ ctx[1].closeButton && create_if_block_1(ctx); | ||
var switch_value = /*Component*/ ctx[2]; | ||
let if_block = /*closeButton*/ ctx[3] && create_if_block_1(ctx); | ||
var switch_value = /*Component*/ ctx[12]; | ||
@@ -65,24 +64,24 @@ function switch_props(ctx) { | ||
if (switch_instance) create_component(switch_instance.$$.fragment); | ||
attr(div0, "class", div0_class_value = "" + (null_to_empty(/*state*/ ctx[1].classContent) + " svelte-n7cvum")); | ||
attr(div0, "style", /*cssContent*/ ctx[9]); | ||
toggle_class(div0, "content", !/*unstyled*/ ctx[0]); | ||
attr(div1, "class", div1_class_value = "" + (null_to_empty(/*state*/ ctx[1].classWindow) + " svelte-n7cvum")); | ||
attr(div0, "class", div0_class_value = "" + (null_to_empty(/*classContent*/ ctx[5]) + " svelte-n7cvum")); | ||
attr(div0, "style", /*cssContent*/ ctx[19]); | ||
toggle_class(div0, "content", !/*unstyled*/ ctx[7]); | ||
attr(div1, "class", div1_class_value = "" + (null_to_empty(/*classWindow*/ ctx[4]) + " svelte-n7cvum")); | ||
attr(div1, "role", "dialog"); | ||
attr(div1, "aria-modal", "true"); | ||
attr(div1, "aria-label", div1_aria_label_value = /*state*/ ctx[1].ariaLabelledBy | ||
attr(div1, "aria-label", div1_aria_label_value = /*ariaLabelledBy*/ ctx[2] | ||
? null | ||
: /*state*/ ctx[1].ariaLabel || null); | ||
: /*ariaLabel*/ ctx[1] || null); | ||
attr(div1, "aria-labelledby", div1_aria_labelledby_value = /*state*/ ctx[1].ariaLabelledBy || null); | ||
attr(div1, "style", /*cssWindow*/ ctx[8]); | ||
toggle_class(div1, "window", !/*unstyled*/ ctx[0]); | ||
attr(div2, "class", div2_class_value = "" + (null_to_empty(/*state*/ ctx[1].classWindowWrap) + " svelte-n7cvum")); | ||
attr(div2, "style", /*cssWindowWrap*/ ctx[7]); | ||
toggle_class(div2, "wrap", !/*unstyled*/ ctx[0]); | ||
attr(div1, "aria-labelledby", div1_aria_labelledby_value = /*ariaLabelledBy*/ ctx[2] || null); | ||
attr(div1, "style", /*cssWindow*/ ctx[18]); | ||
toggle_class(div1, "window", !/*unstyled*/ ctx[7]); | ||
attr(div2, "class", div2_class_value = "" + (null_to_empty(/*classWindowWrap*/ ctx[11]) + " svelte-n7cvum")); | ||
attr(div2, "style", /*cssWindowWrap*/ ctx[17]); | ||
toggle_class(div2, "wrap", !/*unstyled*/ ctx[7]); | ||
attr(div3, "aria-hidden", "true"); | ||
attr(div3, "id", div3_id_value = /*state*/ ctx[1].id); | ||
attr(div3, "class", div3_class_value = "" + (null_to_empty(/*state*/ ctx[1].classBg) + " svelte-n7cvum")); | ||
attr(div3, "style", /*cssBg*/ ctx[6]); | ||
toggle_class(div3, "bg", !/*unstyled*/ ctx[0]); | ||
attr(div3, "id", /*id*/ ctx[0]); | ||
attr(div3, "class", div3_class_value = "" + (null_to_empty(/*classBg*/ ctx[10]) + " svelte-n7cvum")); | ||
attr(div3, "style", /*cssBg*/ ctx[16]); | ||
toggle_class(div3, "bg", !/*unstyled*/ ctx[7]); | ||
}, | ||
@@ -97,5 +96,5 @@ m(target, anchor) { | ||
if (switch_instance) mount_component(switch_instance, div0, null); | ||
/*div1_binding*/ ctx[50](div1); | ||
/*div2_binding*/ ctx[51](div2); | ||
/*div3_binding*/ ctx[52](div3); | ||
/*div1_binding*/ ctx[49](div1); | ||
/*div2_binding*/ ctx[50](div2); | ||
/*div3_binding*/ ctx[51](div3); | ||
current = true; | ||
@@ -106,15 +105,15 @@ | ||
listen(div1, "introstart", function () { | ||
if (is_function(/*onOpen*/ ctx[13])) /*onOpen*/ ctx[13].apply(this, arguments); | ||
if (is_function(/*onOpen*/ ctx[23])) /*onOpen*/ ctx[23].apply(this, arguments); | ||
}), | ||
listen(div1, "outrostart", function () { | ||
if (is_function(/*onClose*/ ctx[14])) /*onClose*/ ctx[14].apply(this, arguments); | ||
if (is_function(/*onClose*/ ctx[24])) /*onClose*/ ctx[24].apply(this, arguments); | ||
}), | ||
listen(div1, "introend", function () { | ||
if (is_function(/*onOpened*/ ctx[15])) /*onOpened*/ ctx[15].apply(this, arguments); | ||
if (is_function(/*onOpened*/ ctx[25])) /*onOpened*/ ctx[25].apply(this, arguments); | ||
}), | ||
listen(div1, "outroend", function () { | ||
if (is_function(/*onClosed*/ ctx[16])) /*onClosed*/ ctx[16].apply(this, arguments); | ||
if (is_function(/*onClosed*/ ctx[26])) /*onClosed*/ ctx[26].apply(this, arguments); | ||
}), | ||
listen(div3, "mousedown", /*handleOuterMousedown*/ ctx[20]), | ||
listen(div3, "mouseup", /*handleOuterMouseup*/ ctx[21]) | ||
listen(div3, "mousedown", /*handleOuterMousedown*/ ctx[30]), | ||
listen(div3, "mouseup", /*handleOuterMouseup*/ ctx[31]) | ||
]; | ||
@@ -128,7 +127,7 @@ | ||
if (/*state*/ ctx[1].closeButton) { | ||
if (/*closeButton*/ ctx[3]) { | ||
if (if_block) { | ||
if_block.p(ctx, dirty); | ||
if (dirty[0] & /*state*/ 2) { | ||
if (dirty[0] & /*closeButton*/ 8) { | ||
transition_in(if_block, 1); | ||
@@ -152,3 +151,3 @@ } | ||
if (dirty[0] & /*Component*/ 4 && switch_value !== (switch_value = /*Component*/ ctx[2])) { | ||
if (dirty[0] & /*Component*/ 4096 && switch_value !== (switch_value = /*Component*/ ctx[12])) { | ||
if (switch_instance) { | ||
@@ -175,62 +174,62 @@ group_outros(); | ||
if (!current || dirty[0] & /*state*/ 2 && div0_class_value !== (div0_class_value = "" + (null_to_empty(/*state*/ ctx[1].classContent) + " svelte-n7cvum"))) { | ||
if (!current || dirty[0] & /*classContent*/ 32 && div0_class_value !== (div0_class_value = "" + (null_to_empty(/*classContent*/ ctx[5]) + " svelte-n7cvum"))) { | ||
attr(div0, "class", div0_class_value); | ||
} | ||
if (!current || dirty[0] & /*cssContent*/ 512) { | ||
attr(div0, "style", /*cssContent*/ ctx[9]); | ||
if (!current || dirty[0] & /*cssContent*/ 524288) { | ||
attr(div0, "style", /*cssContent*/ ctx[19]); | ||
} | ||
if (!current || dirty[0] & /*state, unstyled*/ 3) { | ||
toggle_class(div0, "content", !/*unstyled*/ ctx[0]); | ||
if (!current || dirty[0] & /*classContent, unstyled*/ 160) { | ||
toggle_class(div0, "content", !/*unstyled*/ ctx[7]); | ||
} | ||
if (!current || dirty[0] & /*state*/ 2 && div1_class_value !== (div1_class_value = "" + (null_to_empty(/*state*/ ctx[1].classWindow) + " svelte-n7cvum"))) { | ||
if (!current || dirty[0] & /*classWindow*/ 16 && div1_class_value !== (div1_class_value = "" + (null_to_empty(/*classWindow*/ ctx[4]) + " svelte-n7cvum"))) { | ||
attr(div1, "class", div1_class_value); | ||
} | ||
if (!current || dirty[0] & /*state*/ 2 && div1_aria_label_value !== (div1_aria_label_value = /*state*/ ctx[1].ariaLabelledBy | ||
if (!current || dirty[0] & /*ariaLabelledBy, ariaLabel*/ 6 && div1_aria_label_value !== (div1_aria_label_value = /*ariaLabelledBy*/ ctx[2] | ||
? null | ||
: /*state*/ ctx[1].ariaLabel || null)) { | ||
: /*ariaLabel*/ ctx[1] || null)) { | ||
attr(div1, "aria-label", div1_aria_label_value); | ||
} | ||
if (!current || dirty[0] & /*state*/ 2 && div1_aria_labelledby_value !== (div1_aria_labelledby_value = /*state*/ ctx[1].ariaLabelledBy || null)) { | ||
if (!current || dirty[0] & /*ariaLabelledBy*/ 4 && div1_aria_labelledby_value !== (div1_aria_labelledby_value = /*ariaLabelledBy*/ ctx[2] || null)) { | ||
attr(div1, "aria-labelledby", div1_aria_labelledby_value); | ||
} | ||
if (!current || dirty[0] & /*cssWindow*/ 256) { | ||
attr(div1, "style", /*cssWindow*/ ctx[8]); | ||
if (!current || dirty[0] & /*cssWindow*/ 262144) { | ||
attr(div1, "style", /*cssWindow*/ ctx[18]); | ||
} | ||
if (!current || dirty[0] & /*state, unstyled*/ 3) { | ||
toggle_class(div1, "window", !/*unstyled*/ ctx[0]); | ||
if (!current || dirty[0] & /*classWindow, unstyled*/ 144) { | ||
toggle_class(div1, "window", !/*unstyled*/ ctx[7]); | ||
} | ||
if (!current || dirty[0] & /*state*/ 2 && div2_class_value !== (div2_class_value = "" + (null_to_empty(/*state*/ ctx[1].classWindowWrap) + " svelte-n7cvum"))) { | ||
if (!current || dirty[0] & /*classWindowWrap*/ 2048 && div2_class_value !== (div2_class_value = "" + (null_to_empty(/*classWindowWrap*/ ctx[11]) + " svelte-n7cvum"))) { | ||
attr(div2, "class", div2_class_value); | ||
} | ||
if (!current || dirty[0] & /*cssWindowWrap*/ 128) { | ||
attr(div2, "style", /*cssWindowWrap*/ ctx[7]); | ||
if (!current || dirty[0] & /*cssWindowWrap*/ 131072) { | ||
attr(div2, "style", /*cssWindowWrap*/ ctx[17]); | ||
} | ||
if (!current || dirty[0] & /*state, unstyled*/ 3) { | ||
toggle_class(div2, "wrap", !/*unstyled*/ ctx[0]); | ||
if (!current || dirty[0] & /*classWindowWrap, unstyled*/ 2176) { | ||
toggle_class(div2, "wrap", !/*unstyled*/ ctx[7]); | ||
} | ||
if (!current || dirty[0] & /*state*/ 2 && div3_id_value !== (div3_id_value = /*state*/ ctx[1].id)) { | ||
attr(div3, "id", div3_id_value); | ||
if (!current || dirty[0] & /*id*/ 1) { | ||
attr(div3, "id", /*id*/ ctx[0]); | ||
} | ||
if (!current || dirty[0] & /*state*/ 2 && div3_class_value !== (div3_class_value = "" + (null_to_empty(/*state*/ ctx[1].classBg) + " svelte-n7cvum"))) { | ||
if (!current || dirty[0] & /*classBg*/ 1024 && div3_class_value !== (div3_class_value = "" + (null_to_empty(/*classBg*/ ctx[10]) + " svelte-n7cvum"))) { | ||
attr(div3, "class", div3_class_value); | ||
} | ||
if (!current || dirty[0] & /*cssBg*/ 64) { | ||
attr(div3, "style", /*cssBg*/ ctx[6]); | ||
if (!current || dirty[0] & /*cssBg*/ 65536) { | ||
attr(div3, "style", /*cssBg*/ ctx[16]); | ||
} | ||
if (!current || dirty[0] & /*state, unstyled*/ 3) { | ||
toggle_class(div3, "bg", !/*unstyled*/ ctx[0]); | ||
if (!current || dirty[0] & /*classBg, unstyled*/ 1152) { | ||
toggle_class(div3, "bg", !/*unstyled*/ ctx[7]); | ||
} | ||
@@ -246,3 +245,3 @@ }, | ||
if (!current) return; | ||
if (!div1_transition) div1_transition = create_bidirectional_transition(div1, /*currentTransitionWindow*/ ctx[12], /*state*/ ctx[1].transitionWindowProps, true); | ||
if (!div1_transition) div1_transition = create_bidirectional_transition(div1, /*currentTransitionWindow*/ ctx[22], /*transitionWindowProps*/ ctx[9], true); | ||
div1_transition.run(1); | ||
@@ -255,3 +254,3 @@ }); | ||
if (!current) return; | ||
if (!div3_transition) div3_transition = create_bidirectional_transition(div3, /*currentTransitionBg*/ ctx[11], /*state*/ ctx[1].transitionBgProps, true); | ||
if (!div3_transition) div3_transition = create_bidirectional_transition(div3, /*currentTransitionBg*/ ctx[21], /*transitionBgProps*/ ctx[8], true); | ||
div3_transition.run(1); | ||
@@ -268,3 +267,3 @@ }); | ||
if (local) { | ||
if (!div1_transition) div1_transition = create_bidirectional_transition(div1, /*currentTransitionWindow*/ ctx[12], /*state*/ ctx[1].transitionWindowProps, false); | ||
if (!div1_transition) div1_transition = create_bidirectional_transition(div1, /*currentTransitionWindow*/ ctx[22], /*transitionWindowProps*/ ctx[9], false); | ||
div1_transition.run(0); | ||
@@ -274,3 +273,3 @@ } | ||
if (local) { | ||
if (!div3_transition) div3_transition = create_bidirectional_transition(div3, /*currentTransitionBg*/ ctx[11], /*state*/ ctx[1].transitionBgProps, false); | ||
if (!div3_transition) div3_transition = create_bidirectional_transition(div3, /*currentTransitionBg*/ ctx[21], /*transitionBgProps*/ ctx[8], false); | ||
div3_transition.run(0); | ||
@@ -288,6 +287,6 @@ } | ||
if (switch_instance) destroy_component(switch_instance); | ||
/*div1_binding*/ ctx[50](null); | ||
/*div1_binding*/ ctx[49](null); | ||
if (detaching && div1_transition) div1_transition.end(); | ||
/*div2_binding*/ ctx[51](null); | ||
/*div3_binding*/ ctx[52](null); | ||
/*div2_binding*/ ctx[50](null); | ||
/*div3_binding*/ ctx[51](null); | ||
if (detaching && div3_transition) div3_transition.end(); | ||
@@ -300,3 +299,3 @@ mounted = false; | ||
// (520:8) {#if state.closeButton} | ||
// (499:8) {#if closeButton} | ||
function create_if_block_1(ctx) { | ||
@@ -312,4 +311,4 @@ let show_if; | ||
function select_block_type(ctx, dirty) { | ||
if (dirty[0] & /*state*/ 2) show_if = null; | ||
if (show_if == null) show_if = !!/*isFunction*/ ctx[17](/*state*/ ctx[1].closeButton); | ||
if (dirty[0] & /*closeButton*/ 8) show_if = null; | ||
if (show_if == null) show_if = !!/*isFunction*/ ctx[27](/*closeButton*/ ctx[3]); | ||
if (show_if) return 0; | ||
@@ -378,3 +377,3 @@ return 1; | ||
// (523:10) {:else} | ||
// (502:10) {:else} | ||
function create_else_block(ctx) { | ||
@@ -389,7 +388,7 @@ let button; | ||
button = element("button"); | ||
attr(button, "class", button_class_value = "" + (null_to_empty(/*state*/ ctx[1].classCloseButton) + " svelte-n7cvum")); | ||
attr(button, "class", button_class_value = "" + (null_to_empty(/*classCloseButton*/ ctx[6]) + " svelte-n7cvum")); | ||
attr(button, "aria-label", "Close modal"); | ||
attr(button, "style", /*cssCloseButton*/ ctx[10]); | ||
attr(button, "style", /*cssCloseButton*/ ctx[20]); | ||
attr(button, "type", "button"); | ||
toggle_class(button, "close", !/*unstyled*/ ctx[0]); | ||
toggle_class(button, "close", !/*unstyled*/ ctx[7]); | ||
}, | ||
@@ -400,3 +399,3 @@ m(target, anchor) { | ||
if (!mounted) { | ||
dispose = listen(button, "click", /*close*/ ctx[18]); | ||
dispose = listen(button, "click", /*close*/ ctx[28]); | ||
mounted = true; | ||
@@ -406,12 +405,12 @@ } | ||
p(ctx, dirty) { | ||
if (dirty[0] & /*state*/ 2 && button_class_value !== (button_class_value = "" + (null_to_empty(/*state*/ ctx[1].classCloseButton) + " svelte-n7cvum"))) { | ||
if (dirty[0] & /*classCloseButton*/ 64 && button_class_value !== (button_class_value = "" + (null_to_empty(/*classCloseButton*/ ctx[6]) + " svelte-n7cvum"))) { | ||
attr(button, "class", button_class_value); | ||
} | ||
if (dirty[0] & /*cssCloseButton*/ 1024) { | ||
attr(button, "style", /*cssCloseButton*/ ctx[10]); | ||
if (dirty[0] & /*cssCloseButton*/ 1048576) { | ||
attr(button, "style", /*cssCloseButton*/ ctx[20]); | ||
} | ||
if (dirty[0] & /*state, unstyled*/ 3) { | ||
toggle_class(button, "close", !/*unstyled*/ ctx[0]); | ||
if (dirty[0] & /*classCloseButton, unstyled*/ 192) { | ||
toggle_class(button, "close", !/*unstyled*/ ctx[7]); | ||
} | ||
@@ -432,3 +431,3 @@ }, | ||
// (521:10) {#if isFunction(state.closeButton)} | ||
// (500:10) {#if isFunction(closeButton)} | ||
function create_if_block_2(ctx) { | ||
@@ -438,6 +437,6 @@ let switch_instance; | ||
let current; | ||
var switch_value = /*state*/ ctx[1].closeButton; | ||
var switch_value = /*closeButton*/ ctx[3]; | ||
function switch_props(ctx) { | ||
return { props: { onClose: /*close*/ ctx[18] } }; | ||
return { props: { onClose: /*close*/ ctx[28] } }; | ||
} | ||
@@ -460,3 +459,3 @@ | ||
p(ctx, dirty) { | ||
if (dirty[0] & /*state*/ 2 && switch_value !== (switch_value = /*state*/ ctx[1].closeButton)) { | ||
if (dirty[0] & /*closeButton*/ 8 && switch_value !== (switch_value = /*closeButton*/ ctx[3])) { | ||
if (switch_instance) { | ||
@@ -507,5 +506,5 @@ group_outros(); | ||
let dispose; | ||
let if_block = /*Component*/ ctx[2] && create_if_block(ctx); | ||
const default_slot_template = /*#slots*/ ctx[49].default; | ||
const default_slot = create_slot(default_slot_template, ctx, /*$$scope*/ ctx[48], null); | ||
let if_block = /*Component*/ ctx[12] && create_if_block(ctx); | ||
const default_slot_template = /*#slots*/ ctx[48].default; | ||
const default_slot = create_slot(default_slot_template, ctx, /*$$scope*/ ctx[47], null); | ||
@@ -529,3 +528,3 @@ return { | ||
if (!mounted) { | ||
dispose = listen(window_1, "keydown", /*handleKeydown*/ ctx[19]); | ||
dispose = listen(window_1, "keydown", /*handleKeydown*/ ctx[29]); | ||
mounted = true; | ||
@@ -535,7 +534,7 @@ } | ||
p(ctx, dirty) { | ||
if (/*Component*/ ctx[2]) { | ||
if (/*Component*/ ctx[12]) { | ||
if (if_block) { | ||
if_block.p(ctx, dirty); | ||
if (dirty[0] & /*Component*/ 4) { | ||
if (dirty[0] & /*Component*/ 4096) { | ||
transition_in(if_block, 1); | ||
@@ -560,3 +559,3 @@ } | ||
if (default_slot) { | ||
if (default_slot.p && (!current || dirty[1] & /*$$scope*/ 131072)) { | ||
if (default_slot.p && (!current || dirty[1] & /*$$scope*/ 65536)) { | ||
update_slot_base( | ||
@@ -566,6 +565,6 @@ default_slot, | ||
ctx, | ||
/*$$scope*/ ctx[48], | ||
/*$$scope*/ ctx[47], | ||
!current | ||
? get_all_dirty_from_scope(/*$$scope*/ ctx[48]) | ||
: get_slot_changes(default_slot_template, /*$$scope*/ ctx[48], dirty, null), | ||
? get_all_dirty_from_scope(/*$$scope*/ ctx[47]) | ||
: get_slot_changes(default_slot_template, /*$$scope*/ ctx[47], dirty, null), | ||
null | ||
@@ -645,30 +644,2 @@ ); | ||
let { disableFocusTrap = false } = $$props; | ||
const defaultState = { | ||
id, | ||
ariaLabel, | ||
ariaLabelledBy, | ||
closeButton, | ||
closeOnEsc, | ||
closeOnOuterClick, | ||
styleBg, | ||
styleWindowWrap, | ||
styleWindow, | ||
styleContent, | ||
styleCloseButton, | ||
classBg, | ||
classWindowWrap, | ||
classWindow, | ||
classContent, | ||
classCloseButton, | ||
transitionBg, | ||
transitionBgProps, | ||
transitionWindow, | ||
transitionWindowProps, | ||
disableFocusTrap, | ||
isTabbable, | ||
unstyled | ||
}; | ||
let state = { ...defaultState }; | ||
let Component = null; | ||
@@ -699,3 +670,3 @@ let background; | ||
const updateStyleTransition = () => { | ||
$$invalidate(6, cssBg = toCssString(Object.assign( | ||
$$invalidate(16, cssBg = toCssString(Object.assign( | ||
{}, | ||
@@ -706,11 +677,11 @@ { | ||
}, | ||
state.styleBg | ||
styleBg | ||
))); | ||
$$invalidate(7, cssWindowWrap = toCssString(state.styleWindowWrap)); | ||
$$invalidate(8, cssWindow = toCssString(state.styleWindow)); | ||
$$invalidate(9, cssContent = toCssString(state.styleContent)); | ||
$$invalidate(10, cssCloseButton = toCssString(state.styleCloseButton)); | ||
$$invalidate(11, currentTransitionBg = state.transitionBg); | ||
$$invalidate(12, currentTransitionWindow = state.transitionWindow); | ||
$$invalidate(17, cssWindowWrap = toCssString(styleWindowWrap)); | ||
$$invalidate(18, cssWindow = toCssString(styleWindow)); | ||
$$invalidate(19, cssContent = toCssString(styleContent)); | ||
$$invalidate(20, cssCloseButton = toCssString(styleCloseButton)); | ||
$$invalidate(21, currentTransitionBg = transitionBg); | ||
$$invalidate(22, currentTransitionWindow = transitionWindow); | ||
}; | ||
@@ -734,8 +705,25 @@ | ||
const open = (NewComponent, newProps = {}, options = {}, callbacks = {}) => { | ||
$$invalidate(2, Component = bind(NewComponent, newProps)); | ||
$$invalidate(1, state = { ...defaultState, ...options }); | ||
$$invalidate(12, Component = bind(NewComponent, newProps)); | ||
if (options.id != null) $$invalidate(0, id = options.id); | ||
if (options.ariaLabel != null) $$invalidate(1, ariaLabel = options.ariaLabel); | ||
if (options.ariaLabelledBy != null) $$invalidate(2, ariaLabelledBy = options.ariaLabelledBy); | ||
if (options.closeButton != null) $$invalidate(3, closeButton = options.closeButton); | ||
if (options.closeOnEsc != null) $$invalidate(33, closeOnEsc = options.closeOnEsc); | ||
if (options.closeOnOuterClick != null) $$invalidate(34, closeOnOuterClick = options.closeOnOuterClick); | ||
if (options.styleBg != null) $$invalidate(35, styleBg = options.styleBg); | ||
if (options.styleWindowWrap != null) $$invalidate(36, styleWindowWrap = options.styleWindowWrap); | ||
if (options.classWindow != null) $$invalidate(4, classWindow = options.classWindow); | ||
if (options.classContent != null) $$invalidate(5, classContent = options.classContent); | ||
if (options.classCloseButton != null) $$invalidate(6, classCloseButton = options.classCloseButton); | ||
if (options.transitionBg != null) $$invalidate(37, transitionBg = options.transitionBg); | ||
if (options.transitionBgProps != null) $$invalidate(8, transitionBgProps = options.transitionBgProps); | ||
if (options.transitionWindow != null) $$invalidate(38, transitionWindow = options.transitionWindow); | ||
if (options.transitionWindowProps != null) $$invalidate(9, transitionWindowProps = options.transitionWindowProps); | ||
if (options.disableFocusTrap != null) $$invalidate(39, disableFocusTrap = options.disableFocusTrap); | ||
if (options.isTabbable != null) $$invalidate(32, isTabbable = options.isTabbable); | ||
if (options.unstyled != null) $$invalidate(7, unstyled = options.unstyled); | ||
updateStyleTransition(); | ||
disableScroll(); | ||
$$invalidate(13, onOpen = event => { | ||
$$invalidate(23, onOpen = event => { | ||
if (callbacks.onOpen) callbacks.onOpen(event); | ||
@@ -757,3 +745,3 @@ | ||
$$invalidate(14, onClose = event => { | ||
$$invalidate(24, onClose = event => { | ||
if (callbacks.onClose) callbacks.onClose(event); | ||
@@ -775,3 +763,3 @@ | ||
$$invalidate(15, onOpened = event => { | ||
$$invalidate(25, onOpened = event => { | ||
if (callbacks.onOpened) callbacks.onOpened(event); | ||
@@ -786,3 +774,3 @@ | ||
$$invalidate(16, onClosed = event => { | ||
$$invalidate(26, onClosed = event => { | ||
if (callbacks.onClosed) callbacks.onClosed(event); | ||
@@ -806,5 +794,5 @@ | ||
if (!Component) return; | ||
$$invalidate(14, onClose = callbacks.onClose || onClose); | ||
$$invalidate(16, onClosed = callbacks.onClosed || onClosed); | ||
$$invalidate(2, Component = null); | ||
$$invalidate(24, onClose = callbacks.onClose || onClose); | ||
$$invalidate(26, onClosed = callbacks.onClosed || onClosed); | ||
$$invalidate(12, Component = null); | ||
enableScroll(); | ||
@@ -814,3 +802,3 @@ }; | ||
const handleKeydown = event => { | ||
if (state.closeOnEsc && Component && event.key === 'Escape') { | ||
if (closeOnEsc && Component && event.key === 'Escape') { | ||
event.preventDefault(); | ||
@@ -820,7 +808,7 @@ close(); | ||
if (Component && event.key === 'Tab' && !state.disableFocusTrap) { | ||
if (Component && event.key === 'Tab' && !disableFocusTrap) { | ||
// trap focus | ||
const nodes = modalWindow.querySelectorAll('*'); | ||
const tabbable = Array.from(nodes).filter(state.isTabbable).sort((a, b) => a.tabIndex - b.tabIndex); | ||
const tabbable = Array.from(nodes).filter(isTabbable).sort((a, b) => a.tabIndex - b.tabIndex); | ||
let index = tabbable.indexOf(document.activeElement); | ||
@@ -836,7 +824,7 @@ if (index === -1 && event.shiftKey) index = 0; | ||
const handleOuterMousedown = event => { | ||
if (state.closeOnOuterClick && (event.target === background || event.target === wrap)) outerClickTarget = event.target; | ||
if (closeOnOuterClick && (event.target === background || event.target === wrap)) outerClickTarget = event.target; | ||
}; | ||
const handleOuterMouseup = event => { | ||
if (state.closeOnOuterClick && event.target === outerClickTarget) { | ||
if (closeOnOuterClick && event.target === outerClickTarget) { | ||
event.preventDefault(); | ||
@@ -885,3 +873,3 @@ close(); | ||
svelte.onMount(() => { | ||
$$invalidate(47, isMounted = true); | ||
$$invalidate(46, isMounted = true); | ||
}); | ||
@@ -892,3 +880,3 @@ | ||
modalWindow = $$value; | ||
$$invalidate(5, modalWindow); | ||
$$invalidate(15, modalWindow); | ||
}); | ||
@@ -900,3 +888,3 @@ } | ||
wrap = $$value; | ||
$$invalidate(4, wrap); | ||
$$invalidate(14, wrap); | ||
}); | ||
@@ -908,3 +896,3 @@ } | ||
background = $$value; | ||
$$invalidate(3, background); | ||
$$invalidate(13, background); | ||
}); | ||
@@ -914,105 +902,33 @@ } | ||
$$self.$$set = $$props => { | ||
if ('isTabbable' in $$props) $$invalidate(22, isTabbable = $$props.isTabbable); | ||
if ('show' in $$props) $$invalidate(23, show = $$props.show); | ||
if ('id' in $$props) $$invalidate(24, id = $$props.id); | ||
if ('key' in $$props) $$invalidate(25, key = $$props.key); | ||
if ('ariaLabel' in $$props) $$invalidate(26, ariaLabel = $$props.ariaLabel); | ||
if ('ariaLabelledBy' in $$props) $$invalidate(27, ariaLabelledBy = $$props.ariaLabelledBy); | ||
if ('closeButton' in $$props) $$invalidate(28, closeButton = $$props.closeButton); | ||
if ('closeOnEsc' in $$props) $$invalidate(29, closeOnEsc = $$props.closeOnEsc); | ||
if ('closeOnOuterClick' in $$props) $$invalidate(30, closeOnOuterClick = $$props.closeOnOuterClick); | ||
if ('styleBg' in $$props) $$invalidate(31, styleBg = $$props.styleBg); | ||
if ('styleWindowWrap' in $$props) $$invalidate(32, styleWindowWrap = $$props.styleWindowWrap); | ||
if ('styleWindow' in $$props) $$invalidate(33, styleWindow = $$props.styleWindow); | ||
if ('styleContent' in $$props) $$invalidate(34, styleContent = $$props.styleContent); | ||
if ('styleCloseButton' in $$props) $$invalidate(35, styleCloseButton = $$props.styleCloseButton); | ||
if ('classBg' in $$props) $$invalidate(36, classBg = $$props.classBg); | ||
if ('classWindowWrap' in $$props) $$invalidate(37, classWindowWrap = $$props.classWindowWrap); | ||
if ('classWindow' in $$props) $$invalidate(38, classWindow = $$props.classWindow); | ||
if ('classContent' in $$props) $$invalidate(39, classContent = $$props.classContent); | ||
if ('classCloseButton' in $$props) $$invalidate(40, classCloseButton = $$props.classCloseButton); | ||
if ('unstyled' in $$props) $$invalidate(0, unstyled = $$props.unstyled); | ||
if ('setContext' in $$props) $$invalidate(41, setContext = $$props.setContext); | ||
if ('transitionBg' in $$props) $$invalidate(42, transitionBg = $$props.transitionBg); | ||
if ('transitionBgProps' in $$props) $$invalidate(43, transitionBgProps = $$props.transitionBgProps); | ||
if ('transitionWindow' in $$props) $$invalidate(44, transitionWindow = $$props.transitionWindow); | ||
if ('transitionWindowProps' in $$props) $$invalidate(45, transitionWindowProps = $$props.transitionWindowProps); | ||
if ('disableFocusTrap' in $$props) $$invalidate(46, disableFocusTrap = $$props.disableFocusTrap); | ||
if ('$$scope' in $$props) $$invalidate(48, $$scope = $$props.$$scope); | ||
if ('isTabbable' in $$props) $$invalidate(32, isTabbable = $$props.isTabbable); | ||
if ('show' in $$props) $$invalidate(40, show = $$props.show); | ||
if ('id' in $$props) $$invalidate(0, id = $$props.id); | ||
if ('key' in $$props) $$invalidate(41, key = $$props.key); | ||
if ('ariaLabel' in $$props) $$invalidate(1, ariaLabel = $$props.ariaLabel); | ||
if ('ariaLabelledBy' in $$props) $$invalidate(2, ariaLabelledBy = $$props.ariaLabelledBy); | ||
if ('closeButton' in $$props) $$invalidate(3, closeButton = $$props.closeButton); | ||
if ('closeOnEsc' in $$props) $$invalidate(33, closeOnEsc = $$props.closeOnEsc); | ||
if ('closeOnOuterClick' in $$props) $$invalidate(34, closeOnOuterClick = $$props.closeOnOuterClick); | ||
if ('styleBg' in $$props) $$invalidate(35, styleBg = $$props.styleBg); | ||
if ('styleWindowWrap' in $$props) $$invalidate(36, styleWindowWrap = $$props.styleWindowWrap); | ||
if ('styleWindow' in $$props) $$invalidate(42, styleWindow = $$props.styleWindow); | ||
if ('styleContent' in $$props) $$invalidate(43, styleContent = $$props.styleContent); | ||
if ('styleCloseButton' in $$props) $$invalidate(44, styleCloseButton = $$props.styleCloseButton); | ||
if ('classBg' in $$props) $$invalidate(10, classBg = $$props.classBg); | ||
if ('classWindowWrap' in $$props) $$invalidate(11, classWindowWrap = $$props.classWindowWrap); | ||
if ('classWindow' in $$props) $$invalidate(4, classWindow = $$props.classWindow); | ||
if ('classContent' in $$props) $$invalidate(5, classContent = $$props.classContent); | ||
if ('classCloseButton' in $$props) $$invalidate(6, classCloseButton = $$props.classCloseButton); | ||
if ('unstyled' in $$props) $$invalidate(7, unstyled = $$props.unstyled); | ||
if ('setContext' in $$props) $$invalidate(45, setContext = $$props.setContext); | ||
if ('transitionBg' in $$props) $$invalidate(37, transitionBg = $$props.transitionBg); | ||
if ('transitionBgProps' in $$props) $$invalidate(8, transitionBgProps = $$props.transitionBgProps); | ||
if ('transitionWindow' in $$props) $$invalidate(38, transitionWindow = $$props.transitionWindow); | ||
if ('transitionWindowProps' in $$props) $$invalidate(9, transitionWindowProps = $$props.transitionWindowProps); | ||
if ('disableFocusTrap' in $$props) $$invalidate(39, disableFocusTrap = $$props.disableFocusTrap); | ||
if ('$$scope' in $$props) $$invalidate(47, $$scope = $$props.$$scope); | ||
}; | ||
$$self.$$.update = () => { | ||
if ($$self.$$.dirty[0] & /*id*/ 16777216) { | ||
$$invalidate(1, state.id = id, state); | ||
} | ||
if ($$self.$$.dirty[0] & /*ariaLabel*/ 67108864) { | ||
$$invalidate(1, state.ariaLabel = ariaLabel, state); | ||
} | ||
if ($$self.$$.dirty[0] & /*ariaLabelledBy*/ 134217728) { | ||
$$invalidate(1, state.ariaLabelledBy = ariaLabelledBy, state); | ||
} | ||
if ($$self.$$.dirty[0] & /*closeButton*/ 268435456) { | ||
$$invalidate(1, state.closeButton = closeButton, state); | ||
} | ||
if ($$self.$$.dirty[0] & /*closeOnEsc*/ 536870912) { | ||
$$invalidate(1, state.closeOnEsc = closeOnEsc, state); | ||
} | ||
if ($$self.$$.dirty[0] & /*closeOnOuterClick*/ 1073741824) { | ||
$$invalidate(1, state.closeOnOuterClick = closeOnOuterClick, state); | ||
} | ||
if ($$self.$$.dirty[1] & /*styleBg*/ 1) { | ||
$$invalidate(1, state.styleBg = styleBg, state); | ||
} | ||
if ($$self.$$.dirty[1] & /*styleWindowWrap*/ 2) { | ||
$$invalidate(1, state.styleWindowWrap = styleWindowWrap, state); | ||
} | ||
if ($$self.$$.dirty[1] & /*classWindow*/ 128) { | ||
$$invalidate(1, state.classWindow = classWindow, state); | ||
} | ||
if ($$self.$$.dirty[1] & /*classContent*/ 256) { | ||
$$invalidate(1, state.classContent = classContent, state); | ||
} | ||
if ($$self.$$.dirty[1] & /*classCloseButton*/ 512) { | ||
$$invalidate(1, state.classCloseButton = classCloseButton, state); | ||
} | ||
if ($$self.$$.dirty[1] & /*transitionBg*/ 2048) { | ||
$$invalidate(1, state.transitionBg = transitionBg, state); | ||
} | ||
if ($$self.$$.dirty[1] & /*transitionBgProps*/ 4096) { | ||
$$invalidate(1, state.transitionBgProps = transitionBgProps, state); | ||
} | ||
if ($$self.$$.dirty[1] & /*transitionWindow*/ 8192) { | ||
$$invalidate(1, state.transitionWindow = transitionWindow, state); | ||
} | ||
if ($$self.$$.dirty[1] & /*transitionWindowProps*/ 16384) { | ||
$$invalidate(1, state.transitionWindowProps = transitionWindowProps, state); | ||
} | ||
if ($$self.$$.dirty[1] & /*disableFocusTrap*/ 32768) { | ||
$$invalidate(1, state.disableFocusTrap = disableFocusTrap, state); | ||
} | ||
if ($$self.$$.dirty[0] & /*isTabbable*/ 4194304) { | ||
$$invalidate(1, state.isTabbable = isTabbable, state); | ||
} | ||
if ($$self.$$.dirty[0] & /*unstyled*/ 1) { | ||
$$invalidate(1, state.unstyled = unstyled, state); | ||
} | ||
if ($$self.$$.dirty[0] & /*show*/ 8388608 | $$self.$$.dirty[1] & /*isMounted*/ 65536) { | ||
if ($$self.$$.dirty[1] & /*isMounted, show*/ 33280) { | ||
{ | ||
@@ -1031,4 +947,14 @@ if (isMounted) { | ||
return [ | ||
id, | ||
ariaLabel, | ||
ariaLabelledBy, | ||
closeButton, | ||
classWindow, | ||
classContent, | ||
classCloseButton, | ||
unstyled, | ||
state, | ||
transitionBgProps, | ||
transitionWindowProps, | ||
classBg, | ||
classWindowWrap, | ||
Component, | ||
@@ -1055,8 +981,2 @@ background, | ||
isTabbable, | ||
show, | ||
id, | ||
key, | ||
ariaLabel, | ||
ariaLabelledBy, | ||
closeButton, | ||
closeOnEsc, | ||
@@ -1066,16 +986,11 @@ closeOnOuterClick, | ||
styleWindowWrap, | ||
transitionBg, | ||
transitionWindow, | ||
disableFocusTrap, | ||
show, | ||
key, | ||
styleWindow, | ||
styleContent, | ||
styleCloseButton, | ||
classBg, | ||
classWindowWrap, | ||
classWindow, | ||
classContent, | ||
classCloseButton, | ||
setContext, | ||
transitionBg, | ||
transitionBgProps, | ||
transitionWindow, | ||
transitionWindowProps, | ||
disableFocusTrap, | ||
isMounted, | ||
@@ -1101,28 +1016,28 @@ $$scope, | ||
{ | ||
isTabbable: 22, | ||
show: 23, | ||
id: 24, | ||
key: 25, | ||
ariaLabel: 26, | ||
ariaLabelledBy: 27, | ||
closeButton: 28, | ||
closeOnEsc: 29, | ||
closeOnOuterClick: 30, | ||
styleBg: 31, | ||
styleWindowWrap: 32, | ||
styleWindow: 33, | ||
styleContent: 34, | ||
styleCloseButton: 35, | ||
classBg: 36, | ||
classWindowWrap: 37, | ||
classWindow: 38, | ||
classContent: 39, | ||
classCloseButton: 40, | ||
unstyled: 0, | ||
setContext: 41, | ||
transitionBg: 42, | ||
transitionBgProps: 43, | ||
transitionWindow: 44, | ||
transitionWindowProps: 45, | ||
disableFocusTrap: 46 | ||
isTabbable: 32, | ||
show: 40, | ||
id: 0, | ||
key: 41, | ||
ariaLabel: 1, | ||
ariaLabelledBy: 2, | ||
closeButton: 3, | ||
closeOnEsc: 33, | ||
closeOnOuterClick: 34, | ||
styleBg: 35, | ||
styleWindowWrap: 36, | ||
styleWindow: 42, | ||
styleContent: 43, | ||
styleCloseButton: 44, | ||
classBg: 10, | ||
classWindowWrap: 11, | ||
classWindow: 4, | ||
classContent: 5, | ||
classCloseButton: 6, | ||
unstyled: 7, | ||
setContext: 45, | ||
transitionBg: 37, | ||
transitionBgProps: 8, | ||
transitionWindow: 38, | ||
transitionWindowProps: 9, | ||
disableFocusTrap: 39 | ||
}, | ||
@@ -1129,0 +1044,0 @@ add_css, |
{ | ||
"name": "@tarnadas/svelte-simple-modal", | ||
"version": "1.6.2", | ||
"version": "1.6.3", | ||
"description": "A small and simple modal for Svelte", | ||
@@ -5,0 +5,0 @@ "type": "module", |
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
80798
1112