Socket
Socket
Sign inDemoInstall

@tarnadas/svelte-simple-modal

Package Overview
Dependencies
21
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.6.1 to 1.6.2

480

lib/index.js

@@ -1,2 +0,2 @@

import { SvelteComponent, init, safe_not_equal as safe_not_equal$1, 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, component_subscribe, 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, set_store_value, binding_callbacks, noop as noop$1 } from 'svelte/internal';
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';
import * as svelte from 'svelte';

@@ -14,81 +14,2 @@ import { createEventDispatcher } from 'svelte';

/** @returns {void} */
function noop() {}
/** @returns {boolean} */
function safe_not_equal(a, b) {
return a != a ? b == b : a !== b || (a && typeof a === 'object') || typeof a === 'function';
}
const subscriber_queue = [];
/**
* Create a `Writable` store that allows both updating and reading by subscription.
*
* https://svelte.dev/docs/svelte-store#writable
* @template T
* @param {T} [value] initial value
* @param {import('./public.js').StartStopNotifier<T>} [start]
* @returns {import('./public.js').Writable<T>}
*/
function writable(value, start = noop) {
/** @type {import('./public.js').Unsubscriber} */
let stop;
/** @type {Set<import('./private.js').SubscribeInvalidateTuple<T>>} */
const subscribers = new Set();
/** @param {T} new_value
* @returns {void}
*/
function set(new_value) {
if (safe_not_equal(value, new_value)) {
value = new_value;
if (stop) {
// store is ready
const run_queue = !subscriber_queue.length;
for (const subscriber of subscribers) {
subscriber[1]();
subscriber_queue.push(subscriber, value);
}
if (run_queue) {
for (let i = 0; i < subscriber_queue.length; i += 2) {
subscriber_queue[i][0](subscriber_queue[i + 1]);
}
subscriber_queue.length = 0;
}
}
}
}
/**
* @param {import('./public.js').Updater<T>} fn
* @returns {void}
*/
function update(fn) {
set(fn(value));
}
/**
* @param {import('./public.js').Subscriber<T>} run
* @param {import('./private.js').Invalidator<T>} [invalidate]
* @returns {import('./public.js').Unsubscriber}
*/
function subscribe(run, invalidate = noop) {
/** @type {import('./private.js').SubscribeInvalidateTuple<T>} */
const subscriber = [run, invalidate];
subscribers.add(subscriber);
if (subscribers.size === 1) {
stop = start(set, update) || noop;
}
run(value);
return () => {
subscribers.delete(subscriber);
if (subscribers.size === 0 && stop) {
stop();
stop = null;
}
};
}
return { set, update, subscribe };
}
/* src/Modal.svelte generated by Svelte v4.0.0 */

@@ -102,3 +23,3 @@

// (470:0) {#if Component}
// (487:0) {#if Component}
function create_if_block(ctx) {

@@ -123,4 +44,4 @@ let div3;

let dispose;
let if_block = /*$state$*/ ctx[16].closeButton && create_if_block_1(ctx);
var switch_value = /*Component*/ ctx[1];
let if_block = /*state*/ ctx[1].closeButton && create_if_block_1(ctx);
var switch_value = /*Component*/ ctx[2];

@@ -144,23 +65,23 @@ function switch_props(ctx) {

if (switch_instance) create_component(switch_instance.$$.fragment);
attr(div0, "class", div0_class_value = "" + (null_to_empty(/*$state$*/ ctx[16].classContent) + " svelte-n7cvum"));
attr(div0, "style", /*cssContent*/ ctx[8]);
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[16].classWindow) + " svelte-n7cvum"));
attr(div1, "class", div1_class_value = "" + (null_to_empty(/*state*/ ctx[1].classWindow) + " svelte-n7cvum"));
attr(div1, "role", "dialog");
attr(div1, "aria-modal", "true");
attr(div1, "aria-label", div1_aria_label_value = /*$state$*/ ctx[16].ariaLabelledBy
attr(div1, "aria-label", div1_aria_label_value = /*state*/ ctx[1].ariaLabelledBy
? null
: /*$state$*/ ctx[16].ariaLabel || null);
: /*state*/ ctx[1].ariaLabel || null);
attr(div1, "aria-labelledby", div1_aria_labelledby_value = /*$state$*/ ctx[16].ariaLabelledBy || null);
attr(div1, "style", /*cssWindow*/ ctx[7]);
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[16].classWindowWrap) + " svelte-n7cvum"));
attr(div2, "style", /*cssWindowWrap*/ ctx[6]);
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(div3, "aria-hidden", "true");
attr(div3, "id", div3_id_value = /*$state$*/ ctx[16].id);
attr(div3, "class", div3_class_value = "" + (null_to_empty(/*$state$*/ ctx[16].classBg) + " svelte-n7cvum"));
attr(div3, "style", /*cssBg*/ ctx[5]);
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]);

