tltv-timeline-element 1.0.21 → 1.0.22

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,27 +1,27 @@
1
- import { ILocaleDataProvider } from './ILocaleDataProvider';
2
- export declare class DefaultLocaleDataProvider implements ILocaleDataProvider {
3
- locale: string;
4
- timeZone: string;
5
- twelveHourClock: boolean;
6
- firstDayOfWeek: number;
7
- monthNames: string[];
8
- weekDayNames: string[];
9
- browserTimeZone: string;
10
- _offsetCache: Map<string, number>;
11
- constructor(locale: string, timeZone: string, firstDayOfWeek: number, twelveHourClock: boolean);
12
- getMonthNames(): string[];
13
- getWeekdayNames(): string[];
14
- getFirstDayOfWeek(): number;
15
- formatDate(date: Date, pattern: string): string;
16
- formatTime(date: Date, pattern: string): string;
17
- isTwelveHourClock(): boolean;
18
- getLocale(): string;
19
- getTimeZone(): string;
20
- getDaylightAdjustment(zonedDate: Date): number;
21
- _getDaylightAdjustment(zonedDate: Date, timezone: string): number;
22
- _getDaylightSavingTime(fullYear: number, timezone: string): number;
23
- isDaylightTime(zonedDate: Date): boolean;
24
- getTimezoneOffset(zonedDate: Date): number;
25
- _getTimezoneOffset(zonedDate: Date, timezone: string): number;
26
- _getOffset(fullYear: number, month: string, cache: Map<string, number>, timezone: string): number;
27
- }
1
+ import { ILocaleDataProvider } from './ILocaleDataProvider';
2
+ export declare class DefaultLocaleDataProvider implements ILocaleDataProvider {
3
+ locale: string;
4
+ timeZone: string;
5
+ twelveHourClock: boolean;
6
+ firstDayOfWeek: number;
7
+ monthNames: string[];
8
+ weekDayNames: string[];
9
+ browserTimeZone: string;
10
+ _offsetCache: Map<string, number>;
11
+ constructor(locale: string, timeZone: string, firstDayOfWeek: number, twelveHourClock: boolean);
12
+ getMonthNames(): string[];
13
+ getWeekdayNames(): string[];
14
+ getFirstDayOfWeek(): number;
15
+ formatDate(date: Date, pattern: string): string;
16
+ formatTime(date: Date, pattern: string): string;
17
+ isTwelveHourClock(): boolean;
18
+ getLocale(): string;
19
+ getTimeZone(): string;
20
+ getDaylightAdjustment(zonedDate: Date): number;
21
+ _getDaylightAdjustment(zonedDate: Date, timezone: string): number;
22
+ _getDaylightSavingTime(fullYear: number, timezone: string): number;
23
+ isDaylightTime(zonedDate: Date): boolean;
24
+ getTimezoneOffset(zonedDate: Date): number;
25
+ _getTimezoneOffset(zonedDate: Date, timezone: string): number;
26
+ _getOffset(fullYear: number, month: string, cache: Map<string, number>, timezone: string): number;
27
+ }
@@ -1,112 +1,112 @@
1
- import { formatInTimeZone } from 'date-fns-tz';
2
- export class DefaultLocaleDataProvider {
3
- constructor(locale, timeZone, firstDayOfWeek, twelveHourClock) {
4
- this.locale = "en-US";
5
- this.timeZone = "Europe/London";
6
- this.twelveHourClock = false;
7
- this.firstDayOfWeek = 1; // sunday
8
- this.monthNames = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"];
9
- this.weekDayNames = ["sunday", "monday", "tuesday", "wednesday", "thursday", "friday", "saturday"];
10
- this._offsetCache = new Map();
11
- this.locale = locale;
12
- this.timeZone = timeZone;
13
- this.firstDayOfWeek = firstDayOfWeek;
14
- this.twelveHourClock = twelveHourClock;
15
- this.browserTimeZone = Intl.DateTimeFormat().resolvedOptions().timeZone;
16
- }
17
- getMonthNames() {
18
- return this.monthNames;
19
- }
20
- getWeekdayNames() {
21
- return this.weekDayNames;
22
- }
23
- getFirstDayOfWeek() {
24
- return this.firstDayOfWeek;
25
- }
26
- formatDate(date, pattern) {
27
- return formatInTimeZone(date, this.getTimeZone(), pattern);
28
- }
29
- formatTime(date, pattern) {
30
- let options = {
31
- hour: "numeric",
32
- timeZone: this.getTimeZone(),
33
- hour12: (pattern == 'h')
34
- };
35
- return new Intl.DateTimeFormat(this.getLocale(), options).format(date);
36
- }
37
- isTwelveHourClock() {
38
- return this.twelveHourClock;
39
- }
40
- getLocale() {
41
- return this.locale;
42
- }
43
- getTimeZone() {
44
- return this.timeZone;
45
- }
46
- getDaylightAdjustment(zonedDate) {
47
- return this._getDaylightAdjustment(zonedDate, this.getTimeZone());
48
- }
49
- _getDaylightAdjustment(zonedDate, timezone) {
50
- let fullYear = zonedDate.getFullYear();
51
- let janOffset = this._getOffset(fullYear, "01", this._offsetCache, timezone);
52
- let julOffset = this._getOffset(fullYear, "07", this._offsetCache, timezone);
53
- if (janOffset !== julOffset) {
54
- let maxOffset = Math.max(janOffset, julOffset);
55
- let targetOffset = this._getTimezoneOffset(zonedDate, timezone);
56
- if (targetOffset < maxOffset) {
57
- // This is Daylight saving time
58
- let minOffset = Math.min(janOffset, julOffset);
59
- return maxOffset - minOffset;
60
- }
61
- }
62
- return 0;
63
- }
64
- _getDaylightSavingTime(fullYear, timezone) {
65
- let janOffset = this._getOffset(fullYear, "01", this._offsetCache, timezone);
66
- let julOffset = this._getOffset(fullYear, "07", this._offsetCache, timezone);
67
- if (janOffset !== julOffset) {
68
- let maxOffset = Math.max(janOffset, julOffset);
69
- let minOffset = Math.min(janOffset, julOffset);
70
- return maxOffset - minOffset;
71
- }
72
- return 0;
73
- }
74
- isDaylightTime(zonedDate) {
75
- let fullYear = zonedDate.getFullYear();
76
- let janOffset = this._getOffset(fullYear, "01", this._offsetCache, this.getTimeZone());
77
- let julOffset = this._getOffset(fullYear, "07", this._offsetCache, this.getTimeZone());
78
- if (janOffset !== julOffset) {
79
- let maxOffset = Math.max(janOffset, julOffset);
80
- let targetOffset = this.getTimezoneOffset(zonedDate);
81
- return targetOffset < maxOffset;
82
- }
83
- return false;
84
- }
85
- getTimezoneOffset(zonedDate) {
86
- return this._getTimezoneOffset(zonedDate, this.getTimeZone());
87
- }
88
- _getTimezoneOffset(zonedDate, timezone) {
89
- let offset = formatInTimeZone(zonedDate, timezone, "xxx"); // like "+01:00"
90
- if (offset && offset.length === 6) {
91
- let hour = offset[1] + offset[2];
92
- if (hour === '24') {
93
- hour = '00';
94
- }
95
- let tzOffset = (parseInt(hour) * 60) + parseInt(offset[4] + offset[5]);
96
- if (offset[0] === '-') {
97
- tzOffset = -1 * tzOffset;
98
- }
99
- return tzOffset * 60000;
100
- }
101
- return 0;
102
- }
103
- _getOffset(fullYear, month, cache, timezone) {
104
- const key = `${fullYear}-${month}-${timezone}`;
105
- if (!cache.has(key)) {
106
- let targetDate = new Date(`${fullYear}-${month}-01T00:00:00Z`);
107
- cache.set(key, this._getTimezoneOffset(targetDate, timezone));
108
- }
109
- return cache.get(key);
110
- }
111
- }
1
+ import { formatInTimeZone } from 'date-fns-tz';
2
+ export class DefaultLocaleDataProvider {
3
+ constructor(locale, timeZone, firstDayOfWeek, twelveHourClock) {
4
+ this.locale = "en-US";
5
+ this.timeZone = "Europe/London";
6
+ this.twelveHourClock = false;
7
+ this.firstDayOfWeek = 1; // sunday
8
+ this.monthNames = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"];
9
+ this.weekDayNames = ["sunday", "monday", "tuesday", "wednesday", "thursday", "friday", "saturday"];
10
+ this._offsetCache = new Map();
11
+ this.locale = locale;
12
+ this.timeZone = timeZone;
13
+ this.firstDayOfWeek = firstDayOfWeek;
14
+ this.twelveHourClock = twelveHourClock;
15
+ this.browserTimeZone = Intl.DateTimeFormat().resolvedOptions().timeZone;
16
+ }
17
+ getMonthNames() {
18
+ return this.monthNames;
19
+ }
20
+ getWeekdayNames() {
21
+ return this.weekDayNames;
22
+ }
23
+ getFirstDayOfWeek() {
24
+ return this.firstDayOfWeek;
25
+ }
26
+ formatDate(date, pattern) {
27
+ return formatInTimeZone(date, this.getTimeZone(), pattern);
28
+ }
29
+ formatTime(date, pattern) {
30
+ let options = {
31
+ hour: "numeric",
32
+ timeZone: this.getTimeZone(),
33
+ hour12: (pattern == 'h')
34
+ };
35
+ return new Intl.DateTimeFormat(this.getLocale(), options).format(date);
36
+ }
37
+ isTwelveHourClock() {
38
+ return this.twelveHourClock;
39
+ }
40
+ getLocale() {
41
+ return this.locale;
42
+ }
43
+ getTimeZone() {
44
+ return this.timeZone;
45
+ }
46
+ getDaylightAdjustment(zonedDate) {
47
+ return this._getDaylightAdjustment(zonedDate, this.getTimeZone());
48
+ }
49
+ _getDaylightAdjustment(zonedDate, timezone) {
50
+ let fullYear = zonedDate.getFullYear();
51
+ let janOffset = this._getOffset(fullYear, "01", this._offsetCache, timezone);
52
+ let julOffset = this._getOffset(fullYear, "07", this._offsetCache, timezone);
53
+ if (janOffset !== julOffset) {
54
+ let maxOffset = Math.max(janOffset, julOffset);
55
+ let targetOffset = this._getTimezoneOffset(zonedDate, timezone);
56
+ if (targetOffset < maxOffset) {
57
+ // This is Daylight saving time
58
+ let minOffset = Math.min(janOffset, julOffset);
59
+ return maxOffset - minOffset;
60
+ }
61
+ }
62
+ return 0;
63
+ }
64
+ _getDaylightSavingTime(fullYear, timezone) {
65
+ let janOffset = this._getOffset(fullYear, "01", this._offsetCache, timezone);
66
+ let julOffset = this._getOffset(fullYear, "07", this._offsetCache, timezone);
67
+ if (janOffset !== julOffset) {
68
+ let maxOffset = Math.max(janOffset, julOffset);
69
+ let minOffset = Math.min(janOffset, julOffset);
70
+ return maxOffset - minOffset;
71
+ }
72
+ return 0;
73
+ }
74
+ isDaylightTime(zonedDate) {
75
+ let fullYear = zonedDate.getFullYear();
76
+ let janOffset = this._getOffset(fullYear, "01", this._offsetCache, this.getTimeZone());
77
+ let julOffset = this._getOffset(fullYear, "07", this._offsetCache, this.getTimeZone());
78
+ if (janOffset !== julOffset) {
79
+ let maxOffset = Math.max(janOffset, julOffset);
80
+ let targetOffset = this.getTimezoneOffset(zonedDate);
81
+ return targetOffset < maxOffset;
82
+ }
83
+ return false;
84
+ }
85
+ getTimezoneOffset(zonedDate) {
86
+ return this._getTimezoneOffset(zonedDate, this.getTimeZone());
87
+ }
88
+ _getTimezoneOffset(zonedDate, timezone) {
89
+ let offset = formatInTimeZone(zonedDate, timezone, "xxx"); // like "+01:00"
90
+ if (offset && offset.length === 6) {
91
+ let hour = offset[1] + offset[2];
92
+ if (hour === '24') {
93
+ hour = '00';
94
+ }
95
+ let tzOffset = (parseInt(hour) * 60) + parseInt(offset[4] + offset[5]);
96
+ if (offset[0] === '-') {
97
+ tzOffset = -1 * tzOffset;
98
+ }
99
+ return tzOffset * 60000;
100
+ }
101
+ return 0;
102
+ }
103
+ _getOffset(fullYear, month, cache, timezone) {
104
+ const key = `${fullYear}-${month}-${timezone}`;
105
+ if (!cache.has(key)) {
106
+ let targetDate = new Date(`${fullYear}-${month}-01T00:00:00Z`);
107
+ cache.set(key, this._getTimezoneOffset(targetDate, timezone));
108
+ }
109
+ return cache.get(key);
110
+ }
111
+ }
112
112
  //# sourceMappingURL=DefaultLocaleDataProvider.js.map
@@ -1,62 +1,62 @@
1
- export interface ILocaleDataProvider {
2
- /**
3
- * Returns month names in order starting from January.
4
- *
5
- * @return Locale dependent month names
6
- */
7
- getMonthNames(): string[];
8
- /**
9
- * Returns weekdays in order starting from Sunday.
10
- *
11
- * @return Locale dependent weekday names
12
- */
13
- getWeekdayNames(): string[];
14
- /**
15
- * Returns first day of week. Allowed values are 1-7. 1 is Sunday.
16
- *
17
- * @return Integer between 1-7.
18
- */
19
- getFirstDayOfWeek(): number;
20
- /**
21
- * Format zoned date to String.
22
- *
23
- * @param date
24
- * Date to format (Expected to be in same TimeZone as
25
- * {@link #getTimeZone()}).
26
- * @param format
27
- * Pattern of the date format. Like MMM or MMMM.
28
- * @return Formatted date
29
- */
30
- formatDate(date: Date, format: string): string;
31
- /**
32
- * Format date to time String.
33
- *
34
- * @param date
35
- * Time to format (Expected to be in same TimeZone as
36
- * {@link #getTimeZone()}).
37
- * @param format
38
- * Pattern of the time format. Like h or HH.
39
- * @return Formatted time
40
- */
41
- formatTime(date: Date, format: string): string;
42
- /**
43
- * Returns true, if active locale uses twelve hour clock.
44
- *
45
- * @return true if 12h clock. False if 24h clock.
46
- */
47
- isTwelveHourClock(): boolean;
48
- /**
49
- * Get currently active locale id. See {@link Locale#toString()}.
50
- *
51
- * @return Locale
52
- */
53
- getLocale(): string;
54
- /**
55
- * Get currently active time-zone.
56
- */
57
- getTimeZone(): string;
58
- /** Get daylight saving time adjustment in milliseconds for the target date. */
59
- getDaylightAdjustment(zonedDate: Date): number;
60
- isDaylightTime(zonedDate: Date): boolean;
61
- getTimezoneOffset(zonedDate: Date): number;
62
- }
1
+ export interface ILocaleDataProvider {
2
+ /**
3
+ * Returns month names in order starting from January.
4
+ *
5
+ * @return Locale dependent month names
6
+ */
7
+ getMonthNames(): string[];
8
+ /**
9
+ * Returns weekdays in order starting from Sunday.
10
+ *
11
+ * @return Locale dependent weekday names
12
+ */
13
+ getWeekdayNames(): string[];
14
+ /**
15
+ * Returns first day of week. Allowed values are 1-7. 1 is Sunday.
16
+ *
17
+ * @return Integer between 1-7.
18
+ */
19
+ getFirstDayOfWeek(): number;
20
+ /**
21
+ * Format zoned date to String.
22
+ *
23
+ * @param date
24
+ * Date to format (Expected to be in same TimeZone as
25
+ * {@link #getTimeZone()}).
26
+ * @param format
27
+ * Pattern of the date format. Like MMM or MMMM.
28
+ * @return Formatted date
29
+ */
30
+ formatDate(date: Date, format: string): string;
31
+ /**
32
+ * Format date to time String.
33
+ *
34
+ * @param date
35
+ * Time to format (Expected to be in same TimeZone as
36
+ * {@link #getTimeZone()}).
37
+ * @param format
38
+ * Pattern of the time format. Like h or HH.
39
+ * @return Formatted time
40
+ */
41
+ formatTime(date: Date, format: string): string;
42
+ /**
43
+ * Returns true, if active locale uses twelve hour clock.
44
+ *
45
+ * @return true if 12h clock. False if 24h clock.
46
+ */
47
+ isTwelveHourClock(): boolean;
48
+ /**
49
+ * Get currently active locale id. See {@link Locale#toString()}.
50
+ *
51
+ * @return Locale
52
+ */
53
+ getLocale(): string;
54
+ /**
55
+ * Get currently active time-zone.
56
+ */
57
+ getTimeZone(): string;
58
+ /** Get daylight saving time adjustment in milliseconds for the target date. */
59
+ getDaylightAdjustment(zonedDate: Date): number;
60
+ isDaylightTime(zonedDate: Date): boolean;
61
+ getTimezoneOffset(zonedDate: Date): number;
62
+ }
@@ -1,2 +1,2 @@
1
- export {};
1
+ export {};
2
2
  //# sourceMappingURL=ILocaleDataProvider.js.map
