Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

no direction #533

Merged
merged 56 commits into from
Apr 23, 2024
Merged
Changes from 1 commit
Commits
Show all changes
56 commits
Select commit Hold shift + click to select a range
4ab2e3f
progress on no-directions
SkepticMystic Apr 13, 2024
6e3825c
Progress on no-dirs
SkepticMystic Apr 13, 2024
4a5b19d
Update tests
SkepticMystic Apr 13, 2024
d3f9cdf
Lots of progress on settings migration
SkepticMystic Apr 13, 2024
4c94644
More migration touchups + edge_field_labels on the Views
SkepticMystic Apr 14, 2024
2f192f8
test: migrate_settings
SkepticMystic Apr 14, 2024
da21c51
Better typing on migrate_settings.old
SkepticMystic Apr 14, 2024
92750d4
Change views over to individual/merge_fields
SkepticMystic Apr 14, 2024
4e5dacd
field_group_labels
SkepticMystic Apr 14, 2024
88cad6c
EdgeFieldSettings
SkepticMystic Apr 14, 2024
e166562
EdgeFieldSettings: dirty flag + rename_field
SkepticMystic Apr 14, 2024
9b69612
Apply field_group_labels to more views + bug fixes on merge_fields ap…
SkepticMystic Apr 14, 2024
cf588cd
Add settings for new options
SkepticMystic Apr 14, 2024
f231a46
field-groups codeblock field
SkepticMystic Apr 14, 2024
5759870
Better styling on EdgeSettings + Jump to field/group
SkepticMystic Apr 16, 2024
49c1048
Touchups from review
SkepticMystic Apr 16, 2024
fa7689d
Fixes after running through each function in test-vault
SkepticMystic Apr 16, 2024
35a9b7b
test: V3 mock data for settings migration
SkepticMystic Apr 16, 2024
6ccf8ce
test: Fix implied_kind
SkepticMystic Apr 16, 2024
e604567
Touch up EdgeSettings
SkepticMystic Apr 16, 2024
a7ba638
Merge branch 'master' into no-direction
SkepticMystic Apr 16, 2024
f6233a9
fix: Missing return value
SkepticMystic Apr 16, 2024
09fe8da
fix: break out of migration
SkepticMystic Apr 16, 2024
b44eb9f
perf: Check if each implied_rule even needs to run each round
SkepticMystic Apr 16, 2024
a7bdbab
fix: Round timer.elapsed() result
SkepticMystic Apr 16, 2024
632134e
Lotsa touchups to edgesettings and transitivesettings
SkepticMystic Apr 17, 2024
5cf7beb
Tidy up some TODOs
SkepticMystic Apr 17, 2024
da4ed35
fix(command:threading): Normalise resolved_target_path
SkepticMystic Apr 17, 2024
7692a46
fix(command:threading): Don't drop_ext on source.basename
SkepticMystic Apr 17, 2024
aff730c
Add hierarchy1 group by default
SkepticMystic Apr 17, 2024
5ffcdd4
Improve traversal alg, don't use all_paths in _most_ places
SkepticMystic Apr 18, 2024
0a27d38
docs: Add credits section to README
SkepticMystic Apr 18, 2024
1cfc696
fix: Button icons show their current state, not where they're going
SkepticMystic Apr 18, 2024
607c52d
Various EdgeFieldSettings + ImpliedSettings improvements and fixes
SkepticMystic Apr 19, 2024
9e73f40
refactor: Extract MermaidDiagram component
SkepticMystic Apr 19, 2024
7228cec
feat: Show Mermaid preview on transitive rule settings
SkepticMystic Apr 19, 2024
ba47ac3
Standardise Paths.basename inline with TFile
SkepticMystic Apr 19, 2024
bd76cfa
test: Cover more utils
SkepticMystic Apr 19, 2024
6198969
fix: Wait for metadatacache init before refreshing
SkepticMystic Apr 21, 2024
34dc110
feat: All button on ShowAttributes selector
SkepticMystic Apr 21, 2024
6e26cba
fix: Actually log stats + incorrect setting reference
SkepticMystic Apr 21, 2024
084ab94
Merge branch 'no-direction' of https://github.com/SkepticMystic/bread…
SkepticMystic Apr 21, 2024
c08f927
fix: Rename default_field and field_group_labels on edgefield.label r…
SkepticMystic Apr 21, 2024
4a60dcb
Specify that Date Notes are joined with a "next" field
SkepticMystic Apr 21, 2024
779d5cc
docs: Update donation section
SkepticMystic Apr 21, 2024
d950f5d
fix: Parse codeblock.depth better + extract TreeItemFlair component
SkepticMystic Apr 21, 2024
0ffa45c
fix: metadataCache may already be initialized
SkepticMystic Apr 22, 2024
6e68f43
feat(debugging): FEAT LogLevel for features whose purpose is to log t…
SkepticMystic Apr 22, 2024
c6043a7
fix(builder:list-note): Only validate list-note-neighbour-field if it…
SkepticMystic Apr 22, 2024
b372b1b
Tidy up settings components + Track global settings.is_dirty
SkepticMystic Apr 22, 2024
ed57485
saveSettings resets the is_dirty flag itself
SkepticMystic Apr 22, 2024
f5c52d0
docs: Add HEmile to credits
SkepticMystic Apr 22, 2024
26ff091
feat(view:codeblock:mermaid): Buttons to view image and live edit
SkepticMystic Apr 23, 2024
075f4eb
fix(views): Redraw side views on relevant settings changes
SkepticMystic Apr 23, 2024
06d476c
fix(view:codeblock): Still warn on deprecated dirs field, but gracefu…
SkepticMystic Apr 23, 2024
dab0500
Merge branch 'master' into no-direction
SkepticMystic Apr 23, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/api/index.ts
Original file line number Diff line number Diff line change
@@ -13,7 +13,7 @@ export class BCAPI {
}

