@6edesign/svelte-three
Version:
[Demo](https://6edesign.github.io/svelte-three-mograph/)
342 lines (299 loc) • 7.25 kB
JavaScript
import './Index.css.proxy.js';
/* src/documentation/Index.svelte generated by Svelte v3.31.2 */
import {
SvelteComponent,
check_outros,
create_component,
destroy_component,
destroy_each,
detach,
empty,
group_outros,
init,
insert,
mount_component,
safe_not_equal,
space,
transition_in,
transition_out
} from "../../web_modules/svelte/internal.js";
import { Router, Route } from "../../web_modules/@6edesign/svelte-router.js";
import Layout from "./Layout.js";
import Home from "./pages/Home.js";
import Orbit from "./pages/Orbit.js";
import Tree from "./pages/tree/Tree.js";
import { pages } from "./config/index.js";
function get_each_context(ctx, list, i) {
const child_ctx = ctx.slice();
child_ctx[2] = list[i].path;
child_ctx[3] = list[i].component;
return child_ctx;
}
// (13:6) <Route {path}>
function create_default_slot_2(ctx) {
let switch_instance;
let t;
let current;
var switch_value = /*component*/ ctx[3];
function switch_props(ctx) {
return {
props: {
width: /*width*/ ctx[0],
height: /*height*/ ctx[1]
}
};
}
if (switch_value) {
switch_instance = new switch_value(switch_props(ctx));
}
return {
c() {
if (switch_instance) create_component(switch_instance.$$.fragment);
t = space();
},
m(target, anchor) {
if (switch_instance) {
mount_component(switch_instance, target, anchor);
}
insert(target, t, anchor);
current = true;
},
p(ctx, dirty) {
const switch_instance_changes = {};
if (dirty & /*width*/ 1) switch_instance_changes.width = /*width*/ ctx[0];
if (dirty & /*height*/ 2) switch_instance_changes.height = /*height*/ ctx[1];
if (switch_value !== (switch_value = /*component*/ ctx[3])) {
if (switch_instance) {
group_outros();
const old_component = switch_instance;
transition_out(old_component.$$.fragment, 1, 0, () => {
destroy_component(old_component, 1);
});
check_outros();
}
if (switch_value) {
switch_instance = new switch_value(switch_props(ctx));
create_component(switch_instance.$$.fragment);
transition_in(switch_instance.$$.fragment, 1);
mount_component(switch_instance, t.parentNode, t);
} else {
switch_instance = null;
}
} else if (switch_value) {
switch_instance.$set(switch_instance_changes);
}
},
i(local) {
if (current) return;
if (switch_instance) transition_in(switch_instance.$$.fragment, local);
current = true;
},
o(local) {
if (switch_instance) transition_out(switch_instance.$$.fragment, local);
current = false;
},
d(detaching) {
if (switch_instance) destroy_component(switch_instance, detaching);
if (detaching) detach(t);
}
};
}
// (12:4) {#each pages as { path, component }}
function create_each_block(ctx) {
let route;
let current;
route = new Route({
props: {
path: /*path*/ ctx[2],
$$slots: { default: [create_default_slot_2] },
$$scope: { ctx }
}
});
return {
c() {
create_component(route.$$.fragment);
},
m(target, anchor) {
mount_component(route, target, anchor);
current = true;
},
p(ctx, dirty) {
const route_changes = {};
if (dirty & /*$$scope, width, height*/ 67) {
route_changes.$$scope = { dirty, ctx };
}
route.$set(route_changes);
},
i(local) {
if (current) return;
transition_in(route.$$.fragment, local);
current = true;
},
o(local) {
transition_out(route.$$.fragment, local);
current = false;
},
d(detaching) {
destroy_component(route, detaching);
}
};
}
// (11:2) <Router>
function create_default_slot_1(ctx) {
let each_1_anchor;
let current;
let each_value = pages;
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 & /*pages, width, height*/ 3) {
each_value = pages;
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);
}
};
}
// (10:0) <Layout let:width let:height>
function create_default_slot(ctx) {
let router;
let current;
router = new Router({
props: {
$$slots: { default: [create_default_slot_1] },
$$scope: { ctx }
}
});
return {
c() {
create_component(router.$$.fragment);
},
m(target, anchor) {
mount_component(router, target, anchor);
current = true;
},
p(ctx, dirty) {
const router_changes = {};
if (dirty & /*$$scope, width, height*/ 67) {
router_changes.$$scope = { dirty, ctx };
}
router.$set(router_changes);
},
i(local) {
if (current) return;
transition_in(router.$$.fragment, local);
current = true;
},
o(local) {
transition_out(router.$$.fragment, local);
current = false;
},
d(detaching) {
destroy_component(router, detaching);
}
};
}
function create_fragment(ctx) {
let layout;
let current;
layout = new Layout({
props: {
$$slots: {
default: [
create_default_slot,
({ width, height }) => ({ 0: width, 1: height }),
({ width, height }) => (width ? 1 : 0) | (height ? 2 : 0)
]
},
$$scope: { ctx }
}
});
return {
c() {
create_component(layout.$$.fragment);
},
m(target, anchor) {
mount_component(layout, target, anchor);
current = true;
},
p(ctx, [dirty]) {
const layout_changes = {};
if (dirty & /*$$scope, width, height*/ 67) {
layout_changes.$$scope = { dirty, ctx };
}
layout.$set(layout_changes);
},
i(local) {
if (current) return;
transition_in(layout.$$.fragment, local);
current = true;
},
o(local) {
transition_out(layout.$$.fragment, local);
current = false;
},
d(detaching) {
destroy_component(layout, detaching);
}
};
}
class Index extends SvelteComponent {
constructor(options) {
super();
init(this, options, null, create_fragment, safe_not_equal, {});
}
}
export default Index;