@@ -1,4 +1,4 @@
1
- export interface IResolutionBlockFiller {
2
- fillResolutionBlock(index: number, date: Date, currentYear: String, lastTimelineBlock: boolean): void;
3
- setup(): void;
4
- }
1
+ export interface IResolutionBlockFiller {
2
+ fillResolutionBlock(index: number, date: Date, currentYear: String, lastTimelineBlock: boolean): void;
3
+ setup(): void;
4
+ }
@@ -1,2 +1,2 @@
1
- export {};
1
+ export {};
2
2
  //# sourceMappingURL=IResolutionBlockFiller.js.map
@@ -1,3 +1,3 @@
1
- export interface IResolutionBlockRegisterer {
2
- registerResolutionBlock(index: number, date: Date, currentYear: String, lastTimelineBlock: boolean): void;
3
- }
1
+ export interface IResolutionBlockRegisterer {
2
+ registerResolutionBlock(index: number, date: Date, currentYear: String, lastTimelineBlock: boolean): void;
3
+ }
@@ -1,2 +1,2 @@
1
- export {};
1
+ export {};
2
2
  //# sourceMappingURL=IResolutionBlockRegisterer.js.map
@@ -1,5 +1,5 @@
1
- export declare enum Resolution {
2
- Hour = 1,
3
- Day = 2,
4
- Week = 3
5
- }
1
+ export declare enum Resolution {
2
+ Hour = 1,
3
+ Day = 2,
4
+ Week = 3
5
+ }
@@ -1,7 +1,7 @@
1
- export var Resolution;
2
- (function (Resolution) {
3
- Resolution[Resolution["Hour"] = 1] = "Hour";
4
- Resolution[Resolution["Day"] = 2] = "Day";
5
- Resolution[Resolution["Week"] = 3] = "Week";
6
- })(Resolution || (Resolution = {}));
1
+ export var Resolution;
2
+ (function (Resolution) {
3
+ Resolution[Resolution["Hour"] = 1] = "Hour";
4
+ Resolution[Resolution["Day"] = 2] = "Day";
5
+ Resolution[Resolution["Week"] = 3] = "Week";
6
+ })(Resolution || (Resolution = {}));
7
7
  //# sourceMappingURL=Resolution.js.map