@@ -176,5 +97,5 @@ },

if (switch_instance) mount_component(switch_instance, div0, null);
/*div1_binding*/ ctx[51](div1);
/*div2_binding*/ ctx[52](div2);
/*div3_binding*/ ctx[53](div3);
/*div1_binding*/ ctx[50](div1);
/*div2_binding*/ ctx[51](div2);
/*div3_binding*/ ctx[52](div3);
current = true;

@@ -185,15 +106,15 @@

listen(div1, "introstart", function () {
if (is_function(/*onOpen*/ ctx[12])) /*onOpen*/ ctx[12].apply(this, arguments);
if (is_function(/*onOpen*/ ctx[13])) /*onOpen*/ ctx[13].apply(this, arguments);
}),
listen(div1, "outrostart", function () {
if (is_function(/*onClose*/ ctx[13])) /*onClose*/ ctx[13].apply(this, arguments);
if (is_function(/*onClose*/ ctx[14])) /*onClose*/ ctx[14].apply(this, arguments);
}),
listen(div1, "introend", function () {
if (is_function(/*onOpened*/ ctx[14])) /*onOpened*/ ctx[14].apply(this, arguments);
if (is_function(/*onOpened*/ ctx[15])) /*onOpened*/ ctx[15].apply(this, arguments);
}),
listen(div1, "outroend", function () {
if (is_function(/*onClosed*/ ctx[15])) /*onClosed*/ ctx[15].apply(this, arguments);
if (is_function(/*onClosed*/ ctx[16])) /*onClosed*/ ctx[16].apply(this, arguments);
}),
listen(div3, "mousedown", /*handleOuterMousedown*/ ctx[21]),
listen(div3, "mouseup", /*handleOuterMouseup*/ ctx[22])
listen(div3, "mousedown", /*handleOuterMousedown*/ ctx[20]),
listen(div3, "mouseup", /*handleOuterMouseup*/ ctx[21])
];

@@ -207,7 +128,7 @@

