svelte-body
Advanced tools
Comparing version
@@ -8,8 +8,2 @@ (function (global, factory) { | ||
function noop() { } | ||
function assign(tar, src) { | ||
// @ts-ignore | ||
for (const k in src) | ||
tar[k] = src[k]; | ||
return tar; | ||
} | ||
function run(fn) { | ||
@@ -45,9 +39,2 @@ return fn(); | ||
} | ||
function exclude_internal_props(props) { | ||
const result = {}; | ||
for (const k in props) | ||
if (k[0] !== '$') | ||
result[k] = props[k]; | ||
return result; | ||
} | ||
function action_destroyer(action_result) { | ||
@@ -381,2 +368,3 @@ return action_result && is_function(action_result.destroy) ? action_result.destroy : noop; | ||
function create_fragment(ctx) { | ||
let classList_action; | ||
let styleAction_action; | ||
@@ -391,4 +379,4 @@ let mounted; | ||
dispose = [ | ||
action_destroyer(classList.call(null, document.body, /*classes*/ ctx[1])), | ||
action_destroyer(styleAction_action = style.call(null, document.body, /*style*/ ctx[0])) | ||
action_destroyer(classList_action = classList.call(null, document.body, /*classes*/ ctx[0])), | ||
action_destroyer(styleAction_action = style.call(null, document.body, /*style*/ ctx[1])) | ||
]; | ||
@@ -400,3 +388,4 @@ | ||
p(ctx, [dirty]) { | ||
if (styleAction_action && is_function(styleAction_action.update) && dirty & /*style*/ 1) styleAction_action.update.call(null, /*style*/ ctx[0]); | ||
if (classList_action && is_function(classList_action.update) && dirty & /*classes*/ 1) classList_action.update.call(null, /*classes*/ ctx[0]); | ||
if (styleAction_action && is_function(styleAction_action.update) && dirty & /*style*/ 2) styleAction_action.update.call(null, /*style*/ ctx[1]); | ||
}, | ||
@@ -413,14 +402,11 @@ i: noop, | ||
function instance($$self, $$props, $$invalidate) { | ||
let { class: classes = '' } = $$props; | ||
let { style } = $$props; | ||
// Get around not being able to use class reserved word | ||
const classes = $$props?.class || ''; | ||
$$self.$$set = $$new_props => { | ||
$$invalidate(2, $$props = assign(assign({}, $$props), exclude_internal_props($$new_props))); | ||
if ('style' in $$new_props) $$invalidate(0, style = $$new_props.style); | ||
$$self.$$set = $$props => { | ||
if ('class' in $$props) $$invalidate(0, classes = $$props.class); | ||
if ('style' in $$props) $$invalidate(1, style = $$props.style); | ||
}; | ||
$$props = exclude_internal_props($$props); | ||
return [style, classes]; | ||
return [classes, style]; | ||
} | ||
@@ -431,3 +417,3 @@ | ||
super(); | ||
init(this, options, instance, create_fragment, safe_not_equal, { style: 0 }); | ||
init(this, options, instance, create_fragment, safe_not_equal, { class: 0, style: 1 }); | ||
} | ||
@@ -434,0 +420,0 @@ } |
{ | ||
"name": "svelte-body", | ||
"version": "1.1.2", | ||
"version": "1.1.3", | ||
"description": "Apply styles to the body in routes! Designed to work with Svelte Kit and Routify.", | ||
@@ -5,0 +5,0 @@ "main": "./dist/index.js", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
31629
-1.72%845
-2.99%