@aquera/nile-elements 0.1.25 → 0.1.26
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 +9 -0
- package/demo/filenames.txt +1 -1
- package/demo/index.html +0 -2
- package/demo/variables.css +1 -0
- package/demo/variables_v2.css +1 -0
- package/dist/index.cjs.js +1 -1
- package/dist/index.esm.js +1 -1
- package/dist/lit-element-9e4e16c6.cjs.js +18 -0
- package/dist/lit-element-9e4e16c6.cjs.js.map +1 -0
- package/dist/lit-element-a5a64515.esm.js +23 -0
- package/dist/nile-avatar/nile-avatar.test.cjs.js +1 -1
- package/dist/nile-avatar/nile-avatar.test.cjs.js.map +1 -1
- package/dist/nile-avatar/nile-avatar.test.esm.js +1 -1
- package/dist/nile-badge/index.cjs.js +1 -1
- package/dist/nile-badge/index.esm.js +1 -1
- package/dist/nile-badge/nile-badge.cjs.js +1 -1
- package/dist/nile-badge/nile-badge.cjs.js.map +1 -1
- package/dist/nile-badge/nile-badge.esm.js +1 -1
- package/dist/nile-badge/nile-badge.test.cjs.js +1 -1
- package/dist/nile-badge/nile-badge.test.cjs.js.map +1 -1
- package/dist/nile-badge/nile-badge.test.esm.js +1 -1
- package/dist/nile-button/index.cjs.js +1 -1
- package/dist/nile-button/index.esm.js +1 -1
- package/dist/nile-button/nile-button.cjs.js +1 -1
- package/dist/nile-button/nile-button.cjs.js.map +1 -1
- package/dist/nile-button/nile-button.esm.js +1 -1
- package/dist/nile-button/nile-button.test.cjs.js +1 -1
- package/dist/nile-button/nile-button.test.cjs.js.map +1 -1
- package/dist/nile-button/nile-button.test.esm.js +1 -1
- package/dist/nile-calendar/nile-calendar.test.cjs.js +1 -1
- package/dist/nile-calendar/nile-calendar.test.cjs.js.map +1 -1
- package/dist/nile-calendar/nile-calendar.test.esm.js +1 -1
- package/dist/nile-chip/nile-chip.test.cjs.js +1 -1
- package/dist/nile-chip/nile-chip.test.cjs.js.map +1 -1
- package/dist/nile-chip/nile-chip.test.esm.js +1 -1
- package/dist/nile-dialog/index.cjs.js +1 -1
- package/dist/nile-dialog/index.esm.js +1 -1
- package/dist/nile-dialog/nile-dialog.cjs.js +1 -1
- package/dist/nile-dialog/nile-dialog.cjs.js.map +1 -1
- package/dist/nile-dialog/nile-dialog.esm.js +1 -1
- package/dist/nile-dialog/nile-dialog.test.cjs.js +1 -1
- package/dist/nile-dialog/nile-dialog.test.cjs.js.map +1 -1
- package/dist/nile-dialog/nile-dialog.test.esm.js +1 -1
- package/dist/nile-drawer/index.cjs.js +1 -1
- package/dist/nile-drawer/index.esm.js +1 -1
- package/dist/nile-drawer/nile-drawer.cjs.js +1 -1
- package/dist/nile-drawer/nile-drawer.cjs.js.map +1 -1
- package/dist/nile-drawer/nile-drawer.esm.js +1 -1
- package/dist/nile-drawer/nile-drawer.test.cjs.js +1 -1
- package/dist/nile-drawer/nile-drawer.test.cjs.js.map +1 -1
- package/dist/nile-drawer/nile-drawer.test.esm.js +1 -1
- package/dist/nile-highlighter/index.cjs.js +1 -1
- package/dist/nile-highlighter/index.esm.js +1 -1
- package/dist/nile-highlighter/nile-highlighter.cjs.js +1 -1
- package/dist/nile-highlighter/nile-highlighter.esm.js +1 -1
- package/dist/nile-icon/icons/svg/comment.cjs.js +2 -0
- package/dist/nile-icon/icons/svg/comment.cjs.js.map +1 -0
- package/dist/nile-icon/icons/svg/comment.esm.js +1 -0
- package/dist/nile-icon/icons/svg/index.cjs.js +1 -1
- package/dist/nile-icon/icons/svg/index.esm.js +1 -1
- package/dist/nile-icon/icons/svg/returnvalue.cjs.js +1 -1
- package/dist/nile-icon/icons/svg/returnvalue.cjs.js.map +1 -1
- package/dist/nile-icon/icons/svg/returnvalue.esm.js +1 -1
- package/dist/nile-icon/index.cjs.js +1 -1
- package/dist/nile-icon/index.cjs.js.map +1 -1
- package/dist/nile-icon/index.esm.js +1 -1
- package/dist/nile-icon/nile-icon.test.cjs.js +1 -1
- package/dist/nile-icon/nile-icon.test.cjs.js.map +1 -1
- package/dist/nile-icon/nile-icon.test.esm.js +1 -1
- package/dist/nile-icon-button/index.cjs.js +1 -1
- package/dist/nile-icon-button/index.esm.js +1 -1
- package/dist/nile-icon-button/nile-icon-button.cjs.js +1 -1
- package/dist/nile-icon-button/nile-icon-button.cjs.js.map +1 -1
- package/dist/nile-icon-button/nile-icon-button.esm.js +1 -1
- package/dist/nile-input/index.cjs.js +1 -1
- package/dist/nile-input/index.esm.js +1 -1
- package/dist/nile-input/nile-input.cjs.js +1 -1
- package/dist/nile-input/nile-input.cjs.js.map +1 -1
- package/dist/nile-input/nile-input.esm.js +1 -1
- package/dist/nile-input/nile-input.test.cjs.js +1 -1
- package/dist/nile-input/nile-input.test.cjs.js.map +1 -1
- package/dist/nile-input/nile-input.test.esm.js +1 -1
- package/dist/nile-menu-item/index.cjs.js +1 -1
- package/dist/nile-menu-item/index.esm.js +1 -1
- package/dist/nile-menu-item/nile-menu-item.cjs.js +1 -1
- package/dist/nile-menu-item/nile-menu-item.cjs.js.map +1 -1
- package/dist/nile-menu-item/nile-menu-item.esm.js +1 -1
- package/dist/nile-option/index.cjs.js +1 -1
- package/dist/nile-option/index.esm.js +1 -1
- package/dist/nile-option/nile-option.cjs.js +1 -1
- package/dist/nile-option/nile-option.cjs.js.map +1 -1
- package/dist/nile-option/nile-option.esm.js +1 -1
- package/dist/nile-popover/index.cjs.js +1 -1
- package/dist/nile-popover/index.esm.js +1 -1
- package/dist/nile-popover/nile-popover.cjs.js +1 -1
- package/dist/nile-popover/nile-popover.esm.js +1 -1
- package/dist/nile-popover/nile-popover.test.cjs.js +1 -1
- package/dist/nile-popover/nile-popover.test.esm.js +1 -1
- package/dist/nile-select/index.cjs.js +1 -1
- package/dist/nile-select/index.esm.js +1 -1
- package/dist/nile-select/nile-select.cjs.js +1 -1
- package/dist/nile-select/nile-select.cjs.js.map +1 -1
- package/dist/nile-select/nile-select.esm.js +1 -1
- package/dist/nile-select/nile-select.test.cjs.js +1 -1
- package/dist/nile-select/nile-select.test.cjs.js.map +1 -1
- package/dist/nile-select/nile-select.test.esm.js +1 -1
- package/dist/nile-slide-toggle/nile-slide-toggle.cjs.js +1 -1
- package/dist/nile-slide-toggle/nile-slide-toggle.cjs.js.map +1 -1
- package/dist/nile-slide-toggle/nile-slide-toggle.esm.js +2 -2
- package/dist/nile-slide-toggle/nile-slide-toggle.test.cjs.js +1 -1
- package/dist/nile-slide-toggle/nile-slide-toggle.test.cjs.js.map +1 -1
- package/dist/nile-slide-toggle/nile-slide-toggle.test.esm.js +1 -1
- package/dist/nile-tab/index.cjs.js +1 -1
- package/dist/nile-tab/index.esm.js +1 -1
- package/dist/nile-tab/nile-tab.cjs.js +1 -1
- package/dist/nile-tab/nile-tab.cjs.js.map +1 -1
- package/dist/nile-tab/nile-tab.esm.js +1 -1
- package/dist/nile-tab-group/index.cjs.js +1 -1
- package/dist/nile-tab-group/index.esm.js +1 -1
- package/dist/nile-tab-group/nile-tab-group.cjs.js +1 -1
- package/dist/nile-tab-group/nile-tab-group.cjs.js.map +1 -1
- package/dist/nile-tab-group/nile-tab-group.css.cjs.js +1 -1
- package/dist/nile-tab-group/nile-tab-group.css.cjs.js.map +1 -1
- package/dist/nile-tab-group/nile-tab-group.css.esm.js +1 -1
- package/dist/nile-tab-group/nile-tab-group.esm.js +1 -1
- package/dist/nile-tab-group/nile-tab-group.test.cjs.js +1 -1
- package/dist/nile-tab-group/nile-tab-group.test.cjs.js.map +1 -1
- package/dist/nile-tab-group/nile-tab-group.test.esm.js +1 -1
- package/dist/nile-tag/index.cjs.js +1 -1
- package/dist/nile-tag/index.esm.js +1 -1
- package/dist/nile-tag/nile-tag.cjs.js +1 -1
- package/dist/nile-tag/nile-tag.cjs.js.map +1 -1
- package/dist/nile-tag/nile-tag.esm.js +1 -1
- package/dist/nile-toast/index.cjs.js +1 -1
- package/dist/nile-toast/index.esm.js +1 -1
- package/dist/nile-toast/nile-toast.cjs.js +1 -1
- package/dist/nile-toast/nile-toast.cjs.js.map +1 -1
- package/dist/nile-toast/nile-toast.esm.js +2 -2
- package/dist/nile-tree/index.cjs.js +1 -1
- package/dist/nile-tree/index.esm.js +1 -1
- package/dist/nile-tree/nile-tree.cjs.js +1 -1
- package/dist/nile-tree/nile-tree.cjs.js.map +1 -1
- package/dist/nile-tree/nile-tree.esm.js +1 -1
- package/dist/nile-tree-item/index.cjs.js +1 -1
- package/dist/nile-tree-item/index.esm.js +1 -1
- package/dist/nile-tree-item/nile-tree-item.cjs.js +1 -1
- package/dist/nile-tree-item/nile-tree-item.cjs.js.map +1 -1
- package/dist/nile-tree-item/nile-tree-item.esm.js +1 -1
- package/dist/src/index.d.ts +0 -1
- package/dist/src/index.js +0 -1
- package/dist/src/index.js.map +1 -1
- package/dist/src/nile-icon/icons/svg/comment.d.ts +5 -0
- package/dist/src/nile-icon/icons/svg/comment.js +5 -0
- package/dist/src/nile-icon/icons/svg/comment.js.map +1 -0
- package/dist/src/nile-icon/icons/svg/index.d.ts +1 -1
- package/dist/src/nile-icon/icons/svg/index.js +1 -1
- package/dist/src/nile-icon/icons/svg/index.js.map +1 -1
- package/dist/src/nile-slide-toggle/nile-slide-toggle.js +2 -2
- package/dist/src/nile-slide-toggle/nile-slide-toggle.js.map +1 -1
- package/dist/src/nile-slide-toggle/nile-slide-toggle.test.js +2 -2
- package/dist/src/nile-slide-toggle/nile-slide-toggle.test.js.map +1 -1
- package/dist/src/nile-tab-group/nile-tab-group.css.js +1 -1
- package/dist/src/nile-tab-group/nile-tab-group.css.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +3 -4
- package/src/index.ts +1 -2
- package/src/nile-icon/icons/svg/comment.ts +5 -0
- package/src/nile-icon/icons/svg/index.ts +1 -1
- package/src/nile-slide-toggle/nile-slide-toggle.test.ts +2 -2
- package/src/nile-slide-toggle/nile-slide-toggle.ts +2 -2
- package/src/nile-tab-group/nile-tab-group.css.ts +1 -1
- package/vscode-html-custom-data.json +0 -20
- package/dist/lit-element-3b4aa6c6.esm.js +0 -23
- package/dist/lit-element-b510b02d.cjs.js +0 -14
- package/dist/lit-element-b510b02d.cjs.js.map +0 -1
- package/dist/nile-tour/index.cjs.js +0 -2
- package/dist/nile-tour/index.cjs.js.map +0 -1
- package/dist/nile-tour/index.esm.js +0 -1
- package/dist/nile-tour/nile-tour.cjs.js +0 -10
- package/dist/nile-tour/nile-tour.cjs.js.map +0 -1
- package/dist/nile-tour/nile-tour.css.cjs.js +0 -2
- package/dist/nile-tour/nile-tour.css.cjs.js.map +0 -1
- package/dist/nile-tour/nile-tour.css.esm.js +0 -233
- package/dist/nile-tour/nile-tour.esm.js +0 -24
- package/dist/src/nile-tour/index.d.ts +0 -1
- package/dist/src/nile-tour/index.js +0 -2
- package/dist/src/nile-tour/index.js.map +0 -1
- package/dist/src/nile-tour/nile-tour.css.d.ts +0 -12
- package/dist/src/nile-tour/nile-tour.css.js +0 -245
- package/dist/src/nile-tour/nile-tour.css.js.map +0 -1
- package/dist/src/nile-tour/nile-tour.d.ts +0 -36
- package/dist/src/nile-tour/nile-tour.js +0 -180
- package/dist/src/nile-tour/nile-tour.js.map +0 -1
- package/src/nile-tour/index.ts +0 -1
- package/src/nile-tour/nile-tour.css.ts +0 -247
- package/src/nile-tour/nile-tour.ts +0 -199
@@ -1,180 +0,0 @@
|
|
1
|
-
/**
|
2
|
-
* Copyright Aquera Inc 2023
|
3
|
-
*
|
4
|
-
* This source code is licensed under the BSD-3-Clause license found in the
|
5
|
-
* LICENSE file in the root directory of this source tree.
|
6
|
-
*/
|
7
|
-
import { __decorate } from "tslib";
|
8
|
-
import { LitElement, html } from 'lit';
|
9
|
-
import { customElement, property } from 'lit/decorators.js';
|
10
|
-
import introJs from 'intro.js';
|
11
|
-
import { styles } from './nile-tour.css';
|
12
|
-
let NileTour = class NileTour extends LitElement {
|
13
|
-
static get styles() {
|
14
|
-
return [styles];
|
15
|
-
}
|
16
|
-
createRenderRoot() {
|
17
|
-
return this;
|
18
|
-
}
|
19
|
-
constructor() {
|
20
|
-
super();
|
21
|
-
this.tourInstance = null;
|
22
|
-
/**
|
23
|
-
* JSON string for steps.
|
24
|
-
*/
|
25
|
-
this.stepsJson = '';
|
26
|
-
/**
|
27
|
-
* Whether to show the backdrop overlay.
|
28
|
-
*/
|
29
|
-
this.showBackdrop = false;
|
30
|
-
/**
|
31
|
-
* Whether to disable interaction during the tour.
|
32
|
-
*/
|
33
|
-
this.disableInteraction = false;
|
34
|
-
}
|
35
|
-
parseSteps() {
|
36
|
-
if (Array.isArray(this.stepsJson)) {
|
37
|
-
return this.stepsJson;
|
38
|
-
}
|
39
|
-
console.error('Invalid stepsJson format');
|
40
|
-
return [];
|
41
|
-
}
|
42
|
-
async getElementWhenNeeded(step) {
|
43
|
-
return {
|
44
|
-
element: () => document.querySelector(`[data-tour="${step.element}"]`),
|
45
|
-
intro: step.content,
|
46
|
-
title: step.title,
|
47
|
-
position: step.position,
|
48
|
-
beforeChange: step.beforeChange,
|
49
|
-
afterChange: step.afterChange,
|
50
|
-
disableNext: step.disableNext || false,
|
51
|
-
disablePrev: step.disablePrev || false
|
52
|
-
};
|
53
|
-
}
|
54
|
-
nextStep() {
|
55
|
-
this.tourInstance?.nextStep();
|
56
|
-
}
|
57
|
-
async startTour() {
|
58
|
-
const steps = await Promise.all(this.parseSteps().map(step => this.getElementWhenNeeded(step)));
|
59
|
-
if (steps.length === 0) {
|
60
|
-
console.error('No valid steps found for the tour.');
|
61
|
-
return;
|
62
|
-
}
|
63
|
-
this.tourInstance = introJs().setOptions({
|
64
|
-
steps: steps,
|
65
|
-
disableInteraction: this.disableInteraction,
|
66
|
-
nextLabel: 'Next',
|
67
|
-
prevLabel: 'Prev',
|
68
|
-
overlayOpacity: this.showBackdrop ? 0.5 : 0,
|
69
|
-
exitOnOverlayClick: false,
|
70
|
-
showProgress: false,
|
71
|
-
showButtons: true
|
72
|
-
});
|
73
|
-
this.tourInstance.onbeforechange(async (targetElement) => {
|
74
|
-
const currentStepIndex = this.tourInstance?._currentStep ?? 0;
|
75
|
-
const step = steps[currentStepIndex];
|
76
|
-
if (step && typeof step.element === 'function') {
|
77
|
-
const el = step.element();
|
78
|
-
if (el) {
|
79
|
-
if (this.tourInstance && this.tourInstance._introItems) {
|
80
|
-
this.tourInstance._introItems[currentStepIndex].element = el;
|
81
|
-
}
|
82
|
-
}
|
83
|
-
}
|
84
|
-
if (step.beforeChange) {
|
85
|
-
return await step.beforeChange();
|
86
|
-
}
|
87
|
-
return true;
|
88
|
-
});
|
89
|
-
this.tourInstance.onafterchange((targetElement) => {
|
90
|
-
const currentStepIndex = this.tourInstance?._currentStep ?? 0;
|
91
|
-
const step = steps[currentStepIndex];
|
92
|
-
if (step?.afterChange) {
|
93
|
-
step.afterChange();
|
94
|
-
}
|
95
|
-
const nextBtn = document.querySelector('.introjs-nextbutton');
|
96
|
-
const prevBtn = document.querySelector('.introjs-prevbutton');
|
97
|
-
if (nextBtn) {
|
98
|
-
nextBtn.setAttribute('disabled', step.disableNext ? 'true' : 'false');
|
99
|
-
}
|
100
|
-
if (prevBtn) {
|
101
|
-
prevBtn.setAttribute('disabled', step.disablePrev ? 'true' : 'false');
|
102
|
-
}
|
103
|
-
});
|
104
|
-
this.tourInstance.onchange(() => {
|
105
|
-
const currentStep = this.tourInstance?._currentStep ?? 0;
|
106
|
-
const totalSteps = steps.length;
|
107
|
-
const tooltip = document.querySelector('.introjs-tooltip');
|
108
|
-
if (tooltip) {
|
109
|
-
const navBar = tooltip.querySelector('.introjs-tooltipbuttons');
|
110
|
-
if (navBar) {
|
111
|
-
let stepCounter = navBar.querySelector('.introjs-step-counter');
|
112
|
-
if (!stepCounter) {
|
113
|
-
stepCounter = document.createElement('div');
|
114
|
-
stepCounter.className = 'introjs-step-counter';
|
115
|
-
navBar.insertBefore(stepCounter, navBar.firstChild);
|
116
|
-
}
|
117
|
-
stepCounter.textContent = `${currentStep + 1} of ${totalSteps}`;
|
118
|
-
}
|
119
|
-
}
|
120
|
-
});
|
121
|
-
this.tourInstance.start().then(() => {
|
122
|
-
const currentStep = this.tourInstance?._currentStep ?? 0;
|
123
|
-
const totalSteps = steps.length;
|
124
|
-
const tooltip = document.querySelector('.introjs-tooltip');
|
125
|
-
if (tooltip) {
|
126
|
-
const navBar = tooltip.querySelector('.introjs-tooltipbuttons');
|
127
|
-
if (navBar) {
|
128
|
-
let stepCounter = navBar.querySelector('.introjs-step-counter');
|
129
|
-
if (!stepCounter) {
|
130
|
-
stepCounter = document.createElement('div');
|
131
|
-
stepCounter.className = 'introjs-step-counter';
|
132
|
-
navBar.insertBefore(stepCounter, navBar.firstChild);
|
133
|
-
}
|
134
|
-
stepCounter.textContent = `${currentStep + 1} of ${totalSteps}`;
|
135
|
-
}
|
136
|
-
const closeButton = document.createElement('button');
|
137
|
-
closeButton.className = 'introjs-close-btn';
|
138
|
-
closeButton.innerHTML = `
|
139
|
-
<svg width="12" height="12" viewBox="0 0 12 12" fill="none" xmlns="http://www.w3.org/2000/svg">
|
140
|
-
<path d="M5.33228 5.99996L0 11.3322L0.667759 12L6.00004 6.66772L11.3323 12L12.0001 11.3322L6.66779 5.99996L12 0.667759L11.3322 0L6.00004 5.3322L0.667842 5.96046e-08L8.40425e-05 0.667759L5.33228 5.99996Z" fill="white" fill-opacity="0.5"/>
|
141
|
-
</svg>`;
|
142
|
-
closeButton.onclick = () => this.tourInstance?.exit(true);
|
143
|
-
tooltip.appendChild(closeButton);
|
144
|
-
}
|
145
|
-
}).catch(err => {
|
146
|
-
console.error('Error starting the tour:', err);
|
147
|
-
});
|
148
|
-
}
|
149
|
-
render() {
|
150
|
-
return html `
|
151
|
-
<style>
|
152
|
-
${styles.cssText}
|
153
|
-
.introjs-close-btn {
|
154
|
-
position: absolute;
|
155
|
-
top: 5px;
|
156
|
-
right: 10px;
|
157
|
-
background: none;
|
158
|
-
border: none;
|
159
|
-
cursor: pointer;
|
160
|
-
padding: 0;
|
161
|
-
}
|
162
|
-
</style>
|
163
|
-
<slot></slot>
|
164
|
-
`;
|
165
|
-
}
|
166
|
-
};
|
167
|
-
__decorate([
|
168
|
-
property({ type: String })
|
169
|
-
], NileTour.prototype, "stepsJson", void 0);
|
170
|
-
__decorate([
|
171
|
-
property({ type: Boolean })
|
172
|
-
], NileTour.prototype, "showBackdrop", void 0);
|
173
|
-
__decorate([
|
174
|
-
property({ type: Boolean })
|
175
|
-
], NileTour.prototype, "disableInteraction", void 0);
|
176
|
-
NileTour = __decorate([
|
177
|
-
customElement('nile-tour')
|
178
|
-
], NileTour);
|
179
|
-
export { NileTour };
|
180
|
-
//# sourceMappingURL=nile-tour.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"nile-tour.js","sourceRoot":"","sources":["../../../src/nile-tour/nile-tour.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;;AAEH,OAAO,EAAE,UAAU,EAAE,IAAI,EAAuC,MAAM,KAAK,CAAC;AAC5E,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC5D,OAAO,OAAO,MAAM,UAAU,CAAC;AAC/B,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAGlC,IAAM,QAAQ,GAAd,MAAM,QAAS,SAAQ,UAAU;IAqB/B,MAAM,KAAK,MAAM;QACtB,OAAO,CAAC,MAAM,CAAC,CAAC;IAClB,CAAC;IAED,gBAAgB;QACd,OAAO,IAAI,CAAC;IACd,CAAC;IAED;QACE,KAAK,EAAE,CAAC;QA7BV,iBAAY,GAAsC,IAAI,CAAC;QAEvD;;WAEG;QAEH,cAAS,GAAW,EAAE,CAAC;QAEvB;;WAEG;QAEH,iBAAY,GAAY,KAAK,CAAC;QAE9B;;WAEG;QAEH,uBAAkB,GAAY,KAAK,CAAC;IAYpC,CAAC;IAEO,UAAU;QAChB,IAAI,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,SAAS,CAAC,EAAE,CAAC;YAClC,OAAO,IAAI,CAAC,SAAS,CAAC;QACxB,CAAC;QAED,OAAO,CA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;;;;KAYnB,CAAC;IACJ,CAAC;CACF,CAAA;AA5KC;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;2CACJ;AAMvB;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;8CACE;AAM9B;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;oDACQ;AAnBzB,QAAQ;IADpB,aAAa,CAAC,WAAW,CAAC;GACd,QAAQ,CAmLpB","sourcesContent":["/**\n * Copyright Aquera Inc 2023\n *\n * This source code is licensed under the BSD-3-Clause license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\nimport { LitElement, html, css, CSSResultArray, TemplateResult } from 'lit';\nimport { customElement, property } from 'lit/decorators.js';\nimport introJs from 'intro.js';\nimport { styles } from './nile-tour.css';\n\n@customElement('nile-tour')\nexport class NileTour extends LitElement {\n tourInstance: ReturnType<typeof introJs> | null = null;\n\n /**\n * JSON string for steps.\n */\n @property({ type: String })\n stepsJson: string = '';\n\n /**\n * Whether to show the backdrop overlay.\n */\n @property({ type: Boolean })\n showBackdrop: boolean = false;\n\n /**\n * Whether to disable interaction during the tour.\n */\n @property({ type: Boolean })\n disableInteraction: boolean = false;\n \n public static get styles(): CSSResultArray {\n return [styles];\n }\n\n createRenderRoot() {\n return this;\n }\n\n constructor() {\n super();\n }\n\n private parseSteps(): any[] {\n if (Array.isArray(this.stepsJson)) {\n return this.stepsJson;\n }\n \n console.error('Invalid stepsJson format');\n return [];\n }\n\n private async getElementWhenNeeded(step: any): Promise<any> {\n return {\n element: () => document.querySelector(`[data-tour=\"${step.element}\"]`) as HTMLElement | null,\n intro: step.content,\n title: step.title,\n position: step.position,\n beforeChange: step.beforeChange,\n afterChange: step.afterChange,\n disableNext: step.disableNext || false,\n disablePrev: step.disablePrev || false\n };\n }\n\n public nextStep() {\n this.tourInstance?.nextStep();\n }\n \n public async startTour(): Promise<void> {\n const steps = await Promise.all(this.parseSteps().map(step => this.getElementWhenNeeded(step)));\n\n if (steps.length === 0) {\n console.error('No valid steps found for the tour.');\n return;\n }\n\n this.tourInstance = introJs().setOptions({\n steps: steps as any,\n disableInteraction: this.disableInteraction,\n nextLabel: 'Next',\n prevLabel: 'Prev',\n overlayOpacity: this.showBackdrop ? 0.5 : 0,\n exitOnOverlayClick: false,\n showProgress: false,\n showButtons: true\n });\n\n this.tourInstance.onbeforechange(async (targetElement) => {\n const currentStepIndex = this.tourInstance?._currentStep ?? 0;\n const step = steps[currentStepIndex];\n if (step && typeof step.element === 'function') {\n const el = step.element();\n if (el) {\n if (this.tourInstance && this.tourInstance._introItems) {\n this.tourInstance._introItems[currentStepIndex].element = el;\n }\n }\n }\n if (step.beforeChange) {\n return await step.beforeChange();\n }\n return true;\n });\n\n this.tourInstance.onafterchange((targetElement) => {\n const currentStepIndex = this.tourInstance?._currentStep ?? 0;\n const step = steps[currentStepIndex];\n if (step?.afterChange) {\n step.afterChange();\n }\n\n \n const nextBtn = document.querySelector('.introjs-nextbutton');\n const prevBtn = document.querySelector('.introjs-prevbutton');\n\n if (nextBtn) {\n nextBtn.setAttribute('disabled', step.disableNext ? 'true' : 'false');\n }\n if (prevBtn) {\n prevBtn.setAttribute('disabled', step.disablePrev ? 'true' : 'false');\n }\n });\n\n this.tourInstance.onchange(() => {\n const currentStep = this.tourInstance?._currentStep ?? 0;\n const totalSteps = steps.length;\n const tooltip = document.querySelector('.introjs-tooltip');\n if (tooltip) {\n const navBar = tooltip.querySelector('.introjs-tooltipbuttons');\n if (navBar) {\n let stepCounter = navBar.querySelector('.introjs-step-counter') as HTMLElement;\n if (!stepCounter) {\n stepCounter = document.createElement('div');\n stepCounter.className = 'introjs-step-counter';\n navBar.insertBefore(stepCounter, navBar.firstChild);\n }\n stepCounter.textContent = `${currentStep + 1} of ${totalSteps}`;\n }\n }\n });\n\n this.tourInstance.start().then(() => {\n const currentStep = this.tourInstance?._currentStep ?? 0;\n const totalSteps = steps.length;\n const tooltip = document.querySelector('.introjs-tooltip');\n if (tooltip) {\n const navBar = tooltip.querySelector('.introjs-tooltipbuttons');\n if (navBar) {\n let stepCounter = navBar.querySelector('.introjs-step-counter') as HTMLElement;\n if (!stepCounter) {\n stepCounter = document.createElement('div');\n stepCounter.className = 'introjs-step-counter';\n navBar.insertBefore(stepCounter, navBar.firstChild);\n }\n stepCounter.textContent = `${currentStep + 1} of ${totalSteps}`;\n }\n\n const closeButton = document.createElement('button');\n closeButton.className = 'introjs-close-btn';\n closeButton.innerHTML = `\n <svg width=\"12\" height=\"12\" viewBox=\"0 0 12 12\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n <path d=\"M5.33228 5.99996L0 11.3322L0.667759 12L6.00004 6.66772L11.3323 12L12.0001 11.3322L6.66779 5.99996L12 0.667759L11.3322 0L6.00004 5.3322L0.667842 5.96046e-08L8.40425e-05 0.667759L5.33228 5.99996Z\" fill=\"white\" fill-opacity=\"0.5\"/>\n </svg>`;\n closeButton.onclick = () => this.tourInstance?.exit(true);\n tooltip.appendChild(closeButton);\n }\n }).catch(err => {\n console.error('Error starting the tour:', err);\n });\n }\n\n public render(): TemplateResult {\n return html`\n <style>\n ${styles.cssText}\n .introjs-close-btn {\n position: absolute;\n top: 5px;\n right: 10px;\n background: none;\n border: none;\n cursor: pointer;\n padding: 0;\n }\n </style>\n <slot></slot>\n `;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'nile-tour': NileTour;\n }\n}\n"]}
|
package/src/nile-tour/index.ts
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
export { NileTour } from './nile-tour';
|
@@ -1,247 +0,0 @@
|
|
1
|
-
/**
|
2
|
-
* Copyright Aquera Inc 2023
|
3
|
-
*
|
4
|
-
* This source code is licensed under the BSD-3-Clause license found in the
|
5
|
-
* LICENSE file in the root directory of this source tree.
|
6
|
-
*/
|
7
|
-
|
8
|
-
import { css } from 'lit-element';
|
9
|
-
|
10
|
-
/**
|
11
|
-
* Tour CSS
|
12
|
-
*/
|
13
|
-
export const styles = css`
|
14
|
-
:host {
|
15
|
-
}
|
16
|
-
|
17
|
-
.introjs-tooltip {
|
18
|
-
background-color: var(--nile-tour-background-color, #1978b8);
|
19
|
-
color: var(--nile-tour-text-color, #fff);
|
20
|
-
width: 300px;
|
21
|
-
max-width: 300px;
|
22
|
-
border-radius: 12px;
|
23
|
-
border: 1px solid var(--Neutral-30, #1978b8);
|
24
|
-
background: var(--White-Normal, #1978b8);
|
25
|
-
/* border: 1px solid var(--Neutral-30, #C7CED4); */
|
26
|
-
|
27
|
-
/* Elevation/Lifted */
|
28
|
-
box-shadow: 0px 4px 8px 0px rgba(119, 125, 130, 0.15);
|
29
|
-
}
|
30
|
-
|
31
|
-
.introjs-tooltip-title {
|
32
|
-
color: var(--nile-colors-white-base);
|
33
|
-
font-size: 16px;
|
34
|
-
font-style: normal;
|
35
|
-
font-weight: 500;
|
36
|
-
line-height: 16px;
|
37
|
-
letter-spacing: 0.2px;
|
38
|
-
}
|
39
|
-
|
40
|
-
.introjs-tooltip-header {
|
41
|
-
padding-left: 18px;
|
42
|
-
padding-right: 18px;
|
43
|
-
padding-top: 18px;
|
44
|
-
}
|
45
|
-
|
46
|
-
.introjs-progress {
|
47
|
-
display: none;
|
48
|
-
}
|
49
|
-
|
50
|
-
.introjs-tooltiptext {
|
51
|
-
color: #c7ced4;
|
52
|
-
font-size: 14px;
|
53
|
-
font-style: normal;
|
54
|
-
font-weight: 400;
|
55
|
-
line-height: 20px;
|
56
|
-
letter-spacing: 0.2px;
|
57
|
-
padding: 15px 18px;
|
58
|
-
}
|
59
|
-
|
60
|
-
.introjs-arrow {
|
61
|
-
width: 15px;
|
62
|
-
height: 20px;
|
63
|
-
background-image: url('data:image/svg+xml,%3Csvg width="15" height="20" viewBox="0 0 15 20" fill="none" xmlns="http://www.w3.org/2000/svg"%3E%3Cpath d="M1.13333 11.6C0.0666661 10.8 0.0666662 9.2 1.13333 8.4L11.8 0.400001C13.1185 -0.588854 15 0.351909 15 2L15 18C15 19.6481 13.1185 20.5889 11.8 19.6L1.13333 11.6Z" fill="%231978B8"/%3E%3C/svg%3E');
|
64
|
-
background-repeat: no-repeat;
|
65
|
-
background-size: contain;
|
66
|
-
background-position: center;
|
67
|
-
position: absolute;
|
68
|
-
border: none;
|
69
|
-
content: none;
|
70
|
-
}
|
71
|
-
|
72
|
-
.introjs-arrow.top {
|
73
|
-
top: -14.5px;
|
74
|
-
transform: rotate(90deg);
|
75
|
-
clip-path: inset(0px 3px 0px 0px);
|
76
|
-
}
|
77
|
-
|
78
|
-
.introjs-arrow.bottom {
|
79
|
-
bottom: -14.5px;
|
80
|
-
transform: rotate(270deg);
|
81
|
-
clip-path: inset(0px 3px 0px 0px);
|
82
|
-
}
|
83
|
-
|
84
|
-
.introjs-arrow.left {
|
85
|
-
left: -11.5px;
|
86
|
-
transform: rotate(0);
|
87
|
-
clip-path: inset(0px 3px 0px 0px);
|
88
|
-
}
|
89
|
-
|
90
|
-
.introjs-arrow.right {
|
91
|
-
right: -12px;
|
92
|
-
transform: rotate(180deg);
|
93
|
-
clip-path: inset(0px 3px 0px 0px);
|
94
|
-
}
|
95
|
-
|
96
|
-
.introjs-arrow.left-bottom {
|
97
|
-
transform: rotate(0);
|
98
|
-
clip-path: inset(0px 1px 0px 0px);
|
99
|
-
left: -13.5px;
|
100
|
-
border-right-color: var(--nile-tour-background-color, var(--nile-colors-white-base)) !important;
|
101
|
-
}
|
102
|
-
|
103
|
-
.introjs-arrow.right-bottom {
|
104
|
-
right: -12px;
|
105
|
-
transform: rotate(180deg);
|
106
|
-
clip-path: inset(0px 3px 0px 0px);
|
107
|
-
border-left-color: var(--nile-tour-background-color, var(--nile-colors-white-base)) !important;
|
108
|
-
}
|
109
|
-
|
110
|
-
.introjs-arrow.top-middle {
|
111
|
-
top: -14px;
|
112
|
-
left: 50%;
|
113
|
-
margin-left: -5px;
|
114
|
-
transform: rotate(90deg);
|
115
|
-
clip-path: inset(0px 3px 0px 0px);
|
116
|
-
}
|
117
|
-
|
118
|
-
.introjs-button {
|
119
|
-
background: none;
|
120
|
-
border: none;
|
121
|
-
color: var(--nile-tour-text-color, var(--nile-colors-white-base));
|
122
|
-
font-size: 14px;
|
123
|
-
padding: 0;
|
124
|
-
cursor: pointer;
|
125
|
-
text-shadow: none;
|
126
|
-
background: var(--Primary-Normal, #1978b8);
|
127
|
-
border-color: transparent;
|
128
|
-
display: flex;
|
129
|
-
padding: 12px;
|
130
|
-
align-items: center;
|
131
|
-
gap: 12px;
|
132
|
-
border-radius: 4px;
|
133
|
-
font-weight: 500;
|
134
|
-
}
|
135
|
-
|
136
|
-
.introjs-button:hover {
|
137
|
-
background: none;
|
138
|
-
border: none;
|
139
|
-
color: var(--nile-tour-text-color, var(--nile-colors-white-base));
|
140
|
-
font-size: 14px;
|
141
|
-
padding: 0;
|
142
|
-
cursor: pointer;
|
143
|
-
text-shadow: none;
|
144
|
-
background: var(--Primary-Normal, #1978b8);
|
145
|
-
border-color: transparent;
|
146
|
-
display: flex;
|
147
|
-
padding: 12px;
|
148
|
-
align-items: center;
|
149
|
-
gap: 12px;
|
150
|
-
}
|
151
|
-
|
152
|
-
.introjs-button:focus {
|
153
|
-
background: none;
|
154
|
-
border: none;
|
155
|
-
color: var(--nile-tour-text-color, var(--nile-colors-white-base));
|
156
|
-
font-size: 14px;
|
157
|
-
padding: 0;
|
158
|
-
cursor: pointer;
|
159
|
-
text-shadow: none;
|
160
|
-
box-shadow: none;
|
161
|
-
background: var(--Primary-Normal, #1978b8);
|
162
|
-
border-color: transparent;
|
163
|
-
display: flex;
|
164
|
-
padding: 12px;
|
165
|
-
align-items: center;
|
166
|
-
gap: 12px;
|
167
|
-
}
|
168
|
-
|
169
|
-
.introjs-tooltipbuttons {
|
170
|
-
border-top: none;
|
171
|
-
display: flex;
|
172
|
-
justify-content: flex-end;
|
173
|
-
gap: 10px;
|
174
|
-
}
|
175
|
-
|
176
|
-
.introjs-helperNumberLayer {
|
177
|
-
display: none;
|
178
|
-
}
|
179
|
-
|
180
|
-
.introjs-bullets {
|
181
|
-
display: none;
|
182
|
-
}
|
183
|
-
|
184
|
-
.introjs-skipbutton {
|
185
|
-
display: none;
|
186
|
-
}
|
187
|
-
|
188
|
-
.introjs-prev-button {
|
189
|
-
color: #c7ced4;
|
190
|
-
}
|
191
|
-
|
192
|
-
.introjs-helperLayer {
|
193
|
-
box-shadow: rgb(33 33 33 / 0%) 0px 0px 1px 2px,
|
194
|
-
rgba(33, 33, 33, 0.5) 0px 0px 0px 5000px !important;
|
195
|
-
}
|
196
|
-
|
197
|
-
.introjs-step-counter {
|
198
|
-
margin-right: auto;
|
199
|
-
font-size: 14px;
|
200
|
-
padding: 0 10px;
|
201
|
-
display: flex;
|
202
|
-
align-items: center;
|
203
|
-
color: var(--Color-Text-Inverted-Secondary, rgba(255, 255, 255, 0.5));
|
204
|
-
font-style: normal;
|
205
|
-
font-weight: 500;
|
206
|
-
line-height: 14px;
|
207
|
-
letter-spacing: 0.2px;
|
208
|
-
}
|
209
|
-
|
210
|
-
@keyframes shake {
|
211
|
-
0% {
|
212
|
-
transform: translateX(0);
|
213
|
-
}
|
214
|
-
25% {
|
215
|
-
transform: translateX(-5px);
|
216
|
-
}
|
217
|
-
50% {
|
218
|
-
transform: translateX(5px);
|
219
|
-
}
|
220
|
-
75% {
|
221
|
-
transform: translateX(-5px);
|
222
|
-
}
|
223
|
-
100% {
|
224
|
-
transform: translateX(0);
|
225
|
-
}
|
226
|
-
}
|
227
|
-
|
228
|
-
.introjs-shake {
|
229
|
-
animation: shake 0.5s ease infinite;
|
230
|
-
}
|
231
|
-
|
232
|
-
.introjs-close-btn {
|
233
|
-
position: absolute;
|
234
|
-
top: 15px;
|
235
|
-
right: 10px;
|
236
|
-
background: none;
|
237
|
-
border: none;
|
238
|
-
font-size: 16px;
|
239
|
-
cursor: pointer;
|
240
|
-
}
|
241
|
-
|
242
|
-
a[disabled='true'] {
|
243
|
-
display: none;
|
244
|
-
}
|
245
|
-
`;
|
246
|
-
|
247
|
-
export default [styles];
|
@@ -1,199 +0,0 @@
|
|
1
|
-
/**
|
2
|
-
* Copyright Aquera Inc 2023
|
3
|
-
*
|
4
|
-
* This source code is licensed under the BSD-3-Clause license found in the
|
5
|
-
* LICENSE file in the root directory of this source tree.
|
6
|
-
*/
|
7
|
-
|
8
|
-
import { LitElement, html, css, CSSResultArray, TemplateResult } from 'lit';
|
9
|
-
import { customElement, property } from 'lit/decorators.js';
|
10
|
-
import introJs from 'intro.js';
|
11
|
-
import { styles } from './nile-tour.css';
|
12
|
-
|
13
|
-
@customElement('nile-tour')
|
14
|
-
export class NileTour extends LitElement {
|
15
|
-
tourInstance: ReturnType<typeof introJs> | null = null;
|
16
|
-
|
17
|
-
/**
|
18
|
-
* JSON string for steps.
|
19
|
-
*/
|
20
|
-
@property({ type: String })
|
21
|
-
stepsJson: string = '';
|
22
|
-
|
23
|
-
/**
|
24
|
-
* Whether to show the backdrop overlay.
|
25
|
-
*/
|
26
|
-
@property({ type: Boolean })
|
27
|
-
showBackdrop: boolean = false;
|
28
|
-
|
29
|
-
/**
|
30
|
-
* Whether to disable interaction during the tour.
|
31
|
-
*/
|
32
|
-
@property({ type: Boolean })
|
33
|
-
disableInteraction: boolean = false;
|
34
|
-
|
35
|
-
public static get styles(): CSSResultArray {
|
36
|
-
return [styles];
|
37
|
-
}
|
38
|
-
|
39
|
-
createRenderRoot() {
|
40
|
-
return this;
|
41
|
-
}
|
42
|
-
|
43
|
-
constructor() {
|
44
|
-
super();
|
45
|
-
}
|
46
|
-
|
47
|
-
private parseSteps(): any[] {
|
48
|
-
if (Array.isArray(this.stepsJson)) {
|
49
|
-
return this.stepsJson;
|
50
|
-
}
|
51
|
-
|
52
|
-
console.error('Invalid stepsJson format');
|
53
|
-
return [];
|
54
|
-
}
|
55
|
-
|
56
|
-
private async getElementWhenNeeded(step: any): Promise<any> {
|
57
|
-
return {
|
58
|
-
element: () => document.querySelector(`[data-tour="${step.element}"]`) as HTMLElement | null,
|
59
|
-
intro: step.content,
|
60
|
-
title: step.title,
|
61
|
-
position: step.position,
|
62
|
-
beforeChange: step.beforeChange,
|
63
|
-
afterChange: step.afterChange,
|
64
|
-
disableNext: step.disableNext || false,
|
65
|
-
disablePrev: step.disablePrev || false
|
66
|
-
};
|
67
|
-
}
|
68
|
-
|
69
|
-
public nextStep() {
|
70
|
-
this.tourInstance?.nextStep();
|
71
|
-
}
|
72
|
-
|
73
|
-
public async startTour(): Promise<void> {
|
74
|
-
const steps = await Promise.all(this.parseSteps().map(step => this.getElementWhenNeeded(step)));
|
75
|
-
|
76
|
-
if (steps.length === 0) {
|
77
|
-
console.error('No valid steps found for the tour.');
|
78
|
-
return;
|
79
|
-
}
|
80
|
-
|
81
|
-
this.tourInstance = introJs().setOptions({
|
82
|
-
steps: steps as any,
|
83
|
-
disableInteraction: this.disableInteraction,
|
84
|
-
nextLabel: 'Next',
|
85
|
-
prevLabel: 'Prev',
|
86
|
-
overlayOpacity: this.showBackdrop ? 0.5 : 0,
|
87
|
-
exitOnOverlayClick: false,
|
88
|
-
showProgress: false,
|
89
|
-
showButtons: true
|
90
|
-
});
|
91
|
-
|
92
|
-
this.tourInstance.onbeforechange(async (targetElement) => {
|
93
|
-
const currentStepIndex = this.tourInstance?._currentStep ?? 0;
|
94
|
-
const step = steps[currentStepIndex];
|
95
|
-
if (step && typeof step.element === 'function') {
|
96
|
-
const el = step.element();
|
97
|
-
if (el) {
|
98
|
-
if (this.tourInstance && this.tourInstance._introItems) {
|
99
|
-
this.tourInstance._introItems[currentStepIndex].element = el;
|
100
|
-
}
|
101
|
-
}
|
102
|
-
}
|
103
|
-
if (step.beforeChange) {
|
104
|
-
return await step.beforeChange();
|
105
|
-
}
|
106
|
-
return true;
|
107
|
-
});
|
108
|
-
|
109
|
-
this.tourInstance.onafterchange((targetElement) => {
|
110
|
-
const currentStepIndex = this.tourInstance?._currentStep ?? 0;
|
111
|
-
const step = steps[currentStepIndex];
|
112
|
-
if (step?.afterChange) {
|
113
|
-
step.afterChange();
|
114
|
-
}
|
115
|
-
|
116
|
-
|
117
|
-
const nextBtn = document.querySelector('.introjs-nextbutton');
|
118
|
-
const prevBtn = document.querySelector('.introjs-prevbutton');
|
119
|
-
|
120
|
-
if (nextBtn) {
|
121
|
-
nextBtn.setAttribute('disabled', step.disableNext ? 'true' : 'false');
|
122
|
-
}
|
123
|
-
if (prevBtn) {
|
124
|
-
prevBtn.setAttribute('disabled', step.disablePrev ? 'true' : 'false');
|
125
|
-
}
|
126
|
-
});
|
127
|
-
|
128
|
-
this.tourInstance.onchange(() => {
|
129
|
-
const currentStep = this.tourInstance?._currentStep ?? 0;
|
130
|
-
const totalSteps = steps.length;
|
131
|
-
const tooltip = document.querySelector('.introjs-tooltip');
|
132
|
-
if (tooltip) {
|
133
|
-
const navBar = tooltip.querySelector('.introjs-tooltipbuttons');
|
134
|
-
if (navBar) {
|
135
|
-
let stepCounter = navBar.querySelector('.introjs-step-counter') as HTMLElement;
|
136
|
-
if (!stepCounter) {
|
137
|
-
stepCounter = document.createElement('div');
|
138
|
-
stepCounter.className = 'introjs-step-counter';
|
139
|
-
navBar.insertBefore(stepCounter, navBar.firstChild);
|
140
|
-
}
|
141
|
-
stepCounter.textContent = `${currentStep + 1} of ${totalSteps}`;
|
142
|
-
}
|
143
|
-
}
|
144
|
-
});
|
145
|
-
|
146
|
-
this.tourInstance.start().then(() => {
|
147
|
-
const currentStep = this.tourInstance?._currentStep ?? 0;
|
148
|
-
const totalSteps = steps.length;
|
149
|
-
const tooltip = document.querySelector('.introjs-tooltip');
|
150
|
-
if (tooltip) {
|
151
|
-
const navBar = tooltip.querySelector('.introjs-tooltipbuttons');
|
152
|
-
if (navBar) {
|
153
|
-
let stepCounter = navBar.querySelector('.introjs-step-counter') as HTMLElement;
|
154
|
-
if (!stepCounter) {
|
155
|
-
stepCounter = document.createElement('div');
|
156
|
-
stepCounter.className = 'introjs-step-counter';
|
157
|
-
navBar.insertBefore(stepCounter, navBar.firstChild);
|
158
|
-
}
|
159
|
-
stepCounter.textContent = `${currentStep + 1} of ${totalSteps}`;
|
160
|
-
}
|
161
|
-
|
162
|
-
const closeButton = document.createElement('button');
|
163
|
-
closeButton.className = 'introjs-close-btn';
|
164
|
-
closeButton.innerHTML = `
|
165
|
-
<svg width="12" height="12" viewBox="0 0 12 12" fill="none" xmlns="http://www.w3.org/2000/svg">
|
166
|
-
<path d="M5.33228 5.99996L0 11.3322L0.667759 12L6.00004 6.66772L11.3323 12L12.0001 11.3322L6.66779 5.99996L12 0.667759L11.3322 0L6.00004 5.3322L0.667842 5.96046e-08L8.40425e-05 0.667759L5.33228 5.99996Z" fill="white" fill-opacity="0.5"/>
|
167
|
-
</svg>`;
|
168
|
-
closeButton.onclick = () => this.tourInstance?.exit(true);
|
169
|
-
tooltip.appendChild(closeButton);
|
170
|
-
}
|
171
|
-
}).catch(err => {
|
172
|
-
console.error('Error starting the tour:', err);
|
173
|
-
});
|
174
|
-
}
|
175
|
-
|
176
|
-
public render(): TemplateResult {
|
177
|
-
return html`
|
178
|
-
<style>
|
179
|
-
${styles.cssText}
|
180
|
-
.introjs-close-btn {
|
181
|
-
position: absolute;
|
182
|
-
top: 5px;
|
183
|
-
right: 10px;
|
184
|
-
background: none;
|
185
|
-
border: none;
|
186
|
-
cursor: pointer;
|
187
|
-
padding: 0;
|
188
|
-
}
|
189
|
-
</style>
|
190
|
-
<slot></slot>
|
191
|
-
`;
|
192
|
-
}
|
193
|
-
}
|
194
|
-
|
195
|
-
declare global {
|
196
|
-
interface HTMLElementTagNameMap {
|
197
|
-
'nile-tour': NileTour;
|
198
|
-
}
|
199
|
-
}
|