canvu-react 0.4.14 → 0.4.16
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/native.cjs +1090 -158
- package/dist/native.cjs.map +1 -1
- package/dist/native.d.cts +51 -13
- package/dist/native.d.ts +51 -13
- package/dist/native.js +1089 -161
- package/dist/native.js.map +1 -1
- package/package.json +1 -1
package/dist/native.d.cts
CHANGED
|
@@ -1,10 +1,26 @@
|
|
|
1
|
-
import { C as Camera2D } from './shape-builders-CKEMjivV.cjs';
|
|
1
|
+
import { C as Camera2D, S as StrokeStyle } from './shape-builders-CKEMjivV.cjs';
|
|
2
2
|
export { o as createFreehandStrokeItem, q as createImageItem, t as createShapeId } from './shape-builders-CKEMjivV.cjs';
|
|
3
3
|
import { V as VectorSceneItem, R as Rect } from './types-BCCvY6ie.cjs';
|
|
4
4
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
5
|
+
import { StyleProp, ViewStyle, TextStyle } from 'react-native';
|
|
5
6
|
import * as react from 'react';
|
|
6
7
|
import { ReactNode } from 'react';
|
|
7
|
-
|
|
8
|
+
|
|
9
|
+
type TimedTrailPoint = {
|
|
10
|
+
readonly x: number;
|
|
11
|
+
readonly y: number;
|
|
12
|
+
readonly t: number;
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
type NativeVectorToolCursorKind = "crosshair" | "draw" | "marker" | "eraser" | "text";
|
|
16
|
+
type NativeVectorToolCursor = {
|
|
17
|
+
readonly kind: NativeVectorToolCursorKind;
|
|
18
|
+
readonly size: number;
|
|
19
|
+
readonly hotspot: {
|
|
20
|
+
readonly x: number;
|
|
21
|
+
readonly y: number;
|
|
22
|
+
};
|
|
23
|
+
};
|
|
8
24
|
|
|
9
25
|
type PlacementPreview = {
|
|
10
26
|
readonly kind: "rect" | "ellipse" | "architectural-cloud";
|
|
@@ -34,11 +50,12 @@ type PlacementPreview = {
|
|
|
34
50
|
};
|
|
35
51
|
} | {
|
|
36
52
|
readonly kind: "stroke";
|
|
37
|
-
readonly tool:
|
|
53
|
+
readonly tool: "draw" | "marker" | "laser";
|
|
38
54
|
readonly points: readonly {
|
|
39
55
|
readonly x: number;
|
|
40
56
|
readonly y: number;
|
|
41
57
|
}[];
|
|
58
|
+
readonly style?: StrokeStyle;
|
|
42
59
|
};
|
|
43
60
|
type NativeInteractionOverlayProps = {
|
|
44
61
|
readonly camera: Camera2D;
|
|
@@ -47,17 +64,19 @@ type NativeInteractionOverlayProps = {
|
|
|
47
64
|
readonly selectedItems: readonly VectorSceneItem[];
|
|
48
65
|
readonly showResizeHandles: boolean;
|
|
49
66
|
readonly placementPreview: PlacementPreview | null;
|
|
50
|
-
readonly eraserTrail?: readonly
|
|
51
|
-
|
|
52
|
-
readonly y: number;
|
|
53
|
-
}[];
|
|
54
|
-
readonly laserTrail?: readonly {
|
|
55
|
-
readonly x: number;
|
|
56
|
-
readonly y: number;
|
|
57
|
-
}[];
|
|
67
|
+
readonly eraserTrail?: readonly TimedTrailPoint[];
|
|
68
|
+
readonly laserTrail?: readonly TimedTrailPoint[];
|
|
58
69
|
readonly eraserPreviewItems?: readonly VectorSceneItem[];
|
|
70
|
+
readonly previewStrokeStyle?: StrokeStyle;
|
|
71
|
+
readonly toolCursor?: {
|
|
72
|
+
readonly cursor: NativeVectorToolCursor;
|
|
73
|
+
readonly point: {
|
|
74
|
+
readonly x: number;
|
|
75
|
+
readonly y: number;
|
|
76
|
+
};
|
|
77
|
+
} | null;
|
|
59
78
|
};
|
|
60
|
-
declare function NativeInteractionOverlay({ camera, width, height, selectedItems, showResizeHandles, placementPreview, eraserTrail, laserTrail, eraserPreviewItems, }: NativeInteractionOverlayProps): react_jsx_runtime.JSX.Element | null;
|
|
79
|
+
declare function NativeInteractionOverlay({ camera, width, height, selectedItems, showResizeHandles, placementPreview, eraserTrail, laserTrail, eraserPreviewItems, previewStrokeStyle, toolCursor, }: NativeInteractionOverlayProps): react_jsx_runtime.JSX.Element | null;
|
|
61
80
|
|
|
62
81
|
type NativeSceneRendererProps = {
|
|
63
82
|
readonly items: readonly VectorSceneItem[];
|
|
@@ -72,6 +91,15 @@ type NativeShapeRendererProps = {
|
|
|
72
91
|
};
|
|
73
92
|
declare function NativeShapeRenderer({ item }: NativeShapeRendererProps): react_jsx_runtime.JSX.Element | null;
|
|
74
93
|
|
|
94
|
+
type NativeVectorStyleToolId = "draw" | "marker";
|
|
95
|
+
type NativeVectorStyleInspectorProps = {
|
|
96
|
+
readonly toolId: NativeVectorStyleToolId;
|
|
97
|
+
readonly value: StrokeStyle;
|
|
98
|
+
readonly onChange: (patch: Partial<StrokeStyle>) => void;
|
|
99
|
+
readonly style?: StyleProp<ViewStyle>;
|
|
100
|
+
};
|
|
101
|
+
declare function NativeVectorStyleInspector({ toolId, value, onChange, style, }: NativeVectorStyleInspectorProps): react_jsx_runtime.JSX.Element;
|
|
102
|
+
|
|
75
103
|
/**
|
|
76
104
|
* Describes a single tool button rendered by {@link NativeVectorToolbar}.
|
|
77
105
|
*
|
|
@@ -196,9 +224,19 @@ type NativeVectorViewportProps = {
|
|
|
196
224
|
readonly onToolChangeRequest?: (toolId: string) => void;
|
|
197
225
|
readonly onCameraChange?: () => void;
|
|
198
226
|
readonly toolbar?: React.ReactNode;
|
|
227
|
+
readonly showStyleInspector?: boolean;
|
|
228
|
+
readonly styleInspectorPlacement?: "bottom" | "top-left";
|
|
199
229
|
};
|
|
200
230
|
declare const NativeVectorViewport: react.ForwardRefExoticComponent<NativeVectorViewportProps & react.RefAttributes<NativeVectorViewportHandle>>;
|
|
201
231
|
|
|
232
|
+
type NativeStyleColor = {
|
|
233
|
+
readonly name: string;
|
|
234
|
+
readonly hex: string;
|
|
235
|
+
};
|
|
236
|
+
declare const NATIVE_STYLE_PALETTE: readonly NativeStyleColor[];
|
|
237
|
+
declare function normalizeNativeStyleHex(stroke: string | undefined): string;
|
|
238
|
+
declare function nativeStyleColorWithOpacity(hex: string, opacity: number | undefined): string;
|
|
239
|
+
|
|
202
240
|
type NumberProp = string | number;
|
|
203
241
|
type SvgRectNode = {
|
|
204
242
|
readonly kind: "rect";
|
|
@@ -321,4 +359,4 @@ type SvgNode = SvgRectNode | SvgEllipseNode | SvgCircleNode | SvgLineNode | SvgP
|
|
|
321
359
|
*/
|
|
322
360
|
declare function parseSvgFragment(xml: string): SvgNode[];
|
|
323
361
|
|
|
324
|
-
export { DEFAULT_NATIVE_OVERFLOW_TOOL_IDS, DEFAULT_NATIVE_VECTOR_TOOLS, NativeInteractionOverlay, type NativeInteractionOverlayProps, NativeSceneRenderer, type NativeSceneRendererProps, NativeShapeRenderer, type NativeShapeRendererProps, type NativeVectorToolDefinition, NativeVectorToolbar, type NativeVectorToolbarDensity, type NativeVectorToolbarProps, type NativeVectorToolbarRenderOverflowInput, type NativeVectorToolbarRenderToolInput, type NativeVectorToolbarRenderToolLockInput, NativeVectorViewport, type NativeVectorViewportHandle, type NativeVectorViewportProps, type PlacementPreview, type SvgNode, VectorSceneItem, parseSvgFragment };
|
|
362
|
+
export { DEFAULT_NATIVE_OVERFLOW_TOOL_IDS, DEFAULT_NATIVE_VECTOR_TOOLS, NATIVE_STYLE_PALETTE, NativeInteractionOverlay, type NativeInteractionOverlayProps, NativeSceneRenderer, type NativeSceneRendererProps, NativeShapeRenderer, type NativeShapeRendererProps, type NativeStyleColor, NativeVectorStyleInspector, type NativeVectorStyleInspectorProps, type NativeVectorStyleToolId, type NativeVectorToolDefinition, NativeVectorToolbar, type NativeVectorToolbarDensity, type NativeVectorToolbarProps, type NativeVectorToolbarRenderOverflowInput, type NativeVectorToolbarRenderToolInput, type NativeVectorToolbarRenderToolLockInput, NativeVectorViewport, type NativeVectorViewportHandle, type NativeVectorViewportProps, type PlacementPreview, type SvgNode, VectorSceneItem, nativeStyleColorWithOpacity, normalizeNativeStyleHex, parseSvgFragment };
|
package/dist/native.d.ts
CHANGED
|
@@ -1,10 +1,26 @@
|
|
|
1
|
-
import { C as Camera2D } from './shape-builders-Cyh8zvDG.js';
|
|
1
|
+
import { C as Camera2D, S as StrokeStyle } from './shape-builders-Cyh8zvDG.js';
|
|
2
2
|
export { o as createFreehandStrokeItem, q as createImageItem, t as createShapeId } from './shape-builders-Cyh8zvDG.js';
|
|
3
3
|
import { V as VectorSceneItem, R as Rect } from './types-BCCvY6ie.js';
|
|
4
4
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
5
|
+
import { StyleProp, ViewStyle, TextStyle } from 'react-native';
|
|
5
6
|
import * as react from 'react';
|
|
6
7
|
import { ReactNode } from 'react';
|
|
7
|
-
|
|
8
|
+
|
|
9
|
+
type TimedTrailPoint = {
|
|
10
|
+
readonly x: number;
|
|
11
|
+
readonly y: number;
|
|
12
|
+
readonly t: number;
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
type NativeVectorToolCursorKind = "crosshair" | "draw" | "marker" | "eraser" | "text";
|
|
16
|
+
type NativeVectorToolCursor = {
|
|
17
|
+
readonly kind: NativeVectorToolCursorKind;
|
|
18
|
+
readonly size: number;
|
|
19
|
+
readonly hotspot: {
|
|
20
|
+
readonly x: number;
|
|
21
|
+
readonly y: number;
|
|
22
|
+
};
|
|
23
|
+
};
|
|
8
24
|
|
|
9
25
|
type PlacementPreview = {
|
|
10
26
|
readonly kind: "rect" | "ellipse" | "architectural-cloud";
|
|
@@ -34,11 +50,12 @@ type PlacementPreview = {
|
|
|
34
50
|
};
|
|
35
51
|
} | {
|
|
36
52
|
readonly kind: "stroke";
|
|
37
|
-
readonly tool:
|
|
53
|
+
readonly tool: "draw" | "marker" | "laser";
|
|
38
54
|
readonly points: readonly {
|
|
39
55
|
readonly x: number;
|
|
40
56
|
readonly y: number;
|
|
41
57
|
}[];
|
|
58
|
+
readonly style?: StrokeStyle;
|
|
42
59
|
};
|
|
43
60
|
type NativeInteractionOverlayProps = {
|
|
44
61
|
readonly camera: Camera2D;
|
|
@@ -47,17 +64,19 @@ type NativeInteractionOverlayProps = {
|
|
|
47
64
|
readonly selectedItems: readonly VectorSceneItem[];
|
|
48
65
|
readonly showResizeHandles: boolean;
|
|
49
66
|
readonly placementPreview: PlacementPreview | null;
|
|
50
|
-
readonly eraserTrail?: readonly
|
|
51
|
-
|
|
52
|
-
readonly y: number;
|
|
53
|
-
}[];
|
|
54
|
-
readonly laserTrail?: readonly {
|
|
55
|
-
readonly x: number;
|
|
56
|
-
readonly y: number;
|
|
57
|
-
}[];
|
|
67
|
+
readonly eraserTrail?: readonly TimedTrailPoint[];
|
|
68
|
+
readonly laserTrail?: readonly TimedTrailPoint[];
|
|
58
69
|
readonly eraserPreviewItems?: readonly VectorSceneItem[];
|
|
70
|
+
readonly previewStrokeStyle?: StrokeStyle;
|
|
71
|
+
readonly toolCursor?: {
|
|
72
|
+
readonly cursor: NativeVectorToolCursor;
|
|
73
|
+
readonly point: {
|
|
74
|
+
readonly x: number;
|
|
75
|
+
readonly y: number;
|
|
76
|
+
};
|
|
77
|
+
} | null;
|
|
59
78
|
};
|
|
60
|
-
declare function NativeInteractionOverlay({ camera, width, height, selectedItems, showResizeHandles, placementPreview, eraserTrail, laserTrail, eraserPreviewItems, }: NativeInteractionOverlayProps): react_jsx_runtime.JSX.Element | null;
|
|
79
|
+
declare function NativeInteractionOverlay({ camera, width, height, selectedItems, showResizeHandles, placementPreview, eraserTrail, laserTrail, eraserPreviewItems, previewStrokeStyle, toolCursor, }: NativeInteractionOverlayProps): react_jsx_runtime.JSX.Element | null;
|
|
61
80
|
|
|
62
81
|
type NativeSceneRendererProps = {
|
|
63
82
|
readonly items: readonly VectorSceneItem[];
|
|
@@ -72,6 +91,15 @@ type NativeShapeRendererProps = {
|
|
|
72
91
|
};
|
|
73
92
|
declare function NativeShapeRenderer({ item }: NativeShapeRendererProps): react_jsx_runtime.JSX.Element | null;
|
|
74
93
|
|
|
94
|
+
type NativeVectorStyleToolId = "draw" | "marker";
|
|
95
|
+
type NativeVectorStyleInspectorProps = {
|
|
96
|
+
readonly toolId: NativeVectorStyleToolId;
|
|
97
|
+
readonly value: StrokeStyle;
|
|
98
|
+
readonly onChange: (patch: Partial<StrokeStyle>) => void;
|
|
99
|
+
readonly style?: StyleProp<ViewStyle>;
|
|
100
|
+
};
|
|
101
|
+
declare function NativeVectorStyleInspector({ toolId, value, onChange, style, }: NativeVectorStyleInspectorProps): react_jsx_runtime.JSX.Element;
|
|
102
|
+
|
|
75
103
|
/**
|
|
76
104
|
* Describes a single tool button rendered by {@link NativeVectorToolbar}.
|
|
77
105
|
*
|
|
@@ -196,9 +224,19 @@ type NativeVectorViewportProps = {
|
|
|
196
224
|
readonly onToolChangeRequest?: (toolId: string) => void;
|
|
197
225
|
readonly onCameraChange?: () => void;
|
|
198
226
|
readonly toolbar?: React.ReactNode;
|
|
227
|
+
readonly showStyleInspector?: boolean;
|
|
228
|
+
readonly styleInspectorPlacement?: "bottom" | "top-left";
|
|
199
229
|
};
|
|
200
230
|
declare const NativeVectorViewport: react.ForwardRefExoticComponent<NativeVectorViewportProps & react.RefAttributes<NativeVectorViewportHandle>>;
|
|
201
231
|
|
|
232
|
+
type NativeStyleColor = {
|
|
233
|
+
readonly name: string;
|
|
234
|
+
readonly hex: string;
|
|
235
|
+
};
|
|
236
|
+
declare const NATIVE_STYLE_PALETTE: readonly NativeStyleColor[];
|
|
237
|
+
declare function normalizeNativeStyleHex(stroke: string | undefined): string;
|
|
238
|
+
declare function nativeStyleColorWithOpacity(hex: string, opacity: number | undefined): string;
|
|
239
|
+
|
|
202
240
|
type NumberProp = string | number;
|
|
203
241
|
type SvgRectNode = {
|
|
204
242
|
readonly kind: "rect";
|
|
@@ -321,4 +359,4 @@ type SvgNode = SvgRectNode | SvgEllipseNode | SvgCircleNode | SvgLineNode | SvgP
|
|
|
321
359
|
*/
|
|
322
360
|
declare function parseSvgFragment(xml: string): SvgNode[];
|
|
323
361
|
|
|
324
|
-
export { DEFAULT_NATIVE_OVERFLOW_TOOL_IDS, DEFAULT_NATIVE_VECTOR_TOOLS, NativeInteractionOverlay, type NativeInteractionOverlayProps, NativeSceneRenderer, type NativeSceneRendererProps, NativeShapeRenderer, type NativeShapeRendererProps, type NativeVectorToolDefinition, NativeVectorToolbar, type NativeVectorToolbarDensity, type NativeVectorToolbarProps, type NativeVectorToolbarRenderOverflowInput, type NativeVectorToolbarRenderToolInput, type NativeVectorToolbarRenderToolLockInput, NativeVectorViewport, type NativeVectorViewportHandle, type NativeVectorViewportProps, type PlacementPreview, type SvgNode, VectorSceneItem, parseSvgFragment };
|
|
362
|
+
export { DEFAULT_NATIVE_OVERFLOW_TOOL_IDS, DEFAULT_NATIVE_VECTOR_TOOLS, NATIVE_STYLE_PALETTE, NativeInteractionOverlay, type NativeInteractionOverlayProps, NativeSceneRenderer, type NativeSceneRendererProps, NativeShapeRenderer, type NativeShapeRendererProps, type NativeStyleColor, NativeVectorStyleInspector, type NativeVectorStyleInspectorProps, type NativeVectorStyleToolId, type NativeVectorToolDefinition, NativeVectorToolbar, type NativeVectorToolbarDensity, type NativeVectorToolbarProps, type NativeVectorToolbarRenderOverflowInput, type NativeVectorToolbarRenderToolInput, type NativeVectorToolbarRenderToolLockInput, NativeVectorViewport, type NativeVectorViewportHandle, type NativeVectorViewportProps, type PlacementPreview, type SvgNode, VectorSceneItem, nativeStyleColorWithOpacity, normalizeNativeStyleHex, parseSvgFragment };
|