if (/*$state$*/ ctx[16].closeButton) {
if (/*state*/ ctx[1].closeButton) {
if (if_block) {
if_block.p(ctx, dirty);
if (dirty[0] & /*$state$*/ 65536) {
if (dirty[0] & /*state*/ 2) {
transition_in(if_block, 1);

@@ -231,3 +152,3 @@ }

if (dirty[0] & /*Component*/ 2 && switch_value !== (switch_value = /*Component*/ ctx[1])) {
if (dirty[0] & /*Component*/ 4 && switch_value !== (switch_value = /*Component*/ ctx[2])) {
if (switch_instance) {

@@ -254,61 +175,61 @@ group_outros();

if (!current || dirty[0] & /*$state$*/ 65536 && div0_class_value !== (div0_class_value = "" + (null_to_empty(/*$state$*/ ctx[16].classContent) + " svelte-n7cvum"))) {
if (!current || dirty[0] & /*state*/ 2 && div0_class_value !== (div0_class_value = "" + (null_to_empty(/*state*/ ctx[1].classContent) + " svelte-n7cvum"))) {
attr(div0, "class", div0_class_value);
}
if (!current || dirty[0] & /*cssContent*/ 256) {
attr(div0, "style", /*cssContent*/ ctx[8]);
if (!current || dirty[0] & /*cssContent*/ 512) {
attr(div0, "style", /*cssContent*/ ctx[9]);
}
if (!current || dirty[0] & /*$state$, unstyled*/ 65537) {
if (!current || dirty[0] & /*state, unstyled*/ 3) {
toggle_class(div0, "content", !/*unstyled*/ ctx[0]);
}
if (!current || dirty[0] & /*$state$*/ 65536 && div1_class_value !== (div1_class_value = "" + (null_to_empty(/*$state$*/ ctx[16].classWindow) + " svelte-n7cvum"))) {
if (!current || dirty[0] & /*state*/ 2 && div1_class_value !== (div1_class_value = "" + (null_to_empty(/*state*/ ctx[1].classWindow) + " svelte-n7cvum"))) {
attr(div1, "class", div1_class_value);
}
if (!current || dirty[0] & /*$state$*/ 65536 && div1_aria_label_value !== (div1_aria_label_value = /*$state$*/ ctx[16].ariaLabelledBy
if (!current || dirty[0] & /*state*/ 2 && div1_aria_label_value !== (div1_aria_label_value = /*state*/ ctx[1].ariaLabelledBy
? null
: /*$state$*/ ctx[16].ariaLabel || null)) {
: /*state*/ ctx[1].ariaLabel || null)) {
attr(div1, "aria-label", div1_aria_label_value);
}
if (!current || dirty[0] & /*$state$*/ 65536 && div1_aria_labelledby_value !== (div1_aria_labelledby_value = /*$state$*/ ctx[16].ariaLabelledBy || null)) {
if (!current || dirty[0] & /*state*/ 2 && div1_aria_labelledby_value !== (div1_aria_labelledby_value = /*state*/ ctx[1].ariaLabelledBy || null)) {
attr(div1, "aria-labelledby", div1_aria_labelledby_value);
}
if (!current || dirty[0] & /*cssWindow*/ 128) {
attr(div1, "style", /*cssWindow*/ ctx[7]);
if (!current || dirty[0] & /*cssWindow*/ 256) {
attr(div1, "style", /*cssWindow*/ ctx[8]);
}
if (!current || dirty[0] & /*$state$, unstyled*/ 65537) {
if (!current || dirty[0] & /*state, unstyled*/ 3) {
toggle_class(div1, "window", !/*unstyled*/ ctx[0]);
}
if (!current || dirty[0] & /*$state$*/ 65536 && div2_class_value !== (div2_class_value = "" + (null_to_empty(/*$state$*/ ctx[16].classWindowWrap) + " svelte-n7cvum"))) {
if (!current || dirty[0] & /*state*/ 2 && div2_class_value !== (div2_class_value = "" + (null_to_empty(/*state*/ ctx[1].classWindowWrap) + " svelte-n7cvum"))) {
attr(div2, "class", div2_class_value);
}
if (!current || dirty[0] & /*cssWindowWrap*/ 64) {
attr(div2, "style", /*cssWindowWrap*/ ctx[6]);
if (!current || dirty[0] & /*cssWindowWrap*/ 128) {
attr(div2, "style", /*cssWindowWrap*/ ctx[7]);
}
if (!current || dirty[0] & /*$state$, unstyled*/ 65537) {
if (!current || dirty[0] & /*state, unstyled*/ 3) {
toggle_class(div2, "wrap", !/*unstyled*/ ctx[0]);
}
if (!current || dirty[0] & /*$state$*/ 65536 && div3_id_value !== (div3_id_value = /*$state$*/ ctx[16].id)) {
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] & /*$state$*/ 65536 && div3_class_value !== (div3_class_value = "" + (null_to_empty(/*$state$*/ ctx[16].classBg) + " svelte-n7cvum"))) {
if (!current || dirty[0] & /*state*/ 2 && div3_class_value !== (div3_class_value = "" + (null_to_empty(/*state*/ ctx[1].classBg) + " svelte-n7cvum"))) {
attr(div3, "class", div3_class_value);
}
if (!current || dirty[0] & /*cssBg*/ 32) {
attr(div3, "style", /*cssBg*/ ctx[5]);
if (!current || dirty[0] & /*cssBg*/ 64) {
attr(div3, "style", /*cssBg*/ ctx[6]);
}
if (!current || dirty[0] & /*$state$, unstyled*/ 65537) {
if (!current || dirty[0] & /*state, unstyled*/ 3) {
toggle_class(div3, "bg", !/*unstyled*/ ctx[0]);

@@ -325,3 +246,3 @@ }

if (!current) return;
if (!div1_transition) div1_transition = create_bidirectional_transition(div1, /*currentTransitionWindow*/ ctx[11], /*$state$*/ ctx[16].transitionWindowProps, true);
if (!div1_transition) div1_transition = create_bidirectional_transition(div1, /*currentTransitionWindow*/ ctx[12], /*state*/ ctx[1].transitionWindowProps, true);
div1_transition.run(1);

@@ -334,3 +255,3 @@ });

if (!current) return;
if (!div3_transition) div3_transition = create_bidirectional_transition(div3, /*currentTransitionBg*/ ctx[10], /*$state$*/ ctx[16].transitionBgProps, true);
if (!div3_transition) div3_transition = create_bidirectional_transition(div3, /*currentTransitionBg*/ ctx[11], /*state*/ ctx[1].transitionBgProps, true);
div3_transition.run(1);

@@ -347,3 +268,3 @@ });

if (local) {
if (!div1_transition) div1_transition = create_bidirectional_transition(div1, /*currentTransitionWindow*/ ctx[11], /*$state$*/ ctx[16].transitionWindowProps, false);
if (!div1_transition) div1_transition = create_bidirectional_transition(div1, /*currentTransitionWindow*/ ctx[12], /*state*/ ctx[1].transitionWindowProps, false);
div1_transition.run(0);

@@ -353,3 +274,3 @@ }

if (local) {
if (!div3_transition) div3_transition = create_bidirectional_transition(div3, /*currentTransitionBg*/ ctx[10], /*$state$*/ ctx[16].transitionBgProps, false);
if (!div3_transition) div3_transition = create_bidirectional_transition(div3, /*currentTransitionBg*/ ctx[11], /*state*/ ctx[1].transitionBgProps, false);
div3_transition.run(0);

@@ -367,6 +288,6 @@ }

if (switch_instance) destroy_component(switch_instance);
/*div1_binding*/ ctx[51](null);
/*div1_binding*/ ctx[50](null);
if (detaching && div1_transition) div1_transition.end();
/*div2_binding*/ ctx[52](null);
/*div3_binding*/ ctx[53](null);
/*div2_binding*/ ctx[51](null);
/*div3_binding*/ ctx[52](null);
if (detaching && div3_transition) div3_transition.end();

@@ -379,3 +300,3 @@ mounted = false;

// (503:8) {#if $state$.closeButton}
// (520:8) {#if state.closeButton}
function create_if_block_1(ctx) {

@@ -391,4 +312,4 @@ let show_if;

function select_block_type(ctx, dirty) {
if (dirty[0] & /*$state$*/ 65536) show_if = null;
if (show_if == null) show_if = !!/*isFunction*/ ctx[18](/*$state$*/ ctx[16].closeButton);
if (dirty[0] & /*state*/ 2) show_if = null;
if (show_if == null) show_if = !!/*isFunction*/ ctx[17](/*state*/ ctx[1].closeButton);
if (show_if) return 0;

@@ -457,3 +378,3 @@ return 1;

// (506:10) {:else}
// (523:10) {:else}
function create_else_block(ctx) {

@@ -468,5 +389,5 @@ let button;

button = element("button");
attr(button, "class", button_class_value = "" + (null_to_empty(/*$state$*/ ctx[16].classCloseButton) + " svelte-n7cvum"));
attr(button, "class", button_class_value = "" + (null_to_empty(/*state*/ ctx[1].classCloseButton) + " svelte-n7cvum"));
attr(button, "aria-label", "Close modal");
attr(button, "style", /*cssCloseButton*/ ctx[9]);
attr(button, "style", /*cssCloseButton*/ ctx[10]);
attr(button, "type", "button");

@@ -479,3 +400,3 @@ toggle_class(button, "close", !/*unstyled*/ ctx[0]);

if (!mounted) {
dispose = listen(button, "click", /*close*/ ctx[19]);
dispose = listen(button, "click", /*close*/ ctx[18]);
mounted = true;

@@ -485,16 +406,16 @@ }

p(ctx, dirty) {
if (dirty[0] & /*$state$*/ 65536 && button_class_value !== (button_class_value = "" + (null_to_empty(/*$state$*/ ctx[16].classCloseButton) + " svelte-n7cvum"))) {
if (dirty[0] & /*state*/ 2 && button_class_value !== (button_class_value = "" + (null_to_empty(/*state*/ ctx[1].classCloseButton) + " svelte-n7cvum"))) {
attr(button, "class", button_class_value);
}
if (dirty[0] & /*cssCloseButton*/ 512) {
attr(button, "style", /*cssCloseButton*/ ctx[9]);
if (dirty[0] & /*cssCloseButton*/ 1024) {
attr(button, "style", /*cssCloseButton*/ ctx[10]);
}
if (dirty[0] & /*$state$, unstyled*/ 65537) {
if (dirty[0] & /*state, unstyled*/ 3) {
toggle_class(button, "close", !/*unstyled*/ ctx[0]);
}
},
i: noop$1,
o: noop$1,
i: noop,
o: noop,
d(detaching) {

@@ -511,3 +432,3 @@ if (detaching) {

// (504:10) {#if isFunction($state$.closeButton)}
// (521:10) {#if isFunction(state.closeButton)}
function create_if_block_2(ctx) {

@@ -517,6 +438,6 @@ let switch_instance;

let current;
var switch_value = /*$state$*/ ctx[16].closeButton;
var switch_value = /*state*/ ctx[1].closeButton;
function switch_props(ctx) {
return { props: { onClose: /*close*/ ctx[19] } };
return { props: { onClose: /*close*/ ctx[18] } };
}

@@ -539,3 +460,3 @@

p(ctx, dirty) {
if (dirty[0] & /*$state$*/ 65536 && switch_value !== (switch_value = /*$state$*/ ctx[16].closeButton)) {
if (dirty[0] & /*state*/ 2 && switch_value !== (switch_value = /*state*/ ctx[1].closeButton)) {
if (switch_instance) {

@@ -586,5 +507,5 @@ group_outros();

let dispose;
let if_block = /*Component*/ ctx[1] && create_if_block(ctx);
const default_slot_template = /*#slots*/ ctx[50].default;
const default_slot = create_slot(default_slot_template, ctx, /*$$scope*/ ctx[49], null);
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);

@@ -608,3 +529,3 @@ return {

if (!mounted) {
dispose = listen(window_1, "keydown", /*handleKeydown*/ ctx[20]);
dispose = listen(window_1, "keydown", /*handleKeydown*/ ctx[19]);
mounted = true;

@@ -614,7 +535,7 @@ }

p(ctx, dirty) {
if (/*Component*/ ctx[1]) {
if (/*Component*/ ctx[2]) {
if (if_block) {
if_block.p(ctx, dirty);
if (dirty[0] & /*Component*/ 2) {
if (dirty[0] & /*Component*/ 4) {
transition_in(if_block, 1);

@@ -639,3 +560,3 @@ }

if (default_slot) {
if (default_slot.p && (!current || dirty[1] & /*$$scope*/ 262144)) {
if (default_slot.p && (!current || dirty[1] & /*$$scope*/ 131072)) {
update_slot_base(

@@ -645,6 +566,6 @@ default_slot,

ctx,
/*$$scope*/ ctx[49],
/*$$scope*/ ctx[48],
!current
? get_all_dirty_from_scope(/*$$scope*/ ctx[49])
: get_slot_changes(default_slot_template, /*$$scope*/ ctx[49], dirty, null),
? get_all_dirty_from_scope(/*$$scope*/ ctx[48])
: get_slot_changes(default_slot_template, /*$$scope*/ ctx[48], dirty, null),
null

@@ -689,3 +610,2 @@ );

function instance($$self, $$props, $$invalidate) {
let $state$;
let { $$slots: slots = {}, $$scope } = $$props;

@@ -753,4 +673,3 @@ const dispatch = createEventDispatcher();

const state$ = writable({ ...defaultState });
component_subscribe($$self, state$, value => $$invalidate(16, $state$ = value));
let state = { ...defaultState };
let Component = null;

@@ -781,3 +700,3 @@ let background;

const updateStyleTransition = () => {
$$invalidate(5, cssBg = toCssString(Object.assign(
$$invalidate(6, cssBg = toCssString(Object.assign(
{},

@@ -788,11 +707,11 @@ {

},
$state$.styleBg
state.styleBg
)));
$$invalidate(6, cssWindowWrap = toCssString($state$.styleWindowWrap));
$$invalidate(7, cssWindow = toCssString($state$.styleWindow));
$$invalidate(8, cssContent = toCssString($state$.styleContent));
$$invalidate(9, cssCloseButton = toCssString($state$.styleCloseButton));
$$invalidate(10, currentTransitionBg = $state$.transitionBg);
$$invalidate(11, currentTransitionWindow = $state$.transitionWindow);
$$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);
};

@@ -816,8 +735,8 @@

const open = (NewComponent, newProps = {}, options = {}, callbacks = {}) => {
$$invalidate(1, Component = bind(NewComponent, newProps));
set_store_value(state$, $state$ = { ...defaultState, ...options }, $state$);
$$invalidate(2, Component = bind(NewComponent, newProps));
$$invalidate(1, state = { ...defaultState, ...options });
updateStyleTransition();
disableScroll();
$$invalidate(12, onOpen = event => {
$$invalidate(13, onOpen = event => {
if (callbacks.onOpen) callbacks.onOpen(event);

@@ -839,3 +758,3 @@

$$invalidate(13, onClose = event => {
$$invalidate(14, onClose = event => {
if (callbacks.onClose) callbacks.onClose(event);

@@ -857,3 +776,3 @@

$$invalidate(14, onOpened = event => {
$$invalidate(15, onOpened = event => {
if (callbacks.onOpened) callbacks.onOpened(event);

@@ -868,3 +787,3 @@

$$invalidate(15, onClosed = event => {
$$invalidate(16, onClosed = event => {
if (callbacks.onClosed) callbacks.onClosed(event);

@@ -888,5 +807,5 @@

if (!Component) return;
$$invalidate(13, onClose = callbacks.onClose || onClose);
$$invalidate(15, onClosed = callbacks.onClosed || onClosed);
$$invalidate(1, Component = null);
$$invalidate(14, onClose = callbacks.onClose || onClose);
$$invalidate(16, onClosed = callbacks.onClosed || onClosed);
$$invalidate(2, Component = null);
enableScroll();

@@ -896,3 +815,3 @@ };

const handleKeydown = event => {
if ($state$.closeOnEsc && Component && event.key === 'Escape') {
if (state.closeOnEsc && Component && event.key === 'Escape') {
event.preventDefault();

@@ -902,7 +821,7 @@ close();

if (Component && event.key === 'Tab' && !$state$.disableFocusTrap) {
if (Component && event.key === 'Tab' && !state.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(state.isTabbable).sort((a, b) => a.tabIndex - b.tabIndex);
let index = tabbable.indexOf(document.activeElement);

@@ -918,7 +837,7 @@ if (index === -1 && event.shiftKey) index = 0;

const handleOuterMousedown = event => {
if ($state$.closeOnOuterClick && (event.target === background || event.target === wrap)) outerClickTarget = event.target;
if (state.closeOnOuterClick && (event.target === background || event.target === wrap)) outerClickTarget = event.target;
};
const handleOuterMouseup = event => {
if ($state$.closeOnOuterClick && event.target === outerClickTarget) {
if (state.closeOnOuterClick && event.target === outerClickTarget) {
event.preventDefault();

@@ -967,3 +886,3 @@ close();

svelte.onMount(() => {
$$invalidate(48, isMounted = true);
$$invalidate(47, isMounted = true);
});

@@ -974,3 +893,3 @@

modalWindow = $$value;
$$invalidate(4, modalWindow);
$$invalidate(5, modalWindow);
});

@@ -982,3 +901,3 @@ }

wrap = $$value;
$$invalidate(3, wrap);
$$invalidate(4, wrap);
});

@@ -990,3 +909,3 @@ }

background = $$value;
$$invalidate(2, background);
$$invalidate(3, background);
});

@@ -996,33 +915,105 @@ }

$$self.$$set = $$props => {
if ('isTabbable' in $$props) $$invalidate(23, isTabbable = $$props.isTabbable);
if ('show' in $$props) $$invalidate(24, show = $$props.show);
if ('id' in $$props) $$invalidate(25, id = $$props.id);
if ('key' in $$props) $$invalidate(26, key = $$props.key);
if ('ariaLabel' in $$props) $$invalidate(27, ariaLabel = $$props.ariaLabel);
if ('ariaLabelledBy' in $$props) $$invalidate(28, ariaLabelledBy = $$props.ariaLabelledBy);
if ('closeButton' in $$props) $$invalidate(29, closeButton = $$props.closeButton);
if ('closeOnEsc' in $$props) $$invalidate(30, closeOnEsc = $$props.closeOnEsc);
if ('closeOnOuterClick' in $$props) $$invalidate(31, closeOnOuterClick = $$props.closeOnOuterClick);
if ('styleBg' in $$props) $$invalidate(32, styleBg = $$props.styleBg);
if ('styleWindowWrap' in $$props) $$invalidate(33, styleWindowWrap = $$props.styleWindowWrap);
if ('styleWindow' in $$props) $$invalidate(34, styleWindow = $$props.styleWindow);
if ('styleContent' in $$props) $$invalidate(35, styleContent = $$props.styleContent);
if ('styleCloseButton' in $$props) $$invalidate(36, styleCloseButton = $$props.styleCloseButton);
if ('classBg' in $$props) $$invalidate(37, classBg = $$props.classBg);
if ('classWindowWrap' in $$props) $$invalidate(38, classWindowWrap = $$props.classWindowWrap);
if ('classWindow' in $$props) $$invalidate(39, classWindow = $$props.classWindow);
if ('classContent' in $$props) $$invalidate(40, classContent = $$props.classContent);
if ('classCloseButton' in $$props) $$invalidate(41, classCloseButton = $$props.classCloseButton);
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(42, setContext = $$props.setContext);
if ('transitionBg' in $$props) $$invalidate(43, transitionBg = $$props.transitionBg);
if ('transitionBgProps' in $$props) $$invalidate(44, transitionBgProps = $$props.transitionBgProps);
if ('transitionWindow' in $$props) $$invalidate(45, transitionWindow = $$props.transitionWindow);
if ('transitionWindowProps' in $$props) $$invalidate(46, transitionWindowProps = $$props.transitionWindowProps);
if ('disableFocusTrap' in $$props) $$invalidate(47, disableFocusTrap = $$props.disableFocusTrap);
if ('$$scope' in $$props) $$invalidate(49, $$scope = $$props.$$scope);
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);
};
$$self.$$.update = () => {
if ($$self.$$.dirty[0] & /*show*/ 16777216 | $$self.$$.dirty[1] & /*isMounted*/ 131072) {
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) {
{

@@ -1042,2 +1033,3 @@ if (isMounted) {

unstyled,
state,
Component,

@@ -1058,4 +1050,2 @@ background,

onClosed,
$state$,
state$,
isFunction,

@@ -1109,30 +1099,30 @@ close,

create_fragment,
safe_not_equal$1,
safe_not_equal,
{
isTabbable: 23,
show: 24,
id: 25,
key: 26,
ariaLabel: 27,
ariaLabelledBy: 28,
closeButton: 29,
closeOnEsc: 30,
closeOnOuterClick: 31,
styleBg: 32,
styleWindowWrap: 33,
styleWindow: 34,
styleContent: 35,
styleCloseButton: 36,
classBg: 37,
classWindowWrap: 38,
classWindow: 39,
classContent: 40,
classCloseButton: 41,
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: 42,
transitionBg: 43,
transitionBgProps: 44,
transitionWindow: 45,
transitionWindowProps: 46,
disableFocusTrap: 47
setContext: 41,
transitionBg: 42,
transitionBgProps: 43,
transitionWindow: 44,
transitionWindowProps: 45,
disableFocusTrap: 46
},

@@ -1139,0 +1129,0 @@ add_css,

{
"name": "@tarnadas/svelte-simple-modal",
"version": "1.6.1",
"version": "1.6.2",
"description": "A small and simple modal for Svelte",

@@ -5,0 +5,0 @@ "type": "module",

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc