Skip to content

Commit ca8b534

Browse files
committed
the first ipf test runs
1 parent 8af3723 commit ca8b534

Some content is hidden

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

57 files changed

+402
-234
lines changed

bun.lockb

-13 KB
Binary file not shown.

bunfig.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
[test]
2-
preload = "./tests/happydom.ts"
2+
preload = ["./tests/svelteLoader.ts", "./tests/happydom.ts", "./tests/obsidianMock.ts"]
33
root = "./tests"

package.json

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -55,10 +55,6 @@
5555
},
5656
"dependencies": {
5757
"@lemons_dev/parsinom": "^0.0.11",
58-
"@popperjs/core": "^2.11.8",
59-
"@ungap/structured-clone": "^1.2.0",
60-
"mathjs": "^12.0.0",
61-
"obsidian-svelte": "^0.1.9",
62-
"svelte-portal": "^2.2.0"
58+
"mathjs": "^12.0.0"
6359
}
6460
}

src/api/API.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { InputFieldMDRC, RenderChildType } from '../renderChildren/InputFieldMDRC';
1+
import { InputFieldMDRC } from '../renderChildren/InputFieldMDRC';
22
import { ViewFieldParser } from '../parsers/viewFieldParser/ViewFieldParser';
33
import { BindTargetParser } from '../parsers/BindTargetParser';
44
import { ViewFieldMDRC } from '../renderChildren/ViewFieldMDRC';
@@ -26,6 +26,7 @@ import {
2626
import { ViewFieldFactory } from '../fields/viewFields/ViewFieldFactory';
2727
import { getUUID } from '../utils/Utils';
2828
import { parsePropPath } from '../utils/prop/PropParser';
29+
import { RenderChildType } from '../config/FieldConfigs';
2930

3031
export class API implements IAPI {
3132
public plugin: MetaBindPlugin;

src/api/IAPI.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ 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';
6+
import { type InputFieldFactory } from '../fields/inputFields/InputFieldFactory';
67

78
export interface IAPI {
89
readonly plugin: IPlugin;
@@ -23,4 +24,6 @@ export interface IAPI {
2324
* Parser for bind target declarations.
2425
*/
2526
readonly bindTargetParser: BindTargetParser;
27+
28+
readonly inputFieldFactory: InputFieldFactory;
2629
}

src/cm6/Cm6_Widgets.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,10 @@ import { type EditorView, WidgetType } from '@codemirror/view';
22
import type MetaBindPlugin from '../main';
33
import { type AbstractMDRC } from '../renderChildren/AbstractMDRC';
44
import { type ViewFieldMDRC } from '../renderChildren/ViewFieldMDRC';
5-
import { type InputFieldMDRC, RenderChildType } from '../renderChildren/InputFieldMDRC';
5+
import { type InputFieldMDRC } from '../renderChildren/InputFieldMDRC';
66
import { type Component } from 'obsidian';
77
import { type ExcludedMDRC } from '../renderChildren/ExcludedMDRC';
8+
import { RenderChildType } from '../config/FieldConfigs';
89

910
export abstract class MarkdownRenderChildWidget<T extends AbstractMDRC> extends WidgetType {
1011
content: string;

src/config/FieldConfigs.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -509,3 +509,8 @@ export const ViewFieldArgumentConfigs: Record<ViewFieldArgumentType, ViewFieldAr
509509
allowMultiple: true,
510510
},
511511
};
512+
513+
export enum RenderChildType {
514+
INLINE = 'inline',
515+
BLOCK = 'block',
516+
}

src/faq/FaqComponent.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
<script lang="ts">
2-
import { Button } from 'obsidian-svelte';
32
import { DocsHelper } from '../utils/DocsHelper';
43
import ErrorIndicatorComponent from '../utils/errors/ErrorIndicatorComponent.svelte';
54
import { App } from 'obsidian';
@@ -9,6 +8,7 @@
98
import { createInputFieldExamples } from './InputFieldExamples';
109
import MetaBindPlugin from '../main';
1110
import InputFieldExampleComponent from './InputFieldExampleComponent.svelte';
11+
import Button from '../utils/components/Button.svelte';
1212
1313
export let app: App;
1414
export let plugin: MetaBindPlugin;

src/faq/InputFieldExampleComponent.svelte

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
<script lang="ts">
2-
import { InputFieldType } from '../config/FieldConfigs';
2+
import { InputFieldType, RenderChildType } from '../config/FieldConfigs';
33
import { UnvalidatedInputFieldDeclaration } from '../parsers/inputFieldParser/InputFieldDeclaration';
44
import { onDestroy, onMount } from 'svelte';
55
import MetaBindPlugin from '../main';
66
import { Component } from 'obsidian';
7-
import { RenderChildType } from '../renderChildren/InputFieldMDRC';
87
98
export let type: InputFieldType;
109
export let declaration: UnvalidatedInputFieldDeclaration;

src/fields/inputFields/AbstractInputField.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,15 @@ import { type IInputFieldBase } from './IInputFieldBase';
77
import { type MetadataSubscription } from '../../metadata/MetadataSubscription';
88

99
export abstract class AbstractInputField<MetadataValueType, ComponentValueType> {
10-
readonly renderChild: IInputFieldBase;
10+
readonly base: IInputFieldBase;
1111
readonly inputFieldComponent: InputFieldComponent<ComponentValueType>;
1212
readonly inputSignal: Signal<unknown>;
1313
readonly signal: ComputedSignal<unknown, MetadataValueType>;
1414

1515
private metadataSubscription?: MetadataSubscription;
1616

17-
protected constructor(renderChild: IInputFieldBase) {
18-
this.renderChild = renderChild;
17+
protected constructor(base: IInputFieldBase) {
18+
this.base = base;
1919
this.inputSignal = new Signal<unknown>(undefined);
2020
this.inputFieldComponent = new InputFieldComponent<ComponentValueType>(this.getSvelteComponent());
2121

@@ -31,7 +31,7 @@ export abstract class AbstractInputField<MetadataValueType, ComponentValueType>
3131
callback: value => this.inputFieldComponent.setValue(this.reverseMapValue(value)),
3232
});
3333

34-
const fullBindTarget = this.renderChild.getFullBindTarget();
34+
const fullBindTarget = this.base.getFullBindTarget();
3535

3636
if (fullBindTarget) {
3737
this.inputFieldComponent.registerListener({
@@ -41,11 +41,11 @@ export abstract class AbstractInputField<MetadataValueType, ComponentValueType>
4141
},
4242
});
4343

44-
this.metadataSubscription = this.renderChild.plugin.metadataManager.subscribe(
45-
this.renderChild.getUuid(),
44+
this.metadataSubscription = this.base.plugin.metadataManager.subscribe(
45+
this.base.getUuid(),
4646
this.inputSignal,
4747
fullBindTarget,
48-
() => this.renderChild.unload(),
48+
() => this.base.unload(),
4949
);
5050
}
5151
}
@@ -134,7 +134,7 @@ export abstract class AbstractInputField<MetadataValueType, ComponentValueType>
134134
}
135135

136136
private getDefaultValue(): MetadataValueType {
137-
const defaultValueArgument = this.renderChild.getArgument(InputFieldArgumentType.DEFAULT_VALUE);
137+
const defaultValueArgument = this.base.getArgument(InputFieldArgumentType.DEFAULT_VALUE);
138138
if (!defaultValueArgument) {
139139
return this.mapValue(this.getFallbackDefaultValue());
140140
}

0 commit comments

Comments
 (0)