siteguide.js 0.3.0 → 0.5.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.
- package/README.md +57 -1
- package/dist/css/siteguide.css +1 -1
- package/dist/index.d.ts +137 -45
- package/dist/index.js +3 -3
- package/dist/index.mjs +665 -583
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -1 +1,57 @@
|
|
|
1
|
-
|
|
1
|
+
|
|
2
|
+
# Siteguide.js
|
|
3
|
+
|
|
4
|
+
Siteguide.js is an open source library made with vanilla Javascript and CSS to help you build website guides and onboarding tours.
|
|
5
|
+
|
|
6
|
+
Siteguide empowers you to create personalized tours and interactive guides for users within your application or website. With its simple and minimalistic design, Siteguide offers extensive customization options while remaining user-friendly and intuitive.
|
|
7
|
+
|
|
8
|
+
## Installation
|
|
9
|
+
|
|
10
|
+
```bash
|
|
11
|
+
npm install siteguide.js --save
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
## Quick Start Example
|
|
15
|
+
|
|
16
|
+
The following example is a simple tour with two steps.
|
|
17
|
+
|
|
18
|
+
```javascript
|
|
19
|
+
import { Tour } from 'siteguide.js';
|
|
20
|
+
|
|
21
|
+
const tour = new Tour({
|
|
22
|
+
scrollTo: {
|
|
23
|
+
behavior: 'smooth',
|
|
24
|
+
block: 'center',
|
|
25
|
+
inline: 'center',
|
|
26
|
+
},
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
const stepList = [
|
|
30
|
+
{
|
|
31
|
+
id: '1',
|
|
32
|
+
host: '.step-1',
|
|
33
|
+
popup: {
|
|
34
|
+
text: "I'm step 1",
|
|
35
|
+
title: 'Step 1',
|
|
36
|
+
type: 'text',
|
|
37
|
+
},
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
id: '2',
|
|
41
|
+
host: '.step-2',
|
|
42
|
+
popup: {
|
|
43
|
+
title: 'Step 2',
|
|
44
|
+
text: "I'm step 2",
|
|
45
|
+
type: 'text',
|
|
46
|
+
},
|
|
47
|
+
},
|
|
48
|
+
];
|
|
49
|
+
|
|
50
|
+
tour.addSteps(stepList);
|
|
51
|
+
|
|
52
|
+
tour.start();
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
## License
|
|
56
|
+
|
|
57
|
+
Siteguide.js is open source and free to use under the MIT license. See the [LICENSE](LICENSE) file for more information.
|
package/dist/css/siteguide.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
:root{--bg:
|
|
1
|
+
:root{--sg-bg: var(--sg-mono-100);--sg-text: var(--sg-mono-900);--sg-line: var(--sg-mono-500);--primary: #2e62d9;--primary-hover: #2ca2fd;--secondary: #2ca2fd;--secondary-hover: #2ca2fd;--sg-mono-900: #101828;--sg-mono-800: #4c525e;--sg-mono-700: #7c8089;--sg-mono-600: #acaeb5;--sg-mono-500: #d5d6d9;--sg-mono-400: #e6e7e8;--sg-mono-300: #f4f4f5;--sg-mono-200: #f9f9fa;--sg-mono-100: #fff;--padding-s: 8px;--padding-m: 12px;--padding-l: 16px;--padding-2l: 20px;--sg-text-m: 16px;--sg-text-l: 18px}@keyframes fadeIn{0%{opacity:0}to{opacity:1}}.siteguide{color:var(--sg-text);box-sizing:border-box;font-family:Inter,sans-serif;font-size:var(--sg-text-m);width:280px;min-height:150px;background-color:var(--sg-bg);border-radius:8px;border:1px solid var(--sg-line);display:flex;flex-direction:column;position:absolute;box-shadow:0 10px 10px #0001;z-index:1000001;max-height:400px}.siteguide-animation{animation:fadeIn .3s ease-out}.siteguide-arrow{position:absolute;width:10px;height:10px;background-color:var(--sg-bg)}.siteguide-highlight{box-shadow:0 0 #212121cc,0 0 0 5000px #21212180;border:2px solid var(--sg-mono-900);border-radius:4px;opacity:1;z-index:1000000;position:absolute;transition:all .3s ease-out;pointer-events:none}.siteguide-header{display:flex;align-items:center;width:100%;padding:var(--padding-m) var(--padding-2l) 0}.siteguide-content{width:100%;padding:var(--padding-m) var(--padding-2l);overflow-y:auto}.siteguide-content::-webkit-scrollbar{width:4px}.siteguide-content::-webkit-scrollbar-thumb{background-color:var(--primary);border-radius:4px}.siteguide-title{display:block;font-size:var(--sg-text-l);font-weight:800;color:var(--sg-text)}.siteguide-image{width:100%;height:auto;border-radius:4px;object-fit:cover;margin-bottom:var(--padding-m)}.siteguide-description{font-size:14px;font-weight:400;color:var(--sg-text)}.siteguide-footer{width:100%;display:flex;align-items:center;justify-content:space-between;padding:var(--padding-m);border-top:1px solid var(--sg-line);gap:var(--padding-l);margin-top:auto}.siteguide-button{padding:var(--padding-s) var(--padding-l);border-radius:4px;cursor:pointer;font-size:14px;line-height:20px;transition:background-color .3s ease-out;color:var(--sg-mono-100)}.siteguide-button-secondary{background-color:var(--secondary)}.siteguide-button-secondary:hover{background-color:var(--secondary-hover)}.siteguide-button-primary{background-color:var(--primary)}.siteguide-button-primary:hover{background-color:var(--primary-hover)}.siteguide-button-link{color:var(--primary);background-color:transparent;cursor:pointer;transition:color .3s ease-out}.siteguide-button-link:hover{color:var(--primary-hover)}.siteguide-close{width:20px;height:20px;display:flex;align-items:center;justify-content:center;background-color:transparent;border-radius:4px;cursor:pointer;position:absolute;top:10px;right:10px;transition:background-color .3s ease-out}.siteguide-close:hover{background-color:var(--secondary-hover);color:#fff}.siteguide-close-icon{height:10px}
|
package/dist/index.d.ts
CHANGED
|
@@ -11,6 +11,9 @@ export declare function createElement<T extends keyof HTMLElementTagNameMap>(tag
|
|
|
11
11
|
* Represents the data for a custom popup
|
|
12
12
|
*/
|
|
13
13
|
export declare type CustomPopupData = SharedPopupData & {
|
|
14
|
+
/**
|
|
15
|
+
* The type of the popup
|
|
16
|
+
*/
|
|
14
17
|
type: Extract<PopupType, 'custom'>;
|
|
15
18
|
/**
|
|
16
19
|
* The HTML element to use as the content of the custom popup
|
|
@@ -22,6 +25,9 @@ export declare type CustomPopupData = SharedPopupData & {
|
|
|
22
25
|
* Represents the data for a custom popup
|
|
23
26
|
*/
|
|
24
27
|
declare type CustomPopupData_2 = SharedPopupData_2 & {
|
|
28
|
+
/**
|
|
29
|
+
* The type of the popup
|
|
30
|
+
*/
|
|
25
31
|
type: Extract<PopupType_2, 'custom'>;
|
|
26
32
|
/**
|
|
27
33
|
* The HTML element to use as the content of the custom popup
|
|
@@ -34,18 +40,20 @@ declare type CustomPopupData_2 = SharedPopupData_2 & {
|
|
|
34
40
|
* @template T The type to make deep required
|
|
35
41
|
* @returns A type that represents a deep required version of T
|
|
36
42
|
*/
|
|
37
|
-
declare type DeepRequired<T> =
|
|
38
|
-
|
|
39
|
-
|
|
43
|
+
declare type DeepRequired<T> = T extends (...args: any[]) => any
|
|
44
|
+
? T
|
|
45
|
+
: T extends object
|
|
46
|
+
? { [K in keyof T]-?: DeepRequired<T[K]> }
|
|
47
|
+
: T;
|
|
40
48
|
|
|
41
49
|
/**
|
|
42
50
|
* Represents a deep required type, ensuring all properties of an object are required and recursively applies to nested objects
|
|
43
51
|
* @template T The type to make deep required
|
|
44
52
|
* @returns A type that represents a deep required version of T
|
|
45
53
|
*/
|
|
46
|
-
declare type DeepRequired_2<T> =
|
|
47
|
-
[
|
|
48
|
-
}
|
|
54
|
+
declare type DeepRequired_2<T> = T extends (...args: any[]) => any ? T : T extends object ? {
|
|
55
|
+
[K in keyof T]-?: DeepRequired_2<T[K]>;
|
|
56
|
+
} : T;
|
|
49
57
|
|
|
50
58
|
/**
|
|
51
59
|
* Interface for rendering element
|
|
@@ -92,9 +100,9 @@ declare interface ITour {
|
|
|
92
100
|
get stepList(): readonly ITourStep[];
|
|
93
101
|
get config(): RequiredTourConfig;
|
|
94
102
|
get popup(): HTMLElement | null;
|
|
95
|
-
get
|
|
103
|
+
get highlight(): HTMLElement | null;
|
|
96
104
|
get popupRenderer(): IRenderer;
|
|
97
|
-
get
|
|
105
|
+
get highlightRenderer(): IRenderer;
|
|
98
106
|
addStep(config: TourStepConfig_2): void;
|
|
99
107
|
addSteps(steps: TourStepConfig_2[]): void;
|
|
100
108
|
removeStep(stepId: StepId): void;
|
|
@@ -112,9 +120,9 @@ declare interface ITour_2 {
|
|
|
112
120
|
get stepList(): readonly ITourStep_2[];
|
|
113
121
|
get config(): RequiredTourConfig_2;
|
|
114
122
|
get popup(): HTMLElement | null;
|
|
115
|
-
get
|
|
123
|
+
get highlight(): HTMLElement | null;
|
|
116
124
|
get popupRenderer(): IRenderer;
|
|
117
|
-
get
|
|
125
|
+
get highlightRenderer(): IRenderer;
|
|
118
126
|
addStep(config: TourStepConfig): void;
|
|
119
127
|
addSteps(steps: TourStepConfig[]): void;
|
|
120
128
|
removeStep(stepId: StepId_2): void;
|
|
@@ -129,15 +137,17 @@ declare interface ITour_2 {
|
|
|
129
137
|
* Made for resolving circular dependencies
|
|
130
138
|
*/
|
|
131
139
|
declare interface ITourStep {
|
|
132
|
-
|
|
133
|
-
readonly popupData: PopupData_2;
|
|
134
|
-
readonly tour: ITour;
|
|
140
|
+
get direction(): StepDirection;
|
|
135
141
|
get isFirst(): boolean;
|
|
136
142
|
get nextStep(): ITourStep | null;
|
|
137
143
|
get prevStep(): ITourStep | null;
|
|
138
144
|
get hasHost(): boolean;
|
|
139
145
|
get hostElement(): HTMLElement | null;
|
|
140
|
-
|
|
146
|
+
readonly id: StepId;
|
|
147
|
+
readonly popupData: PopupData_2;
|
|
148
|
+
readonly tour: ITour;
|
|
149
|
+
readonly index: number | null;
|
|
150
|
+
show(direction: StepDirection): Promise<void>;
|
|
141
151
|
}
|
|
142
152
|
|
|
143
153
|
/**
|
|
@@ -145,15 +155,17 @@ declare interface ITourStep {
|
|
|
145
155
|
* Made for resolving circular dependencies
|
|
146
156
|
*/
|
|
147
157
|
declare interface ITourStep_2 {
|
|
148
|
-
|
|
149
|
-
readonly popupData: PopupData_2;
|
|
150
|
-
readonly tour: ITour_2;
|
|
158
|
+
get direction(): StepDirection_2;
|
|
151
159
|
get isFirst(): boolean;
|
|
152
160
|
get nextStep(): ITourStep_2 | null;
|
|
153
161
|
get prevStep(): ITourStep_2 | null;
|
|
154
162
|
get hasHost(): boolean;
|
|
155
163
|
get hostElement(): HTMLElement | null;
|
|
156
|
-
|
|
164
|
+
readonly id: StepId_2;
|
|
165
|
+
readonly popupData: PopupData_2;
|
|
166
|
+
readonly tour: ITour_2;
|
|
167
|
+
readonly index: number | null;
|
|
168
|
+
show(direction: StepDirection_2): Promise<void>;
|
|
157
169
|
}
|
|
158
170
|
|
|
159
171
|
export declare type PopupCloseIconElement = InnerHTML | HTMLElement;
|
|
@@ -261,7 +273,7 @@ declare type PopupData_2 = TextPopupData_2 | CustomPopupData_2;
|
|
|
261
273
|
* // Example 4: Function returning string as host
|
|
262
274
|
* { host: () => '.example-element' };
|
|
263
275
|
*/
|
|
264
|
-
export declare type PopupHost = string |
|
|
276
|
+
export declare type PopupHost = string | Element | (() => Element | string);
|
|
265
277
|
|
|
266
278
|
/**
|
|
267
279
|
* Represents the host of a tour step. It can be a string, an HTMLElement, or a function that returns either an HTMLElement or a string.
|
|
@@ -278,7 +290,7 @@ export declare type PopupHost = string | HTMLElement | (() => HTMLElement | stri
|
|
|
278
290
|
* // Example 4: Function returning string as host
|
|
279
291
|
* { host: () => '.example-element' };
|
|
280
292
|
*/
|
|
281
|
-
declare type PopupHost_2 = string |
|
|
293
|
+
declare type PopupHost_2 = string | Element | (() => Element | string);
|
|
282
294
|
|
|
283
295
|
/**
|
|
284
296
|
* The position of a popup
|
|
@@ -375,6 +387,10 @@ declare type SharedPopupData_2 = {
|
|
|
375
387
|
buttonList?: TourButtonConfig_2[];
|
|
376
388
|
};
|
|
377
389
|
|
|
390
|
+
declare type StepDirection = 'toNext' | 'fromBack';
|
|
391
|
+
|
|
392
|
+
declare type StepDirection_2 = 'toNext' | 'fromBack';
|
|
393
|
+
|
|
378
394
|
declare type StepId = string;
|
|
379
395
|
|
|
380
396
|
declare type StepId_2 = string;
|
|
@@ -383,6 +399,9 @@ declare type StepId_2 = string;
|
|
|
383
399
|
* Represents the data for a text popup
|
|
384
400
|
*/
|
|
385
401
|
export declare type TextPopupData = SharedPopupData & {
|
|
402
|
+
/**
|
|
403
|
+
* The type of the popup
|
|
404
|
+
*/
|
|
386
405
|
type: Extract<PopupType, 'text'>;
|
|
387
406
|
/**
|
|
388
407
|
* The text to display in the popup
|
|
@@ -398,6 +417,9 @@ export declare type TextPopupData = SharedPopupData & {
|
|
|
398
417
|
* Represents the data for a text popup
|
|
399
418
|
*/
|
|
400
419
|
declare type TextPopupData_2 = SharedPopupData_2 & {
|
|
420
|
+
/**
|
|
421
|
+
* The type of the popup
|
|
422
|
+
*/
|
|
401
423
|
type: Extract<PopupType_2, 'text'>;
|
|
402
424
|
/**
|
|
403
425
|
* The text to display in the popup
|
|
@@ -413,20 +435,15 @@ export declare class Tour implements ITour {
|
|
|
413
435
|
get stepList(): readonly ITourStep[];
|
|
414
436
|
get config(): RequiredTourConfig_2;
|
|
415
437
|
get popup(): HTMLElement | null;
|
|
416
|
-
get
|
|
438
|
+
get highlight(): HTMLElement | null;
|
|
417
439
|
readonly popupRenderer: IRenderer_2;
|
|
418
|
-
readonly
|
|
419
|
-
/**
|
|
420
|
-
* TODO remove
|
|
421
|
-
* @deprecated remove later
|
|
422
|
-
*/
|
|
423
|
-
isStarted: boolean;
|
|
440
|
+
readonly highlightRenderer: IRenderer_2;
|
|
424
441
|
private _popup;
|
|
425
|
-
private
|
|
442
|
+
private _highlight;
|
|
426
443
|
private _stepList;
|
|
427
444
|
private _activeStep;
|
|
428
445
|
private _bodyResizeObserver;
|
|
429
|
-
private
|
|
446
|
+
private _config;
|
|
430
447
|
private readonly _stepMap;
|
|
431
448
|
constructor(config: TourConfig);
|
|
432
449
|
addStep(config: TourStepConfig): void;
|
|
@@ -436,6 +453,7 @@ export declare class Tour implements ITour {
|
|
|
436
453
|
complete(): void;
|
|
437
454
|
prev(): void;
|
|
438
455
|
next(): void;
|
|
456
|
+
setConfig(config: TourConfig): void;
|
|
439
457
|
private getBodyResizeObserver;
|
|
440
458
|
}
|
|
441
459
|
|
|
@@ -488,12 +506,12 @@ declare type TourButtonConfig_2 = {
|
|
|
488
506
|
/**
|
|
489
507
|
* Type of a button
|
|
490
508
|
*/
|
|
491
|
-
export declare type TourButtonType = 'primary' | 'secondary';
|
|
509
|
+
export declare type TourButtonType = 'primary' | 'secondary' | 'link';
|
|
492
510
|
|
|
493
511
|
/**
|
|
494
512
|
* Type of a button
|
|
495
513
|
*/
|
|
496
|
-
declare type TourButtonType_2 = 'primary' | 'secondary';
|
|
514
|
+
declare type TourButtonType_2 = 'primary' | 'secondary' | 'link';
|
|
497
515
|
|
|
498
516
|
/**
|
|
499
517
|
* Represents the configuration for a tour.
|
|
@@ -511,6 +529,11 @@ export declare type TourConfig = {
|
|
|
511
529
|
* @default true
|
|
512
530
|
*/
|
|
513
531
|
allowClose?: boolean;
|
|
532
|
+
/**
|
|
533
|
+
* Indicates if the tour popup can be closed by clicking outside the popup
|
|
534
|
+
* @default true
|
|
535
|
+
*/
|
|
536
|
+
allowClickoutClose?: boolean;
|
|
514
537
|
/**
|
|
515
538
|
* Specifies if the tour should scroll to the current step and how to scroll
|
|
516
539
|
* Can be a boolean to enable or disable scrolling, or an object with options for scrollIntoView
|
|
@@ -521,21 +544,40 @@ export declare type TourConfig = {
|
|
|
521
544
|
* The element or HTML to use as the close icon
|
|
522
545
|
*/
|
|
523
546
|
closeIcon?: PopupCloseIconElement;
|
|
547
|
+
/**
|
|
548
|
+
* Indicates if the arrow should be shown
|
|
549
|
+
* @default true
|
|
550
|
+
*/
|
|
551
|
+
enableArrow?: boolean;
|
|
524
552
|
/**
|
|
525
553
|
* Configuration for the helper layout.
|
|
526
554
|
*/
|
|
527
|
-
|
|
555
|
+
highlight?: {
|
|
556
|
+
/**
|
|
557
|
+
* Indicates if the helper layout should be disabled
|
|
558
|
+
* @default false
|
|
559
|
+
*/
|
|
560
|
+
disable?: boolean;
|
|
528
561
|
/**
|
|
529
562
|
* The horizontal padding for the helper layout.
|
|
530
563
|
* @default 8
|
|
531
564
|
*/
|
|
532
|
-
|
|
565
|
+
padding?: number;
|
|
533
566
|
/**
|
|
534
|
-
* The
|
|
535
|
-
* @default
|
|
567
|
+
* The class to apply to the highlight
|
|
568
|
+
* @default 'siteguide-highlight'
|
|
536
569
|
*/
|
|
537
|
-
|
|
570
|
+
class?: string;
|
|
538
571
|
};
|
|
572
|
+
/**
|
|
573
|
+
* The class to apply to the tour popup animation
|
|
574
|
+
* @default 'siteguide-animation'
|
|
575
|
+
*/
|
|
576
|
+
animationClass?: string;
|
|
577
|
+
/**
|
|
578
|
+
* The function to translate the tokens
|
|
579
|
+
*/
|
|
580
|
+
translateFn?: TranslateFn_2;
|
|
539
581
|
};
|
|
540
582
|
|
|
541
583
|
/**
|
|
@@ -554,6 +596,11 @@ declare type TourConfig_2 = {
|
|
|
554
596
|
* @default true
|
|
555
597
|
*/
|
|
556
598
|
allowClose?: boolean;
|
|
599
|
+
/**
|
|
600
|
+
* Indicates if the tour popup can be closed by clicking outside the popup
|
|
601
|
+
* @default true
|
|
602
|
+
*/
|
|
603
|
+
allowClickoutClose?: boolean;
|
|
557
604
|
/**
|
|
558
605
|
* Specifies if the tour should scroll to the current step and how to scroll
|
|
559
606
|
* Can be a boolean to enable or disable scrolling, or an object with options for scrollIntoView
|
|
@@ -564,38 +611,61 @@ declare type TourConfig_2 = {
|
|
|
564
611
|
* The element or HTML to use as the close icon
|
|
565
612
|
*/
|
|
566
613
|
closeIcon?: PopupCloseIconElement_2;
|
|
614
|
+
/**
|
|
615
|
+
* Indicates if the arrow should be shown
|
|
616
|
+
* @default true
|
|
617
|
+
*/
|
|
618
|
+
enableArrow?: boolean;
|
|
567
619
|
/**
|
|
568
620
|
* Configuration for the helper layout.
|
|
569
621
|
*/
|
|
570
|
-
|
|
622
|
+
highlight?: {
|
|
623
|
+
/**
|
|
624
|
+
* Indicates if the helper layout should be disabled
|
|
625
|
+
* @default false
|
|
626
|
+
*/
|
|
627
|
+
disable?: boolean;
|
|
571
628
|
/**
|
|
572
629
|
* The horizontal padding for the helper layout.
|
|
573
630
|
* @default 8
|
|
574
631
|
*/
|
|
575
|
-
|
|
632
|
+
padding?: number;
|
|
576
633
|
/**
|
|
577
|
-
* The
|
|
578
|
-
* @default
|
|
634
|
+
* The class to apply to the highlight
|
|
635
|
+
* @default 'siteguide-highlight'
|
|
579
636
|
*/
|
|
580
|
-
|
|
637
|
+
class?: string;
|
|
581
638
|
};
|
|
639
|
+
|
|
640
|
+
/**
|
|
641
|
+
* The class to apply to the tour popup animation
|
|
642
|
+
* @default 'siteguide-animation'
|
|
643
|
+
*/
|
|
644
|
+
animationClass?: string;
|
|
645
|
+
/**
|
|
646
|
+
* The function to translate the tokens
|
|
647
|
+
*/
|
|
648
|
+
translateFn?: TranslateFn;
|
|
582
649
|
};
|
|
583
650
|
|
|
584
651
|
export declare class TourStep implements ITourStep_2 {
|
|
585
652
|
get isFirst(): boolean;
|
|
586
653
|
get nextStep(): ITourStep_2 | null;
|
|
587
654
|
get prevStep(): ITourStep_2 | null;
|
|
655
|
+
get direction(): StepDirection_2;
|
|
588
656
|
get hasHost(): boolean;
|
|
589
657
|
get hostElement(): HTMLElement | null;
|
|
590
658
|
readonly id: StepId_2;
|
|
591
659
|
readonly popupData: PopupData;
|
|
592
|
-
readonly tour:
|
|
660
|
+
readonly tour: ITour_2;
|
|
661
|
+
readonly index: number | null;
|
|
593
662
|
private _hostElement;
|
|
663
|
+
private _direction;
|
|
594
664
|
private readonly _hostData;
|
|
595
665
|
private readonly _popupRenderer;
|
|
596
|
-
private readonly
|
|
597
|
-
constructor(tour:
|
|
598
|
-
show(): Promise<void>;
|
|
666
|
+
private readonly _highlightRenderer;
|
|
667
|
+
constructor(tour: ITour_2, config: TourStepConfig);
|
|
668
|
+
show(direction: StepDirection_2): Promise<void>;
|
|
599
669
|
private resolveHostElement;
|
|
600
670
|
}
|
|
601
671
|
|
|
@@ -607,6 +677,10 @@ export declare type TourStepConfig = {
|
|
|
607
677
|
* The unique identifier for the tour step.
|
|
608
678
|
*/
|
|
609
679
|
id: StepId_2;
|
|
680
|
+
/**
|
|
681
|
+
* The index of the step in the tour
|
|
682
|
+
*/
|
|
683
|
+
index?: number;
|
|
610
684
|
/**
|
|
611
685
|
* The host element or a function that returns the host element for the tour step
|
|
612
686
|
*/
|
|
@@ -625,6 +699,10 @@ declare type TourStepConfig_2 = {
|
|
|
625
699
|
* The unique identifier for the tour step.
|
|
626
700
|
*/
|
|
627
701
|
id: StepId;
|
|
702
|
+
/**
|
|
703
|
+
* The index of the step in the tour
|
|
704
|
+
*/
|
|
705
|
+
index?: number;
|
|
628
706
|
/**
|
|
629
707
|
* The host element or a function that returns the host element for the tour step
|
|
630
708
|
*/
|
|
@@ -635,4 +713,18 @@ declare type TourStepConfig_2 = {
|
|
|
635
713
|
popup: PopupData_2;
|
|
636
714
|
};
|
|
637
715
|
|
|
716
|
+
/**
|
|
717
|
+
* The function to translate the tokens
|
|
718
|
+
* @param {string} token - The token to translate
|
|
719
|
+
* @returns {string} The translated string
|
|
720
|
+
*/
|
|
721
|
+
declare type TranslateFn = (token: string) => string;
|
|
722
|
+
|
|
723
|
+
/**
|
|
724
|
+
* The function to translate the tokens
|
|
725
|
+
* @param {string} token - The token to translate
|
|
726
|
+
* @returns {string} The translated string
|
|
727
|
+
*/
|
|
728
|
+
declare type TranslateFn_2 = (token: string) => string;
|
|
729
|
+
|
|
638
730
|
export { }
|
package/dist/index.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
"use strict";var Nt=Object.defineProperty,Vt=Object.defineProperties;var Ft=Object.getOwnPropertyDescriptors;var U=Object.getOwnPropertySymbols;var dt=Object.prototype.hasOwnProperty,ht=Object.prototype.propertyIsEnumerable;var Z=(t,e,n)=>e in t?Nt(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,O=(t,e)=>{for(var n in e||(e={}))dt.call(e,n)&&Z(t,n,e[n]);if(U)for(var n of U(e))ht.call(e,n)&&Z(t,n,e[n]);return t},z=(t,e)=>Vt(t,Ft(e));var pt=(t,e)=>{var n={};for(var i in t)dt.call(t,i)&&e.indexOf(i)<0&&(n[i]=t[i]);if(t!=null&&U)for(var i of U(t))e.indexOf(i)<0&&ht.call(t,i)&&(n[i]=t[i]);return n};var w=(t,e,n)=>Z(t,typeof e!="symbol"?e+"":e,n);var A=(t,e,n)=>new Promise((i,o)=>{var r=a=>{try{l(n.next(a))}catch(c){o(c)}},s=a=>{try{l(n.throw(a))}catch(c){o(c)}},l=a=>a.done?i(a.value):Promise.resolve(a.value).then(r,s);l((n=n.apply(t,e)).next())});Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const Wt=["top","right","bottom","left"],mt=["start","end"],gt=Wt.reduce((t,e)=>t.concat(e,e+"-"+mt[0],e+"-"+mt[1]),[]),yt=Math.min,I=Math.max,q=Math.round,E=t=>({x:t,y:t}),zt={left:"right",right:"left",bottom:"top",top:"bottom"},It={start:"end",end:"start"};function it(t,e){return typeof t=="function"?t(e):t}function j(t){return t.split("-")[0]}function D(t){return t.split("-")[1]}function Yt(t){return t==="x"?"y":"x"}function bt(t){return t==="y"?"height":"width"}function ot(t){return["top","bottom"].includes(j(t))?"y":"x"}function Ct(t){return Yt(ot(t))}function jt(t,e,n){n===void 0&&(n=!1);const i=D(t),o=Ct(t),r=bt(o);let s=o==="x"?i===(n?"end":"start")?"right":"left":i==="start"?"bottom":"top";return e.reference[r]>e.floating[r]&&(s=wt(s)),[s,wt(s)]}function Xt(t){return t.replace(/start|end/g,e=>It[e])}function wt(t){return t.replace(/left|right|bottom|top/g,e=>zt[e])}function Ut(t){return O({top:0,right:0,bottom:0,left:0},t)}function qt(t){return typeof t!="number"?Ut(t):{top:t,right:t,bottom:t,left:t}}function K(t){const{x:e,y:n,width:i,height:o}=t;return{width:i,height:o,top:n,left:e,right:e+i,bottom:n+o,x:e,y:n}}function xt(t,e,n){let{reference:i,floating:o}=t;const r=ot(e),s=Ct(e),l=bt(s),a=j(e),c=r==="y",f=i.x+i.width/2-o.width/2,u=i.y+i.height/2-o.height/2,p=i[l]/2-o[l]/2;let d;switch(a){case"top":d={x:f,y:i.y-o.height};break;case"bottom":d={x:f,y:i.y+i.height};break;case"right":d={x:i.x+i.width,y:u};break;case"left":d={x:i.x-o.width,y:u};break;default:d={x:i.x,y:i.y}}switch(D(e)){case"start":d[s]-=p*(n&&c?-1:1);break;case"end":d[s]+=p*(n&&c?-1:1);break}return d}const Kt=(t,e,n)=>A(exports,null,function*(){const{placement:i="bottom",strategy:o="absolute",middleware:r=[],platform:s}=n,l=r.filter(Boolean),a=yield s.isRTL==null?void 0:s.isRTL(e);let c=yield s.getElementRects({reference:t,floating:e,strategy:o}),{x:f,y:u}=xt(c,i,a),p=i,d={},m=0;for(let y=0;y<l.length;y++){const{name:g,fn:v}=l[y],{x:_,y:h,data:L,reset:x}=yield v({x:f,y:u,initialPlacement:i,placement:p,strategy:o,middlewareData:d,rects:c,platform:s,elements:{reference:t,floating:e}});f=_!=null?_:f,u=h!=null?h:u,d=z(O({},d),{[g]:O(O({},d[g]),L)}),x&&m<=50&&(m++,typeof x=="object"&&(x.placement&&(p=x.placement),x.rects&&(c=x.rects===!0?yield s.getElementRects({reference:t,floating:e,strategy:o}):x.rects),{x:f,y:u}=xt(c,p,a)),y=-1)}return{x:f,y:u,placement:p,strategy:o,middlewareData:d}});function Gt(t,e){return A(this,null,function*(){var n;e===void 0&&(e={});const{x:i,y:o,platform:r,rects:s,elements:l,strategy:a}=t,{boundary:c="clippingAncestors",rootBoundary:f="viewport",elementContext:u="floating",altBoundary:p=!1,padding:d=0}=it(e,t),m=qt(d),g=l[p?u==="floating"?"reference":"floating":u],v=K(yield r.getClippingRect({element:(n=yield r.isElement==null?void 0:r.isElement(g))==null||n?g:g.contextElement||(yield r.getDocumentElement==null?void 0:r.getDocumentElement(l.floating)),boundary:c,rootBoundary:f,strategy:a})),_=u==="floating"?{x:i,y:o,width:s.floating.width,height:s.floating.height}:s.reference,h=yield r.getOffsetParent==null?void 0:r.getOffsetParent(l.floating),L=(yield r.isElement==null?void 0:r.isElement(h))?(yield r.getScale==null?void 0:r.getScale(h))||{x:1,y:1}:{x:1,y:1},x=K(r.convertOffsetParentRelativeRectToViewportRelativeRect?yield r.convertOffsetParentRelativeRectToViewportRelativeRect({elements:l,rect:_,offsetParent:h,strategy:a}):_);return{top:(v.top-x.top+m.top)/L.y,bottom:(x.bottom-v.bottom+m.bottom)/L.y,left:(v.left-x.left+m.left)/L.x,right:(x.right-v.right+m.right)/L.x}})}function Jt(t,e,n){return(t?[...n.filter(o=>D(o)===t),...n.filter(o=>D(o)!==t)]:n.filter(o=>j(o)===o)).filter(o=>t?D(o)===t||(e?Xt(o)!==o:!1):!0)}const Qt=function(t){return t===void 0&&(t={}),{name:"autoPlacement",options:t,fn(n){return A(this,null,function*(){var i,o,r;const{rects:s,middlewareData:l,placement:a,platform:c,elements:f}=n,ut=it(t,n),{crossAxis:u=!1,alignment:p,allowedPlacements:d=gt,autoAlignment:m=!0}=ut,y=pt(ut,["crossAxis","alignment","allowedPlacements","autoAlignment"]),g=p!==void 0||d===gt?Jt(p||null,m,d):d,v=yield Gt(n,y),_=((i=l.autoPlacement)==null?void 0:i.index)||0,h=g[_];if(h==null)return{};const L=jt(h,s,yield c.isRTL==null?void 0:c.isRTL(f.floating));if(a!==h)return{reset:{placement:g[0]}};const x=[v[j(h)],v[L[0]],v[L[1]]],k=[...((o=l.autoPlacement)==null?void 0:o.overflows)||[],{placement:h,overflows:x}],ct=g[_+1];if(ct)return{data:{index:_+1,overflows:k},reset:{placement:ct}};const at=k.map(R=>{const W=D(R.placement);return[R.placement,W&&u?R.overflows.slice(0,2).reduce((kt,Bt)=>kt+Bt,0):R.overflows[0],R.overflows]}).sort((R,W)=>R[1]-W[1]),ft=((r=at.filter(R=>R[2].slice(0,D(R[0])?2:3).every(W=>W<=0))[0])==null?void 0:r[0])||at[0][0];return ft!==a?{data:{index:_+1,overflows:k},reset:{placement:ft}}:{}})}}};function Zt(t,e){return A(this,null,function*(){const{placement:n,platform:i,elements:o}=t,r=yield i.isRTL==null?void 0:i.isRTL(o.floating),s=j(n),l=D(n),a=ot(n)==="y",c=["left","top"].includes(s)?-1:1,f=r&&a?-1:1,u=it(e,t);let{mainAxis:p,crossAxis:d,alignmentAxis:m}=typeof u=="number"?{mainAxis:u,crossAxis:0,alignmentAxis:null}:{mainAxis:u.mainAxis||0,crossAxis:u.crossAxis||0,alignmentAxis:u.alignmentAxis};return l&&typeof m=="number"&&(d=l==="end"?m*-1:m),a?{x:d*f,y:p*c}:{x:p*c,y:d*f}})}const te=function(t){return t===void 0&&(t=0),{name:"offset",options:t,fn(n){return A(this,null,function*(){var i,o;const{x:r,y:s,placement:l,middlewareData:a}=n,c=yield Zt(n,t);return l===((i=a.offset)==null?void 0:i.placement)&&(o=a.arrow)!=null&&o.alignmentOffset?{}:{x:r+c.x,y:s+c.y,data:z(O({},c),{placement:l})}})}}};function G(){return typeof window!="undefined"}function F(t){return St(t)?(t.nodeName||"").toLowerCase():"#document"}function b(t){var e;return(t==null||(e=t.ownerDocument)==null?void 0:e.defaultView)||window}function $(t){var e;return(e=(St(t)?t.ownerDocument:t.document)||window.document)==null?void 0:e.documentElement}function St(t){return G()?t instanceof Node||t instanceof b(t).Node:!1}function S(t){return G()?t instanceof Element||t instanceof b(t).Element:!1}function P(t){return G()?t instanceof HTMLElement||t instanceof b(t).HTMLElement:!1}function vt(t){return!G()||typeof ShadowRoot=="undefined"?!1:t instanceof ShadowRoot||t instanceof b(t).ShadowRoot}function X(t){const{overflow:e,overflowX:n,overflowY:i,display:o}=T(t);return/auto|scroll|overlay|hidden|clip/.test(e+i+n)&&!["inline","contents"].includes(o)}function ee(t){return["table","td","th"].includes(F(t))}function J(t){return[":popover-open",":modal"].some(e=>{try{return t.matches(e)}catch(n){return!1}})}function st(t){const e=rt(),n=S(t)?T(t):t;return n.transform!=="none"||n.perspective!=="none"||(n.containerType?n.containerType!=="normal":!1)||!e&&(n.backdropFilter?n.backdropFilter!=="none":!1)||!e&&(n.filter?n.filter!=="none":!1)||["transform","perspective","filter"].some(i=>(n.willChange||"").includes(i))||["paint","layout","strict","content"].some(i=>(n.contain||"").includes(i))}function ne(t){let e=M(t);for(;P(e)&&!V(e);){if(st(e))return e;if(J(e))return null;e=M(e)}return null}function rt(){return typeof CSS=="undefined"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}function V(t){return["html","body","#document"].includes(F(t))}function T(t){return b(t).getComputedStyle(t)}function Q(t){return S(t)?{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}:{scrollLeft:t.scrollX,scrollTop:t.scrollY}}function M(t){if(F(t)==="html")return t;const e=t.assignedSlot||t.parentNode||vt(t)&&t.host||$(t);return vt(e)?e.host:e}function Tt(t){const e=M(t);return V(e)?t.ownerDocument?t.ownerDocument.body:t.body:P(e)&&X(e)?e:Tt(e)}function et(t,e,n){var i;e===void 0&&(e=[]),n===void 0&&(n=!0);const o=Tt(t),r=o===((i=t.ownerDocument)==null?void 0:i.body),s=b(o);if(r){const l=nt(s);return e.concat(s,s.visualViewport||[],X(o)?o:[],l&&n?et(l):[])}return e.concat(o,et(o,[],n))}function nt(t){return t.parent&&Object.getPrototypeOf(t.parent)?t.frameElement:null}function Rt(t){const e=T(t);let n=parseFloat(e.width)||0,i=parseFloat(e.height)||0;const o=P(t),r=o?t.offsetWidth:n,s=o?t.offsetHeight:i,l=q(n)!==r||q(i)!==s;return l&&(n=r,i=s),{width:n,height:i,$:l}}function Et(t){return S(t)?t:t.contextElement}function N(t){const e=Et(t);if(!P(e))return E(1);const n=e.getBoundingClientRect(),{width:i,height:o,$:r}=Rt(e);let s=(r?q(n.width):n.width)/i,l=(r?q(n.height):n.height)/o;return(!s||!Number.isFinite(s))&&(s=1),(!l||!Number.isFinite(l))&&(l=1),{x:s,y:l}}const ie=E(0);function Pt(t){const e=b(t);return!rt()||!e.visualViewport?ie:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function oe(t,e,n){return e===void 0&&(e=!1),!n||e&&n!==b(t)?!1:e}function Y(t,e,n,i){e===void 0&&(e=!1),n===void 0&&(n=!1);const o=t.getBoundingClientRect(),r=Et(t);let s=E(1);e&&(i?S(i)&&(s=N(i)):s=N(t));const l=oe(r,n,i)?Pt(r):E(0);let a=(o.left+l.x)/s.x,c=(o.top+l.y)/s.y,f=o.width/s.x,u=o.height/s.y;if(r){const p=b(r),d=i&&S(i)?b(i):i;let m=p,y=nt(m);for(;y&&i&&d!==m;){const g=N(y),v=y.getBoundingClientRect(),_=T(y),h=v.left+(y.clientLeft+parseFloat(_.paddingLeft))*g.x,L=v.top+(y.clientTop+parseFloat(_.paddingTop))*g.y;a*=g.x,c*=g.y,f*=g.x,u*=g.y,a+=h,c+=L,m=b(y),y=nt(m)}}return K({width:f,height:u,x:a,y:c})}function lt(t,e){const n=Q(t).scrollLeft;return e?e.left+n:Y($(t)).left+n}function Ot(t,e,n){n===void 0&&(n=!1);const i=t.getBoundingClientRect(),o=i.left+e.scrollLeft-(n?0:lt(t,i)),r=i.top+e.scrollTop;return{x:o,y:r}}function se(t){let{elements:e,rect:n,offsetParent:i,strategy:o}=t;const r=o==="fixed",s=$(i),l=e?J(e.floating):!1;if(i===s||l&&r)return n;let a={scrollLeft:0,scrollTop:0},c=E(1);const f=E(0),u=P(i);if((u||!u&&!r)&&((F(i)!=="body"||X(s))&&(a=Q(i)),P(i))){const d=Y(i);c=N(i),f.x=d.x+i.clientLeft,f.y=d.y+i.clientTop}const p=s&&!u&&!r?Ot(s,a,!0):E(0);return{width:n.width*c.x,height:n.height*c.y,x:n.x*c.x-a.scrollLeft*c.x+f.x+p.x,y:n.y*c.y-a.scrollTop*c.y+f.y+p.y}}function re(t){return Array.from(t.getClientRects())}function le(t){const e=$(t),n=Q(t),i=t.ownerDocument.body,o=I(e.scrollWidth,e.clientWidth,i.scrollWidth,i.clientWidth),r=I(e.scrollHeight,e.clientHeight,i.scrollHeight,i.clientHeight);let s=-n.scrollLeft+lt(t);const l=-n.scrollTop;return T(i).direction==="rtl"&&(s+=I(e.clientWidth,i.clientWidth)-o),{width:o,height:r,x:s,y:l}}function ce(t,e){const n=b(t),i=$(t),o=n.visualViewport;let r=i.clientWidth,s=i.clientHeight,l=0,a=0;if(o){r=o.width,s=o.height;const c=rt();(!c||c&&e==="fixed")&&(l=o.offsetLeft,a=o.offsetTop)}return{width:r,height:s,x:l,y:a}}function ae(t,e){const n=Y(t,!0,e==="fixed"),i=n.top+t.clientTop,o=n.left+t.clientLeft,r=P(t)?N(t):E(1),s=t.clientWidth*r.x,l=t.clientHeight*r.y,a=o*r.x,c=i*r.y;return{width:s,height:l,x:a,y:c}}function _t(t,e,n){let i;if(e==="viewport")i=ce(t,n);else if(e==="document")i=le($(t));else if(S(e))i=ae(e,n);else{const o=Pt(t);i={x:e.x-o.x,y:e.y-o.y,width:e.width,height:e.height}}return K(i)}function $t(t,e){const n=M(t);return n===e||!S(n)||V(n)?!1:T(n).position==="fixed"||$t(n,e)}function fe(t,e){const n=e.get(t);if(n)return n;let i=et(t,[],!1).filter(l=>S(l)&&F(l)!=="body"),o=null;const r=T(t).position==="fixed";let s=r?M(t):t;for(;S(s)&&!V(s);){const l=T(s),a=st(s);!a&&l.position==="fixed"&&(o=null),(r?!a&&!o:!a&&l.position==="static"&&!!o&&["absolute","fixed"].includes(o.position)||X(s)&&!a&&$t(t,s))?i=i.filter(f=>f!==s):o=l,s=M(s)}return e.set(t,i),i}function ue(t){let{element:e,boundary:n,rootBoundary:i,strategy:o}=t;const s=[...n==="clippingAncestors"?J(e)?[]:fe(e,this._c):[].concat(n),i],l=s[0],a=s.reduce((c,f)=>{const u=_t(e,f,o);return c.top=I(u.top,c.top),c.right=yt(u.right,c.right),c.bottom=yt(u.bottom,c.bottom),c.left=I(u.left,c.left),c},_t(e,l,o));return{width:a.right-a.left,height:a.bottom-a.top,x:a.left,y:a.top}}function de(t){const{width:e,height:n}=Rt(t);return{width:e,height:n}}function he(t,e,n){const i=P(e),o=$(e),r=n==="fixed",s=Y(t,!0,r,e);let l={scrollLeft:0,scrollTop:0};const a=E(0);if(i||!i&&!r)if((F(e)!=="body"||X(o))&&(l=Q(e)),i){const p=Y(e,!0,r,e);a.x=p.x+e.clientLeft,a.y=p.y+e.clientTop}else o&&(a.x=lt(o));const c=o&&!i&&!r?Ot(o,l):E(0),f=s.left+l.scrollLeft-a.x-c.x,u=s.top+l.scrollTop-a.y-c.y;return{x:f,y:u,width:s.width,height:s.height}}function tt(t){return T(t).position==="static"}function Lt(t,e){if(!P(t)||T(t).position==="fixed")return null;if(e)return e(t);let n=t.offsetParent;return $(t)===n&&(n=n.ownerDocument.body),n}function At(t,e){const n=b(t);if(J(t))return n;if(!P(t)){let o=M(t);for(;o&&!V(o);){if(S(o)&&!tt(o))return o;o=M(o)}return n}let i=Lt(t,e);for(;i&&ee(i)&&tt(i);)i=Lt(i,e);return i&&V(i)&&tt(i)&&!st(i)?n:i||ne(t)||n}const pe=function(t){return A(this,null,function*(){const e=this.getOffsetParent||At,n=this.getDimensions,i=yield n(t.floating);return{reference:he(t.reference,yield e(t.floating),t.strategy),floating:{x:0,y:0,width:i.width,height:i.height}}})};function me(t){return T(t).direction==="rtl"}const ge={convertOffsetParentRelativeRectToViewportRelativeRect:se,getDocumentElement:$,getClippingRect:ue,getOffsetParent:At,getElementRects:pe,getClientRects:re,getDimensions:de,getScale:N,isElement:S,isRTL:me},ye=te,we=Qt,xe=(t,e,n)=>{const i=new Map,o=O({platform:ge},n),r=z(O({},o.platform),{_c:i});return Kt(t,e,z(O({},o),{platform:r}))};function H(t){return t===null||typeof t=="undefined"}function B(t){return!H(t)}function ve(t){return new Promise(e=>setTimeout(e,t))}function Dt(t){var i;const e=t.parentElement;return!e||e.nodeName==="HTML"?!1:((i=document.defaultView)==null?void 0:i.getComputedStyle(t,null).getPropertyValue("position"))==="fixed"?!0:Dt(e)}function Mt(t){return Dt(t)?"fixed":"absolute"}class _e{renderContent(e,n,i){e.querySelector(`.${i.classPrefix}-content`).appendChild(n.node)}}function C(t,e){const n=document.createElement(t);return e&&e.length>0&&(e=e.filter(i=>i),n.classList.add(...e)),n}class Le{renderContent(e,n,i){var r,s,l,a;const o=e.querySelector(`.${i.classPrefix}-content`);if(n.imgSrc){const c=C("img",[`${i.classPrefix}-image`,`${(s=(r=n.customization)==null?void 0:r.imageClass)!=null?s:""}`]);c.src=n.imgSrc,o.appendChild(c)}if(n.text){const c=C("p",[`${i.classPrefix}-description`,`${(a=(l=n.customization)==null?void 0:l.descriptionClass)!=null?a:""}`]);c.innerText=n.text,o.appendChild(c)}}}function be(t,e,n){var l,a,c,f,u,p,d,m,y,g,v,_;t.innerHTML="",t.className=`${n.config.classPrefix}`,(l=e.customization)!=null&&l.class&&t.classList.add(e.customization.class);const i=C("div",[`${n.config.classPrefix}-header`,`${(c=(a=e.customization)==null?void 0:a.headerClass)!=null?c:""}`]);t.appendChild(i);const o=C("h1",[`${n.config.classPrefix}-title`,`${(u=(f=e.customization)==null?void 0:f.titleClass)!=null?u:""}`]);if(o.innerHTML=(p=e.title)!=null?p:"",i.appendChild(o),n.config.allowClose){const h=C("button",[`${n.config.classPrefix}-close`,`${(m=(d=e.customization)==null?void 0:d.closeButtonClass)!=null?m:""}`]);Ce(h,n.config.closeIcon),h.onclick=n.complete.bind(n),i.appendChild(h)}const r=C("div",[`${n.config.classPrefix}-content`,`${(g=(y=e.customization)==null?void 0:y.contentClass)!=null?g:""}`]);t.appendChild(r);const s=C("div",[`${n.config.classPrefix}-footer`,`${(_=(v=e.customization)==null?void 0:v.footerClass)!=null?_:""}`]);H(e.buttonList)&&(e.buttonList=Se(n)),e.buttonList.forEach(h=>{var k;h.action=h.action.bind(n);const L=[`${n.config.classPrefix}-button`,(k=h.class)!=null?k:""];H(h.type)||h.type==="secondary"?L.push(`${n.config.classPrefix}-button-secondary`):h.type==="primary"&&L.push(`${n.config.classPrefix}-button-primary`),!H(h.class)&&h.class!==""&&L.push(h.class);const x=C("button",L);x.innerText=h.text,x.onclick=()=>{h.action()},s.appendChild(x)}),t.appendChild(s)}function Ce(t,e){e instanceof HTMLElement?t.appendChild(e):t.innerHTML=e.innerHTML}function Se(t){return[{text:"Back",action:t.prev},{text:"Next",type:"primary",action:t.next}]}class Te{constructor(){w(this,"_renderContentStrategy",new Map);this.setUpStrategies()}render(e,n){return new Promise(i=>{var o,r;if(!this._renderContentStrategy.has(n.popupData.type))throw new Error("Missing popup creator strategy");e.style.animation="none",e.style.opacity="0",n.hostElement?e.style.position=Mt(n.hostElement):e.style.position="fixed",be(e,n.popupData,n.tour),(o=this._renderContentStrategy.get(n.popupData.type))==null||o.renderContent(e,n.popupData,n.tour.config),(r=n.hostElement)==null||r.scrollIntoView(n.tour.config.scrollTo),i()}).then(()=>{var i,o;return n.isFirst||!n.hasHost&&!((i=n.prevStep)!=null&&i.hasHost)||!n.hasHost&&!((o=n.nextStep)!=null&&o.hasHost)?Promise.resolve():ve(400)}).then(()=>{this.updatePosition(e,n),e.style.opacity="1",e.style.animation="fadeIn 0.3s ease-out"})}updatePosition(e,n){const i=e.style.position==="fixed"?window.scrollY||document.documentElement.scrollTop:0,o=[],r=B(n.popupData.position)&&n.popupData.position!=="auto"?n.popupData.position:void 0;(n.popupData.position==="auto"||H(r))&&o.push(we()),n.hostElement?xe(n.hostElement,e,{placement:r,middleware:[...o,ye(20)]}).then(({x:s,y:l})=>{Object.assign(e.style,{top:`${l-i}px`,left:`${s}px`,transform:""})}):Object.assign(e.style,{top:"50%",left:"50%",transform:"translate(-50%, -50%)"})}setUpStrategies(){this._renderContentStrategy.set("text",new Le),this._renderContentStrategy.set("custom",new _e)}}class Re{render(e,n){return new Promise(i=>{n.hostElement&&(e.style.position=Mt(n.hostElement)),i()}).then(()=>{this.updatePosition(e,n)})}updatePosition(e,n){var l,a,c,f;if(!n.hostElement){e.style.width="0",e.style.height="0",e.style.top="50%",e.style.left="50%",e.style.transform="translate(-50%, -50%)",e.style.borderWidth="0";return}const i=n.hostElement.getBoundingClientRect(),o=(a=(l=n.tour.config.helperLayout)==null?void 0:l.paddingX)!=null?a:8,r=(f=(c=n.tour.config.helperLayout)==null?void 0:c.paddingY)!=null?f:8,s=e.style.position==="fixed"?0:window.scrollY||document.documentElement.scrollTop;e.style.transform="",e.style.borderWidth="2px",e.style.left=`${i.left-o}px`,e.style.top=`${i.top+s-r}px`,e.style.width=`${i.width+2*o}px`,e.style.height=`${i.height+2*r}px`}}class Ht{constructor(e,n){w(this,"id");w(this,"popupData");w(this,"tour");w(this,"_hostElement",null);w(this,"_hostData");w(this,"_popupRenderer");w(this,"_helperRenderer");this.id=n.id,this.popupData=n.popup,this.tour=e,this._hostData=n.host,this._popupRenderer=e.popupRenderer,this._helperRenderer=e.helperRenderer}get isFirst(){return this.tour.stepList.indexOf(this)===0}get nextStep(){var e;return(e=this.tour.stepList[this.tour.stepList.indexOf(this)+1])!=null?e:null}get prevStep(){var e;return(e=this.tour.stepList[this.tour.stepList.indexOf(this)-1])!=null?e:null}get hasHost(){return B(this._hostElement)}get hostElement(){return this._hostElement}show(){return A(this,null,function*(){var e;H(this.tour.popup)||H(this.tour.helperLayout)||(this._hostData&&(this._hostElement=this.resolveHostElement(typeof this._hostData=="function"?this._hostData():(e=this._hostData)!=null?e:null)),yield Promise.all([this._helperRenderer.render(this.tour.helperLayout,this),this._popupRenderer.render(this.tour.popup,this)]))})}resolveHostElement(e){return typeof this._hostData=="string"?document.querySelector(this._hostData):e}}function Ee(t){return{innerHTML:`
|
|
1
|
+
"use strict";var Yt=Object.defineProperty,qt=Object.defineProperties;var Ut=Object.getOwnPropertyDescriptors;var tt=Object.getOwnPropertySymbols;var bt=Object.prototype.hasOwnProperty,_t=Object.prototype.propertyIsEnumerable;var Ct=Math.pow,ft=(e,t,n)=>t in e?Yt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,L=(e,t)=>{for(var n in t||(t={}))bt.call(t,n)&&ft(e,n,t[n]);if(tt)for(var n of tt(t))_t.call(t,n)&&ft(e,n,t[n]);return e},X=(e,t)=>qt(e,Ut(t));var Pt=(e,t)=>{var n={};for(var i in e)bt.call(e,i)&&t.indexOf(i)<0&&(n[i]=e[i]);if(e!=null&&tt)for(var i of tt(e))t.indexOf(i)<0&&_t.call(e,i)&&(n[i]=e[i]);return n};var y=(e,t,n)=>ft(e,typeof t!="symbol"?t+"":t,n);var k=(e,t,n)=>new Promise((i,o)=>{var r=a=>{try{l(n.next(a))}catch(c){o(c)}},s=a=>{try{l(n.throw(a))}catch(c){o(c)}},l=a=>a.done?i(a.value):Promise.resolve(a.value).then(r,s);l((n=n.apply(e,t)).next())});Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const Xt=["top","right","bottom","left"],Lt=["start","end"],St=Xt.reduce((e,t)=>e.concat(t,t+"-"+Lt[0],t+"-"+Lt[1]),[]),K=Math.min,z=Math.max,et=Math.round,$=e=>({x:e,y:e}),Kt={left:"right",right:"left",bottom:"top",top:"bottom"},Gt={start:"end",end:"start"};function Jt(e,t,n){return z(e,K(t,n))}function it(e,t){return typeof e=="function"?e(t):e}function J(e){return e.split("-")[0]}function M(e){return e.split("-")[1]}function Qt(e){return e==="x"?"y":"x"}function gt(e){return e==="y"?"height":"width"}function pt(e){return["top","bottom"].includes(J(e))?"y":"x"}function mt(e){return Qt(pt(e))}function Zt(e,t,n){n===void 0&&(n=!1);const i=M(e),o=mt(e),r=gt(o);let s=o==="x"?i===(n?"end":"start")?"right":"left":i==="start"?"bottom":"top";return t.reference[r]>t.floating[r]&&(s=Tt(s)),[s,Tt(s)]}function te(e){return e.replace(/start|end/g,t=>Gt[t])}function Tt(e){return e.replace(/left|right|bottom|top/g,t=>Kt[t])}function ee(e){return L({top:0,right:0,bottom:0,left:0},e)}function Dt(e){return typeof e!="number"?ee(e):{top:e,right:e,bottom:e,left:e}}function nt(e){const{x:t,y:n,width:i,height:o}=e;return{width:i,height:o,top:n,left:t,right:t+i,bottom:n+o,x:t,y:n}}function Rt(e,t,n){let{reference:i,floating:o}=e;const r=pt(t),s=mt(t),l=gt(s),a=J(t),c=r==="y",h=i.x+i.width/2-o.width/2,f=i.y+i.height/2-o.height/2,g=i[l]/2-o[l]/2;let u;switch(a){case"top":u={x:h,y:i.y-o.height};break;case"bottom":u={x:h,y:i.y+i.height};break;case"right":u={x:i.x+i.width,y:f};break;case"left":u={x:i.x-o.width,y:f};break;default:u={x:i.x,y:i.y}}switch(M(t)){case"start":u[s]-=g*(n&&c?-1:1);break;case"end":u[s]+=g*(n&&c?-1:1);break}return u}const ne=(e,t,n)=>k(exports,null,function*(){const{placement:i="bottom",strategy:o="absolute",middleware:r=[],platform:s}=n,l=r.filter(Boolean),a=yield s.isRTL==null?void 0:s.isRTL(t);let c=yield s.getElementRects({reference:e,floating:t,strategy:o}),{x:h,y:f}=Rt(c,i,a),g=i,u={},d=0;for(let p=0;p<l.length;p++){const{name:w,fn:x}=l[p],{x:_,y:m,data:v,reset:b}=yield x({x:h,y:f,initialPlacement:i,placement:g,strategy:o,middlewareData:u,rects:c,platform:s,elements:{reference:e,floating:t}});h=_!=null?_:h,f=m!=null?m:f,u=X(L({},u),{[w]:L(L({},u[w]),v)}),b&&d<=50&&(d++,typeof b=="object"&&(b.placement&&(g=b.placement),b.rects&&(c=b.rects===!0?yield s.getElementRects({reference:e,floating:t,strategy:o}):b.rects),{x:h,y:f}=Rt(c,g,a)),p=-1)}return{x:h,y:f,placement:g,strategy:o,middlewareData:u}});function ie(e,t){return k(this,null,function*(){var n;t===void 0&&(t={});const{x:i,y:o,platform:r,rects:s,elements:l,strategy:a}=e,{boundary:c="clippingAncestors",rootBoundary:h="viewport",elementContext:f="floating",altBoundary:g=!1,padding:u=0}=it(t,e),d=Dt(u),w=l[g?f==="floating"?"reference":"floating":f],x=nt(yield r.getClippingRect({element:(n=yield r.isElement==null?void 0:r.isElement(w))==null||n?w:w.contextElement||(yield r.getDocumentElement==null?void 0:r.getDocumentElement(l.floating)),boundary:c,rootBoundary:h,strategy:a})),_=f==="floating"?{x:i,y:o,width:s.floating.width,height:s.floating.height}:s.reference,m=yield r.getOffsetParent==null?void 0:r.getOffsetParent(l.floating),v=(yield r.isElement==null?void 0:r.isElement(m))?(yield r.getScale==null?void 0:r.getScale(m))||{x:1,y:1}:{x:1,y:1},b=nt(r.convertOffsetParentRelativeRectToViewportRelativeRect?yield r.convertOffsetParentRelativeRectToViewportRelativeRect({elements:l,rect:_,offsetParent:m,strategy:a}):_);return{top:(x.top-b.top+d.top)/v.y,bottom:(b.bottom-x.bottom+d.bottom)/v.y,left:(x.left-b.left+d.left)/v.x,right:(b.right-x.right+d.right)/v.x}})}const oe=e=>({name:"arrow",options:e,fn(n){return k(this,null,function*(){const{x:i,y:o,placement:r,rects:s,platform:l,elements:a,middlewareData:c}=n,{element:h,padding:f=0}=it(e,n)||{};if(h==null)return{};const g=Dt(f),u={x:i,y:o},d=mt(r),p=gt(d),w=yield l.getDimensions(h),x=d==="y",_=x?"top":"left",m=x?"bottom":"right",v=x?"clientHeight":"clientWidth",b=s.reference[p]+s.reference[d]-u[d]-s.floating[p],B=u[d]-s.reference[d],V=yield l.getOffsetParent==null?void 0:l.getOffsetParent(h);let H=V?V[v]:0;(!H||!(yield l.isElement==null?void 0:l.isElement(V)))&&(H=a.floating[v]||s.floating[p]);const vt=b/2-B/2,q=H/2-w[p]/2-1,U=K(g[_],q),C=K(g[m],q),E=U,Z=H-w[p]-C,D=H/2-w[p]/2+vt,lt=Jt(E,D,Z),ct=!c.arrow&&M(r)!=null&&D!==lt&&s.reference[p]/2-(D<E?U:C)-w[p]/2<0,at=ct?D<E?D-E:D-Z:0;return{[d]:u[d]+at,data:L({[d]:lt,centerOffset:D-lt-at},ct&&{alignmentOffset:at}),reset:ct}})}});function se(e,t,n){return(e?[...n.filter(o=>M(o)===e),...n.filter(o=>M(o)!==e)]:n.filter(o=>J(o)===o)).filter(o=>e?M(o)===e||(t?te(o)!==o:!1):!0)}const re=function(e){return e===void 0&&(e={}),{name:"autoPlacement",options:e,fn(n){return k(this,null,function*(){var i,o,r;const{rects:s,middlewareData:l,placement:a,platform:c,elements:h}=n,U=it(e,n),{crossAxis:f=!1,alignment:g,allowedPlacements:u=St,autoAlignment:d=!0}=U,p=Pt(U,["crossAxis","alignment","allowedPlacements","autoAlignment"]),w=g!==void 0||u===St?se(g||null,d,u):u,x=yield ie(n,p),_=((i=l.autoPlacement)==null?void 0:i.index)||0,m=w[_];if(m==null)return{};const v=Zt(m,s,yield c.isRTL==null?void 0:c.isRTL(h.floating));if(a!==m)return{reset:{placement:w[0]}};const b=[x[J(m)],x[v[0]],x[v[1]]],B=[...((o=l.autoPlacement)==null?void 0:o.overflows)||[],{placement:m,overflows:b}],V=w[_+1];if(V)return{data:{index:_+1,overflows:B},reset:{placement:V}};const H=B.map(C=>{const E=M(C.placement);return[C.placement,E&&f?C.overflows.slice(0,2).reduce((Z,D)=>Z+D,0):C.overflows[0],C.overflows]}).sort((C,E)=>C[1]-E[1]),q=((r=H.filter(C=>C[2].slice(0,M(C[0])?2:3).every(E=>E<=0))[0])==null?void 0:r[0])||H[0][0];return q!==a?{data:{index:_+1,overflows:B},reset:{placement:q}}:{}})}}};function le(e,t){return k(this,null,function*(){const{placement:n,platform:i,elements:o}=e,r=yield i.isRTL==null?void 0:i.isRTL(o.floating),s=J(n),l=M(n),a=pt(n)==="y",c=["left","top"].includes(s)?-1:1,h=r&&a?-1:1,f=it(t,e);let{mainAxis:g,crossAxis:u,alignmentAxis:d}=typeof f=="number"?{mainAxis:f,crossAxis:0,alignmentAxis:null}:{mainAxis:f.mainAxis||0,crossAxis:f.crossAxis||0,alignmentAxis:f.alignmentAxis};return l&&typeof d=="number"&&(u=l==="end"?d*-1:d),a?{x:u*h,y:g*c}:{x:g*c,y:u*h}})}const ce=function(e){return e===void 0&&(e=0),{name:"offset",options:e,fn(n){return k(this,null,function*(){var i,o;const{x:r,y:s,placement:l,middlewareData:a}=n,c=yield le(n,e);return l===((i=a.offset)==null?void 0:i.placement)&&(o=a.arrow)!=null&&o.alignmentOffset?{}:{x:r+c.x,y:s+c.y,data:X(L({},c),{placement:l})}})}}};function ot(){return typeof window!="undefined"}function Y(e){return kt(e)?(e.nodeName||"").toLowerCase():"#document"}function P(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function F(e){var t;return(t=(kt(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function kt(e){return ot()?e instanceof Node||e instanceof P(e).Node:!1}function R(e){return ot()?e instanceof Element||e instanceof P(e).Element:!1}function A(e){return ot()?e instanceof HTMLElement||e instanceof P(e).HTMLElement:!1}function Ot(e){return!ot()||typeof ShadowRoot=="undefined"?!1:e instanceof ShadowRoot||e instanceof P(e).ShadowRoot}function Q(e){const{overflow:t,overflowX:n,overflowY:i,display:o}=O(e);return/auto|scroll|overlay|hidden|clip/.test(t+i+n)&&!["inline","contents"].includes(o)}function ae(e){return["table","td","th"].includes(Y(e))}function st(e){return[":popover-open",":modal"].some(t=>{try{return e.matches(t)}catch(n){return!1}})}function wt(e){const t=xt(),n=R(e)?O(e):e;return n.transform!=="none"||n.perspective!=="none"||(n.containerType?n.containerType!=="normal":!1)||!t&&(n.backdropFilter?n.backdropFilter!=="none":!1)||!t&&(n.filter?n.filter!=="none":!1)||["transform","perspective","filter"].some(i=>(n.willChange||"").includes(i))||["paint","layout","strict","content"].some(i=>(n.contain||"").includes(i))}function fe(e){let t=N(e);for(;A(t)&&!I(t);){if(wt(t))return t;if(st(t))return null;t=N(t)}return null}function xt(){return typeof CSS=="undefined"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}function I(e){return["html","body","#document"].includes(Y(e))}function O(e){return P(e).getComputedStyle(e)}function rt(e){return R(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function N(e){if(Y(e)==="html")return e;const t=e.assignedSlot||e.parentNode||Ot(e)&&e.host||F(e);return Ot(t)?t.host:t}function Mt(e){const t=N(e);return I(t)?e.ownerDocument?e.ownerDocument.body:e.body:A(t)&&Q(t)?t:Mt(t)}function ut(e,t,n){var i;t===void 0&&(t=[]),n===void 0&&(n=!0);const o=Mt(e),r=o===((i=e.ownerDocument)==null?void 0:i.body),s=P(o);if(r){const l=dt(s);return t.concat(s,s.visualViewport||[],Q(o)?o:[],l&&n?ut(l):[])}return t.concat(o,ut(o,[],n))}function dt(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function Ft(e){const t=O(e);let n=parseFloat(t.width)||0,i=parseFloat(t.height)||0;const o=A(e),r=o?e.offsetWidth:n,s=o?e.offsetHeight:i,l=et(n)!==r||et(i)!==s;return l&&(n=r,i=s),{width:n,height:i,$:l}}function Bt(e){return R(e)?e:e.contextElement}function j(e){const t=Bt(e);if(!A(t))return $(1);const n=t.getBoundingClientRect(),{width:i,height:o,$:r}=Ft(t);let s=(r?et(n.width):n.width)/i,l=(r?et(n.height):n.height)/o;return(!s||!Number.isFinite(s))&&(s=1),(!l||!Number.isFinite(l))&&(l=1),{x:s,y:l}}const he=$(0);function Ht(e){const t=P(e);return!xt()||!t.visualViewport?he:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function ue(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==P(e)?!1:t}function G(e,t,n,i){t===void 0&&(t=!1),n===void 0&&(n=!1);const o=e.getBoundingClientRect(),r=Bt(e);let s=$(1);t&&(i?R(i)&&(s=j(i)):s=j(e));const l=ue(r,n,i)?Ht(r):$(0);let a=(o.left+l.x)/s.x,c=(o.top+l.y)/s.y,h=o.width/s.x,f=o.height/s.y;if(r){const g=P(r),u=i&&R(i)?P(i):i;let d=g,p=dt(d);for(;p&&i&&u!==d;){const w=j(p),x=p.getBoundingClientRect(),_=O(p),m=x.left+(p.clientLeft+parseFloat(_.paddingLeft))*w.x,v=x.top+(p.clientTop+parseFloat(_.paddingTop))*w.y;a*=w.x,c*=w.y,h*=w.x,f*=w.y,a+=m,c+=v,d=P(p),p=dt(d)}}return nt({width:h,height:f,x:a,y:c})}function yt(e,t){const n=rt(e).scrollLeft;return t?t.left+n:G(F(e)).left+n}function Nt(e,t,n){n===void 0&&(n=!1);const i=e.getBoundingClientRect(),o=i.left+t.scrollLeft-(n?0:yt(e,i)),r=i.top+t.scrollTop;return{x:o,y:r}}function de(e){let{elements:t,rect:n,offsetParent:i,strategy:o}=e;const r=o==="fixed",s=F(i),l=t?st(t.floating):!1;if(i===s||l&&r)return n;let a={scrollLeft:0,scrollTop:0},c=$(1);const h=$(0),f=A(i);if((f||!f&&!r)&&((Y(i)!=="body"||Q(s))&&(a=rt(i)),A(i))){const u=G(i);c=j(i),h.x=u.x+i.clientLeft,h.y=u.y+i.clientTop}const g=s&&!f&&!r?Nt(s,a,!0):$(0);return{width:n.width*c.x,height:n.height*c.y,x:n.x*c.x-a.scrollLeft*c.x+h.x+g.x,y:n.y*c.y-a.scrollTop*c.y+h.y+g.y}}function ge(e){return Array.from(e.getClientRects())}function pe(e){const t=F(e),n=rt(e),i=e.ownerDocument.body,o=z(t.scrollWidth,t.clientWidth,i.scrollWidth,i.clientWidth),r=z(t.scrollHeight,t.clientHeight,i.scrollHeight,i.clientHeight);let s=-n.scrollLeft+yt(e);const l=-n.scrollTop;return O(i).direction==="rtl"&&(s+=z(t.clientWidth,i.clientWidth)-o),{width:o,height:r,x:s,y:l}}function me(e,t){const n=P(e),i=F(e),o=n.visualViewport;let r=i.clientWidth,s=i.clientHeight,l=0,a=0;if(o){r=o.width,s=o.height;const c=xt();(!c||c&&t==="fixed")&&(l=o.offsetLeft,a=o.offsetTop)}return{width:r,height:s,x:l,y:a}}function we(e,t){const n=G(e,!0,t==="fixed"),i=n.top+e.clientTop,o=n.left+e.clientLeft,r=A(e)?j(e):$(1),s=e.clientWidth*r.x,l=e.clientHeight*r.y,a=o*r.x,c=i*r.y;return{width:s,height:l,x:a,y:c}}function Et(e,t,n){let i;if(t==="viewport")i=me(e,n);else if(t==="document")i=pe(F(e));else if(R(t))i=we(t,n);else{const o=Ht(e);i={x:t.x-o.x,y:t.y-o.y,width:t.width,height:t.height}}return nt(i)}function Vt(e,t){const n=N(e);return n===t||!R(n)||I(n)?!1:O(n).position==="fixed"||Vt(n,t)}function xe(e,t){const n=t.get(e);if(n)return n;let i=ut(e,[],!1).filter(l=>R(l)&&Y(l)!=="body"),o=null;const r=O(e).position==="fixed";let s=r?N(e):e;for(;R(s)&&!I(s);){const l=O(s),a=wt(s);!a&&l.position==="fixed"&&(o=null),(r?!a&&!o:!a&&l.position==="static"&&!!o&&["absolute","fixed"].includes(o.position)||Q(s)&&!a&&Vt(e,s))?i=i.filter(h=>h!==s):o=l,s=N(s)}return t.set(e,i),i}function ye(e){let{element:t,boundary:n,rootBoundary:i,strategy:o}=e;const s=[...n==="clippingAncestors"?st(t)?[]:xe(t,this._c):[].concat(n),i],l=s[0],a=s.reduce((c,h)=>{const f=Et(t,h,o);return c.top=z(f.top,c.top),c.right=K(f.right,c.right),c.bottom=K(f.bottom,c.bottom),c.left=z(f.left,c.left),c},Et(t,l,o));return{width:a.right-a.left,height:a.bottom-a.top,x:a.left,y:a.top}}function ve(e){const{width:t,height:n}=Ft(e);return{width:t,height:n}}function be(e,t,n){const i=A(t),o=F(t),r=n==="fixed",s=G(e,!0,r,t);let l={scrollLeft:0,scrollTop:0};const a=$(0);if(i||!i&&!r)if((Y(t)!=="body"||Q(o))&&(l=rt(t)),i){const g=G(t,!0,r,t);a.x=g.x+t.clientLeft,a.y=g.y+t.clientTop}else o&&(a.x=yt(o));const c=o&&!i&&!r?Nt(o,l):$(0),h=s.left+l.scrollLeft-a.x-c.x,f=s.top+l.scrollTop-a.y-c.y;return{x:h,y:f,width:s.width,height:s.height}}function ht(e){return O(e).position==="static"}function $t(e,t){if(!A(e)||O(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return F(e)===n&&(n=n.ownerDocument.body),n}function Wt(e,t){const n=P(e);if(st(e))return n;if(!A(e)){let o=N(e);for(;o&&!I(o);){if(R(o)&&!ht(o))return o;o=N(o)}return n}let i=$t(e,t);for(;i&&ae(i)&&ht(i);)i=$t(i,t);return i&&I(i)&&ht(i)&&!wt(i)?n:i||fe(e)||n}const _e=function(e){return k(this,null,function*(){const t=this.getOffsetParent||Wt,n=this.getDimensions,i=yield n(e.floating);return{reference:be(e.reference,yield t(e.floating),e.strategy),floating:{x:0,y:0,width:i.width,height:i.height}}})};function Ce(e){return O(e).direction==="rtl"}const Pe={convertOffsetParentRelativeRectToViewportRelativeRect:de,getDocumentElement:F,getClippingRect:ye,getOffsetParent:Wt,getElementRects:_e,getClientRects:ge,getDimensions:ve,getScale:j,isElement:R,isRTL:Ce},Le=ce,Se=re,Te=oe,Re=(e,t,n)=>{const i=new Map,o=L({platform:Pe},n),r=X(L({},o.platform),{_c:i});return ne(e,t,X(L({},o),{platform:r}))};function W(e){return e===null||typeof e=="undefined"}function T(e){return!W(e)}function At(e){return new Promise(t=>setTimeout(t,e))}function zt(e){var i;const t=e.parentElement;return!t||t.nodeName==="HTML"?!1:((i=document.defaultView)==null?void 0:i.getComputedStyle(e,null).getPropertyValue("position"))==="fixed"?!0:zt(t)}function jt(e){return zt(e)?"fixed":"absolute"}class Oe{renderContent(t,n,i){t.querySelector(`.${i.classPrefix}-content`).appendChild(n.node)}}function S(e,t){const n=document.createElement(e);return t&&t.length>0&&(t=t.filter(i=>i),n.classList.add(...t)),n}class Ee{renderContent(t,n,i){var r,s,l,a;const o=t.querySelector(`.${i.classPrefix}-content`);if(n.imgSrc){const c=S("img",[`${i.classPrefix}-image`,`${(s=(r=n.customization)==null?void 0:r.imageClass)!=null?s:""}`]);c.src=n.imgSrc,o.appendChild(c)}if(n.text){const c=S("p",[`${i.classPrefix}-description`,`${(a=(l=n.customization)==null?void 0:l.descriptionClass)!=null?a:""}`]);c.innerText=i.translateFn(n.text),o.appendChild(c)}}}function $e(e,t,n){var l,a,c,h,f,g,u,d,p,w,x,_;if(e.innerHTML="",e.className=`${n.config.classPrefix} ${n.config.animationClass}`,n.config.enableArrow){const m=S("div",[`${n.config.classPrefix}-arrow`]);e.appendChild(m)}(l=t.customization)!=null&&l.class&&e.classList.add(t.customization.class);const i=S("div",[`${n.config.classPrefix}-header`,`${(c=(a=t.customization)==null?void 0:a.headerClass)!=null?c:""}`]);e.appendChild(i);const o=S("h1",[`${n.config.classPrefix}-title`,`${(f=(h=t.customization)==null?void 0:h.titleClass)!=null?f:""}`]);if(o.innerHTML=n.config.translateFn((g=t.title)!=null?g:""),i.appendChild(o),n.config.allowClose){const m=S("button",[`${n.config.classPrefix}-close`,`${(d=(u=t.customization)==null?void 0:u.closeButtonClass)!=null?d:""}`]);Ae(m,n.config.closeIcon),m.onclick=n.complete.bind(n),i.appendChild(m)}const r=S("div",[`${n.config.classPrefix}-content`,`${(w=(p=t.customization)==null?void 0:p.contentClass)!=null?w:""}`]);e.appendChild(r);const s=S("div",[`${n.config.classPrefix}-footer`,`${(_=(x=t.customization)==null?void 0:x.footerClass)!=null?_:""}`]);W(t.buttonList)&&(t.buttonList=De(n)),t.buttonList.forEach(m=>{var B;const v=[`${n.config.classPrefix}-button`,(B=m.class)!=null?B:""];W(m.type)||m.type==="secondary"?v.push(`${n.config.classPrefix}-button-secondary`):m.type==="primary"?v.push(`${n.config.classPrefix}-button-primary`):m.type==="link"&&v.push(`${n.config.classPrefix}-button-link`),!W(m.class)&&m.class!==""&&v.push(m.class);const b=S("button",v);b.innerText=n.config.translateFn(m.text),b.onclick=V=>{m.action.call(n)},s.appendChild(b)}),e.appendChild(s)}function Ae(e,t){t instanceof HTMLElement?e.appendChild(t):e.innerHTML=t.innerHTML}function De(e){return[{text:"Back",action:e.prev},{text:"Next",type:"primary",action:e.next}]}class ke{constructor(){y(this,"_renderContentStrategy",new Map);y(this,"_staticSides",{top:"bottom",right:"left",bottom:"top",left:"right"});this.setUpStrategies()}render(t,n){return new Promise(i=>{var o,r;if(!this._renderContentStrategy.has(n.popupData.type))throw new Error("Missing popup creator strategy");t.style.display="none",t.classList.remove(n.tour.config.animationClass),n.hostElement?t.style.position=jt(n.hostElement):t.style.position="fixed",$e(t,n.popupData,n.tour),(o=this._renderContentStrategy.get(n.popupData.type))==null||o.renderContent(t,n.popupData,n.tour.config),(r=n.hostElement)==null||r.scrollIntoView(n.tour.config.scrollTo),i()}).then(()=>n.isFirst&&n.direction==="toNext"?At(0):At(400)).then(()=>{t.style.display="block",this.updatePosition(t,n),t.classList.add(n.tour.config.animationClass)})}updatePosition(t,n){T(n.hostElement)?this.renderFloatingPopup(t,n):this.renderCenterPopup(t)}renderFloatingPopup(t,n){var c;const i=t.style.position==="fixed"?window.scrollY||document.documentElement.scrollTop:0,o=t.querySelector(`.${n.tour.config.classPrefix}-arrow`),r=[],s=T(n.popupData.position)&&n.popupData.position!=="auto"?n.popupData.position:void 0,l=(c=o==null?void 0:o.offsetWidth)!=null?c:10,a=Math.sqrt(2*Ct(l,2))/2+n.tour.config.highlight.padding;r.push(Le(a)),(n.popupData.position==="auto"||W(s))&&r.push(Se()),n.tour.config.enableArrow&&T(o)&&r.push(Te({element:o})),Re(n.hostElement,t,{placement:s,middleware:[...r]}).then(({x:h,y:f,middlewareData:g,placement:u})=>{Object.assign(t.style,{top:`${f-i}px`,left:`${h}px`,marginTop:"0",marginLeft:"0"});const d=u.split("-")[0],p=this._staticSides[d];if(g.arrow&&T(o)){const{x:w,y:x}=g.arrow;Object.assign(o.style,{left:w!=null?`${w}px`:"",top:x!=null?`${x}px`:"",right:"",bottom:"",[p]:`${-l/2}px`,transform:"rotate(45deg)"})}})}renderCenterPopup(t){Object.assign(t.style,{top:"50%",left:"50%",marginTop:`-${t.clientHeight/2}px`,marginLeft:`-${t.clientWidth/2}px`})}setUpStrategies(){this._renderContentStrategy.set("text",new Ee),this._renderContentStrategy.set("custom",new Oe)}}class Me{render(t,n){return new Promise(i=>{n.hostElement&&(t.style.position=jt(n.hostElement)),i()}).then(()=>{this.updatePosition(t,n)})}updatePosition(t,n){var s,l;if(!n.hostElement){t.style.width="0",t.style.height="0",t.style.top="50%",t.style.left="50%",t.style.transform="translate(-50%, -50%)",t.style.borderWidth="0";return}const i=n.hostElement.getBoundingClientRect(),o=(l=(s=n.tour.config.highlight)==null?void 0:s.padding)!=null?l:8,r=t.style.position==="fixed"?0:window.scrollY||document.documentElement.scrollTop;t.style.transform="",t.style.borderWidth="2px",t.style.left=`${i.left-o}px`,t.style.top=`${i.top+r-o}px`,t.style.width=`${i.width+2*o}px`,t.style.height=`${i.height+2*o}px`}}class It{constructor(t,n){y(this,"id");y(this,"popupData");y(this,"tour");y(this,"index");y(this,"_hostElement",null);y(this,"_direction","toNext");y(this,"_hostData");y(this,"_popupRenderer");y(this,"_highlightRenderer");var i;this.id=n.id,this.popupData=n.popup,this.tour=t,this.index=(i=n.index)!=null?i:null,this._hostData=n.host,this._popupRenderer=t.popupRenderer,this._highlightRenderer=t.highlightRenderer}get isFirst(){return this.index===0}get nextStep(){var t;return(t=this.tour.stepList[this.tour.stepList.indexOf(this)+1])!=null?t:null}get prevStep(){var t;return(t=this.tour.stepList[this.tour.stepList.indexOf(this)-1])!=null?t:null}get direction(){return this._direction}get hasHost(){return T(this._hostElement)}get hostElement(){return this._hostElement}show(t){return k(this,null,function*(){var i;if(W(this.tour.popup))return;this._direction=t,this._hostData&&(this._hostElement=this.resolveHostElement(typeof this._hostData=="function"?this._hostData():(i=this._hostData)!=null?i:null));const n=[this._popupRenderer.render(this.tour.popup,this)];!this.tour.config.highlight.disable&&!W(this.tour.highlight)&&n.push(this._highlightRenderer.render(this.tour.highlight,this)),yield Promise.all(n)})}resolveHostElement(t){return typeof this._hostData=="string"?document.querySelector(this._hostData):t}}function Fe(e){return{innerHTML:`
|
|
2
2
|
<svg
|
|
3
3
|
xmlns="http://www.w3.org/2000/svg"
|
|
4
4
|
fill="none"
|
|
5
5
|
viewBox="0 0 162 162"
|
|
6
|
-
class="${
|
|
6
|
+
class="${e}-close-icon"
|
|
7
7
|
>
|
|
8
8
|
<path
|
|
9
9
|
stroke-linecap="round"
|
|
@@ -18,4 +18,4 @@
|
|
|
18
18
|
d="M9.01074 153L153.021 8.98926"
|
|
19
19
|
></path>
|
|
20
20
|
</svg>
|
|
21
|
-
`}}class
|
|
21
|
+
`}}class Be{constructor(t){y(this,"popupRenderer",new ke);y(this,"highlightRenderer",new Me);y(this,"_popup",null);y(this,"_highlight",null);y(this,"_stepList",[]);y(this,"_activeStep",null);y(this,"_bodyResizeObserver");y(this,"_config");y(this,"_stepMap",new Map);var n,i,o,r,s,l,a,c,h,f,g,u,d,p,w;this._bodyResizeObserver=this.getBodyResizeObserver(),this._config={classPrefix:(n=t.classPrefix)!=null?n:"siteguide",animationClass:(i=t.animationClass)!=null?i:"siteguide-animation",allowClose:(o=t.allowClose)!=null?o:!0,scrollTo:(r=t.scrollTo)!=null?r:{behavior:"smooth",block:"center",inline:"center"},allowClickoutClose:(s=t.allowClickoutClose)!=null?s:!1,closeIcon:(a=t.closeIcon)!=null?a:Fe((l=t.classPrefix)!=null?l:"siteguide"),enableArrow:(c=t.enableArrow)!=null?c:!0,highlight:{disable:(f=(h=t.highlight)==null?void 0:h.disable)!=null?f:!1,padding:(u=(g=t.highlight)==null?void 0:g.padding)!=null?u:8,class:(p=(d=t.highlight)==null?void 0:d.class)!=null?p:"siteguide-highlight"},translateFn:(w=t.translateFn)!=null?w:x=>x}}get stepList(){return this._stepList}get config(){return this._config}get popup(){return this._popup}get highlight(){return this._highlight}addStep(t){if(this._stepMap.has(t.id))throw new Error("Step with provided id has been already registered");const n=new It(this,t);T(t.index)?this._stepList.splice(t.index,0,n):this._stepList.push(n),this._stepMap.set(t.id,n)}addSteps(t){t.forEach(n=>this.addStep(n))}removeStep(t){this._stepList=this._stepList.filter(n=>t!==n.id),this._stepMap.delete(t)}start(){this._popup=S("div",[this._config.classPrefix]),document.body.appendChild(this._popup),this._config.highlight.disable||(this._highlight=S("div",[T(this._config.highlight.class)?this._config.highlight.class:`${this._config.classPrefix}-highlight`]),document.body.appendChild(this._highlight)),this.next()}complete(){this._popup&&document.body.removeChild(this._popup),this._highlight&&document.body.removeChild(this._highlight),this._activeStep=null}prev(){const t=T(this._activeStep)?this._stepList.indexOf(this._activeStep)-1:this._stepList.indexOf(this._stepList[this._stepList.length-1]);if(t<0){this.complete();return}this._activeStep=this._stepList[t],this._activeStep.show("fromBack")}next(){const t=T(this._activeStep)?this._stepList.indexOf(this._activeStep)+1:this._stepList.indexOf(this._stepList[0]);if(t>=this._stepList.length){this.complete();return}this._activeStep=this._stepList[t],this._activeStep.show("toNext")}setConfig(t){this._config=L(L({},this._config),t)}getBodyResizeObserver(){const t=new ResizeObserver(()=>{this._activeStep&&(T(this._popup)&&this.popupRenderer.updatePosition(this._popup,this._activeStep),T(this._highlight)&&!this.config.highlight.disable&&this.highlightRenderer.updatePosition(this._highlight,this._activeStep))});return t.observe(document.body),t}}exports.Tour=Be;exports.TourStep=It;exports.createElement=S;
|