@contember/echo 0.0.18

Sign up to get free protection for your applications and to get access to all the features.
Files changed (78) hide show
  1. package/README.md +101 -0
  2. package/dist/components/Echo.d.ts +3 -0
  3. package/dist/components/EchoLayout.d.ts +7 -0
  4. package/dist/components/Launcher.d.ts +6 -0
  5. package/dist/components/Overlay.d.ts +4 -0
  6. package/dist/components/atoms/Button.d.ts +9 -0
  7. package/dist/components/atoms/index.d.ts +1 -0
  8. package/dist/components/icons/CheckCircleIcon.d.ts +3 -0
  9. package/dist/components/icons/ChevronRightIcon.d.ts +3 -0
  10. package/dist/components/icons/ContemberIcon.d.ts +3 -0
  11. package/dist/components/icons/ExternalLinkIcon.d.ts +3 -0
  12. package/dist/components/icons/HighlightIcon.d.ts +3 -0
  13. package/dist/components/icons/MessageIcon.d.ts +3 -0
  14. package/dist/components/icons/PenIcon.d.ts +3 -0
  15. package/dist/components/icons/TrashIcon.d.ts +3 -0
  16. package/dist/components/icons/XCircleIcon.d.ts +3 -0
  17. package/dist/components/icons/XIcon.d.ts +3 -0
  18. package/dist/components/icons/index.d.ts +9 -0
  19. package/dist/config/defaultText.d.ts +2 -0
  20. package/dist/config/drawingConfig.d.ts +18 -0
  21. package/dist/contexts/EchoContext.d.ts +12 -0
  22. package/dist/contexts/index.d.ts +1 -0
  23. package/dist/echo.es.js +8069 -0
  24. package/dist/echo.umd.js +1112 -0
  25. package/dist/features/drawing/components/ColorSelector.d.ts +2 -0
  26. package/dist/features/drawing/components/DrawingLayer.d.ts +2 -0
  27. package/dist/features/drawing/components/DrawingToolbar.d.ts +2 -0
  28. package/dist/features/drawing/components/DrawingTooltip.d.ts +2 -0
  29. package/dist/features/drawing/components/Shape.d.ts +10 -0
  30. package/dist/features/drawing/components/ShapeActions.d.ts +2 -0
  31. package/dist/features/drawing/components/index.d.ts +5 -0
  32. package/dist/features/drawing/hooks/index.d.ts +3 -0
  33. package/dist/features/drawing/hooks/useDrag.d.ts +17 -0
  34. package/dist/features/drawing/hooks/useDrawing.d.ts +11 -0
  35. package/dist/features/drawing/hooks/useViewport.d.ts +4 -0
  36. package/dist/features/drawing/index.d.ts +5 -0
  37. package/dist/features/drawing/styles/ColorSelector.styles.d.ts +2 -0
  38. package/dist/features/drawing/styles/DrawingLayer.styles.d.ts +2 -0
  39. package/dist/features/drawing/styles/DrawingToolbar.styles.d.ts +2 -0
  40. package/dist/features/drawing/styles/DrawingTooltip.styles.d.ts +2 -0
  41. package/dist/features/drawing/styles/ShapeActions.styles.d.ts +2 -0
  42. package/dist/features/drawing/styles/index.d.ts +6 -0
  43. package/dist/features/drawing/types/index.d.ts +21 -0
  44. package/dist/features/drawing/utils/events.d.ts +5 -0
  45. package/dist/features/drawing/utils/index.d.ts +2 -0
  46. package/dist/features/drawing/utils/svg.d.ts +12 -0
  47. package/dist/features/feedback/components/FeedbackForm.d.ts +2 -0
  48. package/dist/features/feedback/components/index.d.ts +1 -0
  49. package/dist/features/feedback/index.d.ts +2 -0
  50. package/dist/features/feedback/styles/FeedbackForm.styles.d.ts +2 -0
  51. package/dist/features/feedback/styles/index.d.ts +1 -0
  52. package/dist/features/launcher/components/EchoButton.d.ts +2 -0
  53. package/dist/features/launcher/components/Notification.d.ts +2 -0
  54. package/dist/features/launcher/components/SavedPagesDropdown.d.ts +2 -0
  55. package/dist/features/launcher/components/WelcomeMessage.d.ts +2 -0
  56. package/dist/features/launcher/styles/EchoLauncherButton.styles.d.ts +2 -0
  57. package/dist/features/launcher/styles/Notification.styles.d.ts +2 -0
  58. package/dist/features/launcher/styles/SavedPagesDropdown.styles.d.ts +2 -0
  59. package/dist/features/launcher/styles/WelcomeMessage.styles.d.ts +2 -0
  60. package/dist/features/launcher/styles/index.d.ts +4 -0
  61. package/dist/index.d.ts +8 -0
  62. package/dist/stores/echoStore.d.ts +55 -0
  63. package/dist/stores/index.d.ts +2 -0
  64. package/dist/stores/welcomeMessageStore.d.ts +4 -0
  65. package/dist/styles/Echo.styles.d.ts +2 -0
  66. package/dist/styles/index.d.ts +2 -0
  67. package/dist/styles/zIndex.d.ts +13 -0
  68. package/dist/types.d.ts +93 -0
  69. package/dist/utils/color.d.ts +2 -0
  70. package/dist/utils/console.d.ts +4 -0
  71. package/dist/utils/debounce.d.ts +1 -0
  72. package/dist/utils/device.d.ts +1 -0
  73. package/dist/utils/geometry.d.ts +7 -0
  74. package/dist/utils/index.d.ts +5 -0
  75. package/dist/utils/screenshot.d.ts +6 -0
  76. package/dist/utils/shape.d.ts +2 -0
  77. package/dist/utils/storage.d.ts +28 -0
  78. 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,3 @@
