Skip to content

Commit

Permalink
refactor(Juggl): 🎨 Formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
SkepticMystic committed Jan 21, 2022
1 parent f273bd5 commit 238af28
Show file tree
Hide file tree
Showing 2 changed files with 326 additions and 322 deletions.
182 changes: 91 additions & 91 deletions main.js
Original file line number Diff line number Diff line change
Expand Up @@ -24719,86 +24719,6 @@ class TrailPath extends SvelteComponent {
}
}

/* src\Components\JugglButton.svelte generated by Svelte v3.35.0 */

function create_fragment$i(ctx) {
let button;
let t;
let mounted;
let dispose;

return {
c() {
button = element("button");
t = text(/*icon*/ ctx[0]);
attr(button, "type", "button");
attr(button, "class", "juggl-button");
attr(button, "aria-label", /*title*/ ctx[3]);
button.disabled = /*disabled*/ ctx[2];
},
m(target, anchor) {
insert(target, button, anchor);
append(button, t);

if (!mounted) {
dispose = listen(button, "click", function () {
if (is_function(/*onClick*/ ctx[1])) /*onClick*/ ctx[1].apply(this, arguments);
});

mounted = true;
}
},
p(new_ctx, [dirty]) {
ctx = new_ctx;
if (dirty & /*icon*/ 1) set_data(t, /*icon*/ ctx[0]);

if (dirty & /*title*/ 8) {
attr(button, "aria-label", /*title*/ ctx[3]);
}

if (dirty & /*disabled*/ 4) {
button.disabled = /*disabled*/ ctx[2];
}
},
i: noop,
o: noop,
d(detaching) {
if (detaching) detach(button);
mounted = false;
dispose();
}
};
}

function instance$i($$self, $$props, $$invalidate) {
let { icon } = $$props;
let { onClick } = $$props;
let { disabled = false } = $$props;
let { title } = $$props;

$$self.$$set = $$props => {
if ("icon" in $$props) $$invalidate(0, icon = $$props.icon);
if ("onClick" in $$props) $$invalidate(1, onClick = $$props.onClick);
if ("disabled" in $$props) $$invalidate(2, disabled = $$props.disabled);
if ("title" in $$props) $$invalidate(3, title = $$props.title);
};

return [icon, onClick, disabled, title];
}

class JugglButton extends SvelteComponent {
constructor(options) {
super();

init(this, options, instance$i, create_fragment$i, safe_not_equal, {
icon: 0,
onClick: 1,
disabled: 2,
title: 3
});
}
}

/**
* Returns a copy of `index`, doesn't mutate.
* @param {string} index
Expand Down Expand Up @@ -24886,6 +24806,86 @@ async function copyGlobalIndex(plugin) {
await copy(globalIndex);
}

/* src\Components\JugglButton.svelte generated by Svelte v3.35.0 */

function create_fragment$i(ctx) {
let button;
let t;
let mounted;
let dispose;

return {
c() {
button = element("button");
t = text(/*icon*/ ctx[0]);
attr(button, "type", "button");
attr(button, "class", "juggl-button");
attr(button, "aria-label", /*title*/ ctx[3]);
button.disabled = /*disabled*/ ctx[2];
},
m(target, anchor) {
insert(target, button, anchor);
append(button, t);

if (!mounted) {
dispose = listen(button, "click", function () {
if (is_function(/*onClick*/ ctx[1])) /*onClick*/ ctx[1].apply(this, arguments);
});

mounted = true;
}
},
p(new_ctx, [dirty]) {
ctx = new_ctx;
if (dirty & /*icon*/ 1) set_data(t, /*icon*/ ctx[0]);

if (dirty & /*title*/ 8) {
attr(button, "aria-label", /*title*/ ctx[3]);
}

if (dirty & /*disabled*/ 4) {
button.disabled = /*disabled*/ ctx[2];
}
},
i: noop,
o: noop,
d(detaching) {
if (detaching) detach(button);
mounted = false;
dispose();
}
};
}

function instance$i($$self, $$props, $$invalidate) {
let { icon } = $$props;
let { onClick } = $$props;
let { disabled = false } = $$props;
let { title } = $$props;

$$self.$$set = $$props => {
if ("icon" in $$props) $$invalidate(0, icon = $$props.icon);
if ("onClick" in $$props) $$invalidate(1, onClick = $$props.onClick);
if ("disabled" in $$props) $$invalidate(2, disabled = $$props.disabled);
if ("title" in $$props) $$invalidate(3, title = $$props.title);
};

return [icon, onClick, disabled, title];
}

class JugglButton extends SvelteComponent {
constructor(options) {
super();

init(this, options, instance$i, create_fragment$i, safe_not_equal, {
icon: 0,
onClick: 1,
disabled: 2,
title: 3
});
}
}

const STORE_ID = "core";
class BCStoreEvents extends obsidian.Events {
}
Expand Down Expand Up @@ -24987,7 +24987,7 @@ function zoomToSource(juggl, source) {
}
juggl.on("vizReady", (viz) => {
// After layout is done, center on source node
viz.one('layoutstop', e => {
viz.one("layoutstop", (e) => {
const viz = e.cy;
const node = viz.$id(VizId.toId(source + ".md", STORE_ID));
viz.animate({
Expand All @@ -24996,14 +24996,14 @@ function zoomToSource(juggl, source) {
},
duration: 250,
queue: false,
zoom: 1.7
zoom: 1.7,
});
});
});
}
function createJugglTrail(plugin, target, paths, source, args) {
const toolbarDiv = document.createElement('div');
toolbarDiv.addClass('cy-toolbar');
const toolbarDiv = document.createElement("div");
toolbarDiv.addClass("cy-toolbar");
target.appendChild(toolbarDiv);
const sectDiv = document.createElement("div");
sectDiv.addClass("cy-toolbar-section");
Expand All @@ -25024,8 +25024,8 @@ function createJugglTrail(plugin, target, paths, source, args) {
}
},
disabled: false,
title: "Show up graph"
}
title: "Show up graph",
},
});
new JugglButton({
target: sectDiv,
Expand All @@ -25039,9 +25039,9 @@ function createJugglTrail(plugin, target, paths, source, args) {
}
return;
}
const sub = getSubInDirs(plugin.mainG, 'down', 'up');
const sub = getSubInDirs(plugin.mainG, "down", "up");
const closed = getReflexiveClosure(sub, plugin.settings.userHiers);
const subClosed = getSubInDirs(closed, 'down');
const subClosed = getSubInDirs(closed, "down");
const allPaths = dfsAllPaths(subClosed, source);
const index = createIndex(allPaths, false);
const lines = index
Expand All @@ -25054,7 +25054,7 @@ function createJugglTrail(plugin, target, paths, source, args) {
.filter((pair) => pair && pair !== "");
let nodesS = new Set(lines);
nodesS.add(source);
const nodes = Array.from(nodesS).map(s => s + ".md");
const nodes = Array.from(nodesS).map((s) => s + ".md");
console.log({ nodes });
jugglDown = createJuggl(plugin, target, nodes, args);
if (jugglUp) {
Expand All @@ -25063,8 +25063,8 @@ function createJugglTrail(plugin, target, paths, source, args) {
zoomToSource(jugglDown, source);
},
disabled: false,
title: "Show down graph"
}
title: "Show down graph",
},
});
// new JugglButton({
// target: sectDiv,
Expand Down
Loading

0 comments on commit 238af28

Please sign in to comment.