@contember/echo 0.0.18 → 0.0.20

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.
@@ -1,10 +1,8 @@
1
- import type { Component } from 'solid-js';
1
+ import { Component } from 'solid-js';
2
2
  import type { Shape as ShapeType } from '~/types';
3
- interface ShapeProps {
4
- shape: ShapeType;
3
+ type ShapeProps = ShapeType & {
5
4
  selectedShapeId: string | null;
6
5
  onShapeClick?: (id: string) => void;
7
- isMask?: boolean;
8
- }
6
+ };
9
7
  export declare const Shape: Component<ShapeProps>;
10
8
  export {};
@@ -1,5 +1,2 @@
1
1
  export * from './components';
2
2
  export * from './styles';
3
- export * from './hooks';
4
- export * from './types';
5
- export * from './utils';
@@ -0,0 +1,2 @@
1
+ import type { Component } from 'solid-js';
2
+ export declare const EchoLauncherButton: Component;
@@ -0,0 +1,40 @@
1
+ import type { DrawingTool, Point, Shape } from '~/types';
2
+ export interface DrawingState {
3
+ isDrawing: boolean;
4
+ selectedShapeId: string | null;
5
+ selectedTool: DrawingTool;
6
+ selectedColor: string;
7
+ shapes: Shape[];
8
+ currentPoints: Point[];
9
+ currentPath: string;
10
+ showTooltip: boolean;
11
+ mousePosition: Point;
12
+ hasDrawn: boolean;
13
+ isDragging: boolean;
14
+ dragStartPos: Point | null;
15
+ initialClickPos: Point | null;
16
+ dragOffset: Point | null;
17
+ cursor: string;
18
+ }
19
+ export interface DrawingStore {
20
+ state: DrawingState;
21
+ setState: (state: Partial<DrawingState>, isClearing?: boolean) => void;
22
+ methods: {
23
+ startDrawing: (initialPoint: Point) => void;
24
+ updateDrawing: (point: Point) => void;
25
+ finishDrawing: () => void;
26
+ handleShapeClick: (shapeId: string) => void;
27
+ handleStart: (e: MouseEvent | TouchEvent) => void;
28
+ handleMove: (e: MouseEvent | TouchEvent) => void;
29
+ handleEnd: (e: MouseEvent | TouchEvent) => void;
30
+ handleEnter: (e: MouseEvent | TouchEvent) => void;
31
+ handleLeave: (e: MouseEvent | TouchEvent) => void;
32
+ startDrag: (point: Point) => void;
33
+ stopDrag: () => void;
34
+ setInitialClick: (point: Point | null) => void;
35
+ updateDragOffset: (shape: {
36
+ points: Point[];
37
+ }, point: Point) => void;
38
+ };
39
+ }
40
+ export declare const createDrawingStore: (primaryColor: string, onStateChange?: (state: Partial<DrawingState>, isClearing?: boolean) => void) => DrawingStore;
@@ -1,55 +1,20 @@
1
- import type { DrawingTool, FeedbackData, Notification, Point, Screenshot, Shape, TextConfig } from '~/types';
2
- export interface FeedbackState {
3
- comment: string;
4
- screenshot?: Screenshot;
5
- isCapturing: boolean;
6
- isMinimized: boolean;
7
- }
8
- export interface DrawingState {
9
- isDrawing: boolean;
10
- selectedShapeId: string | null;
11
- selectedTool: DrawingTool;
12
- selectedColor: string;
13
- shapes: Shape[];
14
- currentPoints: Point[];
15
- currentPath: string;
16
- showTooltip: boolean;
17
- mousePosition: Point;
18
- hasDrawn: boolean;
19
- isDragging: boolean;
20
- dragStartPos: Point | null;
21
- initialClickPos: Point | null;
22
- dragOffset: Point | null;
23
- }
24
- export interface WidgetState {
25
- isOpen: boolean;
26
- primaryColor: string;
27
- onSubmit: (data: FeedbackData) => void | Promise<void>;
28
- notification: Notification;
29
- dimensions: {
30
- width: number;
31
- height: number;
1
+ import type { FeedbackData, TextConfig } from '~/types';
2
+ import { type DrawingStore } from './drawingStore';
3
+ import { type FeedbackStore } from './feedbackStore';
4
+ import { type WidgetStore } from './widgetStore';
5
+ export interface EchoStore {
6
+ feedback: FeedbackStore;
7
+ drawing: DrawingStore;
8
+ widget: WidgetStore;
9
+ text: TextConfig;
10
+ methods: {
11
+ reset: () => void;
32
12
  };
33
- isPagesDropdownOpen: boolean;
34
- pagesCount: number;
35
13
  }
36
14
  interface EchoStoreConfig {
37
15
  primaryColor: string;
38
16
  onSubmit: (data: FeedbackData) => Promise<void>;
39
17
  text: TextConfig;
40
18
  }
41
- export interface EchoStore {
42
- feedback: FeedbackState;
43
- setFeedback: (state: Partial<FeedbackState>, isClearing?: boolean) => void;
44
- drawing: DrawingState;
45
- setDrawing: (state: Partial<DrawingState>, isClearing?: boolean) => void;
46
- widget: WidgetState;
47
- setWidget: (state: Partial<WidgetState>) => void;
48
- text: TextConfig;
49
- methods: {
50
- reset: () => void;
51
- postSubmit: (result: Notification) => void;
52
- };
53
- }
54
19
  export declare const createEchoStore: (config: EchoStoreConfig) => EchoStore;
55
20
  export {};
@@ -0,0 +1,12 @@
1
+ import type { Screenshot } from '~/types';
2
+ export interface FeedbackState {
3
+ comment: string;
4
+ screenshot?: Screenshot;
5
+ isCapturing: boolean;
6
+ isMinimized: boolean;
7
+ }
8
+ export interface FeedbackStore {
9
+ state: FeedbackState;
10
+ setState: (state: Partial<FeedbackState>, isClearing?: boolean) => void;
11
+ }
12
+ export declare const createFeedbackStore: (initialComment?: string, onStateChange?: (state: Partial<FeedbackState>, isClearing?: boolean) => void) => FeedbackStore;
@@ -1,2 +1,4 @@
1
1
  export * from './echoStore';
2
- export * from './welcomeMessageStore';
2
+ export * from './drawingStore';
3
+ export * from './feedbackStore';
4
+ export * from './widgetStore';
@@ -0,0 +1,22 @@
1
+ import type { FeedbackData, Notification } from '~/types';
2
+ export interface WidgetState {
3
+ isOpen: boolean;
4
+ primaryColor: string;
5
+ notification: Notification;
6
+ dimensions: {
7
+ width: number;
8
+ height: number;
9
+ };
10
+ isPagesDropdownOpen: boolean;
11
+ pagesCount: number;
12
+ welcomeMessageIsClosing: boolean;
13
+ }
14
+ export interface WidgetStore {
15
+ state: WidgetState;
16
+ setState: (state: Partial<WidgetState>) => void;
17
+ methods: {
18
+ postSubmit: (result: Notification) => void;
19
+ onSubmit: (data: FeedbackData) => Promise<void>;
20
+ };
21
+ }
22
+ export declare const createWidgetStore: (primaryColor: string, onSubmit: (data: FeedbackData) => Promise<void>) => WidgetStore;
package/dist/types.d.ts CHANGED
@@ -63,7 +63,7 @@ export interface Point {
63
63
  y: number;
64
64
  }
65
65
  export type ShapeType = 'rectangle' | 'path';
66
- export type DrawingTool = 'highlight' | 'pen';
66
+ export type DrawingTool = 'rectangle' | 'path';
67
67
  export interface Shape {
68
68
  id: string;
69
69
  type: ShapeType;
@@ -5,3 +5,4 @@ export declare const getRectFromPoints: (points: Point[]) => {
5
5
  width: number;
6
6
  height: number;
7
7
  } | null;
8
+ export declare const getPathFromPoints: (points: Point[]) => string | null;
@@ -1,5 +1,4 @@
1
1
  export * from './device';
2
2
  export * from './screenshot';
3
3
  export * from './geometry';
4
- export * from './shape';
5
4
  export * from './storage';
@@ -1,4 +1,4 @@
1
- import type { DrawingState, FeedbackState } from '~/stores/echoStore';
1
+ import { DrawingState, FeedbackState } from '~/stores';
2
2
  import type { Shape } from '~/types';
3
3
  interface StoredPageState {
4
4
  feedback: {
@@ -0,0 +1,13 @@
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;
package/package.json CHANGED
@@ -1,6 +1,7 @@
1
1
  {
2
2
  "name": "@contember/echo",
3
- "version": "0.0.18",
3
+ "license": "Apache-2.0",
4
+ "version": "0.0.20",
4
5
  "type": "module",
5
6
  "author": "neumie@neumie.dev",
6
7
  "keywords": [
@@ -1,3 +0,0 @@
1
- export * from './useDrawing';
2
- export * from './useDrag';
3
- export * from './useViewport';
@@ -1,17 +0,0 @@
1
- import type { Point } from '~/types';
2
- export declare const useDrag: () => {
3
- state: {
4
- isDragging: import("solid-js").Accessor<boolean>;
5
- dragStartPos: import("solid-js").Accessor<Point | null>;
6
- initialClickPos: import("solid-js").Accessor<Point | null>;
7
- dragOffset: import("solid-js").Accessor<Point | null>;
8
- };
9
- actions: {
10
- startDrag: (point: Point) => void;
11
- stopDrag: () => void;
12
- setInitialClick: (point: Point | null) => void;
13
- updateDragOffset: (shape: {
14
- points: Point[];
15
- }, point: Point) => void;
16
- };
17
- };
@@ -1,11 +0,0 @@
1
- export declare const useDrawing: () => {
2
- state: import("../../../stores").DrawingState;
3
- actions: {
4
- handleStart: (e: MouseEvent | TouchEvent) => void;
5
- handleMove: (e: MouseEvent | TouchEvent) => void;
6
- handleEnd: (e: MouseEvent | TouchEvent) => void;
7
- handleEnter: (e: MouseEvent | TouchEvent) => void;
8
- handleLeave: (e: MouseEvent | TouchEvent) => void;
9
- handleShapeClick: (shapeId: string) => void;
10
- };
11
- };
@@ -1,4 +0,0 @@
1
- export declare const useViewport: () => {
2
- width: import("solid-js").Accessor<number>;
3
- height: import("solid-js").Accessor<number>;
4
- };
@@ -1,21 +0,0 @@
1
- import { Point, Shape } from '~/types';
2
- export interface DrawingState {
3
- isDrawing: boolean;
4
- currentPoints: Point[];
5
- currentPath: string;
6
- selectedShapeId: string | null;
7
- mousePosition: Point | null;
8
- showTooltip: boolean;
9
- hasDrawn: boolean;
10
- selectedTool: string;
11
- selectedColor: string;
12
- shapes: Shape[];
13
- isDragging: boolean;
14
- dragStartPos: Point | null;
15
- initialClickPos: Point | null;
16
- dragOffset: Point | null;
17
- }
18
- export interface ViewportState {
19
- width: number;
20
- height: number;
21
- }
@@ -1,2 +0,0 @@
1
- export * from './events';
2
- export * from './svg';
@@ -1,12 +0,0 @@
1
- import type { ViewportState } from '../types';
2
- export declare const generateCutoutPath: (viewport: ViewportState, currentPoints: {
3
- x: number;
4
- y: number;
5
- }[], shapes: {
6
- type: string;
7
- points: {
8
- x: number;
9
- y: number;
10
- }[];
11
- }[]) => string;
12
- export declare const getPenCursor: (color: string) => string;
@@ -1,2 +0,0 @@
1
- import type { Component } from 'solid-js';
2
- export declare const EchoButton: Component;
@@ -1,4 +0,0 @@
1
- export declare const welcomeMessageStore: {
2
- isClosing: import("solid-js").Accessor<boolean>;
3
- setIsClosing: import("solid-js").Setter<boolean>;
4
- };
@@ -1,2 +0,0 @@
1
- import { Shape } from '~/types';
2
- export declare const renderShape: (shape: Shape, isMask?: boolean) => import("solid-js").JSX.Element;