@tsdraw/react 0.6.2 → 0.8.0
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 +563 -107
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +27 -4
- package/dist/index.d.ts +27 -4
- package/dist/index.js +565 -109
- package/dist/index.js.map +1 -1
- package/dist/tsdraw.css +39 -11
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -1,6 +1,22 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import { ReactNode, CSSProperties } from 'react';
|
|
3
|
+
import { ColorStyle, DashStyle, FillStyle, SizeStyle, ToolId, Editor, ToolDefinition } from '@tsdraw/core';
|
|
4
|
+
|
|
5
|
+
type TsdrawStylePanelPartItem = 'colors' | 'dashes' | 'fills' | 'sizes' | (string & {});
|
|
6
|
+
interface TsdrawStylePanelRenderContext {
|
|
7
|
+
drawColor: ColorStyle;
|
|
8
|
+
drawDash: DashStyle;
|
|
9
|
+
drawFill: FillStyle;
|
|
10
|
+
drawSize: SizeStyle;
|
|
11
|
+
onColorSelect: (color: ColorStyle) => void;
|
|
12
|
+
onDashSelect: (dash: DashStyle) => void;
|
|
13
|
+
onFillSelect: (fill: FillStyle) => void;
|
|
14
|
+
onSizeSelect: (size: SizeStyle) => void;
|
|
15
|
+
}
|
|
16
|
+
interface TsdrawStylePanelCustomPart {
|
|
17
|
+
id: string;
|
|
18
|
+
render: (context: TsdrawStylePanelRenderContext) => ReactNode;
|
|
19
|
+
}
|
|
4
20
|
|
|
5
21
|
interface TsdrawCursorContext {
|
|
6
22
|
currentTool: ToolId;
|
|
@@ -32,6 +48,7 @@ interface TsdrawMountApi {
|
|
|
32
48
|
applyDrawStyle: (partial: Partial<{
|
|
33
49
|
color: ColorStyle;
|
|
34
50
|
dash: DashStyle;
|
|
51
|
+
fill: FillStyle;
|
|
35
52
|
size: SizeStyle;
|
|
36
53
|
}>) => void;
|
|
37
54
|
}
|
|
@@ -45,7 +62,10 @@ interface TsdrawCustomTool {
|
|
|
45
62
|
icon: ReactNode;
|
|
46
63
|
iconSelected?: ReactNode;
|
|
47
64
|
definition: ToolDefinition;
|
|
48
|
-
|
|
65
|
+
stylePanel?: {
|
|
66
|
+
parts?: TsdrawStylePanelPartItem[];
|
|
67
|
+
customParts?: TsdrawStylePanelCustomPart[];
|
|
68
|
+
};
|
|
49
69
|
}
|
|
50
70
|
type TsdrawToolbarBuiltInAction = 'undo' | 'redo';
|
|
51
71
|
type ToolbarPartItem = ToolId | TsdrawToolbarBuiltInAction;
|
|
@@ -57,10 +77,12 @@ interface TsdrawUiPlacement {
|
|
|
57
77
|
}
|
|
58
78
|
interface TsdrawUiOptions {
|
|
59
79
|
toolbar?: {
|
|
80
|
+
hide?: boolean;
|
|
60
81
|
placement?: TsdrawUiPlacement;
|
|
61
82
|
parts?: ToolbarPartItem[][];
|
|
62
83
|
};
|
|
63
84
|
stylePanel?: {
|
|
85
|
+
hide?: boolean;
|
|
64
86
|
placement?: TsdrawUiPlacement;
|
|
65
87
|
};
|
|
66
88
|
customElements?: TsdrawCustomElement[];
|
|
@@ -81,6 +103,7 @@ interface TsdrawCustomElementRenderArgs {
|
|
|
81
103
|
applyDrawStyle: (partial: Partial<{
|
|
82
104
|
color: ColorStyle;
|
|
83
105
|
dash: DashStyle;
|
|
106
|
+
fill: FillStyle;
|
|
84
107
|
size: SizeStyle;
|
|
85
108
|
}>) => void;
|
|
86
109
|
}
|
|
@@ -125,4 +148,4 @@ interface ToolbarPart {
|
|
|
125
148
|
}
|
|
126
149
|
declare function getDefaultToolbarIcon(toolId: ToolId, isActive: boolean): ReactNode;
|
|
127
150
|
|
|
128
|
-
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 TsdrawToolOverlayState, type TsdrawToolbarBuiltInAction, type TsdrawUiOptions, type TsdrawUiPlacement, type UiAnchor, getDefaultToolbarIcon };
|
|
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 };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,22 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import { ReactNode, CSSProperties } from 'react';
|
|
3
|
+
import { ColorStyle, DashStyle, FillStyle, SizeStyle, ToolId, Editor, ToolDefinition } from '@tsdraw/core';
|
|
4
|
+
|
|
5
|
+
type TsdrawStylePanelPartItem = 'colors' | 'dashes' | 'fills' | 'sizes' | (string & {});
|
|
6
|
+
interface TsdrawStylePanelRenderContext {
|
|
7
|
+
drawColor: ColorStyle;
|
|
8
|
+
drawDash: DashStyle;
|
|
9
|
+
drawFill: FillStyle;
|
|
10
|
+
drawSize: SizeStyle;
|
|
11
|
+
onColorSelect: (color: ColorStyle) => void;
|
|
12
|
+
onDashSelect: (dash: DashStyle) => void;
|
|
13
|
+
onFillSelect: (fill: FillStyle) => void;
|
|
14
|
+
onSizeSelect: (size: SizeStyle) => void;
|
|
15
|
+
}
|
|
16
|
+
interface TsdrawStylePanelCustomPart {
|
|
17
|
+
id: string;
|
|
18
|
+
render: (context: TsdrawStylePanelRenderContext) => ReactNode;
|
|
19
|
+
}
|
|
4
20
|
|
|
5
21
|
interface TsdrawCursorContext {
|
|
6
22
|
currentTool: ToolId;
|
|
@@ -32,6 +48,7 @@ interface TsdrawMountApi {
|
|
|
32
48
|
applyDrawStyle: (partial: Partial<{
|
|
33
49
|
color: ColorStyle;
|
|
34
50
|
dash: DashStyle;
|
|
51
|
+
fill: FillStyle;
|
|
35
52
|
size: SizeStyle;
|
|
36
53
|
}>) => void;
|
|
37
54
|
}
|
|
@@ -45,7 +62,10 @@ interface TsdrawCustomTool {
|
|
|
45
62
|
icon: ReactNode;
|
|
46
63
|
iconSelected?: ReactNode;
|
|
47
64
|
definition: ToolDefinition;
|
|
48
|
-
|
|
65
|
+
stylePanel?: {
|
|
66
|
+
parts?: TsdrawStylePanelPartItem[];
|
|
67
|
+
customParts?: TsdrawStylePanelCustomPart[];
|
|
68
|
+
};
|
|
49
69
|
}
|
|
50
70
|
type TsdrawToolbarBuiltInAction = 'undo' | 'redo';
|
|
51
71
|
type ToolbarPartItem = ToolId | TsdrawToolbarBuiltInAction;
|
|
@@ -57,10 +77,12 @@ interface TsdrawUiPlacement {
|
|
|
57
77
|
}
|
|
58
78
|
interface TsdrawUiOptions {
|
|
59
79
|
toolbar?: {
|
|
80
|
+
hide?: boolean;
|
|
60
81
|
placement?: TsdrawUiPlacement;
|
|
61
82
|
parts?: ToolbarPartItem[][];
|
|
62
83
|
};
|
|
63
84
|
stylePanel?: {
|
|
85
|
+
hide?: boolean;
|
|
64
86
|
placement?: TsdrawUiPlacement;
|
|
65
87
|
};
|
|
66
88
|
customElements?: TsdrawCustomElement[];
|
|
@@ -81,6 +103,7 @@ interface TsdrawCustomElementRenderArgs {
|
|
|
81
103
|
applyDrawStyle: (partial: Partial<{
|
|
82
104
|
color: ColorStyle;
|
|
83
105
|
dash: DashStyle;
|
|
106
|
+
fill: FillStyle;
|
|
84
107
|
size: SizeStyle;
|
|
85
108
|
}>) => void;
|
|
86
109
|
}
|
|
@@ -125,4 +148,4 @@ interface ToolbarPart {
|
|
|
125
148
|
}
|
|
126
149
|
declare function getDefaultToolbarIcon(toolId: ToolId, isActive: boolean): ReactNode;
|
|
127
150
|
|
|
128
|
-
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 TsdrawToolOverlayState, type TsdrawToolbarBuiltInAction, type TsdrawUiOptions, type TsdrawUiPlacement, type UiAnchor, getDefaultToolbarIcon };
|
|
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 };
|