Skip to content

Commit 3591a4c

Browse files
committed
move some files; fix bug with meta bind table
1 parent 9042461 commit 3591a4c

File tree

123 files changed

+436
-377
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

123 files changed

+436
-377
lines changed

README.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Obsidian Meta Bind Plugin
22

3-
Meta Bind allows you to create input and view fields inside your notes.
3+
Meta Bind allows you to create input and view fields inside your notes.
44
Those input and view fields can then be bound to frontmatter properties, which keeps them in sync those frontmatter properties.
55
Allowing you to edit and view your frontmatter properties inside your notes.
66

@@ -38,10 +38,10 @@ Contributions are always welcome. If you have an idea, feel free to open a featu
3838
The plugin uses [Bun](https://bun.sh/) instead of Node.js/NPM to manage dependencies.
3939
To install the dependencies, run `bun install` in the root directory of the project.
4040

41-
- `bun run dev` will build the plugin in dev mode and watch for changes. The plugin builds directly into the example vault inside of this repo.
42-
- `bun run build` will build the plugin in production mode. The plugin builds into the root of this repo.
43-
- `bun run test` will run the tests.
44-
- `bun run check` will check for formatting, linting, type errors and run the tests.
45-
- `bun run check:fix` will fix formatting and linting errors, check for type errors and run the tests.
41+
- `bun run dev` will build the plugin in dev mode and watch for changes. The plugin builds directly into the example vault inside of this repo.
42+
- `bun run build` will build the plugin in production mode. The plugin builds into the root of this repo.
43+
- `bun run test` will run the tests.
44+
- `bun run check` will check for formatting, linting, type errors and run the tests.
45+
- `bun run check:fix` will fix formatting and linting errors, check for type errors and run the tests.
4646

4747
`bun run check` should run successfully before creating a pull request.
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
---
2+
activities:
3+
- {}
4+
---
5+
6+
```js-engine
7+
const mb = engine.getPlugin('obsidian-meta-bind-plugin').api;
8+
9+
const bindTarget = mb.createBindTarget('activities');
10+
const tableHead = ['From', 'To', 'Activity', 'Status'];
11+
const columns = [
12+
mb.inputField.createInputFieldDeclarationFromString('INPUT[time:^.from]'),
13+
mb.inputField.createInputFieldDeclarationFromString('INPUT[time:^.to]'),
14+
mb.inputField.createInputFieldDeclarationFromString('INPUT[inlineSelect(option(youtube), option(sudying), option(linch)):^.activity]'),
15+
mb.inputField.createInputFieldDeclarationFromString('INPUT[inlineSelect(option(-, unproductive), option(0, normal), option(+, productive)):^.status]')
16+
];
17+
18+
19+
mb.createTable(container, context.file.path, component, bindTarget, tableHead, columns);
20+
```

exampleVault/examples.md renamed to exampleVault/Examples.md

Lines changed: 36 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,9 @@ nested:
1414
object: test
1515
---
1616

17-
## In callouts
17+
## Fields Work Everywhere
18+
19+
Input and view fields work in the top level and in
1820

1921
> `INPUT[slider(addLabels, minValue(1), maxValue(10)):slider1]`
2022
@@ -27,19 +29,34 @@ nested:
2729
> ```
2830
2931
## Nested data
30-
`INPUT[text:nested["object"]]`
32+
33+
Input fields work with nested front-matter.
34+
35+
```meta-bind
36+
INPUT[text(showcase):nested["object"]]
37+
```
3138
3239
## String Escaping
3340

34-
`INPUT[inlineSelect(option(0, 'don\'t do this'), option(1, 'do this \\')):inlineSelect]`
41+
Certain characters need escaping.
42+
43+
```meta-bind
44+
INPUT[inlineSelect(option(0, 'don\'t do this'), option(1, 'do this \\'), showcase):inlineSelect]
45+
```
3546

3647
## Unicode
3748

38-
`INPUT[text:こんにちは]`
49+
Meta Bind supports Unicode characters.
3950

40-
## Linking to a different note
41-
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque sit amet porttitor arcu. Quisque scelerisque dolor augue, et posuere nulla bibendum nec. Curabitur sed rhoncus nisl.
51+
```meta-bind
52+
INPUT[text:こんにちは]
53+
```
4254

55+
## Binding to Another Note
56+
57+
Meta Bind supports binding to front-matter of a different note.
58+
59+
Text area to a different note.
4360
```meta-bind
4461
INPUT[textArea(
4562
title(text area),
@@ -48,7 +65,7 @@ class(meta-bind-high)
4865
):other note#title]
4966
```
5067

51-
A select to a different note
68+
A select to a different note.
5269
```meta-bind
5370
INPUT[select(
5471
option(option a),
@@ -58,7 +75,7 @@ option(option d)
5875
):other note#select]
5976
```
6077

61-
A multi select to a different note
78+
A multi select to a different note.
6279
```meta-bind
6380
INPUT[multiSelect(
6481
title(A multi select input),
@@ -69,14 +86,24 @@ option(option d)
6986
):other note#multi-select]
7087
```
7188

89+
## Inline Input Fields
90+
91+
Inline input fields should not cause line breaks.
92+
7293
Lorem ipsum dolor sit amet, `INPUT[date():other note#date]` consectetur adipiscing elit. Pellentesque sit amet porttitor arcu. Quisque scelerisque dolor augue, et posuere nulla bibendum nec. `INPUT[date():other note#date]` Curabitur sed rhoncus nisl. Maecenas nisi justo, viverra vel tempus vel, hendrerit at metus. `INPUT[datePicker():other note#date]` asdasd asdasdasd
7394

7495
## Templates
96+
97+
For input fields, templates can be set in the plugin settings
98+
7599
- `INPUT[][toggle:toggle1]` empty template
76100
- `INPUT[nonExistantTemplate][toggle:toggle1]` unknown template
77101
- `INPUT[toggleTemplate][]`
78102

79103
## Error Messages
104+
105+
There are a lot of different error messages and they are clickable
106+
80107
- `INPUT[text():meta bind/nonExistantFile#title]`
81108
- `INPUT[slider(nonExistantArgument)]`
82109
- `INPUT[slider]`
@@ -89,6 +116,7 @@ Lorem ipsum dolor sit amet, `INPUT[date():other note#date]` consectetur adipisci
89116
Lorem ipsum dolor sit amet, `INPUT[text():meta bind/nonExistantFile#title]` consectetur adipiscing elit. Pellentesque sit amet porttitor arcu. Quisque scelerisque dolor augue, et posuere nulla bibendum nec. `INPUT[slider(nonExistantArgument)]` Curabitur sed rhoncus nisl. Maecenas nisi justo, viverra vel tempus vel, hendrerit at metus. `INPUT[select(option(option a),option(option b),option(option c),option(option d)):select]` asdasd asdasdasd
90117

91118
Code block error
119+
92120
```meta-bind
93121
INPUT[slider(nonExistantArgument)]
94122
```
File renamed without changes.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
"build-publish": "tsc -noEmit -skipLibCheck && node esbuild.publish.config.mjs production",
1111
"tsc": "tsc -noEmit -skipLibCheck",
1212
"test": "bun test",
13+
"test:log": "LOG_TESTS=true bun test",
1314
"format": "prettier --write --plugin prettier-plugin-svelte .",
1415
"format:check": "prettier --check --plugin prettier-plugin-svelte .",
1516
"lint": "eslint --max-warnings=0 src/**",

src/api/API.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { InputFieldMDRC, RenderChildType } from '../renderChildren/InputFieldMDRC';
2-
import { ViewFieldDeclarationParser } from '../parsers/viewFieldParser/ViewFieldDeclarationParser';
2+
import { ViewFieldParser } from '../parsers/viewFieldParser/ViewFieldParser';
33
import { BindTargetParser } from '../parsers/BindTargetParser';
44
import { ViewFieldMDRC } from '../renderChildren/ViewFieldMDRC';
55
import { JsViewFieldMDRC } from '../renderChildren/JsViewFieldMDRC';
@@ -16,14 +16,14 @@ import {
1616
} from '../parsers/inputFieldParser/InputFieldDeclaration';
1717
import { Signal } from '../utils/Signal';
1818
import { type BindTargetScope } from '../metadata/BindTargetScope';
19-
import { MetaBindTable } from '../metaBindTable/MetaBindTable';
20-
import { InputFieldFactory } from '../inputFields/InputFieldFactory';
19+
import { MetaBindTable } from '../fields/metaBindTable/MetaBindTable';
20+
import { InputFieldFactory } from '../fields/inputFields/InputFieldFactory';
2121
import {
2222
type JsViewFieldDeclaration,
2323
type UnvalidatedViewFieldDeclaration,
2424
type ViewFieldDeclaration,
2525
} from '../parsers/viewFieldParser/ViewFieldDeclaration';
26-
import { ViewFieldFactory } from '../viewFields/ViewFieldFactory';
26+
import { ViewFieldFactory } from '../fields/viewFields/ViewFieldFactory';
2727
import { getUUID } from '../utils/Utils';
2828
import { parsePropPath } from '../utils/prop/PropParser';
2929

@@ -32,7 +32,7 @@ export class API implements IAPI {
3232
public readonly inputField: InputFieldAPI;
3333

3434
public readonly inputFieldParser: InputFieldDeclarationParser;
35-
public readonly viewFieldParser: ViewFieldDeclarationParser;
35+
public readonly viewFieldParser: ViewFieldParser;
3636
public readonly bindTargetParser: BindTargetParser;
3737

3838
public readonly inputFieldFactory: InputFieldFactory;
@@ -44,7 +44,7 @@ export class API implements IAPI {
4444

4545
// this.inputFieldParser = new InputFieldDeclarationParser();
4646
this.inputFieldParser = new InputFieldDeclarationParser(this.plugin);
47-
this.viewFieldParser = new ViewFieldDeclarationParser(this.plugin);
47+
this.viewFieldParser = new ViewFieldParser(this.plugin);
4848
this.bindTargetParser = new BindTargetParser(this.plugin);
4949

5050
this.inputFieldFactory = new InputFieldFactory(this.plugin);

src/api/IAPI.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { type InputFieldDeclarationParser } from '../parsers/inputFieldParser/InputFieldParser';
2-
import { type ViewFieldDeclarationParser } from '../parsers/viewFieldParser/ViewFieldDeclarationParser';
2+
import { type ViewFieldParser } from '../parsers/viewFieldParser/ViewFieldParser';
33
import { type BindTargetParser } from '../parsers/BindTargetParser';
44
import { type IPlugin } from '../IPlugin';
55
import { type InputFieldAPI } from './InputFieldAPI';
@@ -18,7 +18,7 @@ export interface IAPI {
1818
/**
1919
* Parser for view field declarations.
2020
*/
21-
readonly viewFieldParser: ViewFieldDeclarationParser;
21+
readonly viewFieldParser: ViewFieldParser;
2222
/**
2323
* Parser for bind target declarations.
2424
*/

src/api/InputFieldAPI.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import {
66
type UnvalidatedFieldArgument,
77
type UnvalidatedInputFieldDeclaration,
88
} from '../parsers/inputFieldParser/InputFieldDeclaration';
9-
import { type InputFieldArgumentType, type InputFieldType } from '../parsers/GeneralConfigs';
9+
import { type InputFieldArgumentType, type InputFieldType } from '../config/FieldConfigs';
1010
import { PROP_ACCESS_TYPE } from '../utils/prop/PropAccess';
1111

1212
export class InputFieldAPI {
File renamed without changes.

src/utils/faq/FaqComponent.svelte renamed to src/faq/FaqComponent.svelte

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
<script lang="ts">
22
import { Button } from 'obsidian-svelte';
3-
import { DocsHelper } from '../DocsHelper';
4-
import ErrorIndicatorComponent from '../errors/ErrorIndicatorComponent.svelte';
3+
import { DocsHelper } from '../utils/DocsHelper';
4+
import ErrorIndicatorComponent from '../utils/errors/ErrorIndicatorComponent.svelte';
55
import { App } from 'obsidian';
6-
import { ErrorCollection } from '../errors/ErrorCollection';
6+
import { ErrorCollection } from '../utils/errors/ErrorCollection';
77
import { onMount } from 'svelte';
8-
import { ErrorLevel, MetaBindExampleError } from '../errors/MetaBindErrors';
8+
import { ErrorLevel, MetaBindExampleError } from '../utils/errors/MetaBindErrors';
99
import { createInputFieldExamples } from './InputFieldExamples';
10-
import MetaBindPlugin from '../../main';
10+
import MetaBindPlugin from '../main';
1111
import InputFieldExampleComponent from './InputFieldExampleComponent.svelte';
1212
1313
export let app: App;

0 commit comments

Comments
 (0)