@contember/echo 0.0.26 → 0.0.27

Sign up to get free protection for your applications and to get access to all the features.
Files changed (53) hide show
  1. package/dist/echo.es.js +767 -782
  2. package/dist/echo.es.js.map +1 -0
  3. package/dist/echo.umd.js +6 -5
  4. package/dist/echo.umd.js.map +1 -0
  5. package/package.json +1 -1
  6. package/dist/components/Echo.d.ts +0 -3
  7. package/dist/components/atoms/Button.d.ts +0 -7
  8. package/dist/components/atoms/Shape.d.ts +0 -8
  9. package/dist/components/atoms/index.d.ts +0 -1
  10. package/dist/components/icons/CheckCircleIcon.d.ts +0 -3
  11. package/dist/components/icons/ChevronRightIcon.d.ts +0 -3
  12. package/dist/components/icons/ContemberIcon.d.ts +0 -3
  13. package/dist/components/icons/ExternalLinkIcon.d.ts +0 -3
  14. package/dist/components/icons/HighlightIcon.d.ts +0 -3
  15. package/dist/components/icons/PenIcon.d.ts +0 -3
  16. package/dist/components/icons/TrashIcon.d.ts +0 -3
  17. package/dist/components/icons/XCircleIcon.d.ts +0 -3
  18. package/dist/components/icons/XIcon.d.ts +0 -3
  19. package/dist/components/icons/index.d.ts +0 -8
  20. package/dist/components/molecules/ColorSelector.d.ts +0 -2
  21. package/dist/components/molecules/DrawingToolbar.d.ts +0 -2
  22. package/dist/components/molecules/DrawingTooltip.d.ts +0 -2
  23. package/dist/components/molecules/LauncherButton.d.ts +0 -2
  24. package/dist/components/molecules/Notification.d.ts +0 -2
  25. package/dist/components/molecules/ShapeActions.d.ts +0 -2
  26. package/dist/components/molecules/StoredFeedback.d.ts +0 -2
  27. package/dist/components/molecules/WelcomeMessage.d.ts +0 -2
  28. package/dist/components/organisms/DrawingLayer.d.ts +0 -2
  29. package/dist/components/organisms/FeedbackForm.d.ts +0 -2
  30. package/dist/config/defaultText.d.ts +0 -2
  31. package/dist/config/drawingConfig.d.ts +0 -13
  32. package/dist/contexts/EchoContext.d.ts +0 -9
  33. package/dist/contexts/index.d.ts +0 -1
  34. package/dist/stores/drawingStore.d.ts +0 -39
  35. package/dist/stores/echoStore.d.ts +0 -16
  36. package/dist/stores/feedbackStore.d.ts +0 -12
  37. package/dist/stores/index.d.ts +0 -4
  38. package/dist/stores/widgetStore.d.ts +0 -19
  39. package/dist/types.d.ts +0 -87
  40. package/dist/utils/color.d.ts +0 -2
  41. package/dist/utils/common.d.ts +0 -1
  42. package/dist/utils/console.d.ts +0 -4
  43. package/dist/utils/debounce.d.ts +0 -1
  44. package/dist/utils/device.d.ts +0 -1
  45. package/dist/utils/events.d.ts +0 -5
  46. package/dist/utils/format.d.ts +0 -1
  47. package/dist/utils/geometry.d.ts +0 -8
  48. package/dist/utils/index.d.ts +0 -13
  49. package/dist/utils/listeners.d.ts +0 -22
  50. package/dist/utils/screenshot.d.ts +0 -2
  51. package/dist/utils/storage.d.ts +0 -28
  52. package/dist/utils/svg.d.ts +0 -13
  53. package/dist/utils/validators.d.ts +0 -2
