@evercam/ui 0.0.37 → 0.0.38-alpha.0

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.
@@ -0,0 +1,5 @@
1
+ import { TimelineAxesConfig } from '../types';
2
+ /**
3
+ * Map of formats and ticks intervals for the Timeline axis(s) by type.
4
+ */
5
+ export declare const defaultAxesConfig: TimelineAxesConfig;
@@ -0,0 +1,117 @@
1
+ import * as d3 from "d3";
2
+ import Vue from "vue";
3
+ import { D3ZoomEvent } from "d3";
4
+ import { TimelineAxesConfig, TimelineAxis, TimelineTicksConfig, Timestamp } from '../types';
5
+ export type TimelineEvent = {
6
+ timestamp: string | Date;
7
+ [key: string]: any;
8
+ } | {
9
+ startDate: string | Date;
10
+ endDate: string | Date;
11
+ [key: string]: any;
12
+ };
13
+ export type TimelineEventsGroup = {
14
+ label: string;
15
+ color: string;
16
+ events: Array<TimelineEvent>;
17
+ };
18
+ export type TimelineEventsByType = {
19
+ [eventsType: string]: TimelineEventsGroup;
20
+ };
21
+ declare const _default: import("vue/types/vue").ExtendedVue<Vue<Record<string, any>, Record<string, any>, never, never, (event: string, ...args: any[]) => Vue<Record<string, any>, Record<string, any>, never, never, any>>, {
22
+ tooltip: HTMLElement;
23
+ cursor: HTMLElement;
24
+ timeline: HTMLElement;
25
+ selectedTimestampCursor: HTMLElement;
26
+ svg: d3.Selection<SVGSVGElement, any, any, any>;
27
+ axesContainer: d3.Selection<SVGGElement, any, any, any>;
28
+ xAxes: Record<TimelineAxis, d3.Axis<Date>>;
29
+ timeScale: d3.ScaleTime<any, any, unknown>;
30
+ initialTimeScale: d3.ScaleTime<any, any, unknown>;
31
+ currentTimeScaleDensity: number;
32
+ zoomBehavior: d3.ZoomBehavior<SVGSVGElement, unknown>;
33
+ isMouseDown: boolean;
34
+ axisHeight: number;
35
+ eventGroupHeight: number;
36
+ eventGroupPadding: number;
37
+ isHoveringEvent: boolean;
38
+ hoveredEvent: TimelineEvent;
39
+ isHoveringTimeline: boolean;
40
+ hoveredTimestamp: Date;
41
+ eventTooltipStyle: {};
42
+ hoveredEventType: string;
43
+ utcOffset: number;
44
+ }, {
45
+ utcToZonedTime(timestamp: Timestamp): Date;
46
+ getFormattedTimestamp(timestamp: Timestamp): string;
47
+ handleResize({ contentRect }: ResizeObserverEntry): void;
48
+ initTimeline(): void;
49
+ initRefs(): void;
50
+ initSvg(): void;
51
+ initUtcOffset(): void;
52
+ initTimeScale(): void;
53
+ initXAxes(): void;
54
+ createAxis(axisName: TimelineAxis): d3.Axis<Date>;
55
+ getAxisTicksConfig(configs: TimelineTicksConfig[]): {
56
+ formatFn: (d: Date) => string;
57
+ interval: any;
58
+ };
59
+ initZoomBehavior(): void;
60
+ initSelectedTimestampCursor(): void;
61
+ repositionSelectedTimestampCursor(): void;
62
+ updateCurrentTimeScaleDensity(): void;
63
+ registerEventsListeners(): void;
64
+ handleMouseDown(): void;
65
+ handleDocumentMouseUp(): void;
66
+ handleMouseLeave(): void;
67
+ handleMouseMove(event: MouseEvent): void;
68
+ handleClick(event: MouseEvent): void;
69
+ handleEventMouseOver(_event: MouseEvent, eventData: TimelineEvent, eventType: string): void;
70
+ handleEventMouseOut(): void;
71
+ handleZoom(event: D3ZoomEvent<SVGSVGElement, any>): void;
72
+ zoomToStartAndEndDates(): void;
73
+ rescaleAxis(axisName: string, newScale: d3.ScaleTime<any, any, unknown>): void;
74
+ translateTicksText(axisName: string): void;
75
+ updateEventsRects(): void;
76
+ getEventRectX(d: TimelineEvent): any;
77
+ getEventRectWidth(d: TimelineEvent): number;
78
+ drawEventsGroups(): void;
79
+ drawBackground({ color, yPosition, gElement, }: {
80
+ gElement: d3.Selection<SVGGElement, any, any, any>;
81
+ yPosition: number;
82
+ color: string;
83
+ }): void;
84
+ drawEvents({ events, gElement, yPosition, color, type, }: {
85
+ events: TimelineEvent[];
86
+ gElement: d3.Selection<SVGGElement, any, any, any>;
87
+ yPosition: number;
88
+ color: string;
89
+ type: string;
90
+ }): void;
91
+ drawTextLabel({ gElement, yPosition, color, label, }: {
92
+ gElement: d3.Selection<SVGGElement, any, any, any>;
93
+ yPosition: number;
94
+ color: string;
95
+ label: string;
96
+ }): void;
97
+ getTextFillColor(baseColor: string): string;
98
+ getLabelBackgroundColor(baseColor: string): string;
99
+ onDarkModeChange(): void;
100
+ }, {
101
+ labelRectWidth: number;
102
+ combinedXAxesHeight: number;
103
+ timelineHeight: number;
104
+ allEventsSorted: TimelineEvent[];
105
+ oldestEvent: TimelineEvent;
106
+ latestEvent: TimelineEvent;
107
+ }, {
108
+ eventsGroups: {};
109
+ xAxesConfig: TimelineAxesConfig;
110
+ dark: boolean;
111
+ startDate: string;
112
+ endDate: string;
113
+ selectedTimestamp: string;
114
+ showEventTooltip: boolean;
115
+ disableZoom: boolean;
116
+ }, {}, import("vue/types/v3-component-options").ComponentOptionsMixin, import("vue/types/v3-component-options").ComponentOptionsMixin>;
117
+ export default _default;
@@ -1,6 +1,6 @@
1
1
  import ResizeObserverDirective from '../directives/resize-observer';
