@ewjdev/anyclick-react 1.1.1 → 1.2.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/dist/index.d.mts +66 -36
- package/dist/index.d.ts +66 -36
- package/dist/index.js +174 -64
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +176 -65
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -2
package/dist/index.d.mts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
-
import {
|
|
3
|
-
export {
|
|
2
|
+
import { AnyclickAdapter, AnyclickTriggerEvent, AnyclickType, AnyclickPayload, ScreenshotConfig, ScreenshotData, AnyclickMenuEvent } from '@ewjdev/anyclick-core';
|
|
3
|
+
export { AnyclickAdapter, AnyclickPayload, AnyclickType, DEFAULT_SCREENSHOT_CONFIG, DEFAULT_SENSITIVE_SELECTORS, ElementContext, 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';
|
|
6
6
|
import * as zustand from 'zustand';
|
|
@@ -20,6 +20,22 @@ interface AnyclickTheme {
|
|
|
20
20
|
screenshotConfig?: ScreenshotConfig;
|
|
21
21
|
/** Whether anyclick functionality is disabled in this theme */
|
|
22
22
|
disabled?: boolean;
|
|
23
|
+
/**
|
|
24
|
+
* Enable fun mode (go-kart cursor) within this scoped provider.
|
|
25
|
+
* When true/configured, a FunModeBridge can hand off the track to the pointer.
|
|
26
|
+
*/
|
|
27
|
+
funMode?: boolean | FunModeThemeConfig;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Optional fun mode configuration (forwarded to pointer fun mode)
|
|
31
|
+
*/
|
|
32
|
+
interface FunModeThemeConfig {
|
|
33
|
+
/** Whether fun mode is enabled (default: true) */
|
|
34
|
+
enabled?: boolean;
|
|
35
|
+
/** Optional max speed override for this provider */
|
|
36
|
+
maxSpeed?: number;
|
|
37
|
+
/** Optional acceleration override */
|
|
38
|
+
acceleration?: number;
|
|
23
39
|
}
|
|
24
40
|
/**
|
|
25
41
|
* Menu positioning modes
|
|
@@ -55,11 +71,11 @@ interface HighlightConfig {
|
|
|
55
71
|
minChildrenForContainer?: number;
|
|
56
72
|
}
|
|
57
73
|
/**
|
|
58
|
-
* Menu item displayed in the
|
|
74
|
+
* Menu item displayed in the Anyclick context menu
|
|
59
75
|
*/
|
|
60
|
-
interface
|
|
76
|
+
interface AnyclickMenuItem {
|
|
61
77
|
/** Feedback type for this option (use unique identifier for parent items with children) */
|
|
62
|
-
type:
|
|
78
|
+
type: AnyclickType;
|
|
63
79
|
/** Display label */
|
|
64
80
|
label: string;
|
|
65
81
|
/** Optional icon */
|
|
@@ -69,12 +85,21 @@ interface FeedbackMenuItem {
|
|
|
69
85
|
/** Optional role(s) required to see this menu item */
|
|
70
86
|
requiredRoles?: string[];
|
|
71
87
|
/** Child menu items (creates a submenu) */
|
|
72
|
-
children?:
|
|
88
|
+
children?: AnyclickMenuItem[];
|
|
89
|
+
/**
|
|
90
|
+
* Optional click handler for custom behavior.
|
|
91
|
+
* Return `false` (or a Promise resolving to false) to skip the default submission flow.
|
|
92
|
+
*/
|
|
93
|
+
onClick?: (context: {
|
|
94
|
+
targetElement: Element | null;
|
|
95
|
+
containerElement: Element | null;
|
|
96
|
+
closeMenu: () => void;
|
|
97
|
+
}) => void | boolean | Promise<void | boolean>;
|
|
73
98
|
}
|
|
74
99
|
/**
|
|
75
100
|
* User context for role-based menu filtering
|
|
76
101
|
*/
|
|
77
|
-
interface
|
|
102
|
+
interface AnyclickUserContext {
|
|
78
103
|
/** User's role(s) */
|
|
79
104
|
roles?: string[];
|
|
80
105
|
/** User ID */
|
|
@@ -85,23 +110,25 @@ interface FeedbackUserContext {
|
|
|
85
110
|
/**
|
|
86
111
|
* Filter menu items based on user context
|
|
87
112
|
*/
|
|
88
|
-
declare function filterMenuItemsByRole(items:
|
|
113
|
+
declare function filterMenuItemsByRole(items: AnyclickMenuItem[], userContext?: AnyclickUserContext): AnyclickMenuItem[];
|
|
89
114
|
/**
|
|
90
115
|
* Props for the AnyclickProvider component
|
|
91
116
|
*/
|
|
92
117
|
interface AnyclickProviderProps {
|
|
93
|
-
/**
|
|
94
|
-
|
|
118
|
+
/** Header content */
|
|
119
|
+
header?: ReactNode | null;
|
|
120
|
+
/** The adapter to use for submitting anyclick */
|
|
121
|
+
adapter: AnyclickAdapter;
|
|
95
122
|
/** Child components */
|
|
96
123
|
children: ReactNode;
|
|
97
124
|
/**
|
|
98
|
-
* Filter function to determine if
|
|
99
|
-
* Return true to allow
|
|
125
|
+
* Filter function to determine if anyclick should be captured for a target element
|
|
126
|
+
* Return true to allow anyclick, false to ignore
|
|
100
127
|
* Accepts both MouseEvent (right-click) and TouchEvent (press-and-hold)
|
|
101
128
|
*/
|
|
102
|
-
targetFilter?: (event:
|
|
129
|
+
targetFilter?: (event: AnyclickTriggerEvent, target: Element) => boolean;
|
|
103
130
|
/** Custom menu items (defaults to Issue, Feature, Like) */
|
|
104
|
-
menuItems?:
|
|
131
|
+
menuItems?: AnyclickMenuItem[];
|
|
105
132
|
/** Maximum length for innerText capture */
|
|
106
133
|
maxInnerTextLength?: number;
|
|
107
134
|
/** Maximum length for outerHTML capture */
|
|
@@ -115,9 +142,9 @@ interface AnyclickProviderProps {
|
|
|
115
142
|
/** Additional metadata to include with every submission */
|
|
116
143
|
metadata?: Record<string, unknown>;
|
|
117
144
|
/** Callback after successful submission */
|
|
118
|
-
onSubmitSuccess?: (payload:
|
|
145
|
+
onSubmitSuccess?: (payload: AnyclickPayload) => void;
|
|
119
146
|
/** Callback after failed submission */
|
|
120
|
-
onSubmitError?: (error: Error, payload:
|
|
147
|
+
onSubmitError?: (error: Error, payload: AnyclickPayload) => void;
|
|
121
148
|
/** Custom styles for the context menu */
|
|
122
149
|
menuStyle?: CSSProperties;
|
|
123
150
|
/** Custom class name for the context menu */
|
|
@@ -147,26 +174,22 @@ interface AnyclickProviderProps {
|
|
|
147
174
|
/** Menu positioning mode (default: 'inView') */
|
|
148
175
|
menuPositionMode?: MenuPositionMode;
|
|
149
176
|
}
|
|
150
|
-
/**
|
|
151
|
-
* @deprecated Use AnyclickProviderProps instead
|
|
152
|
-
*/
|
|
153
|
-
type FeedbackProviderProps = AnyclickProviderProps;
|
|
154
177
|
/**
|
|
155
178
|
* Context value exposed by AnyclickProvider
|
|
156
179
|
*/
|
|
157
180
|
interface AnyclickContextValue {
|
|
158
|
-
/** Whether
|
|
181
|
+
/** Whether anyclick is currently enabled */
|
|
159
182
|
isEnabled: boolean;
|
|
160
183
|
/** Whether a submission is in progress */
|
|
161
184
|
isSubmitting: boolean;
|
|
162
|
-
/** Submit
|
|
163
|
-
|
|
164
|
-
/** Open the
|
|
185
|
+
/** Submit anyclick for a specific element */
|
|
186
|
+
submitAnyclick: (element: Element, type: AnyclickType, comment?: string) => Promise<void>;
|
|
187
|
+
/** Open the anyclick menu programmatically */
|
|
165
188
|
openMenu: (element: Element, position: {
|
|
166
189
|
x: number;
|
|
167
190
|
y: number;
|
|
168
191
|
}) => void;
|
|
169
|
-
/** Close the
|
|
192
|
+
/** Close the anyclick menu */
|
|
170
193
|
closeMenu: () => void;
|
|
171
194
|
/** The current merged theme (inherited from ancestors) */
|
|
172
195
|
theme: AnyclickTheme;
|
|
@@ -175,10 +198,6 @@ interface AnyclickContextValue {
|
|
|
175
198
|
/** The provider's unique ID */
|
|
176
199
|
providerId: string;
|
|
177
200
|
}
|
|
178
|
-
/**
|
|
179
|
-
* @deprecated Use AnyclickContextValue instead
|
|
180
|
-
*/
|
|
181
|
-
type FeedbackContextValue = AnyclickContextValue;
|
|
182
201
|
/**
|
|
183
202
|
* Props for the context menu component
|
|
184
203
|
*/
|
|
@@ -190,14 +209,14 @@ interface ContextMenuProps {
|
|
|
190
209
|
x: number;
|
|
191
210
|
y: number;
|
|
192
211
|
};
|
|
193
|
-
/** Target element for
|
|
212
|
+
/** Target element for anyclick */
|
|
194
213
|
targetElement: Element | null;
|
|
195
214
|
/** Container element found by highlight logic */
|
|
196
215
|
containerElement: Element | null;
|
|
197
216
|
/** Menu items to display */
|
|
198
|
-
items:
|
|
217
|
+
items: AnyclickMenuItem[];
|
|
199
218
|
/** Callback when an item is selected */
|
|
200
|
-
onSelect: (type:
|
|
219
|
+
onSelect: (type: AnyclickType, comment?: string, screenshots?: ScreenshotData) => void;
|
|
201
220
|
/** Callback when menu is closed */
|
|
202
221
|
onClose: () => void;
|
|
203
222
|
/** Whether submission is in progress */
|
|
@@ -212,6 +231,10 @@ interface ContextMenuProps {
|
|
|
212
231
|
screenshotConfig?: ScreenshotConfig;
|
|
213
232
|
/** Menu positioning mode (default: 'inView') */
|
|
214
233
|
positionMode?: MenuPositionMode;
|
|
234
|
+
/** Header content */
|
|
235
|
+
header?: ReactNode;
|
|
236
|
+
/** Footer content */
|
|
237
|
+
footer?: ReactNode;
|
|
215
238
|
}
|
|
216
239
|
/**
|
|
217
240
|
* Props for the screenshot preview component
|
|
@@ -235,16 +258,23 @@ interface ScreenshotPreviewProps {
|
|
|
235
258
|
* AnyclickProvider component - wraps your app to enable feedback capture
|
|
236
259
|
* Supports scoped providers and nested theming
|
|
237
260
|
*/
|
|
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;
|
|
261
|
+
declare function AnyclickProvider({ adapter, children, targetFilter, menuItems, maxInnerTextLength, maxOuterHTMLLength, maxAncestors, cooldownMs, stripAttributes, metadata, onSubmitSuccess, onSubmitError, menuStyle, menuClassName, disabled, highlightConfig, header, screenshotConfig, scoped, theme, touchHoldDurationMs, touchMoveThreshold, }: AnyclickProviderProps): react_jsx_runtime.JSX.Element;
|
|
239
262
|
/**
|
|
240
263
|
* @deprecated Use AnyclickProvider instead
|
|
241
264
|
*/
|
|
242
265
|
declare const FeedbackProvider: typeof AnyclickProvider;
|
|
243
266
|
|
|
267
|
+
/**
|
|
268
|
+
* FunModeBridge watches Anyclick scoped providers and toggles the pointer
|
|
269
|
+
* into fun mode (go-kart) when the cursor is within a provider with funMode enabled.
|
|
270
|
+
* Requires a PointerProvider higher in the tree.
|
|
271
|
+
*/
|
|
272
|
+
declare function FunModeBridge(): null;
|
|
273
|
+
|
|
244
274
|
/**
|
|
245
275
|
* Context menu component for selecting feedback type
|
|
246
276
|
*/
|
|
247
|
-
declare function ContextMenu({ visible, position, targetElement, containerElement, items, onSelect, onClose, isSubmitting, style, className, highlightConfig, screenshotConfig, positionMode, }: ContextMenuProps): react_jsx_runtime.JSX.Element | null;
|
|
277
|
+
declare function ContextMenu({ visible, position, targetElement, containerElement, items, onSelect, onClose, isSubmitting, style, className, highlightConfig, screenshotConfig, positionMode, header, footer, }: ContextMenuProps): react_jsx_runtime.JSX.Element | null;
|
|
248
278
|
|
|
249
279
|
/**
|
|
250
280
|
* Screenshot preview component - shows captured screenshots before sending
|
|
@@ -288,7 +318,7 @@ interface ProviderInstance {
|
|
|
288
318
|
/** Depth in the provider hierarchy (0 = root) */
|
|
289
319
|
depth: number;
|
|
290
320
|
/** Handler to call when an event occurs in this provider's scope */
|
|
291
|
-
onContextMenu?: (event:
|
|
321
|
+
onContextMenu?: (event: AnyclickMenuEvent, element: Element) => boolean | void;
|
|
292
322
|
}
|
|
293
323
|
/**
|
|
294
324
|
* Provider registry store state
|
|
@@ -418,4 +448,4 @@ declare function applyHighlights(targetElement: Element, config?: HighlightConfi
|
|
|
418
448
|
container: Element | null;
|
|
419
449
|
};
|
|
420
450
|
|
|
421
|
-
export { AnyclickContext, type AnyclickContextValue, AnyclickProvider, type AnyclickProviderProps, type AnyclickTheme,
|
|
451
|
+
export { AnyclickContext, type AnyclickContextValue, type AnyclickMenuItem, AnyclickProvider, type AnyclickProviderProps, type AnyclickTheme, type AnyclickUserContext, ContextMenu, type ContextMenuProps, FeedbackContext, FeedbackProvider, FunModeBridge, type FunModeThemeConfig, 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,6 +1,6 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
-
import {
|
|
3
|
-
export {
|
|
2
|
+
import { AnyclickAdapter, AnyclickTriggerEvent, AnyclickType, AnyclickPayload, ScreenshotConfig, ScreenshotData, AnyclickMenuEvent } from '@ewjdev/anyclick-core';
|
|
3
|
+
export { AnyclickAdapter, AnyclickPayload, AnyclickType, DEFAULT_SCREENSHOT_CONFIG, DEFAULT_SENSITIVE_SELECTORS, ElementContext, 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';
|
|
6
6
|
import * as zustand from 'zustand';
|
|
@@ -20,6 +20,22 @@ interface AnyclickTheme {
|
|
|
20
20
|
screenshotConfig?: ScreenshotConfig;
|
|
21
21
|
/** Whether anyclick functionality is disabled in this theme */
|
|
22
22
|
disabled?: boolean;
|
|
23
|
+
/**
|
|
24
|
+
* Enable fun mode (go-kart cursor) within this scoped provider.
|
|
25
|
+
* When true/configured, a FunModeBridge can hand off the track to the pointer.
|
|
26
|
+
*/
|
|
27
|
+
funMode?: boolean | FunModeThemeConfig;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Optional fun mode configuration (forwarded to pointer fun mode)
|
|
31
|
+
*/
|
|
32
|
+
interface FunModeThemeConfig {
|
|
33
|
+
/** Whether fun mode is enabled (default: true) */
|
|
34
|
+
enabled?: boolean;
|
|
35
|
+
/** Optional max speed override for this provider */
|
|
36
|
+
maxSpeed?: number;
|
|
37
|
+
/** Optional acceleration override */
|
|
38
|
+
acceleration?: number;
|
|
23
39
|
}
|
|
24
40
|
/**
|
|
25
41
|
* Menu positioning modes
|
|
@@ -55,11 +71,11 @@ interface HighlightConfig {
|
|
|
55
71
|
minChildrenForContainer?: number;
|
|
56
72
|
}
|
|
57
73
|
/**
|
|
58
|
-
* Menu item displayed in the
|
|
74
|
+
* Menu item displayed in the Anyclick context menu
|
|
59
75
|
*/
|
|
60
|
-
interface
|
|
76
|
+
interface AnyclickMenuItem {
|
|
61
77
|
/** Feedback type for this option (use unique identifier for parent items with children) */
|
|
62
|
-
type:
|
|
78
|
+
type: AnyclickType;
|
|
63
79
|
/** Display label */
|
|
64
80
|
label: string;
|
|
65
81
|
/** Optional icon */
|
|
@@ -69,12 +85,21 @@ interface FeedbackMenuItem {
|
|
|
69
85
|
/** Optional role(s) required to see this menu item */
|
|
70
86
|
requiredRoles?: string[];
|
|
71
87
|
/** Child menu items (creates a submenu) */
|
|
72
|
-
children?:
|
|
88
|
+
children?: AnyclickMenuItem[];
|
|
89
|
+
/**
|
|
90
|
+
* Optional click handler for custom behavior.
|
|
91
|
+
* Return `false` (or a Promise resolving to false) to skip the default submission flow.
|
|
92
|
+
*/
|
|
93
|
+
onClick?: (context: {
|
|
94
|
+
targetElement: Element | null;
|
|
95
|
+
containerElement: Element | null;
|
|
96
|
+
closeMenu: () => void;
|
|
97
|
+
}) => void | boolean | Promise<void | boolean>;
|
|
73
98
|
}
|
|
74
99
|
/**
|
|
75
100
|
* User context for role-based menu filtering
|
|
76
101
|
*/
|
|
77
|
-
interface
|
|
102
|
+
interface AnyclickUserContext {
|
|
78
103
|
/** User's role(s) */
|
|
79
104
|
roles?: string[];
|
|
80
105
|
/** User ID */
|
|
@@ -85,23 +110,25 @@ interface FeedbackUserContext {
|
|
|
85
110
|
/**
|
|
86
111
|
* Filter menu items based on user context
|
|
87
112
|
*/
|
|
88
|
-
declare function filterMenuItemsByRole(items:
|
|
113
|
+
declare function filterMenuItemsByRole(items: AnyclickMenuItem[], userContext?: AnyclickUserContext): AnyclickMenuItem[];
|
|
89
114
|
/**
|
|
90
115
|
* Props for the AnyclickProvider component
|
|
91
116
|
*/
|
|
92
117
|
interface AnyclickProviderProps {
|
|
93
|
-
/**
|
|
94
|
-
|
|
118
|
+
/** Header content */
|
|
119
|
+
header?: ReactNode | null;
|
|
120
|
+
/** The adapter to use for submitting anyclick */
|
|
121
|
+
adapter: AnyclickAdapter;
|
|
95
122
|
/** Child components */
|
|
96
123
|
children: ReactNode;
|
|
97
124
|
/**
|
|
98
|
-
* Filter function to determine if
|
|
99
|
-
* Return true to allow
|
|
125
|
+
* Filter function to determine if anyclick should be captured for a target element
|
|
126
|
+
* Return true to allow anyclick, false to ignore
|
|
100
127
|
* Accepts both MouseEvent (right-click) and TouchEvent (press-and-hold)
|
|
101
128
|
*/
|
|
102
|
-
targetFilter?: (event:
|
|
129
|
+
targetFilter?: (event: AnyclickTriggerEvent, target: Element) => boolean;
|
|
103
130
|
/** Custom menu items (defaults to Issue, Feature, Like) */
|
|
104
|
-
menuItems?:
|
|
131
|
+
menuItems?: AnyclickMenuItem[];
|
|
105
132
|
/** Maximum length for innerText capture */
|
|
106
133
|
maxInnerTextLength?: number;
|
|
107
134
|
/** Maximum length for outerHTML capture */
|
|
@@ -115,9 +142,9 @@ interface AnyclickProviderProps {
|
|
|
115
142
|
/** Additional metadata to include with every submission */
|
|
116
143
|
metadata?: Record<string, unknown>;
|
|
117
144
|
/** Callback after successful submission */
|
|
118
|
-
onSubmitSuccess?: (payload:
|
|
145
|
+
onSubmitSuccess?: (payload: AnyclickPayload) => void;
|
|
119
146
|
/** Callback after failed submission */
|
|
120
|
-
onSubmitError?: (error: Error, payload:
|
|
147
|
+
onSubmitError?: (error: Error, payload: AnyclickPayload) => void;
|
|
121
148
|
/** Custom styles for the context menu */
|
|
122
149
|
menuStyle?: CSSProperties;
|
|
123
150
|
/** Custom class name for the context menu */
|
|
@@ -147,26 +174,22 @@ interface AnyclickProviderProps {
|
|
|
147
174
|
/** Menu positioning mode (default: 'inView') */
|
|
148
175
|
menuPositionMode?: MenuPositionMode;
|
|
149
176
|
}
|
|
150
|
-
/**
|
|
151
|
-
* @deprecated Use AnyclickProviderProps instead
|
|
152
|
-
*/
|
|
153
|
-
type FeedbackProviderProps = AnyclickProviderProps;
|
|
154
177
|
/**
|
|
155
178
|
* Context value exposed by AnyclickProvider
|
|
156
179
|
*/
|
|
157
180
|
interface AnyclickContextValue {
|
|
158
|
-
/** Whether
|
|
181
|
+
/** Whether anyclick is currently enabled */
|
|
159
182
|
isEnabled: boolean;
|
|
160
183
|
/** Whether a submission is in progress */
|
|
161
184
|
isSubmitting: boolean;
|
|
162
|
-
/** Submit
|
|
163
|
-
|
|
164
|
-
/** Open the
|
|
185
|
+
/** Submit anyclick for a specific element */
|
|
186
|
+
submitAnyclick: (element: Element, type: AnyclickType, comment?: string) => Promise<void>;
|
|
187
|
+
/** Open the anyclick menu programmatically */
|
|
165
188
|
openMenu: (element: Element, position: {
|
|
166
189
|
x: number;
|
|
167
190
|
y: number;
|
|
168
191
|
}) => void;
|
|
169
|
-
/** Close the
|
|
192
|
+
/** Close the anyclick menu */
|
|
170
193
|
closeMenu: () => void;
|
|
171
194
|
/** The current merged theme (inherited from ancestors) */
|
|
172
195
|
theme: AnyclickTheme;
|
|
@@ -175,10 +198,6 @@ interface AnyclickContextValue {
|
|
|
175
198
|
/** The provider's unique ID */
|
|
176
199
|
providerId: string;
|
|
177
200
|
}
|
|
178
|
-
/**
|
|
179
|
-
* @deprecated Use AnyclickContextValue instead
|
|
180
|
-
*/
|
|
181
|
-
type FeedbackContextValue = AnyclickContextValue;
|
|
182
201
|
/**
|
|
183
202
|
* Props for the context menu component
|
|
184
203
|
*/
|
|
@@ -190,14 +209,14 @@ interface ContextMenuProps {
|
|
|
190
209
|
x: number;
|
|
191
210
|
y: number;
|
|
192
211
|
};
|
|
193
|
-
/** Target element for
|
|
212
|
+
/** Target element for anyclick */
|
|
194
213
|
targetElement: Element | null;
|
|
195
214
|
/** Container element found by highlight logic */
|
|
196
215
|
containerElement: Element | null;
|
|
197
216
|
/** Menu items to display */
|
|
198
|
-
items:
|
|
217
|
+
items: AnyclickMenuItem[];
|
|
199
218
|
/** Callback when an item is selected */
|
|
200
|
-
onSelect: (type:
|
|
219
|
+
onSelect: (type: AnyclickType, comment?: string, screenshots?: ScreenshotData) => void;
|
|
201
220
|
/** Callback when menu is closed */
|
|
202
221
|
onClose: () => void;
|
|
203
222
|
/** Whether submission is in progress */
|
|
@@ -212,6 +231,10 @@ interface ContextMenuProps {
|
|
|
212
231
|
screenshotConfig?: ScreenshotConfig;
|
|
213
232
|
/** Menu positioning mode (default: 'inView') */
|
|
214
233
|
positionMode?: MenuPositionMode;
|
|
234
|
+
/** Header content */
|
|
235
|
+
header?: ReactNode;
|
|
236
|
+
/** Footer content */
|
|
237
|
+
footer?: ReactNode;
|
|
215
238
|
}
|
|
216
239
|
/**
|
|
217
240
|
* Props for the screenshot preview component
|
|
@@ -235,16 +258,23 @@ interface ScreenshotPreviewProps {
|
|
|
235
258
|
* AnyclickProvider component - wraps your app to enable feedback capture
|
|
236
259
|
* Supports scoped providers and nested theming
|
|
237
260
|
*/
|
|
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;
|
|
261
|
+
declare function AnyclickProvider({ adapter, children, targetFilter, menuItems, maxInnerTextLength, maxOuterHTMLLength, maxAncestors, cooldownMs, stripAttributes, metadata, onSubmitSuccess, onSubmitError, menuStyle, menuClassName, disabled, highlightConfig, header, screenshotConfig, scoped, theme, touchHoldDurationMs, touchMoveThreshold, }: AnyclickProviderProps): react_jsx_runtime.JSX.Element;
|
|
239
262
|
/**
|
|
240
263
|
* @deprecated Use AnyclickProvider instead
|
|
241
264
|
*/
|
|
242
265
|
declare const FeedbackProvider: typeof AnyclickProvider;
|
|
243
266
|
|
|
267
|
+
/**
|
|
268
|
+
* FunModeBridge watches Anyclick scoped providers and toggles the pointer
|
|
269
|
+
* into fun mode (go-kart) when the cursor is within a provider with funMode enabled.
|
|
270
|
+
* Requires a PointerProvider higher in the tree.
|
|
271
|
+
*/
|
|
272
|
+
declare function FunModeBridge(): null;
|
|
273
|
+
|
|
244
274
|
/**
|
|
245
275
|
* Context menu component for selecting feedback type
|
|
246
276
|
*/
|
|
247
|
-
declare function ContextMenu({ visible, position, targetElement, containerElement, items, onSelect, onClose, isSubmitting, style, className, highlightConfig, screenshotConfig, positionMode, }: ContextMenuProps): react_jsx_runtime.JSX.Element | null;
|
|
277
|
+
declare function ContextMenu({ visible, position, targetElement, containerElement, items, onSelect, onClose, isSubmitting, style, className, highlightConfig, screenshotConfig, positionMode, header, footer, }: ContextMenuProps): react_jsx_runtime.JSX.Element | null;
|
|
248
278
|
|
|
249
279
|
/**
|
|
250
280
|
* Screenshot preview component - shows captured screenshots before sending
|
|
@@ -288,7 +318,7 @@ interface ProviderInstance {
|
|
|
288
318
|
/** Depth in the provider hierarchy (0 = root) */
|
|
289
319
|
depth: number;
|
|
290
320
|
/** Handler to call when an event occurs in this provider's scope */
|
|
291
|
-
onContextMenu?: (event:
|
|
321
|
+
onContextMenu?: (event: AnyclickMenuEvent, element: Element) => boolean | void;
|
|
292
322
|
}
|
|
293
323
|
/**
|
|
294
324
|
* Provider registry store state
|
|
@@ -418,4 +448,4 @@ declare function applyHighlights(targetElement: Element, config?: HighlightConfi
|
|
|
418
448
|
container: Element | null;
|
|
419
449
|
};
|
|
420
450
|
|
|
421
|
-
export { AnyclickContext, type AnyclickContextValue, AnyclickProvider, type AnyclickProviderProps, type AnyclickTheme,
|
|
451
|
+
export { AnyclickContext, type AnyclickContextValue, type AnyclickMenuItem, AnyclickProvider, type AnyclickProviderProps, type AnyclickTheme, type AnyclickUserContext, ContextMenu, type ContextMenuProps, FeedbackContext, FeedbackProvider, FunModeBridge, type FunModeThemeConfig, 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 };
|