@contember/echo 0.0.18
Sign up to get free protection for your applications and to get access to all the features.
- package/README.md +101 -0
- package/dist/components/Echo.d.ts +3 -0
- package/dist/components/EchoLayout.d.ts +7 -0
- package/dist/components/Launcher.d.ts +6 -0
- package/dist/components/Overlay.d.ts +4 -0
- package/dist/components/atoms/Button.d.ts +9 -0
- package/dist/components/atoms/index.d.ts +1 -0
- package/dist/components/icons/CheckCircleIcon.d.ts +3 -0
- package/dist/components/icons/ChevronRightIcon.d.ts +3 -0
- package/dist/components/icons/ContemberIcon.d.ts +3 -0
- package/dist/components/icons/ExternalLinkIcon.d.ts +3 -0
- package/dist/components/icons/HighlightIcon.d.ts +3 -0
- package/dist/components/icons/MessageIcon.d.ts +3 -0
- package/dist/components/icons/PenIcon.d.ts +3 -0
- package/dist/components/icons/TrashIcon.d.ts +3 -0
- package/dist/components/icons/XCircleIcon.d.ts +3 -0
- package/dist/components/icons/XIcon.d.ts +3 -0
- package/dist/components/icons/index.d.ts +9 -0
- package/dist/config/defaultText.d.ts +2 -0
- package/dist/config/drawingConfig.d.ts +18 -0
- package/dist/contexts/EchoContext.d.ts +12 -0
- package/dist/contexts/index.d.ts +1 -0
- package/dist/echo.es.js +8069 -0
- package/dist/echo.umd.js +1112 -0
- package/dist/features/drawing/components/ColorSelector.d.ts +2 -0
- package/dist/features/drawing/components/DrawingLayer.d.ts +2 -0
- package/dist/features/drawing/components/DrawingToolbar.d.ts +2 -0
- package/dist/features/drawing/components/DrawingTooltip.d.ts +2 -0
- package/dist/features/drawing/components/Shape.d.ts +10 -0
- package/dist/features/drawing/components/ShapeActions.d.ts +2 -0
- package/dist/features/drawing/components/index.d.ts +5 -0
- package/dist/features/drawing/hooks/index.d.ts +3 -0
- package/dist/features/drawing/hooks/useDrag.d.ts +17 -0
- package/dist/features/drawing/hooks/useDrawing.d.ts +11 -0
- package/dist/features/drawing/hooks/useViewport.d.ts +4 -0
- package/dist/features/drawing/index.d.ts +5 -0
- package/dist/features/drawing/styles/ColorSelector.styles.d.ts +2 -0
- package/dist/features/drawing/styles/DrawingLayer.styles.d.ts +2 -0
- package/dist/features/drawing/styles/DrawingToolbar.styles.d.ts +2 -0
- package/dist/features/drawing/styles/DrawingTooltip.styles.d.ts +2 -0
- package/dist/features/drawing/styles/ShapeActions.styles.d.ts +2 -0
- package/dist/features/drawing/styles/index.d.ts +6 -0
- package/dist/features/drawing/types/index.d.ts +21 -0
- package/dist/features/drawing/utils/events.d.ts +5 -0
- package/dist/features/drawing/utils/index.d.ts +2 -0
- package/dist/features/drawing/utils/svg.d.ts +12 -0
- package/dist/features/feedback/components/FeedbackForm.d.ts +2 -0
- package/dist/features/feedback/components/index.d.ts +1 -0
- package/dist/features/feedback/index.d.ts +2 -0
- package/dist/features/feedback/styles/FeedbackForm.styles.d.ts +2 -0
- package/dist/features/feedback/styles/index.d.ts +1 -0
- package/dist/features/launcher/components/EchoButton.d.ts +2 -0
- package/dist/features/launcher/components/Notification.d.ts +2 -0
- package/dist/features/launcher/components/SavedPagesDropdown.d.ts +2 -0
- package/dist/features/launcher/components/WelcomeMessage.d.ts +2 -0
- package/dist/features/launcher/styles/EchoLauncherButton.styles.d.ts +2 -0
- package/dist/features/launcher/styles/Notification.styles.d.ts +2 -0
- package/dist/features/launcher/styles/SavedPagesDropdown.styles.d.ts +2 -0
- package/dist/features/launcher/styles/WelcomeMessage.styles.d.ts +2 -0
- package/dist/features/launcher/styles/index.d.ts +4 -0
- package/dist/index.d.ts +8 -0
- package/dist/stores/echoStore.d.ts +55 -0
- package/dist/stores/index.d.ts +2 -0
- package/dist/stores/welcomeMessageStore.d.ts +4 -0
- package/dist/styles/Echo.styles.d.ts +2 -0
- package/dist/styles/index.d.ts +2 -0
- package/dist/styles/zIndex.d.ts +13 -0
- package/dist/types.d.ts +93 -0
- package/dist/utils/color.d.ts +2 -0
- package/dist/utils/console.d.ts +4 -0
- package/dist/utils/debounce.d.ts +1 -0
- package/dist/utils/device.d.ts +1 -0
- package/dist/utils/geometry.d.ts +7 -0
- package/dist/utils/index.d.ts +5 -0
- package/dist/utils/screenshot.d.ts +6 -0
- package/dist/utils/shape.d.ts +2 -0
- package/dist/utils/storage.d.ts +28 -0
- package/package.json +35 -0
package/README.md
ADDED
@@ -0,0 +1,101 @@
|
|
1
|
+
# Echo Widget
|
2
|
+
|
3
|
+
A lightweight feedback widget built with Solid.js that allows users to capture screenshots, annotate them, and submit feedback.
|
4
|
+
|
5
|
+
## Usage
|
6
|
+
|
7
|
+
### Using as an NPM Package
|
8
|
+
|
9
|
+
```typescript
|
10
|
+
import { initEcho } from '@contember/echo';
|
11
|
+
|
12
|
+
initEcho({
|
13
|
+
// Optional: widget position (default: 'bottom-right')
|
14
|
+
position: 'bottom-right',
|
15
|
+
|
16
|
+
// Optional: primary color for buttons and UI elements
|
17
|
+
primaryColor: '#007AFF',
|
18
|
+
|
19
|
+
// Optional: customize all text elements in the widget
|
20
|
+
textConfig: {
|
21
|
+
welcomeMessage: {
|
22
|
+
text: 'Click here to leave feedback',
|
23
|
+
closeAriaLabel: 'Close welcome message',
|
24
|
+
},
|
25
|
+
feedbackForm: {
|
26
|
+
title: 'Send Feedback',
|
27
|
+
placeholder: "What's on your mind? We'd love to hear your feedback...",
|
28
|
+
screenshotAlt: 'Screenshot Preview',
|
29
|
+
submitButton: 'Send Feedback',
|
30
|
+
minimizeTitle: 'Minimize',
|
31
|
+
expandTitle: 'Expand',
|
32
|
+
closeTitle: 'Close',
|
33
|
+
showFormTitle: 'Show Feedback Form',
|
34
|
+
},
|
35
|
+
notification: {
|
36
|
+
successTitle: 'Thank you for your feedback!',
|
37
|
+
errorTitle: 'Something went wrong.',
|
38
|
+
errorMessage: 'Failed to send feedback. Please try again.',
|
39
|
+
hideTitle: 'Hide notification',
|
40
|
+
},
|
41
|
+
drawingTooltip: {
|
42
|
+
text: 'Click & drag to draw',
|
43
|
+
},
|
44
|
+
},
|
45
|
+
|
46
|
+
// Required: callback function when feedback is submitted
|
47
|
+
onSubmit: async (data) => {
|
48
|
+
console.log('Feedback submitted:', data);
|
49
|
+
// Handle the feedback data (send to server, etc.)
|
50
|
+
}
|
51
|
+
});
|
52
|
+
```
|
53
|
+
|
54
|
+
### Using Directly in HTML
|
55
|
+
|
56
|
+
```html
|
57
|
+
<script type="module">
|
58
|
+
import { initEcho } from "https://esm.sh/@contember/echo";
|
59
|
+
|
60
|
+
initEcho({
|
61
|
+
// Optional: widget position (default: 'bottom-right')
|
62
|
+
position: 'bottom-right',
|
63
|
+
|
64
|
+
// Optional: primary color for buttons and UI elements
|
65
|
+
primaryColor: '#007AFF',
|
66
|
+
|
67
|
+
// Optional: customize all text elements in the widget
|
68
|
+
textConfig: {
|
69
|
+
welcomeMessage: {
|
70
|
+
text: 'Click here to leave feedback',
|
71
|
+
closeAriaLabel: 'Close welcome message',
|
72
|
+
},
|
73
|
+
feedbackForm: {
|
74
|
+
title: 'Send Feedback',
|
75
|
+
placeholder: "What's on your mind? We'd love to hear your feedback...",
|
76
|
+
screenshotAlt: 'Screenshot Preview',
|
77
|
+
submitButton: 'Send Feedback',
|
78
|
+
minimizeTitle: 'Minimize',
|
79
|
+
expandTitle: 'Expand',
|
80
|
+
closeTitle: 'Close',
|
81
|
+
showFormTitle: 'Show Feedback Form',
|
82
|
+
},
|
83
|
+
notification: {
|
84
|
+
successTitle: 'Thank you for your feedback!',
|
85
|
+
errorTitle: 'Something went wrong.',
|
86
|
+
errorMessage: 'Failed to send feedback. Please try again.',
|
87
|
+
hideTitle: 'Hide notification',
|
88
|
+
},
|
89
|
+
drawingTooltip: {
|
90
|
+
text: 'Click & drag to draw',
|
91
|
+
},
|
92
|
+
},
|
93
|
+
|
94
|
+
// Required: callback function when feedback is submitted
|
95
|
+
onSubmit: async (data) => {
|
96
|
+
console.log('Feedback submitted:', data);
|
97
|
+
// Handle the feedback data (send to server, etc.)
|
98
|
+
}
|
99
|
+
});
|
100
|
+
</script>
|
101
|
+
```
|
@@ -0,0 +1,9 @@
|
|
1
|
+
import type { Component, JSX } from 'solid-js';
|
2
|
+
import type { EnrichedStylesConfig } from '~/types';
|
3
|
+
type ButtonProps = JSX.ButtonHTMLAttributes<HTMLButtonElement> & {
|
4
|
+
variant?: 'primary' | 'secondary';
|
5
|
+
size?: 'xs' | 'sm' | 'md' | 'lg';
|
6
|
+
};
|
7
|
+
export declare const Button: Component<ButtonProps>;
|
8
|
+
export declare const buttonStyles: (config: EnrichedStylesConfig) => string;
|
9
|
+
export {};
|
@@ -0,0 +1 @@
|
|
1
|
+
export * from './Button';
|
@@ -0,0 +1,9 @@
|
|
1
|
+
export * from './MessageIcon';
|
2
|
+
export * from './ChevronRightIcon';
|
3
|
+
export * from './ContemberIcon';
|
4
|
+
export * from './HighlightIcon';
|
5
|
+
export * from './PenIcon';
|
6
|
+
export * from './TrashIcon';
|
7
|
+
export * from './CheckCircleIcon';
|
8
|
+
export * from './XCircleIcon';
|
9
|
+
export * from './XIcon';
|
@@ -0,0 +1,18 @@
|
|
1
|
+
import type { DrawingTool } from '~/types';
|
2
|
+
interface ToolConfig {
|
3
|
+
id: DrawingTool;
|
4
|
+
label: string;
|
5
|
+
cursor: string;
|
6
|
+
strokeWidth: {
|
7
|
+
active: number;
|
8
|
+
normal: number;
|
9
|
+
selected: number;
|
10
|
+
};
|
11
|
+
opacity: {
|
12
|
+
active: number;
|
13
|
+
normal: number;
|
14
|
+
};
|
15
|
+
hysteresis?: number;
|
16
|
+
}
|
17
|
+
export declare const drawingConfig: Record<DrawingTool, ToolConfig>;
|
18
|
+
export {};
|
@@ -0,0 +1,12 @@
|
|
1
|
+
import { type Component } from 'solid-js';
|
2
|
+
import { type EchoStore } from '~/stores';
|
3
|
+
import type { FeedbackData, TextConfig } from '~/types';
|
4
|
+
interface EchoProviderProps {
|
5
|
+
primaryColor: string;
|
6
|
+
onSubmit: (data: FeedbackData) => Promise<void>;
|
7
|
+
textConfig?: Partial<TextConfig>;
|
8
|
+
children: any;
|
9
|
+
}
|
10
|
+
export declare const EchoProvider: Component<EchoProviderProps>;
|
11
|
+
export declare const useEchoStore: () => EchoStore;
|
12
|
+
export {};
|
@@ -0,0 +1 @@
|
|
1
|
+
export * from './EchoContext';
|