Skip to content

Commit

Permalink
remove merge conflict markers
Browse files Browse the repository at this point in the history
  • Loading branch information
GamerGirlandCo committed Nov 1, 2024
1 parent ee69b97 commit ac195bf
Show file tree
Hide file tree
Showing 9 changed files with 75 additions and 3,177 deletions.
3 changes: 0 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
<<<<<<< HEAD
# 0.1.19 (Beta)

Adds parsing for list item symbols ($symbol), and task text ($text). In general in datacore I am trying to avoid pulling actual text contents into the index, but the task usecase is sufficiently common that
Expand Down Expand Up @@ -30,8 +29,6 @@ Fixes field indexing, meaning you can use things like `rating >= 8` in your quer

---

=======
>>>>>>> bb443f1 (Squashed commit of the following:)
# 0.1.14 (Beta)

Fixes non-markdown files not showing up in the Datacore index when they are created while Obsidian is running.
Expand Down
4 changes: 0 additions & 4 deletions manifest-beta.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
{
"id": "datacore",
"name": "Datacore",
<<<<<<< HEAD
"version": "0.1.19",
=======
"version": "0.1.14",
>>>>>>> bb443f1 (Squashed commit of the following:)
"minAppVersion": "1.4.11",
"description": "Reactive data engine for Obsidian.md.",
"author": "Michael Brenan",
Expand Down
2 changes: 1 addition & 1 deletion src/api/ui/basics.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import "./basics.css";

/** Various intents for buttons and other interactive elements. */
export type Intent = "error" | "warn" | "info" | "success";
export type Omittable = "value" | "defaultValue"
export type Omittable = "value" | "defaultValue";
export const INTENT_CLASSES: Record<Intent, string> = {
error: "dc-intent-error",
warn: "dc-intent-warn",
Expand Down
17 changes: 9 additions & 8 deletions src/api/ui/views/table.css
Original file line number Diff line number Diff line change
Expand Up @@ -55,16 +55,17 @@
}

.datacore-table td .datacore-collapser {
max-width: 1.25em;
max-height: min-content;
vertical-align: middle;
display: flex;
max-width: 1.25em;
max-height: min-content;
vertical-align: middle;
display: flex;
}
.datacore-table td:has(.datacore-card-collapser) {
max-width: 1.25em;
max-width: 1.25em;
}

.datacore-table td .datacore-editable-outer, .datacore-table td .datacore-editable {
width: 100%;
display: inline-block;
.datacore-table td .datacore-editable-outer,
.datacore-table td .datacore-editable {
width: 100%;
display: inline-block;
}
26 changes: 15 additions & 11 deletions src/expression/field.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,18 +50,22 @@ export namespace Fieldbearings {
else return object[key];
}

export function getWithDefault<T extends {$position: LineSpan} & Indexable>(object: T, key: string, defaultValue?: Literal): Field {
return {
key: key,
value: defaultValue ?? null,
provenance: {
type: "inline-field",
file: object.$file!,
key,
line: object.$position.end,
},
export function getWithDefault<T extends { $position: LineSpan } & Indexable>(
object: T,
key: string,
defaultValue?: Literal
): Field {
return {
key: key,
value: defaultValue ?? null,
provenance: {
type: "inline-field",
file: object.$file!,
key,
line: object.$position.end,
},
};
}
}
}

/**
Expand Down
9 changes: 8 additions & 1 deletion src/index/types/markdown.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,14 @@ import {
Taggable,
} from "index/types/indexable";
import { DateTime } from "luxon";
import { Extractors, FIELDBEARING_TYPE, Field, FieldExtractor, Fieldbearing, Fieldbearings } from "../../expression/field";
import {
Extractors,
FIELDBEARING_TYPE,
Field,
FieldExtractor,
Fieldbearing,
Fieldbearings,
} from "../../expression/field";
import { InlineField, jsonInlineField, valueInlineField } from "index/import/inline-field";
import {
LineSpan,
Expand Down
84 changes: 42 additions & 42 deletions src/utils/fields.ts
Original file line number Diff line number Diff line change
@@ -1,42 +1,42 @@
import { Field } from "expression/field";
import { Literal } from "expression/literal";
import { setInlineField } from "index/import/inline-field";
import { MarkdownTaskItem } from "index/types/markdown";
import { App } from "obsidian";
import { Dispatch, useCallback, useContext } from "preact/hooks";
import { APP_CONTEXT } from "ui/markdown";
import { rewriteTask } from "./task";
import { EditableAction } from "ui/fields/editable";
import { Datacore } from "index/datacore";
import { editProvenance } from "index/edit/field";

export function useSetField<T extends Literal>(field: Field, onChange?: (newValue: T) => void) {
const app = useContext(APP_CONTEXT);
return useCallback(
(newValue: T) => {
editProvenance(app, field.provenance!, newValue).then(() => {
if (onChange) onChange(newValue);
});
},
[field, onChange]
);
}
export async function setTaskText(app: App, core: Datacore, text: string, item: MarkdownTaskItem) {
let withFields = `${text}${Object.keys(item.$infields).length ? " " : ""}`;
for (let field in item.$infields) {
withFields = setInlineField(withFields, field, item.$infields[field].raw);
}
await rewriteTask(app.vault, core, item, item.$status, withFields);
}
export function useFinalizer<T>(newValue: T, dispatch: Dispatch<EditableAction<T>>) {
return async function () {
dispatch({
type: "content-changed",
newValue: newValue,
});
dispatch({
type: "editing-toggled",
newValue: false,
});
};
}
import { Field } from "expression/field";
import { Literal } from "expression/literal";
import { setInlineField } from "index/import/inline-field";
import { MarkdownTaskItem } from "index/types/markdown";
import { App } from "obsidian";
import { Dispatch, useCallback, useContext } from "preact/hooks";
import { APP_CONTEXT } from "ui/markdown";
import { rewriteTask } from "./task";
import { EditableAction } from "ui/fields/editable";
import { Datacore } from "index/datacore";
import { editProvenance } from "index/edit/field";

export function useSetField<T extends Literal>(field: Field, onChange?: (newValue: T) => void) {
const app = useContext(APP_CONTEXT);
return useCallback(
(newValue: T) => {
editProvenance(app, field.provenance!, newValue).then(() => {
if (onChange) onChange(newValue);
});
},
[field, onChange]
);
}
export async function setTaskText(app: App, core: Datacore, text: string, item: MarkdownTaskItem) {
let withFields = `${text}${Object.keys(item.$infields).length ? " " : ""}`;
for (let field in item.$infields) {
withFields = setInlineField(withFields, field, item.$infields[field].raw);
}
await rewriteTask(app.vault, core, item, item.$status, withFields);
}
export function useFinalizer<T>(newValue: T, dispatch: Dispatch<EditableAction<T>>) {
return async function () {
dispatch({
type: "content-changed",
newValue: newValue,
});
dispatch({
type: "editing-toggled",
newValue: false,
});
};
}
4 changes: 0 additions & 4 deletions versions.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,10 @@
"0.1.11": "1.4.11",
"0.1.12": "1.4.11",
"0.1.13": "1.4.11",
<<<<<<< HEAD
"0.1.14": "1.4.11",
"0.1.15": "1.4.11",
"0.1.16": "1.4.11",
"0.1.17": "1.4.11",
"0.1.18": "1.4.11",
"0.1.19": "1.4.11"
=======
"0.1.14": "1.4.11"
>>>>>>> bb443f1 (Squashed commit of the following:)
}
Loading

0 comments on commit ac195bf

Please sign in to comment.