@ewjdev/anyclick-react 1.1.0 → 1.1.1
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 +53 -63
- package/dist/index.d.mts +28 -6
- package/dist/index.d.ts +28 -6
- package/dist/index.js +289 -57
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +289 -57
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -23,21 +23,17 @@ npm install @ewjdev/anyclick-react
|
|
|
23
23
|
## Quick Start
|
|
24
24
|
|
|
25
25
|
```tsx
|
|
26
|
-
|
|
26
|
+
"use client";
|
|
27
27
|
|
|
28
|
-
import { AnyclickProvider } from
|
|
29
|
-
import { createHttpAdapter } from
|
|
28
|
+
import { AnyclickProvider } from "@ewjdev/anyclick-react";
|
|
29
|
+
import { createHttpAdapter } from "@ewjdev/anyclick-github";
|
|
30
30
|
|
|
31
31
|
const adapter = createHttpAdapter({
|
|
32
|
-
endpoint:
|
|
32
|
+
endpoint: "/api/feedback",
|
|
33
33
|
});
|
|
34
34
|
|
|
35
35
|
export function Providers({ children }: { children: React.ReactNode }) {
|
|
36
|
-
return
|
|
37
|
-
<AnyclickProvider adapter={adapter}>
|
|
38
|
-
{children}
|
|
39
|
-
</AnyclickProvider>
|
|
40
|
-
);
|
|
36
|
+
return <AnyclickProvider adapter={adapter}>{children}</AnyclickProvider>;
|
|
41
37
|
}
|
|
42
38
|
```
|
|
43
39
|
|
|
@@ -55,39 +51,39 @@ That's it! Users can now right-click any element to submit feedback.
|
|
|
55
51
|
|
|
56
52
|
## Props
|
|
57
53
|
|
|
58
|
-
| Prop
|
|
59
|
-
|
|
60
|
-
| `adapter`
|
|
61
|
-
| `menuItems`
|
|
62
|
-
| `metadata`
|
|
63
|
-
| `theme`
|
|
64
|
-
| `scoped`
|
|
65
|
-
| `disabled`
|
|
66
|
-
| `onSubmitSuccess` | `(payload) => void`
|
|
67
|
-
| `onSubmitError`
|
|
54
|
+
| Prop | Type | Description |
|
|
55
|
+
| ----------------- | -------------------------- | ---------------------------------------------- |
|
|
56
|
+
| `adapter` | `FeedbackAdapter` | Required. The adapter for submitting feedback |
|
|
57
|
+
| `menuItems` | `FeedbackMenuItem[]` | Custom menu items |
|
|
58
|
+
| `metadata` | `Record<string, unknown>` | Additional data included with every submission |
|
|
59
|
+
| `theme` | `AnyclickTheme \| null` | Theme configuration (inherits from parent) |
|
|
60
|
+
| `scoped` | `boolean` | Limit capture to this provider's children only |
|
|
61
|
+
| `disabled` | `boolean` | Disable feedback capture |
|
|
62
|
+
| `onSubmitSuccess` | `(payload) => void` | Success callback |
|
|
63
|
+
| `onSubmitError` | `(error, payload) => void` | Error callback |
|
|
68
64
|
|
|
69
65
|
## Scoped Providers
|
|
70
66
|
|
|
71
67
|
Limit feedback capture to specific sections of your app:
|
|
72
68
|
|
|
73
69
|
```tsx
|
|
74
|
-
import { AnyclickProvider } from
|
|
70
|
+
import { AnyclickProvider } from "@ewjdev/anyclick-react";
|
|
75
71
|
|
|
76
72
|
function App() {
|
|
77
73
|
return (
|
|
78
74
|
<AnyclickProvider adapter={globalAdapter}>
|
|
79
75
|
{/* Global feedback works everywhere */}
|
|
80
76
|
<Header />
|
|
81
|
-
|
|
77
|
+
|
|
82
78
|
{/* Scoped provider - separate configuration */}
|
|
83
|
-
<AnyclickProvider
|
|
79
|
+
<AnyclickProvider
|
|
84
80
|
adapter={dashboardAdapter}
|
|
85
81
|
scoped
|
|
86
82
|
menuItems={dashboardMenuItems}
|
|
87
83
|
>
|
|
88
84
|
<Dashboard />
|
|
89
85
|
</AnyclickProvider>
|
|
90
|
-
|
|
86
|
+
|
|
91
87
|
<Footer />
|
|
92
88
|
</AnyclickProvider>
|
|
93
89
|
);
|
|
@@ -99,33 +95,33 @@ function App() {
|
|
|
99
95
|
Override themes for specific sections:
|
|
100
96
|
|
|
101
97
|
```tsx
|
|
102
|
-
import { AnyclickProvider } from
|
|
98
|
+
import { AnyclickProvider } from "@ewjdev/anyclick-react";
|
|
103
99
|
|
|
104
100
|
function App() {
|
|
105
101
|
return (
|
|
106
|
-
<AnyclickProvider
|
|
102
|
+
<AnyclickProvider
|
|
107
103
|
adapter={adapter}
|
|
108
104
|
theme={{
|
|
109
105
|
highlightConfig: {
|
|
110
|
-
colors: { targetColor:
|
|
111
|
-
}
|
|
106
|
+
colors: { targetColor: "#3b82f6" },
|
|
107
|
+
},
|
|
112
108
|
}}
|
|
113
109
|
>
|
|
114
110
|
{/* Uses blue highlights */}
|
|
115
111
|
<MainContent />
|
|
116
|
-
|
|
112
|
+
|
|
117
113
|
{/* Uses red highlights (overrides parent) */}
|
|
118
|
-
<AnyclickProvider
|
|
114
|
+
<AnyclickProvider
|
|
119
115
|
scoped
|
|
120
116
|
theme={{
|
|
121
117
|
highlightConfig: {
|
|
122
|
-
colors: { targetColor:
|
|
123
|
-
}
|
|
118
|
+
colors: { targetColor: "#ef4444" },
|
|
119
|
+
},
|
|
124
120
|
}}
|
|
125
121
|
>
|
|
126
122
|
<WarningSection />
|
|
127
123
|
</AnyclickProvider>
|
|
128
|
-
|
|
124
|
+
|
|
129
125
|
{/* Disable anyclick for this section */}
|
|
130
126
|
<AnyclickProvider scoped theme={{ disabled: true }}>
|
|
131
127
|
<SensitiveArea />
|
|
@@ -150,24 +146,24 @@ interface AnyclickTheme {
|
|
|
150
146
|
## Custom Menu Items
|
|
151
147
|
|
|
152
148
|
```tsx
|
|
153
|
-
import { Bug, Lightbulb, Heart } from
|
|
149
|
+
import { Bug, Lightbulb, Heart } from "lucide-react";
|
|
154
150
|
|
|
155
151
|
const menuItems = [
|
|
156
|
-
{
|
|
157
|
-
type:
|
|
158
|
-
label:
|
|
152
|
+
{
|
|
153
|
+
type: "bug",
|
|
154
|
+
label: "Report Bug",
|
|
159
155
|
icon: <Bug className="w-4 h-4" />,
|
|
160
156
|
showComment: true,
|
|
161
157
|
},
|
|
162
|
-
{
|
|
163
|
-
type:
|
|
164
|
-
label:
|
|
158
|
+
{
|
|
159
|
+
type: "feature",
|
|
160
|
+
label: "Suggest Feature",
|
|
165
161
|
icon: <Lightbulb className="w-4 h-4" />,
|
|
166
162
|
showComment: true,
|
|
167
163
|
},
|
|
168
|
-
{
|
|
169
|
-
type:
|
|
170
|
-
label:
|
|
164
|
+
{
|
|
165
|
+
type: "love",
|
|
166
|
+
label: "Love It!",
|
|
171
167
|
icon: <Heart className="w-4 h-4" />,
|
|
172
168
|
showComment: false,
|
|
173
169
|
},
|
|
@@ -175,20 +171,20 @@ const menuItems = [
|
|
|
175
171
|
|
|
176
172
|
<AnyclickProvider adapter={adapter} menuItems={menuItems}>
|
|
177
173
|
{children}
|
|
178
|
-
</AnyclickProvider
|
|
174
|
+
</AnyclickProvider>;
|
|
179
175
|
```
|
|
180
176
|
|
|
181
177
|
## Role-Based Filtering
|
|
182
178
|
|
|
183
179
|
```tsx
|
|
184
|
-
import { filterMenuItemsByRole } from
|
|
180
|
+
import { filterMenuItemsByRole } from "@ewjdev/anyclick-react";
|
|
185
181
|
|
|
186
182
|
const allMenuItems = [
|
|
187
|
-
{ type:
|
|
188
|
-
{ type:
|
|
183
|
+
{ type: "bug", label: "Report Bug" },
|
|
184
|
+
{ type: "debug", label: "Debug Info", requiredRoles: ["developer"] },
|
|
189
185
|
];
|
|
190
186
|
|
|
191
|
-
const userContext = { roles: [
|
|
187
|
+
const userContext = { roles: ["user", "developer"] };
|
|
192
188
|
const menuItems = filterMenuItemsByRole(allMenuItems, userContext);
|
|
193
189
|
```
|
|
194
190
|
|
|
@@ -201,10 +197,10 @@ const menuItems = filterMenuItemsByRole(allMenuItems, userContext);
|
|
|
201
197
|
highlightConfig: {
|
|
202
198
|
enabled: true,
|
|
203
199
|
colors: {
|
|
204
|
-
targetColor:
|
|
205
|
-
containerColor:
|
|
200
|
+
targetColor: "#3b82f6",
|
|
201
|
+
containerColor: "#8b5cf6",
|
|
206
202
|
},
|
|
207
|
-
containerSelectors: [
|
|
203
|
+
containerSelectors: ["[data-component]", ".card"],
|
|
208
204
|
},
|
|
209
205
|
}}
|
|
210
206
|
>
|
|
@@ -217,23 +213,17 @@ const menuItems = filterMenuItemsByRole(allMenuItems, userContext);
|
|
|
217
213
|
Access anyclick context from child components:
|
|
218
214
|
|
|
219
215
|
```tsx
|
|
220
|
-
import { useAnyclick } from
|
|
216
|
+
import { useAnyclick } from "@ewjdev/anyclick-react";
|
|
221
217
|
|
|
222
218
|
function MyComponent() {
|
|
223
|
-
const {
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
closeMenu,
|
|
227
|
-
theme,
|
|
228
|
-
scoped,
|
|
229
|
-
providerId,
|
|
230
|
-
} = useAnyclick();
|
|
231
|
-
|
|
219
|
+
const { isSubmitting, openMenu, closeMenu, theme, scoped, providerId } =
|
|
220
|
+
useAnyclick();
|
|
221
|
+
|
|
232
222
|
// Open menu programmatically
|
|
233
223
|
const handleClick = (event) => {
|
|
234
224
|
openMenu(event.currentTarget, { x: event.clientX, y: event.clientY });
|
|
235
225
|
};
|
|
236
|
-
|
|
226
|
+
|
|
237
227
|
return <button onClick={handleClick}>Open Feedback</button>;
|
|
238
228
|
}
|
|
239
229
|
```
|
|
@@ -244,10 +234,10 @@ The `FeedbackProvider` component has been renamed to `AnyclickProvider`. The old
|
|
|
244
234
|
|
|
245
235
|
```tsx
|
|
246
236
|
// Old (deprecated)
|
|
247
|
-
import { FeedbackProvider, useFeedback } from
|
|
237
|
+
import { FeedbackProvider, useFeedback } from "@ewjdev/anyclick-react";
|
|
248
238
|
|
|
249
239
|
// New (recommended)
|
|
250
|
-
import { AnyclickProvider, useAnyclick } from
|
|
240
|
+
import { AnyclickProvider, useAnyclick } from "@ewjdev/anyclick-react";
|
|
251
241
|
```
|
|
252
242
|
|
|
253
243
|
## Documentation
|
package/dist/index.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
-
import { FeedbackAdapter, FeedbackType, FeedbackPayload, ScreenshotConfig, ScreenshotData } from '@ewjdev/anyclick-core';
|
|
2
|
+
import { FeedbackAdapter, FeedbackTriggerEvent, FeedbackType, FeedbackPayload, ScreenshotConfig, ScreenshotData, FeedbackMenuEvent } from '@ewjdev/anyclick-core';
|
|
3
3
|
export { DEFAULT_SCREENSHOT_CONFIG, DEFAULT_SENSITIVE_SELECTORS, ElementContext, FeedbackAdapter, FeedbackPayload, FeedbackType, PageContext, ScreenshotCapture, ScreenshotCaptureMode, ScreenshotConfig, ScreenshotData, captureAllScreenshots, captureScreenshot, estimateTotalSize, formatBytes, isScreenshotSupported } from '@ewjdev/anyclick-core';
|
|
4
4
|
import * as react from 'react';
|
|
5
5
|
import { ReactNode, CSSProperties } from 'react';
|
|
@@ -21,6 +21,13 @@ interface AnyclickTheme {
|
|
|
21
21
|
/** Whether anyclick functionality is disabled in this theme */
|
|
22
22
|
disabled?: boolean;
|
|
23
23
|
}
|
|
24
|
+
/**
|
|
25
|
+
* Menu positioning modes
|
|
26
|
+
* - static: Menu stays at exact click position (may go off-screen)
|
|
27
|
+
* - inView: Menu adjusts position to stay fully visible in viewport
|
|
28
|
+
* - dynamic: User can drag the menu to reposition it
|
|
29
|
+
*/
|
|
30
|
+
type MenuPositionMode = "static" | "inView" | "dynamic";
|
|
24
31
|
/**
|
|
25
32
|
* Configuration for highlight colors
|
|
26
33
|
*/
|
|
@@ -90,8 +97,9 @@ interface AnyclickProviderProps {
|
|
|
90
97
|
/**
|
|
91
98
|
* Filter function to determine if feedback should be captured for a target element
|
|
92
99
|
* Return true to allow feedback, false to ignore
|
|
100
|
+
* Accepts both MouseEvent (right-click) and TouchEvent (press-and-hold)
|
|
93
101
|
*/
|
|
94
|
-
targetFilter?: (event:
|
|
102
|
+
targetFilter?: (event: FeedbackTriggerEvent, target: Element) => boolean;
|
|
95
103
|
/** Custom menu items (defaults to Issue, Feature, Like) */
|
|
96
104
|
menuItems?: FeedbackMenuItem[];
|
|
97
105
|
/** Maximum length for innerText capture */
|
|
@@ -132,6 +140,12 @@ interface AnyclickProviderProps {
|
|
|
132
140
|
* Set to null or { disabled: true } to disable anyclick in this subtree.
|
|
133
141
|
*/
|
|
134
142
|
theme?: AnyclickTheme | null;
|
|
143
|
+
/** Duration in ms to hold touch before triggering context menu (default: 500) */
|
|
144
|
+
touchHoldDurationMs?: number;
|
|
145
|
+
/** Maximum movement in px before touch hold is cancelled (default: 10) */
|
|
146
|
+
touchMoveThreshold?: number;
|
|
147
|
+
/** Menu positioning mode (default: 'inView') */
|
|
148
|
+
menuPositionMode?: MenuPositionMode;
|
|
135
149
|
}
|
|
136
150
|
/**
|
|
137
151
|
* @deprecated Use AnyclickProviderProps instead
|
|
@@ -196,6 +210,8 @@ interface ContextMenuProps {
|
|
|
196
210
|
highlightConfig?: HighlightConfig;
|
|
197
211
|
/** Configuration for screenshot capture */
|
|
198
212
|
screenshotConfig?: ScreenshotConfig;
|
|
213
|
+
/** Menu positioning mode (default: 'inView') */
|
|
214
|
+
positionMode?: MenuPositionMode;
|
|
199
215
|
}
|
|
200
216
|
/**
|
|
201
217
|
* Props for the screenshot preview component
|
|
@@ -219,7 +235,7 @@ interface ScreenshotPreviewProps {
|
|
|
219
235
|
* AnyclickProvider component - wraps your app to enable feedback capture
|
|
220
236
|
* Supports scoped providers and nested theming
|
|
221
237
|
*/
|
|
222
|
-
declare function AnyclickProvider({ adapter, children, targetFilter, menuItems, maxInnerTextLength, maxOuterHTMLLength, maxAncestors, cooldownMs, stripAttributes, metadata, onSubmitSuccess, onSubmitError, menuStyle, menuClassName, disabled, highlightConfig, screenshotConfig, scoped, theme, }: AnyclickProviderProps): react_jsx_runtime.JSX.Element;
|
|
238
|
+
declare function AnyclickProvider({ adapter, children, targetFilter, menuItems, maxInnerTextLength, maxOuterHTMLLength, maxAncestors, cooldownMs, stripAttributes, metadata, onSubmitSuccess, onSubmitError, menuStyle, menuClassName, disabled, highlightConfig, screenshotConfig, scoped, theme, touchHoldDurationMs, touchMoveThreshold, }: AnyclickProviderProps): react_jsx_runtime.JSX.Element;
|
|
223
239
|
/**
|
|
224
240
|
* @deprecated Use AnyclickProvider instead
|
|
225
241
|
*/
|
|
@@ -228,7 +244,7 @@ declare const FeedbackProvider: typeof AnyclickProvider;
|
|
|
228
244
|
/**
|
|
229
245
|
* Context menu component for selecting feedback type
|
|
230
246
|
*/
|
|
231
|
-
declare function ContextMenu({ visible, position, targetElement, containerElement, items, onSelect, onClose, isSubmitting, style, className, highlightConfig, screenshotConfig, }: ContextMenuProps): react_jsx_runtime.JSX.Element | null;
|
|
247
|
+
declare function ContextMenu({ visible, position, targetElement, containerElement, items, onSelect, onClose, isSubmitting, style, className, highlightConfig, screenshotConfig, positionMode, }: ContextMenuProps): react_jsx_runtime.JSX.Element | null;
|
|
232
248
|
|
|
233
249
|
/**
|
|
234
250
|
* Screenshot preview component - shows captured screenshots before sending
|
|
@@ -272,7 +288,7 @@ interface ProviderInstance {
|
|
|
272
288
|
/** Depth in the provider hierarchy (0 = root) */
|
|
273
289
|
depth: number;
|
|
274
290
|
/** Handler to call when an event occurs in this provider's scope */
|
|
275
|
-
onContextMenu?: (event:
|
|
291
|
+
onContextMenu?: (event: FeedbackMenuEvent, element: Element) => boolean | void;
|
|
276
292
|
}
|
|
277
293
|
/**
|
|
278
294
|
* Provider registry store state
|
|
@@ -314,6 +330,12 @@ interface ProviderStore {
|
|
|
314
330
|
* in areas where a disabled scoped provider should block them
|
|
315
331
|
*/
|
|
316
332
|
isElementInDisabledScope: (element: Element) => boolean;
|
|
333
|
+
/**
|
|
334
|
+
* Check if an element is inside any scoped provider's container (enabled or not)
|
|
335
|
+
* This is used to prevent the global provider from handling touch events
|
|
336
|
+
* that should be handled by a scoped provider instead
|
|
337
|
+
*/
|
|
338
|
+
isElementInAnyScopedProvider: (element: Element) => boolean;
|
|
317
339
|
}
|
|
318
340
|
declare function generateProviderId(): string;
|
|
319
341
|
/**
|
|
@@ -396,4 +418,4 @@ declare function applyHighlights(targetElement: Element, config?: HighlightConfi
|
|
|
396
418
|
container: Element | null;
|
|
397
419
|
};
|
|
398
420
|
|
|
399
|
-
export { AnyclickContext, type AnyclickContextValue, AnyclickProvider, type AnyclickProviderProps, type AnyclickTheme, ContextMenu, type ContextMenuProps, FeedbackContext, type FeedbackContextValue, type FeedbackMenuItem, FeedbackProvider, type FeedbackProviderProps, type FeedbackUserContext, type HighlightColors, type HighlightConfig, type ProviderInstance, ScreenshotPreview, type ScreenshotPreviewProps, applyHighlights, clearHighlights, darkMenuStyles, defaultContainerSelectors, defaultHighlightColors, dispatchContextMenuEvent, filterMenuItemsByRole, findContainerParent, generateProviderId, highlightContainer, highlightTarget, menuCSSVariables, menuStyles, useAnyclick, useFeedback, useProviderStore };
|
|
421
|
+
export { AnyclickContext, type AnyclickContextValue, AnyclickProvider, type AnyclickProviderProps, type AnyclickTheme, ContextMenu, type ContextMenuProps, FeedbackContext, type FeedbackContextValue, type FeedbackMenuItem, FeedbackProvider, type FeedbackProviderProps, type FeedbackUserContext, type HighlightColors, type HighlightConfig, type MenuPositionMode, type ProviderInstance, ScreenshotPreview, type ScreenshotPreviewProps, applyHighlights, clearHighlights, darkMenuStyles, defaultContainerSelectors, defaultHighlightColors, dispatchContextMenuEvent, filterMenuItemsByRole, findContainerParent, generateProviderId, highlightContainer, highlightTarget, menuCSSVariables, menuStyles, useAnyclick, useFeedback, useProviderStore };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
-
import { FeedbackAdapter, FeedbackType, FeedbackPayload, ScreenshotConfig, ScreenshotData } from '@ewjdev/anyclick-core';
|
|
2
|
+
import { FeedbackAdapter, FeedbackTriggerEvent, FeedbackType, FeedbackPayload, ScreenshotConfig, ScreenshotData, FeedbackMenuEvent } from '@ewjdev/anyclick-core';
|
|
3
3
|
export { DEFAULT_SCREENSHOT_CONFIG, DEFAULT_SENSITIVE_SELECTORS, ElementContext, FeedbackAdapter, FeedbackPayload, FeedbackType, PageContext, ScreenshotCapture, ScreenshotCaptureMode, ScreenshotConfig, ScreenshotData, captureAllScreenshots, captureScreenshot, estimateTotalSize, formatBytes, isScreenshotSupported } from '@ewjdev/anyclick-core';
|
|
4
4
|
import * as react from 'react';
|
|
5
5
|
import { ReactNode, CSSProperties } from 'react';
|
|
@@ -21,6 +21,13 @@ interface AnyclickTheme {
|
|
|
21
21
|
/** Whether anyclick functionality is disabled in this theme */
|
|
22
22
|
disabled?: boolean;
|
|
23
23
|
}
|
|
24
|
+
/**
|
|
25
|
+
* Menu positioning modes
|
|
26
|
+
* - static: Menu stays at exact click position (may go off-screen)
|
|
27
|
+
* - inView: Menu adjusts position to stay fully visible in viewport
|
|
28
|
+
* - dynamic: User can drag the menu to reposition it
|
|
29
|
+
*/
|
|
30
|
+
type MenuPositionMode = "static" | "inView" | "dynamic";
|
|
24
31
|
/**
|
|
25
32
|
* Configuration for highlight colors
|
|
26
33
|
*/
|
|
@@ -90,8 +97,9 @@ interface AnyclickProviderProps {
|
|
|
90
97
|
/**
|
|
91
98
|
* Filter function to determine if feedback should be captured for a target element
|
|
92
99
|
* Return true to allow feedback, false to ignore
|
|
100
|
+
* Accepts both MouseEvent (right-click) and TouchEvent (press-and-hold)
|
|
93
101
|
*/
|
|
94
|
-
targetFilter?: (event:
|
|
102
|
+
targetFilter?: (event: FeedbackTriggerEvent, target: Element) => boolean;
|
|
95
103
|
/** Custom menu items (defaults to Issue, Feature, Like) */
|
|
96
104
|
menuItems?: FeedbackMenuItem[];
|
|
97
105
|
/** Maximum length for innerText capture */
|
|
@@ -132,6 +140,12 @@ interface AnyclickProviderProps {
|
|
|
132
140
|
* Set to null or { disabled: true } to disable anyclick in this subtree.
|
|
133
141
|
*/
|
|
134
142
|
theme?: AnyclickTheme | null;
|
|
143
|
+
/** Duration in ms to hold touch before triggering context menu (default: 500) */
|
|
144
|
+
touchHoldDurationMs?: number;
|
|
145
|
+
/** Maximum movement in px before touch hold is cancelled (default: 10) */
|
|
146
|
+
touchMoveThreshold?: number;
|
|
147
|
+
/** Menu positioning mode (default: 'inView') */
|
|
148
|
+
menuPositionMode?: MenuPositionMode;
|
|
135
149
|
}
|
|
136
150
|
/**
|
|
137
151
|
* @deprecated Use AnyclickProviderProps instead
|
|
@@ -196,6 +210,8 @@ interface ContextMenuProps {
|
|
|
196
210
|
highlightConfig?: HighlightConfig;
|
|
197
211
|
/** Configuration for screenshot capture */
|
|
198
212
|
screenshotConfig?: ScreenshotConfig;
|
|
213
|
+
/** Menu positioning mode (default: 'inView') */
|
|
214
|
+
positionMode?: MenuPositionMode;
|
|
199
215
|
}
|
|
200
216
|
/**
|
|
201
217
|
* Props for the screenshot preview component
|
|
@@ -219,7 +235,7 @@ interface ScreenshotPreviewProps {
|
|
|
219
235
|
* AnyclickProvider component - wraps your app to enable feedback capture
|
|
220
236
|
* Supports scoped providers and nested theming
|
|
221
237
|
*/
|
|
222
|
-
declare function AnyclickProvider({ adapter, children, targetFilter, menuItems, maxInnerTextLength, maxOuterHTMLLength, maxAncestors, cooldownMs, stripAttributes, metadata, onSubmitSuccess, onSubmitError, menuStyle, menuClassName, disabled, highlightConfig, screenshotConfig, scoped, theme, }: AnyclickProviderProps): react_jsx_runtime.JSX.Element;
|
|
238
|
+
declare function AnyclickProvider({ adapter, children, targetFilter, menuItems, maxInnerTextLength, maxOuterHTMLLength, maxAncestors, cooldownMs, stripAttributes, metadata, onSubmitSuccess, onSubmitError, menuStyle, menuClassName, disabled, highlightConfig, screenshotConfig, scoped, theme, touchHoldDurationMs, touchMoveThreshold, }: AnyclickProviderProps): react_jsx_runtime.JSX.Element;
|
|
223
239
|
/**
|
|
224
240
|
* @deprecated Use AnyclickProvider instead
|
|
225
241
|
*/
|
|
@@ -228,7 +244,7 @@ declare const FeedbackProvider: typeof AnyclickProvider;
|
|
|
228
244
|
/**
|
|
229
245
|
* Context menu component for selecting feedback type
|
|
230
246
|
*/
|
|
231
|
-
declare function ContextMenu({ visible, position, targetElement, containerElement, items, onSelect, onClose, isSubmitting, style, className, highlightConfig, screenshotConfig, }: ContextMenuProps): react_jsx_runtime.JSX.Element | null;
|
|
247
|
+
declare function ContextMenu({ visible, position, targetElement, containerElement, items, onSelect, onClose, isSubmitting, style, className, highlightConfig, screenshotConfig, positionMode, }: ContextMenuProps): react_jsx_runtime.JSX.Element | null;
|
|
232
248
|
|
|
233
249
|
/**
|
|
234
250
|
* Screenshot preview component - shows captured screenshots before sending
|
|
@@ -272,7 +288,7 @@ interface ProviderInstance {
|
|
|
272
288
|
/** Depth in the provider hierarchy (0 = root) */
|
|
273
289
|
depth: number;
|
|
274
290
|
/** Handler to call when an event occurs in this provider's scope */
|
|
275
|
-
onContextMenu?: (event:
|
|
291
|
+
onContextMenu?: (event: FeedbackMenuEvent, element: Element) => boolean | void;
|
|
276
292
|
}
|
|
277
293
|
/**
|
|
278
294
|
* Provider registry store state
|
|
@@ -314,6 +330,12 @@ interface ProviderStore {
|
|
|
314
330
|
* in areas where a disabled scoped provider should block them
|
|
315
331
|
*/
|
|
316
332
|
isElementInDisabledScope: (element: Element) => boolean;
|
|
333
|
+
/**
|
|
334
|
+
* Check if an element is inside any scoped provider's container (enabled or not)
|
|
335
|
+
* This is used to prevent the global provider from handling touch events
|
|
336
|
+
* that should be handled by a scoped provider instead
|
|
337
|
+
*/
|
|
338
|
+
isElementInAnyScopedProvider: (element: Element) => boolean;
|
|
317
339
|
}
|
|
318
340
|
declare function generateProviderId(): string;
|
|
319
341
|
/**
|
|
@@ -396,4 +418,4 @@ declare function applyHighlights(targetElement: Element, config?: HighlightConfi
|
|
|
396
418
|
container: Element | null;
|
|
397
419
|
};
|
|
398
420
|
|
|
399
|
-
export { AnyclickContext, type AnyclickContextValue, AnyclickProvider, type AnyclickProviderProps, type AnyclickTheme, ContextMenu, type ContextMenuProps, FeedbackContext, type FeedbackContextValue, type FeedbackMenuItem, FeedbackProvider, type FeedbackProviderProps, type FeedbackUserContext, type HighlightColors, type HighlightConfig, type ProviderInstance, ScreenshotPreview, type ScreenshotPreviewProps, applyHighlights, clearHighlights, darkMenuStyles, defaultContainerSelectors, defaultHighlightColors, dispatchContextMenuEvent, filterMenuItemsByRole, findContainerParent, generateProviderId, highlightContainer, highlightTarget, menuCSSVariables, menuStyles, useAnyclick, useFeedback, useProviderStore };
|
|
421
|
+
export { AnyclickContext, type AnyclickContextValue, AnyclickProvider, type AnyclickProviderProps, type AnyclickTheme, ContextMenu, type ContextMenuProps, FeedbackContext, type FeedbackContextValue, type FeedbackMenuItem, FeedbackProvider, type FeedbackProviderProps, type FeedbackUserContext, type HighlightColors, type HighlightConfig, type MenuPositionMode, type ProviderInstance, ScreenshotPreview, type ScreenshotPreviewProps, applyHighlights, clearHighlights, darkMenuStyles, defaultContainerSelectors, defaultHighlightColors, dispatchContextMenuEvent, filterMenuItemsByRole, findContainerParent, generateProviderId, highlightContainer, highlightTarget, menuCSSVariables, menuStyles, useAnyclick, useFeedback, useProviderStore };
|