diff --git a/main.js b/main.js index 304317b5..dd428866 100644 --- a/main.js +++ b/main.js @@ -2,6 +2,7 @@ var require$$0 = require('obsidian'); var util = require('util'); +var console$1 = require('console'); function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; } @@ -20438,6 +20439,9 @@ function set_data(text, data) { if (text.wholeText !== data) text.data = data; } +function set_input_value(input, value) { + input.value = value == null ? '' : value; +} function set_style(node, key, value, important) { node.style.setProperty(key, value, important ? 'important' : ''); } @@ -20450,11 +20454,23 @@ function select_option(select, value) { } } } +function select_value(select) { + const selected_option = select.querySelector(':checked') || select.options[0]; + return selected_option && selected_option.__value; +} let current_component; function set_current_component(component) { current_component = component; } +function get_current_component() { + if (!current_component) + throw new Error('Function called outside component initialization'); + return current_component; +} +function onMount(fn) { + get_current_component().$$.on_mount.push(fn); +} const dirty_components = []; const binding_callbacks = []; @@ -21118,7 +21134,7 @@ function iterateHiers(userHiers, fn) { /* src\Components\Stats.svelte generated by Svelte v3.35.0 */ -function add_css$9() { +function add_css$a() { var style = element("style"); style.id = "svelte-rb5mhu-style"; style.textContent = "table.svelte-rb5mhu{border-collapse:collapse}td.svelte-rb5mhu:first-child{text-align:right}td.svelte-rb5mhu,th.svelte-rb5mhu{padding:3px;border:1px solid var(--background-modifier-border);white-space:pre-line}"; @@ -21759,7 +21775,7 @@ function create_each_block$9(ctx) { }; } -function create_fragment$h(ctx) { +function create_fragment$i(ctx) { let table; let thead; let tr0; @@ -22104,7 +22120,7 @@ function create_fragment$h(ctx) { }; } -function instance$h($$self, $$props, $$invalidate) { +function instance$i($$self, $$props, $$invalidate) { let { plugin } = $$props; @@ -22235,8 +22251,8 @@ function instance$h($$self, $$props, $$invalidate) { class Stats extends SvelteComponent { constructor(options) { super(); - if (!document.getElementById("svelte-rb5mhu-style")) add_css$9(); - init(this, options, instance$h, create_fragment$h, safe_not_equal, { plugin: 0 }, [-1, -1]); + if (!document.getElementById("svelte-rb5mhu-style")) add_css$a(); + init(this, options, instance$i, create_fragment$i, safe_not_equal, { plugin: 0 }, [-1, -1]); } } @@ -22278,7 +22294,7 @@ class StatsView extends require$$0.ItemView { /* node_modules\svelte-icons\components\IconBase.svelte generated by Svelte v3.35.0 */ -function add_css$8() { +function add_css$9() { var style = element("style"); style.id = "svelte-c8tyih-style"; style.textContent = "svg.svelte-c8tyih{stroke:currentColor;fill:currentColor;stroke-width:0;width:100%;height:auto;max-height:100%}"; @@ -22286,7 +22302,7 @@ function add_css$8() { } // (18:2) {#if title} -function create_if_block$5(ctx) { +function create_if_block$6(ctx) { let title_1; let t; @@ -22308,11 +22324,11 @@ function create_if_block$5(ctx) { }; } -function create_fragment$g(ctx) { +function create_fragment$h(ctx) { let svg; let if_block_anchor; let current; - let if_block = /*title*/ ctx[0] && create_if_block$5(ctx); + let if_block = /*title*/ ctx[0] && create_if_block$6(ctx); const default_slot_template = /*#slots*/ ctx[3].default; const default_slot = create_slot(default_slot_template, ctx, /*$$scope*/ ctx[2], null); @@ -22342,7 +22358,7 @@ function create_fragment$g(ctx) { if (if_block) { if_block.p(ctx, dirty); } else { - if_block = create_if_block$5(ctx); + if_block = create_if_block$6(ctx); if_block.c(); if_block.m(svg, if_block_anchor); } @@ -22378,7 +22394,7 @@ function create_fragment$g(ctx) { }; } -function instance$g($$self, $$props, $$invalidate) { +function instance$h($$self, $$props, $$invalidate) { let { $$slots: slots = {}, $$scope } = $$props; let { title = null } = $$props; let { viewBox } = $$props; @@ -22395,8 +22411,8 @@ function instance$g($$self, $$props, $$invalidate) { class IconBase extends SvelteComponent { constructor(options) { super(); - if (!document.getElementById("svelte-c8tyih-style")) add_css$8(); - init(this, options, instance$g, create_fragment$g, safe_not_equal, { title: 0, viewBox: 1 }); + if (!document.getElementById("svelte-c8tyih-style")) add_css$9(); + init(this, options, instance$h, create_fragment$h, safe_not_equal, { title: 0, viewBox: 1 }); } } @@ -22419,7 +22435,7 @@ function create_default_slot$5(ctx) { }; } -function create_fragment$f(ctx) { +function create_fragment$g(ctx) { let iconbase; let current; const iconbase_spread_levels = [{ viewBox: "0 0 384 512" }, /*$$props*/ ctx[0]]; @@ -22469,7 +22485,7 @@ function create_fragment$f(ctx) { }; } -function instance$f($$self, $$props, $$invalidate) { +function instance$g($$self, $$props, $$invalidate) { $$self.$$set = $$new_props => { $$invalidate(0, $$props = assign(assign({}, $$props), exclude_internal_props($$new_props))); }; @@ -22481,7 +22497,7 @@ function instance$f($$self, $$props, $$invalidate) { class FaFire extends SvelteComponent { constructor(options) { super(); - init(this, options, instance$f, create_fragment$f, safe_not_equal, {}); + init(this, options, instance$g, create_fragment$g, safe_not_equal, {}); } } @@ -22504,7 +22520,7 @@ function create_default_slot$4(ctx) { }; } -function create_fragment$e(ctx) { +function create_fragment$f(ctx) { let iconbase; let current; const iconbase_spread_levels = [{ viewBox: "0 0 448 512" }, /*$$props*/ ctx[0]]; @@ -22554,7 +22570,7 @@ function create_fragment$e(ctx) { }; } -function instance$e($$self, $$props, $$invalidate) { +function instance$f($$self, $$props, $$invalidate) { $$self.$$set = $$new_props => { $$invalidate(0, $$props = assign(assign({}, $$props), exclude_internal_props($$new_props))); }; @@ -22566,13 +22582,13 @@ function instance$e($$self, $$props, $$invalidate) { class FaRegSnowflake extends SvelteComponent { constructor(options) { super(); - init(this, options, instance$e, create_fragment$e, safe_not_equal, {}); + init(this, options, instance$f, create_fragment$f, safe_not_equal, {}); } } /* src\Components\Down.svelte generated by Svelte v3.35.0 */ -function add_css$7() { +function add_css$8() { var style = element("style"); style.id = "svelte-1mg8nz0-style"; style.textContent = ".BC-downs.svelte-1mg8nz0{padding-left:5px}pre.svelte-1mg8nz0{display:inline}.is-unresolved.svelte-1mg8nz0{color:var(--text-muted)}.icon.svelte-1mg8nz0{color:var(--text-normal);display:inline-block;padding-top:5px !important;width:20px;height:20px}"; @@ -22586,7 +22602,7 @@ function get_each_context$8(ctx, list, i) { } // (51:4) {:else} -function create_else_block$1(ctx) { +function create_else_block$2(ctx) { let fafire; let current; fafire = new FaFire({}); @@ -22615,7 +22631,7 @@ function create_else_block$1(ctx) { } // (49:4) {#if frozen} -function create_if_block_1$3(ctx) { +function create_if_block_1$4(ctx) { let faregsnowflake; let current; faregsnowflake = new FaRegSnowflake({}); @@ -22644,7 +22660,7 @@ function create_if_block_1$3(ctx) { } // (67:4) {#if line.length > 1} -function create_if_block$4(ctx) { +function create_if_block$5(ctx) { let div; let pre; let t0_value = /*line*/ ctx[11][0] + "-" + ""; @@ -22731,7 +22747,7 @@ function create_if_block$4(ctx) { // (66:2) {#each lines as line} function create_each_block$8(ctx) { let if_block_anchor; - let if_block = /*line*/ ctx[11].length > 1 && create_if_block$4(ctx); + let if_block = /*line*/ ctx[11].length > 1 && create_if_block$5(ctx); return { c() { @@ -22747,7 +22763,7 @@ function create_each_block$8(ctx) { if (if_block) { if_block.p(ctx, dirty); } else { - if_block = create_if_block$4(ctx); + if_block = create_if_block$5(ctx); if_block.c(); if_block.m(if_block_anchor.parentNode, if_block_anchor); } @@ -22763,7 +22779,7 @@ function create_each_block$8(ctx) { }; } -function create_fragment$d(ctx) { +function create_fragment$e(ctx) { let div0; let span; let current_block_type_index; @@ -22776,7 +22792,7 @@ function create_fragment$d(ctx) { let current; let mounted; let dispose; - const if_block_creators = [create_if_block_1$3, create_else_block$1]; + const if_block_creators = [create_if_block_1$4, create_else_block$2]; const if_blocks = []; function select_block_type(ctx, dirty) { @@ -22915,7 +22931,7 @@ function create_fragment$d(ctx) { }; } -function instance$d($$self, $$props, $$invalidate) { +function instance$e($$self, $$props, $$invalidate) { let { plugin } = $$props; @@ -22986,8 +23002,8 @@ function instance$d($$self, $$props, $$invalidate) { class Down extends SvelteComponent { constructor(options) { super(); - if (!document.getElementById("svelte-1mg8nz0-style")) add_css$7(); - init(this, options, instance$d, create_fragment$d, safe_not_equal, { plugin: 0, view: 1 }); + if (!document.getElementById("svelte-1mg8nz0-style")) add_css$8(); + init(this, options, instance$e, create_fragment$e, safe_not_equal, { plugin: 0, view: 1 }); } } @@ -23043,7 +23059,7 @@ function create_default_slot$3(ctx) { }; } -function create_fragment$c(ctx) { +function create_fragment$d(ctx) { let iconbase; let current; const iconbase_spread_levels = [{ viewBox: "0 0 192 512" }, /*$$props*/ ctx[0]]; @@ -23093,7 +23109,7 @@ function create_fragment$c(ctx) { }; } -function instance$c($$self, $$props, $$invalidate) { +function instance$d($$self, $$props, $$invalidate) { $$self.$$set = $$new_props => { $$invalidate(0, $$props = assign(assign({}, $$props), exclude_internal_props($$new_props))); }; @@ -23105,13 +23121,13 @@ function instance$c($$self, $$props, $$invalidate) { class FaInfo extends SvelteComponent { constructor(options) { super(); - init(this, options, instance$c, create_fragment$c, safe_not_equal, {}); + init(this, options, instance$d, create_fragment$d, safe_not_equal, {}); } } /* src\Components\Ducks.svelte generated by Svelte v3.35.0 */ -function add_css$6() { +function add_css$7() { var style = element("style"); style.id = "svelte-gmdm3a-style"; style.textContent = ".icon.svelte-gmdm3a{color:var(--text-normal);display:inline-block;padding-top:5px !important;width:20px;height:20px}"; @@ -23177,7 +23193,7 @@ function create_each_block$7(ctx) { }; } -function create_fragment$b(ctx) { +function create_fragment$c(ctx) { let div; let h6; let t1; @@ -23314,7 +23330,7 @@ function create_fragment$b(ctx) { }; } -function instance$b($$self, $$props, $$invalidate) { +function instance$c($$self, $$props, $$invalidate) { @@ -23372,8 +23388,8 @@ function instance$b($$self, $$props, $$invalidate) { class Ducks extends SvelteComponent { constructor(options) { super(); - if (!document.getElementById("svelte-gmdm3a-style")) add_css$6(); - init(this, options, instance$b, create_fragment$b, safe_not_equal, { plugin: 5, app: 0, ducksView: 1 }); + if (!document.getElementById("svelte-gmdm3a-style")) add_css$7(); + init(this, options, instance$c, create_fragment$c, safe_not_equal, { plugin: 5, app: 0, ducksView: 1 }); } } @@ -23414,7 +23430,7 @@ class DucksView extends require$$0.ItemView { /* src\Components\Lists.svelte generated by Svelte v3.35.0 */ -function add_css$5() { +function add_css$6() { var style = element("style"); style.id = "svelte-1dlhare-style"; style.textContent = "summary.hier-summary.svelte-1dlhare{color:var(--text-title-h2);font-size:larger}summary.svelte-1dlhare{color:var(--text-title-h3)}h5.BC-header.svelte-1dlhare{color:var(--text-title-h5)}.markdown-preview-view.svelte-1dlhare{padding-left:10px}.internal-link.is-unresolved.svelte-1dlhare{color:var(--text-muted)}"; @@ -23446,15 +23462,15 @@ function get_each_context_3$1(ctx, list, i) { } // (24:8) {#if square.realItems.length > 0 || square.impliedItems.length > 0} -function create_if_block$3(ctx) { +function create_if_block$4(ctx) { let details; let summary; let t0_value = /*square*/ ctx[12].field + ""; let t0; let t1; let t2; - let if_block0 = /*square*/ ctx[12].realItems.length && create_if_block_3$1(ctx); - let if_block1 = /*square*/ ctx[12].impliedItems.length && create_if_block_1$2(ctx); + let if_block0 = /*square*/ ctx[12].realItems.length && create_if_block_3$2(ctx); + let if_block1 = /*square*/ ctx[12].impliedItems.length && create_if_block_1$3(ctx); return { c() { @@ -23485,7 +23501,7 @@ function create_if_block$3(ctx) { if (if_block0) { if_block0.p(ctx, dirty); } else { - if_block0 = create_if_block_3$1(ctx); + if_block0 = create_if_block_3$2(ctx); if_block0.c(); if_block0.m(details, t2); } @@ -23498,7 +23514,7 @@ function create_if_block$3(ctx) { if (if_block1) { if_block1.p(ctx, dirty); } else { - if_block1 = create_if_block_1$2(ctx); + if_block1 = create_if_block_1$3(ctx); if_block1.c(); if_block1.m(details, null); } @@ -23516,7 +23532,7 @@ function create_if_block$3(ctx) { } // (27:12) {#if square.realItems.length} -function create_if_block_3$1(ctx) { +function create_if_block_3$2(ctx) { let t; let ol; let if_block = /*settings*/ ctx[1].showRelationType && create_if_block_4$1(); @@ -23668,11 +23684,11 @@ function create_each_block_3$1(ctx) { } // (48:12) {#if square.impliedItems.length} -function create_if_block_1$2(ctx) { +function create_if_block_1$3(ctx) { let t; let ol; let ol_start_value; - let if_block = /*settings*/ ctx[1].showRelationType && create_if_block_2$2(); + let if_block = /*settings*/ ctx[1].showRelationType && create_if_block_2$3(); let each_value_2 = /*square*/ ctx[12].impliedItems; let each_blocks = []; @@ -23704,7 +23720,7 @@ function create_if_block_1$2(ctx) { p(ctx, dirty) { if (/*settings*/ ctx[1].showRelationType) { if (if_block) ; else { - if_block = create_if_block_2$2(); + if_block = create_if_block_2$3(); if_block.c(); if_block.m(t.parentNode, t); } @@ -23750,7 +23766,7 @@ function create_if_block_1$2(ctx) { } // (49:14) {#if settings.showRelationType} -function create_if_block_2$2(ctx) { +function create_if_block_2$3(ctx) { let h5; return { @@ -23833,7 +23849,7 @@ function create_each_block_2$2(ctx) { // (23:6) {#each squares as square} function create_each_block_1$6(ctx) { let if_block_anchor; - let if_block = (/*square*/ ctx[12].realItems.length > 0 || /*square*/ ctx[12].impliedItems.length > 0) && create_if_block$3(ctx); + let if_block = (/*square*/ ctx[12].realItems.length > 0 || /*square*/ ctx[12].impliedItems.length > 0) && create_if_block$4(ctx); return { c() { @@ -23849,7 +23865,7 @@ function create_each_block_1$6(ctx) { if (if_block) { if_block.p(ctx, dirty); } else { - if_block = create_if_block$3(ctx); + if_block = create_if_block$4(ctx); if_block.c(); if_block.m(if_block_anchor.parentNode, if_block_anchor); } @@ -23940,7 +23956,7 @@ function create_each_block$6(ctx) { }; } -function create_fragment$a(ctx) { +function create_fragment$b(ctx) { let div; let div_class_value; let each_value = /*filteredSquaresArr*/ ctx[0]; @@ -24010,7 +24026,7 @@ function create_fragment$a(ctx) { const func = square => square.field; -function instance$a($$self, $$props, $$invalidate) { +function instance$b($$self, $$props, $$invalidate) { @@ -24048,9 +24064,9 @@ function instance$a($$self, $$props, $$invalidate) { class Lists extends SvelteComponent { constructor(options) { super(); - if (!document.getElementById("svelte-1dlhare-style")) add_css$5(); + if (!document.getElementById("svelte-1dlhare-style")) add_css$6(); - init(this, options, instance$a, create_fragment$a, safe_not_equal, { + init(this, options, instance$b, create_fragment$b, safe_not_equal, { filteredSquaresArr: 0, currFile: 4, settings: 1, @@ -24062,7 +24078,7 @@ class Lists extends SvelteComponent { /* src\Components\Matrix.svelte generated by Svelte v3.35.0 */ -function add_css$4() { +function add_css$5() { var style = element("style"); style.id = "svelte-sp0k97-style"; style.textContent = "div.BC-Matrix.svelte-sp0k97.svelte-sp0k97{padding:5px}div.BC-Matrix.svelte-sp0k97>div.svelte-sp0k97{border:3px solid var(--background-modifier-border);border-radius:3px;text-align:center;margin:3px;position:relative;height:fit-content}div.BC-Matrix-square.svelte-sp0k97.svelte-sp0k97{border:1px solid var(--background-modifier-border)}div.BC-Matrix-headers.svelte-sp0k97.svelte-sp0k97{display:flex;justify-content:space-between;align-items:center}.BC-Matrix-header.svelte-sp0k97.svelte-sp0k97{margin:2px;padding:0px 10px}ol.svelte-sp0k97.svelte-sp0k97{margin:3px;padding-left:30px}"; @@ -24094,7 +24110,7 @@ function get_each_context_3(ctx, list, i) { } // (20:8) {#if square.realItems.length > 0 || square.impliedItems.length > 0} -function create_if_block$2(ctx) { +function create_if_block$3(ctx) { let div1; let div0; let h4; @@ -24105,7 +24121,7 @@ function create_if_block$2(ctx) { let t3; let if_block0 = /*settings*/ ctx[1].showRelationType && create_if_block_5(ctx); let if_block1 = /*square*/ ctx[12].realItems.length && create_if_block_4(ctx); - let if_block2 = /*square*/ ctx[12].impliedItems.length && create_if_block_1$1(ctx); + let if_block2 = /*square*/ ctx[12].impliedItems.length && create_if_block_1$2(ctx); return { c() { @@ -24168,7 +24184,7 @@ function create_if_block$2(ctx) { if (if_block2) { if_block2.p(ctx, dirty); } else { - if_block2 = create_if_block_1$1(ctx); + if_block2 = create_if_block_1$2(ctx); if_block2.c(); if_block2.m(div1, null); } @@ -24328,14 +24344,14 @@ function create_each_block_3(ctx) { } // (48:12) {#if square.impliedItems.length} -function create_if_block_1$1(ctx) { +function create_if_block_1$2(ctx) { let div; let h4; let t0; let t1; let ol; let ol_start_value; - let if_block = /*square*/ ctx[12].impliedItems.length && create_if_block_2$1(ctx); + let if_block = /*square*/ ctx[12].impliedItems.length && create_if_block_2$2(ctx); let each_value_2 = /*square*/ ctx[12].impliedItems; let each_blocks = []; @@ -24378,7 +24394,7 @@ function create_if_block_1$1(ctx) { if (if_block) { if_block.p(ctx, dirty); } else { - if_block = create_if_block_2$1(ctx); + if_block = create_if_block_2$2(ctx); if_block.c(); if_block.m(div, null); } @@ -24425,9 +24441,9 @@ function create_if_block_1$1(ctx) { } // (51:16) {#if square.impliedItems.length} -function create_if_block_2$1(ctx) { +function create_if_block_2$2(ctx) { let if_block_anchor; - let if_block = /*settings*/ ctx[1].showRelationType && /*square*/ ctx[12].realItems.length && create_if_block_3(); + let if_block = /*settings*/ ctx[1].showRelationType && /*square*/ ctx[12].realItems.length && create_if_block_3$1(); return { c() { @@ -24441,7 +24457,7 @@ function create_if_block_2$1(ctx) { p(ctx, dirty) { if (/*settings*/ ctx[1].showRelationType && /*square*/ ctx[12].realItems.length) { if (if_block) ; else { - if_block = create_if_block_3(); + if_block = create_if_block_3$1(); if_block.c(); if_block.m(if_block_anchor.parentNode, if_block_anchor); } @@ -24458,7 +24474,7 @@ function create_if_block_2$1(ctx) { } // (52:18) {#if settings.showRelationType && square.realItems.length} -function create_if_block_3(ctx) { +function create_if_block_3$1(ctx) { let h6; return { @@ -24541,7 +24557,7 @@ function create_each_block_2$1(ctx) { // (19:6) {#each squares as square} function create_each_block_1$5(ctx) { let if_block_anchor; - let if_block = (/*square*/ ctx[12].realItems.length > 0 || /*square*/ ctx[12].impliedItems.length > 0) && create_if_block$2(ctx); + let if_block = (/*square*/ ctx[12].realItems.length > 0 || /*square*/ ctx[12].impliedItems.length > 0) && create_if_block$3(ctx); return { c() { @@ -24557,7 +24573,7 @@ function create_each_block_1$5(ctx) { if (if_block) { if_block.p(ctx, dirty); } else { - if_block = create_if_block$2(ctx); + if_block = create_if_block$3(ctx); if_block.c(); if_block.m(if_block_anchor.parentNode, if_block_anchor); } @@ -24635,7 +24651,7 @@ function create_each_block$5(ctx) { }; } -function create_fragment$9(ctx) { +function create_fragment$a(ctx) { let div; let div_class_value; let each_value = /*filteredSquaresArr*/ ctx[0]; @@ -24703,7 +24719,7 @@ function create_fragment$9(ctx) { }; } -function instance$9($$self, $$props, $$invalidate) { +function instance$a($$self, $$props, $$invalidate) { @@ -24741,9 +24757,9 @@ function instance$9($$self, $$props, $$invalidate) { class Matrix extends SvelteComponent { constructor(options) { super(); - if (!document.getElementById("svelte-sp0k97-style")) add_css$4(); + if (!document.getElementById("svelte-sp0k97-style")) add_css$5(); - init(this, options, instance$9, create_fragment$9, safe_not_equal, { + init(this, options, instance$a, create_fragment$a, safe_not_equal, { filteredSquaresArr: 0, currFile: 4, settings: 1, @@ -24945,7 +24961,7 @@ class MatrixView extends require$$0.ItemView { /* src\Components\KoFi.svelte generated by Svelte v3.35.0 */ -function create_fragment$8(ctx) { +function create_fragment$9(ctx) { let script; let script_src_value; let t; @@ -24986,7 +25002,7 @@ function create_fragment$8(ctx) { }; } -function instance$8($$self, $$props, $$invalidate) { +function instance$9($$self, $$props, $$invalidate) { let button; var initializeKofi = () => { @@ -25007,7 +25023,7 @@ function instance$8($$self, $$props, $$invalidate) { class KoFi extends SvelteComponent { constructor(options) { super(); - init(this, options, instance$8, create_fragment$8, safe_not_equal, {}); + init(this, options, instance$9, create_fragment$9, safe_not_equal, {}); } } @@ -25030,7 +25046,7 @@ function create_default_slot$2(ctx) { }; } -function create_fragment$7(ctx) { +function create_fragment$8(ctx) { let iconbase; let current; const iconbase_spread_levels = [{ viewBox: "0 0 512 512" }, /*$$props*/ ctx[0]]; @@ -25080,7 +25096,7 @@ function create_fragment$7(ctx) { }; } -function instance$7($$self, $$props, $$invalidate) { +function instance$8($$self, $$props, $$invalidate) { $$self.$$set = $$new_props => { $$invalidate(0, $$props = assign(assign({}, $$props), exclude_internal_props($$new_props))); }; @@ -25092,7 +25108,7 @@ function instance$7($$self, $$props, $$invalidate) { class FaListUl extends SvelteComponent { constructor(options) { super(); - init(this, options, instance$7, create_fragment$7, safe_not_equal, {}); + init(this, options, instance$8, create_fragment$8, safe_not_equal, {}); } } @@ -25115,7 +25131,7 @@ function create_default_slot$1(ctx) { }; } -function create_fragment$6(ctx) { +function create_fragment$7(ctx) { let iconbase; let current; const iconbase_spread_levels = [{ viewBox: "0 0 448 512" }, /*$$props*/ ctx[0]]; @@ -25165,7 +25181,7 @@ function create_fragment$6(ctx) { }; } -function instance$6($$self, $$props, $$invalidate) { +function instance$7($$self, $$props, $$invalidate) { $$self.$$set = $$new_props => { $$invalidate(0, $$props = assign(assign({}, $$props), exclude_internal_props($$new_props))); }; @@ -25177,7 +25193,7 @@ function instance$6($$self, $$props, $$invalidate) { class FaPlus extends SvelteComponent { constructor(options) { super(); - init(this, options, instance$6, create_fragment$6, safe_not_equal, {}); + init(this, options, instance$7, create_fragment$7, safe_not_equal, {}); } } @@ -25200,7 +25216,7 @@ function create_default_slot(ctx) { }; } -function create_fragment$5(ctx) { +function create_fragment$6(ctx) { let iconbase; let current; const iconbase_spread_levels = [{ viewBox: "0 0 448 512" }, /*$$props*/ ctx[0]]; @@ -25250,7 +25266,7 @@ function create_fragment$5(ctx) { }; } -function instance$5($$self, $$props, $$invalidate) { +function instance$6($$self, $$props, $$invalidate) { $$self.$$set = $$new_props => { $$invalidate(0, $$props = assign(assign({}, $$props), exclude_internal_props($$new_props))); }; @@ -25262,13 +25278,13 @@ function instance$5($$self, $$props, $$invalidate) { class FaRegTrashAlt extends SvelteComponent { constructor(options) { super(); - init(this, options, instance$5, create_fragment$5, safe_not_equal, {}); + init(this, options, instance$6, create_fragment$6, safe_not_equal, {}); } } /* src\Components\UserHierarchies.svelte generated by Svelte v3.35.0 */ -function add_css$3() { +function add_css$4() { var style = element("style"); style.id = "svelte-5y4abu-style"; style.textContent = "label.BC-Arrow-Label.svelte-5y4abu.svelte-5y4abu{display:inline-block;width:20px !important}div.GA-Buttons.svelte-5y4abu.svelte-5y4abu{padding-bottom:5px}details.BC-Hier-Details.svelte-5y4abu.svelte-5y4abu{border:1px solid var(--background-modifier-border);border-radius:10px;padding:10px 5px 10px 10px;margin-bottom:15px}.BC-Hier-Details.svelte-5y4abu summary.svelte-5y4abu::marker{font-size:10px}.BC-Hier-Details.svelte-5y4abu summary button.svelte-5y4abu{float:right}.icon.svelte-5y4abu.svelte-5y4abu{color:var(--text-normal);display:inline-block;padding-top:3px;width:17px;height:17px}"; @@ -25485,7 +25501,7 @@ function create_each_block$4(ctx) { }; } -function create_fragment$4(ctx) { +function create_fragment$5(ctx) { let div4; let div3; let button0; @@ -25625,7 +25641,7 @@ function create_fragment$4(ctx) { const func_1 = dirFields => `(${dirFields})`; -function instance$4($$self, $$props, $$invalidate) { +function instance$5($$self, $$props, $$invalidate) { var __awaiter = this && this.__awaiter || function (thisArg, _arguments, P, generator) { function adopt(value) { return value instanceof P @@ -25730,8 +25746,8 @@ function instance$4($$self, $$props, $$invalidate) { class UserHierarchies extends SvelteComponent { constructor(options) { super(); - if (!document.getElementById("svelte-5y4abu-style")) add_css$3(); - init(this, options, instance$4, create_fragment$4, safe_not_equal, { plugin: 2 }); + if (!document.getElementById("svelte-5y4abu-style")) add_css$4(); + init(this, options, instance$5, create_fragment$5, safe_not_equal, { plugin: 2 }); } } @@ -26414,7 +26430,7 @@ class BCSettingTab extends require$$0.PluginSettingTab { /* src\Components\NextPrev.svelte generated by Svelte v3.35.0 */ -function add_css$2() { +function add_css$3() { var style = element("style"); style.id = "svelte-1cqb0v5-style"; style.textContent = ".BC-nexts.svelte-1cqb0v5 div.svelte-1cqb0v5{text-align:right}.BC-right-arrow.svelte-1cqb0v5.svelte-1cqb0v5{padding-left:5px;float:right}.BC-left-arrow.svelte-1cqb0v5.svelte-1cqb0v5{padding-right:5px;float:left}.BC-nexts.svelte-1cqb0v5.svelte-1cqb0v5{border-left:1px solid var(--background-modifier-border)}.BC-prevs.svelte-1cqb0v5.svelte-1cqb0v5{border-right:1px solid var(--background-modifier-border)}.BC-NextPrev-Container.svelte-1cqb0v5.svelte-1cqb0v5{display:grid;grid-template-columns:1fr 1fr}"; @@ -26549,7 +26565,7 @@ function create_each_block$3(ctx) { }; } -function create_fragment$3(ctx) { +function create_fragment$4(ctx) { let div2; let div0; let span0; @@ -26666,7 +26682,7 @@ function create_fragment$3(ctx) { }; } -function instance$3($$self, $$props, $$invalidate) { +function instance$4($$self, $$props, $$invalidate) { @@ -26690,14 +26706,14 @@ function instance$3($$self, $$props, $$invalidate) { class NextPrev extends SvelteComponent { constructor(options) { super(); - if (!document.getElementById("svelte-1cqb0v5-style")) add_css$2(); - init(this, options, instance$3, create_fragment$3, safe_not_equal, { app: 0, plugin: 3, next: 1, prev: 2 }); + if (!document.getElementById("svelte-1cqb0v5-style")) add_css$3(); + init(this, options, instance$4, create_fragment$4, safe_not_equal, { app: 0, plugin: 3, next: 1, prev: 2 }); } } /* src\Components\TrailGrid.svelte generated by Svelte v3.35.0 */ -function add_css$1() { +function add_css$2() { var style = element("style"); style.id = "svelte-ybyqyo-style"; style.textContent = "div.BC-trail-grid.svelte-ybyqyo{border:2px solid var(--background-modifier-border);display:grid;align-items:stretch;width:auto;height:auto}div.BC-trail-grid-item.svelte-ybyqyo{display:flex;flex-direction:column;border:1px solid var(--background-modifier-border);align-items:center;justify-content:center;padding:2px;font-size:smaller}div.BC-trail-grid-item.BC-filler.svelte-ybyqyo{opacity:0.7}.dot.svelte-ybyqyo{height:5px;width:5px;border-radius:50%;display:inline-block}"; @@ -26724,7 +26740,7 @@ function get_each_context_2(ctx, list, i) { } // (82:8) {#if step.value && settings.gridDots} -function create_if_block$1(ctx) { +function create_if_block$2(ctx) { let div; let each_value_2 = lodash.range(Math.floor(/*wordCounts*/ ctx[2][/*step*/ ctx[24].value] / 1000)); let each_blocks = []; @@ -26814,7 +26830,7 @@ function create_each_block_1$2(ctx) { let div1_style_value; let mounted; let dispose; - let if_block = /*step*/ ctx[24].value && /*settings*/ ctx[4].gridDots && create_if_block$1(ctx); + let if_block = /*step*/ ctx[24].value && /*settings*/ ctx[4].gridDots && create_if_block$2(ctx); function click_handler(...args) { return /*click_handler*/ ctx[9](/*step*/ ctx[24], ...args); @@ -26936,7 +26952,7 @@ function create_each_block$2(ctx) { }; } -function create_fragment$2(ctx) { +function create_fragment$3(ctx) { let div; let each_value = /*transposedTrails*/ ctx[6]; let each_blocks = []; @@ -27001,7 +27017,7 @@ function create_fragment$2(ctx) { }; } -function instance$2($$self, $$props, $$invalidate) { +function instance$3($$self, $$props, $$invalidate) { let { sortedTrails } = $$props; @@ -27091,14 +27107,14 @@ function instance$2($$self, $$props, $$invalidate) { class TrailGrid extends SvelteComponent { constructor(options) { super(); - if (!document.getElementById("svelte-ybyqyo-style")) add_css$1(); - init(this, options, instance$2, create_fragment$2, safe_not_equal, { sortedTrails: 0, app: 1, plugin: 8 }); + if (!document.getElementById("svelte-ybyqyo-style")) add_css$2(); + init(this, options, instance$3, create_fragment$3, safe_not_equal, { sortedTrails: 0, app: 1, plugin: 8 }); } } /* src\Components\TrailPath.svelte generated by Svelte v3.35.0 */ -function add_css() { +function add_css$1() { var style = element("style"); style.id = "svelte-3c1frp-style"; style.textContent = "span.BC-trail-path-container.svelte-3c1frp{display:flex;justify-content:space-between}"; @@ -27119,7 +27135,7 @@ function get_each_context_1$1(ctx, list, i) { } // (19:8) {:else} -function create_else_block(ctx) { +function create_else_block$1(ctx) { let each_1_anchor; let each_value_1 = /*trail*/ ctx[10]; let each_blocks = []; @@ -27175,7 +27191,7 @@ function create_else_block(ctx) { } // (17:8) {#if trail.length === 0} -function create_if_block_1(ctx) { +function create_if_block_1$1(ctx) { let span; return { @@ -27194,7 +27210,7 @@ function create_if_block_1(ctx) { } // (28:12) {#if i < trail.length - 1} -function create_if_block_2(ctx) { +function create_if_block_2$1(ctx) { let span; return { @@ -27230,7 +27246,7 @@ function create_each_block_1$1(ctx) { return /*mouseover_handler*/ ctx[8](/*crumb*/ ctx[13], ...args); } - let if_block = /*i*/ ctx[15] < /*trail*/ ctx[10].length - 1 && create_if_block_2(ctx); + let if_block = /*i*/ ctx[15] < /*trail*/ ctx[10].length - 1 && create_if_block_2$1(ctx); return { c() { @@ -27265,7 +27281,7 @@ function create_each_block_1$1(ctx) { if (if_block) { if_block.p(ctx, dirty); } else { - if_block = create_if_block_2(ctx); + if_block = create_if_block_2$1(ctx); if_block.c(); if_block.m(if_block_anchor.parentNode, if_block_anchor); } @@ -27291,8 +27307,8 @@ function create_each_block$1(ctx) { let t; function select_block_type(ctx, dirty) { - if (/*trail*/ ctx[10].length === 0) return create_if_block_1; - return create_else_block; + if (/*trail*/ ctx[10].length === 0) return create_if_block_1$1; + return create_else_block$1; } let current_block_type = select_block_type(ctx); @@ -27330,7 +27346,7 @@ function create_each_block$1(ctx) { } // (37:2) {#if sortedTrails.length > 1} -function create_if_block(ctx) { +function create_if_block$1(ctx) { let div; let button; let t_value = (/*showAll*/ ctx[2] ? "Shortest" : "All") + ""; @@ -27366,7 +27382,7 @@ function create_if_block(ctx) { }; } -function create_fragment$1(ctx) { +function create_fragment$2(ctx) { let span; let div; let t; @@ -27377,7 +27393,7 @@ function create_fragment$1(ctx) { each_blocks[i] = create_each_block$1(get_each_context$1(ctx, each_value, i)); } - let if_block = /*sortedTrails*/ ctx[0].length > 1 && create_if_block(ctx); + let if_block = /*sortedTrails*/ ctx[0].length > 1 && create_if_block$1(ctx); return { c() { @@ -27432,7 +27448,7 @@ function create_fragment$1(ctx) { if (if_block) { if_block.p(ctx, dirty); } else { - if_block = create_if_block(ctx); + if_block = create_if_block$1(ctx); if_block.c(); if_block.m(span, null); } @@ -27451,7 +27467,7 @@ function create_fragment$1(ctx) { }; } -function instance$1($$self, $$props, $$invalidate) { +function instance$2($$self, $$props, $$invalidate) { let trailsToShow; @@ -27494,8 +27510,8 @@ function instance$1($$self, $$props, $$invalidate) { class TrailPath extends SvelteComponent { constructor(options) { super(); - if (!document.getElementById("svelte-3c1frp-style")) add_css(); - init(this, options, instance$1, create_fragment$1, safe_not_equal, { sortedTrails: 0, app: 1, plugin: 6 }); + if (!document.getElementById("svelte-3c1frp-style")) add_css$1(); + init(this, options, instance$2, create_fragment$2, safe_not_equal, { sortedTrails: 0, app: 1, plugin: 6 }); } } @@ -49171,7 +49187,7 @@ function create_each_block(ctx) { }; } -function create_fragment(ctx) { +function create_fragment$1(ctx) { let div0; let t; let div1; @@ -49239,7 +49255,7 @@ function create_fragment(ctx) { }; } -function instance($$self, $$props, $$invalidate) { +function instance$1($$self, $$props, $$invalidate) { let argArr; @@ -49397,7 +49413,7 @@ function instance($$self, $$props, $$invalidate) { class VisComp extends SvelteComponent { constructor(options) { super(); - init(this, options, instance, create_fragment, safe_not_equal, { modal: 1, settings: 2 }); + init(this, options, instance$1, create_fragment$1, safe_not_equal, { modal: 1, settings: 2 }); } } @@ -49532,6 +49548,587 @@ class VisModal extends require$$0.Modal { } } +/* src\Components\ModifyHNItemComp.svelte generated by Svelte v3.35.0 */ + +function add_css() { + var style = element("style"); + style.id = "svelte-13g4k7i-style"; + style.textContent = "pre.svelte-13g4k7i{display:inline}"; + append(document.head, style); +} + +// (21:2) {#if rel === "up"} +function create_if_block_2(ctx) { + let if_block_anchor; + + function select_block_type(ctx, dirty) { + if (/*hnItem*/ ctx[2].depth === 0) return create_if_block_3; + return create_else_block; + } + + let current_block_type = select_block_type(ctx); + let if_block = current_block_type(ctx); + + return { + c() { + if_block.c(); + if_block_anchor = empty(); + }, + m(target, anchor) { + if_block.m(target, anchor); + insert(target, if_block_anchor, anchor); + }, + p(ctx, dirty) { + if (current_block_type === (current_block_type = select_block_type(ctx)) && if_block) { + if_block.p(ctx, dirty); + } else { + if_block.d(1); + if_block = current_block_type(ctx); + + if (if_block) { + if_block.c(); + if_block.m(if_block_anchor.parentNode, if_block_anchor); + } + } + }, + d(detaching) { + if_block.d(detaching); + if (detaching) detach(if_block_anchor); + } + }; +} + +// (24:4) {:else} +function create_else_block(ctx) { + let div; + let pre; + let t_value = /*buildNewItem*/ ctx[6](/*newItem*/ ctx[5], /*hnItem*/ ctx[2].depth - 4, true) + ""; + let t; + + return { + c() { + div = element("div"); + pre = element("pre"); + t = text(t_value); + attr(pre, "class", "svelte-13g4k7i"); + }, + m(target, anchor) { + insert(target, div, anchor); + append(div, pre); + append(pre, t); + }, + p(ctx, dirty) { + if (dirty & /*newItem, hnItem*/ 36 && t_value !== (t_value = /*buildNewItem*/ ctx[6](/*newItem*/ ctx[5], /*hnItem*/ ctx[2].depth - 4, true) + "")) set_data(t, t_value); + }, + d(detaching) { + if (detaching) detach(div); + } + }; +} + +// (22:4) {#if hnItem.depth === 0} +function create_if_block_3(ctx) { + let div; + + return { + c() { + div = element("div"); + div.textContent = "Can't add parent to top level item, choose another direction"; + }, + m(target, anchor) { + insert(target, div, anchor); + }, + p: noop, + d(detaching) { + if (detaching) detach(div); + } + }; +} + +// (43:27) +function create_if_block_1(ctx) { + let div; + let pre; + let t_value = /*buildNewItem*/ ctx[6](/*newItem*/ ctx[5], /*hnItem*/ ctx[2].depth + 4, true) + ""; + let t; + + return { + c() { + div = element("div"); + pre = element("pre"); + t = text(t_value); + attr(pre, "class", "svelte-13g4k7i"); + }, + m(target, anchor) { + insert(target, div, anchor); + append(div, pre); + append(pre, t); + }, + p(ctx, dirty) { + if (dirty & /*newItem, hnItem*/ 36 && t_value !== (t_value = /*buildNewItem*/ ctx[6](/*newItem*/ ctx[5], /*hnItem*/ ctx[2].depth + 4, true) + "")) set_data(t, t_value); + }, + d(detaching) { + if (detaching) detach(div); + } + }; +} + +// (37:2) {#if rel === "same"} +function create_if_block(ctx) { + let div; + let pre; + let t_value = /*buildNewItem*/ ctx[6](/*newItem*/ ctx[5], /*hnItem*/ ctx[2].depth, true) + ""; + let t; + + return { + c() { + div = element("div"); + pre = element("pre"); + t = text(t_value); + attr(pre, "class", "svelte-13g4k7i"); + }, + m(target, anchor) { + insert(target, div, anchor); + append(div, pre); + append(pre, t); + }, + p(ctx, dirty) { + if (dirty & /*newItem, hnItem*/ 36 && t_value !== (t_value = /*buildNewItem*/ ctx[6](/*newItem*/ ctx[5], /*hnItem*/ ctx[2].depth, true) + "")) set_data(t, t_value); + }, + d(detaching) { + if (detaching) detach(div); + } + }; +} + +function create_fragment(ctx) { + let h5; + let t0; + let t1_value = ARROW_DIRECTIONS[/*rel*/ ctx[0]] + ""; + let t1; + let t2; + let t3_value = dropWikilinks(/*hnItem*/ ctx[2].line) + ""; + let t3; + let t4; + let div1; + let t5; + let div0; + let pre; + let strong; + let t6_value = /*buildNewItem*/ ctx[6](dropWikilinks(/*hnItem*/ ctx[2].line), /*hnItem*/ ctx[2].depth, true) + ""; + let t6; + let t7; + let t8; + let select; + let option0; + let option1; + let option2; + let t12; + let input; + let t13; + let button; + let mounted; + let dispose; + let if_block0 = /*rel*/ ctx[0] === "up" && create_if_block_2(ctx); + + function select_block_type_1(ctx, dirty) { + if (/*rel*/ ctx[0] === "same") return create_if_block; + if (/*rel*/ ctx[0] === "down") return create_if_block_1; + } + + let current_block_type = select_block_type_1(ctx); + let if_block1 = current_block_type && current_block_type(ctx); + + return { + c() { + h5 = element("h5"); + t0 = text("Add an "); + t1 = text(t1_value); + t2 = text(" to "); + t3 = text(t3_value); + t4 = space(); + div1 = element("div"); + if (if_block0) if_block0.c(); + t5 = space(); + div0 = element("div"); + pre = element("pre"); + strong = element("strong"); + t6 = text(t6_value); + t7 = space(); + if (if_block1) if_block1.c(); + t8 = space(); + select = element("select"); + option0 = element("option"); + option0.textContent = "up"; + option1 = element("option"); + option1.textContent = "same"; + option2 = element("option"); + option2.textContent = "down"; + t12 = space(); + input = element("input"); + t13 = space(); + button = element("button"); + button.textContent = "Add"; + attr(pre, "class", "svelte-13g4k7i"); + option0.__value = "up"; + option0.value = option0.__value; + option1.__value = "same"; + option1.value = option1.__value; + option2.__value = "down"; + option2.value = option2.__value; + attr(select, "class", "dropdown"); + attr(select, "width", "1"); + if (/*rel*/ ctx[0] === void 0) add_render_callback(() => /*select_change_handler*/ ctx[8].call(select)); + attr(input, "type", "text"); + attr(input, "placeholder", "New item"); + }, + m(target, anchor) { + insert(target, h5, anchor); + append(h5, t0); + append(h5, t1); + append(h5, t2); + append(h5, t3); + insert(target, t4, anchor); + insert(target, div1, anchor); + if (if_block0) if_block0.m(div1, null); + append(div1, t5); + append(div1, div0); + append(div0, pre); + append(pre, strong); + append(strong, t6); + append(div1, t7); + if (if_block1) if_block1.m(div1, null); + append(div1, t8); + append(div1, select); + append(select, option0); + append(select, option1); + append(select, option2); + select_option(select, /*rel*/ ctx[0]); + append(div1, t12); + append(div1, input); + /*input_binding*/ ctx[9](input); + set_input_value(input, /*newItem*/ ctx[5]); + append(div1, t13); + append(div1, button); + + if (!mounted) { + dispose = [ + listen(select, "change", /*select_change_handler*/ ctx[8]), + listen(input, "input", /*input_input_handler*/ ctx[10]), + listen(button, "click", /*click_handler*/ ctx[11]) + ]; + + mounted = true; + } + }, + p(ctx, [dirty]) { + if (dirty & /*rel*/ 1 && t1_value !== (t1_value = ARROW_DIRECTIONS[/*rel*/ ctx[0]] + "")) set_data(t1, t1_value); + if (dirty & /*hnItem*/ 4 && t3_value !== (t3_value = dropWikilinks(/*hnItem*/ ctx[2].line) + "")) set_data(t3, t3_value); + + if (/*rel*/ ctx[0] === "up") { + if (if_block0) { + if_block0.p(ctx, dirty); + } else { + if_block0 = create_if_block_2(ctx); + if_block0.c(); + if_block0.m(div1, t5); + } + } else if (if_block0) { + if_block0.d(1); + if_block0 = null; + } + + if (dirty & /*hnItem*/ 4 && t6_value !== (t6_value = /*buildNewItem*/ ctx[6](dropWikilinks(/*hnItem*/ ctx[2].line), /*hnItem*/ ctx[2].depth, true) + "")) set_data(t6, t6_value); + + if (current_block_type === (current_block_type = select_block_type_1(ctx)) && if_block1) { + if_block1.p(ctx, dirty); + } else { + if (if_block1) if_block1.d(1); + if_block1 = current_block_type && current_block_type(ctx); + + if (if_block1) { + if_block1.c(); + if_block1.m(div1, t8); + } + } + + if (dirty & /*rel*/ 1) { + select_option(select, /*rel*/ ctx[0]); + } + + if (dirty & /*newItem*/ 32 && input.value !== /*newItem*/ ctx[5]) { + set_input_value(input, /*newItem*/ ctx[5]); + } + }, + i: noop, + o: noop, + d(detaching) { + if (detaching) detach(h5); + if (detaching) detach(t4); + if (detaching) detach(div1); + if (if_block0) if_block0.d(); + + if (if_block1) { + if_block1.d(); + } + + /*input_binding*/ ctx[9](null); + mounted = false; + run_all(dispose); + } + }; +} + +function instance($$self, $$props, $$invalidate) { + + + let { modal } = $$props; + let { settings } = $$props; + let { hnItem } = $$props; + let { file } = $$props; + let { rel } = $$props; + let inputEl; + let newItem = ""; + const buildNewItem = (newItem, depth = hnItem.depth, preview = false) => `${(" ").repeat(Math.round(depth / (preview ? 2 : 1)))}- ${preview ? newItem || "" : makeWiki(newItem)}`; + onMount(() => inputEl.focus()); + + function select_change_handler() { + rel = select_value(this); + $$invalidate(0, rel); + } + + function input_binding($$value) { + binding_callbacks[$$value ? "unshift" : "push"](() => { + inputEl = $$value; + $$invalidate(4, inputEl); + }); + } + + function input_input_handler() { + newItem = this.value; + $$invalidate(5, newItem); + } + + const click_handler = async e => { + if (rel === "up" && hnItem.depth === 0) { + new require$$0.Notice("Can't add parent to top level item, choose another direction"); + return; + } else { + try { + const content = await modal.app.vault.read(file); + const lines = content.split("\n"); + const lineNo = rel === "up" ? hnItem.lineNo : hnItem.lineNo + 1; + + const depth = rel === "up" + ? hnItem.depth - 4 + : rel === "down" ? hnItem.depth + 4 : hnItem.depth; + + lines.splice(lineNo, 0, buildNewItem(newItem, depth)); + await modal.app.vault.modify(file, lines.join("\n")); + modal.close(); + } catch(err) { + console$1.error(err); + new require$$0.Notice("An error occured, please check the console"); + } + } + }; + + $$self.$$set = $$props => { + if ("modal" in $$props) $$invalidate(1, modal = $$props.modal); + if ("settings" in $$props) $$invalidate(7, settings = $$props.settings); + if ("hnItem" in $$props) $$invalidate(2, hnItem = $$props.hnItem); + if ("file" in $$props) $$invalidate(3, file = $$props.file); + if ("rel" in $$props) $$invalidate(0, rel = $$props.rel); + }; + + return [ + rel, + modal, + hnItem, + file, + inputEl, + newItem, + buildNewItem, + settings, + select_change_handler, + input_binding, + input_input_handler, + click_handler + ]; +} + +class ModifyHNItemComp extends SvelteComponent { + constructor(options) { + super(); + if (!document.getElementById("svelte-13g4k7i-style")) add_css(); + + init(this, options, instance, create_fragment, safe_not_equal, { + modal: 1, + settings: 7, + hnItem: 2, + file: 3, + rel: 0 + }); + } +} + +class ModifyHierItemModal extends require$$0.Modal { + constructor(app, plugin, hnItem, file, rel) { + super(app); + this.plugin = plugin; + this.modal = this; + this.hnItem = hnItem; + this.file = file; + this.rel = rel; + } + onOpen() { + const { contentEl } = this; + contentEl.empty(); + new ModifyHNItemComp({ + target: contentEl, + props: { + modal: this, + settings: this.plugin.settings, + hnItem: this.hnItem, + file: this.file, + rel: this.rel, + }, + }); + } + onClose() { + this.contentEl.empty(); + } +} + +class HierarchyNoteManipulator extends require$$0.FuzzySuggestModal { + constructor(app, plugin, hierNoteName) { + super(app); + this.app = app; + this.plugin = plugin; + this.settings = this.plugin.settings; + this.hierNoteName = hierNoteName; + const chooseOverride = (evt) => { + // @ts-ignore + this.chooser.useSelectedItem(evt); + return false; + }; + this.scope.register([], "Delete", chooseOverride); + this.scope.register(["Shift"], "ArrowUp", chooseOverride); + this.scope.register(["Shift"], "ArrowRight", chooseOverride); + this.scope.register(["Shift"], "ArrowDown", chooseOverride); + } + async onOpen() { + this.setPlaceholder("HN Manipulator"); + this.setInstructions([ + { command: "Enter/Click", purpose: "Jump to item" }, + { command: "Shift + ↑", purpose: "Add parent" }, + { command: "Shift + →", purpose: "Add sibling" }, + { command: "Shift + ↓", purpose: "Add child" }, + { command: "Delete", purpose: "Delete item" }, + ]); + this.file = this.app.metadataCache.getFirstLinkpathDest(this.hierNoteName, ""); + if (!this.file) + this.lines = []; + const content = await this.app.vault.cachedRead(this.file); + this.lines = content.split("\n"); + this.listItems = this.app.metadataCache.getFileCache(this.file).listItems; + super.onOpen(); + } + getItems() { + const items = this.listItems + .map((item) => { + const i = item.position.start.line; + return { i, line: this.lines[i] }; + }) + .map((item) => { + const splits = item.line.split("- "); + const depth = splits[0].length; + const line = splits.slice(1).join("- "); + return { depth, line, lineNo: item.i }; + }); + return items; + } + getItemText(item) { + return `${" ".repeat(item.depth)}- ${dropWikilinks(item.line)}`; + } + renderSuggestion(item, el) { + super.renderSuggestion(item, el); + el.innerText = `${" ".repeat(item.item.depth)}- ${dropWikilinks(item.item.line)}`; + } + async deleteItem(item) { + try { + this.lines.splice(item.lineNo, 1); + this.listItems.splice(item.lineNo, 1); + await this.app.vault.modify(this.file, this.lines.join("\n")); + new require$$0.Notice("Item deleted Succesfully"); + } + catch (err) { + loglevel.error(err); + new require$$0.Notice("An error occured. Please check the console"); + } + } + onChooseItem(item, evt) { + if (evt instanceof KeyboardEvent && evt.key === "Delete") { + this.deleteItem(item); + } + else if (evt instanceof KeyboardEvent && evt.shiftKey) { + const rel = evt.key === "ArrowUp" + ? "up" + : evt.key === "ArrowDown" + ? "down" + : "same"; + new ModifyHierItemModal(this.app, this.plugin, item, this.file, rel).open(); + this.close(); + } + else { + const view = this.app.workspace.getActiveViewOfType(require$$0.MarkdownView); + const { editor } = view !== null && view !== void 0 ? view : {}; + if (!editor) + return; + //@ts-ignore + view.leaf.openFile(this.file, { active: true, mode: "source" }); + editor.setCursor({ line: item.lineNo, ch: item.depth + 2 }); + } + } +} + +class HierarchyNoteSelectorModal extends require$$0.FuzzySuggestModal { + constructor(app, plugin) { + super(app); + this.app = app; + this.plugin = plugin; + this.settings = this.plugin.settings; + } + onOpen() { + this.setPlaceholder("HN Chooser"); + const { hierarchyNotes } = this.settings; + if (hierarchyNotes.length === 0) { + this.close(); + new require$$0.Notice("No hierarchy notes found"); + } + else if (hierarchyNotes.length === 1) { + this.close(); + new HierarchyNoteManipulator(this.app, this.plugin, hierarchyNotes[0]).open(); + } + else { + super.onOpen(); + } + } + getItems() { + return this.settings.hierarchyNotes; + } + getItemText(item) { + return `${item}`; + } + renderSuggestion(item, el) { + super.renderSuggestion(item, el); + } + onChooseItem(item, evt) { + new HierarchyNoteManipulator(this.app, this.plugin, item).open(); + this.close(); + } +} + class BCPlugin extends require$$0.Plugin { constructor() { super(...arguments); @@ -49625,7 +50222,6 @@ class BCPlugin extends require$$0.Plugin { } } async onload() { - var _a; console.log("loading breadcrumbs plugin"); await this.loadSettings(); const { settings } = this; @@ -49690,34 +50286,21 @@ class BCPlugin extends require$$0.Plugin { require$$0.addIcon(TRAIL_ICON, TRAIL_ICON_SVG); await this.waitForCache(); this.mainG = await this.initGraphs(); - if (((_a = this.mainG) === null || _a === void 0 ? void 0 : _a.nodes.length) === 0) { - await wait(3000); - await this.refreshIndex(); - } - for (const { openOnLoad, type, constructor } of this.VIEWS) { - if (openOnLoad) - await openView(this.app, type, constructor); - } - if (settings.showBCs) - await this.drawTrail(); this.app.workspace.onLayoutReady(async () => { + var _a; + const noFiles = this.app.vault.getMarkdownFiles().length; + if (((_a = this.mainG) === null || _a === void 0 ? void 0 : _a.nodes().length) < noFiles) { + await wait(3000); + this.mainG = await this.initGraphs(); + } + for (const { openOnLoad, type, constructor } of this.VIEWS) { + if (openOnLoad) + await openView(this.app, type, constructor); + } + if (settings.showBCs) + await this.drawTrail(); this.registerActiveLeafChangeEvent(); this.registerLayoutChangeEvent(); - // if (this.app.plugins.enabledPlugins.has("dataview")) { - // const api = this.app.plugins.plugins.dataview?.api; - // if (api) { - // await this.initEverything(); - // } else { - // this.registerEvent( - // this.app.metadataCache.on("dataview:api-ready", async () => { - // await this.initEverything(); - // }) - // ); - // } - // } else { - // await waitForResolvedLinks(this.app); - // await this.initEverything(); - // } }); for (const { type, plain, constructor } of this.VIEWS) { this.addCommand({ @@ -49739,6 +50322,11 @@ class BCPlugin extends require$$0.Plugin { new VisModal(this.app, this).open(); }, }); + this.addCommand({ + id: "manipulate-hierarchy-notes", + name: "Adjust Hierarchy Notes", + callback: () => new HierarchyNoteSelectorModal(this.app, this).open(), + }); this.addCommand({ id: "Refresh-Breadcrumbs-Index", name: "Refresh Breadcrumbs Index", diff --git a/src/main.ts b/src/main.ts index 6cb742df..ae465f0f 100644 --- a/src/main.ts +++ b/src/main.ts @@ -223,36 +223,20 @@ export default class BCPlugin extends Plugin { await this.waitForCache(); this.mainG = await this.initGraphs(); - if (this.mainG?.nodes.length === 0) { - await wait(3000); - await this.refreshIndex(); - } - - for (const { openOnLoad, type, constructor } of this.VIEWS) { - if (openOnLoad) await openView(this.app, type, constructor); - } + this.app.workspace.onLayoutReady(async () => { + const noFiles = this.app.vault.getMarkdownFiles().length; + if (this.mainG?.nodes().length < noFiles) { + await wait(3000); + this.mainG = await this.initGraphs(); + } - if (settings.showBCs) await this.drawTrail(); + for (const { openOnLoad, type, constructor } of this.VIEWS) { + if (openOnLoad) await openView(this.app, type, constructor); + } - this.app.workspace.onLayoutReady(async () => { + if (settings.showBCs) await this.drawTrail(); this.registerActiveLeafChangeEvent(); this.registerLayoutChangeEvent(); - - // if (this.app.plugins.enabledPlugins.has("dataview")) { - // const api = this.app.plugins.plugins.dataview?.api; - // if (api) { - // await this.initEverything(); - // } else { - // this.registerEvent( - // this.app.metadataCache.on("dataview:api-ready", async () => { - // await this.initEverything(); - // }) - // ); - // } - // } else { - // await waitForResolvedLinks(this.app); - // await this.initEverything(); - // } }); for (const { type, plain, constructor } of this.VIEWS) {