@diabolic/pointy 1.1.1 → 1.3.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 +159 -6
- package/dist/pointy.d.ts +150 -10
- package/dist/pointy.esm.js +364 -75
- package/dist/pointy.js +364 -75
- package/dist/pointy.min.js +1 -1
- package/dist/pointy.min.js.map +1 -1
- package/package.json +1 -1
- package/src/pointy.d.ts +150 -10
- package/src/pointy.js +362 -73
package/README.md
CHANGED
|
@@ -13,7 +13,8 @@ A lightweight, dependency-free JavaScript library for creating animated tooltips
|
|
|
13
13
|
- 📝 **Multi-step Tours** - Create guided product tours with multiple steps
|
|
14
14
|
- 💬 **Multi-message Steps** - Each step can have multiple messages that auto-cycle
|
|
15
15
|
- 🎬 **Autoplay Mode** - Automatically advance through steps
|
|
16
|
-
- 🎨 **Customizable Styling** - CSS variables, custom class names, and
|
|
16
|
+
- 🎨 **Customizable Styling** - CSS variables, custom class names, SVG support, and color theming
|
|
17
|
+
- 🎨 **Color Theming** - Customize pointer, bubble background, and text colors
|
|
17
18
|
- 📍 **Target Tracking** - Follows target elements in real-time
|
|
18
19
|
- ⚛️ **React Compatible** - Supports JSX/React elements as content
|
|
19
20
|
- 🔗 **Event System** - Comprehensive events with group listeners
|
|
@@ -69,6 +70,47 @@ pointy.show();
|
|
|
69
70
|
}
|
|
70
71
|
```
|
|
71
72
|
|
|
73
|
+
### Content Types
|
|
74
|
+
|
|
75
|
+
Pointy supports multiple content formats:
|
|
76
|
+
|
|
77
|
+
```javascript
|
|
78
|
+
// Plain text
|
|
79
|
+
{ target: '#el', content: 'Simple message' }
|
|
80
|
+
|
|
81
|
+
// HTML string with custom layout
|
|
82
|
+
{ target: '#el', content: `
|
|
83
|
+
<div style="display: flex; gap: 10px; align-items: flex-start; max-width: 260px;">
|
|
84
|
+
<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
|
85
|
+
<circle cx="12" cy="12" r="10"/>
|
|
86
|
+
<path d="M12 16v-4M12 8h.01"/>
|
|
87
|
+
</svg>
|
|
88
|
+
<span style="line-height: 1.4;">Custom tooltip with icon!</span>
|
|
89
|
+
</div>
|
|
90
|
+
` }
|
|
91
|
+
|
|
92
|
+
// Multiple messages (auto-cycles with messageInterval)
|
|
93
|
+
{ target: '#el', content: ['First message', 'Second message', 'Third message'] }
|
|
94
|
+
|
|
95
|
+
// React/JSX element (requires React & ReactDOM)
|
|
96
|
+
{ target: '#el', content: (
|
|
97
|
+
<div style={{ display: 'flex', gap: '10px', alignItems: 'flex-start' }}>
|
|
98
|
+
<svg width={20} height={20} viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth={2}>
|
|
99
|
+
<circle cx={12} cy={12} r={10} />
|
|
100
|
+
<path d="M12 16v-4" />
|
|
101
|
+
</svg>
|
|
102
|
+
<span>React element with SVG!</span>
|
|
103
|
+
</div>
|
|
104
|
+
) }
|
|
105
|
+
|
|
106
|
+
// Array of React elements
|
|
107
|
+
{ target: '#el', content: [
|
|
108
|
+
<span>First React message</span>,
|
|
109
|
+
<strong>Second React message</strong>,
|
|
110
|
+
<em>Third React message</em>
|
|
111
|
+
] }
|
|
112
|
+
```
|
|
113
|
+
|
|
72
114
|
### Direction Presets
|
|
73
115
|
|
|
74
116
|
Control the pointer and bubble direction manually:
|
|
@@ -96,7 +138,7 @@ pointy.setVerticalDirection('down'); // Only vertical
|
|
|
96
138
|
pointy.setDirection(null); // Reset to auto
|
|
97
139
|
|
|
98
140
|
// pointTo with direction
|
|
99
|
-
pointy.pointTo('#element', 'Message', 'down-left');
|
|
141
|
+
pointy.pointTo('#element', 'Message', { direction: 'down-left' });
|
|
100
142
|
```
|
|
101
143
|
|
|
102
144
|
### Animation
|
|
@@ -130,6 +172,15 @@ pointy.pointTo('#element', 'Message', 'down-left');
|
|
|
130
172
|
| `autoplayWaitForMessages` | `boolean` | `true` | Wait for all messages |
|
|
131
173
|
| `messageInterval` | `number\|null` | `null` | Message auto-cycle interval (ms) |
|
|
132
174
|
|
|
175
|
+
### Styling
|
|
176
|
+
|
|
177
|
+
| Option | Type | Default | Description |
|
|
178
|
+
|--------|------|---------|-------------|
|
|
179
|
+
| `pointerColor` | `string` | `null` | Pointer/cursor color (CSS color) |
|
|
180
|
+
| `bubbleBackgroundColor` | `string` | `null` | Bubble background color (CSS color) |
|
|
181
|
+
| `bubbleTextColor` | `string` | `null` | Bubble text color (CSS color) |
|
|
182
|
+
| `bubbleMaxWidth` | `string` | `'min(400px, 90vw)'` | Maximum bubble width (CSS value) |
|
|
183
|
+
|
|
133
184
|
### Completion
|
|
134
185
|
|
|
135
186
|
| Option | Type | Default | Description |
|
|
@@ -180,10 +231,34 @@ pointy.goToMessage(index);
|
|
|
180
231
|
|
|
181
232
|
### Point to Custom Target
|
|
182
233
|
|
|
234
|
+
Temporarily point to any element without changing the current step:
|
|
235
|
+
|
|
183
236
|
```javascript
|
|
237
|
+
// Basic usage
|
|
184
238
|
pointy.pointTo('#element');
|
|
185
239
|
pointy.pointTo('#element', 'Custom message');
|
|
186
|
-
|
|
240
|
+
|
|
241
|
+
// With options
|
|
242
|
+
pointy.pointTo('#element', 'Message', {
|
|
243
|
+
direction: 'down', // 'up', 'down', 'left', 'right', 'up-left', etc.
|
|
244
|
+
autoplay: true, // Auto-cycle through messages (if array)
|
|
245
|
+
interval: 2000, // Message cycle interval in ms
|
|
246
|
+
cycle: true // Loop messages (true) or stop at last (false)
|
|
247
|
+
});
|
|
248
|
+
|
|
249
|
+
// Array of messages with autoplay
|
|
250
|
+
pointy.pointTo('#element', [
|
|
251
|
+
'First tip',
|
|
252
|
+
'Second tip',
|
|
253
|
+
'Third tip'
|
|
254
|
+
], { autoplay: true, interval: 2500 });
|
|
255
|
+
|
|
256
|
+
// Stop at last message (no loop)
|
|
257
|
+
pointy.pointTo('#element', ['Step 1', 'Step 2', 'Done!'], {
|
|
258
|
+
autoplay: true,
|
|
259
|
+
interval: 2000,
|
|
260
|
+
cycle: false // Stops at 'Done!'
|
|
261
|
+
});
|
|
187
262
|
```
|
|
188
263
|
|
|
189
264
|
### Autoplay Control
|
|
@@ -247,6 +322,10 @@ pointy.setHideOnCompleteDelay(500);
|
|
|
247
322
|
|
|
248
323
|
// Styling
|
|
249
324
|
pointy.setPointerSvg('<svg>...</svg>');
|
|
325
|
+
pointy.setPointerColor('#ff6600'); // Pointer color
|
|
326
|
+
pointy.setBubbleBackgroundColor('#1a1a2e'); // Bubble background
|
|
327
|
+
pointy.setBubbleTextColor('#ffffff'); // Bubble text
|
|
328
|
+
pointy.setBubbleMaxWidth('300px'); // Max bubble width
|
|
250
329
|
```
|
|
251
330
|
|
|
252
331
|
## Easing Presets
|
|
@@ -353,11 +432,11 @@ pointy.on('all', (data) => {
|
|
|
353
432
|
#### Message Cycle
|
|
354
433
|
| Event | Data |
|
|
355
434
|
|-------|------|
|
|
356
|
-
| `messageCycleStart` | `{ interval, totalMessages }` |
|
|
435
|
+
| `messageCycleStart` | `{ interval, totalMessages, cycle }` |
|
|
357
436
|
| `messageCycleStop` | `{ currentIndex }` |
|
|
358
437
|
| `messageCyclePause` | `{ currentIndex }` |
|
|
359
438
|
| `messageCycleResume` | `{ currentIndex }` |
|
|
360
|
-
| `messageCycleComplete` | `{ stepIndex
|
|
439
|
+
| `messageCycleComplete` | `{ stepIndex?, totalMessages }` |
|
|
361
440
|
|
|
362
441
|
#### Pointing
|
|
363
442
|
| Event | Data |
|
|
@@ -393,7 +472,18 @@ pointy.on('all', (data) => {
|
|
|
393
472
|
| `stayInViewportChange` | `{ from: { enabled, x, y }, to: { enabled, x, y } }` |
|
|
394
473
|
|
|
395
474
|
#### Config
|
|
396
|
-
All setter methods emit `*Change` events with `{ from, to }` data
|
|
475
|
+
All setter methods emit `*Change` events with `{ from, to }` data:
|
|
476
|
+
|
|
477
|
+
| Event | Description |
|
|
478
|
+
|-------|-------------|
|
|
479
|
+
| `pointerColorChange` | Pointer color changed |
|
|
480
|
+
| `bubbleBackgroundColorChange` | Bubble background color changed |
|
|
481
|
+
| `bubbleTextColorChange` | Bubble text color changed |
|
|
482
|
+
| `bubbleMaxWidthChange` | Bubble max width changed |
|
|
483
|
+
| `easingChange` | Easing preset changed |
|
|
484
|
+
| `animationDurationChange` | Animation duration changed |
|
|
485
|
+
| `floatingAnimationChange` | Floating animation toggled |
|
|
486
|
+
| ... | (and more for all setters) |
|
|
397
487
|
|
|
398
488
|
## CSS Customization
|
|
399
489
|
|
|
@@ -401,9 +491,16 @@ All setter methods emit `*Change` events with `{ from, to }` data.
|
|
|
401
491
|
|
|
402
492
|
```css
|
|
403
493
|
.pointy-container {
|
|
494
|
+
/* Animation */
|
|
404
495
|
--pointy-duration: 1000ms;
|
|
405
496
|
--pointy-easing: cubic-bezier(0, 0.55, 0.45, 1);
|
|
406
497
|
--pointy-bubble-fade: 500ms;
|
|
498
|
+
|
|
499
|
+
/* Colors */
|
|
500
|
+
--pointy-pointer-color: #0a1551;
|
|
501
|
+
--pointy-bubble-bg: #0a1551;
|
|
502
|
+
--pointy-bubble-color: white;
|
|
503
|
+
--pointy-bubble-max-width: min(400px, 90vw);
|
|
407
504
|
}
|
|
408
505
|
```
|
|
409
506
|
|
|
@@ -488,6 +585,62 @@ const tour = new Pointy({
|
|
|
488
585
|
tour.show();
|
|
489
586
|
```
|
|
490
587
|
|
|
588
|
+
### Custom Theming
|
|
589
|
+
|
|
590
|
+
```javascript
|
|
591
|
+
const tour = new Pointy({
|
|
592
|
+
steps: [
|
|
593
|
+
{ target: '#feature', content: 'Check out this feature!' }
|
|
594
|
+
],
|
|
595
|
+
pointerColor: '#ff6600',
|
|
596
|
+
bubbleBackgroundColor: '#1a1a2e',
|
|
597
|
+
bubbleTextColor: '#ffffff',
|
|
598
|
+
bubbleMaxWidth: '300px'
|
|
599
|
+
});
|
|
600
|
+
|
|
601
|
+
tour.show();
|
|
602
|
+
|
|
603
|
+
// Or change colors at runtime
|
|
604
|
+
tour.setPointerColor('#00ff88');
|
|
605
|
+
tour.setBubbleBackgroundColor('#2d2d44');
|
|
606
|
+
```
|
|
607
|
+
|
|
608
|
+
### React/JSX Content
|
|
609
|
+
|
|
610
|
+
```jsx
|
|
611
|
+
// With React loaded via CDN or bundler
|
|
612
|
+
const tour = new Pointy({
|
|
613
|
+
steps: [{
|
|
614
|
+
target: '#feature',
|
|
615
|
+
content: (
|
|
616
|
+
<div style={{ display: 'flex', gap: '10px', alignItems: 'flex-start' }}>
|
|
617
|
+
<svg
|
|
618
|
+
width={20} height={20} viewBox="0 0 24 24"
|
|
619
|
+
fill="none" stroke="currentColor" strokeWidth={2}
|
|
620
|
+
strokeLinecap="round" strokeLinejoin="round"
|
|
621
|
+
>
|
|
622
|
+
<path d="M12 22c5.523 0 10-4.477 10-10S17.523 2 12 2 2 6.477 2 12s4.477 10 10 10z" />
|
|
623
|
+
<path d="M12 16v-4" />
|
|
624
|
+
<path d="M12 8h.01" />
|
|
625
|
+
</svg>
|
|
626
|
+
<span>React element with info icon!</span>
|
|
627
|
+
</div>
|
|
628
|
+
)
|
|
629
|
+
}]
|
|
630
|
+
});
|
|
631
|
+
|
|
632
|
+
tour.show();
|
|
633
|
+
|
|
634
|
+
// Or with pointTo and autoplay
|
|
635
|
+
const messages = [
|
|
636
|
+
<span>First tip</span>,
|
|
637
|
+
<strong>Important tip!</strong>,
|
|
638
|
+
<em>Final tip</em>
|
|
639
|
+
];
|
|
640
|
+
|
|
641
|
+
tour.pointTo('#element', messages, { autoplay: true, interval: 2000 });
|
|
642
|
+
```
|
|
643
|
+
|
|
491
644
|
### Autoplay Tour
|
|
492
645
|
|
|
493
646
|
```javascript
|
package/dist/pointy.d.ts
CHANGED
|
@@ -7,6 +7,31 @@ declare module '@diabolic/pointy' {
|
|
|
7
7
|
export = Pointy;
|
|
8
8
|
}
|
|
9
9
|
|
|
10
|
+
/**
|
|
11
|
+
* Direction presets for pointer positioning
|
|
12
|
+
*/
|
|
13
|
+
type PointyDirection = 'up' | 'down' | 'left' | 'right' | 'up-left' | 'up-right' | 'down-left' | 'down-right' | null;
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Horizontal direction
|
|
17
|
+
*/
|
|
18
|
+
type PointyHorizontalDirection = 'left' | 'right' | null;
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Vertical direction
|
|
22
|
+
*/
|
|
23
|
+
type PointyVerticalDirection = 'up' | 'down' | null;
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Viewport threshold configuration
|
|
27
|
+
*/
|
|
28
|
+
interface PointyViewportThresholds {
|
|
29
|
+
/** Horizontal margin from viewport edge to trigger flip (default: 40) */
|
|
30
|
+
x?: number;
|
|
31
|
+
/** Vertical margin from viewport edge to trigger flip (default: 60) */
|
|
32
|
+
y?: number;
|
|
33
|
+
}
|
|
34
|
+
|
|
10
35
|
/**
|
|
11
36
|
* Step configuration for tour steps
|
|
12
37
|
*/
|
|
@@ -15,8 +40,8 @@ interface PointyStep {
|
|
|
15
40
|
target: string | HTMLElement;
|
|
16
41
|
/** Content to display - can be string, HTML, array of messages, or React element */
|
|
17
42
|
content: string | string[] | React.ReactNode | React.ReactNode[];
|
|
18
|
-
/** Pointer direction: 'up', 'down', or null for auto */
|
|
19
|
-
direction?:
|
|
43
|
+
/** Pointer direction: 'up', 'down', 'left', 'right', 'up-left', 'up-right', 'down-left', 'down-right', or null for auto */
|
|
44
|
+
direction?: PointyDirection;
|
|
20
45
|
/** Step-specific autoplay duration in ms (overrides global autoplay) */
|
|
21
46
|
duration?: number;
|
|
22
47
|
}
|
|
@@ -110,6 +135,10 @@ interface PointyOptions {
|
|
|
110
135
|
/** Enable floating/bobbing animation (default: true) */
|
|
111
136
|
floatingAnimation?: boolean;
|
|
112
137
|
|
|
138
|
+
// Viewport
|
|
139
|
+
/** Auto-flip bubble to stay within viewport (default: true). Can be boolean or threshold config */
|
|
140
|
+
stayInViewport?: boolean | PointyViewportThresholds;
|
|
141
|
+
|
|
113
142
|
// Position
|
|
114
143
|
/** Horizontal offset from target in px (default: 20) */
|
|
115
144
|
offsetX?: number;
|
|
@@ -159,6 +188,14 @@ interface PointyOptions {
|
|
|
159
188
|
cssVarPrefix?: string;
|
|
160
189
|
/** Custom SVG markup for pointer or React element */
|
|
161
190
|
pointerSvg?: string | React.ReactNode;
|
|
191
|
+
/** Custom bubble background color (CSS color value) */
|
|
192
|
+
bubbleBackgroundColor?: string;
|
|
193
|
+
/** Custom bubble text color (CSS color value) */
|
|
194
|
+
bubbleTextColor?: string;
|
|
195
|
+
/** Maximum width for bubble (CSS width value, default: 'min(400px, 90vw)') */
|
|
196
|
+
bubbleMaxWidth?: string;
|
|
197
|
+
/** Custom pointer/cursor color (CSS color value) */
|
|
198
|
+
pointerColor?: string;
|
|
162
199
|
|
|
163
200
|
// Callbacks
|
|
164
201
|
/** Called when step changes */
|
|
@@ -247,10 +284,34 @@ interface PointyMessageCycleEventData extends PointyEventData {
|
|
|
247
284
|
interface PointyPointingEventData extends PointyEventData {
|
|
248
285
|
target?: HTMLElement;
|
|
249
286
|
content?: string | string[];
|
|
250
|
-
direction?:
|
|
287
|
+
direction?: PointyDirection;
|
|
251
288
|
fromTarget?: HTMLElement;
|
|
252
289
|
}
|
|
253
290
|
|
|
291
|
+
/**
|
|
292
|
+
* Flip event data (when bubble flips due to viewport bounds)
|
|
293
|
+
*/
|
|
294
|
+
interface PointyFlipEventData extends PointyEventData {
|
|
295
|
+
from: 'left' | 'right' | 'up' | 'down';
|
|
296
|
+
to: 'left' | 'right' | 'up' | 'down';
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
/**
|
|
300
|
+
* Direction change event data
|
|
301
|
+
*/
|
|
302
|
+
interface PointyDirectionChangeEventData extends PointyEventData {
|
|
303
|
+
from: { horizontal: PointyHorizontalDirection; vertical: PointyVerticalDirection };
|
|
304
|
+
to: { horizontal: PointyHorizontalDirection; vertical: PointyVerticalDirection };
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
/**
|
|
308
|
+
* Viewport change event data
|
|
309
|
+
*/
|
|
310
|
+
interface PointyViewportChangeEventData extends PointyEventData {
|
|
311
|
+
from: { enabled: boolean; x: number; y: number };
|
|
312
|
+
to: { enabled: boolean; x: number; y: number };
|
|
313
|
+
}
|
|
314
|
+
|
|
254
315
|
/**
|
|
255
316
|
* Tracking event data
|
|
256
317
|
*/
|
|
@@ -291,15 +352,17 @@ type PointyEventCallback<T = PointyEventData> = (data: T) => void;
|
|
|
291
352
|
*/
|
|
292
353
|
type PointyLifecycleEvent = 'beforeShow' | 'show' | 'beforeHide' | 'hide' | 'destroy' | 'beforeRestart' | 'restart' | 'beforeReset' | 'reset';
|
|
293
354
|
type PointyNavigationEvent = 'beforeStepChange' | 'stepChange' | 'next' | 'prev' | 'complete';
|
|
294
|
-
type PointyAnimationEvent = 'animationStart' | 'animationEnd' | 'move' | 'moveComplete' | 'introAnimationStart' | 'introAnimationEnd';
|
|
355
|
+
type PointyAnimationEvent = 'animationStart' | 'animationEnd' | 'move' | 'moveComplete' | 'introAnimationStart' | 'introAnimationEnd' | 'flipHorizontal' | 'flipVertical';
|
|
356
|
+
type PointyDirectionEvent = 'directionChange' | 'horizontalDirectionChange' | 'verticalDirectionChange';
|
|
357
|
+
type PointyViewportEvent = 'stayInViewportChange';
|
|
295
358
|
type PointyContentEvent = 'contentSet' | 'messagesSet' | 'messageChange';
|
|
296
359
|
type PointyMessageCycleEvent = 'messageCycleStart' | 'messageCycleStop' | 'messageCyclePause' | 'messageCycleResume' | 'messageCycleComplete';
|
|
297
360
|
type PointyPointingEvent = 'beforePointTo' | 'pointTo' | 'pointToComplete';
|
|
298
361
|
type PointyTrackingEvent = 'track' | 'targetChange' | 'trackingChange' | 'trackingFpsChange';
|
|
299
362
|
type PointyAutoplayEvent = 'autoplayStart' | 'autoplayStop' | 'autoplayPause' | 'autoplayResume' | 'autoplayNext' | 'autoplayComplete' | 'autoHide' | 'autoplayChange' | 'autoplayWaitForMessagesChange';
|
|
300
|
-
type PointyConfigEvent = 'easingChange' | 'animationDurationChange' | 'introFadeDurationChange' | 'bubbleFadeDurationChange' | 'messageIntervalChange' | 'messageTransitionDurationChange' | 'offsetChange' | 'resetOnCompleteChange' | 'hideOnCompleteChange' | 'hideOnCompleteDelayChange' | 'floatingAnimationChange' | 'initialPositionChange' | 'initialPositionOffsetChange' | 'pointerSvgChange';
|
|
363
|
+
type PointyConfigEvent = 'easingChange' | 'animationDurationChange' | 'introFadeDurationChange' | 'bubbleFadeDurationChange' | 'bubbleBackgroundColorChange' | 'bubbleTextColorChange' | 'bubbleMaxWidthChange' | 'pointerColorChange' | 'messageIntervalChange' | 'messageTransitionDurationChange' | 'offsetChange' | 'resetOnCompleteChange' | 'hideOnCompleteChange' | 'hideOnCompleteDelayChange' | 'floatingAnimationChange' | 'initialPositionChange' | 'initialPositionOffsetChange' | 'pointerSvgChange' | 'zIndexChange';
|
|
301
364
|
|
|
302
|
-
type PointyEvent = PointyLifecycleEvent | PointyNavigationEvent | PointyAnimationEvent | PointyContentEvent | PointyMessageCycleEvent | PointyPointingEvent | PointyTrackingEvent | PointyAutoplayEvent | PointyConfigEvent;
|
|
365
|
+
type PointyEvent = PointyLifecycleEvent | PointyNavigationEvent | PointyAnimationEvent | PointyDirectionEvent | PointyViewportEvent | PointyContentEvent | PointyMessageCycleEvent | PointyPointingEvent | PointyTrackingEvent | PointyAutoplayEvent | PointyConfigEvent;
|
|
303
366
|
|
|
304
367
|
/**
|
|
305
368
|
* Event group names
|
|
@@ -313,6 +376,8 @@ interface PointyEventGroups {
|
|
|
313
376
|
lifecycle: PointyLifecycleEvent[];
|
|
314
377
|
navigation: PointyNavigationEvent[];
|
|
315
378
|
animation: PointyAnimationEvent[];
|
|
379
|
+
direction: PointyDirectionEvent[];
|
|
380
|
+
viewport: PointyViewportEvent[];
|
|
316
381
|
content: PointyContentEvent[];
|
|
317
382
|
messageCycle: PointyMessageCycleEvent[];
|
|
318
383
|
pointing: PointyPointingEvent[];
|
|
@@ -474,6 +539,22 @@ declare class Pointy {
|
|
|
474
539
|
messageInterval: number | null;
|
|
475
540
|
/** Current pointer SVG or React element */
|
|
476
541
|
pointerSvg: string | React.ReactNode;
|
|
542
|
+
/** Custom bubble background color */
|
|
543
|
+
bubbleBackgroundColor: string | null;
|
|
544
|
+
/** Custom bubble text color */
|
|
545
|
+
bubbleTextColor: string | null;
|
|
546
|
+
/** Maximum width for bubble (default: min(400px, 90vw)) */
|
|
547
|
+
bubbleMaxWidth: string | null;
|
|
548
|
+
/** Custom pointer/cursor color */
|
|
549
|
+
pointerColor: string | null;
|
|
550
|
+
|
|
551
|
+
// Viewport properties
|
|
552
|
+
/** Whether to auto-flip bubble to stay in viewport */
|
|
553
|
+
stayInViewport: boolean;
|
|
554
|
+
/** Horizontal viewport threshold */
|
|
555
|
+
viewportThresholdX: number;
|
|
556
|
+
/** Vertical viewport threshold */
|
|
557
|
+
viewportThresholdY: number;
|
|
477
558
|
|
|
478
559
|
// State properties (readonly)
|
|
479
560
|
/** Whether pointer is currently visible */
|
|
@@ -486,8 +567,12 @@ declare class Pointy {
|
|
|
486
567
|
readonly currentMessages: (string | React.ReactNode)[];
|
|
487
568
|
/** Whether pointer is pointing up */
|
|
488
569
|
readonly isPointingUp: boolean;
|
|
489
|
-
/**
|
|
490
|
-
readonly
|
|
570
|
+
/** Whether pointer is on left side of target */
|
|
571
|
+
readonly isPointingLeft: boolean;
|
|
572
|
+
/** Manual horizontal direction override */
|
|
573
|
+
readonly manualHorizontalDirection: PointyHorizontalDirection;
|
|
574
|
+
/** Manual vertical direction override */
|
|
575
|
+
readonly manualVerticalDirection: PointyVerticalDirection;
|
|
491
576
|
|
|
492
577
|
// Callbacks
|
|
493
578
|
/** Step change callback */
|
|
@@ -532,9 +617,9 @@ declare class Pointy {
|
|
|
532
617
|
* Point to any element without changing current step
|
|
533
618
|
* @param target - Target element or CSS selector
|
|
534
619
|
* @param content - Optional content to display
|
|
535
|
-
* @param direction - Optional direction: 'up', 'down', or null for auto
|
|
620
|
+
* @param direction - Optional direction: 'up', 'down', 'left', 'right', 'up-left', 'up-right', 'down-left', 'down-right', or null for auto
|
|
536
621
|
*/
|
|
537
|
-
pointTo(target: string | HTMLElement, content?: string | string[], direction?:
|
|
622
|
+
pointTo(target: string | HTMLElement, content?: string | string[], direction?: PointyDirection): void;
|
|
538
623
|
|
|
539
624
|
// Content methods
|
|
540
625
|
/**
|
|
@@ -650,6 +735,26 @@ declare class Pointy {
|
|
|
650
735
|
* @param duration - Duration in milliseconds
|
|
651
736
|
*/
|
|
652
737
|
setBubbleFadeDuration(duration: number): void;
|
|
738
|
+
/**
|
|
739
|
+
* Set the bubble background color
|
|
740
|
+
* @param color - CSS color value (hex, rgb, etc.) or null to reset
|
|
741
|
+
*/
|
|
742
|
+
setBubbleBackgroundColor(color: string | null): void;
|
|
743
|
+
/**
|
|
744
|
+
* Set the bubble text color
|
|
745
|
+
* @param color - CSS color value (hex, rgb, etc.) or null to reset
|
|
746
|
+
*/
|
|
747
|
+
setBubbleTextColor(color: string | null): void;
|
|
748
|
+
/**
|
|
749
|
+
* Set the bubble max width
|
|
750
|
+
* @param width - CSS width value (e.g., '90vw', '300px') or null to reset
|
|
751
|
+
*/
|
|
752
|
+
setBubbleMaxWidth(width: string | null): void;
|
|
753
|
+
/**
|
|
754
|
+
* Set the pointer/cursor color
|
|
755
|
+
* @param color - CSS color value (hex, rgb, etc.) or null to reset
|
|
756
|
+
*/
|
|
757
|
+
setPointerColor(color: string | null): void;
|
|
653
758
|
/**
|
|
654
759
|
* Set the message transition duration
|
|
655
760
|
* @param duration - Duration in milliseconds
|
|
@@ -727,6 +832,32 @@ declare class Pointy {
|
|
|
727
832
|
* @param svg - SVG markup string or React element
|
|
728
833
|
*/
|
|
729
834
|
setPointerSvg(svg: string | React.ReactNode): void;
|
|
835
|
+
/**
|
|
836
|
+
* Set the z-index of the container
|
|
837
|
+
* @param zIndex - CSS z-index value
|
|
838
|
+
*/
|
|
839
|
+
setZIndex(zIndex: number): void;
|
|
840
|
+
/**
|
|
841
|
+
* Set stayInViewport enabled/disabled with optional thresholds
|
|
842
|
+
* @param enabled - Whether stayInViewport is enabled
|
|
843
|
+
* @param thresholds - Optional threshold values { x?: number, y?: number }
|
|
844
|
+
*/
|
|
845
|
+
setStayInViewport(enabled: boolean, thresholds?: PointyViewportThresholds): void;
|
|
846
|
+
/**
|
|
847
|
+
* Set the pointer direction manually (both horizontal and vertical)
|
|
848
|
+
* @param direction - Direction: 'up', 'down', 'left', 'right', 'up-left', 'up-right', 'down-left', 'down-right', or null for auto
|
|
849
|
+
*/
|
|
850
|
+
setDirection(direction: PointyDirection): void;
|
|
851
|
+
/**
|
|
852
|
+
* Set only the horizontal direction
|
|
853
|
+
* @param direction - 'left', 'right', or null for auto
|
|
854
|
+
*/
|
|
855
|
+
setHorizontalDirection(direction: PointyHorizontalDirection): void;
|
|
856
|
+
/**
|
|
857
|
+
* Set only the vertical direction
|
|
858
|
+
* @param direction - 'up', 'down', or null for auto
|
|
859
|
+
*/
|
|
860
|
+
setVerticalDirection(direction: PointyVerticalDirection): void;
|
|
730
861
|
|
|
731
862
|
// Getter methods
|
|
732
863
|
/** Get current pointer SVG or React element */
|
|
@@ -825,6 +956,10 @@ export {
|
|
|
825
956
|
PointyClassSuffixes,
|
|
826
957
|
PointyInitialPosition,
|
|
827
958
|
PointyEasing,
|
|
959
|
+
PointyDirection,
|
|
960
|
+
PointyHorizontalDirection,
|
|
961
|
+
PointyVerticalDirection,
|
|
962
|
+
PointyViewportThresholds,
|
|
828
963
|
PointyEvent,
|
|
829
964
|
PointyEventGroup,
|
|
830
965
|
PointyEventGroups,
|
|
@@ -836,6 +971,11 @@ export {
|
|
|
836
971
|
PointyNavigationEventData,
|
|
837
972
|
PointyAnimationEvent,
|
|
838
973
|
PointyAnimationEventData,
|
|
974
|
+
PointyDirectionEvent,
|
|
975
|
+
PointyDirectionChangeEventData,
|
|
976
|
+
PointyViewportEvent,
|
|
977
|
+
PointyViewportChangeEventData,
|
|
978
|
+
PointyFlipEventData,
|
|
839
979
|
PointyContentEvent,
|
|
840
980
|
PointyContentEventData,
|
|
841
981
|
PointyMessageCycleEvent,
|