2
2
  export declare const DirectivesMap: {
3
3
  name: string;
4
- definition: import("vue").ObjectDirective<any, any>;
4
+ definition: import("vue").DirectiveOptions;
5
5
  }[];
6
6
  export { ResizeObserverDirective };
@@ -1,6 +1,6 @@
1
- import { ObjectDirective } from "vue";
1
+ import { DirectiveOptions } from "vue";
2
2
  export interface ObservedElement extends HTMLElement {
3
3
  __resizeObserver__?: ResizeObserver;
4
4
  }
5
- declare const ResizeObserverDirective: ObjectDirective;
5
+ declare const ResizeObserverDirective: DirectiveOptions;
6
6
  export default ResizeObserverDirective;
@@ -5,6 +5,7 @@ import ESpinner from './components/ESpinner.vue';
5
5
  import ERow from './components/ERow.vue';
6
6
  import ECol from './components/ECol.vue';
7
7
  import EVideoPlayer from './components/EVideoPlayer.vue';
8
+ import ETimeline from './components/ETimeline.vue';
8
9
  import { VueConstructor } from "vue";
9
10
  export declare const components: {
10
11
  EAvatar: import("vue/types/vue").ExtendedVue<import("vue").default<Record<string, any>, Record<string, any>, never, never, (event: string, ...args: any[]) => import("vue").default<Record<string, any>, Record<string, any>, never, never, any>>, {
@@ -169,12 +170,108 @@ export declare const components: {
169
170
  videoListeners: {};
170
171
  videoOptions: {};
171
172
  }, {}, import("vue/types/v3-component-options").ComponentOptionsMixin, import("vue/types/v3-component-options").ComponentOptionsMixin>;
173
+ ETimeline: import("vue/types/vue").ExtendedVue<import("vue").default<Record<string, any>, Record<string, any>, never, never, (event: string, ...args: any[]) => import("vue").default<Record<string, any>, Record<string, any>, never, never, any>>, {
174
+ tooltip: HTMLElement;
175
+ cursor: HTMLElement;
176
+ timeline: HTMLElement;
177
+ selectedTimestampCursor: HTMLElement;
178
+ svg: import("d3-selection").Selection<SVGSVGElement, any, any, any>;
179
+ axesContainer: import("d3-selection").Selection<SVGGElement, any, any, any>;
180
+ xAxes: Record<import('./types').TimelineAxis, import("d3-axis").Axis<Date>>;
181
+ timeScale: import("d3-scale").ScaleTime<any, any, unknown>;
182
+ initialTimeScale: import("d3-scale").ScaleTime<any, any, unknown>;
183
+ currentTimeScaleDensity: number;
184
+ zoomBehavior: import("d3-zoom").ZoomBehavior<SVGSVGElement, unknown>;
185
+ isMouseDown: boolean;
186
+ axisHeight: number;
187
+ eventGroupHeight: number;
188
+ eventGroupPadding: number;
189
+ isHoveringEvent: boolean;
190
+ hoveredEvent: import('./components/ETimeline.vue').TimelineEvent;
191
+ isHoveringTimeline: boolean;
192
+ hoveredTimestamp: Date;
193
+ eventTooltipStyle: {};
194
+ hoveredEventType: string;
195
+ utcOffset: number;
196
+ }, {
197
+ utcToZonedTime(timestamp: import('./types').Timestamp): Date;
198
+ getFormattedTimestamp(timestamp: import('./types').Timestamp): string;
199
+ handleResize({ contentRect }: ResizeObserverEntry): void;
200
+ initTimeline(): void;
201
+ initRefs(): void;
202
+ initSvg(): void;
203
+ initUtcOffset(): void;
204
+ initTimeScale(): void;
205
+ initXAxes(): void;
206
+ createAxis(axisName: import('./types').TimelineAxis): import("d3-axis").Axis<Date>;
207
+ getAxisTicksConfig(configs: import('./types').TimelineTicksConfig[]): {
208
+ formatFn: (d: Date) => string;
209
+ interval: any;
210
+ };
211
+ initZoomBehavior(): void;
212
+ initSelectedTimestampCursor(): void;
213
+ repositionSelectedTimestampCursor(): void;
214
+ updateCurrentTimeScaleDensity(): void;
215
+ registerEventsListeners(): void;
216
+ handleMouseDown(): void;
217
+ handleDocumentMouseUp(): void;
218
+ handleMouseLeave(): void;
219
+ handleMouseMove(event: MouseEvent): void;
220
+ handleClick(event: MouseEvent): void;
221
+ handleEventMouseOver(_event: MouseEvent, eventData: import('./components/ETimeline.vue').TimelineEvent, eventType: string): void;
222
+ handleEventMouseOut(): void;
223
+ handleZoom(event: import("d3-zoom").D3ZoomEvent<SVGSVGElement, any>): void;
224
+ zoomToStartAndEndDates(): void;
225
+ rescaleAxis(axisName: string, newScale: import("d3-scale").ScaleTime<any, any, unknown>): void;
226
+ translateTicksText(axisName: string): void;
227
+ updateEventsRects(): void;
228
+ getEventRectX(d: import('./components/ETimeline.vue').TimelineEvent): any;
229
+ getEventRectWidth(d: import('./components/ETimeline.vue').TimelineEvent): number;
230
+ drawEventsGroups(): void;
231
+ drawBackground({ color, yPosition, gElement, }: {
232
+ gElement: import("d3-selection").Selection<SVGGElement, any, any, any>;
233
+ yPosition: number;
234
+ color: string;
235
+ }): void;
236
+ drawEvents({ events, gElement, yPosition, color, type, }: {
237
+ events: import('./components/ETimeline.vue').TimelineEvent[];
238
+ gElement: import("d3-selection").Selection<SVGGElement, any, any, any>;
239
+ yPosition: number;
240
+ color: string;
241
+ type: string;
242
+ }): void;
243
+ drawTextLabel({ gElement, yPosition, color, label, }: {
244
+ gElement: import("d3-selection").Selection<SVGGElement, any, any, any>;
245
+ yPosition: number;
246
+ color: string;
247
+ label: string;
248
+ }): void;
249
+ getTextFillColor(baseColor: string): string;
250
+ getLabelBackgroundColor(baseColor: string): string;
251
+ onDarkModeChange(): void;
252
+ }, {
253
+ labelRectWidth: number;
254
+ combinedXAxesHeight: number;
255
+ timelineHeight: number;
256
+ allEventsSorted: import('./components/ETimeline.vue').TimelineEvent[];
257
+ oldestEvent: import('./components/ETimeline.vue').TimelineEvent;
258
+ latestEvent: import('./components/ETimeline.vue').TimelineEvent;
259
+ }, {
260
+ eventsGroups: {};
261
+ xAxesConfig: import('./types').TimelineAxesConfig;
262
+ dark: boolean;
263
+ startDate: string;
264
+ endDate: string;
265
+ selectedTimestamp: string;
266
+ showEventTooltip: boolean;
267
+ disableZoom: boolean;
268
+ }, {}, import("vue/types/v3-component-options").ComponentOptionsMixin, import("vue/types/v3-component-options").ComponentOptionsMixin>;
172
269
  };
173
270
  declare const _default: {
174
271
  install(Vue: VueConstructor): void;
175
272
  };
176
273
  export default _default;
177
- export { EAvatar, EBadge, EIcon, ESpinner, ERow, ECol, EVideoPlayer };
274
+ export { EAvatar, EBadge, EIcon, ESpinner, ERow, ECol, EVideoPlayer, ETimeline };
178
275
  export * from './constants';
179
276
  export * from './types';
180
277
  export * from './utils';
@@ -34,5 +34,19 @@ export type FlexJustifyContent = "around" | "between" | "center" | "end" | "even
34
34
  export type FlexAlignItems = "start" | "center" | "end" | "baseline" | "stretch";
35
35
  export type FlexAlignContent = "around" | "baseline" | "between" | "center" | "end" | "evenly" | "normal" | "start" | "stretch";
36
36
  export type FlexAlignSelf = "auto" | "baseline" | "center" | "end" | "start" | "stretch";
37
+ export declare enum TimelineAxis {
38
+ overview = "overview",
39
+ detailed = "detailed",
40
+ detailedBackground = "detailedBackground"
41
+ }
42
+ export type TimelineTicksConfig = {
43
+ precision: number;
44
+ interval: any;
45
+ format: string | ((d: Date) => string);
46
+ };
47
+ export type TimelineAxesConfig = {
48
+ [key in TimelineAxis]: TimelineTicksConfig[];
49
+ };
50
+ export type Timestamp = Date | string | number;
37
51
  declare const _default: {};
38
52
  export default _default;
package/dist/style.css CHANGED
@@ -1 +1 @@
1
- .e-spinner[data-v-f6962f4a]{vertical-align:center}.e-spinner__primary[data-v-f6962f4a],.e-spinner__secondary[data-v-f6962f4a]{stroke-width:0;animation:fade-f6962f4a;animation-iteration-count:infinite}@keyframes fade-f6962f4a{0%{fill-opacity:0}50%{fill-opacity:1}to{fill-opacity:0}}.e-row.e-row--no-gutters{margin:0}.e-row.e-row--no-gutters>.e-col{padding:0}.e-col{padding:.75rem}.spinner-container[data-v-40b3a4ac]{position:absolute;background:linear-gradient(to top,rgba(0,0,0,.65),transparent);inset:0;display:flex;justify-content:center;align-items:center;vertical-align:middle}.video-container[data-v-40b3a4ac]{position:relative;width:100%;height:100%;display:flex;flex-direction:column;justify-content:center;margin:0 auto}.video-container.full-screen[data-v-40b3a4ac]{max-width:initial;width:100%;max-height:100vh}video[data-v-40b3a4ac]{width:100%;height:inherit}.video-controls-container[data-v-40b3a4ac]{position:absolute;bottom:0;left:0;right:0;color:#fff;z-index:100;opacity:0;transition:opacity .15s ease-in-out}.hide[data-v-40b3a4ac]{display:none}.video-controls-container[data-v-40b3a4ac]:before{content:"";position:absolute;bottom:0;background:linear-gradient(to top,rgba(0,0,0,.75),transparent);width:100%;aspect-ratio:6 / 1;z-index:-1;pointer-events:none}.video-container:hover .video-controls-container[data-v-40b3a4ac],.video-container:focus-within .video-controls-container[data-v-40b3a4ac],.video-container.paused .video-controls-container[data-v-40b3a4ac]{opacity:1}.video-controls-container .controls[data-v-40b3a4ac]{display:flex;gap:.5rem;padding:.75rem 1rem;align-items:center;width:100%}.video-controls-container .controls button[data-v-40b3a4ac]{background:none;border:none;color:inherit;padding:0;height:32px;width:32px;font-size:1.35rem;cursor:pointer;opacity:.85;transition:opacity .15s ease-in-out}.video-controls-container .controls button[data-v-40b3a4ac]:hover{opacity:1}.duration-container[data-v-40b3a4ac]{display:flex;align-items:center;gap:.25rem;flex-grow:1}.video-container.captions .captions-btn[data-v-40b3a4ac]{border-bottom:3px solid red}.video-controls-container .controls button.wide-btn[data-v-40b3a4ac]{width:50px}.timeline-container[data-v-40b3a4ac]{width:100%;height:7px;margin-inline:.5rem;cursor:pointer;display:flex;align-items:center}.timeline[data-v-40b3a4ac]{background-color:#64646480;height:3px;width:100%;position:relative}.timeline[data-v-40b3a4ac]:before{content:"";position:absolute;left:0;top:0;bottom:0;right:calc(100% - var(--preview-position) * 100%);background-color:#969696;display:none}.timeline[data-v-40b3a4ac]:after{content:"";position:absolute;left:0;top:0;bottom:0;right:calc(100% - var(--progress-position) * 100%);background-color:red}.timeline .thumb-indicator[data-v-40b3a4ac]{--scale: 0;position:absolute;transform:translate(-50%) scale(var(--scale));height:200%;top:-50%;left:calc(var(--progress-position) * 100%);background-color:red;border-radius:50%;transition:transform .15s ease-in-out;aspect-ratio:1 / 1}.video-container.scrubbing .thumbnail-img[data-v-40b3a4ac]{display:block}.video-container.scrubbing .timeline[data-v-40b3a4ac]:before,.timeline-container:hover .timeline[data-v-40b3a4ac]:before{display:block}.video-container.scrubbing .thumb-indicator[data-v-40b3a4ac],.timeline-container:hover .thumb-indicator[data-v-40b3a4ac]{--scale: 1}.video-container.scrubbing .timeline[data-v-40b3a4ac],.timeline-container:hover .timeline[data-v-40b3a4ac]{height:100%}
1
+ .e-spinner[data-v-29711f67]{vertical-align:center}.e-spinner__primary[data-v-29711f67],.e-spinner__secondary[data-v-29711f67]{stroke-width:0;animation:fade-29711f67;animation-iteration-count:infinite}@keyframes fade-29711f67{0%{fill-opacity:0}50%{fill-opacity:1}to{fill-opacity:0}}.e-row.e-row--no-gutters{margin:0}.e-row.e-row--no-gutters>.e-col{padding:0}.e-col{padding:.75rem}.spinner-container[data-v-99c9162d]{position:absolute;background:linear-gradient(to top,rgba(0,0,0,.65),transparent);inset:0;display:flex;justify-content:center;align-items:center;vertical-align:middle}.video-container[data-v-99c9162d]{position:relative;width:100%;height:100%;display:flex;flex-direction:column;justify-content:center;margin:0 auto}.video-container.full-screen[data-v-99c9162d]{max-width:initial;width:100%;max-height:100vh}video[data-v-99c9162d]{width:100%;height:inherit}.video-controls-container[data-v-99c9162d]{position:absolute;bottom:0;left:0;right:0;color:#fff;z-index:100;opacity:0;transition:opacity .15s ease-in-out}.hide[data-v-99c9162d]{display:none}.video-controls-container[data-v-99c9162d]:before{content:"";position:absolute;bottom:0;background:linear-gradient(to top,rgba(0,0,0,.75),transparent);width:100%;aspect-ratio:6 / 1;z-index:-1;pointer-events:none}.video-container:hover .video-controls-container[data-v-99c9162d],.video-container:focus-within .video-controls-container[data-v-99c9162d],.video-container.paused .video-controls-container[data-v-99c9162d]{opacity:1}.video-controls-container .controls[data-v-99c9162d]{display:flex;gap:.5rem;padding:.75rem 1rem;align-items:center;width:100%}.video-controls-container .controls button[data-v-99c9162d]{background:none;border:none;color:inherit;padding:0;height:32px;width:32px;font-size:1.35rem;cursor:pointer;opacity:.85;transition:opacity .15s ease-in-out}.video-controls-container .controls button[data-v-99c9162d]:hover{opacity:1}.duration-container[data-v-99c9162d]{display:flex;align-items:center;gap:.25rem;flex-grow:1}.video-container.captions .captions-btn[data-v-99c9162d]{border-bottom:3px solid red}.video-controls-container .controls button.wide-btn[data-v-99c9162d]{width:50px}.timeline-container[data-v-99c9162d]{width:100%;height:7px;margin-inline:.5rem;cursor:pointer;display:flex;align-items:center}.timeline[data-v-99c9162d]{background-color:#64646480;height:3px;width:100%;position:relative}.timeline[data-v-99c9162d]:before{content:"";position:absolute;left:0;top:0;bottom:0;right:calc(100% - var(--preview-position) * 100%);background-color:#969696;display:none}.timeline[data-v-99c9162d]:after{content:"";position:absolute;left:0;top:0;bottom:0;right:calc(100% - var(--progress-position) * 100%);background-color:red}.timeline .thumb-indicator[data-v-99c9162d]{--scale: 0;position:absolute;transform:translate(-50%) scale(var(--scale));height:200%;top:-50%;left:calc(var(--progress-position) * 100%);background-color:red;border-radius:50%;transition:transform .15s ease-in-out;aspect-ratio:1 / 1}.video-container.scrubbing .thumbnail-img[data-v-99c9162d]{display:block}.video-container.scrubbing .timeline[data-v-99c9162d]:before,.timeline-container:hover .timeline[data-v-99c9162d]:before{display:block}.video-container.scrubbing .thumb-indicator[data-v-99c9162d],.timeline-container:hover .thumb-indicator[data-v-99c9162d]{--scale: 1}.video-container.scrubbing .timeline[data-v-99c9162d],.timeline-container:hover .timeline[data-v-99c9162d]{height:100%}.e-timeline svg{display:block}.e-timeline .x-axis-overview .domain,.e-timeline .x-axis-detailed .domain,.e-timeline .x-axis-overviewBackground .domain,.e-timeline .x-axis-detailedBackground .domain{display:none}.e-timeline .x-axis-detailedBackground .domain,.e-timeline .x-axis-detailedBackground text{display:none}.e-timeline .x-axis-overview>g.tick>line{opacity:.1;stroke-width:3;stroke-linecap:round}.e-timeline .x-axis-detailed>g.tick>line{opacity:.1;stroke-linecap:round}.e-timeline .x-axis-detailedBackground>g.tick>line{opacity:.075;stroke-linecap:round}.e-timeline--dark line{stroke:#fff}.e-timeline--dark text{fill:#fff}