@@ -1,5 +1,5 @@
1
- export declare enum Weekday {
2
- First = 0,
3
- Between = 1,
4
- Last = 2
5
- }
1
+ export declare enum Weekday {
2
+ First = 0,
3
+ Between = 1,
4
+ Last = 2
5
+ }
@@ -1,7 +1,7 @@
1
- export var Weekday;
2
- (function (Weekday) {
3
- Weekday[Weekday["First"] = 0] = "First";
4
- Weekday[Weekday["Between"] = 1] = "Between";
5
- Weekday[Weekday["Last"] = 2] = "Last";
6
- })(Weekday || (Weekday = {}));
1
+ export var Weekday;
2
+ (function (Weekday) {
3
+ Weekday[Weekday["First"] = 0] = "First";
4
+ Weekday[Weekday["Between"] = 1] = "Between";
5
+ Weekday[Weekday["Last"] = 2] = "Last";
6
+ })(Weekday || (Weekday = {}));
7
7
  //# sourceMappingURL=Weekday.js.map
@@ -1,11 +1,11 @@
1
- export declare class BlockRowData {
2
- blocks: Map<string, any>;
3
- blockLength: Map<string, number>;
4
- size(): number;
5
- getBlock(key: string): any;
6
- getBlockEntries(): IterableIterator<[string, any]>;
7
- setBlock(key: string, element: any): void;
8
- getBlockLength(key: string): number;
9
- setBlockLength(key: string, length: number): void;
10
- clear(): void;
11
- }
1
+ export declare class BlockRowData {
2
+ blocks: Map<string, any>;
3
+ blockLength: Map<string, number>;
4
+ size(): number;
5
+ getBlock(key: string): any;
6
+ getBlockEntries(): IterableIterator<[string, any]>;
7
+ setBlock(key: string, element: any): void;
8
+ getBlockLength(key: string): number;
9
+ setBlockLength(key: string, length: number): void;
10
+ clear(): void;
11
+ }
@@ -1,29 +1,29 @@
1
- export class BlockRowData {
2
- constructor() {
3
- this.blocks = new Map();
4
- this.blockLength = new Map();
5
- }
6
- size() {
7
- return this.blocks.size;
8
- }
9
- getBlock(key) {
10
- return this.blocks.get(key);
11
- }
12
- getBlockEntries() {
13
- return this.blocks.entries();
14
- }
15
- setBlock(key, element) {
16
- this.blocks.set(key, element);
17
- }
18
- getBlockLength(key) {
19
- return this.blockLength.get(key);
20
- }
21
- setBlockLength(key, length) {
22
- this.blockLength.set(key, length);
23
- }
24
- clear() {
25
- this.blocks.clear();
26
- this.blockLength.clear();
27
- }
28
- }
1
+ export class BlockRowData {
2
+ constructor() {
3
+ this.blocks = new Map();
4
+ this.blockLength = new Map();
5
+ }
6
+ size() {
7
+ return this.blocks.size;
8
+ }
9
+ getBlock(key) {
10
+ return this.blocks.get(key);
11
+ }
12
+ getBlockEntries() {
13
+ return this.blocks.entries();
14
+ }
15
+ setBlock(key, element) {
16
+ this.blocks.set(key, element);
17
+ }
18
+ getBlockLength(key) {
19
+ return this.blockLength.get(key);
20
+ }
21
+ setBlockLength(key, length) {
22
+ this.blockLength.set(key, length);
23
+ }
24
+ clear() {
25
+ this.blocks.clear();
26
+ this.blockLength.clear();
27
+ }
28
+ }
29
29
  //# sourceMappingURL=blockRowData.js.map