@tsdraw/react 0.8.3 → 0.8.5
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.cjs +224 -40
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +37 -2
- package/dist/index.d.ts +37 -2
- package/dist/index.js +225 -41
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -1,6 +1,31 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
2
|
import { ReactNode, CSSProperties } from 'react';
|
|
3
|
-
import { ColorStyle, DashStyle, FillStyle, SizeStyle,
|
|
3
|
+
import { ZoomRange, ToolId, ColorStyle, DashStyle, FillStyle, SizeStyle, Editor, ToolDefinition, TsdrawEditorSnapshot, TsdrawDocumentSnapshot, Viewport } from '@tsdraw/core';
|
|
4
|
+
|
|
5
|
+
interface TsdrawCameraOptions {
|
|
6
|
+
panSpeed?: number;
|
|
7
|
+
zoomSpeed?: number;
|
|
8
|
+
zoomRange?: ZoomRange;
|
|
9
|
+
wheelBehavior?: 'pan' | 'zoom' | 'none';
|
|
10
|
+
slideEnabled?: boolean;
|
|
11
|
+
slideFriction?: number;
|
|
12
|
+
locked?: boolean;
|
|
13
|
+
}
|
|
14
|
+
interface TsdrawTouchOptions {
|
|
15
|
+
pinchToZoom?: boolean;
|
|
16
|
+
fingerPanInPenMode?: boolean;
|
|
17
|
+
tapUndoRedo?: boolean;
|
|
18
|
+
trackpadGestures?: boolean;
|
|
19
|
+
}
|
|
20
|
+
interface TsdrawKeyboardShortcutOptions {
|
|
21
|
+
enabled?: boolean;
|
|
22
|
+
toolShortcuts?: Record<string, ToolId>;
|
|
23
|
+
overrideDefaults?: boolean;
|
|
24
|
+
}
|
|
25
|
+
interface TsdrawPenOptions {
|
|
26
|
+
pressureSensitivity?: number;
|
|
27
|
+
autoDetect?: boolean;
|
|
28
|
+
}
|
|
4
29
|
|
|
5
30
|
type TsdrawStylePanelPartItem = 'colors' | 'dashes' | 'fills' | 'sizes' | (string & {});
|
|
6
31
|
interface TsdrawStylePanelRenderContext {
|
|
@@ -123,6 +148,16 @@ interface TsdrawProps {
|
|
|
123
148
|
initialToolId?: ToolId;
|
|
124
149
|
uiOptions?: TsdrawUiOptions;
|
|
125
150
|
onMount?: (api: TsdrawMountApi) => void | (() => void);
|
|
151
|
+
cameraOptions?: TsdrawCameraOptions;
|
|
152
|
+
touchOptions?: TsdrawTouchOptions;
|
|
153
|
+
keyboardShortcuts?: TsdrawKeyboardShortcutOptions;
|
|
154
|
+
penOptions?: TsdrawPenOptions;
|
|
155
|
+
readOnly?: boolean;
|
|
156
|
+
autoFocus?: boolean;
|
|
157
|
+
snapshot?: TsdrawEditorSnapshot;
|
|
158
|
+
onChange?: (snapshot: TsdrawDocumentSnapshot) => void;
|
|
159
|
+
onCameraChange?: (viewport: Viewport) => void;
|
|
160
|
+
onToolChange?: (toolId: ToolId) => void;
|
|
126
161
|
}
|
|
127
162
|
type TsdrawCanvasProps = TsdrawProps;
|
|
128
163
|
declare function Tsdraw(props: TsdrawProps): react_jsx_runtime.JSX.Element;
|
|
@@ -148,4 +183,4 @@ interface ToolbarPart {
|
|
|
148
183
|
}
|
|
149
184
|
declare function getDefaultToolbarIcon(toolId: ToolId, isActive: boolean): ReactNode;
|
|
150
185
|
|
|
151
|
-
export { type ToolbarActionItem, type ToolbarPart, type ToolbarPartItem, type ToolbarRenderItem, type ToolbarToolItem, Tsdraw, TsdrawCanvas, type TsdrawCanvasProps, type TsdrawCursorContext, type TsdrawCustomElement, type TsdrawCustomElementRenderArgs, type TsdrawCustomTool, type TsdrawMountApi, type TsdrawProps, type TsdrawStylePanelCustomPart, type TsdrawStylePanelPartItem, type TsdrawStylePanelRenderContext, type TsdrawToolOverlayState, type TsdrawToolbarBuiltInAction, type TsdrawUiOptions, type TsdrawUiPlacement, type UiAnchor, getDefaultToolbarIcon };
|
|
186
|
+
export { type ToolbarActionItem, type ToolbarPart, type ToolbarPartItem, type ToolbarRenderItem, type ToolbarToolItem, Tsdraw, type TsdrawCameraOptions, TsdrawCanvas, type TsdrawCanvasProps, type TsdrawCursorContext, type TsdrawCustomElement, type TsdrawCustomElementRenderArgs, type TsdrawCustomTool, type TsdrawKeyboardShortcutOptions, type TsdrawMountApi, type TsdrawPenOptions, type TsdrawProps, type TsdrawStylePanelCustomPart, type TsdrawStylePanelPartItem, type TsdrawStylePanelRenderContext, type TsdrawToolOverlayState, type TsdrawToolbarBuiltInAction, type TsdrawTouchOptions, type TsdrawUiOptions, type TsdrawUiPlacement, type UiAnchor, getDefaultToolbarIcon };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,31 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
2
|
import { ReactNode, CSSProperties } from 'react';
|
|
3
|
-
import { ColorStyle, DashStyle, FillStyle, SizeStyle,
|
|
3
|
+
import { ZoomRange, ToolId, ColorStyle, DashStyle, FillStyle, SizeStyle, Editor, ToolDefinition, TsdrawEditorSnapshot, TsdrawDocumentSnapshot, Viewport } from '@tsdraw/core';
|
|
4
|
+
|
|
5
|
+
interface TsdrawCameraOptions {
|
|
6
|
+
panSpeed?: number;
|
|
7
|
+
zoomSpeed?: number;
|
|
8
|
+
zoomRange?: ZoomRange;
|
|
9
|
+
wheelBehavior?: 'pan' | 'zoom' | 'none';
|
|
10
|
+
slideEnabled?: boolean;
|
|
11
|
+
slideFriction?: number;
|
|
12
|
+
locked?: boolean;
|
|
13
|
+
}
|
|
14
|
+
interface TsdrawTouchOptions {
|
|
15
|
+
pinchToZoom?: boolean;
|
|
16
|
+
fingerPanInPenMode?: boolean;
|
|
17
|
+
tapUndoRedo?: boolean;
|
|
18
|
+
trackpadGestures?: boolean;
|
|
19
|
+
}
|
|
20
|
+
interface TsdrawKeyboardShortcutOptions {
|
|
21
|
+
enabled?: boolean;
|
|
22
|
+
toolShortcuts?: Record<string, ToolId>;
|
|
23
|
+
overrideDefaults?: boolean;
|
|
24
|
+
}
|
|
25
|
+
interface TsdrawPenOptions {
|
|
26
|
+
pressureSensitivity?: number;
|
|
27
|
+
autoDetect?: boolean;
|
|
28
|
+
}
|
|
4
29
|
|
|
5
30
|
type TsdrawStylePanelPartItem = 'colors' | 'dashes' | 'fills' | 'sizes' | (string & {});
|
|
6
31
|
interface TsdrawStylePanelRenderContext {
|
|
@@ -123,6 +148,16 @@ interface TsdrawProps {
|
|
|
123
148
|
initialToolId?: ToolId;
|
|
124
149
|
uiOptions?: TsdrawUiOptions;
|
|
125
150
|
onMount?: (api: TsdrawMountApi) => void | (() => void);
|
|
151
|
+
cameraOptions?: TsdrawCameraOptions;
|
|
152
|
+
touchOptions?: TsdrawTouchOptions;
|
|
153
|
+
keyboardShortcuts?: TsdrawKeyboardShortcutOptions;
|
|
154
|
+
penOptions?: TsdrawPenOptions;
|
|
155
|
+
readOnly?: boolean;
|
|
156
|
+
autoFocus?: boolean;
|
|
157
|
+
snapshot?: TsdrawEditorSnapshot;
|
|
158
|
+
onChange?: (snapshot: TsdrawDocumentSnapshot) => void;
|
|
159
|
+
onCameraChange?: (viewport: Viewport) => void;
|
|
160
|
+
onToolChange?: (toolId: ToolId) => void;
|
|
126
161
|
}
|
|
127
162
|
type TsdrawCanvasProps = TsdrawProps;
|
|
128
163
|
declare function Tsdraw(props: TsdrawProps): react_jsx_runtime.JSX.Element;
|
|
@@ -148,4 +183,4 @@ interface ToolbarPart {
|
|
|
148
183
|
}
|
|
149
184
|
declare function getDefaultToolbarIcon(toolId: ToolId, isActive: boolean): ReactNode;
|
|
150
185
|
|
|
151
|
-
export { type ToolbarActionItem, type ToolbarPart, type ToolbarPartItem, type ToolbarRenderItem, type ToolbarToolItem, Tsdraw, TsdrawCanvas, type TsdrawCanvasProps, type TsdrawCursorContext, type TsdrawCustomElement, type TsdrawCustomElementRenderArgs, type TsdrawCustomTool, type TsdrawMountApi, type TsdrawProps, type TsdrawStylePanelCustomPart, type TsdrawStylePanelPartItem, type TsdrawStylePanelRenderContext, type TsdrawToolOverlayState, type TsdrawToolbarBuiltInAction, type TsdrawUiOptions, type TsdrawUiPlacement, type UiAnchor, getDefaultToolbarIcon };
|
|
186
|
+
export { type ToolbarActionItem, type ToolbarPart, type ToolbarPartItem, type ToolbarRenderItem, type ToolbarToolItem, Tsdraw, type TsdrawCameraOptions, TsdrawCanvas, type TsdrawCanvasProps, type TsdrawCursorContext, type TsdrawCustomElement, type TsdrawCustomElementRenderArgs, type TsdrawCustomTool, type TsdrawKeyboardShortcutOptions, type TsdrawMountApi, type TsdrawPenOptions, type TsdrawProps, type TsdrawStylePanelCustomPart, type TsdrawStylePanelPartItem, type TsdrawStylePanelRenderContext, type TsdrawToolOverlayState, type TsdrawToolbarBuiltInAction, type TsdrawTouchOptions, type TsdrawUiOptions, type TsdrawUiPlacement, type UiAnchor, getDefaultToolbarIcon };
|