js-kompo-utils 1.0.8 → 1.0.10

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "js-kompo-utils",
3
- "version": "1.0.8",
3
+ "version": "1.0.10",
4
4
  "description": "",
5
5
  "main": "app.js",
6
6
  "scripts": {
@@ -181,6 +181,10 @@ export class TutorialEngine {
181
181
  }
182
182
 
183
183
  _wireButtons() {
184
+ if (this.bubble.closeBtn) {
185
+ this.bubble.closeBtn.addEventListener('click', () => { this._close(); });
186
+ }
187
+
184
188
  if (this.bubble.actionBtn) {
185
189
  this.bubble.actionBtn.addEventListener('click', () => { this._advance(); });
186
190
  }
@@ -29,6 +29,12 @@ export class Bubble {
29
29
  this.el.style.fontSize = config.bubbleFontSize;
30
30
  this.el.style.lineHeight = config.bubbleLineHeight;
31
31
 
32
+ this.closeBtn = document.createElement('button');
33
+ this.closeBtn.className = 'tutorial-close-btn';
34
+ this.closeBtn.setAttribute('aria-label', 'Close tutorial');
35
+ this.closeBtn.innerHTML = '<svg width="14" height="14" viewBox="0 0 14 14" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"><line x1="1" y1="1" x2="13" y2="13"/><line x1="13" y1="1" x2="1" y2="13"/></svg>';
36
+ this.el.appendChild(this.closeBtn);
37
+
32
38
  this.arrowEl = document.createElement('div');
33
39
  this.arrowEl.className = 'tutorial-arrow';
34
40
  this.el.appendChild(this.arrowEl);
@@ -209,6 +215,7 @@ export class Bubble {
209
215
  this.actionBtn = null;
210
216
  this.backBtn = null;
211
217
  this.pauseBtn = null;
218
+ this.closeBtn = null;
212
219
  }
213
220
 
214
221
  // --- Private: mobile positioning (CSS flexbox, no @floating-ui) ---
@@ -213,6 +213,32 @@
213
213
  }
214
214
  }
215
215
 
216
+ // === Close button (top-right of bubble) ===
217
+ .tutorial-close-btn {
218
+ position: absolute;
219
+ top: 10px;
220
+ right: 10px;
221
+ width: 24px;
222
+ height: 24px;
223
+ border: none;
224
+ border-radius: 50%;
225
+ background: none;
226
+ color: #aaa;
227
+ font-size: 20px;
228
+ line-height: 1;
229
+ cursor: pointer;
230
+ display: flex;
231
+ align-items: center;
232
+ justify-content: center;
233
+ transition: color 0.15s;
234
+ z-index: 2;
235
+ padding: 0;
236
+
237
+ &:hover {
238
+ color: #333;
239
+ }
240
+ }
241
+
216
242
  .tutorial-text {
217
243
  margin: 0;
218
244
  max-height: clamp(150px, 40vh, 300px);