@responsive-ui/tab
Advanced tools
Comparing version 0.2.5 to 0.2.6
247
lib/index.js
@@ -65,2 +65,9 @@ var app = (function () { | ||
} | ||
function compute_slots(slots) { | ||
const result = {}; | ||
for (const key in slots) { | ||
result[key] = true; | ||
} | ||
return result; | ||
} | ||
@@ -355,16 +362,23 @@ function append(target, node) { | ||
/* packages/tab/src/Tab.svelte generated by Svelte v3.31.0 */ | ||
function get_each_context(ctx, list, i) { | ||
const child_ctx = ctx.slice(); | ||
child_ctx[12] = list[i]; | ||
return child_ctx; | ||
} | ||
const get_default_slot_changes = dirty => ({ selected: dirty & /*selected*/ 1 }); | ||
const get_default_slot_context = ctx => ({ selected: /*selected*/ ctx[0] }); | ||
function get_each_context(ctx, list, i) { | ||
function get_each_context_1(ctx, list, i) { | ||
const child_ctx = ctx.slice(); | ||
child_ctx[10] = list[i]; | ||
child_ctx[12] = i; | ||
child_ctx[12] = list[i]; | ||
child_ctx[16] = i; | ||
return child_ctx; | ||
} | ||
// (51:4) {#each items as item, i} | ||
function create_each_block(ctx) { | ||
// (52:4) {#each items as item, i} | ||
function create_each_block_1(ctx) { | ||
let span; | ||
let t0_value = /*item*/ ctx[10].title + ""; | ||
let t0_value = /*item*/ ctx[12].title + ""; | ||
let t0; | ||
@@ -376,3 +390,3 @@ let t1; | ||
function click_handler(...args) { | ||
return /*click_handler*/ ctx[7](/*i*/ ctx[12], ...args); | ||
return /*click_handler*/ ctx[8](/*i*/ ctx[16], ...args); | ||
} | ||
@@ -386,3 +400,3 @@ | ||
attr(span, "class", "responsive-ui-tab__item svelte-1ao7vw7"); | ||
toggle_class(span, "responsive-ui-tab__item--selected", /*selected*/ ctx[0] == /*i*/ ctx[12]); | ||
toggle_class(span, "responsive-ui-tab__item--selected", /*selected*/ ctx[0] == /*i*/ ctx[16]); | ||
}, | ||
@@ -401,6 +415,6 @@ m(target, anchor) { | ||
ctx = new_ctx; | ||
if (dirty & /*items*/ 2 && t0_value !== (t0_value = /*item*/ ctx[10].title + "")) set_data(t0, t0_value); | ||
if (dirty & /*items*/ 2 && t0_value !== (t0_value = /*item*/ ctx[12].title + "")) set_data(t0, t0_value); | ||
if (dirty & /*selected*/ 1) { | ||
toggle_class(span, "responsive-ui-tab__item--selected", /*selected*/ ctx[0] == /*i*/ ctx[12]); | ||
toggle_class(span, "responsive-ui-tab__item--selected", /*selected*/ ctx[0] == /*i*/ ctx[16]); | ||
} | ||
@@ -416,10 +430,94 @@ }, | ||
// (64:0) {:else} | ||
// (66:0) {:else} | ||
function create_else_block(ctx) { | ||
let each_1_anchor; | ||
let current; | ||
const default_slot_template = /*#slots*/ ctx[6].default; | ||
const default_slot = create_slot(default_slot_template, ctx, /*$$scope*/ ctx[5], get_default_slot_context); | ||
let each_value = /*items*/ ctx[1]; | ||
let each_blocks = []; | ||
for (let i = 0; i < each_value.length; i += 1) { | ||
each_blocks[i] = create_each_block(get_each_context(ctx, each_value, i)); | ||
} | ||
const out = i => transition_out(each_blocks[i], 1, 1, () => { | ||
each_blocks[i] = null; | ||
}); | ||
return { | ||
c() { | ||
for (let i = 0; i < each_blocks.length; i += 1) { | ||
each_blocks[i].c(); | ||
} | ||
each_1_anchor = empty(); | ||
}, | ||
m(target, anchor) { | ||
for (let i = 0; i < each_blocks.length; i += 1) { | ||
each_blocks[i].m(target, anchor); | ||
} | ||
insert(target, each_1_anchor, anchor); | ||
current = true; | ||
}, | ||
p(ctx, dirty) { | ||
if (dirty & /*items*/ 2) { | ||
each_value = /*items*/ ctx[1]; | ||
let i; | ||
for (i = 0; i < each_value.length; i += 1) { | ||
const child_ctx = get_each_context(ctx, each_value, i); | ||
if (each_blocks[i]) { | ||
each_blocks[i].p(child_ctx, dirty); | ||
transition_in(each_blocks[i], 1); | ||
} else { | ||
each_blocks[i] = create_each_block(child_ctx); | ||
each_blocks[i].c(); | ||
transition_in(each_blocks[i], 1); | ||
each_blocks[i].m(each_1_anchor.parentNode, each_1_anchor); | ||
} | ||
} | ||
group_outros(); | ||
for (i = each_value.length; i < each_blocks.length; i += 1) { | ||
out(i); | ||
} | ||
check_outros(); | ||
} | ||
}, | ||
i(local) { | ||
if (current) return; | ||
for (let i = 0; i < each_value.length; i += 1) { | ||
transition_in(each_blocks[i]); | ||
} | ||
current = true; | ||
}, | ||
o(local) { | ||
each_blocks = each_blocks.filter(Boolean); | ||
for (let i = 0; i < each_blocks.length; i += 1) { | ||
transition_out(each_blocks[i]); | ||
} | ||
current = false; | ||
}, | ||
d(detaching) { | ||
destroy_each(each_blocks, detaching); | ||
if (detaching) detach(each_1_anchor); | ||
} | ||
}; | ||
} | ||
// (64:0) {#if hasSlots} | ||
function create_if_block(ctx) { | ||
let current; | ||
const default_slot_template = /*#slots*/ ctx[7].default; | ||
const default_slot = create_slot(default_slot_template, ctx, /*$$scope*/ ctx[6], get_default_slot_context); | ||
return { | ||
c() { | ||
if (default_slot) default_slot.c(); | ||
@@ -436,4 +534,4 @@ }, | ||
if (default_slot) { | ||
if (default_slot.p && dirty & /*$$scope, selected*/ 33) { | ||
update_slot(default_slot, default_slot_template, ctx, /*$$scope*/ ctx[5], dirty, get_default_slot_changes, get_default_slot_context); | ||
if (default_slot.p && dirty & /*$$scope, selected*/ 65) { | ||
update_slot(default_slot, default_slot_template, ctx, /*$$scope*/ ctx[6], dirty, get_default_slot_changes, get_default_slot_context); | ||
} | ||
@@ -457,8 +555,8 @@ } | ||
// (62:0) {#if items[selected] && items[selected].component} | ||
function create_if_block(ctx) { | ||
// (68:4) {#if item && item.component} | ||
function create_if_block_1(ctx) { | ||
let switch_instance; | ||
let switch_instance_anchor; | ||
let current; | ||
var switch_value = /*items*/ ctx[1][/*selected*/ ctx[0]].component; | ||
var switch_value = /*item*/ ctx[12].component; | ||
@@ -487,3 +585,3 @@ function switch_props(ctx) { | ||
p(ctx, dirty) { | ||
if (switch_value !== (switch_value = /*items*/ ctx[1][/*selected*/ ctx[0]].component)) { | ||
if (switch_value !== (switch_value = /*item*/ ctx[12].component)) { | ||
if (switch_instance) { | ||
@@ -526,2 +624,58 @@ group_outros(); | ||
// (67:2) {#each items as item} | ||
function create_each_block(ctx) { | ||
let if_block_anchor; | ||
let current; | ||
let if_block = /*item*/ ctx[12] && /*item*/ ctx[12].component && create_if_block_1(ctx); | ||
return { | ||
c() { | ||
if (if_block) if_block.c(); | ||
if_block_anchor = empty(); | ||
}, | ||
m(target, anchor) { | ||
if (if_block) if_block.m(target, anchor); | ||
insert(target, if_block_anchor, anchor); | ||
current = true; | ||
}, | ||
p(ctx, dirty) { | ||
if (/*item*/ ctx[12] && /*item*/ ctx[12].component) { | ||
if (if_block) { | ||
if_block.p(ctx, dirty); | ||
if (dirty & /*items*/ 2) { | ||
transition_in(if_block, 1); | ||
} | ||
} else { | ||
if_block = create_if_block_1(ctx); | ||
if_block.c(); | ||
transition_in(if_block, 1); | ||
if_block.m(if_block_anchor.parentNode, if_block_anchor); | ||
} | ||
} else if (if_block) { | ||
group_outros(); | ||
transition_out(if_block, 1, 1, () => { | ||
if_block = null; | ||
}); | ||
check_outros(); | ||
} | ||
}, | ||
i(local) { | ||
if (current) return; | ||
transition_in(if_block); | ||
current = true; | ||
}, | ||
o(local) { | ||
transition_out(if_block); | ||
current = false; | ||
}, | ||
d(detaching) { | ||
if (if_block) if_block.d(detaching); | ||
if (detaching) detach(if_block_anchor); | ||
} | ||
}; | ||
} | ||
function create_fragment(ctx) { | ||
@@ -537,7 +691,7 @@ let div1; | ||
let current; | ||
let each_value = /*items*/ ctx[1]; | ||
let each_value_1 = /*items*/ ctx[1]; | ||
let each_blocks = []; | ||
for (let i = 0; i < each_value.length; i += 1) { | ||
each_blocks[i] = create_each_block(get_each_context(ctx, each_value, i)); | ||
for (let i = 0; i < each_value_1.length; i += 1) { | ||
each_blocks[i] = create_each_block_1(get_each_context_1(ctx, each_value_1, i)); | ||
} | ||
@@ -549,3 +703,3 @@ | ||
function select_block_type(ctx, dirty) { | ||
if (/*items*/ ctx[1][/*selected*/ ctx[0]] && /*items*/ ctx[1][/*selected*/ ctx[0]].component) return 0; | ||
if (/*hasSlots*/ ctx[4]) return 0; | ||
return 1; | ||
@@ -584,3 +738,3 @@ } | ||
/*nav_binding*/ ctx[8](nav); | ||
/*nav_binding*/ ctx[9](nav); | ||
append(div1, t0); | ||
@@ -594,8 +748,8 @@ append(div1, div0); | ||
p(ctx, [dirty]) { | ||
if (dirty & /*selected, onChange, items*/ 19) { | ||
each_value = /*items*/ ctx[1]; | ||
if (dirty & /*selected, onChange, items*/ 35) { | ||
each_value_1 = /*items*/ ctx[1]; | ||
let i; | ||
for (i = 0; i < each_value.length; i += 1) { | ||
const child_ctx = get_each_context(ctx, each_value, i); | ||
for (i = 0; i < each_value_1.length; i += 1) { | ||
const child_ctx = get_each_context_1(ctx, each_value_1, i); | ||
@@ -605,3 +759,3 @@ if (each_blocks[i]) { | ||
} else { | ||
each_blocks[i] = create_each_block(child_ctx); | ||
each_blocks[i] = create_each_block_1(child_ctx); | ||
each_blocks[i].c(); | ||
@@ -616,3 +770,3 @@ each_blocks[i].m(nav, null); | ||
each_blocks.length = each_value.length; | ||
each_blocks.length = each_value_1.length; | ||
} | ||
@@ -624,27 +778,3 @@ | ||
let previous_block_index = current_block_type_index; | ||
current_block_type_index = select_block_type(ctx); | ||
if (current_block_type_index === previous_block_index) { | ||
if_blocks[current_block_type_index].p(ctx, dirty); | ||
} else { | ||
group_outros(); | ||
transition_out(if_blocks[previous_block_index], 1, 1, () => { | ||
if_blocks[previous_block_index] = null; | ||
}); | ||
check_outros(); | ||
if_block = if_blocks[current_block_type_index]; | ||
if (!if_block) { | ||
if_block = if_blocks[current_block_type_index] = if_block_creators[current_block_type_index](ctx); | ||
if_block.c(); | ||
} else { | ||
if_block.p(ctx, dirty); | ||
} | ||
transition_in(if_block, 1); | ||
if_block.m(if_block_anchor.parentNode, if_block_anchor); | ||
} | ||
if_block.p(ctx, dirty); | ||
}, | ||
@@ -663,3 +793,3 @@ i(local) { | ||
destroy_each(each_blocks, detaching); | ||
/*nav_binding*/ ctx[8](null); | ||
/*nav_binding*/ ctx[9](null); | ||
if (detaching) detach(t1); | ||
@@ -674,2 +804,3 @@ if_blocks[current_block_type_index].d(detaching); | ||
let { $$slots: slots = {}, $$scope } = $$props; | ||
const $$slots = compute_slots(slots); | ||
@@ -679,2 +810,3 @@ let { items = [] } = $$props; | ||
let { style = "" } = $$props; | ||
const hasSlots = !!$$slots.default; | ||
let tab; | ||
@@ -709,3 +841,3 @@ let childNodes; | ||
if ("style" in $$props) $$invalidate(2, style = $$props.style); | ||
if ("$$scope" in $$props) $$invalidate(5, $$scope = $$props.$$scope); | ||
if ("$$scope" in $$props) $$invalidate(6, $$scope = $$props.$$scope); | ||
}; | ||
@@ -718,2 +850,3 @@ | ||
tab, | ||
hasSlots, | ||
onChange, | ||
@@ -720,0 +853,0 @@ $$scope, |
{ | ||
"name": "@responsive-ui/tab", | ||
"version": "0.2.5", | ||
"version": "0.2.6", | ||
"description": "> TODO: description", | ||
@@ -38,3 +38,3 @@ "author": "Si3nLoong <sianloong90@gmail.com>", | ||
}, | ||
"gitHead": "1938b10388f032d0cd686ec4e2138aaf8a11dc46" | ||
"gitHead": "660a3420484ad762dfadd14be9d3e4de1de6878b" | ||
} |
Sorry, the diff of this file is not supported yet
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
73964
2339