From 06f52b9fd9cc8db4a98af6435d19381a4d96a7e1 Mon Sep 17 00:00:00 2001 From: Liam Cain Date: Sat, 19 Dec 2020 07:51:24 -0500 Subject: [PATCH 1/7] Generalize sources --- src/main.ts | 9 ++- src/settings.ts | 15 ----- src/ui/Calendar.svelte | 65 ++++++++++--------- src/ui/Day.svelte | 67 ++++++-------------- src/ui/WeekNum.svelte | 53 +++------------- src/ui/utils.ts | 139 +++++++++++++++++++++++++++++++---------- src/view.ts | 57 ++++++++--------- 7 files changed, 201 insertions(+), 204 deletions(-) diff --git a/src/main.ts b/src/main.ts index 71ea58b..d149c5f 100644 --- a/src/main.ts +++ b/src/main.ts @@ -4,10 +4,9 @@ import { App, Plugin, WorkspaceLeaf } from "obsidian"; import { configureMomentLocale } from "src/localization"; import { VIEW_TYPE_CALENDAR } from "./constants"; -import { getWeeklyNote } from "./io/weeklyNotes"; +import { settings } from "./ui/stores"; import { CalendarSettingsTab, - SettingsInstance, ISettings, syncMomentLocaleWithSettings, } from "./settings"; @@ -33,7 +32,7 @@ export default class CalendarPlugin extends Plugin { async onload(): Promise { this.register( - SettingsInstance.subscribe((value) => { + settings.subscribe((value) => { this.options = value; configureMomentLocale(this.options); }) @@ -108,7 +107,7 @@ export default class CalendarPlugin extends Plugin { async loadOptions(): Promise { const options = await this.loadData(); - SettingsInstance.update((old) => { + settings.update((old) => { return { ...old, ...(options || {}), @@ -119,7 +118,7 @@ export default class CalendarPlugin extends Plugin { } async writeOptions(changeOpts: (settings: ISettings) => void): Promise { - SettingsInstance.update((old) => { + settings.update((old) => { changeOpts(old); return old; }); diff --git a/src/settings.ts b/src/settings.ts index 41cd149..08a660f 100644 --- a/src/settings.ts +++ b/src/settings.ts @@ -1,5 +1,4 @@ import { App, PluginSettingTab, Setting } from "obsidian"; -import { writable } from "svelte/store"; import { DEFAULT_WEEK_FORMAT, DEFAULT_WORDS_PER_DOT } from "src/constants"; @@ -36,20 +35,6 @@ export function getWeeklyNoteSettings(settings: ISettings): IDailyNoteSettings { }; } -export const SettingsInstance = writable({ - shouldConfirmBeforeCreate: true, - weekStart: "locale", - - wordsPerDot: DEFAULT_WORDS_PER_DOT, - - showWeeklyNote: false, - weeklyNoteFormat: "", - weeklyNoteTemplate: "", - weeklyNoteFolder: "", - - localeOverride: "system-default", -}); - export function syncMomentLocaleWithSettings(settings: ISettings): void { const { moment } = window; const currentLocale = moment.locale(); diff --git a/src/ui/Calendar.svelte b/src/ui/Calendar.svelte index f1a301a..f1583b9 100644 --- a/src/ui/Calendar.svelte +++ b/src/ui/Calendar.svelte @@ -1,16 +1,22 @@ @@ -205,7 +214,7 @@ - {#if settings.showWeeklyNote} + {#if $settings.showWeeklyNote} {/if} {#each month[1].days as day} @@ -214,7 +223,7 @@ - {#if settings.showWeeklyNote} + {#if $settings.showWeeklyNote} {/if} {#each daysOfWeek as dayOfWeek} @@ -225,21 +234,15 @@ {#each month as week} - {#if settings.showWeeklyNote} - - {/if} - {#each week.days as day} + {#each week.days as { date, file } (file)} + {source} + {today} /> {/each} {/each} diff --git a/src/ui/Day.svelte b/src/ui/Day.svelte index f4d403f..4d08c0d 100644 --- a/src/ui/Day.svelte +++ b/src/ui/Day.svelte @@ -3,21 +3,22 @@ import type { TFile } from "obsidian"; import { getDailyNoteSettings } from "obsidian-daily-notes-interface"; - import { isMetaPressed } from "./utils"; + import Dot from "./Dot.svelte"; + import { activeFile } from "./stores"; + import { CalendarSource, IDayMetadata, isMetaPressed } from "./utils"; const { format } = getDailyNoteSettings(); - export let isActive: boolean; + let isActive: boolean; + let metadata: IDayMetadata; export let date: Moment; - export let note: TFile; - export let numTasksRemaining: Promise; - export let numDots: Promise; - export let tags: string[]; + export let file: TFile; + export let source: CalendarSource; export let onHover: ( targetEl: EventTarget, filename: string, - note: TFile + file: TFile ) => void; export let openOrCreateDailyNote: ( date: Moment, @@ -26,6 +27,11 @@ ) => void; export let displayedMonth: Moment; export let today: Moment; + + $: { + isActive = $activeFile === file; + metadata = source.getMetadata(date); + } diff --git a/src/ui/WeekNum.svelte b/src/ui/WeekNum.svelte index ec5eca0..3e76711 100644 --- a/src/ui/WeekNum.svelte +++ b/src/ui/WeekNum.svelte @@ -1,22 +1,19 @@ - - -
- -
W
@@ -99,38 +84,24 @@ class="day" class:adjacent-month={!date.isSame(displayedMonth, 'month')} class:active={isActive} - class:has-note={!!note} + class:has-note={!!file} class:today={date.isSame(today, 'day')} - data-tags={tags.join(' ')} on:click={(e) => { - openOrCreateDailyNote(date, note, isMetaPressed(e)); + openOrCreateDailyNote(date, file, isMetaPressed(e)); }} on:pointerover={(e) => { if (isMetaPressed(e)) { - onHover(e.target, date.format(format), note); + onHover(e.target, date.format(format), file); } }}> {date.format('D')}
- {#await numDots then dots} - {#each Array(dots) as _} - - - + {#await metadata.dots then dots} + {#each dots as dot} + {/each} {/await} - {#await numTasksRemaining then hasTask} - {#if hasTask} - - {/if} - {/await}
- - {#if $settings.showWeeklyNote} - - {/if} - {#each month[1].days as day} - - {/each} - - - - {#if $settings.showWeeklyNote} - - {/if} - {#each daysOfWeek as dayOfWeek} - - {/each} - - - - {#each month as week} - - {#each week.days as { date, file } (file)} - - {/each} - - {/each} - -
W{dayOfWeek}
- + + diff --git a/src/ui/Day.svelte b/src/ui/Day.svelte deleted file mode 100644 index 4d08c0d..0000000 --- a/src/ui/Day.svelte +++ /dev/null @@ -1,107 +0,0 @@ - - - - - -
{ - openOrCreateDailyNote(date, file, isMetaPressed(e)); - }} - on:pointerover={(e) => { - if (isMetaPressed(e)) { - onHover(e.target, date.format(format), file); - } - }}> - {date.format('D')} - -
- {#await metadata.dots then dots} - {#each dots as dot} - - {/each} - {/await} -
-
- diff --git a/src/ui/WeekNum.svelte b/src/ui/WeekNum.svelte deleted file mode 100644 index 3e76711..0000000 --- a/src/ui/WeekNum.svelte +++ /dev/null @@ -1,103 +0,0 @@ - - - - - -
{ - openOrCreateWeeklyNote(startOfWeek, weeklyNote, isMetaPressed(e)); - }} - on:pointerover={(e) => { - if (isMetaPressed(e)) { - onHover(e.target, formattedDate, weeklyNote); - } - }}> - {weekNum} - -
- {#await metadata.dots then dots} - {#each dots as dot} - - {/each} - {/await} -
-
- diff --git a/src/ui/__tests__/utils.spec.ts b/src/ui/__tests__/utils.spec.ts index e4856cb..5e95714 100644 --- a/src/ui/__tests__/utils.spec.ts +++ b/src/ui/__tests__/utils.spec.ts @@ -1,5 +1,6 @@ import moment from "moment"; +import { settings } from "../../ui/stores"; import { getDefaultSettings } from "../../testUtils/settings"; import mockApp from "../../testUtils/mockApp"; import { getMonthData } from "../utils"; @@ -14,14 +15,11 @@ describe("getMonthData", () => { describe("january", () => { it("creates correct calendar starting on Sunday", () => { - const monthData = getMonthData( - null, - moment({ year: 2020, month: 0, day: 1 }), - getDefaultSettings({ weekStart: "monday" }) - ); + settings.set(getDefaultSettings({ weekStart: "sunday" })); + const monthData = getMonthData(moment({ year: 2020, month: 0, day: 1 })); expect( - monthData.map((week) => week.days.map((day) => day.date.date())) + monthData.map((week) => week.days.map((day) => day.date())) ).toEqual([ [29, 30, 31, 1, 2, 3, 4], [5, 6, 7, 8, 9, 10, 11], @@ -33,14 +31,11 @@ describe("getMonthData", () => { }); it("creates correct calendar starting on Monday", () => { - const monthData = getMonthData( - null, - moment({ year: 2020, month: 0, day: 1 }), - getDefaultSettings({ weekStart: "monday" }) - ); + settings.set(getDefaultSettings({ weekStart: "monday" })); + const monthData = getMonthData(moment({ year: 2020, month: 0, day: 1 })); expect( - monthData.map((week) => week.days.map((day) => day.date.date())) + monthData.map((week) => week.days.map((day) => day.date())) ).toEqual([ [30, 31, 1, 2, 3, 4, 5], [6, 7, 8, 9, 10, 11, 12], @@ -54,14 +49,11 @@ describe("getMonthData", () => { describe("february", () => { it("creates correct calendar starting on Sunday", () => { - const monthData = getMonthData( - null, - moment({ year: 2020, month: 1, day: 1 }), - getDefaultSettings({ weekStart: "sunday" }) - ); + settings.set(getDefaultSettings({ weekStart: "sunday" })); + const monthData = getMonthData(moment({ year: 2020, month: 1, day: 1 })); expect( - monthData.map((week) => week.days.map((day) => day.date.date())) + monthData.map((week) => week.days.map((day) => day.date())) ).toEqual([ [26, 27, 28, 29, 30, 31, 1], [2, 3, 4, 5, 6, 7, 8], @@ -73,14 +65,11 @@ describe("getMonthData", () => { }); it("creates correct calendar starting on Monday", () => { - const monthData = getMonthData( - null, - moment({ year: 2020, month: 1, day: 1 }), - getDefaultSettings({ weekStart: "monday" }) - ); + settings.set(getDefaultSettings({ weekStart: "monday" })); + const monthData = getMonthData(moment({ year: 2020, month: 1, day: 1 })); expect( - monthData.map((week) => week.days.map((day) => day.date.date())) + monthData.map((week) => week.days.map((day) => day.date())) ).toEqual([ [27, 28, 29, 30, 31, 1, 2], [3, 4, 5, 6, 7, 8, 9], diff --git a/src/ui/sources/CalendarSource.ts b/src/ui/sources/CalendarSource.ts new file mode 100644 index 0000000..90c199d --- /dev/null +++ b/src/ui/sources/CalendarSource.ts @@ -0,0 +1,25 @@ +import type { Moment } from "moment"; + +export interface IDot { + color: string; + isFilled: boolean; +} + +export interface IDayMetadata { + classes?: string[]; + dataAttributes?: string[]; + dots: Promise; +} + +export interface IWeekMetadata { + classes?: string[]; + dataAttributes?: string[]; + dots: Promise; +} + +export abstract class CalendarSource { + // eslint-disable-next-line @typescript-eslint/no-explicit-any + abstract getDailyMetadata(date: Moment, ...args: any[]): IDayMetadata; + // eslint-disable-next-line @typescript-eslint/no-explicit-any + abstract getWeeklyMetadata(date: Moment, ...args: any[]): IDayMetadata; +} diff --git a/src/ui/sources/DailyNoteSource.ts b/src/ui/sources/DailyNoteSource.ts new file mode 100644 index 0000000..642d916 --- /dev/null +++ b/src/ui/sources/DailyNoteSource.ts @@ -0,0 +1,109 @@ +import type { Moment } from "moment"; +import { parseFrontMatterTags, TFile } from "obsidian"; +import { getDailyNote } from "obsidian-daily-notes-interface"; +import { get } from "svelte/store"; + +import { clamp, getWordCount } from "src/ui/utils"; + +import { + CalendarSource, + IDayMetadata, + IWeekMetadata, + IDot, +} from "obsidian-calendar-ui"; +import { dailyNotes, settings } from "../stores"; + +const NUM_MAX_DOTS = 5; + +export async function getWordLengthAsDots(note: TFile): Promise { + const { wordsPerDot } = get(settings); + if (!note || wordsPerDot <= 0) { + return 0; + } + const fileContents = await window.app.vault.cachedRead(note); + + const numDots = getWordCount(fileContents) / wordsPerDot; + return clamp(Math.floor(numDots), 1, NUM_MAX_DOTS); +} + +export function getNoteTags(note: TFile | null): string[] { + if (!note) { + return []; + } + + const { metadataCache } = window.app; + const frontmatter = metadataCache.getFileCache(note)?.frontmatter; + + const tags = []; + + if (frontmatter) { + const frontmatterTags = parseFrontMatterTags(frontmatter) || []; + tags.push(...frontmatterTags); + } + + return tags.map((tag) => tag.substring(1)); +} + +export async function getNumberOfRemainingTasks(note: TFile): Promise { + if (!note) { + return 0; + } + + const { vault } = window.app; + const fileContents = await vault.cachedRead(note); + return (fileContents.match(/(-|\*) \[ \]/g) || []).length; +} + +export async function getDotsForDailyNote( + dailyNote: TFile | null +): Promise { + if (!dailyNote) { + return []; + } + const numSolidDots = await getWordLengthAsDots(dailyNote); + const numHollowDots = await getNumberOfRemainingTasks(dailyNote); + + const dots = []; + for (let i = 0; i < numSolidDots; i++) { + dots.push({ + color: "default", + isFilled: true, + }); + } + for (let i = 0; i < numHollowDots; i++) { + dots.push({ + color: "default", + isFilled: false, + }); + } + + return dots; +} + +export default class DailyNoteSource extends CalendarSource { + private getClasses(file: TFile): string[] { + const classes = []; + if (file) { + classes.push("has-note"); + } + return classes; + } + + public getDailyMetadata(date: Moment): IDayMetadata { + const file = getDailyNote(date, get(dailyNotes)); + return { + classes: this.getClasses(file), + dataAttributes: getNoteTags(file), + dots: getDotsForDailyNote(file), + }; + } + + public getWeeklyMetadata(date: Moment): IWeekMetadata { + const file = getDailyNote(date, get(dailyNotes)); + return { + classes: this.getClasses(file), + dataAttributes: getNoteTags(file), + dots: getDotsForDailyNote(file), + }; + } +} diff --git a/src/ui/stores.ts b/src/ui/stores.ts new file mode 100644 index 0000000..3ad9fe5 --- /dev/null +++ b/src/ui/stores.ts @@ -0,0 +1,41 @@ +import type { Moment } from "moment"; +import type { TFile } from "obsidian"; +import { writable } from "svelte/store"; +import { getAllDailyNotes } from "obsidian-daily-notes-interface"; + +import { DEFAULT_WORDS_PER_DOT } from "src/constants"; +import type { ISettings } from "src/settings"; + +function createDailyNotesStore() { + const store = writable>(null); + return { + reindex: () => store.set(getAllDailyNotes()), + ...store, + }; +} + +function createDisplayedMonthStore() { + const store = writable(null); + return { + reset: () => store.set(window.moment()), + increment: () => store.update((month) => month.clone().add(1, "months")), + decrement: () => + store.update((month) => month.clone().subtract(1, "months")), + ...store, + }; +} + +export const activeFile = writable(null); +export const displayedMonth = createDisplayedMonthStore(); +export const dailyNotes = createDailyNotesStore(); +export const settings = writable({ + shouldConfirmBeforeCreate: true, + weekStart: "locale", + + wordsPerDot: DEFAULT_WORDS_PER_DOT, + + showWeeklyNote: false, + weeklyNoteFormat: "", + weeklyNoteTemplate: "", + weeklyNoteFolder: "", +}); diff --git a/src/ui/utils.ts b/src/ui/utils.ts index 220bdc6..2ef2275 100644 --- a/src/ui/utils.ts +++ b/src/ui/utils.ts @@ -1,40 +1,22 @@ import type { Moment } from "moment"; import * as os from "os"; -import { parseFrontMatterTags, TFile } from "obsidian"; import type { ISettings } from "src/settings"; -import { getDailyNote, IDailyNote } from "obsidian-daily-notes-interface"; -import { getWeeklyNote } from "src/io/weeklyNotes"; - -const NUM_MAX_DOTS = 5; - export interface IWeek { - days: IDailyNote[]; + days: Moment[]; weekNum: number; - weeklyNote: TFile; } export type IMonth = IWeek[]; -export interface IDot { - color: string; - isFilled: boolean; -} -export interface IDayMetadata { - classes?: string[]; - dataAttributes?: string[]; - dots: Promise; -} -// export type IActualizedCalendarSource = Record; -// export type ICalendarSource = ( -// month: IMonth, -// settings: ISettings -// ) => IActualizedCalendarSource; - -function clamp(num: number, lowerBound: number, upperBound: number) { +export function clamp( + num: number, + lowerBound: number, + upperBound: number +): number { return Math.min(Math.max(lowerBound, num), upperBound); } -function getWordCount(text: string): number { +export function getWordCount(text: string): number { const wordChars = /(?:[',.0-9;A-Z_a-z\xAA\xB2\xB3\xB5\xB9\xBA\xBC-\xBE\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0560-\u0589\u05D0-\u05EA\u05EF-\u05F2\u060C\u060D\u0620-\u064A\u0660-\u0669\u066C\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07C0-\u07EA\u07F4\u07F5\u07F8\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u0860-\u086A\u08A0-\u08B4\u08B6-\u08BD\u0904-\u0939\u093D\u0950\u0958-\u0961\u0966-\u096F\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09E6-\u09F1\u09F4-\u09F9\u09FC\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A66-\u0A6F\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AE6-\u0AEF\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B66-\u0B6F\u0B71-\u0B77\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0BE6-\u0BF2\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C60\u0C61\u0C66-\u0C6F\u0C78-\u0C7E\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CE6-\u0CEF\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D58-\u0D61\u0D66-\u0D78\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0DE6-\u0DEF\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E50-\u0E59\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0ED0-\u0ED9\u0EDC-\u0EDF\u0F00\u0F20-\u0F33\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F-\u1049\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u1090-\u1099\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1369-\u137C\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u17E0-\u17E9\u17F0-\u17F9\u1810-\u1819\u1820-\u1878\u1880-\u1884\u1887-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1946-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u19D0-\u19DA\u1A00-\u1A16\u1A20-\u1A54\u1A80-\u1A89\u1A90-\u1A99\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B50-\u1B59\u1B83-\u1BA0\u1BAE-\u1BE5\u1C00-\u1C23\u1C40-\u1C49\u1C4D-\u1C7D\u1C80-\u1C88\u1C90-\u1CBA\u1CBD-\u1CBF\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2018\u2019\u2024\u203F\u2040\u2044\u2054\u2070\u2071\u2074-\u2079\u207F-\u2089\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2150-\u2189\u2460-\u249B\u24EA-\u24FF\u2776-\u2793\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2CFD\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312F\u3131-\u318E\u3192-\u3195\u31A0-\u31BA\u31F0-\u31FF\u3220-\u3229\u3248-\u324F\u3251-\u325F\u3280-\u3289\u32B1-\u32BF\u3400-\u4DB5\u4E00-\u9FEF\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA7B9\uA7F7-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA830-\uA835\uA840-\uA873\uA882-\uA8B3\uA8D0-\uA8D9\uA8F2-\uA8F7\uA8FB\uA8FD\uA8FE\uA900-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF-\uA9D9\uA9E0-\uA9E4\uA9E6-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA50-\uAA59\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABE2\uABF0-\uABF9\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE10\uFE14\uFE33\uFE34\uFE4D-\uFE50\uFE52\uFE54\uFE70-\uFE74\uFE76-\uFEFC\uFF07\uFF0C\uFF0E\uFF10-\uFF19\uFF1B\uFF21-\uFF3A\uFF3F\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD07-\uDD33\uDD40-\uDD78\uDD8A\uDD8B\uDE80-\uDE9C\uDEA0-\uDED0\uDEE1-\uDEFB\uDF00-\uDF23\uDF2D-\uDF4A\uDF50-\uDF75\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCA0-\uDCA9\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC58-\uDC76\uDC79-\uDC9E\uDCA7-\uDCAF\uDCE0-\uDCF2\uDCF4\uDCF5\uDCFB-\uDD1B\uDD20-\uDD39\uDD80-\uDDB7\uDDBC-\uDDCF\uDDD2-\uDE00\uDE10-\uDE13\uDE15-\uDE17\uDE19-\uDE35\uDE40-\uDE48\uDE60-\uDE7E\uDE80-\uDE9F\uDEC0-\uDEC7\uDEC9-\uDEE4\uDEEB-\uDEEF\uDF00-\uDF35\uDF40-\uDF55\uDF58-\uDF72\uDF78-\uDF91\uDFA9-\uDFAF]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2\uDCFA-\uDD23\uDD30-\uDD39\uDE60-\uDE7E\uDF00-\uDF27\uDF30-\uDF45\uDF51-\uDF54]|\uD804[\uDC03-\uDC37\uDC52-\uDC6F\uDC83-\uDCAF\uDCD0-\uDCE8\uDCF0-\uDCF9\uDD03-\uDD26\uDD36-\uDD3F\uDD44\uDD50-\uDD72\uDD76\uDD83-\uDDB2\uDDC1-\uDDC4\uDDD0-\uDDDA\uDDDC\uDDE1-\uDDF4\uDE00-\uDE11\uDE13-\uDE2B\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEDE\uDEF0-\uDEF9\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3D\uDF50\uDF5D-\uDF61]|\uD805[\uDC00-\uDC34\uDC47-\uDC4A\uDC50-\uDC59\uDC80-\uDCAF\uDCC4\uDCC5\uDCC7\uDCD0-\uDCD9\uDD80-\uDDAE\uDDD8-\uDDDB\uDE00-\uDE2F\uDE44\uDE50-\uDE59\uDE80-\uDEAA\uDEC0-\uDEC9\uDF00-\uDF1A\uDF30-\uDF3B]|\uD806[\uDC00-\uDC2B\uDCA0-\uDCF2\uDCFF\uDE00\uDE0B-\uDE32\uDE3A\uDE50\uDE5C-\uDE83\uDE86-\uDE89\uDE9D\uDEC0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC2E\uDC40\uDC50-\uDC6C\uDC72-\uDC8F\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD30\uDD46\uDD50-\uDD59\uDD60-\uDD65\uDD67\uDD68\uDD6A-\uDD89\uDD98\uDDA0-\uDDA9\uDEE0-\uDEF2]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD81C-\uD820\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDE60-\uDE69\uDED0-\uDEED\uDF00-\uDF2F\uDF40-\uDF43\uDF50-\uDF59\uDF5B-\uDF61\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDE40-\uDE96\uDF00-\uDF44\uDF50\uDF93-\uDF9F\uDFE0\uDFE1]|\uD821[\uDC00-\uDFF1]|\uD822[\uDC00-\uDEF2]|\uD82C[\uDC00-\uDD1E\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99]|\uD834[\uDEE0-\uDEF3\uDF60-\uDF78]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB\uDFCE-\uDFFF]|\uD83A[\uDC00-\uDCC4\uDCC7-\uDCCF\uDD00-\uDD43\uDD50-\uDD59]|\uD83B[\uDC71-\uDCAB\uDCAD-\uDCAF\uDCB1-\uDCB4\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD83C[\uDD00-\uDD0C]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|\uD87E[\uDC00-\uDE1D]|[\u00AD\u2010\u2011]|\u002D(?!\u002D))+/g; return (text.match(wordChars) || []).length; } @@ -56,47 +38,6 @@ function getWordCount(text: string): number { // return target; // } -export async function getWordLengthAsDots( - note: TFile, - settings: ISettings -): Promise { - if (!note || settings.wordsPerDot <= 0) { - return 0; - } - const fileContents = await window.app.vault.cachedRead(note); - - const numDots = getWordCount(fileContents) / settings.wordsPerDot; - return clamp(Math.floor(numDots), 1, NUM_MAX_DOTS); -} - -export function getNoteTags(note: TFile | null): string[] { - if (!note) { - return []; - } - - const { metadataCache } = window.app; - const frontmatter = metadataCache.getFileCache(note)?.frontmatter; - - const tags = []; - - if (frontmatter) { - const frontmatterTags = parseFrontMatterTags(frontmatter) || []; - tags.push(...frontmatterTags); - } - - return tags.map((tag) => tag.substring(1)); -} - -export async function getNumberOfRemainingTasks(note: TFile): Promise { - if (!note) { - return 0; - } - - const { vault } = window.app; - const fileContents = await vault.cachedRead(note); - return (fileContents.match(/(-|\*) \[ \]/g) || []).length; -} - function isMacOS() { return os.platform() === "darwin"; } @@ -113,8 +54,8 @@ export function isWeekend(date: Moment): boolean { return date.isoWeekday() === 6 || date.isoWeekday() === 7; } -export function getStartOfWeek(days: IDailyNote[], _weekNum: number): Moment { - return days[0].date.weekday(0); +export function getStartOfWeek(days: Moment[]): Moment { + return days[0].weekday(0); } /** @@ -122,9 +63,9 @@ export function getStartOfWeek(days: IDailyNote[], _weekNum: number): Moment { * the calendar view. */ export function getMonthData( - dailyNotes: IDailyNote[], displayedMonth: Moment, - settings: ISettings + // eslint-disable-next-line @typescript-eslint/no-explicit-any + ..._upstreamChanges: any[] ): IMonth { const month = []; let week: IWeek; @@ -138,88 +79,13 @@ export function getMonthData( week = { days: [], weekNum: date.week(), - weeklyNote: getWeeklyNote(date, settings), }; month.push(week); } - const file = getDailyNote(date, dailyNotes); - - week.days.push({ - date, - file, - // isActive: activeFile && activeFile === note?.basename, - - // numDots: getNumberOfDots(note, settings), - // numTasksRemaining: getNumberOfRemainingTasks(note), - // tags: getNoteTags(note), - }); - + week.days.push(date); date = date.clone().add(1, "days"); } return month; } - -export async function getDotsForDailyNote( - dailyNote: TFile, - settings: ISettings -): Promise { - const numSolidDots = await getWordLengthAsDots(dailyNote, settings); - const numHollowDots = await getNumberOfRemainingTasks(dailyNote); - - const dots = []; - for (let i = 0; i < numSolidDots; i++) { - dots.push({ - color: "default", - isFilled: true, - }); - } - for (let i = 0; i < numHollowDots; i++) { - dots.push({ - color: "default", - isFilled: false, - }); - } - - return dots; -} - -export abstract class CalendarSource { - abstract getMetadata(date: Moment): IDayMetadata; -} - -export class DailyNoteSource extends CalendarSource { - dailyNotes: IDailyNote[]; - settings: ISettings; - - constructor(dailyNotes: IDailyNote[], settings: ISettings) { - super(); - - this.dailyNotes = dailyNotes; - this.settings = settings; - } - - getMetadata(date: Moment): IDayMetadata { - const file = this.dailyNotes.find((item) => item.date === date).file; - return { - classes: [], - dataAttributes: getNoteTags(file), - dots: getDotsForDailyNote(file, this.settings), - }; - } -} - -export function buildDailyNotesSource( - dailyNotes: IDailyNote[], - settings: ISettings -): (date: Moment) => IDayMetadata { - return (date: Moment) => { - const file = dailyNotes.find((item) => item.date === date).file; - return { - classes: [], - dataAttributes: getNoteTags(file), - dots: getDotsForDailyNote(file, settings), - }; - }; -} diff --git a/src/view.ts b/src/view.ts index 7af804d..0b626d2 100644 --- a/src/view.ts +++ b/src/view.ts @@ -1,18 +1,21 @@ import type { Moment } from "moment"; -import { getDailyNoteSettings } from "obsidian-daily-notes-interface"; +import { getDailyNote, getDateFromFile } from "obsidian-daily-notes-interface"; import { FileView, TFile, ItemView, WorkspaceLeaf } from "obsidian"; +import { MetadataCache } from "obsidian-calendar-ui"; +import { get } from "svelte/store"; import { VIEW_TYPE_CALENDAR } from "src/constants"; import { tryToCreateDailyNote } from "src/io/dailyNotes"; import { tryToCreateWeeklyNote } from "src/io/weeklyNotes"; import { getWeeklyNoteSettings, ISettings } from "src/settings"; -import { activeFile, displayedMonth } from "./ui/stores"; -import { DailyNoteSource } from "./ui/utils"; +import { activeFile, dailyNotes } from "./ui/stores"; import Calendar from "./ui/Calendar.svelte"; +import DailyNoteSource from "./ui/sources/DailyNoteSource"; export default class CalendarView extends ItemView { private calendar: Calendar; + private metadata: MetadataCache; private settings: ISettings; constructor(leaf: WorkspaceLeaf, settings: ISettings) { @@ -22,13 +25,18 @@ export default class CalendarView extends ItemView { this._openOrCreateDailyNote = this._openOrCreateDailyNote.bind(this); this.openOrCreateWeeklyNote = this.openOrCreateWeeklyNote.bind(this); - this.redraw = this.redraw.bind(this); + + this.onFileCreated = this.onFileCreated.bind(this); + this.onFileDeleted = this.onFileDeleted.bind(this); + this.onFileModified = this.onFileModified.bind(this); + this.onFileOpen = this.onFileOpen.bind(this); + this.onHover = this.onHover.bind(this); - this.registerEvent(this.app.workspace.on("file-open", this.redraw)); - // might need to regen dailyNotes on `delete` - this.registerEvent(this.app.vault.on("modify", this.redraw)); - this.registerEvent(this.app.vault.on("delete", this.redraw)); + this.registerEvent(this.app.vault.on("create", this.onFileCreated)); + this.registerEvent(this.app.vault.on("delete", this.onFileDeleted)); + this.registerEvent(this.app.vault.on("modify", this.onFileModified)); + this.registerEvent(this.app.workspace.on("file-open", this.onFileOpen)); } getViewType(): string { @@ -50,50 +58,66 @@ export default class CalendarView extends ItemView { return Promise.resolve(); } - onHover(targetEl: EventTarget, filename: string, note: TFile): void { - this.app.workspace.trigger( - "link-hover", - this, - targetEl, - filename, - note?.path - ); - } - async onOpen(): Promise { - const activeLeaf = this.app.workspace.activeLeaf; - const activeFile = activeLeaf - ? (activeLeaf.view as FileView).file?.path - : null; + dailyNotes.reindex(); + this.metadata = new MetadataCache(new DailyNoteSource()); this.calendar = new Calendar({ // eslint-disable-next-line @typescript-eslint/no-explicit-any target: (this as any).contentEl, props: { - activeFile, - source: DailyNoteSource, - - openOrCreateDailyNote: this._openOrCreateDailyNote, - openOrCreateWeeklyNote: this.openOrCreateWeeklyNote, - onHover: this.onHover, + onClickDay: this._openOrCreateDailyNote, + onClickWeek: this.openOrCreateWeeklyNote, + onHoverDay: this.onHover, + onHoverWeek: this.onHover, + metadata: this.metadata, }, }); } - public async redraw(): Promise { - if (!this.calendar) { - return; + onHover(date: Moment, targetEl: EventTarget): void { + const note = getDailyNote(date, get(dailyNotes)); + // TODO: Fix this "" + this.app.workspace.trigger("link-hover", this, targetEl, "", note?.path); + } + + private async onFileDeleted(file: TFile): Promise { + const date = getDateFromFile(file); + if (date) { + dailyNotes.reindex(); + this.updateActiveFile(); } + } - const { workspace } = this.app; - const view = workspace.activeLeaf.view; + private async onFileModified(file: TFile): Promise { + const date = getDateFromFile(file); + if (date) { + this.metadata.refreshDay(date); + } + } + + private onFileCreated(file: TFile): void { + if (this.app.workspace.layoutReady) { + const date = getDateFromFile(file); + if (date) { + dailyNotes.reindex(); + } + } + } - let activeFilename = null; + private updateActiveFile(): void { + const { view } = this.app.workspace.activeLeaf; + + let file = null; if (view instanceof FileView) { - activeFilename = view.file?.basename; + file = view.file; + this.metadata.selectedDate.set(getDateFromFile(file)); } + activeFile.set(file); + } - activeFile.update(() => activeFilename); + public onFileOpen(_file: TFile): void { + this.updateActiveFile(); } public revealActiveNote(): void { @@ -102,18 +126,17 @@ export default class CalendarView extends ItemView { if (activeLeaf.view instanceof FileView) { // Check to see if the active note is a daily-note - let { format } = getDailyNoteSettings(); - let date = moment(activeLeaf.view.file.basename, format, true); - if (date.isValid()) { - displayedMonth.update(() => date); + let date = getDateFromFile(activeLeaf.view.file); + if (date) { + this.metadata.displayedMonth.update(() => date); return; } // Check to see if the active note is a weekly-note - format = getWeeklyNoteSettings(this.settings).format; + const format = getWeeklyNoteSettings(this.settings).format; date = moment(activeLeaf.view.file.basename, format, true); if (date.isValid()) { - displayedMonth.update(() => date); + this.metadata.displayedMonth.update(() => date); return; } } @@ -121,13 +144,14 @@ export default class CalendarView extends ItemView { async openOrCreateWeeklyNote( date: Moment, - existingFile: TFile, inNewSplit: boolean ): Promise { const { workspace } = this.app; const startOfWeek = date.clone().startOf("week"); + const existingFile = getDailyNote(date, get(dailyNotes)); + if (!existingFile) { // File doesn't exist tryToCreateWeeklyNote(startOfWeek, inNewSplit, this.settings, (file) => { @@ -146,11 +170,10 @@ export default class CalendarView extends ItemView { async _openOrCreateDailyNote( date: Moment, - existingFile: TFile, inNewSplit: boolean ): Promise { const { workspace } = this.app; - + const existingFile = getDailyNote(date, get(dailyNotes)); if (!existingFile) { // File doesn't exist tryToCreateDailyNote( @@ -158,6 +181,7 @@ export default class CalendarView extends ItemView { inNewSplit, this.settings, (dailyNote: TFile) => { + // this.dailyNotesSource.reindex(); activeFile.update(() => dailyNote); } ); diff --git a/yarn.lock b/yarn.lock index 7f471f2..5ec5321 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3329,19 +3329,28 @@ object.pick@^1.3.0: dependencies: isobject "^3.0.1" -obsidian-daily-notes-interface@0.3.1: - version "0.3.1" - resolved "https://registry.yarnpkg.com/obsidian-daily-notes-interface/-/obsidian-daily-notes-interface-0.3.1.tgz#dcc5bb0c9d06b3fa5f1f95cb2ad5d73b10e05d08" - integrity sha512-yt1WQnM29QqiY11yI9Q9k8PhqjjSHqywPgXg7MySXm0+/KOBUB27ZX0OJx7rF3SCATt3y7Dv4jsQU6OSqDpSeA== +obsidian-calendar-ui@0.0.2: + version "0.0.2" + resolved "https://registry.yarnpkg.com/obsidian-calendar-ui/-/obsidian-calendar-ui-0.0.2.tgz#565aaf46c8c4b633ac19199802e69ee69c3f9b68" + integrity sha512-Pqbu63jBrDkgWgbAagDrA7a4gFySGOV8heB9d/Qcz2tNhphFO+mO+WDw+0jT2dVkUQ74qMiBKFtSMzJOD/6lDA== dependencies: - obsidian obsidianmd/obsidian-api#master + obsidian-daily-notes-interface "0.4.0" + svelte "3.31.0" tslib "2.0.3" +<<<<<<< HEAD obsidian@obsidianmd/obsidian-api#master: version "0.10.0" resolved "https://codeload.github.com/obsidianmd/obsidian-api/tar.gz/2e4ac7c8dd4d1b8ca4cf726eac75a935a3ea25d8" +======= +obsidian-daily-notes-interface@0.4.0: + version "0.4.0" + resolved "https://registry.yarnpkg.com/obsidian-daily-notes-interface/-/obsidian-daily-notes-interface-0.4.0.tgz#9bbc1813146ebbff60df986fd717f90b2620d309" + integrity sha512-CTokiN+6UJ7umihC5equ3sMx5kO9F3X94sSrMN8nrUHjVQYfZiGX/cFhCqh7laeE7MC0g8Kzwzv6/6VLbpmV6w== +>>>>>>> 8f2022a (Generalize sources) dependencies: - "@types/codemirror" "0.0.98" + obsidian obsidianmd/obsidian-api#master + tslib "2.0.3" once@^1.3.0, once@^1.3.1, once@^1.4.0: version "1.4.0" From 8bf80fb512a44e5ceca8ae2049722b480d459b97 Mon Sep 17 00:00:00 2001 From: Liam Cain Date: Sun, 3 Jan 2021 09:54:22 -0500 Subject: [PATCH 3/7] Use generic calendar UI bump version of calendar-ui filemenu apply gggg patch for weekly notes add issue template bug fixes - no longer has multiple days selected at once - deselects day when navigating to non-daily note - no longer resets displayedMonth on tick() - now supports any day of the week (monday, tuesday, wednesday, thursday, friday, saturday, sunday) Fastforward settings improvements Fix locale config Move localization code from plugin into ui lib Fix update on settings change use 0.2.0 of the cal-ui --- .github/ISSUE_TEMPLATE/bug_report.md | 41 +++ .github/ISSUE_TEMPLATE/feature_request.md | 21 ++ .github/workflows/{main.yml => publish.yml} | 0 .github/workflows/test.yml | 14 + .gitignore | 1 + README.md | 6 +- package.json | 20 +- src/io/weeklyNotes.ts | 2 +- src/localization.ts | 46 ---- src/main.ts | 24 +- src/settings.ts | 104 +++++--- src/testUtils/settings.ts | 7 +- src/ui/Calendar.svelte | 47 ++-- src/ui/__tests__/utils.spec.ts | 83 ------ src/ui/fileMenu.ts | 23 ++ src/ui/sources/CalendarSource.ts | 25 -- src/ui/sources/DailyNoteSource.ts | 109 -------- src/ui/sources/index.ts | 4 + src/ui/sources/streak.ts | 34 +++ src/ui/sources/tags.ts | 44 ++++ src/ui/sources/tasks.ts | 56 ++++ src/ui/sources/wordCount.ts | 61 +++++ src/ui/stores.ts | 21 +- src/ui/utils.ts | 120 ++++----- src/view.ts | 149 ++++++++--- yarn.lock | 268 ++++++++++---------- 26 files changed, 723 insertions(+), 607 deletions(-) create mode 100644 .github/ISSUE_TEMPLATE/bug_report.md create mode 100644 .github/ISSUE_TEMPLATE/feature_request.md rename .github/workflows/{main.yml => publish.yml} (100%) create mode 100644 .github/workflows/test.yml delete mode 100644 src/localization.ts delete mode 100644 src/ui/__tests__/utils.spec.ts create mode 100644 src/ui/fileMenu.ts delete mode 100644 src/ui/sources/CalendarSource.ts delete mode 100644 src/ui/sources/DailyNoteSource.ts create mode 100644 src/ui/sources/index.ts create mode 100644 src/ui/sources/streak.ts create mode 100644 src/ui/sources/tags.ts create mode 100644 src/ui/sources/tasks.ts create mode 100644 src/ui/sources/wordCount.ts diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md new file mode 100644 index 0000000..3d4a6de --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -0,0 +1,41 @@ +--- +name: Bug report +about: Create a report to help us improve +title: "" +labels: bug, needs-review +assignees: "" +--- + +> **Before Submitting:** Double-check that you are running the latest version of the plugin. The bug might have already been fixed 😄 + +### Describe the bug + +_A clear and concise description of what the bug is._ + +### Steps to reproduce + +1. Go to '...' +2. Click on '....' +3. See error + +### Expected behavior + +_A clear and concise description of what you expected to happen_. + +### Screenshots + +_If applicable, add screenshots to help explain your problem._ + +### Environment (please specify) + +#### OS + +[e.g. macOS] + +#### Obsidian Version (e.g. v0.10.6) + +`(Settings → About → Current Version)` + +### Additional context + +_Add any other context about the problem here._ diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md new file mode 100644 index 0000000..a187e22 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/feature_request.md @@ -0,0 +1,21 @@ +--- +name: Feature request +about: Suggest an idea for this project +title: "" +labels: enhancement +assignees: "" +--- + +> **Before Submitting:** Double-check that you are running the latest version of the plugin. The feature might have already been included 😄 + +**Is your feature request related to a problem? Please describe.** +A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] + +**Describe the solution you'd like** +A clear and concise description of what you want to happen. + +**Describe alternatives you've considered** +A clear and concise description of any alternative solutions or features you've considered. + +**Additional context** +Add any other context or screenshots about the feature request here. diff --git a/.github/workflows/main.yml b/.github/workflows/publish.yml similarity index 100% rename from .github/workflows/main.yml rename to .github/workflows/publish.yml diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..b8acf18 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,14 @@ +name: CI +on: + pull_request: + branches: + - main +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Install modules + run: yarn + - name: Run tests + run: yarn test diff --git a/.gitignore b/.gitignore index ee699c6..c67a9a4 100644 --- a/.gitignore +++ b/.gitignore @@ -2,4 +2,5 @@ node_modules/ dist/ data.json main.js +.vscode/ *.code-workspace \ No newline at end of file diff --git a/README.md b/README.md index 770be3d..db69fce 100644 --- a/README.md +++ b/README.md @@ -106,7 +106,7 @@ From the Settings menu, you can toggle "Start week on Monday". ### How do I include "unformatted" words in my weekly note filenames? -If you want the weekly note format to include a word (e.g. "Week 21 of Year 2020") you can do so by surrounding the words with `[]` brackets. This tells [moment](https://momentjs.com/docs/#/displaying/format/) to ignore the words. So for the example above, you would set your format to `[Week] ww [of Year] YYYY`. +If you want the weekly note format to include a word (e.g. "Week 21 of Year 2020") you can do so by surrounding the words with `[]` brackets. This tells [moment](https://momentjs.com/docs/#/displaying/format/) to ignore the words. So for the example above, you would set your format to `[Week] ww [of Year] gggg`. ### I don't like showing the week numbers but I still want to use weekly notes. Can I still use them? @@ -171,9 +171,9 @@ You can open **weekly notes** in 2 ways: searching `Calendar: open weekly note` | Tag | Description | | -------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -| `sunday`, `monday`, `tuesday`, `wednesday`, `thursday`, `friday`, `saturday`, `sunday` | Because weekly tags refer to main days, you can refer to individual days like this `{{sunday:YYYY-MM-DD}}` to automatically insert the date for that particular day. Note, you must specify the date format! | +| `sunday`, `monday`, `tuesday`, `wednesday`, `thursday`, `friday`, `saturday`, `sunday` | Because weekly tags refer to main days, you can refer to individual days like this `{{sunday:gggg-MM-DD}}` to automatically insert the date for that particular day. Note, you must specify the date format! | | `title` | Works the same as the daily note `{{title}}`. It will insert the title of the note | -| `date`, `time` | Works the same as the daily note `{{date}}` and `{{time}}`. It will insert the date and time of the first day of the week. Useful for creating a heading (e.g. `# # {{date:YYYY [Week] ww}}`). | +| `date`, `time` | Works the same as the daily note `{{date}}` and `{{time}}`. It will insert the date and time of the first day of the week. Useful for creating a heading (e.g. `# # {{date:gggg [Week] ww}}`). | ## Say Thanks 🙏 diff --git a/package.json b/package.json index fcd8984..c908eea 100644 --- a/package.json +++ b/package.json @@ -13,24 +13,24 @@ }, "dependencies": { "obsidian": "obsidianmd/obsidian-api#master", - "obsidian-calendar-ui": "0.0.2", - "obsidian-daily-notes-interface": "0.4.0", + "obsidian-calendar-ui": "0.2.0", + "obsidian-daily-notes-interface": "0.5.1", "svelte": "3.31.0", "tslib": "2.0.3" }, "devDependencies": { "@rollup/plugin-commonjs": "17.0.0", "@rollup/plugin-node-resolve": "11.0.0", - "@rollup/plugin-typescript": "8.0.0", - "@testing-library/jest-dom": "5.11.6", - "@testing-library/svelte": "3.0.0", + "@rollup/plugin-typescript": "8.1.0", + "@testing-library/jest-dom": "5.11.9", + "@testing-library/svelte": "3.0.3", "@tsconfig/svelte": "1.0.10", - "@types/jest": "26.0.19", + "@types/jest": "26.0.20", "@types/moment": "2.13.0", - "@types/node": "14.14.13", - "@typescript-eslint/eslint-plugin": "4.9.1", - "@typescript-eslint/parser": "4.9.1", - "eslint": "7.15.0", + "@types/node": "14.14.21", + "@typescript-eslint/eslint-plugin": "4.13.0", + "@typescript-eslint/parser": "4.13.0", + "eslint": "7.18.0", "jest": "26.6.3", "moment": "2.29.1", "rollup": "2.34.2", diff --git a/src/io/weeklyNotes.ts b/src/io/weeklyNotes.ts index 20b4f75..8a24375 100644 --- a/src/io/weeklyNotes.ts +++ b/src/io/weeklyNotes.ts @@ -107,7 +107,7 @@ export async function tryToCreateWeeklyNote( cta: "Create", onAccept: createFile, text: `File ${filename} does not exist. Would you like to create it?`, - title: "New Daily Note", + title: "New Weekly Note", }); } else { await createFile(); diff --git a/src/localization.ts b/src/localization.ts deleted file mode 100644 index 9f65f88..0000000 --- a/src/localization.ts +++ /dev/null @@ -1,46 +0,0 @@ -import type { ISettings } from "./settings"; - -const langToMomentLocale = { - en: "en-gb", - zh: "zh-cn", - "zh-TW": "zh-tw", - ru: "ru", - ko: "ko", - it: "it", - id: "id", - ro: "ro", - "pt-BR": "pt-br", - cz: "cs", - de: "de", - es: "es", - fr: "fr", - no: "nn", - pl: "pl", - pt: "pt", - tr: "tr", - hi: "hi", - nl: "nl", - ar: "ar", - ja: "ja", -}; - -export async function configureMomentLocale( - settings: ISettings -): Promise { - const obsidianLang = localStorage.getItem("language") || "en"; - const systemLang = navigator.language?.toLowerCase(); - const localeOverride = settings.localeOverride || "system-default"; - - let momentLocale = langToMomentLocale[obsidianLang]; - - if (localeOverride !== "system-default") { - momentLocale = localeOverride; - } else if (systemLang.startsWith(obsidianLang)) { - momentLocale = systemLang; - } - - const currentLocale = window.moment.locale(momentLocale); - console.info( - `Calendar initialization: Trying to switch Moment.js global locale to ${momentLocale}, got ${currentLocale}` - ); -} diff --git a/src/main.ts b/src/main.ts index 1a65bea..d10c4dc 100644 --- a/src/main.ts +++ b/src/main.ts @@ -1,15 +1,9 @@ import type { Moment, WeekSpec } from "moment"; import { App, Plugin, WorkspaceLeaf } from "obsidian"; -import { configureMomentLocale } from "src/localization"; - import { VIEW_TYPE_CALENDAR } from "./constants"; import { settings } from "./ui/stores"; -import { - CalendarSettingsTab, - ISettings, - syncMomentLocaleWithSettings, -} from "./settings"; +import { CalendarSettingsTab, ISettings } from "./settings"; import CalendarView from "./view"; declare global { @@ -34,14 +28,13 @@ export default class CalendarPlugin extends Plugin { this.register( settings.subscribe((value) => { this.options = value; - configureMomentLocale(this.options); + // TODO pass new weekStart and localeOverride to Calendar }) ); this.registerView( VIEW_TYPE_CALENDAR, - (leaf: WorkspaceLeaf) => - (this.view = new CalendarView(leaf, this.options)) + (leaf: WorkspaceLeaf) => (this.view = new CalendarView(leaf)) ); this.addCommand({ @@ -63,12 +56,6 @@ export default class CalendarPlugin extends Plugin { callback: () => this.view.openOrCreateWeeklyNote(window.moment(), false), }); - // this.addCommand({ - // id: "reload-calendar-view", - // name: "Reload daily note settings", - // callback: () => {}, - // }); - this.addCommand({ id: "reveal-active-note", name: "Reveal active note", @@ -77,10 +64,6 @@ export default class CalendarPlugin extends Plugin { await this.loadOptions(); - // After we retrieve the settings, override window.moment to - // reflect 'start week on monday' setting - syncMomentLocaleWithSettings(this.options); - this.addSettingTab(new CalendarSettingsTab(this.app, this)); if (this.app.workspace.layoutReady) { @@ -117,7 +100,6 @@ export default class CalendarPlugin extends Plugin { changeOpts: (settings: ISettings) => Partial ): Promise { settings.update((old) => ({ ...old, ...changeOpts(old) })); - syncMomentLocaleWithSettings(this.options); await this.saveData(this.options); } } diff --git a/src/settings.ts b/src/settings.ts index 7fd0e19..2ec7cea 100644 --- a/src/settings.ts +++ b/src/settings.ts @@ -1,4 +1,5 @@ import { App, PluginSettingTab, Setting } from "obsidian"; +import { writable } from "svelte/store"; import { DEFAULT_WEEK_FORMAT, DEFAULT_WORDS_PER_DOT } from "src/constants"; @@ -8,8 +9,16 @@ import { IDailyNoteSettings, } from "obsidian-daily-notes-interface"; -type IWeekStartOption = "sunday" | "monday" | "locale"; type ILocaleOverride = "system-default" | string; +type IWeekStartOption = + | "sunday" + | "monday" + | "tuesday" + | "wednesday" + | "thursday" + | "friday" + | "saturday" + | "locale"; export interface ISettings { wordsPerDot: number; @@ -25,6 +34,16 @@ export interface ISettings { localeOverride: ILocaleOverride; } +const weekdays = [ + "sunday", + "monday", + "tuesday", + "wednesday", + "thursday", + "friday", + "saturday", +]; + export function getWeeklyNoteSettings(settings: ISettings): IDailyNoteSettings { return { format: settings.weeklyNoteFormat || DEFAULT_WEEK_FORMAT, @@ -35,29 +54,21 @@ export function getWeeklyNoteSettings(settings: ISettings): IDailyNoteSettings { }; } -export function syncMomentLocaleWithSettings(settings: ISettings): void { - const { moment } = window; - const currentLocale = moment.locale(); +export const defaultSettings = Object.freeze({ + shouldConfirmBeforeCreate: true, + weekStart: "locale" as IWeekStartOption, - // Save the initial locale weekspec so that we can restore - // it when toggling between the different options in settings. - if (!window._bundledLocaleWeekSpec) { - // eslint-disable-next-line @typescript-eslint/no-explicit-any - window._bundledLocaleWeekSpec = (moment.localeData())._week; - } + wordsPerDot: DEFAULT_WORDS_PER_DOT, - if (settings.weekStart === "locale") { - moment.updateLocale(currentLocale, { - week: window._bundledLocaleWeekSpec, - }); - } else { - moment.updateLocale(currentLocale, { - week: { - dow: settings.weekStart === "monday" ? 1 : 0, - }, - }); - } -} + showWeeklyNote: false, + weeklyNoteFormat: "", + weeklyNoteTemplate: "", + weeklyNoteFolder: "", + + localeOverride: "system-default", +}); + +export const SettingsInstance = writable(defaultSettings); export class CalendarSettingsTab extends PluginSettingTab { private plugin: CalendarPlugin; @@ -74,7 +85,7 @@ export class CalendarSettingsTab extends PluginSettingTab { text: "General Settings", }); this.addDotThresholdSetting(); - this.addStartWeekOnMondaySetting(); + this.addWeekStartSetting(); this.addConfirmCreateSetting(); this.addShowWeeklyNoteSetting(); @@ -113,16 +124,16 @@ export class CalendarSettingsTab extends PluginSettingTab { textfield.setValue(String(this.plugin.options.wordsPerDot)); textfield.onChange(async (value) => { this.plugin.writeOptions(() => ({ - wordsPerDot: Number(value), + wordsPerDot: value !== "" ? Number(value) : undefined, })); }); }); } - addStartWeekOnMondaySetting(): void { + addWeekStartSetting(): void { const { moment } = window; - const [sunday, monday] = moment.weekdays(); + const localizedWeekdays = moment.weekdays(); const localeWeekStartNum = window._bundledLocaleWeekSpec.dow; const localeWeekStart = moment.weekdays()[localeWeekStartNum]; @@ -133,8 +144,9 @@ export class CalendarSettingsTab extends PluginSettingTab { ) .addDropdown((dropdown) => { dropdown.addOption("locale", `Locale default (${localeWeekStart})`); - dropdown.addOption("sunday", sunday); - dropdown.addOption("monday", monday); + localizedWeekdays.forEach((day, i) => { + dropdown.addOption(weekdays[i], day); + }); dropdown.setValue(this.plugin.options.weekStart); dropdown.onChange(async (value) => { this.plugin.writeOptions(() => ({ @@ -165,9 +177,7 @@ export class CalendarSettingsTab extends PluginSettingTab { .addToggle((toggle) => { toggle.setValue(this.plugin.options.showWeeklyNote); toggle.onChange(async (value) => { - this.plugin.writeOptions(() => ({ - showWeeklyNote: value, - })); + this.plugin.writeOptions(() => ({ showWeeklyNote: value })); this.display(); // show/hide weekly settings }); }); @@ -181,9 +191,7 @@ export class CalendarSettingsTab extends PluginSettingTab { textfield.setValue(this.plugin.options.weeklyNoteFormat); textfield.setPlaceholder(DEFAULT_WEEK_FORMAT); textfield.onChange(async (value) => { - this.plugin.writeOptions(() => ({ - weeklyNoteFormat: value, - })); + this.plugin.writeOptions(() => ({ weeklyNoteFormat: value })); }); }); } @@ -197,9 +205,7 @@ export class CalendarSettingsTab extends PluginSettingTab { .addText((textfield) => { textfield.setValue(this.plugin.options.weeklyNoteTemplate); textfield.onChange(async (value) => { - this.plugin.writeOptions(() => ({ - weeklyNoteTemplate: value, - })); + this.plugin.writeOptions(() => ({ weeklyNoteTemplate: value })); }); }); } @@ -211,8 +217,30 @@ export class CalendarSettingsTab extends PluginSettingTab { .addText((textfield) => { textfield.setValue(this.plugin.options.weeklyNoteFolder); textfield.onChange(async (value) => { + this.plugin.writeOptions(() => ({ weeklyNoteFolder: value })); + }); + }); + } + + addLocaleOverrideSetting(): void { + const { moment } = window; + + const sysLocale = navigator.language?.toLowerCase(); + + new Setting(this.containerEl) + .setName("Override locale:") + .setDesc( + "Set this if you want to use a locale different from the default" + ) + .addDropdown((dropdown) => { + dropdown.addOption("system-default", `Same as system (${sysLocale})`); + moment.locales().forEach((locale) => { + dropdown.addOption(locale, locale); + }); + dropdown.setValue(this.plugin.options.localeOverride); + dropdown.onChange(async (value) => { this.plugin.writeOptions(() => ({ - weeklyNoteFolder: value, + localeOverride: value as ILocaleOverride, })); }); }); diff --git a/src/testUtils/settings.ts b/src/testUtils/settings.ts index c65fedc..d79dbe0 100644 --- a/src/testUtils/settings.ts +++ b/src/testUtils/settings.ts @@ -1,9 +1,9 @@ -import { ISettings, syncMomentLocaleWithSettings } from "src/settings"; +import type { ISettings } from "src/settings"; export function getDefaultSettings( overrides: Partial = {} ): ISettings { - const settings = Object.assign( + return Object.assign( {}, { weekStart: "sunday", @@ -16,7 +16,4 @@ export function getDefaultSettings( }, overrides ); - syncMomentLocaleWithSettings(settings); - - return settings; } diff --git a/src/ui/Calendar.svelte b/src/ui/Calendar.svelte index 25d30de..6a0a4c4 100644 --- a/src/ui/Calendar.svelte +++ b/src/ui/Calendar.svelte @@ -1,32 +1,41 @@ + + - diff --git a/src/ui/__tests__/utils.spec.ts b/src/ui/__tests__/utils.spec.ts deleted file mode 100644 index 5e95714..0000000 --- a/src/ui/__tests__/utils.spec.ts +++ /dev/null @@ -1,83 +0,0 @@ -import moment from "moment"; - -import { settings } from "../../ui/stores"; -import { getDefaultSettings } from "../../testUtils/settings"; -import mockApp from "../../testUtils/mockApp"; -import { getMonthData } from "../utils"; - -jest.mock("obsidian"); - -describe("getMonthData", () => { - beforeEach(() => { - window.app = mockApp; - window.moment = moment; - }); - - describe("january", () => { - it("creates correct calendar starting on Sunday", () => { - settings.set(getDefaultSettings({ weekStart: "sunday" })); - const monthData = getMonthData(moment({ year: 2020, month: 0, day: 1 })); - - expect( - monthData.map((week) => week.days.map((day) => day.date())) - ).toEqual([ - [29, 30, 31, 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, 1], - [2, 3, 4, 5, 6, 7, 8], - ]); - }); - - it("creates correct calendar starting on Monday", () => { - settings.set(getDefaultSettings({ weekStart: "monday" })); - const monthData = getMonthData(moment({ year: 2020, month: 0, day: 1 })); - - expect( - monthData.map((week) => week.days.map((day) => day.date())) - ).toEqual([ - [30, 31, 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, 1, 2], - [3, 4, 5, 6, 7, 8, 9], - ]); - }); - }); - - describe("february", () => { - it("creates correct calendar starting on Sunday", () => { - settings.set(getDefaultSettings({ weekStart: "sunday" })); - const monthData = getMonthData(moment({ year: 2020, month: 1, day: 1 })); - - expect( - monthData.map((week) => week.days.map((day) => day.date())) - ).toEqual([ - [26, 27, 28, 29, 30, 31, 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], - [1, 2, 3, 4, 5, 6, 7], - ]); - }); - - it("creates correct calendar starting on Monday", () => { - settings.set(getDefaultSettings({ weekStart: "monday" })); - const monthData = getMonthData(moment({ year: 2020, month: 1, day: 1 })); - - expect( - monthData.map((week) => week.days.map((day) => day.date())) - ).toEqual([ - [27, 28, 29, 30, 31, 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, 1], - [2, 3, 4, 5, 6, 7, 8], - ]); - }); - }); -}); diff --git a/src/ui/fileMenu.ts b/src/ui/fileMenu.ts new file mode 100644 index 0000000..d99926d --- /dev/null +++ b/src/ui/fileMenu.ts @@ -0,0 +1,23 @@ +import { App, Menu, Point, TFile } from "obsidian"; + +export function showFileMenu(app: App, file: TFile, position: Point): void { + const fileMenu = new Menu(); + fileMenu.addItem((item) => + item + .setTitle("Delete") + .setIcon("trash") + .onClick(() => { + // eslint-disable-next-line @typescript-eslint/no-explicit-any + (app).fileManager.promptForFolderDeletion(file); + }) + ); + + app.workspace.trigger( + "file-menu", + fileMenu, + file, + "calendar-context-menu", + null + ); + fileMenu.showAtPosition(position); +} diff --git a/src/ui/sources/CalendarSource.ts b/src/ui/sources/CalendarSource.ts deleted file mode 100644 index 90c199d..0000000 --- a/src/ui/sources/CalendarSource.ts +++ /dev/null @@ -1,25 +0,0 @@ -import type { Moment } from "moment"; - -export interface IDot { - color: string; - isFilled: boolean; -} - -export interface IDayMetadata { - classes?: string[]; - dataAttributes?: string[]; - dots: Promise; -} - -export interface IWeekMetadata { - classes?: string[]; - dataAttributes?: string[]; - dots: Promise; -} - -export abstract class CalendarSource { - // eslint-disable-next-line @typescript-eslint/no-explicit-any - abstract getDailyMetadata(date: Moment, ...args: any[]): IDayMetadata; - // eslint-disable-next-line @typescript-eslint/no-explicit-any - abstract getWeeklyMetadata(date: Moment, ...args: any[]): IDayMetadata; -} diff --git a/src/ui/sources/DailyNoteSource.ts b/src/ui/sources/DailyNoteSource.ts deleted file mode 100644 index 642d916..0000000 --- a/src/ui/sources/DailyNoteSource.ts +++ /dev/null @@ -1,109 +0,0 @@ -import type { Moment } from "moment"; -import { parseFrontMatterTags, TFile } from "obsidian"; -import { getDailyNote } from "obsidian-daily-notes-interface"; -import { get } from "svelte/store"; - -import { clamp, getWordCount } from "src/ui/utils"; - -import { - CalendarSource, - IDayMetadata, - IWeekMetadata, - IDot, -} from "obsidian-calendar-ui"; -import { dailyNotes, settings } from "../stores"; - -const NUM_MAX_DOTS = 5; - -export async function getWordLengthAsDots(note: TFile): Promise { - const { wordsPerDot } = get(settings); - if (!note || wordsPerDot <= 0) { - return 0; - } - const fileContents = await window.app.vault.cachedRead(note); - - const numDots = getWordCount(fileContents) / wordsPerDot; - return clamp(Math.floor(numDots), 1, NUM_MAX_DOTS); -} - -export function getNoteTags(note: TFile | null): string[] { - if (!note) { - return []; - } - - const { metadataCache } = window.app; - const frontmatter = metadataCache.getFileCache(note)?.frontmatter; - - const tags = []; - - if (frontmatter) { - const frontmatterTags = parseFrontMatterTags(frontmatter) || []; - tags.push(...frontmatterTags); - } - - return tags.map((tag) => tag.substring(1)); -} - -export async function getNumberOfRemainingTasks(note: TFile): Promise { - if (!note) { - return 0; - } - - const { vault } = window.app; - const fileContents = await vault.cachedRead(note); - return (fileContents.match(/(-|\*) \[ \]/g) || []).length; -} - -export async function getDotsForDailyNote( - dailyNote: TFile | null -): Promise { - if (!dailyNote) { - return []; - } - const numSolidDots = await getWordLengthAsDots(dailyNote); - const numHollowDots = await getNumberOfRemainingTasks(dailyNote); - - const dots = []; - for (let i = 0; i < numSolidDots; i++) { - dots.push({ - color: "default", - isFilled: true, - }); - } - for (let i = 0; i < numHollowDots; i++) { - dots.push({ - color: "default", - isFilled: false, - }); - } - - return dots; -} - -export default class DailyNoteSource extends CalendarSource { - private getClasses(file: TFile): string[] { - const classes = []; - if (file) { - classes.push("has-note"); - } - return classes; - } - - public getDailyMetadata(date: Moment): IDayMetadata { - const file = getDailyNote(date, get(dailyNotes)); - return { - classes: this.getClasses(file), - dataAttributes: getNoteTags(file), - dots: getDotsForDailyNote(file), - }; - } - - public getWeeklyMetadata(date: Moment): IWeekMetadata { - const file = getDailyNote(date, get(dailyNotes)); - return { - classes: this.getClasses(file), - dataAttributes: getNoteTags(file), - dots: getDotsForDailyNote(file), - }; - } -} diff --git a/src/ui/sources/index.ts b/src/ui/sources/index.ts new file mode 100644 index 0000000..50ae573 --- /dev/null +++ b/src/ui/sources/index.ts @@ -0,0 +1,4 @@ +export { streakSource } from "./streak"; +export { customTagsSource } from "./tags"; +export { tasksSource } from "./tasks"; +export { wordCountSource } from "./wordCount"; diff --git a/src/ui/sources/streak.ts b/src/ui/sources/streak.ts new file mode 100644 index 0000000..31c2339 --- /dev/null +++ b/src/ui/sources/streak.ts @@ -0,0 +1,34 @@ +import type { Moment } from "moment"; +import type { TFile } from "obsidian"; +import type { ICalendarSource, IDayMetadata } from "obsidian-calendar-ui"; +import { getDailyNote } from "obsidian-daily-notes-interface"; +import { get } from "svelte/store"; + +import { getWeeklyNote } from "src/io/weeklyNotes"; + +import { dailyNotes, settings } from "../stores"; +import { classList } from "../utils"; + +const getStreakClasses = (file: TFile): string[] => { + return classList({ + "has-note": !!file, + }); +}; + +export const streakSource: ICalendarSource = { + getDailyMetadata: async (date: Moment): Promise => { + const file = getDailyNote(date, get(dailyNotes)); + return { + classes: getStreakClasses(file), + dots: [], + }; + }, + + getWeeklyMetadata: async (date: Moment): Promise => { + const file = getWeeklyNote(date, get(settings)); + return { + classes: getStreakClasses(file), + dots: [], + }; + }, +}; diff --git a/src/ui/sources/tags.ts b/src/ui/sources/tags.ts new file mode 100644 index 0000000..d3e83c9 --- /dev/null +++ b/src/ui/sources/tags.ts @@ -0,0 +1,44 @@ +import type { Moment } from "moment"; +import { parseFrontMatterTags, TFile } from "obsidian"; +import type { ICalendarSource, IDayMetadata } from "obsidian-calendar-ui"; +import { getDailyNote } from "obsidian-daily-notes-interface"; +import { get } from "svelte/store"; + +import { getWeeklyNote } from "src/io/weeklyNotes"; + +import { dailyNotes, settings } from "../stores"; + +function getNoteTags(note: TFile | null): string[] { + if (!note) { + return []; + } + + const { metadataCache } = window.app; + const frontmatter = metadataCache.getFileCache(note)?.frontmatter; + + const tags = []; + + if (frontmatter) { + const frontmatterTags = parseFrontMatterTags(frontmatter) || []; + tags.push(...frontmatterTags); + } + + return tags.map((tag) => tag.substring(1)); +} + +export const customTagsSource: ICalendarSource = { + getDailyMetadata: async (date: Moment): Promise => { + const file = getDailyNote(date, get(dailyNotes)); + return { + dataAttributes: getNoteTags(file), + dots: [], + }; + }, + getWeeklyMetadata: async (date: Moment): Promise => { + const file = getWeeklyNote(date, get(settings)); + return { + dataAttributes: getNoteTags(file), + dots: [], + }; + }, +}; diff --git a/src/ui/sources/tasks.ts b/src/ui/sources/tasks.ts new file mode 100644 index 0000000..6c288ea --- /dev/null +++ b/src/ui/sources/tasks.ts @@ -0,0 +1,56 @@ +import type { Moment } from "moment"; +import type { TFile } from "obsidian"; +import type { ICalendarSource, IDayMetadata, IDot } from "obsidian-calendar-ui"; +import { getDailyNote } from "obsidian-daily-notes-interface"; +import { get } from "svelte/store"; + +import { getWeeklyNote } from "src/io/weeklyNotes"; + +import { dailyNotes, settings } from "../stores"; + +export async function getNumberOfRemainingTasks(note: TFile): Promise { + if (!note) { + return 0; + } + + const { vault } = window.app; + const fileContents = await vault.cachedRead(note); + return (fileContents.match(/(-|\*) \[ \]/g) || []).length; +} + +export async function getDotsForDailyNote( + dailyNote: TFile | null +): Promise { + if (!dailyNote) { + return []; + } + const numTasks = await getNumberOfRemainingTasks(dailyNote); + + const dots = []; + if (numTasks) { + dots.push({ + color: "default", + isFilled: false, + }); + } + return dots; +} + +export const tasksSource: ICalendarSource = { + getDailyMetadata: async (date: Moment): Promise => { + const file = getDailyNote(date, get(dailyNotes)); + const dots = await getDotsForDailyNote(file); + return { + dots, + }; + }, + + getWeeklyMetadata: async (date: Moment): Promise => { + const file = getWeeklyNote(date, get(settings)); + const dots = await getDotsForDailyNote(file); + + return { + dots, + }; + }, +}; diff --git a/src/ui/sources/wordCount.ts b/src/ui/sources/wordCount.ts new file mode 100644 index 0000000..fc53d89 --- /dev/null +++ b/src/ui/sources/wordCount.ts @@ -0,0 +1,61 @@ +import type { Moment } from "moment"; +import type { TFile } from "obsidian"; +import type { ICalendarSource, IDayMetadata, IDot } from "obsidian-calendar-ui"; +import { getDailyNote } from "obsidian-daily-notes-interface"; +import { get } from "svelte/store"; + +import { getWeeklyNote } from "src/io/weeklyNotes"; + +import { dailyNotes, settings } from "../stores"; +import { clamp, getWordCount } from "../utils"; + +const NUM_MAX_DOTS = 5; + +export async function getWordLengthAsDots(note: TFile): Promise { + const { wordsPerDot } = get(settings); + if (!note || wordsPerDot <= 0) { + return 0; + } + const fileContents = await window.app.vault.cachedRead(note); + + const wordCount = getWordCount(fileContents); + const numDots = wordCount / wordsPerDot; + return clamp(Math.floor(numDots), 1, NUM_MAX_DOTS); +} + +export async function getDotsForDailyNote( + dailyNote: TFile | null +): Promise { + if (!dailyNote) { + return []; + } + const numSolidDots = await getWordLengthAsDots(dailyNote); + + const dots = []; + for (let i = 0; i < numSolidDots; i++) { + dots.push({ + color: "default", + isFilled: true, + }); + } + return dots; +} + +export const wordCountSource: ICalendarSource = { + getDailyMetadata: async (date: Moment): Promise => { + const file = getDailyNote(date, get(dailyNotes)); + const dots = await getDotsForDailyNote(file); + return { + dots, + }; + }, + + getWeeklyMetadata: async (date: Moment): Promise => { + const file = getWeeklyNote(date, get(settings)); + const dots = await getDotsForDailyNote(file); + + return { + dots, + }; + }, +}; diff --git a/src/ui/stores.ts b/src/ui/stores.ts index 3ad9fe5..b11aac3 100644 --- a/src/ui/stores.ts +++ b/src/ui/stores.ts @@ -1,4 +1,3 @@ -import type { Moment } from "moment"; import type { TFile } from "obsidian"; import { writable } from "svelte/store"; import { getAllDailyNotes } from "obsidian-daily-notes-interface"; @@ -6,6 +5,8 @@ import { getAllDailyNotes } from "obsidian-daily-notes-interface"; import { DEFAULT_WORDS_PER_DOT } from "src/constants"; import type { ISettings } from "src/settings"; +import { getDateUIDFromFile } from "./utils"; + function createDailyNotesStore() { const store = writable>(null); return { @@ -14,19 +15,19 @@ function createDailyNotesStore() { }; } -function createDisplayedMonthStore() { - const store = writable(null); +function createSelectedFileStore() { + const store = writable(null); + return { - reset: () => store.set(window.moment()), - increment: () => store.update((month) => month.clone().add(1, "months")), - decrement: () => - store.update((month) => month.clone().subtract(1, "months")), + setFile: (file: TFile) => { + const id = getDateUIDFromFile(file); + store.set(id); + }, ...store, }; } -export const activeFile = writable(null); -export const displayedMonth = createDisplayedMonthStore(); +export const activeFile = createSelectedFileStore(); export const dailyNotes = createDailyNotesStore(); export const settings = writable({ shouldConfirmBeforeCreate: true, @@ -38,4 +39,6 @@ export const settings = writable({ weeklyNoteFormat: "", weeklyNoteTemplate: "", weeklyNoteFolder: "", + + localeOverride: "system-default", }); diff --git a/src/ui/utils.ts b/src/ui/utils.ts index 2ef2275..56ebc45 100644 --- a/src/ui/utils.ts +++ b/src/ui/utils.ts @@ -1,12 +1,16 @@ -import type { Moment } from "moment"; -import * as os from "os"; +import type { TFile } from "obsidian"; +import { get } from "svelte/store"; +import { getDateFromFile, getDateUID } from "obsidian-daily-notes-interface"; -import type { ISettings } from "src/settings"; -export interface IWeek { - days: Moment[]; - weekNum: number; -} -export type IMonth = IWeek[]; +import { getWeeklyNoteSettings } from "src/settings"; + +import { settings } from "./stores"; + +export const classList = (obj: Record): string[] => { + return Object.entries(obj) + .filter(([_k, v]) => !!v) + .map(([k, _k]) => k); +}; export function clamp( num: number, @@ -16,76 +20,44 @@ export function clamp( return Math.min(Math.max(lowerBound, num), upperBound); } -export function getWordCount(text: string): number { - const wordChars = /(?:[',.0-9;A-Z_a-z\xAA\xB2\xB3\xB5\xB9\xBA\xBC-\xBE\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0560-\u0589\u05D0-\u05EA\u05EF-\u05F2\u060C\u060D\u0620-\u064A\u0660-\u0669\u066C\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07C0-\u07EA\u07F4\u07F5\u07F8\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u0860-\u086A\u08A0-\u08B4\u08B6-\u08BD\u0904-\u0939\u093D\u0950\u0958-\u0961\u0966-\u096F\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09E6-\u09F1\u09F4-\u09F9\u09FC\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A66-\u0A6F\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AE6-\u0AEF\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B66-\u0B6F\u0B71-\u0B77\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0BE6-\u0BF2\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C60\u0C61\u0C66-\u0C6F\u0C78-\u0C7E\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CE6-\u0CEF\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D58-\u0D61\u0D66-\u0D78\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0DE6-\u0DEF\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E50-\u0E59\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0ED0-\u0ED9\u0EDC-\u0EDF\u0F00\u0F20-\u0F33\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F-\u1049\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u1090-\u1099\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1369-\u137C\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u17E0-\u17E9\u17F0-\u17F9\u1810-\u1819\u1820-\u1878\u1880-\u1884\u1887-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1946-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u19D0-\u19DA\u1A00-\u1A16\u1A20-\u1A54\u1A80-\u1A89\u1A90-\u1A99\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B50-\u1B59\u1B83-\u1BA0\u1BAE-\u1BE5\u1C00-\u1C23\u1C40-\u1C49\u1C4D-\u1C7D\u1C80-\u1C88\u1C90-\u1CBA\u1CBD-\u1CBF\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2018\u2019\u2024\u203F\u2040\u2044\u2054\u2070\u2071\u2074-\u2079\u207F-\u2089\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2150-\u2189\u2460-\u249B\u24EA-\u24FF\u2776-\u2793\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2CFD\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312F\u3131-\u318E\u3192-\u3195\u31A0-\u31BA\u31F0-\u31FF\u3220-\u3229\u3248-\u324F\u3251-\u325F\u3280-\u3289\u32B1-\u32BF\u3400-\u4DB5\u4E00-\u9FEF\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA7B9\uA7F7-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA830-\uA835\uA840-\uA873\uA882-\uA8B3\uA8D0-\uA8D9\uA8F2-\uA8F7\uA8FB\uA8FD\uA8FE\uA900-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF-\uA9D9\uA9E0-\uA9E4\uA9E6-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA50-\uAA59\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABE2\uABF0-\uABF9\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE10\uFE14\uFE33\uFE34\uFE4D-\uFE50\uFE52\uFE54\uFE70-\uFE74\uFE76-\uFEFC\uFF07\uFF0C\uFF0E\uFF10-\uFF19\uFF1B\uFF21-\uFF3A\uFF3F\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD07-\uDD33\uDD40-\uDD78\uDD8A\uDD8B\uDE80-\uDE9C\uDEA0-\uDED0\uDEE1-\uDEFB\uDF00-\uDF23\uDF2D-\uDF4A\uDF50-\uDF75\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCA0-\uDCA9\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC58-\uDC76\uDC79-\uDC9E\uDCA7-\uDCAF\uDCE0-\uDCF2\uDCF4\uDCF5\uDCFB-\uDD1B\uDD20-\uDD39\uDD80-\uDDB7\uDDBC-\uDDCF\uDDD2-\uDE00\uDE10-\uDE13\uDE15-\uDE17\uDE19-\uDE35\uDE40-\uDE48\uDE60-\uDE7E\uDE80-\uDE9F\uDEC0-\uDEC7\uDEC9-\uDEE4\uDEEB-\uDEEF\uDF00-\uDF35\uDF40-\uDF55\uDF58-\uDF72\uDF78-\uDF91\uDFA9-\uDFAF]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2\uDCFA-\uDD23\uDD30-\uDD39\uDE60-\uDE7E\uDF00-\uDF27\uDF30-\uDF45\uDF51-\uDF54]|\uD804[\uDC03-\uDC37\uDC52-\uDC6F\uDC83-\uDCAF\uDCD0-\uDCE8\uDCF0-\uDCF9\uDD03-\uDD26\uDD36-\uDD3F\uDD44\uDD50-\uDD72\uDD76\uDD83-\uDDB2\uDDC1-\uDDC4\uDDD0-\uDDDA\uDDDC\uDDE1-\uDDF4\uDE00-\uDE11\uDE13-\uDE2B\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEDE\uDEF0-\uDEF9\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3D\uDF50\uDF5D-\uDF61]|\uD805[\uDC00-\uDC34\uDC47-\uDC4A\uDC50-\uDC59\uDC80-\uDCAF\uDCC4\uDCC5\uDCC7\uDCD0-\uDCD9\uDD80-\uDDAE\uDDD8-\uDDDB\uDE00-\uDE2F\uDE44\uDE50-\uDE59\uDE80-\uDEAA\uDEC0-\uDEC9\uDF00-\uDF1A\uDF30-\uDF3B]|\uD806[\uDC00-\uDC2B\uDCA0-\uDCF2\uDCFF\uDE00\uDE0B-\uDE32\uDE3A\uDE50\uDE5C-\uDE83\uDE86-\uDE89\uDE9D\uDEC0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC2E\uDC40\uDC50-\uDC6C\uDC72-\uDC8F\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD30\uDD46\uDD50-\uDD59\uDD60-\uDD65\uDD67\uDD68\uDD6A-\uDD89\uDD98\uDDA0-\uDDA9\uDEE0-\uDEF2]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD81C-\uD820\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDE60-\uDE69\uDED0-\uDEED\uDF00-\uDF2F\uDF40-\uDF43\uDF50-\uDF59\uDF5B-\uDF61\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDE40-\uDE96\uDF00-\uDF44\uDF50\uDF93-\uDF9F\uDFE0\uDFE1]|\uD821[\uDC00-\uDFF1]|\uD822[\uDC00-\uDEF2]|\uD82C[\uDC00-\uDD1E\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99]|\uD834[\uDEE0-\uDEF3\uDF60-\uDF78]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB\uDFCE-\uDFFF]|\uD83A[\uDC00-\uDCC4\uDCC7-\uDCCF\uDD00-\uDD43\uDD50-\uDD59]|\uD83B[\uDC71-\uDCAB\uDCAD-\uDCAF\uDCB1-\uDCB4\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD83C[\uDD00-\uDD0C]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|\uD87E[\uDC00-\uDE1D]|[\u00AD\u2010\u2011]|\u002D(?!\u002D))+/g; - return (text.match(wordChars) || []).length; -} - -// export function mergeSources( -// sources: IActualizedCalendarSource[] -// ): IActualizedCalendarSource { -// const target: IActualizedCalendarSource = {}; -// const merger = (source: IActualizedCalendarSource) => { -// for (const prop in source) { -// if (Object.prototype.hasOwnProperty.call(source, prop)) { -// target[prop] = source[prop]; -// } -// } -// }; -// for (let i = 0; i < arguments.length; i++) { -// merger(sources[i]); -// } -// return target; -// } - -function isMacOS() { - return os.platform() === "darwin"; -} - -export function isMetaPressed(e: MouseEvent): boolean { - return isMacOS() ? e.metaKey : e.ctrlKey; -} - -export function getDaysOfWeek(_settings: ISettings): string[] { - return window.moment.weekdaysShort(true); -} - -export function isWeekend(date: Moment): boolean { - return date.isoWeekday() === 6 || date.isoWeekday() === 7; -} - -export function getStartOfWeek(days: Moment[]): Moment { - return days[0].weekday(0); -} - /** - * Generate a 2D array of daily information to power - * the calendar view. + * Lookup the dateUID for a given file. It compares the filename + * to the daily and weekly note formats to find a match. + * + * @param file */ -export function getMonthData( - displayedMonth: Moment, - // eslint-disable-next-line @typescript-eslint/no-explicit-any - ..._upstreamChanges: any[] -): IMonth { - const month = []; - let week: IWeek; - - const startOfMonth = displayedMonth.clone().date(1); - const startOffset = startOfMonth.weekday(); - let date: Moment = startOfMonth.clone().subtract(startOffset, "days"); +export function getDateUIDFromFile(file: TFile | null): string { + if (!file) { + return null; + } - for (let _day = 0; _day < 42; _day++) { - if (_day % 7 === 0) { - week = { - days: [], - weekNum: date.week(), - }; - month.push(week); - } + // TODO: I'm not checking the path! + let date = getDateFromFile(file); + if (date) { + return getDateUID(date, "day"); + } - week.days.push(date); - date = date.clone().add(1, "days"); + // Check to see if the active note is a weekly-note + const format = getWeeklyNoteSettings(get(settings)).format; + date = window.moment(file.basename, format, true); + if (date.isValid()) { + return getDateUID(date, "week"); } + return null; +} - return month; +export function getWordCount(text: string): number { + const spaceDelimitedChars = /A-Za-z\u00AA\u00B5\u00BA\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA\u05F0-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u08A0-\u08B4\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C60\u0C61\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16F1-\u16F8\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1877\u1880-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2183\u2184\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005\u3006\u3031-\u3035\u303B\u303C\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6E5\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AD\uA7B0-\uA7B7\uA7F7-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC/ + .source; + const nonSpaceDelimitedWords = /\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u4E00-\u9FD5/ + .source; + + const pattern = new RegExp( + [ + `(?:[0-9]+(?:(?:,|\\.)[0-9]+)*|[\\-${spaceDelimitedChars}])+`, + nonSpaceDelimitedWords, + ].join("|"), + "g" + ); + return (text.match(pattern) || []).length; } diff --git a/src/view.ts b/src/view.ts index 0b626d2..8eed9ba 100644 --- a/src/view.ts +++ b/src/view.ts @@ -1,29 +1,35 @@ import type { Moment } from "moment"; -import { getDailyNote, getDateFromFile } from "obsidian-daily-notes-interface"; +import { + getDailyNote, + getDailyNoteSettings, + getDateFromFile, +} from "obsidian-daily-notes-interface"; import { FileView, TFile, ItemView, WorkspaceLeaf } from "obsidian"; -import { MetadataCache } from "obsidian-calendar-ui"; import { get } from "svelte/store"; import { VIEW_TYPE_CALENDAR } from "src/constants"; import { tryToCreateDailyNote } from "src/io/dailyNotes"; -import { tryToCreateWeeklyNote } from "src/io/weeklyNotes"; +import { getWeeklyNote, tryToCreateWeeklyNote } from "src/io/weeklyNotes"; import { getWeeklyNoteSettings, ISettings } from "src/settings"; -import { activeFile, dailyNotes } from "./ui/stores"; import Calendar from "./ui/Calendar.svelte"; -import DailyNoteSource from "./ui/sources/DailyNoteSource"; +import { showFileMenu } from "./ui/fileMenu"; +import { activeFile, dailyNotes, settings } from "./ui/stores"; +import { + customTagsSource, + streakSource, + tasksSource, + wordCountSource, +} from "./ui/sources"; export default class CalendarView extends ItemView { private calendar: Calendar; - private metadata: MetadataCache; private settings: ISettings; - constructor(leaf: WorkspaceLeaf, settings: ISettings) { + constructor(leaf: WorkspaceLeaf) { super(leaf); - this.settings = settings; - - this._openOrCreateDailyNote = this._openOrCreateDailyNote.bind(this); + this.openOrCreateDailyNote = this.openOrCreateDailyNote.bind(this); this.openOrCreateWeeklyNote = this.openOrCreateWeeklyNote.bind(this); this.onFileCreated = this.onFileCreated.bind(this); @@ -31,12 +37,26 @@ export default class CalendarView extends ItemView { this.onFileModified = this.onFileModified.bind(this); this.onFileOpen = this.onFileOpen.bind(this); - this.onHover = this.onHover.bind(this); + this.onHoverDay = this.onHoverDay.bind(this); + this.onHoverWeek = this.onHoverWeek.bind(this); + + this.onContextMenuDay = this.onContextMenuDay.bind(this); + this.onContextMenuWeek = this.onContextMenuWeek.bind(this); this.registerEvent(this.app.vault.on("create", this.onFileCreated)); this.registerEvent(this.app.vault.on("delete", this.onFileDeleted)); this.registerEvent(this.app.vault.on("modify", this.onFileModified)); this.registerEvent(this.app.workspace.on("file-open", this.onFileOpen)); + + this.settings = null; + settings.subscribe((val) => { + this.settings = val; + + // Refresh the calendar if settings change + if (this.calendar) { + this.calendar.tick(); + } + }); } getViewType(): string { @@ -60,25 +80,82 @@ export default class CalendarView extends ItemView { async onOpen(): Promise { dailyNotes.reindex(); - this.metadata = new MetadataCache(new DailyNoteSource()); this.calendar = new Calendar({ // eslint-disable-next-line @typescript-eslint/no-explicit-any target: (this as any).contentEl, props: { - onClickDay: this._openOrCreateDailyNote, + onClickDay: this.openOrCreateDailyNote, onClickWeek: this.openOrCreateWeeklyNote, - onHoverDay: this.onHover, - onHoverWeek: this.onHover, - metadata: this.metadata, + onHoverDay: this.onHoverDay, + onHoverWeek: this.onHoverWeek, + onContextMenuDay: this.onContextMenuDay, + onContextMenuWeek: this.onContextMenuWeek, + sources: [streakSource, customTagsSource, wordCountSource, tasksSource], }, }); } - onHover(date: Moment, targetEl: EventTarget): void { + onHoverDay( + date: Moment, + targetEl: EventTarget, + isMetaPressed: boolean + ): void { + if (!isMetaPressed) { + return; + } + const { format } = getDailyNoteSettings(); const note = getDailyNote(date, get(dailyNotes)); - // TODO: Fix this "" - this.app.workspace.trigger("link-hover", this, targetEl, "", note?.path); + this.app.workspace.trigger( + "link-hover", + this, + targetEl, + date.format(format), + note?.path + ); + } + + onHoverWeek( + date: Moment, + targetEl: EventTarget, + isMetaPressed: boolean + ): void { + if (!isMetaPressed) { + return; + } + const note = getWeeklyNote(date, this.settings); + const { format } = getWeeklyNoteSettings(this.settings); + this.app.workspace.trigger( + "link-hover", + this, + targetEl, + date.format(format), + note?.path + ); + } + + private onContextMenuDay(date: Moment, event: MouseEvent): void { + const note = getDailyNote(date, get(dailyNotes)); + if (!note) { + // If no file exists for a given day, show nothing. + return; + } + showFileMenu(this.app, note, { + x: event.pageX, + y: event.pageY, + }); + } + + private onContextMenuWeek(date: Moment, event: MouseEvent): void { + const note = getWeeklyNote(date, this.settings); + if (!note) { + // If no file exists for a given day, show nothing. + return; + } + showFileMenu(this.app, note, { + x: event.pageX, + y: event.pageY, + }); } private async onFileDeleted(file: TFile): Promise { @@ -92,7 +169,7 @@ export default class CalendarView extends ItemView { private async onFileModified(file: TFile): Promise { const date = getDateFromFile(file); if (date) { - this.metadata.refreshDay(date); + this.calendar.tick(); } } @@ -101,23 +178,26 @@ export default class CalendarView extends ItemView { const date = getDateFromFile(file); if (date) { dailyNotes.reindex(); + this.calendar.tick(); } } } + public onFileOpen(_file: TFile): void { + if (this.app.workspace.layoutReady) { + this.updateActiveFile(); + } + } + private updateActiveFile(): void { const { view } = this.app.workspace.activeLeaf; let file = null; if (view instanceof FileView) { file = view.file; - this.metadata.selectedDate.set(getDateFromFile(file)); } - activeFile.set(file); - } - - public onFileOpen(_file: TFile): void { - this.updateActiveFile(); + activeFile.setFile(file); + this.calendar.tick(); } public revealActiveNote(): void { @@ -128,7 +208,7 @@ export default class CalendarView extends ItemView { // Check to see if the active note is a daily-note let date = getDateFromFile(activeLeaf.view.file); if (date) { - this.metadata.displayedMonth.update(() => date); + this.calendar.$set({ displayedMonth: date }); return; } @@ -136,7 +216,7 @@ export default class CalendarView extends ItemView { const format = getWeeklyNoteSettings(this.settings).format; date = moment(activeLeaf.view.file.basename, format, true); if (date.isValid()) { - this.metadata.displayedMonth.update(() => date); + this.calendar.$set({ displayedMonth: date }); return; } } @@ -150,12 +230,12 @@ export default class CalendarView extends ItemView { const startOfWeek = date.clone().startOf("week"); - const existingFile = getDailyNote(date, get(dailyNotes)); + const existingFile = getWeeklyNote(date, this.settings); if (!existingFile) { // File doesn't exist tryToCreateWeeklyNote(startOfWeek, inNewSplit, this.settings, (file) => { - activeFile.update(() => file); + activeFile.setFile(file); }); return; } @@ -165,10 +245,10 @@ export default class CalendarView extends ItemView { : workspace.getUnpinnedLeaf(); await leaf.openFile(existingFile); - activeFile.update(() => existingFile); + activeFile.setFile(existingFile); } - async _openOrCreateDailyNote( + async openOrCreateDailyNote( date: Moment, inNewSplit: boolean ): Promise { @@ -181,8 +261,7 @@ export default class CalendarView extends ItemView { inNewSplit, this.settings, (dailyNote: TFile) => { - // this.dailyNotesSource.reindex(); - activeFile.update(() => dailyNote); + activeFile.setFile(dailyNote); } ); return; @@ -193,6 +272,6 @@ export default class CalendarView extends ItemView { : workspace.getUnpinnedLeaf(); await leaf.openFile(existingFile); - activeFile.update(() => existingFile); + activeFile.setFile(existingFile); } } diff --git a/yarn.lock b/yarn.lock index 5ec5321..4660550 100644 --- a/yarn.lock +++ b/yarn.lock @@ -294,10 +294,10 @@ exec-sh "^0.3.2" minimist "^1.2.0" -"@eslint/eslintrc@^0.2.2": - version "0.2.2" - resolved "https://registry.yarnpkg.com/@eslint/eslintrc/-/eslintrc-0.2.2.tgz#d01fc791e2fc33e88a29d6f3dc7e93d0cd784b76" - integrity sha512-EfB5OHNYp1F4px/LI/FEnGylop7nOqkQ1LRzCM0KccA2U8tvV8w01KBv37LbO7nW4H+YhKyo2LcJhRwjjV17QQ== +"@eslint/eslintrc@^0.3.0": + version "0.3.0" + resolved "https://registry.yarnpkg.com/@eslint/eslintrc/-/eslintrc-0.3.0.tgz#d736d6963d7003b6514e6324bec9c602ac340318" + integrity sha512-1JTKgrOKAHVivSvOYw+sJOunkBjUOvjqWk1DPja7ZFhIS2mX/4EgTT8M7eTK9jrKhL/FvXXEbQwIs3pg1xp3dg== dependencies: ajv "^6.12.4" debug "^4.1.1" @@ -306,7 +306,7 @@ ignore "^4.0.6" import-fresh "^3.2.1" js-yaml "^3.13.1" - lodash "^4.17.19" + lodash "^4.17.20" minimatch "^3.0.4" strip-json-comments "^3.1.1" @@ -543,10 +543,10 @@ is-module "^1.0.0" resolve "^1.19.0" -"@rollup/plugin-typescript@8.0.0": - version "8.0.0" - resolved "https://registry.yarnpkg.com/@rollup/plugin-typescript/-/plugin-typescript-8.0.0.tgz#d621d9e268ef591c9e439650f550c5ffc53545c1" - integrity sha512-2L/kKvM5U4VOm+yVMvPIBF3yMZtQUyopf4YIT+KQbqZBZ8Fsdm7X6yeezy92PMyvvHQG1Pa322MVwxPojQvukA== +"@rollup/plugin-typescript@8.1.0": + version "8.1.0" + resolved "https://registry.yarnpkg.com/@rollup/plugin-typescript/-/plugin-typescript-8.1.0.tgz#b7bbbbb4fd1324834f37844efd48b3844d912742" + integrity sha512-pyQlcGQYRsONUDwXK3ckGPHjPzmjlq4sinzr7emW8ZMb2oZjg9WLcdcP8wyHSvBjvHrLzMayyPy079RROqb4vw== dependencies: "@rollup/pluginutils" "^3.1.0" resolve "^1.17.0" @@ -588,10 +588,10 @@ lz-string "^1.4.4" pretty-format "^26.6.2" -"@testing-library/jest-dom@5.11.6": - version "5.11.6" - resolved "https://registry.yarnpkg.com/@testing-library/jest-dom/-/jest-dom-5.11.6.tgz#782940e82e5cd17bc0a36f15156ba16f3570ac81" - integrity sha512-cVZyUNRWwUKI0++yepYpYX7uhrP398I+tGz4zOlLVlUYnZS+Svuxv4fwLeCIy7TnBYKXUaOlQr3vopxL8ZfEnA== +"@testing-library/jest-dom@5.11.9": + version "5.11.9" + resolved "https://registry.yarnpkg.com/@testing-library/jest-dom/-/jest-dom-5.11.9.tgz#e6b3cd687021f89f261bd53cbe367041fbd3e975" + integrity sha512-Mn2gnA9d1wStlAIT2NU8J15LNob0YFBVjs2aEQ3j8rsfRQo+lAs7/ui1i2TGaJjapLmuNPLTsrm+nPjmZDwpcQ== dependencies: "@babel/runtime" "^7.9.2" "@types/testing-library__jest-dom" "^5.9.1" @@ -602,10 +602,10 @@ lodash "^4.17.15" redent "^3.0.0" -"@testing-library/svelte@3.0.0": - version "3.0.0" - resolved "https://registry.yarnpkg.com/@testing-library/svelte/-/svelte-3.0.0.tgz#cfb9c5e2679b0e90f6a79ffdf4397b92537dd1f2" - integrity sha512-0KarnU6czyhNaRECWUI4lpxTGg+9lTgASrsrtnflw9odVSmKk3iRym3ZOg0TOM4GBsX/CR4Un590fEsf6FdTJg== +"@testing-library/svelte@3.0.3": + version "3.0.3" + resolved "https://registry.yarnpkg.com/@testing-library/svelte/-/svelte-3.0.3.tgz#fd0653c02c95c8715ff5a51aa232e3306536755e" + integrity sha512-GxafAllShGM2nkntFGURZ7fYVlUYwv7K62lqv1aFqtTYzzeZ2Cu8zTVhtE/Qt3bk2zMl6+FPKP03wjLip/G8mA== dependencies: "@testing-library/dom" "^7.0.3" @@ -703,10 +703,10 @@ jest-diff "^26.0.0" pretty-format "^26.0.0" -"@types/jest@26.0.19": - version "26.0.19" - resolved "https://registry.yarnpkg.com/@types/jest/-/jest-26.0.19.tgz#e6fa1e3def5842ec85045bd5210e9bb8289de790" - integrity sha512-jqHoirTG61fee6v6rwbnEuKhpSKih0tuhqeFbCmMmErhtu3BYlOZaXWjffgOstMM4S/3iQD31lI5bGLTrs97yQ== +"@types/jest@26.0.20": + version "26.0.20" + resolved "https://registry.yarnpkg.com/@types/jest/-/jest-26.0.20.tgz#cd2f2702ecf69e86b586e1f5223a60e454056307" + integrity sha512-9zi2Y+5USJRxd0FsahERhBwlcvFh6D2GLQnY2FH2BzK8J9s9omvNHIbvABwIluXa0fD8XVKMLTO0aOEuUfACAA== dependencies: jest-diff "^26.0.0" pretty-format "^26.0.0" @@ -728,10 +728,10 @@ resolved "https://registry.yarnpkg.com/@types/node/-/node-14.14.10.tgz#5958a82e41863cfc71f2307b3748e3491ba03785" integrity sha512-J32dgx2hw8vXrSbu4ZlVhn1Nm3GbeCFNw2FWL8S5QKucHGY0cyNwjdQdO+KMBZ4wpmC7KhLCiNsdk1RFRIYUQQ== -"@types/node@14.14.13": - version "14.14.13" - resolved "https://registry.yarnpkg.com/@types/node/-/node-14.14.13.tgz#9e425079799322113ae8477297ae6ef51b8e0cdf" - integrity sha512-vbxr0VZ8exFMMAjCW8rJwaya0dMCDyYW2ZRdTyjtrCvJoENMpdUHOT/eTzvgyA5ZnqRZ/sI0NwqAxNHKYokLJQ== +"@types/node@14.14.21": + version "14.14.21" + resolved "https://registry.yarnpkg.com/@types/node/-/node-14.14.21.tgz#d934aacc22424fe9622ebf6857370c052eae464e" + integrity sha512-cHYfKsnwllYhjOzuC5q1VpguABBeecUp24yFluHpn/BQaVxB1CuQ1FSRZCzrPxrkIfWISXV2LbeoBthLWg0+0A== "@types/normalize-package-data@^2.4.0": version "2.4.0" @@ -798,61 +798,62 @@ dependencies: "@types/yargs-parser" "*" -"@typescript-eslint/eslint-plugin@4.9.1": - version "4.9.1" - resolved "https://registry.yarnpkg.com/@typescript-eslint/eslint-plugin/-/eslint-plugin-4.9.1.tgz#66758cbe129b965fe9c63b04b405d0cf5280868b" - integrity sha512-QRLDSvIPeI1pz5tVuurD+cStNR4sle4avtHhxA+2uyixWGFjKzJ+EaFVRW6dA/jOgjV5DTAjOxboQkRDE8cRlQ== +"@typescript-eslint/eslint-plugin@4.13.0": + version "4.13.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/eslint-plugin/-/eslint-plugin-4.13.0.tgz#5f580ea520fa46442deb82c038460c3dd3524bb6" + integrity sha512-ygqDUm+BUPvrr0jrXqoteMqmIaZ/bixYOc3A4BRwzEPTZPi6E+n44rzNZWaB0YvtukgP+aoj0i/fyx7FkM2p1w== dependencies: - "@typescript-eslint/experimental-utils" "4.9.1" - "@typescript-eslint/scope-manager" "4.9.1" + "@typescript-eslint/experimental-utils" "4.13.0" + "@typescript-eslint/scope-manager" "4.13.0" debug "^4.1.1" functional-red-black-tree "^1.0.1" + lodash "^4.17.15" regexpp "^3.0.0" semver "^7.3.2" tsutils "^3.17.1" -"@typescript-eslint/experimental-utils@4.9.1": - version "4.9.1" - resolved "https://registry.yarnpkg.com/@typescript-eslint/experimental-utils/-/experimental-utils-4.9.1.tgz#86633e8395191d65786a808dc3df030a55267ae2" - integrity sha512-c3k/xJqk0exLFs+cWSJxIjqLYwdHCuLWhnpnikmPQD2+NGAx9KjLYlBDcSI81EArh9FDYSL6dslAUSwILeWOxg== +"@typescript-eslint/experimental-utils@4.13.0": + version "4.13.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/experimental-utils/-/experimental-utils-4.13.0.tgz#9dc9ab375d65603b43d938a0786190a0c72be44e" + integrity sha512-/ZsuWmqagOzNkx30VWYV3MNB/Re/CGv/7EzlqZo5RegBN8tMuPaBgNK6vPBCQA8tcYrbsrTdbx3ixMRRKEEGVw== dependencies: "@types/json-schema" "^7.0.3" - "@typescript-eslint/scope-manager" "4.9.1" - "@typescript-eslint/types" "4.9.1" - "@typescript-eslint/typescript-estree" "4.9.1" + "@typescript-eslint/scope-manager" "4.13.0" + "@typescript-eslint/types" "4.13.0" + "@typescript-eslint/typescript-estree" "4.13.0" eslint-scope "^5.0.0" eslint-utils "^2.0.0" -"@typescript-eslint/parser@4.9.1": - version "4.9.1" - resolved "https://registry.yarnpkg.com/@typescript-eslint/parser/-/parser-4.9.1.tgz#2d74c4db5dd5117379a9659081a4d1ec02629055" - integrity sha512-Gv2VpqiomvQ2v4UL+dXlQcZ8zCX4eTkoIW+1aGVWT6yTO+6jbxsw7yQl2z2pPl/4B9qa5JXeIbhJpONKjXIy3g== +"@typescript-eslint/parser@4.13.0": + version "4.13.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/parser/-/parser-4.13.0.tgz#c413d640ea66120cfcc37f891e8cb3fd1c9d247d" + integrity sha512-KO0J5SRF08pMXzq9+abyHnaGQgUJZ3Z3ax+pmqz9vl81JxmTTOUfQmq7/4awVfq09b6C4owNlOgOwp61pYRBSg== dependencies: - "@typescript-eslint/scope-manager" "4.9.1" - "@typescript-eslint/types" "4.9.1" - "@typescript-eslint/typescript-estree" "4.9.1" + "@typescript-eslint/scope-manager" "4.13.0" + "@typescript-eslint/types" "4.13.0" + "@typescript-eslint/typescript-estree" "4.13.0" debug "^4.1.1" -"@typescript-eslint/scope-manager@4.9.1": - version "4.9.1" - resolved "https://registry.yarnpkg.com/@typescript-eslint/scope-manager/-/scope-manager-4.9.1.tgz#cc2fde310b3f3deafe8436a924e784eaab265103" - integrity sha512-sa4L9yUfD/1sg9Kl8OxPxvpUcqxKXRjBeZxBuZSSV1v13hjfEJkn84n0An2hN8oLQ1PmEl2uA6FkI07idXeFgQ== +"@typescript-eslint/scope-manager@4.13.0": + version "4.13.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/scope-manager/-/scope-manager-4.13.0.tgz#5b45912a9aa26b29603d8fa28f5e09088b947141" + integrity sha512-UpK7YLG2JlTp/9G4CHe7GxOwd93RBf3aHO5L+pfjIrhtBvZjHKbMhBXTIQNkbz7HZ9XOe++yKrXutYm5KmjWgQ== dependencies: - "@typescript-eslint/types" "4.9.1" - "@typescript-eslint/visitor-keys" "4.9.1" + "@typescript-eslint/types" "4.13.0" + "@typescript-eslint/visitor-keys" "4.13.0" -"@typescript-eslint/types@4.9.1": - version "4.9.1" - resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-4.9.1.tgz#a1a7dd80e4e5ac2c593bc458d75dd1edaf77faa2" - integrity sha512-fjkT+tXR13ks6Le7JiEdagnwEFc49IkOyys7ueWQ4O8k4quKPwPJudrwlVOJCUQhXo45PrfIvIarcrEjFTNwUA== +"@typescript-eslint/types@4.13.0": + version "4.13.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-4.13.0.tgz#6a7c6015a59a08fbd70daa8c83dfff86250502f8" + integrity sha512-/+aPaq163oX+ObOG00M0t9tKkOgdv9lq0IQv/y4SqGkAXmhFmCfgsELV7kOCTb2vVU5VOmVwXBXJTDr353C1rQ== -"@typescript-eslint/typescript-estree@4.9.1": - version "4.9.1" - resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-4.9.1.tgz#6e5b86ff5a5f66809e1f347469fadeec69ac50bf" - integrity sha512-bzP8vqwX6Vgmvs81bPtCkLtM/Skh36NE6unu6tsDeU/ZFoYthlTXbBmpIrvosgiDKlWTfb2ZpPELHH89aQjeQw== +"@typescript-eslint/typescript-estree@4.13.0": + version "4.13.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-4.13.0.tgz#cf6e2207c7d760f5dfd8d18051428fadfc37b45e" + integrity sha512-9A0/DFZZLlGXn5XA349dWQFwPZxcyYyCFX5X88nWs2uachRDwGeyPz46oTsm9ZJE66EALvEns1lvBwa4d9QxMg== dependencies: - "@typescript-eslint/types" "4.9.1" - "@typescript-eslint/visitor-keys" "4.9.1" + "@typescript-eslint/types" "4.13.0" + "@typescript-eslint/visitor-keys" "4.13.0" debug "^4.1.1" globby "^11.0.1" is-glob "^4.0.1" @@ -860,12 +861,12 @@ semver "^7.3.2" tsutils "^3.17.1" -"@typescript-eslint/visitor-keys@4.9.1": - version "4.9.1" - resolved "https://registry.yarnpkg.com/@typescript-eslint/visitor-keys/-/visitor-keys-4.9.1.tgz#d76374a58c4ead9e92b454d186fea63487b25ae1" - integrity sha512-9gspzc6UqLQHd7lXQS7oWs+hrYggspv/rk6zzEMhCbYwPE/sF7oxo7GAjkS35Tdlt7wguIG+ViWCPtVZHz/ybQ== +"@typescript-eslint/visitor-keys@4.13.0": + version "4.13.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/visitor-keys/-/visitor-keys-4.13.0.tgz#9acb1772d3b3183182b6540d3734143dce9476fe" + integrity sha512-6RoxWK05PAibukE7jElqAtNMq+RWZyqJ6Q/GdIxaiUj2Ept8jh8+FUVlbq9WxMYxkmEOPvCE5cRSyupMpwW31g== dependencies: - "@typescript-eslint/types" "4.9.1" + "@typescript-eslint/types" "4.13.0" eslint-visitor-keys "^2.0.0" abab@^2.0.3: @@ -896,7 +897,7 @@ acorn@^7.1.1, acorn@^7.4.0: resolved "https://registry.yarnpkg.com/acorn/-/acorn-7.4.1.tgz#feaed255973d2e77555b83dbc08851a6c63520fa" integrity sha512-nQyp0o1/mNdbTO1PO6kHkwSrmgZ0MT/jCCpNiwbUjGoRN4dlBhqJtoQuCnEOKzgTVwg0ZWiCoQy6SxMebQVh8A== -ajv@^6.10.0, ajv@^6.10.2, ajv@^6.12.3, ajv@^6.12.4: +ajv@^6.10.0, ajv@^6.12.3, ajv@^6.12.4: version "6.12.6" resolved "https://registry.yarnpkg.com/ajv/-/ajv-6.12.6.tgz#baf5a62e802b07d977034586f8c3baf5adf26df4" integrity sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g== @@ -906,6 +907,16 @@ ajv@^6.10.0, ajv@^6.10.2, ajv@^6.12.3, ajv@^6.12.4: json-schema-traverse "^0.4.1" uri-js "^4.2.2" +ajv@^7.0.2: + version "7.0.3" + resolved "https://registry.yarnpkg.com/ajv/-/ajv-7.0.3.tgz#13ae747eff125cafb230ac504b2406cf371eece2" + integrity sha512-R50QRlXSxqXcQP5SvKUrw8VZeypvo12i2IX0EeR5PiZ7bEKeHWgzgo264LDadUsCU42lTJVhFikTqJwNeH34gQ== + dependencies: + fast-deep-equal "^3.1.1" + json-schema-traverse "^1.0.0" + require-from-string "^2.0.2" + uri-js "^4.2.2" + ansi-colors@^4.1.1: version "4.1.1" resolved "https://registry.yarnpkg.com/ansi-colors/-/ansi-colors-4.1.1.tgz#cbb9ae256bf750af1eab344f229aa27fe94ba348" @@ -918,17 +929,12 @@ ansi-escapes@^4.2.1: dependencies: type-fest "^0.11.0" -ansi-regex@^4.1.0: - version "4.1.0" - resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-4.1.0.tgz#8b9f8f08cf1acb843756a839ca8c7e3168c51997" - integrity sha512-1apePfXM1UOSqw0o9IiFAovVz9M5S1Dg+4TrDwfMewQ6p/rmMueb7tWZjQ1rx4Loy1ArBggoqGpfqqdI4rondg== - ansi-regex@^5.0.0: version "5.0.0" resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-5.0.0.tgz#388539f55179bf39339c81af30a654d69f87cb75" integrity sha512-bY6fj56OUQ0hU1KjFNDQuJFezqKdrAyFdIevADiqrWHwSlbmBNMHp5ak2f40Pm8JTFyM2mqxkG6ngkHO11f/lg== -ansi-styles@^3.2.0, ansi-styles@^3.2.1: +ansi-styles@^3.2.1: version "3.2.1" resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-3.2.1.tgz#41fbb20243e50b12be0f04b8dedbf07520ce841d" integrity sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA== @@ -1015,10 +1021,10 @@ assign-symbols@^1.0.0: resolved "https://registry.yarnpkg.com/assign-symbols/-/assign-symbols-1.0.0.tgz#59667f41fadd4f20ccbc2bb96b8d4f7f78ec0367" integrity sha1-WWZ/QfrdTyDMvCu5a41Pf3jsA2c= -astral-regex@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/astral-regex/-/astral-regex-1.0.0.tgz#6c8c3fb827dd43ee3918f27b82782ab7658a6fd9" - integrity sha512-+Ryf6g3BKoRc7jfp7ad8tM4TtMiaWvbF/1/sQcZPkkS7ag3D5nMBCe2UfOTONtAkaG0tO0ij3C5Lwmf1EiyjHg== +astral-regex@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/astral-regex/-/astral-regex-2.0.0.tgz#483143c567aeed4785759c0865786dc77d7d2e31" + integrity sha512-Z7tMw1ytTXt5jqMcOP+OQteU1VuNK9Y02uuJtKQ1Sv69jXQKKg5cibLwGJow8yzZP+eAc18EmLGPal0bp36rvQ== asynckit@^0.4.0: version "0.4.0" @@ -1591,11 +1597,6 @@ emittery@^0.7.1: resolved "https://registry.yarnpkg.com/emittery/-/emittery-0.7.2.tgz#25595908e13af0f5674ab419396e2fb394cdfa82" integrity sha512-A8OG5SR/ij3SsJdWDJdkkSYUjQdCUx6APQXem0SaEePBSRg4eymGYwBkKo1Y6DU+af/Jn2dBQqDBvjnr9Vi8nQ== -emoji-regex@^7.0.1: - version "7.0.3" - resolved "https://registry.yarnpkg.com/emoji-regex/-/emoji-regex-7.0.3.tgz#933a04052860c85e83c122479c4748a8e4c72156" - integrity sha512-CwBLREIQ7LvYFB0WyRvwhq5N5qPhc6PMjD6bYggFlI5YyDgl+0vxq5VHbMOFqLg7hfWzmu8T5Z1QofhmTIhItA== - emoji-regex@^8.0.0: version "8.0.0" resolved "https://registry.yarnpkg.com/emoji-regex/-/emoji-regex-8.0.0.tgz#e818fd69ce5ccfcb404594f842963bf53164cc37" @@ -1669,13 +1670,13 @@ eslint-visitor-keys@^2.0.0: resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-2.0.0.tgz#21fdc8fbcd9c795cc0321f0563702095751511a8" integrity sha512-QudtT6av5WXels9WjIM7qz1XD1cWGvX4gGXvp/zBn9nXG02D0utdU3Em2m/QjTnrsk6bBjmCygl3rmj118msQQ== -eslint@7.15.0: - version "7.15.0" - resolved "https://registry.yarnpkg.com/eslint/-/eslint-7.15.0.tgz#eb155fb8ed0865fcf5d903f76be2e5b6cd7e0bc7" - integrity sha512-Vr64xFDT8w30wFll643e7cGrIkPEU50yIiI36OdSIDoSGguIeaLzBo0vpGvzo9RECUqq7htURfwEtKqwytkqzA== +eslint@7.18.0: + version "7.18.0" + resolved "https://registry.yarnpkg.com/eslint/-/eslint-7.18.0.tgz#7fdcd2f3715a41fe6295a16234bd69aed2c75e67" + integrity sha512-fbgTiE8BfUJZuBeq2Yi7J3RB3WGUQ9PNuNbmgi6jt9Iv8qrkxfy19Ds3OpL1Pm7zg3BtTVhvcUZbIRQ0wmSjAQ== dependencies: "@babel/code-frame" "^7.0.0" - "@eslint/eslintrc" "^0.2.2" + "@eslint/eslintrc" "^0.3.0" ajv "^6.10.0" chalk "^4.0.0" cross-spawn "^7.0.2" @@ -1699,7 +1700,7 @@ eslint@7.15.0: js-yaml "^3.13.1" json-stable-stringify-without-jsonify "^1.0.1" levn "^0.4.1" - lodash "^4.17.19" + lodash "^4.17.20" minimatch "^3.0.4" natural-compare "^1.4.0" optionator "^0.9.1" @@ -1708,7 +1709,7 @@ eslint@7.15.0: semver "^7.2.1" strip-ansi "^6.0.0" strip-json-comments "^3.1.0" - table "^5.2.3" + table "^6.0.4" text-table "^0.2.0" v8-compile-cache "^2.0.3" @@ -2369,11 +2370,6 @@ is-extglob@^2.1.1: resolved "https://registry.yarnpkg.com/is-extglob/-/is-extglob-2.1.1.tgz#a88c02535791f02ed37c76a1b9ea9773c833f8c2" integrity sha1-qIwCU1eR8C7TfHahueqXc8gz+MI= -is-fullwidth-code-point@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz#a3b30a5c4f199183167aaab93beefae3ddfb654f" - integrity sha1-o7MKXE8ZkYMWeqq5O+764937ZU8= - is-fullwidth-code-point@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz#f116f8064fe90b3f7844a38997c0b75051269f1d" @@ -2960,6 +2956,11 @@ json-schema-traverse@^0.4.1: resolved "https://registry.yarnpkg.com/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz#69f6a87d9513ab8bb8fe63bdb0979c448e684660" integrity sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg== +json-schema-traverse@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz#ae7bcb3656ab77a73ba5c49bf654f38e6b6860e2" + integrity sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug== + json-schema@0.2.3: version "0.2.3" resolved "https://registry.yarnpkg.com/json-schema/-/json-schema-0.2.3.tgz#b480c892e59a2f05954ce727bd3f2a4e882f9e13" @@ -3064,7 +3065,7 @@ lodash.sortby@^4.7.0: resolved "https://registry.yarnpkg.com/lodash.sortby/-/lodash.sortby-4.7.0.tgz#edd14c824e2cc9c1e0b0a1b42bb5210516a42438" integrity sha1-7dFMgk4sycHgsKG0K7UhBRakJDg= -lodash@^4.17.14, lodash@^4.17.15, lodash@^4.17.19: +lodash@^4.17.15, lodash@^4.17.19, lodash@^4.17.20: version "4.17.20" resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.20.tgz#b44a9b6297bcb698f1c51a3545a2b3b368d59c52" integrity sha512-PlhdFcillOINfeV7Ni6oF1TAEayyZBoZ8bcshTHqOYJYlrqzRK5hagpagky5o4HfCzzd1TRkXPMFq6cKk9rGmA== @@ -3329,15 +3330,16 @@ object.pick@^1.3.0: dependencies: isobject "^3.0.1" -obsidian-calendar-ui@0.0.2: - version "0.0.2" - resolved "https://registry.yarnpkg.com/obsidian-calendar-ui/-/obsidian-calendar-ui-0.0.2.tgz#565aaf46c8c4b633ac19199802e69ee69c3f9b68" - integrity sha512-Pqbu63jBrDkgWgbAagDrA7a4gFySGOV8heB9d/Qcz2tNhphFO+mO+WDw+0jT2dVkUQ74qMiBKFtSMzJOD/6lDA== +obsidian-calendar-ui@0.2.0: + version "0.2.0" + resolved "https://registry.yarnpkg.com/obsidian-calendar-ui/-/obsidian-calendar-ui-0.2.0.tgz#899d2b50f9066d6c68a4b8aa725111a40522d3ed" + integrity sha512-O1MphFygFDL2zgHd0wdzSw/Tu1aMnzN2yJEEtOIjSlxF2y5YwaJ40Skci+9GzLjAjQjs+yeaf1I5sayGvdSoAg== dependencies: - obsidian-daily-notes-interface "0.4.0" + obsidian-daily-notes-interface "0.5.1" svelte "3.31.0" tslib "2.0.3" +<<<<<<< HEAD <<<<<<< HEAD obsidian@obsidianmd/obsidian-api#master: version "0.10.0" @@ -3348,10 +3350,25 @@ obsidian-daily-notes-interface@0.4.0: resolved "https://registry.yarnpkg.com/obsidian-daily-notes-interface/-/obsidian-daily-notes-interface-0.4.0.tgz#9bbc1813146ebbff60df986fd717f90b2620d309" integrity sha512-CTokiN+6UJ7umihC5equ3sMx5kO9F3X94sSrMN8nrUHjVQYfZiGX/cFhCqh7laeE7MC0g8Kzwzv6/6VLbpmV6w== >>>>>>> 8f2022a (Generalize sources) +======= +obsidian-daily-notes-interface@0.5.1: + version "0.5.1" + resolved "https://registry.yarnpkg.com/obsidian-daily-notes-interface/-/obsidian-daily-notes-interface-0.5.1.tgz#8fe28eab46e7fb789c8fc935dd3c74232b6e15f9" + integrity sha512-QwSAN7ob6r05e+IFhIY1Knn1H2zM4p3MCmUdbtNOFxPe0MQWsLAK5fjt0ST1usm7z0rVuTbNHJAzXxNRQaDlzg== +>>>>>>> fca8e0a (Use generic calendar UI) dependencies: obsidian obsidianmd/obsidian-api#master tslib "2.0.3" +<<<<<<< HEAD +======= +obsidian@obsidianmd/obsidian-api#master: + version "0.10.6" + resolved "https://codeload.github.com/obsidianmd/obsidian-api/tar.gz/a0e0c245561215ced9468859091e01d015f5cda9" + dependencies: + "@types/codemirror" "0.0.98" + +>>>>>>> fca8e0a (Use generic calendar UI) once@^1.3.0, once@^1.3.1, once@^1.4.0: version "1.4.0" resolved "https://registry.yarnpkg.com/once/-/once-1.4.0.tgz#583b1aa775961d4b113ac17d9c50baef9dd76bd1" @@ -3680,6 +3697,11 @@ require-directory@^2.1.1: resolved "https://registry.yarnpkg.com/require-directory/-/require-directory-2.1.1.tgz#8c64ad5fd30dab1c976e2344ffe7f792a6a6df42" integrity sha1-jGStX9MNqxyXbiNE/+f3kqam30I= +require-from-string@^2.0.2: + version "2.0.2" + resolved "https://registry.yarnpkg.com/require-from-string/-/require-from-string-2.0.2.tgz#89a7fdd938261267318eafe14f9c32e598c36909" + integrity sha512-Xf0nWe6RseziFMu+Ap9biiUbmplq6S9/p+7w7YXP/JBHhrUDDUhwa+vANyubuqfZWTveU//DYVGsDG7RKL/vEw== + require-main-filename@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/require-main-filename/-/require-main-filename-2.0.0.tgz#d0b329ecc7cc0f61649f62215be69af54aa8989b" @@ -3887,14 +3909,14 @@ slash@^3.0.0: resolved "https://registry.yarnpkg.com/slash/-/slash-3.0.0.tgz#6539be870c165adbd5240220dbe361f1bc4d4634" integrity sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q== -slice-ansi@^2.1.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/slice-ansi/-/slice-ansi-2.1.0.tgz#cacd7693461a637a5788d92a7dd4fba068e81636" - integrity sha512-Qu+VC3EwYLldKa1fCxuuvULvSJOKEgk9pi8dZeCVK7TqBfUNTH4sFkk4joj8afVSfAYgJoSOetjx9QWOJ5mYoQ== +slice-ansi@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/slice-ansi/-/slice-ansi-4.0.0.tgz#500e8dd0fd55b05815086255b3195adf2a45fe6b" + integrity sha512-qMCMfhY040cVHT43K9BFygqYbUPFZKHOg7K73mtTWJRb8pyP3fzf4Ixd5SzdEJQ6MRUg/WBnOLxghZtKKurENQ== dependencies: - ansi-styles "^3.2.0" - astral-regex "^1.0.0" - is-fullwidth-code-point "^2.0.0" + ansi-styles "^4.0.0" + astral-regex "^2.0.0" + is-fullwidth-code-point "^3.0.0" snapdragon-node@^2.0.1: version "2.1.1" @@ -4059,15 +4081,6 @@ string-length@^4.0.1: char-regex "^1.0.2" strip-ansi "^6.0.0" -string-width@^3.0.0: - version "3.1.0" - resolved "https://registry.yarnpkg.com/string-width/-/string-width-3.1.0.tgz#22767be21b62af1081574306f69ac51b62203961" - integrity sha512-vafcv6KjVZKSgz06oM/H6GDBrAtz8vdhQakGjFIvNrHA6y3HCF1CInLy+QLq8dTJPQ1b+KDUqDFctkdRW44e1w== - dependencies: - emoji-regex "^7.0.1" - is-fullwidth-code-point "^2.0.0" - strip-ansi "^5.1.0" - string-width@^4.1.0, string-width@^4.2.0: version "4.2.0" resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.0.tgz#952182c46cc7b2c313d1596e623992bd163b72b5" @@ -4077,13 +4090,6 @@ string-width@^4.1.0, string-width@^4.2.0: is-fullwidth-code-point "^3.0.0" strip-ansi "^6.0.0" -strip-ansi@^5.1.0: - version "5.2.0" - resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-5.2.0.tgz#8c9a536feb6afc962bdfa5b104a5091c1ad9c0ae" - integrity sha512-DuRs1gKbBqsMKIZlrffwlug8MHkcnpjs5VPmL1PAh+mA30U0DTotfDZ0d2UUsXpPmPmMMJ6W773MaA3J+lbiWA== - dependencies: - ansi-regex "^4.1.0" - strip-ansi@^6.0.0: version "6.0.0" resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.0.tgz#0b1571dd7669ccd4f3e06e14ef1eed26225ae532" @@ -4181,15 +4187,15 @@ symbol-tree@^3.2.4: resolved "https://registry.yarnpkg.com/symbol-tree/-/symbol-tree-3.2.4.tgz#430637d248ba77e078883951fb9aa0eed7c63fa2" integrity sha512-9QNk5KwDF+Bvz+PyObkmSYjI5ksVUYtjW7AU22r2NKcfLJcXp96hkDWU3+XndOsUb+AQ9QhfzfCT2O+CNWT5Tw== -table@^5.2.3: - version "5.4.6" - resolved "https://registry.yarnpkg.com/table/-/table-5.4.6.tgz#1292d19500ce3f86053b05f0e8e7e4a3bb21079e" - integrity sha512-wmEc8m4fjnob4gt5riFRtTu/6+4rSe12TpAELNSqHMfF3IqnA+CH37USM6/YR3qRZv7e56kAEAtd6nKZaxe0Ug== +table@^6.0.4: + version "6.0.7" + resolved "https://registry.yarnpkg.com/table/-/table-6.0.7.tgz#e45897ffbcc1bcf9e8a87bf420f2c9e5a7a52a34" + integrity sha512-rxZevLGTUzWna/qBLObOe16kB2RTnnbhciwgPbMMlazz1yZGVEgnZK762xyVdVznhqxrfCeBMmMkgOOaPwjH7g== dependencies: - ajv "^6.10.2" - lodash "^4.17.14" - slice-ansi "^2.1.0" - string-width "^3.0.0" + ajv "^7.0.2" + lodash "^4.17.20" + slice-ansi "^4.0.0" + string-width "^4.2.0" terminal-link@^2.0.0: version "2.1.1" From 8a40cca4a6019206362249fad153f320f5be694e Mon Sep 17 00:00:00 2001 From: Liam Cain Date: Sun, 17 Jan 2021 11:51:22 -0500 Subject: [PATCH 4/7] Allow using the default wordsPerDot after clearing the field --- src/settings.ts | 21 ++++----------------- src/ui/sources/wordCount.ts | 3 ++- src/ui/stores.ts | 17 ++--------------- 3 files changed, 8 insertions(+), 33 deletions(-) diff --git a/src/settings.ts b/src/settings.ts index 2ec7cea..2b70a49 100644 --- a/src/settings.ts +++ b/src/settings.ts @@ -1,24 +1,13 @@ import { App, PluginSettingTab, Setting } from "obsidian"; -import { writable } from "svelte/store"; - -import { DEFAULT_WEEK_FORMAT, DEFAULT_WORDS_PER_DOT } from "src/constants"; - -import type CalendarPlugin from "./main"; import { appHasDailyNotesPluginLoaded, IDailyNoteSettings, } from "obsidian-daily-notes-interface"; +import type { ILocaleOverride, IWeekStartOption } from "obsidian-calendar-ui"; -type ILocaleOverride = "system-default" | string; -type IWeekStartOption = - | "sunday" - | "monday" - | "tuesday" - | "wednesday" - | "thursday" - | "friday" - | "saturday" - | "locale"; +import { DEFAULT_WEEK_FORMAT, DEFAULT_WORDS_PER_DOT } from "src/constants"; + +import type CalendarPlugin from "./main"; export interface ISettings { wordsPerDot: number; @@ -68,8 +57,6 @@ export const defaultSettings = Object.freeze({ localeOverride: "system-default", }); -export const SettingsInstance = writable(defaultSettings); - export class CalendarSettingsTab extends PluginSettingTab { private plugin: CalendarPlugin; diff --git a/src/ui/sources/wordCount.ts b/src/ui/sources/wordCount.ts index fc53d89..72dc0f3 100644 --- a/src/ui/sources/wordCount.ts +++ b/src/ui/sources/wordCount.ts @@ -4,6 +4,7 @@ import type { ICalendarSource, IDayMetadata, IDot } from "obsidian-calendar-ui"; import { getDailyNote } from "obsidian-daily-notes-interface"; import { get } from "svelte/store"; +import { DEFAULT_WORDS_PER_DOT } from "src/constants"; import { getWeeklyNote } from "src/io/weeklyNotes"; import { dailyNotes, settings } from "../stores"; @@ -12,7 +13,7 @@ import { clamp, getWordCount } from "../utils"; const NUM_MAX_DOTS = 5; export async function getWordLengthAsDots(note: TFile): Promise { - const { wordsPerDot } = get(settings); + const { wordsPerDot = DEFAULT_WORDS_PER_DOT } = get(settings); if (!note || wordsPerDot <= 0) { return 0; } diff --git a/src/ui/stores.ts b/src/ui/stores.ts index b11aac3..6710f47 100644 --- a/src/ui/stores.ts +++ b/src/ui/stores.ts @@ -2,8 +2,7 @@ import type { TFile } from "obsidian"; import { writable } from "svelte/store"; import { getAllDailyNotes } from "obsidian-daily-notes-interface"; -import { DEFAULT_WORDS_PER_DOT } from "src/constants"; -import type { ISettings } from "src/settings"; +import { defaultSettings, ISettings } from "src/settings"; import { getDateUIDFromFile } from "./utils"; @@ -29,16 +28,4 @@ function createSelectedFileStore() { export const activeFile = createSelectedFileStore(); export const dailyNotes = createDailyNotesStore(); -export const settings = writable({ - shouldConfirmBeforeCreate: true, - weekStart: "locale", - - wordsPerDot: DEFAULT_WORDS_PER_DOT, - - showWeeklyNote: false, - weeklyNoteFormat: "", - weeklyNoteTemplate: "", - weeklyNoteFolder: "", - - localeOverride: "system-default", -}); +export const settings = writable(defaultSettings); From f1039e66b1a087744b8f78c2b150784f4b089109 Mon Sep 17 00:00:00 2001 From: Liam Cain Date: Sun, 17 Jan 2021 12:04:13 -0500 Subject: [PATCH 5/7] Rebase fix --- src/settings.ts | 24 ------------------------ 1 file changed, 24 deletions(-) diff --git a/src/settings.ts b/src/settings.ts index 2b70a49..b4988a1 100644 --- a/src/settings.ts +++ b/src/settings.ts @@ -232,28 +232,4 @@ export class CalendarSettingsTab extends PluginSettingTab { }); }); } - - addLocaleOverrideSetting(): void { - const { moment } = window; - - const sysLocale = navigator.language?.toLowerCase(); - - new Setting(this.containerEl) - .setName("Override locale:") - .setDesc( - "Set this if you want to use a locale different from the default" - ) - .addDropdown((dropdown) => { - dropdown.addOption("system-default", `Same as system (${sysLocale})`); - moment.locales().forEach((locale) => { - dropdown.addOption(locale, locale); - }); - dropdown.setValue(this.plugin.options.localeOverride); - dropdown.onChange(async (value) => { - this.plugin.writeOptions( - (old) => (old.localeOverride = value as ILocaleOverride) - ); - }); - }); - } } From 0984cff3655b0783dac504cdc54eab6e258a56f9 Mon Sep 17 00:00:00 2001 From: Liam Cain Date: Sun, 17 Jan 2021 18:13:22 -0500 Subject: [PATCH 6/7] Bump version, fix theme backwards compatibility --- manifest.json | 2 +- package.json | 4 +- src/main.ts | 1 - src/ui/sources/tasks.ts | 1 + yarn.lock | 430 +++++++++++++++++++--------------------- 5 files changed, 204 insertions(+), 234 deletions(-) diff --git a/manifest.json b/manifest.json index dfd0854..10a7903 100644 --- a/manifest.json +++ b/manifest.json @@ -2,7 +2,7 @@ "id": "calendar", "name": "Calendar", "description": "Calendar view of your daily notes", - "version": "1.4.12", + "version": "1.4.13", "author": "Liam Cain", "authorUrl": "https://github.com/liamcain/", "isDesktopOnly": false, diff --git a/package.json b/package.json index c908eea..4fd7f05 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "calendar", - "version": "1.4.12", + "version": "1.4.13", "description": "Calendar view of your daily notes", "author": "liamcain", "main": "main.js", @@ -13,7 +13,7 @@ }, "dependencies": { "obsidian": "obsidianmd/obsidian-api#master", - "obsidian-calendar-ui": "0.2.0", + "obsidian-calendar-ui": "0.2.1", "obsidian-daily-notes-interface": "0.5.1", "svelte": "3.31.0", "tslib": "2.0.3" diff --git a/src/main.ts b/src/main.ts index d10c4dc..907efc6 100644 --- a/src/main.ts +++ b/src/main.ts @@ -28,7 +28,6 @@ export default class CalendarPlugin extends Plugin { this.register( settings.subscribe((value) => { this.options = value; - // TODO pass new weekStart and localeOverride to Calendar }) ); diff --git a/src/ui/sources/tasks.ts b/src/ui/sources/tasks.ts index 6c288ea..2ae4848 100644 --- a/src/ui/sources/tasks.ts +++ b/src/ui/sources/tasks.ts @@ -29,6 +29,7 @@ export async function getDotsForDailyNote( const dots = []; if (numTasks) { dots.push({ + className: "task", color: "default", isFilled: false, }); diff --git a/yarn.lock b/yarn.lock index 4660550..a21f10c 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2,61 +2,60 @@ # yarn lockfile v1 -"@babel/code-frame@^7.0.0", "@babel/code-frame@^7.10.4": - version "7.10.4" - resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.10.4.tgz#168da1a36e90da68ae8d49c0f1b48c7c6249213a" - integrity sha512-vG6SvB6oYEhvgisZNFRmRCUkLz11c7rp+tbNTynGqc6mS1d5ATd/sGyV6W0KZZnXRKMTzZDRgQT3Ou9jhpAfUg== +"@babel/code-frame@^7.0.0", "@babel/code-frame@^7.10.4", "@babel/code-frame@^7.12.11": + version "7.12.11" + resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.12.11.tgz#f4ad435aa263db935b8f10f2c552d23fb716a63f" + integrity sha512-Zt1yodBx1UcyiePMSkWnU4hPqhwq7hGi2nFL1LeA3EUl+q2LQx16MISgJ0+z7dnmgvP9QtIleuETGOiOH1RcIw== dependencies: "@babel/highlight" "^7.10.4" "@babel/core@^7.1.0", "@babel/core@^7.7.5": - version "7.12.9" - resolved "https://registry.yarnpkg.com/@babel/core/-/core-7.12.9.tgz#fd450c4ec10cdbb980e2928b7aa7a28484593fc8" - integrity sha512-gTXYh3M5wb7FRXQy+FErKFAv90BnlOuNn1QkCK2lREoPAjrQCO49+HVSrFoe5uakFAF5eenS75KbO2vQiLrTMQ== + version "7.12.10" + resolved "https://registry.yarnpkg.com/@babel/core/-/core-7.12.10.tgz#b79a2e1b9f70ed3d84bbfb6d8c4ef825f606bccd" + integrity sha512-eTAlQKq65zHfkHZV0sIVODCPGVgoo1HdBlbSLi9CqOzuZanMv2ihzY+4paiKr1mH+XmYESMAmJ/dpZ68eN6d8w== dependencies: "@babel/code-frame" "^7.10.4" - "@babel/generator" "^7.12.5" + "@babel/generator" "^7.12.10" "@babel/helper-module-transforms" "^7.12.1" "@babel/helpers" "^7.12.5" - "@babel/parser" "^7.12.7" + "@babel/parser" "^7.12.10" "@babel/template" "^7.12.7" - "@babel/traverse" "^7.12.9" - "@babel/types" "^7.12.7" + "@babel/traverse" "^7.12.10" + "@babel/types" "^7.12.10" convert-source-map "^1.7.0" debug "^4.1.0" gensync "^1.0.0-beta.1" json5 "^2.1.2" lodash "^4.17.19" - resolve "^1.3.2" semver "^5.4.1" source-map "^0.5.0" -"@babel/generator@^7.12.5": - version "7.12.5" - resolved "https://registry.yarnpkg.com/@babel/generator/-/generator-7.12.5.tgz#a2c50de5c8b6d708ab95be5e6053936c1884a4de" - integrity sha512-m16TQQJ8hPt7E+OS/XVQg/7U184MLXtvuGbCdA7na61vha+ImkyyNM/9DDA0unYCVZn3ZOhng+qz48/KBOT96A== +"@babel/generator@^7.12.10", "@babel/generator@^7.12.11": + version "7.12.11" + resolved "https://registry.yarnpkg.com/@babel/generator/-/generator-7.12.11.tgz#98a7df7b8c358c9a37ab07a24056853016aba3af" + integrity sha512-Ggg6WPOJtSi8yYQvLVjG8F/TlpWDlKx0OpS4Kt+xMQPs5OaGYWy+v1A+1TvxI6sAMGZpKWWoAQ1DaeQbImlItA== dependencies: - "@babel/types" "^7.12.5" + "@babel/types" "^7.12.11" jsesc "^2.5.1" source-map "^0.5.0" -"@babel/helper-function-name@^7.10.4": - version "7.10.4" - resolved "https://registry.yarnpkg.com/@babel/helper-function-name/-/helper-function-name-7.10.4.tgz#d2d3b20c59ad8c47112fa7d2a94bc09d5ef82f1a" - integrity sha512-YdaSyz1n8gY44EmN7x44zBn9zQ1Ry2Y+3GTA+3vH6Mizke1Vw0aWDM66FOYEPw8//qKkmqOckrGgTYa+6sceqQ== +"@babel/helper-function-name@^7.12.11": + version "7.12.11" + resolved "https://registry.yarnpkg.com/@babel/helper-function-name/-/helper-function-name-7.12.11.tgz#1fd7738aee5dcf53c3ecff24f1da9c511ec47b42" + integrity sha512-AtQKjtYNolKNi6nNNVLQ27CP6D9oFR6bq/HPYSizlzbp7uC1M59XJe8L+0uXjbIaZaUJF99ruHqVGiKXU/7ybA== dependencies: - "@babel/helper-get-function-arity" "^7.10.4" - "@babel/template" "^7.10.4" - "@babel/types" "^7.10.4" + "@babel/helper-get-function-arity" "^7.12.10" + "@babel/template" "^7.12.7" + "@babel/types" "^7.12.11" -"@babel/helper-get-function-arity@^7.10.4": - version "7.10.4" - resolved "https://registry.yarnpkg.com/@babel/helper-get-function-arity/-/helper-get-function-arity-7.10.4.tgz#98c1cbea0e2332f33f9a4661b8ce1505b2c19ba2" - integrity sha512-EkN3YDB+SRDgiIUnNgcmiD361ti+AVbL3f3Henf6dqqUyr5dMsorno0lJWJuLhDhkI5sYEpgj6y9kB8AOU1I2A== +"@babel/helper-get-function-arity@^7.12.10": + version "7.12.10" + resolved "https://registry.yarnpkg.com/@babel/helper-get-function-arity/-/helper-get-function-arity-7.12.10.tgz#b158817a3165b5faa2047825dfa61970ddcc16cf" + integrity sha512-mm0n5BPjR06wh9mPQaDdXWDoll/j5UpCAPl1x8fS71GHm7HA6Ua2V4ylG1Ju8lvcTOietbPNNPaSilKj+pj+Ag== dependencies: - "@babel/types" "^7.10.4" + "@babel/types" "^7.12.10" -"@babel/helper-member-expression-to-functions@^7.12.1": +"@babel/helper-member-expression-to-functions@^7.12.7": version "7.12.7" resolved "https://registry.yarnpkg.com/@babel/helper-member-expression-to-functions/-/helper-member-expression-to-functions-7.12.7.tgz#aa77bd0396ec8114e5e30787efa78599d874a855" integrity sha512-DCsuPyeWxeHgh1Dus7APn7iza42i/qXqiFPWyBDdOFtvS581JQePsc1F/nD+fHrcswhLlRc2UpYS1NwERxZhHw== @@ -85,12 +84,12 @@ "@babel/types" "^7.12.1" lodash "^4.17.19" -"@babel/helper-optimise-call-expression@^7.10.4": - version "7.12.7" - resolved "https://registry.yarnpkg.com/@babel/helper-optimise-call-expression/-/helper-optimise-call-expression-7.12.7.tgz#7f94ae5e08721a49467346aa04fd22f750033b9c" - integrity sha512-I5xc9oSJ2h59OwyUqjv95HRyzxj53DAubUERgQMrpcCEYQyToeHA+NEcUEsVWB4j53RDeskeBJ0SgRAYHDBckw== +"@babel/helper-optimise-call-expression@^7.12.10": + version "7.12.10" + resolved "https://registry.yarnpkg.com/@babel/helper-optimise-call-expression/-/helper-optimise-call-expression-7.12.10.tgz#94ca4e306ee11a7dd6e9f42823e2ac6b49881e2d" + integrity sha512-4tpbU0SrSTjjt65UMWSrUOPZTsgvPgGG4S8QSTNHacKzpS51IVWGDj0yCwyeZND/i+LSN2g/O63jEXEWm49sYQ== dependencies: - "@babel/types" "^7.12.7" + "@babel/types" "^7.12.10" "@babel/helper-plugin-utils@^7.0.0", "@babel/helper-plugin-utils@^7.10.4", "@babel/helper-plugin-utils@^7.8.0": version "7.10.4" @@ -98,14 +97,14 @@ integrity sha512-O4KCvQA6lLiMU9l2eawBPMf1xPP8xPfB3iEQw150hOVTqj/rfXz0ThTb4HEzqQfs2Bmo5Ay8BzxfzVtBrr9dVg== "@babel/helper-replace-supers@^7.12.1": - version "7.12.5" - resolved "https://registry.yarnpkg.com/@babel/helper-replace-supers/-/helper-replace-supers-7.12.5.tgz#f009a17543bbbbce16b06206ae73b63d3fca68d9" - integrity sha512-5YILoed0ZyIpF4gKcpZitEnXEJ9UoDRki1Ey6xz46rxOzfNMAhVIJMoune1hmPVxh40LRv1+oafz7UsWX+vyWA== + version "7.12.11" + resolved "https://registry.yarnpkg.com/@babel/helper-replace-supers/-/helper-replace-supers-7.12.11.tgz#ea511658fc66c7908f923106dd88e08d1997d60d" + integrity sha512-q+w1cqmhL7R0FNzth/PLLp2N+scXEK/L2AHbXUyydxp828F4FEa5WcVoqui9vFRiHDQErj9Zof8azP32uGVTRA== dependencies: - "@babel/helper-member-expression-to-functions" "^7.12.1" - "@babel/helper-optimise-call-expression" "^7.10.4" - "@babel/traverse" "^7.12.5" - "@babel/types" "^7.12.5" + "@babel/helper-member-expression-to-functions" "^7.12.7" + "@babel/helper-optimise-call-expression" "^7.12.10" + "@babel/traverse" "^7.12.10" + "@babel/types" "^7.12.11" "@babel/helper-simple-access@^7.12.1": version "7.12.1" @@ -114,17 +113,17 @@ dependencies: "@babel/types" "^7.12.1" -"@babel/helper-split-export-declaration@^7.11.0": - version "7.11.0" - resolved "https://registry.yarnpkg.com/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.11.0.tgz#f8a491244acf6a676158ac42072911ba83ad099f" - integrity sha512-74Vejvp6mHkGE+m+k5vHY93FX2cAtrw1zXrZXRlG4l410Nm9PxfEiVTn1PjDPV5SnmieiueY4AFg2xqhNFuuZg== +"@babel/helper-split-export-declaration@^7.11.0", "@babel/helper-split-export-declaration@^7.12.11": + version "7.12.11" + resolved "https://registry.yarnpkg.com/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.12.11.tgz#1b4cc424458643c47d37022223da33d76ea4603a" + integrity sha512-LsIVN8j48gHgwzfocYUSkO/hjYAOJqlpJEc7tGXcIm4cubjVUf8LGW6eWRyxEu7gA25q02p0rQUWoCI33HNS5g== dependencies: - "@babel/types" "^7.11.0" + "@babel/types" "^7.12.11" -"@babel/helper-validator-identifier@^7.10.4": - version "7.10.4" - resolved "https://registry.yarnpkg.com/@babel/helper-validator-identifier/-/helper-validator-identifier-7.10.4.tgz#a78c7a7251e01f616512d31b10adcf52ada5e0d2" - integrity sha512-3U9y+43hz7ZM+rzG24Qe2mufW5KhvFg/NhnNph+i9mgCtdTCtMJuI1TMkrIUiK7Ix4PYlRF9I5dhqaLYA/ADXw== +"@babel/helper-validator-identifier@^7.10.4", "@babel/helper-validator-identifier@^7.12.11": + version "7.12.11" + resolved "https://registry.yarnpkg.com/@babel/helper-validator-identifier/-/helper-validator-identifier-7.12.11.tgz#c9a1f021917dcb5ccf0d4e453e399022981fc9ed" + integrity sha512-np/lG3uARFybkoHokJUmf1QfEvRVCPbmQeUQpKow5cQ3xWrV9i3rUHodKDJPQfTVX61qKi+UdYk8kik84n7XOw== "@babel/helpers@^7.12.5": version "7.12.5" @@ -144,10 +143,10 @@ chalk "^2.0.0" js-tokens "^4.0.0" -"@babel/parser@^7.1.0", "@babel/parser@^7.12.7": - version "7.12.7" - resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.12.7.tgz#fee7b39fe809d0e73e5b25eecaf5780ef3d73056" - integrity sha512-oWR02Ubp4xTLCAqPRiNIuMVgNO5Aif/xpXtabhzW2HWUD47XJsAB4Zd/Rg30+XeQA3juXigV7hlquOTmwqLiwg== +"@babel/parser@^7.1.0", "@babel/parser@^7.12.10", "@babel/parser@^7.12.11", "@babel/parser@^7.12.7": + version "7.12.11" + resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.12.11.tgz#9ce3595bcd74bc5c466905e86c535b8b25011e79" + integrity sha512-N3UxG+uuF4CMYoNj8AhnbAcJF0PiuJ9KHuy1lQmkYsxTer/MAH9UBNHsBoAX/4s6NvlDD047No8mYVGGzLL4hg== "@babel/plugin-syntax-async-generators@^7.8.4": version "7.8.4" @@ -257,27 +256,27 @@ "@babel/parser" "^7.12.7" "@babel/types" "^7.12.7" -"@babel/traverse@^7.1.0", "@babel/traverse@^7.12.1", "@babel/traverse@^7.12.5", "@babel/traverse@^7.12.9": - version "7.12.9" - resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.12.9.tgz#fad26c972eabbc11350e0b695978de6cc8e8596f" - integrity sha512-iX9ajqnLdoU1s1nHt36JDI9KG4k+vmI8WgjK5d+aDTwQbL2fUnzedNedssA645Ede3PM2ma1n8Q4h2ohwXgMXw== - dependencies: - "@babel/code-frame" "^7.10.4" - "@babel/generator" "^7.12.5" - "@babel/helper-function-name" "^7.10.4" - "@babel/helper-split-export-declaration" "^7.11.0" - "@babel/parser" "^7.12.7" - "@babel/types" "^7.12.7" +"@babel/traverse@^7.1.0", "@babel/traverse@^7.12.1", "@babel/traverse@^7.12.10", "@babel/traverse@^7.12.5": + version "7.12.12" + resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.12.12.tgz#d0cd87892704edd8da002d674bc811ce64743376" + integrity sha512-s88i0X0lPy45RrLM8b9mz8RPH5FqO9G9p7ti59cToE44xFm1Q+Pjh5Gq4SXBbtb88X7Uy7pexeqRIQDDMNkL0w== + dependencies: + "@babel/code-frame" "^7.12.11" + "@babel/generator" "^7.12.11" + "@babel/helper-function-name" "^7.12.11" + "@babel/helper-split-export-declaration" "^7.12.11" + "@babel/parser" "^7.12.11" + "@babel/types" "^7.12.12" debug "^4.1.0" globals "^11.1.0" lodash "^4.17.19" -"@babel/types@^7.0.0", "@babel/types@^7.10.4", "@babel/types@^7.11.0", "@babel/types@^7.12.1", "@babel/types@^7.12.5", "@babel/types@^7.12.7", "@babel/types@^7.3.0", "@babel/types@^7.3.3": - version "7.12.7" - resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.12.7.tgz#6039ff1e242640a29452c9ae572162ec9a8f5d13" - integrity sha512-MNyI92qZq6jrQkXvtIiykvl4WtoRrVV9MPn+ZfsoEENjiWcBQ3ZSHrkxnJWgWtLX3XXqX5hrSQ+X69wkmesXuQ== +"@babel/types@^7.0.0", "@babel/types@^7.12.1", "@babel/types@^7.12.10", "@babel/types@^7.12.11", "@babel/types@^7.12.12", "@babel/types@^7.12.5", "@babel/types@^7.12.7", "@babel/types@^7.3.0", "@babel/types@^7.3.3": + version "7.12.12" + resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.12.12.tgz#4608a6ec313abbd87afa55004d373ad04a96c299" + integrity sha512-lnIX7piTxOH22xE7fDXDbSHg9MM1/6ORnafpJmov5rs0kX5g4BZxeXNJLXsMRiO0U5Rb8/FvMS6xlTnTHvxonQ== dependencies: - "@babel/helper-validator-identifier" "^7.10.4" + "@babel/helper-validator-identifier" "^7.12.11" lodash "^4.17.19" to-fast-properties "^2.0.0" @@ -497,25 +496,25 @@ "@types/yargs" "^15.0.0" chalk "^4.0.0" -"@nodelib/fs.scandir@2.1.3": - version "2.1.3" - resolved "https://registry.yarnpkg.com/@nodelib/fs.scandir/-/fs.scandir-2.1.3.tgz#3a582bdb53804c6ba6d146579c46e52130cf4a3b" - integrity sha512-eGmwYQn3gxo4r7jdQnkrrN6bY478C3P+a/y72IJukF8LjB6ZHeB3c+Ehacj3sYeSmUXGlnA67/PmbM9CVwL7Dw== +"@nodelib/fs.scandir@2.1.4": + version "2.1.4" + resolved "https://registry.yarnpkg.com/@nodelib/fs.scandir/-/fs.scandir-2.1.4.tgz#d4b3549a5db5de2683e0c1071ab4f140904bbf69" + integrity sha512-33g3pMJk3bg5nXbL/+CY6I2eJDzZAni49PfJnL5fghPTggPvBd/pFNSgJsdAgWptuFu7qq/ERvOYFlhvsLTCKA== dependencies: - "@nodelib/fs.stat" "2.0.3" + "@nodelib/fs.stat" "2.0.4" run-parallel "^1.1.9" -"@nodelib/fs.stat@2.0.3", "@nodelib/fs.stat@^2.0.2": - version "2.0.3" - resolved "https://registry.yarnpkg.com/@nodelib/fs.stat/-/fs.stat-2.0.3.tgz#34dc5f4cabbc720f4e60f75a747e7ecd6c175bd3" - integrity sha512-bQBFruR2TAwoevBEd/NWMoAAtNGzTRgdrqnYCc7dhzfoNvqPzLyqlEQnzZ3kVnNrSp25iyxE00/3h2fqGAGArA== +"@nodelib/fs.stat@2.0.4", "@nodelib/fs.stat@^2.0.2": + version "2.0.4" + resolved "https://registry.yarnpkg.com/@nodelib/fs.stat/-/fs.stat-2.0.4.tgz#a3f2dd61bab43b8db8fa108a121cfffe4c676655" + integrity sha512-IYlHJA0clt2+Vg7bccq+TzRdJvv19c2INqBSsoOLp1je7xjtr7J26+WXR72MCdvU9q1qTzIWDfhMf+DRvQJK4Q== "@nodelib/fs.walk@^1.2.3": - version "1.2.4" - resolved "https://registry.yarnpkg.com/@nodelib/fs.walk/-/fs.walk-1.2.4.tgz#011b9202a70a6366e436ca5c065844528ab04976" - integrity sha512-1V9XOY4rDW0rehzbrcqAmHnz8e7SKvX27gh8Gt2WgB0+pdzdiLV83p72kZPU+jvMbS1qU5mauP2iOvO8rhmurQ== + version "1.2.6" + resolved "https://registry.yarnpkg.com/@nodelib/fs.walk/-/fs.walk-1.2.6.tgz#cce9396b30aa5afe9e3756608f5831adcb53d063" + integrity sha512-8Broas6vTtW4GIXTAHDoE32hnN2M5ykgCpWGbuXHQ15vEMqr23pB76e/GZcYsZCHALv50ktd24qhEyKr6wBtow== dependencies: - "@nodelib/fs.scandir" "2.1.3" + "@nodelib/fs.scandir" "2.1.4" fastq "^1.6.0" "@rollup/plugin-commonjs@17.0.0": @@ -561,9 +560,9 @@ picomatch "^2.2.2" "@sinonjs/commons@^1.7.0": - version "1.8.1" - resolved "https://registry.yarnpkg.com/@sinonjs/commons/-/commons-1.8.1.tgz#e7df00f98a203324f6dc7cc606cad9d4a8ab2217" - integrity sha512-892K+kWUUi3cl+LlqEWIDrhvLgdL79tECi8JZUyq6IviKy/DNhuzCRlbHUjxK89f4ypPMMaFnFuR9Ie6DoIMsw== + version "1.8.2" + resolved "https://registry.yarnpkg.com/@sinonjs/commons/-/commons-1.8.2.tgz#858f5c4b48d80778fde4b9d541f27edc0d56488b" + integrity sha512-sruwd86RJHdsVf/AtBoijDmUqJp3B6hF/DGC23C+JaegnDHaZyewCjoVGTdg3J0uz3Zs7NnIT05OBOmML72lQw== dependencies: type-detect "4.0.8" @@ -575,9 +574,9 @@ "@sinonjs/commons" "^1.7.0" "@testing-library/dom@^7.0.3": - version "7.28.1" - resolved "https://registry.yarnpkg.com/@testing-library/dom/-/dom-7.28.1.tgz#dea78be6e1e6db32ddcb29a449e94d9700c79eb9" - integrity sha512-acv3l6kDwZkQif/YqJjstT3ks5aaI33uxGNVIQmdKzbZ2eMKgg3EV2tB84GDdc72k3Kjhl6mO8yUt6StVIdRDg== + version "7.29.4" + resolved "https://registry.yarnpkg.com/@testing-library/dom/-/dom-7.29.4.tgz#1647c2b478789621ead7a50614ad81ab5ae5b86c" + integrity sha512-CtrJRiSYEfbtNGtEsd78mk1n1v2TUbeABlNIcOCJdDfkN5/JTOwQEbbQpoSRxGqzcWPgStMvJ4mNolSuBRv1NA== dependencies: "@babel/code-frame" "^7.10.4" "@babel/runtime" "^7.12.5" @@ -615,9 +614,9 @@ integrity sha512-EBrpH2iXXfaf/9z81koiDYkp2mlwW2XzFcAqn6qh7VKyP8zBvHHAQzNhY+W9vH5arAjmGAm5g8ElWq6YmXm3ig== "@types/aria-query@^4.2.0": - version "4.2.0" - resolved "https://registry.yarnpkg.com/@types/aria-query/-/aria-query-4.2.0.tgz#14264692a9d6e2fa4db3df5e56e94b5e25647ac0" - integrity sha512-iIgQNzCm0v7QMhhe4Jjn9uRh+I6GoPmt03CbEtwx3ao8/EfoQcmgtqH4vQ5Db/lxiIGaWDv6nwvunuh0RyX0+A== + version "4.2.1" + resolved "https://registry.yarnpkg.com/@types/aria-query/-/aria-query-4.2.1.tgz#78b5433344e2f92e8b306c06a5622c50c245bf6b" + integrity sha512-S6oPal772qJZHoRZLFc/XoZW2gFvwXusYUmXPXkgxJLuEk2vOt7jc4Yo6z/vtI0EBkbPBVrJJ0B+prLIKiWqHg== "@types/babel__core@^7.0.0", "@types/babel__core@^7.1.7": version "7.1.12" @@ -646,9 +645,9 @@ "@babel/types" "^7.0.0" "@types/babel__traverse@*", "@types/babel__traverse@^7.0.4", "@types/babel__traverse@^7.0.6": - version "7.0.16" - resolved "https://registry.yarnpkg.com/@types/babel__traverse/-/babel__traverse-7.0.16.tgz#0bbbf70c7bc4193210dd27e252c51260a37cd6a7" - integrity sha512-S63Dt4CZOkuTmpLGGWtT/mQdVORJOpx6SZWGVaP56dda/0Nx5nEe82K7/LAm8zYr6SfMq+1N2OreIOrHAx656w== + version "7.11.0" + resolved "https://registry.yarnpkg.com/@types/babel__traverse/-/babel__traverse-7.11.0.tgz#b9a1efa635201ba9bc850323a8793ee2d36c04a0" + integrity sha512-kSjgDMZONiIfSH1Nxcr5JIRMwUetDki63FSQfpTCz8ogF3Ulqm8+mr5f78dUYs6vMiB6gBusQqfQmBvHZj/lwg== dependencies: "@babel/types" "^7.3.0" @@ -660,9 +659,9 @@ "@types/tern" "*" "@types/estree@*": - version "0.0.45" - resolved "https://registry.yarnpkg.com/@types/estree/-/estree-0.0.45.tgz#e9387572998e5ecdac221950dab3e8c3b16af884" - integrity sha512-jnqIUKDUqJbDIUxm0Uj7bnlMnRm1T/eZ9N+AVMqhPgzrba2GhGG5o/jCTwmdPK709nEZsGoMzXEDUjcXHa3W0g== + version "0.0.46" + resolved "https://registry.yarnpkg.com/@types/estree/-/estree-0.0.46.tgz#0fb6bfbbeabd7a30880504993369c4bf1deab1fe" + integrity sha512-laIjwTQaD+5DukBZaygQ79K1Z0jb1bPEMRrkXSLjtCcZm+abyp5YbrqpSLzD42FwWW6gK/aS4NYpJ804nG2brg== "@types/estree@0.0.39": version "0.0.39" @@ -695,15 +694,7 @@ dependencies: "@types/istanbul-lib-report" "*" -"@types/jest@*", "@types/jest@26.x": - version "26.0.15" - resolved "https://registry.yarnpkg.com/@types/jest/-/jest-26.0.15.tgz#12e02c0372ad0548e07b9f4e19132b834cb1effe" - integrity sha512-s2VMReFXRg9XXxV+CW9e5Nz8fH2K1aEhwgjUqPPbQd7g95T0laAcvLv032EhFHIa5GHsZ8W7iJEQVaJq6k3Gog== - dependencies: - jest-diff "^26.0.0" - pretty-format "^26.0.0" - -"@types/jest@26.0.20": +"@types/jest@*", "@types/jest@26.0.20", "@types/jest@26.x": version "26.0.20" resolved "https://registry.yarnpkg.com/@types/jest/-/jest-26.0.20.tgz#cd2f2702ecf69e86b586e1f5223a60e454056307" integrity sha512-9zi2Y+5USJRxd0FsahERhBwlcvFh6D2GLQnY2FH2BzK8J9s9omvNHIbvABwIluXa0fD8XVKMLTO0aOEuUfACAA== @@ -723,12 +714,7 @@ dependencies: moment "*" -"@types/node@*": - version "14.14.10" - resolved "https://registry.yarnpkg.com/@types/node/-/node-14.14.10.tgz#5958a82e41863cfc71f2307b3748e3491ba03785" - integrity sha512-J32dgx2hw8vXrSbu4ZlVhn1Nm3GbeCFNw2FWL8S5QKucHGY0cyNwjdQdO+KMBZ4wpmC7KhLCiNsdk1RFRIYUQQ== - -"@types/node@14.14.21": +"@types/node@*", "@types/node@14.14.21": version "14.14.21" resolved "https://registry.yarnpkg.com/@types/node/-/node-14.14.21.tgz#d934aacc22424fe9622ebf6857370c052eae464e" integrity sha512-cHYfKsnwllYhjOzuC5q1VpguABBeecUp24yFluHpn/BQaVxB1CuQ1FSRZCzrPxrkIfWISXV2LbeoBthLWg0+0A== @@ -744,9 +730,9 @@ integrity sha512-//oorEZjL6sbPcKUaCdIGlIUeH26mgzimjBB77G6XRgnDl/L5wOnpyBGRe/Mmf5CVW3PwEBE1NjiMZ/ssFh4wA== "@types/prettier@^2.0.0": - version "2.1.5" - resolved "https://registry.yarnpkg.com/@types/prettier/-/prettier-2.1.5.tgz#b6ab3bba29e16b821d84e09ecfaded462b816b00" - integrity sha512-UEyp8LwZ4Dg30kVU2Q3amHHyTn1jEdhCIE59ANed76GaT1Vp76DD3ZWSAxgCrw6wJ0TqeoBpqmfUHiUDPs//HQ== + version "2.1.6" + resolved "https://registry.yarnpkg.com/@types/prettier/-/prettier-2.1.6.tgz#f4b1efa784e8db479cdb8b14403e2144b1e9ff03" + integrity sha512-6gOkRe7OIioWAXfnO/2lFiv+SJichKVSys1mSsgyrYHSEjk8Ctv4tSR/Odvnu+HWlH2C8j53dahU03XmQdd5fA== "@types/pug@^2.0.4": version "2.0.4" @@ -787,14 +773,14 @@ "@types/jest" "*" "@types/yargs-parser@*": - version "15.0.0" - resolved "https://registry.yarnpkg.com/@types/yargs-parser/-/yargs-parser-15.0.0.tgz#cb3f9f741869e20cce330ffbeb9271590483882d" - integrity sha512-FA/BWv8t8ZWJ+gEOnLLd8ygxH/2UFbAvgEonyfN6yWGLKc7zVjbpl2Y4CTjid9h2RfgPP6SEt6uHwEOply00yw== + version "20.2.0" + resolved "https://registry.yarnpkg.com/@types/yargs-parser/-/yargs-parser-20.2.0.tgz#dd3e6699ba3237f0348cd085e4698780204842f9" + integrity sha512-37RSHht+gzzgYeobbG+KWryeAW8J33Nhr69cjTqSYymXVZEN9NbRYWoYlRtDhHKPVT1FyNKwaTPC1NynKZpzRA== "@types/yargs@^15.0.0": - version "15.0.10" - resolved "https://registry.yarnpkg.com/@types/yargs/-/yargs-15.0.10.tgz#0fe3c8173a0d5c3e780b389050140c3f5ea6ea74" - integrity sha512-z8PNtlhrj7eJNLmrAivM7rjBESG6JwC5xP3RVk12i/8HVP7Xnx/sEmERnRImyEuUaJfO942X0qMOYsoupaJbZQ== + version "15.0.12" + resolved "https://registry.yarnpkg.com/@types/yargs/-/yargs-15.0.12.tgz#6234ce3e3e3fa32c5db301a170f96a599c960d74" + integrity sha512-f+fD/fQAo3BCbCDlrUpznF1A5Zp9rB0noS5vnoormHSIPFKL0Z2DcUJ3Gxp5ytH4uLRNxy7AwYUC9exZzqGMAw== dependencies: "@types/yargs-parser" "*" @@ -882,7 +868,7 @@ acorn-globals@^6.0.0: acorn "^7.1.1" acorn-walk "^7.1.1" -acorn-jsx@^5.2.0, acorn-jsx@^5.3.1: +acorn-jsx@^5.3.1: version "5.3.1" resolved "https://registry.yarnpkg.com/acorn-jsx/-/acorn-jsx-5.3.1.tgz#fc8661e11b7ac1539c47dbfea2e72b3af34d267b" integrity sha512-K0Ptm/47OKfQRpNQ2J/oIN/3QYiK6FwW+eJbILhsdxh2WTLdl+30o8aGdTbm5JbffpFFAg/g+zi1E+jvJha5ng== @@ -1082,9 +1068,9 @@ babel-plugin-jest-hoist@^26.6.2: "@types/babel__traverse" "^7.0.6" babel-preset-current-node-syntax@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/babel-preset-current-node-syntax/-/babel-preset-current-node-syntax-1.0.0.tgz#cf5feef29551253471cfa82fc8e0f5063df07a77" - integrity sha512-mGkvkpocWJes1CmMKtgGUwCeeq0pOhALyymozzDWYomHTbDLwueDYG6p4TK1YOeYHCzBzYPsWkgTto10JubI1Q== + version "1.0.1" + resolved "https://registry.yarnpkg.com/babel-preset-current-node-syntax/-/babel-preset-current-node-syntax-1.0.1.tgz#b4399239b89b2a011f9ddbe3e4f401fc40cff73b" + integrity sha512-M7LQ0bxarkxQoN+vz5aJPsLBn77n8QgTFmo8WK0/44auK2xlCXrYcUxHFxgU7qW5Yzw/CjmLRK2uJzaCd7LvqQ== dependencies: "@babel/plugin-syntax-async-generators" "^7.8.4" "@babel/plugin-syntax-bigint" "^7.8.3" @@ -1133,9 +1119,9 @@ bcrypt-pbkdf@^1.0.0: tweetnacl "^0.14.3" binary-extensions@^2.0.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/binary-extensions/-/binary-extensions-2.1.0.tgz#30fa40c9e7fe07dbc895678cd287024dea241dd9" - integrity sha512-1Yj8h9Q+QDF5FzhMs/c9+6UntbD5MkRfRwac8DoEm9ZfUBZ7tZ55YcGVAzEe4bXsdQHEk+s9S5wsOKVdZrw0tQ== + version "2.2.0" + resolved "https://registry.yarnpkg.com/binary-extensions/-/binary-extensions-2.2.0.tgz#75f502eeaf9ffde42fc98829645be4ea76bd9e2d" + integrity sha512-jDctJ/IVQbZoJykoeHbhXpOlNBqGNcwXJKJog42E5HDPUwQTSdjCHdihjj0DlnheQ7blbT6dHOafNAiS8ooQKA== brace-expansion@^1.1.7: version "1.1.11" @@ -1193,9 +1179,9 @@ buffer-from@1.x, buffer-from@^1.0.0: integrity sha512-MQcXEUbCKtEo7bhqEs6560Hyd4XaovZlO/k9V3hjVUF/zwW7KBVdSK4gIt/bzwS9MbR5qob+F5jusZsb0YQK2A== builtin-modules@^3.1.0: - version "3.1.0" - resolved "https://registry.yarnpkg.com/builtin-modules/-/builtin-modules-3.1.0.tgz#aad97c15131eb76b65b50ef208e7584cd76a7484" - integrity sha512-k0KL0aWZuBt2lrxrcASWDfwOLMnodeQjodT/1SxEQAXsHANgo6ZC/VEaSEHCXt7aSTZ4/4H5LKa+tBXmW7Vtvw== + version "3.2.0" + resolved "https://registry.yarnpkg.com/builtin-modules/-/builtin-modules-3.2.0.tgz#45d5db99e7ee5e6bc4f362e008bf917ab5049887" + integrity sha512-lGzLKcioL90C7wMczpkY0n/oART3MbBa8R9OFGE1rJxoVI86u4WAGfEk8Wjv10eKSyTHVGkSo3bvBylCEtk7LA== cache-base@^1.0.1: version "1.0.1" @@ -1270,9 +1256,9 @@ char-regex@^1.0.2: integrity sha512-kWWXztvZ5SBQV+eRgKFeh8q5sLuZY2+8WUIzlxWVTg+oGwY14qylx1KbKzHd8P6ZYkAg0xyIDU9JMHhyJMZ1jw== chokidar@^3.4.1: - version "3.4.3" - resolved "https://registry.yarnpkg.com/chokidar/-/chokidar-3.4.3.tgz#c1df38231448e45ca4ac588e6c79573ba6a57d5b" - integrity sha512-DtM3g7juCXQxFVSNPNByEC2+NImtBuxQQvWlHunpJIS5Ocr0lG306cC7FCi7cEA0fzmybPUIl4txBIobk1gGOQ== + version "3.5.1" + resolved "https://registry.yarnpkg.com/chokidar/-/chokidar-3.5.1.tgz#ee9ce7bbebd2b79f49f304799d5468e31e14e68a" + integrity sha512-9+s+Od+W0VJJzawDma/gvBNQqkTiqYTWLuZoyAsivsI4AaWTCzHG06/TMjsf1cYe9Cb97UCEhjz7HvnPk2p/tw== dependencies: anymatch "~3.1.1" braces "~3.0.2" @@ -1282,7 +1268,7 @@ chokidar@^3.4.1: normalize-path "~3.0.0" readdirp "~3.5.0" optionalDependencies: - fsevents "~2.1.2" + fsevents "~2.3.1" ci-info@^2.0.0: version "2.0.0" @@ -1390,9 +1376,9 @@ copy-descriptor@^0.1.0: integrity sha1-Z29us8OZl8LuGsOpJP1hJHSPV40= core-js-pure@^3.0.0: - version "3.8.0" - resolved "https://registry.yarnpkg.com/core-js-pure/-/core-js-pure-3.8.0.tgz#4cdd2eca37d49cda206b66e26204818dba77884a" - integrity sha512-fRjhg3NeouotRoIV0L1FdchA6CK7ZD+lyINyMoz19SyV+ROpC4noS1xItWHFtwZdlqfMfVPJEyEGdfri2bD1pA== + version "3.8.2" + resolved "https://registry.yarnpkg.com/core-js-pure/-/core-js-pure-3.8.2.tgz#286f885c0dac1cdcd6d78397392abc25ddeca225" + integrity sha512-v6zfIQqL/pzTVAbZvYUozsxNfxcFb6Ks3ZfEbuneJl3FW9Jb8F6vLWB6f+qTmAu72msUdyb84V8d/yBFf7FNnw== core-util-is@1.0.2: version "1.0.2" @@ -1713,16 +1699,7 @@ eslint@7.18.0: text-table "^0.2.0" v8-compile-cache "^2.0.3" -espree@^7.3.0: - version "7.3.0" - resolved "https://registry.yarnpkg.com/espree/-/espree-7.3.0.tgz#dc30437cf67947cf576121ebd780f15eeac72348" - integrity sha512-dksIWsvKCixn1yrEXO8UosNSxaDoSYpq9reEjZSbHLpT5hpaCAKTLBwq0RHtLrIr+c0ByiYzWT8KTMRzoRCNlw== - dependencies: - acorn "^7.4.0" - acorn-jsx "^5.2.0" - eslint-visitor-keys "^1.3.0" - -espree@^7.3.1: +espree@^7.3.0, espree@^7.3.1: version "7.3.1" resolved "https://registry.yarnpkg.com/espree/-/espree-7.3.1.tgz#f2df330b752c6f55019f8bd89b7660039c1bbbb6" integrity sha512-v3JCNCE64umkFpmkFGqzVKsOT0tN1Zr+ueqLZfpV1Ob8e+CEgPWa+OxCoGH3tnhimMKIaBm4m/vaRpJ/krRz2g== @@ -1771,9 +1748,9 @@ estree-walker@^1.0.1: integrity sha512-1fMXF3YP4pZZVozF8j/ZLfvnR8NSIljt56UhbZ5PeeDmmGHpgpdwQt7ITlGvYaQukCvuBRMLEiKiYC+oeIg4cg== estree-walker@^2.0.1: - version "2.0.1" - resolved "https://registry.yarnpkg.com/estree-walker/-/estree-walker-2.0.1.tgz#f8e030fb21cefa183b44b7ad516b747434e7a3e0" - integrity sha512-tF0hv+Yi2Ot1cwj9eYHtxC0jB9bmjacjQs6ZBTj82H8JwUywFuc+7E83NWfNMwHXZc11mjfFcVXPe9gEP4B8dg== + version "2.0.2" + resolved "https://registry.yarnpkg.com/estree-walker/-/estree-walker-2.0.2.tgz#52f010178c2a4c117a7757cfe942adb7d2da4cac" + integrity sha512-Rfkk/Mp/DL7JVje3u18FxFujQlTNR2q6QfMSMB7AvCBx91NGj/ba3kCfza0f6dVDbw7YlRf/nDrn7pQrCCyQ/w== esutils@^2.0.2: version "2.0.3" @@ -1893,9 +1870,9 @@ fast-deep-equal@^3.1.1: integrity sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q== fast-glob@^3.1.1: - version "3.2.4" - resolved "https://registry.yarnpkg.com/fast-glob/-/fast-glob-3.2.4.tgz#d20aefbf99579383e7f3cc66529158c9b98554d3" - integrity sha512-kr/Oo6PX51265qeuCYsyGypiO5uJFgBS0jksyG7FUeCyQzNwYnzrNIMR1NXfkZXsMYXYLRAHgISHBz8gQcxKHQ== + version "3.2.5" + resolved "https://registry.yarnpkg.com/fast-glob/-/fast-glob-3.2.5.tgz#7939af2a656de79a4f1901903ee8adcaa7cb9661" + integrity sha512-2DtFcgT68wiTTiwZ2hNdJfcHNke9XOfnwmBRWXhmeKM8rF0TGwmC/Qto3S7RoZKp5cilZbxzO5iTNTQsJ+EeDg== dependencies: "@nodelib/fs.stat" "^2.0.2" "@nodelib/fs.walk" "^1.2.3" @@ -1915,9 +1892,9 @@ fast-levenshtein@^2.0.6, fast-levenshtein@~2.0.6: integrity sha1-PYpcZog6FqMMqGQ+hR8Zuqd5eRc= fastq@^1.6.0: - version "1.9.0" - resolved "https://registry.yarnpkg.com/fastq/-/fastq-1.9.0.tgz#e16a72f338eaca48e91b5c23593bcc2ef66b7947" - integrity sha512-i7FVWL8HhVY+CTkwFxkN2mk3h+787ixS5S63eb78diVRc1MCssarHq3W5cj0av7YDSwmaV928RNag+U1etRQ7w== + version "1.10.0" + resolved "https://registry.yarnpkg.com/fastq/-/fastq-1.10.0.tgz#74dbefccade964932cdf500473ef302719c652bb" + integrity sha512-NL2Qc5L3iQEsyYzweq7qfgy5OtXCmGzGvhElGEd/SoFWEMOEczNh5s5ocaF01HDetxz+p8ecjNPA6cZxxIHmzA== dependencies: reusify "^1.0.4" @@ -2004,10 +1981,10 @@ fs.realpath@^1.0.0: resolved "https://registry.yarnpkg.com/fs.realpath/-/fs.realpath-1.0.0.tgz#1504ad2523158caa40db4a2787cb01411994ea4f" integrity sha1-FQStJSMVjKpA20onh8sBQRmU6k8= -fsevents@^2.1.2: - version "2.2.1" - resolved "https://registry.yarnpkg.com/fsevents/-/fsevents-2.2.1.tgz#1fb02ded2036a8ac288d507a65962bd87b97628d" - integrity sha512-bTLYHSeC0UH/EFXS9KqWnXuOl/wHK5Z/d+ghd5AsFMYN7wIGkUCOJyzy88+wJKkZPGON8u4Z9f6U4FdgURE9qA== +fsevents@^2.1.2, fsevents@~2.3.1: + version "2.3.1" + resolved "https://registry.yarnpkg.com/fsevents/-/fsevents-2.3.1.tgz#b209ab14c61012636c8863507edf7fb68cc54e9f" + integrity sha512-YR47Eg4hChJGAB1O3yEAOkGO+rlzutoICGqGo9EZ4lKWokzZRSyIW1QmTzqjtw8MJdj9srP869CuWw/hyzSiBw== fsevents@~2.1.2: version "2.1.3" @@ -2097,9 +2074,9 @@ globals@^12.1.0: type-fest "^0.8.1" globby@^11.0.1: - version "11.0.1" - resolved "https://registry.yarnpkg.com/globby/-/globby-11.0.1.tgz#9a2bf107a068f3ffeabc49ad702c79ede8cfd357" - integrity sha512-iH9RmgwCmUJHi2z5o2l3eTtGBtXek1OYlHrbcxOYugyHLmAsZrPj43OtHThd62Buh/Vv6VyCBD2bdyWcGNQqoQ== + version "11.0.2" + resolved "https://registry.yarnpkg.com/globby/-/globby-11.0.2.tgz#1af538b766a3b540ebfb58a32b2e2d5897321d83" + integrity sha512-2ZThXDvvV8fYFRVIxnrMQBipZQDr7MxKAmQK1vujaj9/7eF0efG7BPUKJ7jP7G5SLF37xKDXvO4S/KKLj/Z0og== dependencies: array-union "^2.1.0" dir-glob "^3.0.1" @@ -2228,9 +2205,9 @@ ignore@^5.1.4: integrity sha512-BMpfD7PpiETpBl/A6S498BaIJ6Y/ABT93ETbby2fP00v4EbvPBXWEoaR1UBPKs3iR53pJY7EtZk5KACI57i1Uw== import-fresh@^3.0.0, import-fresh@^3.1.0, import-fresh@^3.2.1: - version "3.2.2" - resolved "https://registry.yarnpkg.com/import-fresh/-/import-fresh-3.2.2.tgz#fc129c160c5d68235507f4331a6baad186bdbc3e" - integrity sha512-cTPNrlvJT6twpYy+YmKUKrTSjWFs3bjYjAhCwm+z4EOCubZxAuO+hHpRN64TqjEaYSHs7tJAE0w1CKMGmsG/lw== + version "3.3.0" + resolved "https://registry.yarnpkg.com/import-fresh/-/import-fresh-3.3.0.tgz#37162c25fcb9ebaa2e6e53d5b4d88ce17d9e0c2b" + integrity sha512-veYYhQa+D1QBKznvhUHxb8faxlrwUnxseDAbAp457E0wLNio2bOSKnjYDhMj+YiAq61xrMGhQk9iXVk5FzgQMw== dependencies: parent-module "^1.0.0" resolve-from "^4.0.0" @@ -2897,9 +2874,9 @@ js-tokens@^4.0.0: integrity sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ== js-yaml@^3.13.1: - version "3.14.0" - resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-3.14.0.tgz#a7a34170f26a21bb162424d8adacb4113a69e482" - integrity sha512-/4IbIeHcD9VMHFqDR/gQ7EdZdLimOvW2DdcxFjdyyZ9NsbS+ccrXqVWDtab/lRl5AlUqmpBx8EhPaWR+OtY17A== + version "3.14.1" + resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-3.14.1.tgz#dae812fdb3825fa306609a8717383c50c36a0537" + integrity sha512-okMH7OXXJ7YrN9Ok3/SXrnu4iX9yOk+25nqX4imS2npuvTYDmo/QEZoqwZkYaIDk3jVvBOTOIEgEhaLOynBS9g== dependencies: argparse "^1.0.7" esprima "^4.0.0" @@ -3070,6 +3047,13 @@ lodash@^4.17.15, lodash@^4.17.19, lodash@^4.17.20: resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.20.tgz#b44a9b6297bcb698f1c51a3545a2b3b368d59c52" integrity sha512-PlhdFcillOINfeV7Ni6oF1TAEayyZBoZ8bcshTHqOYJYlrqzRK5hagpagky5o4HfCzzd1TRkXPMFq6cKk9rGmA== +lru-cache@^6.0.0: + version "6.0.0" + resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-6.0.0.tgz#6d6fe6570ebd96aaf90fcad1dafa3b2566db3a94" + integrity sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA== + dependencies: + yallist "^4.0.0" + lz-string@^1.4.4: version "1.4.4" resolved "https://registry.yarnpkg.com/lz-string/-/lz-string-1.4.4.tgz#c0d8eaf36059f705796e1e344811cf4c498d3a26" @@ -3150,17 +3134,17 @@ micromatch@^4.0.2: braces "^3.0.1" picomatch "^2.0.5" -mime-db@1.44.0: - version "1.44.0" - resolved "https://registry.yarnpkg.com/mime-db/-/mime-db-1.44.0.tgz#fa11c5eb0aca1334b4233cb4d52f10c5a6272f92" - integrity sha512-/NOTfLrsPBVeH7YtFPgsVWveuL+4SjjYxaQ1xtM1KMFj7HdxlBlxeyNLzhyJVx7r4rZGJAZ/6lkKCitSc/Nmpg== +mime-db@1.45.0: + version "1.45.0" + resolved "https://registry.yarnpkg.com/mime-db/-/mime-db-1.45.0.tgz#cceeda21ccd7c3a745eba2decd55d4b73e7879ea" + integrity sha512-CkqLUxUk15hofLoLyljJSrukZi8mAtgd+yE5uO4tqRZsdsAJKv0O+rFMhVDRJgozy+yG6md5KwuXhD4ocIoP+w== mime-types@^2.1.12, mime-types@~2.1.19: - version "2.1.27" - resolved "https://registry.yarnpkg.com/mime-types/-/mime-types-2.1.27.tgz#47949f98e279ea53119f5722e0f34e529bec009f" - integrity sha512-JIhqnCasI9yD+SsmkquHBxTSEuZdQX5BuQnS2Vc7puQQQ+8yiP5AY5uWhpdv4YL4VM5c6iliiYWPgJ/nJQLp7w== + version "2.1.28" + resolved "https://registry.yarnpkg.com/mime-types/-/mime-types-2.1.28.tgz#1160c4757eab2c5363888e005273ecf79d2a0ecd" + integrity sha512-0TO2yJ5YHYr7M2zzT7gDU1tbwHxEUWBCLt0lscSNpcdAfFyJOVEpRYNS7EXVcTLNj/25QO8gulHC5JtTzSE2UQ== dependencies: - mime-db "1.44.0" + mime-db "1.45.0" mimic-fn@^2.1.0: version "2.1.0" @@ -3250,9 +3234,9 @@ node-modules-regexp@^1.0.0: integrity sha1-jZ2+KJZKSsVxLpExZCEHxx6Q7EA= node-notifier@^8.0.0: - version "8.0.0" - resolved "https://registry.yarnpkg.com/node-notifier/-/node-notifier-8.0.0.tgz#a7eee2d51da6d0f7ff5094bc7108c911240c1620" - integrity sha512-46z7DUmcjoYdaWyXouuFNNfUo6eFa94t23c53c+lG/9Cvauk4a98rAUp9672X5dxGdQmLpPzTxzu8f/OeEPaFA== + version "8.0.1" + resolved "https://registry.yarnpkg.com/node-notifier/-/node-notifier-8.0.1.tgz#f86e89bbc925f2b068784b31f382afdc6ca56be1" + integrity sha512-BvEXF+UmsnAfYfoapKM9nGxnP+Wn7P91YfXmrKnfcYCx6VBeoN5Ez5Ogck6I8Bi5k4RlpqRYaw75pAwzX9OphA== dependencies: growly "^1.3.0" is-wsl "^2.2.0" @@ -3330,45 +3314,29 @@ object.pick@^1.3.0: dependencies: isobject "^3.0.1" -obsidian-calendar-ui@0.2.0: - version "0.2.0" - resolved "https://registry.yarnpkg.com/obsidian-calendar-ui/-/obsidian-calendar-ui-0.2.0.tgz#899d2b50f9066d6c68a4b8aa725111a40522d3ed" - integrity sha512-O1MphFygFDL2zgHd0wdzSw/Tu1aMnzN2yJEEtOIjSlxF2y5YwaJ40Skci+9GzLjAjQjs+yeaf1I5sayGvdSoAg== +obsidian-calendar-ui@0.2.1: + version "0.2.1" + resolved "https://registry.yarnpkg.com/obsidian-calendar-ui/-/obsidian-calendar-ui-0.2.1.tgz#f0645add7e6ef71f3a589a375e411a67ab6b8b3d" + integrity sha512-2ZVbJW50VT1cXnQvIIZCIs17uKPaSWCUIlLOCi2e7Ylh8fPyAU90TkCVJuDOi5wVFRS8YzIseBV2osXo92h6sQ== dependencies: obsidian-daily-notes-interface "0.5.1" svelte "3.31.0" tslib "2.0.3" -<<<<<<< HEAD -<<<<<<< HEAD -obsidian@obsidianmd/obsidian-api#master: - version "0.10.0" - resolved "https://codeload.github.com/obsidianmd/obsidian-api/tar.gz/2e4ac7c8dd4d1b8ca4cf726eac75a935a3ea25d8" -======= -obsidian-daily-notes-interface@0.4.0: - version "0.4.0" - resolved "https://registry.yarnpkg.com/obsidian-daily-notes-interface/-/obsidian-daily-notes-interface-0.4.0.tgz#9bbc1813146ebbff60df986fd717f90b2620d309" - integrity sha512-CTokiN+6UJ7umihC5equ3sMx5kO9F3X94sSrMN8nrUHjVQYfZiGX/cFhCqh7laeE7MC0g8Kzwzv6/6VLbpmV6w== ->>>>>>> 8f2022a (Generalize sources) -======= obsidian-daily-notes-interface@0.5.1: version "0.5.1" resolved "https://registry.yarnpkg.com/obsidian-daily-notes-interface/-/obsidian-daily-notes-interface-0.5.1.tgz#8fe28eab46e7fb789c8fc935dd3c74232b6e15f9" integrity sha512-QwSAN7ob6r05e+IFhIY1Knn1H2zM4p3MCmUdbtNOFxPe0MQWsLAK5fjt0ST1usm7z0rVuTbNHJAzXxNRQaDlzg== ->>>>>>> fca8e0a (Use generic calendar UI) dependencies: obsidian obsidianmd/obsidian-api#master tslib "2.0.3" -<<<<<<< HEAD -======= obsidian@obsidianmd/obsidian-api#master: version "0.10.6" resolved "https://codeload.github.com/obsidianmd/obsidian-api/tar.gz/a0e0c245561215ced9468859091e01d015f5cda9" dependencies: "@types/codemirror" "0.0.98" ->>>>>>> fca8e0a (Use generic calendar UI) once@^1.3.0, once@^1.3.1, once@^1.4.0: version "1.4.0" resolved "https://registry.yarnpkg.com/once/-/once-1.4.0.tgz#583b1aa775961d4b113ac17d9c50baef9dd76bd1" @@ -3734,7 +3702,7 @@ resolve-url@^0.2.1: resolved "https://registry.yarnpkg.com/resolve-url/-/resolve-url-0.2.1.tgz#2c637fe77c893afd2a663fe21aa9080068e2052a" integrity sha1-LGN/53yJOv0qZj/iGqkIAGjiBSo= -resolve@^1.10.0, resolve@^1.17.0, resolve@^1.18.1, resolve@^1.19.0, resolve@^1.3.2: +resolve@^1.10.0, resolve@^1.17.0, resolve@^1.18.1, resolve@^1.19.0: version "1.19.0" resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.19.0.tgz#1af5bf630409734a067cae29318aac7fa29a267c" integrity sha512-rArEXAgsBG4UgRGcynxWIWKFvh/XZCcS8UJdHhwy91zwAvCZIbcs+vAbflgBnNjYMs/i/i+/Ux6IZhML1yPvxg== @@ -3841,9 +3809,11 @@ saxes@^5.0.0: integrity sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ== semver@7.x, semver@^7.2.1, semver@^7.3.2: - version "7.3.2" - resolved "https://registry.yarnpkg.com/semver/-/semver-7.3.2.tgz#604962b052b81ed0786aae84389ffba70ffd3938" - integrity sha512-OrOb32TeeambH6UrhtShmF7CRDqhL6/5XpPNp2DuRH6+9QLw/orhp72j87v8Qa1ScDkvrrBNpZcDejAirJmfXQ== + version "7.3.4" + resolved "https://registry.yarnpkg.com/semver/-/semver-7.3.4.tgz#27aaa7d2e4ca76452f98d3add093a72c943edc97" + integrity sha512-tCfb2WLjqFAtXn4KEdxIhalnRtoKFN7nAwj0B3ZXCbQloV2tq5eDbcTmT68JJD3nRJq24/XgxtQKFIpQdtvmVw== + dependencies: + lru-cache "^6.0.0" semver@^6.0.0, semver@^6.3.0: version "6.3.0" @@ -4318,9 +4288,9 @@ tslib@^1.8.1: integrity sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg== tsutils@^3.17.1: - version "3.17.1" - resolved "https://registry.yarnpkg.com/tsutils/-/tsutils-3.17.1.tgz#ed719917f11ca0dee586272b2ac49e015a2dd759" - integrity sha512-kzeQ5B8H3w60nFY2g8cJIuH7JDpsALXySGtwGJ0p2LSjLgay3NdIpqq5SoOBe46bKDW2iq25irHCr8wjomUS2g== + version "3.19.1" + resolved "https://registry.yarnpkg.com/tsutils/-/tsutils-3.19.1.tgz#d8566e0c51c82f32f9c25a4d367cd62409a547a9" + integrity sha512-GEdoBf5XI324lu7ycad7s6laADfnAqCw6wLGI+knxvw9vsIYBaJfYdmeCEG3FMMUiSm3OGgNb+m6utsWf5h9Vw== dependencies: tslib "^1.8.1" @@ -4377,12 +4347,7 @@ typedarray-to-buffer@^3.1.5: dependencies: is-typedarray "^1.0.0" -typescript@*: - version "4.1.2" - resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.1.2.tgz#6369ef22516fe5e10304aae5a5c4862db55380e9" - integrity sha512-thGloWsGH3SOxv1SoY7QojKi0tc+8FnOmiarEGMbd/lar7QOEd3hvlx3Fp5y6FlDUGl9L+pd4n2e+oToGMmhRQ== - -typescript@4.1.3: +typescript@*, typescript@4.1.3: version "4.1.3" resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.1.3.tgz#519d582bd94cba0cf8934c7d8e8467e473f53bb7" integrity sha512-B3ZIOf1IKeH2ixgHhj6la6xdwR9QrLC5d1VKeCSY4tvkqhF2eqd9O7txNlS0PO3GrBAFIdr3L1ndNwteUbZLYg== @@ -4406,9 +4371,9 @@ unset-value@^1.0.0: isobject "^3.0.0" uri-js@^4.2.2: - version "4.4.0" - resolved "https://registry.yarnpkg.com/uri-js/-/uri-js-4.4.0.tgz#aa714261de793e8a82347a7bcc9ce74e86f28602" - integrity sha512-B0yRTzYdUCCn9n+F4+Gh4yIDtMQcaJsmYBDsTSG8g/OejKBodLQ2IHfN3bM7jUsRXndopT7OIXWdYqc1fjmV6g== + version "4.4.1" + resolved "https://registry.yarnpkg.com/uri-js/-/uri-js-4.4.1.tgz#9b1a52595225859e55f669d928f88c6c57f2a77e" + integrity sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg== dependencies: punycode "^2.1.0" @@ -4428,9 +4393,9 @@ uuid@^3.3.2: integrity sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A== uuid@^8.3.0: - version "8.3.1" - resolved "https://registry.yarnpkg.com/uuid/-/uuid-8.3.1.tgz#2ba2e6ca000da60fce5a196954ab241131e05a31" - integrity sha512-FOmRr+FmWEIG8uhZv6C2bTgEVXsHk08kE7mPlrBbEe+c3r9pjceVPgupIfNIhc4yx55H69OXANrUaSuu9eInKg== + version "8.3.2" + resolved "https://registry.yarnpkg.com/uuid/-/uuid-8.3.2.tgz#80d5b5ced271bb9af6c445f21a1a04c606cefbe2" + integrity sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg== v8-compile-cache@^2.0.3: version "2.2.0" @@ -4438,9 +4403,9 @@ v8-compile-cache@^2.0.3: integrity sha512-gTpR5XQNKFwOd4clxfnhaqvfqMpqEwr4tOtCyz4MtYZX2JYhfr1JvBFKdS+7K/9rfpZR3VLX+YWBbKoxCgS43Q== v8-to-istanbul@^7.0.0: - version "7.0.0" - resolved "https://registry.yarnpkg.com/v8-to-istanbul/-/v8-to-istanbul-7.0.0.tgz#b4fe00e35649ef7785a9b7fcebcea05f37c332fc" - integrity sha512-fLL2rFuQpMtm9r8hrAV2apXX/WqHJ6+IC4/eQVdMDGBUgH/YMV4Gv3duk3kjmyg6uiQWBAA9nJwue4iJUOkHeA== + version "7.1.0" + resolved "https://registry.yarnpkg.com/v8-to-istanbul/-/v8-to-istanbul-7.1.0.tgz#5b95cef45c0f83217ec79f8fc7ee1c8b486aee07" + integrity sha512-uXUVqNUCLa0AH1vuVxzi+MI4RfxEOKt9pBgKwHbgH7st8Kv2P1m+jvWNnektzBh5QShF3ODgKmUFCf38LnVz1g== dependencies: "@types/istanbul-lib-coverage" "^2.0.1" convert-source-map "^1.6.0" @@ -4564,9 +4529,9 @@ write-file-atomic@^3.0.0: typedarray-to-buffer "^3.1.5" ws@^7.2.3: - version "7.4.0" - resolved "https://registry.yarnpkg.com/ws/-/ws-7.4.0.tgz#a5dd76a24197940d4a8bb9e0e152bb4503764da7" - integrity sha512-kyFwXuV/5ymf+IXhS6f0+eAFvydbaBW3zjpT6hUdAh/hbVjTIB5EHBGi0bPoCLSK2wcuz3BrEkB9LrYv1Nm4NQ== + version "7.4.2" + resolved "https://registry.yarnpkg.com/ws/-/ws-7.4.2.tgz#782100048e54eb36fe9843363ab1c68672b261dd" + integrity sha512-T4tewALS3+qsrpGI/8dqNMLIVdq/g/85U98HPMa6F0m6xTbvhXU6RCQLqPH3+SlomNV/LdY6RXEbBpMH6EOJnA== xml-name-validator@^3.0.0: version "3.0.0" @@ -4579,9 +4544,14 @@ xmlchars@^2.2.0: integrity sha512-JZnDKK8B0RCDw84FNdDAIpZK+JuJw+s7Lz8nksI7SIuU3UXJJslUthsi+uWBUYOwPFwW7W7PRLRfUKpxjtjFCw== y18n@^4.0.0: + version "4.0.1" + resolved "https://registry.yarnpkg.com/y18n/-/y18n-4.0.1.tgz#8db2b83c31c5d75099bb890b23f3094891e247d4" + integrity sha512-wNcy4NvjMYL8gogWWYAO7ZFWFfHcbdbE57tZO8e4cbpj8tfUcwrwqSl3ad8HxpYWCdXcJUCeKKZS62Av1affwQ== + +yallist@^4.0.0: version "4.0.0" - resolved "https://registry.yarnpkg.com/y18n/-/y18n-4.0.0.tgz#95ef94f85ecc81d007c264e190a120f0a3c8566b" - integrity sha512-r9S/ZyXu/Xu9q1tYlpsLIsa3EeLXXk0VwlxqTcFRfg9EhMW+17kbt9G0NrgCmhGb5vT2hyhJZLfDGx+7+5Uj/w== + resolved "https://registry.yarnpkg.com/yallist/-/yallist-4.0.0.tgz#9bb92790d9c0effec63be73519e11a35019a3a72" + integrity sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A== yaml@^1.7.2: version "1.10.0" From d8bd5a47227e46f344ade13e2e7baca82dd5b90c Mon Sep 17 00:00:00 2001 From: Liam Cain Date: Sun, 17 Jan 2021 18:49:17 -0500 Subject: [PATCH 7/7] Fix weekly note unit tests --- src/io/__tests__/weeklyNotes.spec.ts | 32 +++++++++++++++++----------- 1 file changed, 20 insertions(+), 12 deletions(-) diff --git a/src/io/__tests__/weeklyNotes.spec.ts b/src/io/__tests__/weeklyNotes.spec.ts index d800532..048d4ab 100644 --- a/src/io/__tests__/weeklyNotes.spec.ts +++ b/src/io/__tests__/weeklyNotes.spec.ts @@ -17,33 +17,31 @@ describe("getDayOfWeekNumericalValue", () => { }); describe("start week on Sunday", () => { + beforeEach(() => { + // eslint-disable-next-line @typescript-eslint/no-explicit-any + (moment.localeData())._week.dow = 0; + }); + test("returns 0 for sunday", () => { - getDefaultSettings({ - weekStart: "sunday", - }); expect(weeklyNote.getDayOfWeekNumericalValue("sunday")).toEqual(0); }); test("returns 1 for monday", () => { - getDefaultSettings({ - weekStart: "sunday", - }); expect(weeklyNote.getDayOfWeekNumericalValue("monday")).toEqual(1); }); }); describe("start week on Monday", () => { + beforeEach(() => { + // eslint-disable-next-line @typescript-eslint/no-explicit-any + (moment.localeData())._week.dow = 1; + }); + test("returns 0 for sunday", () => { - getDefaultSettings({ - weekStart: "monday", - }); expect(weeklyNote.getDayOfWeekNumericalValue("sunday")).toEqual(6); }); test("returns 1 for monday", () => { - getDefaultSettings({ - weekStart: "monday", - }); expect(weeklyNote.getDayOfWeekNumericalValue("monday")).toEqual(0); }); }); @@ -85,6 +83,11 @@ describe("createWeeklyNote", () => { }); describe("start week on Sunday", () => { + beforeEach(() => { + // eslint-disable-next-line @typescript-eslint/no-explicit-any + (moment.localeData())._week.dow = 0; + }); + test("replaces {{sunday}} and {{monday}} in weekly note", async () => { (getTemplateContents as jest.MockedFunction< typeof getTemplateContents @@ -105,6 +108,11 @@ describe("createWeeklyNote", () => { }); describe("start week on Monday", () => { + beforeEach(() => { + // eslint-disable-next-line @typescript-eslint/no-explicit-any + (moment.localeData())._week.dow = 1; + }); + test("replaces {{sunday}} and {{monday}} in weekly note", async () => { (getTemplateContents as jest.MockedFunction< typeof getTemplateContents