@nodegui/svelte-nodegui
Version:
Svelte integration for NodeGUI
264 lines (223 loc) • 7.21 kB
JavaScript
import { SvelteComponent, init, safe_not_equal, create_slot, update_slot, transition_in, transition_out, assign, exclude_internal_props, binding_callbacks, bind, space, create_component, set_attributes, insert, mount_component, get_spread_update, add_flush_callback, detach, destroy_component } from 'svelte/internal';
/* src/components/SlotComponent.svelte generated by Svelte v3.35.0 */
const get_default_slot_changes$1 = dirty => ({ props: dirty & /*p*/ 1 });
const get_default_slot_context$1 = ctx => ({ props: /*p*/ ctx[0] });
function create_fragment$1(ctx) {
let current;
const default_slot_template = /*#slots*/ ctx[2].default;
const default_slot = create_slot(default_slot_template, ctx, /*$$scope*/ ctx[1], get_default_slot_context$1);
return {
c() {
if (default_slot) default_slot.c();
},
m(target, anchor) {
if (default_slot) {
default_slot.m(target, anchor);
}
current = true;
},
p(ctx, [dirty]) {
if (default_slot) {
if (default_slot.p && dirty & /*$$scope, p*/ 3) {
update_slot(default_slot, default_slot_template, ctx, /*$$scope*/ ctx[1], dirty, get_default_slot_changes$1, get_default_slot_context$1);
}
}
},
i(local) {
if (current) return;
transition_in(default_slot, local);
current = true;
},
o(local) {
transition_out(default_slot, local);
current = false;
},
d(detaching) {
if (default_slot) default_slot.d(detaching);
}
};
}
function instance$2($$self, $$props, $$invalidate) {
let p;
let { $$slots: slots = {}, $$scope } = $$props;
$$self.$$set = $$new_props => {
$$invalidate(3, $$props = assign(assign({}, $$props), exclude_internal_props($$new_props)));
if ("$$scope" in $$new_props) $$invalidate(1, $$scope = $$new_props.$$scope);
};
$$self.$$.update = () => {
$$invalidate(0, p = $$props);
};
$$props = exclude_internal_props($$props);
return [p, $$scope, slots];
}
class SlotComponent extends SvelteComponent {
constructor(options) {
super();
init(this, options, instance$2, create_fragment$1, safe_not_equal, {});
}
}
/* src/components/AsComponent.svelte generated by Svelte v3.35.0 */
function instance$1($$self, $$props, $$invalidate) {
let slots = $$props.$$slots;
let scope = $$props.$$scope;
const component = class extends SlotComponent {
constructor(options) {
//force instances of this component to use our slot content and scope.
let new_options = Object.assign({}, options);
new_options.props = Object.assign({}, options.props, { $$slots: slots, $$scope: scope });
super(new_options);
}
};
$$self.$$set = $$new_props => {
$$invalidate(3, $$props = assign(assign({}, $$props), exclude_internal_props($$new_props)));
};
$$props = exclude_internal_props($$props);
return [component];
}
class AsComponent extends SvelteComponent {
constructor(options) {
super();
init(this, options, instance$1, null, safe_not_equal, { component: 0 });
}
get component() {
return this.$$.ctx[0];
}
}
/* src/components/Template.svelte generated by Svelte v3.35.0 */
const get_default_slot_changes = dirty => ({ item: dirty & /*props*/ 32 });
const get_default_slot_context = ctx => ({
item: /*props*/ ctx[5] ? /*props*/ ctx[5].item : null
});
// (2:0) <AsComponent bind:component="{template}" let:props>
function create_default_slot(ctx) {
let current;
const default_slot_template = /*#slots*/ ctx[2].default;
const default_slot = create_slot(default_slot_template, ctx, /*$$scope*/ ctx[4], get_default_slot_context);
return {
c() {
if (default_slot) default_slot.c();
},
m(target, anchor) {
if (default_slot) {
default_slot.m(target, anchor);
}
current = true;
},
p(ctx, dirty) {
if (default_slot) {
if (default_slot.p && dirty & /*$$scope, props*/ 48) {
update_slot(default_slot, default_slot_template, ctx, /*$$scope*/ ctx[4], dirty, get_default_slot_changes, get_default_slot_context);
}
}
},
i(local) {
if (current) return;
transition_in(default_slot, local);
current = true;
},
o(local) {
transition_out(default_slot, local);
current = false;
},
d(detaching) {
if (default_slot) default_slot.d(detaching);
}
};
}
function create_fragment(ctx) {
let template_1;
let t;
let ascomponent;
let updating_component;
let current;
let template_1_levels = [/*$$props*/ ctx[1], { component: /*template*/ ctx[0] }, { xmlns: "tns" }];
let template_1_data = {};
for (let i = 0; i < template_1_levels.length; i += 1) {
template_1_data = assign(template_1_data, template_1_levels[i]);
}
function ascomponent_component_binding(value) {
/*ascomponent_component_binding*/ ctx[3](value);
}
let ascomponent_props = {
$$slots: {
default: [
create_default_slot,
({ props }) => ({ 5: props }),
({ props }) => props ? 32 : 0
]
},
$$scope: { ctx }
};
if (/*template*/ ctx[0] !== void 0) {
ascomponent_props.component = /*template*/ ctx[0];
}
ascomponent = new AsComponent({ props: ascomponent_props });
binding_callbacks.push(() => bind(ascomponent, "component", ascomponent_component_binding));
return {
c() {
template_1 = document.createElementNS("tns", "template");
t = space();
create_component(ascomponent.$$.fragment);
set_attributes(template_1, template_1_data);
},
m(target, anchor) {
insert(target, template_1, anchor);
insert(target, t, anchor);
mount_component(ascomponent, target, anchor);
current = true;
},
p(ctx, [dirty]) {
set_attributes(template_1, template_1_data = get_spread_update(template_1_levels, [
dirty & /*$$props*/ 2 && /*$$props*/ ctx[1],
(!current || dirty & /*template*/ 1) && { component: /*template*/ ctx[0] },
{ xmlns: "tns" }
]));
const ascomponent_changes = {};
if (dirty & /*$$scope, props*/ 48) {
ascomponent_changes.$$scope = { dirty, ctx };
}
if (!updating_component && dirty & /*template*/ 1) {
updating_component = true;
ascomponent_changes.component = /*template*/ ctx[0];
add_flush_callback(() => updating_component = false);
}
ascomponent.$set(ascomponent_changes);
},
i(local) {
if (current) return;
transition_in(ascomponent.$$.fragment, local);
current = true;
},
o(local) {
transition_out(ascomponent.$$.fragment, local);
current = false;
},
d(detaching) {
if (detaching) detach(template_1);
if (detaching) detach(t);
destroy_component(ascomponent, detaching);
}
};
}
function instance($$self, $$props, $$invalidate) {
let { $$slots: slots = {}, $$scope } = $$props;
let template;
function ascomponent_component_binding(value) {
template = value;
$$invalidate(0, template);
}
$$self.$$set = $$new_props => {
$$invalidate(1, $$props = assign(assign({}, $$props), exclude_internal_props($$new_props)));
if ("$$scope" in $$new_props) $$invalidate(4, $$scope = $$new_props.$$scope);
};
$$props = exclude_internal_props($$props);
return [template, $$props, slots, ascomponent_component_binding, $$scope];
}
class Template extends SvelteComponent {
constructor(options) {
super();
init(this, options, instance, create_fragment, safe_not_equal, {});
}
}
export { Template };
//# sourceMappingURL=index.js.map