Skip to content

Commit

Permalink
feat: Improved some constants, depth 0 for juggl
Browse files Browse the repository at this point in the history
  • Loading branch information
HEmile committed Jan 14, 2022
1 parent d62b915 commit 90408d0
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 23 deletions.
5 changes: 5 additions & 0 deletions src/Visualisations/CBJuggl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ export function createdJugglCB(plugin: BCPlugin,
args: ParsedCodeblock,
lines: [string, string][],
froms: string[],
source: string,
min: number,
max: number) {
try {
Expand All @@ -138,13 +139,17 @@ export function createdJugglCB(plugin: BCPlugin,
const nodes = lines
.filter(([indent, node]) => meetsConditions(indent, node, froms, min, max))
.map(([_, node]) => node + ".md");
if (min <= 0) {
nodes.push(source + ".md");
}

const bcStore = new BCStore(plugin.mainG, plugin.app.metadataCache, jugglPlugin);
const stores: IJugglStores = {
coreStore: bcStore,
dataStores: [bcStore]
}

console.log({args});
const juggl = jugglPlugin.createJuggl(target, args, stores, nodes)
plugin.addChild(juggl);
juggl.load();
Expand Down
38 changes: 19 additions & 19 deletions src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,25 +65,25 @@ export const CODEBLOCK_FIELDS = [

export const JUGGL_CB_DEFAULTS: IJugglSettings = {
autoAddNodes: false,
autoExpand: false,
autoZoom: false,
coreStore: "core",
expandInitial: false,
fdgdLayout: 'cola',
filter: '',
height: '650px',
hoverEdges: false,
layout: 'force-directed',
limit: 250,
mergeEdges: true,
metaKeyHover: true,
mode: 'workspace',
navigator: true,
openWithShift: false,
styleGroups: [],
toolbar: true,
width: '100%',
zoomSpeed: 1,
autoExpand: false,
autoZoom: false,
coreStore: "core",
expandInitial: false,
fdgdLayout: 'd3-force',
filter: '',
height: '750px',
hoverEdges: false,
layout: 'force-directed',
limit: 250,
mergeEdges: true,
metaKeyHover: true,
mode: 'workspace',
navigator: true,
openWithShift: false,
styleGroups: [],
toolbar: true,
width: '100%',
zoomSpeed: 1,
};
CODEBLOCK_FIELDS.push(...Object.keys(JUGGL_CB_DEFAULTS));

Expand Down
16 changes: 12 additions & 4 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -606,7 +606,7 @@ export default class BCPlugin extends Plugin {
el.innerHTML = err;
return;
}
let min = 1,
let min = 0,
max = Infinity;
let {depth, dir, from, implied, flat} = parsedSource;
if (depth !== undefined) {
Expand Down Expand Up @@ -673,7 +673,7 @@ export default class BCPlugin extends Plugin {
});
break;
case "juggl":
createdJugglCB(this, el, parsedSource, lines, froms, min, max);
createdJugglCB(this, el, parsedSource, lines, froms, basename, min, max);
break;
}
}
Expand All @@ -688,8 +688,16 @@ export default class BCPlugin extends Plugin {
?.split(":")?.[1]
?.trim();

const results: { [field in CodeblockFields]: string | string[] } = {};
CODEBLOCK_FIELDS.forEach((field) => (results[field] = getValue(field)));
const results: { [field in CodeblockFields]: string | boolean | string[] } = {};
CODEBLOCK_FIELDS.forEach((field) => {
results[field] = getValue(field);
if (results[field] === "false") {
results[field] = false;
}
if (results[field] === "true") {
results[field] = true;
}
});

results.field = results.field
? splitAndTrim(results.field as string)
Expand Down

0 comments on commit 90408d0

Please sign in to comment.