From ec65f689e46d1ed3305fea5a892236dd9c45fedd Mon Sep 17 00:00:00 2001 From: Ross Keenan Date: Sat, 20 Nov 2021 20:07:04 +0200 Subject: [PATCH] feat(DucksView): :sparkles: Filter nodes with regex --- main.js | 530 +++++++++++++++++++++++++----------- src/Components/Ducks.svelte | 52 +++- src/main.ts | 9 +- 3 files changed, 419 insertions(+), 172 deletions(-) diff --git a/main.js b/main.js index 784ec264..ef0ef1e4 100644 --- a/main.js +++ b/main.js @@ -2949,30 +2949,246 @@ class SvelteComponent { } } +/* node_modules\svelte-icons\components\IconBase.svelte generated by Svelte v3.35.0 */ + +function add_css$8() { + 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%}"; + append(document.head, style); +} + +// (18:2) {#if title} +function create_if_block$4(ctx) { + let title_1; + let t; + + return { + c() { + title_1 = svg_element("title"); + t = text(/*title*/ ctx[0]); + }, + m(target, anchor) { + insert(target, title_1, anchor); + append(title_1, t); + }, + p(ctx, dirty) { + if (dirty & /*title*/ 1) set_data(t, /*title*/ ctx[0]); + }, + d(detaching) { + if (detaching) detach(title_1); + } + }; +} + +function create_fragment$e(ctx) { + let svg; + let if_block_anchor; + let current; + let if_block = /*title*/ ctx[0] && create_if_block$4(ctx); + const default_slot_template = /*#slots*/ ctx[3].default; + const default_slot = create_slot(default_slot_template, ctx, /*$$scope*/ ctx[2], null); + + return { + c() { + svg = svg_element("svg"); + if (if_block) if_block.c(); + if_block_anchor = empty$1(); + if (default_slot) default_slot.c(); + attr(svg, "xmlns", "http://www.w3.org/2000/svg"); + attr(svg, "viewBox", /*viewBox*/ ctx[1]); + attr(svg, "class", "svelte-c8tyih"); + }, + m(target, anchor) { + insert(target, svg, anchor); + if (if_block) if_block.m(svg, null); + append(svg, if_block_anchor); + + if (default_slot) { + default_slot.m(svg, null); + } + + current = true; + }, + p(ctx, [dirty]) { + if (/*title*/ ctx[0]) { + if (if_block) { + if_block.p(ctx, dirty); + } else { + if_block = create_if_block$4(ctx); + if_block.c(); + if_block.m(svg, if_block_anchor); + } + } else if (if_block) { + if_block.d(1); + if_block = null; + } + + if (default_slot) { + if (default_slot.p && dirty & /*$$scope*/ 4) { + update_slot(default_slot, default_slot_template, ctx, /*$$scope*/ ctx[2], dirty, null, null); + } + } + + if (!current || dirty & /*viewBox*/ 2) { + attr(svg, "viewBox", /*viewBox*/ ctx[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 (detaching) detach(svg); + if (if_block) if_block.d(); + if (default_slot) default_slot.d(detaching); + } + }; +} + +function instance$e($$self, $$props, $$invalidate) { + let { $$slots: slots = {}, $$scope } = $$props; + let { title = null } = $$props; + let { viewBox } = $$props; + + $$self.$$set = $$props => { + if ("title" in $$props) $$invalidate(0, title = $$props.title); + if ("viewBox" in $$props) $$invalidate(1, viewBox = $$props.viewBox); + if ("$$scope" in $$props) $$invalidate(2, $$scope = $$props.$$scope); + }; + + return [title, viewBox, $$scope, slots]; +} + +class IconBase extends SvelteComponent { + constructor(options) { + super(); + if (!document.getElementById("svelte-c8tyih-style")) add_css$8(); + init$1(this, options, instance$e, create_fragment$e, safe_not_equal, { title: 0, viewBox: 1 }); + } +} + +/* node_modules\svelte-icons\fa\FaInfo.svelte generated by Svelte v3.35.0 */ + +function create_default_slot$3(ctx) { + let path; + + return { + c() { + path = svg_element("path"); + attr(path, "d", "M20 424.229h20V279.771H20c-11.046 0-20-8.954-20-20V212c0-11.046 8.954-20 20-20h112c11.046 0 20 8.954 20 20v212.229h20c11.046 0 20 8.954 20 20V492c0 11.046-8.954 20-20 20H20c-11.046 0-20-8.954-20-20v-47.771c0-11.046 8.954-20 20-20zM96 0C56.235 0 24 32.235 24 72s32.235 72 72 72 72-32.235 72-72S135.764 0 96 0z"); + }, + m(target, anchor) { + insert(target, path, anchor); + }, + d(detaching) { + if (detaching) detach(path); + } + }; +} + +function create_fragment$d(ctx) { + let iconbase; + let current; + const iconbase_spread_levels = [{ viewBox: "0 0 192 512" }, /*$$props*/ ctx[0]]; + + let iconbase_props = { + $$slots: { default: [create_default_slot$3] }, + $$scope: { ctx } + }; + + for (let i = 0; i < iconbase_spread_levels.length; i += 1) { + iconbase_props = assign(iconbase_props, iconbase_spread_levels[i]); + } + + iconbase = new IconBase({ props: iconbase_props }); + + return { + c() { + create_component(iconbase.$$.fragment); + }, + m(target, anchor) { + mount_component(iconbase, target, anchor); + current = true; + }, + p(ctx, [dirty]) { + const iconbase_changes = (dirty & /*$$props*/ 1) + ? get_spread_update(iconbase_spread_levels, [iconbase_spread_levels[0], get_spread_object(/*$$props*/ ctx[0])]) + : {}; + + if (dirty & /*$$scope*/ 2) { + iconbase_changes.$$scope = { dirty, ctx }; + } + + iconbase.$set(iconbase_changes); + }, + i(local) { + if (current) return; + transition_in(iconbase.$$.fragment, local); + current = true; + }, + o(local) { + transition_out(iconbase.$$.fragment, local); + current = false; + }, + d(detaching) { + destroy_component(iconbase, detaching); + } + }; +} + +function instance$d($$self, $$props, $$invalidate) { + $$self.$$set = $$new_props => { + $$invalidate(0, $$props = assign(assign({}, $$props), exclude_internal_props($$new_props))); + }; + + $$props = exclude_internal_props($$props); + return [$$props]; +} + +class FaInfo extends SvelteComponent { + constructor(options) { + super(); + init$1(this, options, instance$d, create_fragment$d, safe_not_equal, {}); + } +} + /* src\Components\Ducks.svelte generated by Svelte v3.35.0 */ +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}"; + append(document.head, style); +} + function get_each_context$8(ctx, list, i) { const child_ctx = ctx.slice(); - child_ctx[8] = list[i]; + child_ctx[13] = list[i]; return child_ctx; } -// (17:2) {#each ducks as duck} +// (48:2) {#each ducks as duck} function create_each_block$8(ctx) { let div; let a; - let t0_value = /*duck*/ ctx[8] + ""; + let t0_value = /*duck*/ ctx[13] + ""; let t0; let t1; let mounted; let dispose; function click_handler(...args) { - return /*click_handler*/ ctx[4](/*duck*/ ctx[8], ...args); + return /*click_handler*/ ctx[9](/*duck*/ ctx[13], ...args); } function mouseover_handler(...args) { - return /*mouseover_handler*/ ctx[5](/*duck*/ ctx[8], ...args); + return /*mouseover_handler*/ ctx[10](/*duck*/ ctx[13], ...args); } return { @@ -3000,6 +3216,7 @@ function create_each_block$8(ctx) { }, p(new_ctx, dirty) { ctx = new_ctx; + if (dirty & /*ducks*/ 16 && t0_value !== (t0_value = /*duck*/ ctx[13] + "")) set_data(t0, t0_value); }, d(detaching) { if (detaching) detach(div); @@ -3009,11 +3226,24 @@ function create_each_block$8(ctx) { }; } -function create_fragment$d(ctx) { +function create_fragment$c(ctx) { let div; let h6; let t1; - let each_value = /*ducks*/ ctx[2]; + let span; + let fainfo; + let t2; + let label; + let t4; + let input0; + let t5; + let input1; + let t6; + let current; + let mounted; + let dispose; + fainfo = new FaInfo({}); + let each_value = /*ducks*/ ctx[4]; let each_blocks = []; for (let i = 0; i < each_value.length; i += 1) { @@ -3026,25 +3256,73 @@ function create_fragment$d(ctx) { h6 = element("h6"); h6.textContent = "Notes without Breadcrumbs"; t1 = space(); + span = element("span"); + create_component(fainfo.$$.fragment); + t2 = space(); + label = element("label"); + label.textContent = "Filter:"; + t4 = space(); + input0 = element("input"); + t5 = space(); + input1 = element("input"); + t6 = space(); for (let i = 0; i < each_blocks.length; i += 1) { each_blocks[i].c(); } + attr(span, "class", "icon svelte-gmdm3a"); + attr(span, "aria-label", `A Regex used to filter the results.\nIf 'Include' is checked, it will only show notes that match the regex.\nIf 'Include' is not checked, this regex will filter out notes that match it.`); + attr(label, "for", "regex"); + attr(input0, "type", "text"); + attr(input0, "name", "regex"); + attr(input0, "placeholder", "Regex"); + input0.value = /*query*/ ctx[2]; + attr(input1, "aria-label", "Include"); + attr(input1, "type", "checkbox"); + input1.checked = /*include*/ ctx[3]; attr(div, "class", "BC-Ducks markdown-preview-view"); }, m(target, anchor) { insert(target, div, anchor); append(div, h6); append(div, t1); + append(div, span); + mount_component(fainfo, span, null); + append(div, t2); + append(div, label); + append(div, t4); + append(div, input0); + append(div, t5); + append(div, input1); + append(div, t6); for (let i = 0; i < each_blocks.length; i += 1) { each_blocks[i].m(div, null); } + + current = true; + + if (!mounted) { + dispose = [ + listen(input0, "change", /*change_handler*/ ctx[7]), + listen(input1, "change", /*change_handler_1*/ ctx[8]) + ]; + + mounted = true; + } }, p(ctx, [dirty]) { - if (dirty & /*openOrSwitch, app, ducks, hoverPreview, ducksView*/ 7) { - each_value = /*ducks*/ ctx[2]; + if (!current || dirty & /*query*/ 4 && input0.value !== /*query*/ ctx[2]) { + input0.value = /*query*/ ctx[2]; + } + + if (!current || dirty & /*include*/ 8) { + input1.checked = /*include*/ ctx[3]; + } + + if (dirty & /*openOrSwitch, app, ducks, hoverPreview, ducksView*/ 19) { + each_value = /*ducks*/ ctx[4]; let i; for (i = 0; i < each_value.length; i += 1) { @@ -3066,16 +3344,26 @@ function create_fragment$d(ctx) { each_blocks.length = each_value.length; } }, - i: noop$1, - o: noop$1, + i(local) { + if (current) return; + transition_in(fainfo.$$.fragment, local); + current = true; + }, + o(local) { + transition_out(fainfo.$$.fragment, local); + current = false; + }, d(detaching) { if (detaching) detach(div); + destroy_component(fainfo); destroy_each(each_blocks, detaching); + mounted = false; + run_all(dispose); } }; } -function instance$d($$self, $$props, $$invalidate) { +function instance$c($$self, $$props, $$invalidate) { @@ -3084,23 +3372,57 @@ function instance$d($$self, $$props, $$invalidate) { let { ducksView } = $$props; const { mainG } = plugin; const files = app.vault.getMarkdownFiles(); - const ducks = files.map(file => file.basename).filter(name => !mainG.neighbors(name).length); + let query = ""; + let include = true; + let regex = new RegExp(query, "g"); + let ducks = files.map(file => file.basename).filter(name => !mainG.neighbors(name).length && include === regex.test(name)); + const change_handler = e => $$invalidate(2, query = e.target.value); + const change_handler_1 = e => $$invalidate(3, include = e.target.checked); const click_handler = async (duck, e) => await openOrSwitch$1(app, duck, e); const mouseover_handler = (duck, e) => hoverPreview$1(e, ducksView, duck); $$self.$$set = $$props => { - if ("plugin" in $$props) $$invalidate(3, plugin = $$props.plugin); + if ("plugin" in $$props) $$invalidate(5, plugin = $$props.plugin); if ("app" in $$props) $$invalidate(0, app = $$props.app); if ("ducksView" in $$props) $$invalidate(1, ducksView = $$props.ducksView); }; - return [app, ducksView, ducks, plugin, click_handler, mouseover_handler]; + $$self.$$.update = () => { + if ($$self.$$.dirty & /*query*/ 4) { + $$invalidate(6, regex = new RegExp(query, "g")); + } + + if ($$self.$$.dirty & /*include, regex*/ 72) { + { + $$invalidate(4, ducks = files.map(file => file.basename).filter(name => !mainG.neighbors(name).length && include === regex.test(name))); + } + } + + if ($$self.$$.dirty & /*ducks, query, include, regex*/ 92) { + console.log({ ducks, query, include, regex }); + } + }; + + return [ + app, + ducksView, + query, + include, + ducks, + plugin, + regex, + change_handler, + change_handler_1, + click_handler, + mouseover_handler + ]; } class Ducks extends SvelteComponent { constructor(options) { super(); - init$1(this, options, instance$d, create_fragment$d, safe_not_equal, { plugin: 3, app: 0, ducksView: 1 }); + if (!document.getElementById("svelte-gmdm3a-style")) add_css$7(); + init$1(this, options, instance$c, create_fragment$c, safe_not_equal, { plugin: 5, app: 0, ducksView: 1 }); } } @@ -20994,7 +21316,7 @@ function getRealnImplied(plugin, currNode, dir = null) { /* src\Components\Lists.svelte generated by Svelte v3.35.0 */ -function add_css$7() { +function add_css$6() { var style = element("style"); style.id = "svelte-ifpk85-style"; style.textContent = "summary.hier-summary.svelte-ifpk85{color:var(--text-title-h2);font-size:larger}summary.svelte-ifpk85{color:var(--text-title-h3)}h5.BC-header.svelte-ifpk85{color:var(--text-title-h5)}ol.markdown-preview-view.svelte-ifpk85{padding-top:3px;padding-bottom:5px}"; @@ -21026,7 +21348,7 @@ function get_each_context_3$2(ctx, list, i) { } // (20:8) {#if square.realItems.length > 0 || square.impliedItems.length > 0} -function create_if_block$4(ctx) { +function create_if_block$3(ctx) { let details; let summary; let t0_value = /*square*/ ctx[12].field + ""; @@ -21410,7 +21732,7 @@ function create_each_block_2$3(ctx) { // (19:6) {#each squares as square} function create_each_block_1$7(ctx) { let if_block_anchor; - let if_block = (/*square*/ ctx[12].realItems.length > 0 || /*square*/ ctx[12].impliedItems.length > 0) && create_if_block$4(ctx); + let if_block = (/*square*/ ctx[12].realItems.length > 0 || /*square*/ ctx[12].impliedItems.length > 0) && create_if_block$3(ctx); return { c() { @@ -21426,7 +21748,7 @@ function create_each_block_1$7(ctx) { if (if_block) { if_block.p(ctx, dirty); } else { - if_block = create_if_block$4(ctx); + if_block = create_if_block$3(ctx); if_block.c(); if_block.m(if_block_anchor.parentNode, if_block_anchor); } @@ -21517,7 +21839,7 @@ function create_each_block$7(ctx) { }; } -function create_fragment$c(ctx) { +function create_fragment$b(ctx) { let div; let each_value = /*filteredSquaresArr*/ ctx[0]; let each_blocks = []; @@ -21578,7 +21900,7 @@ function create_fragment$c(ctx) { const func = square => square.field; -function instance$c($$self, $$props, $$invalidate) { +function instance$b($$self, $$props, $$invalidate) { @@ -21616,9 +21938,9 @@ function instance$c($$self, $$props, $$invalidate) { class Lists extends SvelteComponent { constructor(options) { super(); - if (!document.getElementById("svelte-ifpk85-style")) add_css$7(); + if (!document.getElementById("svelte-ifpk85-style")) add_css$6(); - init$1(this, options, instance$c, create_fragment$c, safe_not_equal, { + init$1(this, options, instance$b, create_fragment$b, safe_not_equal, { filteredSquaresArr: 0, currFile: 1, settings: 2, @@ -21630,7 +21952,7 @@ class Lists extends SvelteComponent { /* src\Components\Matrix.svelte generated by Svelte v3.35.0 */ -function add_css$6() { +function add_css$5() { var style = element("style"); style.id = "svelte-1wt9kkm-style"; style.textContent = "div.BC-Matrix.svelte-1wt9kkm.svelte-1wt9kkm{padding:5px}div.BC-Matrix.svelte-1wt9kkm>div.svelte-1wt9kkm{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-1wt9kkm.svelte-1wt9kkm{border:1px solid var(--background-modifier-border)}.BC-Matrix-header.svelte-1wt9kkm.svelte-1wt9kkm{margin:2px}h3.BC-Matrix-header.svelte-1wt9kkm.svelte-1wt9kkm{color:var(--text-title-h3)}h5.BC-Matrix-header.svelte-1wt9kkm.svelte-1wt9kkm{color:var(--text-title-h5)}ol.svelte-1wt9kkm.svelte-1wt9kkm{margin:3px;padding-left:20px}"; @@ -21662,7 +21984,7 @@ function get_each_context_3$1(ctx, list, i) { } // (17:8) {#if square.realItems.length > 0 || square.impliedItems.length > 0} -function create_if_block$3(ctx) { +function create_if_block$2(ctx) { let div; let h3; let t0_value = /*square*/ ctx[12].field + ""; @@ -22045,7 +22367,7 @@ function create_each_block_2$2(ctx) { // (16: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$2(ctx); return { c() { @@ -22061,7 +22383,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$2(ctx); if_block.c(); if_block.m(if_block_anchor.parentNode, if_block_anchor); } @@ -22139,7 +22461,7 @@ function create_each_block$6(ctx) { }; } -function create_fragment$b(ctx) { +function create_fragment$a(ctx) { let div; let each_value = /*filteredSquaresArr*/ ctx[0]; let each_blocks = []; @@ -22198,7 +22520,7 @@ function create_fragment$b(ctx) { }; } -function instance$b($$self, $$props, $$invalidate) { +function instance$a($$self, $$props, $$invalidate) { @@ -22237,9 +22559,9 @@ function instance$b($$self, $$props, $$invalidate) { class Matrix extends SvelteComponent { constructor(options) { super(); - if (!document.getElementById("svelte-1wt9kkm-style")) add_css$6(); + if (!document.getElementById("svelte-1wt9kkm-style")) add_css$5(); - init$1(this, options, instance$b, create_fragment$b, safe_not_equal, { + init$1(this, options, instance$a, create_fragment$a, safe_not_equal, { filteredSquaresArr: 0, currFile: 1, settings: 2, @@ -22536,7 +22858,7 @@ class MatrixView extends obsidian.ItemView { /* src\Components\Stats.svelte generated by Svelte v3.35.0 */ -function add_css$5() { +function add_css$4() { 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}"; @@ -23177,7 +23499,7 @@ function create_each_block$5(ctx) { }; } -function create_fragment$a(ctx) { +function create_fragment$9(ctx) { let table; let thead; let tr0; @@ -23507,7 +23829,7 @@ function create_fragment$a(ctx) { }; } -function instance$a($$self, $$props, $$invalidate) { +function instance$9($$self, $$props, $$invalidate) { let { plugin } = $$props; @@ -23628,8 +23950,8 @@ function instance$a($$self, $$props, $$invalidate) { class Stats extends SvelteComponent { constructor(options) { super(); - if (!document.getElementById("svelte-rb5mhu-style")) add_css$5(); - init$1(this, options, instance$a, create_fragment$a, safe_not_equal, { plugin: 4 }, [-1, -1]); + if (!document.getElementById("svelte-rb5mhu-style")) add_css$4(); + init$1(this, options, instance$9, create_fragment$9, safe_not_equal, { plugin: 4 }, [-1, -1]); } } @@ -23790,7 +24112,7 @@ const DEFAULT_SETTINGS = { /* src\Components\KoFi.svelte generated by Svelte v3.35.0 */ -function create_fragment$9(ctx) { +function create_fragment$8(ctx) { let script; let script_src_value; let t; @@ -23831,7 +24153,7 @@ function create_fragment$9(ctx) { }; } -function instance$9($$self, $$props, $$invalidate) { +function instance$8($$self, $$props, $$invalidate) { let button; var initializeKofi = () => { @@ -23852,131 +24174,7 @@ function instance$9($$self, $$props, $$invalidate) { class KoFi extends SvelteComponent { constructor(options) { super(); - init$1(this, options, instance$9, create_fragment$9, safe_not_equal, {}); - } -} - -/* node_modules\svelte-icons\components\IconBase.svelte generated by Svelte v3.35.0 */ - -function add_css$4() { - 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%}"; - append(document.head, style); -} - -// (18:2) {#if title} -function create_if_block$2(ctx) { - let title_1; - let t; - - return { - c() { - title_1 = svg_element("title"); - t = text(/*title*/ ctx[0]); - }, - m(target, anchor) { - insert(target, title_1, anchor); - append(title_1, t); - }, - p(ctx, dirty) { - if (dirty & /*title*/ 1) set_data(t, /*title*/ ctx[0]); - }, - d(detaching) { - if (detaching) detach(title_1); - } - }; -} - -function create_fragment$8(ctx) { - let svg; - let if_block_anchor; - let current; - let if_block = /*title*/ ctx[0] && create_if_block$2(ctx); - const default_slot_template = /*#slots*/ ctx[3].default; - const default_slot = create_slot(default_slot_template, ctx, /*$$scope*/ ctx[2], null); - - return { - c() { - svg = svg_element("svg"); - if (if_block) if_block.c(); - if_block_anchor = empty$1(); - if (default_slot) default_slot.c(); - attr(svg, "xmlns", "http://www.w3.org/2000/svg"); - attr(svg, "viewBox", /*viewBox*/ ctx[1]); - attr(svg, "class", "svelte-c8tyih"); - }, - m(target, anchor) { - insert(target, svg, anchor); - if (if_block) if_block.m(svg, null); - append(svg, if_block_anchor); - - if (default_slot) { - default_slot.m(svg, null); - } - - current = true; - }, - p(ctx, [dirty]) { - if (/*title*/ ctx[0]) { - if (if_block) { - if_block.p(ctx, dirty); - } else { - if_block = create_if_block$2(ctx); - if_block.c(); - if_block.m(svg, if_block_anchor); - } - } else if (if_block) { - if_block.d(1); - if_block = null; - } - - if (default_slot) { - if (default_slot.p && dirty & /*$$scope*/ 4) { - update_slot(default_slot, default_slot_template, ctx, /*$$scope*/ ctx[2], dirty, null, null); - } - } - - if (!current || dirty & /*viewBox*/ 2) { - attr(svg, "viewBox", /*viewBox*/ ctx[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 (detaching) detach(svg); - if (if_block) if_block.d(); - if (default_slot) default_slot.d(detaching); - } - }; -} - -function instance$8($$self, $$props, $$invalidate) { - let { $$slots: slots = {}, $$scope } = $$props; - let { title = null } = $$props; - let { viewBox } = $$props; - - $$self.$$set = $$props => { - if ("title" in $$props) $$invalidate(0, title = $$props.title); - if ("viewBox" in $$props) $$invalidate(1, viewBox = $$props.viewBox); - if ("$$scope" in $$props) $$invalidate(2, $$scope = $$props.$$scope); - }; - - return [title, viewBox, $$scope, slots]; -} - -class IconBase extends SvelteComponent { - constructor(options) { - super(); - if (!document.getElementById("svelte-c8tyih-style")) add_css$4(); - init$1(this, options, instance$8, create_fragment$8, safe_not_equal, { title: 0, viewBox: 1 }); + init$1(this, options, instance$8, create_fragment$8, safe_not_equal, {}); } } @@ -35506,7 +35704,9 @@ class BCPlugin extends obsidian.Plugin { i++; const { node, path } = queue.shift(); const extPath = [node, ...path]; - const succsNotVisited = g.filterOutNeighbors(node, (succ) => !visited.includes(succ)); + const succsNotVisited = g.hasNode(node) + ? g.filterOutNeighbors(node, (succ) => !visited.includes(succ)) + : []; for (const node of succsNotVisited) { visited.push(node); queue.push({ node, path: extPath }); diff --git a/src/Components/Ducks.svelte b/src/Components/Ducks.svelte index 11a9b2cc..a54cd003 100644 --- a/src/Components/Ducks.svelte +++ b/src/Components/Ducks.svelte @@ -3,6 +3,7 @@ import { hoverPreview, openOrSwitch } from "obsidian-community-lib"; import type DucksView from "src/DucksView"; import type BCPlugin from "src/main"; + import FaInfo from "svelte-icons/fa/FaInfo.svelte"; export let plugin: BCPlugin; export let app: App; @@ -11,13 +12,50 @@ const { mainG } = plugin; const files = app.vault.getMarkdownFiles(); - const ducks = files + let query: string = ""; + let include = true; + + let regex = new RegExp(query, "g"); + $: regex = new RegExp(query, "g"); + + let ducks = files .map((file) => file.basename) - .filter((name) => !mainG.neighbors(name).length); + .filter( + (name) => !mainG.neighbors(name).length && include === regex.test(name) + ); + $: console.log({ ducks, query, include, regex }); + + $: { + ducks = files + .map((file) => file.basename) + .filter( + (name) => !mainG.neighbors(name).length && include === regex.test(name) + ); + }
Notes without Breadcrumbs
+ + + + + (query = e.target.value)} + /> + (include = e.target.checked)} + /> {#each ducks as duck}
await openOrSwitch(app, duck, e)} @@ -27,3 +65,13 @@
{/each}
+ + diff --git a/src/main.ts b/src/main.ts index 6239e81f..62b9d734 100644 --- a/src/main.ts +++ b/src/main.ts @@ -530,10 +530,9 @@ export default class BCPlugin extends Plugin { const { node, path } = queue.shift(); const extPath = [node, ...path]; - const succsNotVisited = g.filterOutNeighbors( - node, - (succ) => !visited.includes(succ) - ); + const succsNotVisited = g.hasNode(node) + ? g.filterOutNeighbors(node, (succ) => !visited.includes(succ)) + : []; for (const node of succsNotVisited) { visited.push(node); queue.push({ node, path: extPath }); @@ -577,7 +576,7 @@ export default class BCPlugin extends Plugin { const upFields = getFields(userHierarchies, "up"); const downFields = getFields(userHierarchies, "down"); let subGraph: MultiGraph; - + if (Object.values(limitTrailCheckboxStates).every((val) => val)) { subGraph = getSubForFields(this.mainG, [...upFields, ...downFields]); } else {