@ruc-lib/tour-guide 2.0.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,148 @@
1
+ import { EventEmitter, Renderer2, OnInit, OnDestroy, ElementRef, OnChanges, SimpleChanges } from '@angular/core';
2
+ import { TourGuideConfig, TourGuideData } from '../model/tour-guide.model';
3
+ import * as i0 from "@angular/core";
4
+ export declare class RuclibTourGuideComponent implements OnInit, OnDestroy, OnChanges {
5
+ private renderer;
6
+ rucEvent: EventEmitter<any>;
7
+ rucInputData: TourGuideConfig;
8
+ customTheme: string | undefined;
9
+ showStartButton: boolean;
10
+ dataSource: Array<TourGuideData>;
11
+ overlayRef: ElementRef;
12
+ currentStepIndex: number;
13
+ private currentElement?;
14
+ popupStyle: {
15
+ top: string;
16
+ left: string;
17
+ };
18
+ private originalParent?;
19
+ showTour: boolean;
20
+ startTourButtonLabel: string;
21
+ private resizeListener;
22
+ config: TourGuideConfig;
23
+ /**
24
+ * class constructor
25
+ * @param tourGuideService
26
+ * @param renderer
27
+ */
28
+ constructor(renderer: Renderer2);
29
+ /**
30
+ * handling input data changes
31
+ * updating default config with user provided config
32
+ * @param changes
33
+ */
34
+ ngOnChanges(changes: SimpleChanges): void;
35
+ /**
36
+ * handling change on component initilization
37
+ */
38
+ ngOnInit(): void;
39
+ /**
40
+ * this method handle the start of tour guide fetaure
41
+ */
42
+ startTour(): void;
43
+ /**
44
+ * this method handle the navigation to next tour guide feature
45
+ */
46
+ nextStep(): void;
47
+ /**
48
+ * this method allow us to navigate back to previous tour guide feature
49
+ */
50
+ previousStep(): void;
51
+ /**
52
+ * method to skip the tour guide thats in progress
53
+ */
54
+ skip(): void;
55
+ /**
56
+ * method to highlight feature area and changin details popup based on provide config
57
+ * @returns
58
+ */
59
+ private highlightElement;
60
+ /**
61
+ * Finds an element by its selector, scrolls it into view, and waits for the scroll to complete.
62
+ * @param selector The CSS selector for the target element.
63
+ * @returns A promise that resolves to the HTMLElement or undefined if not found.
64
+ */
65
+ private findElementAndScroll;
66
+ /**
67
+ * Applies CSS classes and styles to visually highlight the target element.
68
+ * @param element The element to highlight.
69
+ */
70
+ private applyHighlightStyles;
71
+ /**
72
+ * Calculates the optimal position for the tour popup and applies it.
73
+ * @param element The highlighted element.
74
+ * @param position The desired position ('auto', 'top', 'bottom', 'left', 'right').
75
+ */
76
+ private calculateAndApplyPopupPosition;
77
+ /**
78
+ * Determines the best placement for the popup when position is 'auto'.
79
+ * @param position The configured position.
80
+ * @param rect The BoundingClientRect of the target element.
81
+ * @returns The calculated final position.
82
+ */
83
+ private determineAutoPosition;
84
+ /**
85
+ * Computes the top and left coordinates for the popup based on the target element and desired position.
86
+ * @param position The final position for the popup.
87
+ * @param offset The absolute offset of the target element.
88
+ * @param element The target element.
89
+ * @returns An object with top and left coordinates.
90
+ */
91
+ private computePopupCoordinates;
92
+ /**
93
+ * Clamps the popup's coordinates to ensure it stays within the visible viewport.
94
+ * @param coords The calculated top and left coordinates.
95
+ * @returns The adjusted coordinates.
96
+ */
97
+ private clampPopupCoordinates;
98
+ /**
99
+ * If the popup is rendered inside a scrollable container, this ensures it's scrolled into view.
100
+ */
101
+ private scrollPopupIntoView;
102
+ /**
103
+ * method to execute highlight process after scroll
104
+ * @returns
105
+ */
106
+ private waitForScroll;
107
+ /**
108
+ * method to create transparent hole in overlay for visibility of highlighted area
109
+ */
110
+ private createTransparentHole;
111
+ /**
112
+ * method to get absolute offset
113
+ * @param element
114
+ * @returns
115
+ */
116
+ private getAbsoluteOffset;
117
+ /**
118
+ * method to lock scroll when tour guide is active
119
+ */
120
+ private lockScroll;
121
+ /**
122
+ * method to unlock scroll when tour guide is not active
123
+ */
124
+ private unlockScroll;
125
+ /**
126
+ * method to remove highlight when tour is skipped or done
127
+ */
128
+ private removeHighlight;
129
+ /**
130
+ * method to navigate between tour slides or skip tour using left, right and skip key
131
+ * @param event
132
+ * @returns
133
+ */
134
+ private handleKey;
135
+ /**
136
+ * debounce method for smooth operation
137
+ * @param fn
138
+ * @param delay
139
+ * @returns
140
+ */
141
+ private debounce;
142
+ /**
143
+ * handling change on component destroy
144
+ */
145
+ ngOnDestroy(): void;
146
+ static ɵfac: i0.ɵɵFactoryDeclaration<RuclibTourGuideComponent, never>;
147
+ static ɵcmp: i0.ɵɵComponentDeclaration<RuclibTourGuideComponent, "uxp-ruclib-tour-guide", never, { "rucInputData": "rucInputData"; "customTheme": "customTheme"; "showStartButton": "showStartButton"; "dataSource": "dataSource"; }, { "rucEvent": "rucEvent"; }, never, never, false, never>;
148
+ }
@@ -0,0 +1,10 @@
1
+ import * as i0 from "@angular/core";
2
+ import * as i1 from "./ruclib-tour-guide/ruclib-tour-guide.component";
3
+ import * as i2 from "@angular/common";
4
+ import * as i3 from "@angular/material/button";
5
+ import * as i4 from "@angular/material/card";
6
+ export declare class RuclibTourGuideModule {
7
+ static ɵfac: i0.ɵɵFactoryDeclaration<RuclibTourGuideModule, never>;
8
+ static ɵmod: i0.ɵɵNgModuleDeclaration<RuclibTourGuideModule, [typeof i1.RuclibTourGuideComponent], [typeof i2.CommonModule, typeof i3.MatButtonModule, typeof i4.MatCardModule], [typeof i1.RuclibTourGuideComponent]>;
9
+ static ɵinj: i0.ɵɵInjectorDeclaration<RuclibTourGuideModule>;
10
+ }
package/package.json ADDED
@@ -0,0 +1,37 @@
1
+ {
2
+ "name": "@ruc-lib/tour-guide",
3
+ "version": "2.0.0",
4
+ "license": "MIT",
5
+ "peerDependencies": {
6
+ "@angular/common": "^15.0.0 || ^16.0.0 || ^17.0.0",
7
+ "@angular/core": "^15.0.0 || ^16.0.0 || ^17.0.0",
8
+ "@angular/cdk": "^15.0.0 || ^16.0.0",
9
+ "@angular/material": "^15.0.0 || ^16.0.0"
10
+ },
11
+ "dependencies": {
12
+ "tslib": "^2.3.0"
13
+ },
14
+ "publishConfig": {
15
+ "access": "public"
16
+ },
17
+ "sideEffects": false,
18
+ "module": "fesm2015/ruc-lib-tour-guide.mjs",
19
+ "es2020": "fesm2020/ruc-lib-tour-guide.mjs",
20
+ "esm2020": "esm2020/ruc-lib-tour-guide.mjs",
21
+ "fesm2020": "fesm2020/ruc-lib-tour-guide.mjs",
22
+ "fesm2015": "fesm2015/ruc-lib-tour-guide.mjs",
23
+ "typings": "index.d.ts",
24
+ "exports": {
25
+ "./package.json": {
26
+ "default": "./package.json"
27
+ },
28
+ ".": {
29
+ "types": "./index.d.ts",
30
+ "esm2020": "./esm2020/ruc-lib-tour-guide.mjs",
31
+ "es2020": "./fesm2020/ruc-lib-tour-guide.mjs",
32
+ "es2015": "./fesm2015/ruc-lib-tour-guide.mjs",
33
+ "node": "./fesm2015/ruc-lib-tour-guide.mjs",
34
+ "default": "./fesm2020/ruc-lib-tour-guide.mjs"
35
+ }
36
+ }
37
+ }