import { ChangeSet } from '@codemirror/state'; import { DateTime } from 'luxon'; import { DurationLikeObject } from 'luxon'; import { LRUCache } from 'lru-cache'; import { Options } from '@markwhen/rrule'; import { Text } from '@codemirror/state'; import { Zone } from 'luxon'; export declare const AMERICAN_DATE_FORMAT = "M/d/y"; export declare const AT_REGEX: RegExp; export declare class Block implements MarkdownBlock { type: BlockType; value?: any; raw: string; constructor(raw: string); } export declare enum BlockType { TEXT = "text", LIST_ITEM = "listItem", CHECKBOX = "checkbox", IMAGE = "image" } export declare class Cache { slashDate: LRUCache; roundDateUp: LRUCache; ranges: LRUCache; } export declare class Caches { zones: LRUCache; yaml: LRUCache; caches: [Zone, Cache][]; zone(timezone: Zone): Cache; } export declare const COLORS: string[]; export declare const COMPLETION_REGEX: RegExp; export declare const DATE_TIME_FORMAT_MONTH_YEAR = "M/y"; export declare const DATE_TIME_FORMAT_YEAR = "y"; declare type DateFormap = { [w in Weight]: { format: string; separator?: string; }; }; export declare type DateFormat = typeof AMERICAN_DATE_FORMAT | typeof EUROPEAN_DATE_FORMAT; export declare interface DateRange { fromDateTime: DateTime; toDateTime: DateTime; } export declare interface DateRangeIso { fromDateTimeIso: DateTimeIso; toDateTimeIso: DateTimeIso; } export declare class DateRangePart implements DateRange { fromDateTime: DateTime; toDateTime: DateTime; originalString?: string; eventText: string; dateRangeInText: Range; definition: Range; recurrence?: Recurrence; isRelative: boolean; recurrenceRangeInText?: Range; fromRelativeTo?: { path: Path; dt: DateTime; }; toRelativeTo?: { path: Path; dt: DateTime; }; constructor({ from, to, originalString, dateRangeInText, eventText, definition, isRelative, recurrence, fromRelativeTo, toRelativeTo, }: { from: DateTime; to: DateTime; originalString: string; dateRangeInText: Range; eventText: string; definition: Range; isRelative: boolean; recurrence?: RecurrenceInText; fromRelativeTo?: { path: Path; dt: DateTime; }; toRelativeTo?: { path: Path; dt: DateTime; }; }); } export declare function dateRangeToString({ fromDateTime, toDateTime, }: { fromDateTime: DateTime; toDateTime: DateTime; }, formap?: DateFormap): string; export declare type DateTimeGranularity = "instant" | "year" | "month" | "week" | "day" | "hour" | "minute"; export declare type DateTimeIso = string; declare interface DocumentMessage { type: "error" | "warning"; message: string; } export declare function emptyTimeline(): Timeline; export declare function entrySet(mw: string, path: Path, value: Record, merge?: boolean): { from: number; to?: number; insert: string; }; export declare const EUROPEAN_DATE_FORMAT = "d/M/y"; declare class Event_2 { firstLine: { full: string; datePart?: string; rest: string; restTrimmed: string; }; textRanges: { whole: Range; datePart: Range; definition: Range; recurrence?: Range; properties?: Range; }; properties: any; propOrder: string[]; dateRangeIso: DateRangeIso; recurrence?: Recurrence; tags: string[]; supplemental: MarkdownBlock[]; matchedListItems: Range[]; isRelative: boolean; fromRelativeTo?: { path: Path; dt: DateTimeIso; }; toRelativeTo?: { path: Path; dt: DateTimeIso; }; id?: string; percent?: number; completed?: boolean; constructor(firstLine: string, properties: any, propOrder: string[], propRange: Range | undefined, dateRange: DateRangePart, rangeInText: Range, dateRangeInText: Range, eventDescription: EventDescription); } export { Event_2 as Event } export declare const EVENT_ID_REGEX: RegExp; export declare class EventDescription { eventDescription: string; tags: string[]; supplemental: MarkdownBlock[]; matchedListItems: Range[]; locations: string[]; id?: string; percent?: number; completed?: boolean; constructor(lines: string[], matchedListItems: Range[], completed?: boolean); } export declare class EventGroup { textRanges: { whole: Range; definition: Range; properties?: Range; }; properties: any; propOrder: string[]; propRange?: Range; tags: string[]; title: string; range?: GroupRange; startExpanded?: boolean; style?: GroupStyle; children: Array; } export declare const eventRange: (e: Event_2) => { fromDateTime: DateTime | DateTime; toDateTime: DateTime | DateTime; }; export declare type Eventy = Event_2 | EventGroup; export declare const expand: (dateRange: DateRange, recurrence: Recurrence, limit: number) => DateRange[]; export declare const flat: (node: Eventy) => Array; export declare const flatMap: (node: Eventy, mapper: (n: Eventy) => T) => Array; export declare interface Foldable { endIndex: number; type: "comment" | "section" | "header" | "event"; startLine: number; startIndex?: number; foldStartIndex?: number; } export declare const get: (root: Eventy, path: Path) => Eventy | undefined; export declare const getLast: (node: Eventy) => { node: Eventy; path: Path; }; declare type GranularDateTime = { dateTimeIso: DateTimeIso; granularity: DateTimeGranularity; }; export declare type GroupRange = DateRange & { maxFrom: DateTime; }; declare type GroupStyle = "section" | "group"; export declare function headerSet(mw: string, value: Record, merge?: boolean): { from: number; to?: number; insert: string; }; export declare function hexToRgb(hex: string): string | undefined; export declare const HUMAN_COLORS: string[]; declare type IdedEvents = { [id: string]: number[]; }; export declare class Image implements MarkdownBlock { type: BlockType; altText: string; link: string; constructor(altText: string, link: string); } export declare const IMAGE_REGEX: RegExp; export declare function incrementalParse(previousText: string | string[] | Text, changes?: ChangeSet, previousParse?: ParseResult, now?: DateTime | string): ParseResult; export declare function isEvent(eventy: Eventy): eventy is Event_2; export declare function iter(eventy: Eventy, path?: Path): Generator<{ eventy: Eventy; path: number[]; }>; export declare const LINK_REGEX: RegExp; export declare const LOCATION_REGEX: RegExp; export declare function mapUrls(events: { path: Path; event: Event_2; }[]): { path: Path; event: Event_2; url: string; }[]; export declare interface MarkdownBlock { type: BlockType; } export declare function parse(timelineString?: string | string[] | Text, cache?: Caches | true, now?: DateTime | string): ParseResult; export declare function parseDateRange(dateRangeString: string): DateRangePart | undefined; export declare function parseHeader(timelineString: string): { lines: string[]; lengthAtIndex: number[]; headerEndLineIndex: number; now: DateTime; events: EventGroup; head?: Eventy; tail?: Event_2; currentPath: Path; ids: IdedEvents; title: string | undefined; description: string | undefined; paletteIndex: number; earliest: DateTime | undefined; latest: DateTime | undefined; maxDuration: number | undefined; foldables: { [F in number | string]: Foldable; }; foldableSections: Foldable[]; ranges: Range[]; header: Record; parseMessages: ParseMessage[]; documentMessages: DocumentMessage[]; cache?: Caches; sectionLevels: number[]; }; export declare function parseICal(ical: string, options?: { output?: "markwhen" | "json"; formap?: DateFormap; }): string | ParseResult; export declare type ParseMessage = DocumentMessage & { pos: [number, number]; }; export declare type ParseResult = Timeline & { cache?: Caches; parser: { version: string; incremental?: boolean; }; }; export declare type ParseTimings = { total: number; lines: number; header: number; body: number; }; export declare class ParsingContext { now: DateTime; events: EventGroup; head?: Eventy; tail?: Event_2; currentPath: Path; ids: IdedEvents; title: string | undefined; description: string | undefined; paletteIndex: number; earliest: DateTime | undefined; latest: DateTime | undefined; maxDuration: number | undefined; foldables: { [F in number | string]: Foldable; }; foldableSections: Foldable[]; ranges: Range[]; header: Record; parseMessages: ParseMessage[]; documentMessages: DocumentMessage[]; cache?: Caches; sectionLevels: number[]; constructor(now?: DateTime | string, cache?: Caches, getPriorEvent?: (c: ParsingContext) => Event_2 | undefined); get zonedNow(): DateTime; get timezone(): Zone; currentFoldableSection(): Foldable; currentFoldableComment(): Foldable; startFoldableSection(f: Foldable): void; startFoldable(f: Foldable): void; finishFoldableSection(line: number, endIndex: number): void; finishFoldableComment(lineNumber: number): void; push(node: Eventy): number[]; endCurrentGroup(to: number, lineTo: { line: number; index: number; }): void; toTimeline(): Timeline & { parseMessages: ParseMessage[]; }; priorEvent(): Event_2 | undefined; parentZone(): Zone; priorEventToDateTime(): DateTime | DateTime | undefined; priorEventFromDateTime(): DateTime | DateTime | undefined; getById(id: string): Eventy | undefined; } export declare type Path = number[]; export declare function profileParse(timelineString?: string | string[] | Text, cache?: Caches | true, now?: DateTime | string): { parseResult: ParseResult; timings: ParseTimings; }; export declare const push: (node: Event_2 | EventGroup, onto: EventGroup, path?: Path, tail?: Event_2) => { path: number[]; tail?: Event_2; }; export declare type Range = { from: number; to: number; type: RangeType; content?: any; }; export declare const ranges: (root?: Eventy) => GroupRange | undefined; export declare enum RangeType { Comment = "comment", CheckboxItemIndicator = "checkboxItemIndicator", listItemIndicator = "listItemIndicator", ListItemContents = "listItemContents", Tag = "tag", tagDefinition = "tagDefinition", Title = "title", View = "view", Viewer = "viewer", Description = "description", Section = "section", DateRange = "dateRange", DateRangeColon = "dateRangeColon", Event = "event", Edit = "edit", Editor = "editor", Recurrence = "recurrence", FrontmatterDelimiter = "frontMatterDelimiter", HeaderKey = "headerKey", HeaderKeyColon = "headerKeyColon", HeaderValue = "headerValue", PropertyKey = "propertyKey", PropertyKeyColon = "propertyKeyColon", PropertyValue = "propertyValue", EventDefinition = "eventDefinition", SectionDefinition = "sectionDefinition", Properties = "properties" } export declare type Recurrence = Omit, "until" | "dtstart"> & { until?: string; dtstart?: string; }; export declare const RECURRENCE_AMOUNT_REGEX: RegExp; declare interface RecurrenceInText { recurrence: Recurrence; range: Range; } export declare const RELATIVE_TIME_REGEX: RegExp; export declare class RelativeDate { /** * Note that this does not accurately work for week days as * we would otherwise need to know the date that this is * being diffed from. * @param raw */ static diffFromString(raw: string): DurationLikeObject; static fromPlus(raw: string, priorDate: DateTime): DateTime; static fromMinus(raw: string, priorDate: DateTime): DateTime; static from(raw: string, priorDate: DateTime, plusOrMinus?: "plus" | "minus"): DateTime; } export declare function rgbStringToHex(s: string): string; export declare interface Timeline { ranges: Range[]; foldables: { [index: number]: Foldable; }; events: EventGroup; header: any; ids: IdedEvents; parseMessages: ParseMessage[]; documentMessages: DocumentMessage[]; } export declare const toArray: (node: Eventy) => { path: Path; eventy: Eventy; }[]; export declare const toArraySorted: (node: Eventy | undefined, cutoff?: DateTime) => { path: Path; event: Event_2; }[]; export declare const toDateRange: (dr: DateRangeIso) => { fromDateTime: DateTime | DateTime; toDateTime: DateTime | DateTime; }; export declare const toDateRangeIso: (dr: DateRange) => DateRangeIso; export declare function toICal(mw: ParseResult, options?: { name?: string; }): string; declare enum Weight { SECOND = 0, QUARTER_MINUTE = 1, MINUTE = 2, QUARTER_HOUR = 3, HOUR = 4, DAY = 5, MONTH = 6, YEAR = 7, DECADE = 8, CENT = 9 } export { }