get fields() {
return this.plugin.settings.fields;
return this.plugin.settings.edge_fields;
}

// TODO
3 changes: 1 addition & 2 deletions src/codeblocks/index.ts
Original file line number Diff line number Diff line change
@@ -82,7 +82,7 @@ const parse_source = (plugin: BreadcrumbsPlugin, source: string) => {
}

case "fields": {
const field_labels = plugin.settings.fields.map(
const field_labels = plugin.settings.edge_fields.map(
(field) => field.label,
);

@@ -277,7 +277,6 @@ const resolve_options = (
Object.assign(
{
type: "tree",
dirs: ["down"],
depth: [0, Infinity],
flat: false,
sort: {
29 changes: 12 additions & 17 deletions src/commands/list_index/index.ts
Original file line number Diff line number Diff line change
@@ -1,26 +1,27 @@
import type { EdgeSortId } from "src/const/graph";
import type { Direction } from "src/const/hierarchies";
import type { BCGraph } from "src/graph/MyMultiGraph";
import { Traverse, type NestedEdgePath } from "src/graph/traverse";
import { get_edge_sorter, stringify_node } from "src/graph/utils";
import type { ObsidianLinkKind } from "src/interfaces/links";
import {
get_edge_sorter,
has_edge_attrs,
stringify_node,
} from "src/graph/utils";
import type { LinkKind } from "src/interfaces/links";
import type { ShowNodeOptions } from "src/interfaces/settings";
import { Links } from "src/utils/links";

export namespace ListIndex {
export type Options = {
dir: Direction;
hierarchy_i: number;
fields: string[];
indent: string;
link_kind: ObsidianLinkKind;
link_kind: LinkKind;
show_node_options: ShowNodeOptions;
edge_sort_id: EdgeSortId;
};

export const DEFAULT_OPTIONS: Options = {
dir: "down",
fields: [],
indent: "\\t",
hierarchy_i: -1,
link_kind: "wiki",
edge_sort_id: {
order: 1,
@@ -33,7 +34,7 @@ export namespace ListIndex {
nested_paths: NestedEdgePath[],
options: {
indent: string;
link_kind: ObsidianLinkKind;
link_kind: LinkKind;
show_node_options: ShowNodeOptions;
},
) => {
@@ -65,14 +66,8 @@ export namespace ListIndex {
nested_paths_to_list_index(
Traverse.sort_nested_paths(
Traverse.nest_all_paths(
Traverse.all_paths(
"depth_first",
graph,
start_node,
(e) =>
e.attr.dir === options.dir &&
(options.hierarchy_i === -1 ||
e.attr.hierarchy_i === options.hierarchy_i),
Traverse.all_paths("depth_first", graph, start_node, (e) =>
has_edge_attrs(e, { $or_fields: options.fields }),
),
),
get_edge_sorter(options.edge_sort_id, graph),
17 changes: 0 additions & 17 deletions src/commands/stats/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import type { ExplicitEdgeSource } from "src/const/graph";
import type { Direction } from "src/const/hierarchies";
import type { BCEdgeAttributes, BCGraph } from "src/graph/MyMultiGraph";

type GraphStats = {
@@ -10,14 +9,6 @@ type GraphStats = {
};

edges: {
hierarchy_i: Partial<{
[key: string]: number;
}>;

direction: Partial<{
[key in Direction]: number;
}>;

field: Partial<{
[key: string]: number;
}>;
@@ -54,8 +45,6 @@ export const get_graph_stats = (graph: BCGraph) => {
field: {},
source: {},
explicit: {},
direction: {},
hierarchy_i: {},
implied_kind: {},
},
};
@@ -67,12 +56,6 @@ export const get_graph_stats = (graph: BCGraph) => {
}

for (const { attributes: attr } of graph.edgeEntries()) {
stats.edges.hierarchy_i[attr.hierarchy_i] =
(stats.edges.hierarchy_i[attr.hierarchy_i] || 0) + 1;

stats.edges.direction[attr.dir] =
(stats.edges.direction[attr.dir] || 0) + 1;

stats.edges.field[attr.field ?? "null"] =
(stats.edges.field[attr.field ?? "null"] || 0) + 1;

18 changes: 6 additions & 12 deletions src/components/codeblocks/CodeblockMermaid.svelte
Original file line number Diff line number Diff line change
@@ -42,29 +42,23 @@
};

const base_traversal = ({
hierarchy_i,
$or_fields,
}: {
hierarchy_i: number | undefined;
$or_fields: string[] | undefined;
}) =>
Traverse.all_paths("depth_first", plugin.graph, active_file_path, (e) =>
has_edge_attrs(e, {
hierarchy_i,
$or_dirs: options.dirs,
$or_fields: options.fields,
$or_fields,
$or_target_ids: options.dataview_from_paths,
}),
);

const get_all_paths = () => {
if (active_file_path && plugin.graph.hasNode(active_file_path)) {
if (options.merge_hierarchies) {
return base_traversal({ hierarchy_i: undefined });
if (options.merge_field_groups) {
return base_traversal({ $or_fields: undefined });
} else {
return plugin.settings.hierarchies
.map((_hierarchy, hierarchy_i) =>
base_traversal({ hierarchy_i }),
)
.flat();
return [].flat();
}
} else {
return [];
22 changes: 8 additions & 14 deletions src/components/codeblocks/CodeblockTree.svelte
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
<script lang="ts">
import type { BCEdge } from "src/graph/MyMultiGraph";
import { Traverse } from "src/graph/traverse";
import { get_edge_sorter, has_edge_attrs } from "src/graph/utils";
import type { ICodeblock } from "src/interfaces/codeblocks";
import type { BreadcrumbsError } from "src/interfaces/graph";
import type BreadcrumbsPlugin from "src/main";
import { active_file_store } from "src/stores/active_file";
import { onMount } from "svelte";
import FlatEdgeList from "../FlatEdgeList.svelte";
import NestedEdgeList from "../NestedEdgeList.svelte";
import CodeblockErrors from "./CodeblockErrors.svelte";
import { onMount } from "svelte";
import type { BCEdge } from "src/graph/MyMultiGraph";

export let plugin: BreadcrumbsPlugin;
export let options: ICodeblock["Options"];
@@ -33,15 +33,13 @@
const sort = get_edge_sorter(options.sort, plugin.graph);

const base_traversal = ({
hierarchy_i,
$or_fields,
}: {
hierarchy_i: number | undefined;
$or_fields: string[] | undefined;
}) =>
Traverse.all_paths("depth_first", plugin.graph, active_file_path, (e) =>
has_edge_attrs(e, {
hierarchy_i,
$or_dirs: options.dirs,
$or_fields: options.fields,
$or_fields,
$or_target_ids: options.dataview_from_paths,
}),
);
@@ -50,14 +48,10 @@
console.log(active_file_path);

if (active_file_path && plugin.graph.hasNode(active_file_path)) {
if (options.merge_hierarchies) {
return base_traversal({ hierarchy_i: undefined });
if (options.merge_field_groups) {
return base_traversal({ $or_fields: undefined });
} else {
return plugin.settings.hierarchies
.map((_hierarchy, hierarchy_i) =>
base_traversal({ hierarchy_i }),
)
.flat();
return [].flat();
}
} else {
return [];
23 changes: 0 additions & 23 deletions src/components/obsidian/TreeItem.svelte

This file was deleted.

5 changes: 3 additions & 2 deletions src/components/page_views/PrevNextView.svelte
Original file line number Diff line number Diff line change
@@ -7,6 +7,7 @@
export let plugin: BreadcrumbsPlugin;
export let file_path: string;

// TODO(NODIR): This'll take alot of thought to migrate to no-dirs
const grouped_out_edges =
// Even tho we ensure the graph is built before the views are registered,
// Existing views still try render before the graph is built.
@@ -15,9 +16,9 @@
plugin.graph
.get_out_edges(file_path)
.filter((e) =>
has_edge_attrs(e, { $or_dirs: ["prev", "next"] }),
has_edge_attrs(e, { $or_fields: ["TODO"] }),
),
(e) => e.attr.dir,
(e) => e.attr.field,
)
: null;
</script>
7 changes: 3 additions & 4 deletions src/components/page_views/TrailView.svelte
Original file line number Diff line number Diff line change
@@ -13,16 +13,15 @@
// Even tho we ensure the graph is built before the views are registered,
// Existing views still try render before the graph is built.
plugin.graph.hasNode(file_path)
? plugin.settings.hierarchies
.map((_hierarchy, hierarchy_i) =>
? plugin.settings.edge_fields
.map((field) =>
Traverse.all_paths(
"depth_first",
plugin.graph,
file_path,
(edge) =>
has_edge_attrs(edge, {
dir: "up",
hierarchy_i,
field: field.label,
}),
),
)
11 changes: 0 additions & 11 deletions src/components/selector/DirectionSelector.svelte

This file was deleted.

25 changes: 25 additions & 0 deletions src/components/selector/EdgeFieldSelector.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<script lang="ts">
import type { EdgeField } from "src/interfaces/settings";
import { createEventDispatcher } from "svelte";

export let fields: EdgeField[];
export let field: EdgeField | undefined = undefined;

const dispatch = createEventDispatcher<{
select: typeof field | undefined;
}>();
</script>

<select
class="dropdown"
on:change={() => {
dispatch("select", field);
field = undefined;
}}
>
<option value={undefined}>Select Field</option>

{#each fields as field}
<option value={field}>{field.label}</option>
{/each}
</select>
28 changes: 0 additions & 28 deletions src/components/selector/HierarchyFieldSelector.svelte

This file was deleted.

Loading