-
-
Notifications
You must be signed in to change notification settings - Fork 18
/
index.d.ts
99 lines (82 loc) · 2.16 KB
/
index.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
import type { Locale, Moment } from "moment";
import type { Plugin, TFile } from "obsidian";
import type { IGranularity } from "obsidian-daily-notes-interface";
import { SvelteComponentTyped } from "svelte";
export type ILocaleOverride = "system-default" | string;
export type IWeekStartOption =
| "sunday"
| "monday"
| "tuesday"
| "wednesday"
| "thursday"
| "friday"
| "saturday"
| "locale";
export interface IDot {
isFilled: boolean;
}
export interface IEvaluatedMetadata {
value: number | string;
goal?: number;
dots: IDot[];
}
export type ISourceDisplayOption = "calendar-and-menu" | "menu" | "none";
export interface ISourceSettings {
color: string;
display: ISourceDisplayOption;
order: number;
}
export interface IDayMetadata
extends ICalendarSource,
ISourceSettings,
IEvaluatedMetadata {}
export interface ICalendarSource {
id: string;
name: string;
description?: string;
getMetadata?: (
granularity: IGranularity,
date: Moment,
file: TFile
) => Promise<IEvaluatedMetadata>;
// eslint-disable-next-line @typescript-eslint/no-explicit-any
defaultSettings: any;
registerSettings?: (
containerEl: HTMLElement,
settings: ISourceSettings,
saveSettings: (settings: Partial<ISourceSettings>) => void
) => void;
}
export type IHTMLAttributes = Record<string, string | number | boolean>;
export interface IEvaluatedMetadata {
value: number;
goal?: number;
dots: IDot[];
attrs?: IHTMLAttributes;
}
export interface ISourceSettings {
color: string;
display: ISourceDisplayOption;
order: number;
}
export interface IDayMetadata
extends ICalendarSource,
ISourceSettings,
IEvaluatedMetadata {}
export class Calendar extends SvelteComponentTyped<{
plugin: Plugin;
showWeekNums: boolean;
localeData?: Locale;
eventHandlers: CallableFunction[];
// External sources
selectedId?: string | null;
sources?: ICalendarSource[];
getSourceSettings: (sourceId: string) => ISourceSettings;
// Override-able local state
today?: Moment;
displayedMonth?: Moment;
}> {}
export function configureGlobalMomentLocale(
localeOverride: ILocaleOverride,
weekStart: IWeekStartOption
): string;