@@ -1,2 +0,0 @@
1
- import { type Component } from 'solid-js';
2
- export declare const DrawingTooltip: Component;
@@ -1,2 +0,0 @@
1
- import type { Component } from 'solid-js';
2
- export declare const LauncherButton: Component;
@@ -1,2 +0,0 @@
1
- import type { Component } from 'solid-js';
2
- export declare const Notification: Component;
@@ -1,2 +0,0 @@
1
- import { type Component } from 'solid-js';
2
- export declare const ShapeActions: Component;
@@ -1,2 +0,0 @@
1
- import { type Component } from 'solid-js';
2
- export declare const StoredFeedback: Component;
@@ -1,2 +0,0 @@
1
- import type { Component } from 'solid-js';
2
- export declare const WelcomeMessage: Component;
@@ -1,2 +0,0 @@
1
- import { type Component } from 'solid-js';
2
- export declare const DrawingLayer: Component;
@@ -1,2 +0,0 @@
1
- import { type Component } from 'solid-js';
2
- export declare const FeedbackForm: Component;
@@ -1,2 +0,0 @@
1
- import type { TextConfig } from '~/types';
2
- export declare const defaultText: TextConfig;
@@ -1,13 +0,0 @@
1
- import type { DrawingTool } from '~/types';
2
- type ToolConfig = {
3
- id: DrawingTool;
4
- label: string;
5
- getCursor: (color: string) => string;
6
- strokeWidth: number;
7
- opacity: {
8
- selected: number;
9
- default: number;
10
- };
11
- };
12
- export declare const toolConfig: Record<DrawingTool, ToolConfig>;
13
- export {};
@@ -1,9 +0,0 @@
1
- import { type Component, JSXElement } from 'solid-js';
2
- import { type EchoStore } from '~/stores';
3
- import type { FullEchoConfig } from '~/types';
4
- type EchoProviderProps = FullEchoConfig & {
5
- children: JSXElement;
6
- };
7
- export declare const EchoProvider: Component<EchoProviderProps>;
8
- export declare const useEchoStore: () => EchoStore;
9
- export {};
@@ -1 +0,0 @@
1
- export * from './EchoContext';
@@ -1,39 +0,0 @@
1
- import type { DrawingTool, FullEchoConfig, Point, Shape } from '~/types';
2
- export type DrawingState = {
3
- isDrawing: boolean;
4
- selectedShapeId: string | null;
5
- selectedTool: DrawingTool;
6
- selectedColor: string;
7
- shapes: Shape[];
8
- currentPoints: Point[];
9
- showTooltip: boolean;
10
- mousePosition: Point;
11
- hasDrawn: boolean;
12
- isDragging: boolean;
13
- dragStartPos: Point | null;
14
- initialClickPos: Point | null;
15
- dragOffset: Point | null;
16
- cursor: string;
17
- };
18
- export type DrawingStore = {
19
- state: DrawingState;
20
- setState: (state: Partial<DrawingState>, isClearing?: boolean) => void;
21
- methods: {
22
- startDrawing: (initialPoint: Point) => void;
23
- updateDrawing: (point: Point) => void;
24
- finishDrawing: () => void;
25
- handleShapeClick: (shapeId: string) => void;
26
- handleStart: (e: MouseEvent | TouchEvent) => void;
27
- handleMove: (e: MouseEvent | TouchEvent) => void;
28
- handleEnd: (e: MouseEvent | TouchEvent) => void;
29
- handleEnter: (e: MouseEvent | TouchEvent) => void;
30
- handleLeave: (e: MouseEvent | TouchEvent) => void;
31
- startDrag: (point: Point) => void;
32
- stopDrag: () => void;
33
- setInitialClick: (point: Point | null) => void;
34
- updateDragOffset: (shape: {
35
- points: Point[];
36
- }, point: Point) => void;
37
- };
38
- };
39
- export declare const createDrawingStore: (config: FullEchoConfig, currentPageKey: string, onStateChange?: (state: Partial<DrawingState>, isClearing?: boolean) => void) => DrawingStore;
@@ -1,16 +0,0 @@
1
- import type { FeedbackPayload, FullEchoConfig } from '~/types';
2
- import { type Notification } from '~/types';
3
- import { type DrawingStore } from './drawingStore';
4
- import { type FeedbackStore } from './feedbackStore';
5
- import { type WidgetStore } from './widgetStore';
6
- export type EchoStore = {
7
- feedback: FeedbackStore;
8
- drawing: DrawingStore;
9
- widget: WidgetStore;
10
- methods: {
11
- reset: () => void;
12
- postSubmit: (result: Notification) => void;
13
- onSubmit: (data: FeedbackPayload) => Promise<void>;
14
- };
15
- };
16
- export declare const createEchoStore: (config: FullEchoConfig) => EchoStore;
@@ -1,12 +0,0 @@
1
- import type { FullEchoConfig, Screenshot } from '~/types';
2
- export type FeedbackState = {
3
- comment: string;
4
- screenshot?: Screenshot;
5
- isCapturing: boolean;
6
- isMinimized: boolean;
7
- };
8
- export type FeedbackStore = {
9
- state: FeedbackState;
10
- setState: (state: Partial<FeedbackState>, isClearing?: boolean) => void;
11
- };
12
- export declare const createFeedbackStore: (config: FullEchoConfig, currentPageKey: string, onStateChange?: (state: Partial<FeedbackState>, isClearing?: boolean) => void) => FeedbackStore;
@@ -1,4 +0,0 @@
1
- export * from './echoStore';
2
- export * from './drawingStore';
3
- export * from './feedbackStore';
4
- export * from './widgetStore';
@@ -1,19 +0,0 @@
1
- import type { FullEchoConfig, Notification, TextConfig } from '~/types';
2
- export type WidgetState = {
3
- text: TextConfig;
4
- isOpen: boolean;
5
- primaryColor: string;
6
- notification: Notification;
7
- dimensions: {
8
- width: number;
9
- height: number;
10
- };
11
- isStoredFeedbackOpen: boolean;
12
- pagesCount: number;
13
- welcomeMessageIsClosing: boolean;
14
- };
15
- export type WidgetStore = {
16
- state: WidgetState;
17
- setState: (state: Partial<WidgetState>) => void;
18
- };
19
- export declare const createWidgetStore: (config: FullEchoConfig, currentPageKey: string) => WidgetStore;
package/dist/types.d.ts DELETED
@@ -1,87 +0,0 @@
1
- export type Screenshot = `data:image/png;base64,${string}`;
2
- export type BrowserInfo = {
3
- width: number;
4
- height: number;
5
- screenWidth: number;
6
- screenHeight: number;
7
- };
8
- export type Metadata = {
9
- url: string;
10
- userAgent: string;
11
- timestamp: string;
12
- browserInfo: BrowserInfo;
13
- };
14
- export type ConsoleEntry = {
15
- type: 'log' | 'warn' | 'error';
16
- message: string;
17
- timestamp: string;
18
- };
19
- export type FeedbackPayload = {
20
- comment: string;
21
- screenshot?: Screenshot;
22
- metadata: Metadata;
23
- console: ConsoleEntry[];
24
- };
25
- export type Position = 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right';
26
- export type TextConfig = {
27
- welcomeMessage: {
28
- text: string;
29
- closeAriaLabel: string;
30
- };
31
- feedbackForm: {
32
- title: string;
33
- placeholder: string;
34
- screenshotAlt: string;
35
- submitButton: string;
36
- minimizeTitle: string;
37
- expandTitle: string;
38
- closeTitle: string;
39
- showFormTitle: string;
40
- };
41
- notification: {
42
- successTitle: string;
43
- errorTitle: string;
44
- errorMessage: string;
45
- hideTitle: string;
46
- };
47
- drawingTooltip: {
48
- text: string;
49
- };
50
- };
51
- export type EchoConfig = {
52
- onSubmit: (data: FeedbackPayload) => Promise<void>;
53
- position?: Position;
54
- primaryColor?: `#${string}`;
55
- textConfig?: Partial<TextConfig>;
56
- };
57
- export type FullEchoConfig = Required<EchoConfig> & {
58
- textConfig: TextConfig;
59
- };
60
- export declare const POSITIONS: Record<Position, {
61
- [key: string]: string;
62
- }>;
63
- export type Point = {
64
- x: number;
65
- y: number;
66
- };
67
- export type ShapeType = 'rectangle' | 'path';
68
- export type DrawingTool = 'rectangle' | 'path';
69
- export type Shape = {
70
- id: string;
71
- type: ShapeType;
72
- color: string;
73
- points: Point[];
74
- };
75
- export type IconProps = {
76
- size?: number;
77
- stroke?: string;
78
- strokeWidth?: number;
79
- class?: string;
80
- style?: any;
81
- fill?: string;
82
- };
83
- export type Notification = {
84
- show: boolean;
85
- type: 'success' | 'error' | null;
86
- message: string | null;
87
- };
@@ -1,2 +0,0 @@
1
- export declare const calculateLuminance: (hexColor: string) => number;
2
- export declare const getContrastColor: (hexColor: string) => string;
@@ -1 +0,0 @@
1
- export declare const deepMerge: (target: any, source: any) => any;
@@ -1,4 +0,0 @@
1
- import type { ConsoleEntry } from '~/types';
2
- export declare const setupConsole: () => void;
3
- export declare const cleanupConsole: () => void;
4
- export declare const getConsoleBuffer: () => ConsoleEntry[];
@@ -1 +0,0 @@
1
- export declare const debounce: <T extends (...args: any[]) => void>(func: T, wait: number) => (...args: Parameters<T>) => void;
@@ -1 +0,0 @@
1
- export declare const isMobileDevice: () => boolean;
@@ -1,5 +0,0 @@
1
- import type { Point } from '~/types';
2
- export declare const getPointFromEvent: (e: MouseEvent | TouchEvent, { useClientCoords }?: {
3
- useClientCoords?: boolean;
4
- }) => Point;
5
- export declare const getDistance: (p1: Point, p2: Point) => number;
@@ -1 +0,0 @@
1
- export declare const formatPath: (path: string) => string;
@@ -1,8 +0,0 @@
1
- import type { Point } from '~/types';
2
- export declare const getRectFromPoints: (points: Point[]) => {
3
- x: number;
4
- y: number;
5
- width: number;
6
- height: number;
7
- } | null;
8
- export declare const getPathFromPoints: (points: Point[]) => string | null;
@@ -1,13 +0,0 @@
1
- export * from './color';
2
- export * from './common';
3
- export * from './console';
4
- export * from './debounce';
5
- export * from './device';
6
- export * from './events';
7
- export * from './format';
8
- export * from './geometry';
9
- export * from './listeners';
10
- export * from './screenshot';
11
- export * from './storage';
12
- export * from './svg';
13
- export * from './validators';
@@ -1,22 +0,0 @@
1
- export declare const registerKeyListener: (key: string, callback: (e: KeyboardEvent) => void) => void;
2
- export declare const registerWindowEventListener: {
3
- <K extends keyof WindowEventMap>(props: {
4
- event: K;
5
- callback: (e: WindowEventMap[K]) => void;
6
- onMount?: () => void;
7
- onCleanup?: () => void;
8
- }): void;
9
- (props: {
10
- event: string;
11
- callback: (e: Event) => void;
12
- onMount?: () => void;
13
- onCleanup?: () => void;
14
- }): void;
15
- };
16
- export declare const registerMutationObserver: (props: {
17
- target: Node;
18
- options?: MutationObserverInit;
19
- callback: (mutations: MutationRecord[]) => void;
20
- onMount?: () => void;
21
- onCleanup?: () => void;
22
- }) => void;
@@ -1,2 +0,0 @@
1
- import type { Screenshot } from '~/types';
2
- export declare const captureScreenshot: () => Promise<Screenshot | undefined>;
@@ -1,28 +0,0 @@
1
- import { DrawingState, FeedbackState } from '~/stores';
2
- import type { Shape } from '~/types';
3
- type StoredPageState = {
4
- feedback: {
5
- comment: string;
6
- };
7
- drawing: {
8
- shapes: Shape[];
9
- };
10
- latestQuery?: string;
11
- };
12
- export declare const dispatchStorageChange: () => void;
13
- export declare const getStorageKey: (key: string) => string;
14
- export declare const getFromStorage: <T>(key: string, defaultValue: T) => T;
15
- export declare const setToStorage: <T>(key: string, value: T) => void;
16
- export declare const getPageKey: () => string;
17
- export declare const savePageState: (pageKey: string, state: {
18
- feedback: FeedbackState;
19
- drawing: DrawingState;
20
- }) => void;
21
- export declare const loadPageState: (pageKey: string) => StoredPageState | null;
22
- export declare const clearPageState: (pageKey: string) => void;
23
- export declare const getStoredPagesCount: () => number;
24
- export declare const getStoredPages: () => {
25
- path: string;
26
- state: StoredPageState;
27
- }[];
28
- export {};
@@ -1,13 +0,0 @@
1
- export declare const generateCutoutPath: (dimensions: {
2
- width: number;
3
- height: number;
4
- }, currentPoints: {
5
- x: number;
6
- y: number;
7
- }[], shapes: {
8
- type: string;
9
- points: {
10
- x: number;
11
- y: number;
12
- }[];
13
- }[]) => string;
@@ -1,2 +0,0 @@
1
- import type { EchoConfig } from '~/types';
2
- export declare const validateOptions: (options: EchoConfig) => void;