1
+ import { type Component } from 'solid-js';
2
+ import type { EchoOptions } from '~/types';
3
+ export declare const Echo: Component<EchoOptions>;
@@ -0,0 +1,7 @@
1
+ import type { Component } from 'solid-js';
2
+ import type { Position } from '~/types';
3
+ interface EchoLayoutProps {
4
+ position?: Position;
5
+ }
6
+ export declare const EchoLayout: Component<EchoLayoutProps>;
7
+ export {};
@@ -0,0 +1,6 @@
1
+ import type { Component, JSXElement } from 'solid-js';
2
+ interface LauncherProps {
3
+ children: JSXElement;
4
+ }
5
+ export declare const Launcher: Component<LauncherProps>;
6
+ export {};
@@ -0,0 +1,4 @@
1
+ import type { Component, JSX } from 'solid-js';
2
+ export declare const Overlay: Component<{
3
+ children: JSX.Element;
4
+ }>;
@@ -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,3 @@
1
+ import type { Component } from 'solid-js';
2
+ import type { IconProps } from '~/types';
3
+ export declare const CheckCircleIcon: Component<IconProps>;
@@ -0,0 +1,3 @@
1
+ import type { Component } from 'solid-js';
2
+ import type { IconProps } from '~/types';
3
+ export declare const ChevronRightIcon: Component<IconProps>;
@@ -0,0 +1,3 @@
1
+ import type { Component } from 'solid-js';
2
+ import type { IconProps } from '~/types';
3
+ export declare const ContemberIcon: Component<IconProps>;
@@ -0,0 +1,3 @@
1
+ import type { Component } from 'solid-js';
2
+ import type { IconProps } from '~/types';
3
+ export declare const ExternalLinkIcon: Component<IconProps>;
@@ -0,0 +1,3 @@
1
+ import type { Component } from 'solid-js';
2
+ import type { IconProps } from '~/types';
3
+ export declare const HighlightIcon: Component<IconProps>;
@@ -0,0 +1,3 @@
1
+ import type { Component } from 'solid-js';
2
+ import type { IconProps } from '~/types';
3
+ export declare const MessageIcon: Component<IconProps>;
@@ -0,0 +1,3 @@
1
+ import type { Component } from 'solid-js';
2
+ import type { IconProps } from '~/types';
3
+ export declare const PenIcon: Component<IconProps>;
@@ -0,0 +1,3 @@
1
+ import type { Component } from 'solid-js';
2
+ import type { IconProps } from '~/types';
3
+ export declare const TrashIcon: Component<IconProps>;
@@ -0,0 +1,3 @@
1
+ import type { Component } from 'solid-js';
2
+ import type { IconProps } from '~/types';
3
+ export declare const XCircleIcon: Component<IconProps>;
@@ -0,0 +1,3 @@
1
+ import type { Component } from 'solid-js';
2
+ import type { IconProps } from '~/types';
3
+ export declare const XIcon: Component<IconProps>;
@@ -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,2 @@
1
+ import type { TextConfig } from '~/types';
2
+ export declare const defaultText: TextConfig;
@@ -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';