@myoc/element 0.19.521 → 0.19.522
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/dev/index.js +3049 -1222
- package/dist/dev/index.js.map +4 -4
- package/dist/prod/index.js +17 -17
- package/dist/types/common/src/colors.d.ts +14 -0
- package/dist/types/common/src/constants.d.ts +3 -0
- package/dist/types/common/src/keys.d.ts +2 -0
- package/dist/types/common/src/points.d.ts +1 -1
- package/dist/types/common/src/utils.d.ts +1 -1
- package/dist/types/element/src/Scene.d.ts +1 -1
- package/dist/types/element/src/align.d.ts +2 -2
- package/dist/types/element/src/arrowEndpointText.d.ts +49 -0
- package/dist/types/element/src/arrows/focus.d.ts +5 -2
- package/dist/types/element/src/binding.d.ts +17 -8
- package/dist/types/element/src/bounds.d.ts +5 -9
- package/dist/types/element/src/bucketFill.d.ts +110 -0
- package/dist/types/element/src/collision.d.ts +1 -1
- package/dist/types/element/src/comparisons.d.ts +4 -4
- package/dist/types/element/src/convertToShape.d.ts +23 -0
- package/dist/types/element/src/distribute.d.ts +2 -2
- package/dist/types/element/src/dragElements.d.ts +27 -0
- package/dist/types/element/src/duplicate.d.ts +3 -3
- package/dist/types/element/src/embeddable.d.ts +2 -2
- package/dist/types/element/src/flowchart.d.ts +7 -7
- package/dist/types/element/src/fractionalIndex.d.ts +2 -2
- package/dist/types/element/src/frame.d.ts +4 -4
- package/dist/types/element/src/groups.d.ts +9 -9
- package/dist/types/element/src/index.d.ts +4 -1
- package/dist/types/element/src/linearElementEditor.d.ts +17 -10
- package/dist/types/element/src/newElement.d.ts +13 -0
- package/dist/types/element/src/renderElement.d.ts +0 -3
- package/dist/types/element/src/resizeElements.d.ts +2 -2
- package/dist/types/element/src/selection.d.ts +5 -5
- package/dist/types/element/src/shape.d.ts +12 -0
- package/dist/types/element/src/sortElements.d.ts +10 -0
- package/dist/types/element/src/textElement.d.ts +12 -9
- package/dist/types/element/src/transform.d.ts +2 -2
- package/dist/types/element/src/typeChecks.d.ts +25 -25
- package/dist/types/element/src/types.d.ts +2 -1
- package/dist/types/element/src/zindex.d.ts +2 -2
- package/dist/types/excalidraw/actions/actionAlign.d.ts +6 -6
- package/dist/types/excalidraw/actions/actionBoundText.d.ts +24 -8
- package/dist/types/excalidraw/actions/actionCanvas.d.ts +128 -961
- package/dist/types/excalidraw/actions/actionClipboard.d.ts +24 -8
- package/dist/types/excalidraw/actions/actionCropEditor.d.ts +12 -4
- package/dist/types/excalidraw/actions/actionDeleteSelected.d.ts +38 -13
- package/dist/types/excalidraw/actions/actionDeselect.d.ts +9 -4
- package/dist/types/excalidraw/actions/actionDistribute.d.ts +2 -3
- package/dist/types/excalidraw/actions/actionElementLink.d.ts +12 -4
- package/dist/types/excalidraw/actions/actionElementLock.d.ts +25 -9
- package/dist/types/excalidraw/actions/actionExport.d.ts +26 -10
- package/dist/types/excalidraw/actions/actionFrame.d.ts +47 -205
- package/dist/types/excalidraw/actions/actionGroup.d.ts +39 -23
- package/dist/types/excalidraw/actions/actionLinearEditor.d.ts +15 -6
- package/dist/types/excalidraw/actions/actionLink.d.ts +13 -5
- package/dist/types/excalidraw/actions/actionMenu.d.ts +12 -4
- package/dist/types/excalidraw/actions/actionProperties.d.ts +43 -24
- package/dist/types/excalidraw/actions/actionSelectAll.d.ts +17 -9
- package/dist/types/excalidraw/actions/actionStyles.d.ts +12 -4
- package/dist/types/excalidraw/actions/actionTextAutoResize.d.ts +1 -1
- package/dist/types/excalidraw/actions/actionToggleArrowBinding.d.ts +14 -6
- package/dist/types/excalidraw/actions/actionToggleGridMode.d.ts +16 -9
- package/dist/types/excalidraw/actions/actionToggleMidpointSnapping.d.ts +13 -5
- package/dist/types/excalidraw/actions/actionToggleObjectsSnapMode.d.ts +13 -5
- package/dist/types/excalidraw/actions/actionToggleSearchMenu.d.ts +16 -9
- package/dist/types/excalidraw/actions/actionToggleStats.d.ts +13 -5
- package/dist/types/excalidraw/actions/actionToggleViewMode.d.ts +14 -6
- package/dist/types/excalidraw/actions/actionToggleZenMode.d.ts +13 -5
- package/dist/types/excalidraw/actions/index.d.ts +1 -2
- package/dist/types/excalidraw/actions/manager.d.ts +1 -0
- package/dist/types/excalidraw/actions/shortcuts.d.ts +1 -1
- package/dist/types/excalidraw/actions/types.d.ts +8 -4
- package/dist/types/excalidraw/appState.d.ts +10 -5
- package/dist/types/excalidraw/components/Actions.d.ts +17 -12
- package/dist/types/excalidraw/components/App.arrowText.d.ts +72 -0
- package/dist/types/excalidraw/components/App.bucketFill.d.ts +48 -0
- package/dist/types/excalidraw/components/App.cursor.d.ts +30 -0
- package/dist/types/excalidraw/components/App.d.ts +384 -60
- package/dist/types/excalidraw/components/App.drawshape.d.ts +55 -0
- package/dist/types/excalidraw/components/App.flowchart.d.ts +21 -0
- package/dist/types/excalidraw/components/App.viewport.d.ts +73 -0
- package/dist/types/excalidraw/components/ColorPicker/ColorPicker.d.ts +9 -3
- package/dist/types/excalidraw/components/ColorPicker/CustomColorList.d.ts +3 -1
- package/dist/types/excalidraw/components/ColorPicker/Picker.d.ts +3 -1
- package/dist/types/excalidraw/components/ColorPicker/PickerColorList.d.ts +9 -2
- package/dist/types/excalidraw/components/ColorPicker/ShadeList.d.ts +4 -2
- package/dist/types/excalidraw/components/ColorPicker/TopPicks.d.ts +8 -1
- package/dist/types/excalidraw/components/ColorPicker/keyboardNavHandlers.d.ts +2 -1
- package/dist/types/excalidraw/components/ColorPicker/topPicksDnD.d.ts +31 -0
- package/dist/types/excalidraw/components/ConvertElementTypePopup.d.ts +1 -1
- package/dist/types/excalidraw/components/CursorHint.d.ts +46 -0
- package/dist/types/excalidraw/components/{ToolButton.d.ts → IconButton.d.ts} +16 -19
- package/dist/types/excalidraw/components/Island.d.ts +7 -0
- package/dist/types/excalidraw/components/LaserPointerButton.d.ts +2 -4
- package/dist/types/excalidraw/components/LayerUI.d.ts +5 -2
- package/dist/types/excalidraw/components/LockButton.d.ts +9 -0
- package/dist/types/excalidraw/components/MobileMenu.d.ts +4 -4
- package/dist/types/excalidraw/components/MobileToolbar.d.ts +9 -0
- package/dist/types/excalidraw/components/PenModeButton.d.ts +2 -5
- package/dist/types/excalidraw/components/Popover.d.ts +1 -3
- package/dist/types/excalidraw/components/{ButtonIcon.d.ts → RadioButton.d.ts} +2 -5
- package/dist/types/excalidraw/components/Stats/Angle.d.ts +2 -2
- package/dist/types/excalidraw/components/Stats/Dimension.d.ts +2 -2
- package/dist/types/excalidraw/components/Stats/DragInput.d.ts +2 -2
- package/dist/types/excalidraw/components/Stats/MultiAngle.d.ts +2 -2
- package/dist/types/excalidraw/components/Stats/MultiDimension.d.ts +2 -2
- package/dist/types/excalidraw/components/Stats/MultiPosition.d.ts +2 -2
- package/dist/types/excalidraw/components/Stats/Position.d.ts +3 -3
- package/dist/types/excalidraw/components/Stats/utils.d.ts +1 -1
- package/dist/types/excalidraw/components/ToolPopover.d.ts +3 -6
- package/dist/types/excalidraw/components/Toolbar.d.ts +11 -0
- package/dist/types/excalidraw/components/Tools.d.ts +146 -0
- package/dist/types/excalidraw/components/UserList.d.ts +3 -2
- package/dist/types/excalidraw/components/ViewportStatusFrame/ViewportStatusFrame.d.ts +11 -0
- package/dist/types/excalidraw/components/canvases/InteractiveCanvas.d.ts +2 -0
- package/dist/types/excalidraw/components/footer/Footer.d.ts +3 -1
- package/dist/types/excalidraw/components/hyperlink/helpers.d.ts +2 -2
- package/dist/types/excalidraw/components/icons.d.ts +4 -1
- package/dist/types/excalidraw/components/positionElementBesideCursor.d.ts +26 -0
- package/dist/types/excalidraw/components/shapeActionPredicates.d.ts +39 -0
- package/dist/types/excalidraw/context/tunnels.d.ts +0 -1
- package/dist/types/excalidraw/data/blob.d.ts +14 -6
- package/dist/types/excalidraw/data/index.d.ts +4 -4
- package/dist/types/excalidraw/data/json.d.ts +20 -12
- package/dist/types/excalidraw/drawShapeTrail.d.ts +16 -0
- package/dist/types/excalidraw/hooks/useAppStateValue.d.ts +29 -0
- package/dist/types/excalidraw/lasso/utils.d.ts +2 -0
- package/dist/types/excalidraw/renderer/interactiveScene.d.ts +10 -3
- package/dist/types/excalidraw/scene/Renderer.d.ts +11 -11
- package/dist/types/excalidraw/scene/export.d.ts +3 -3
- package/dist/types/excalidraw/scene/index.d.ts +1 -1
- package/dist/types/excalidraw/scene/types.d.ts +4 -3
- package/dist/types/excalidraw/snapping.d.ts +7 -7
- package/dist/types/excalidraw/types.d.ts +423 -27
- package/dist/types/excalidraw/viewport.d.ts +283 -0
- package/dist/types/excalidraw/wysiwyg/textWysiwyg.d.ts +2 -3
- package/dist/types/laser-pointer/src/state.d.ts +1 -0
- package/dist/types/math/src/index.d.ts +1 -0
- package/dist/types/math/src/pca.d.ts +79 -0
- package/dist/types/math/src/polygon.d.ts +25 -1
- package/dist/types/utils/src/export.d.ts +3 -3
- package/package.json +4 -4
- package/dist/types/excalidraw/actions/actionEmbeddable.d.ts +0 -180
- package/dist/types/excalidraw/actions/actionSmartZoom.d.ts +0 -16
- package/dist/types/excalidraw/components/DefaultSidebar.d.ts +0 -27
- package/dist/types/excalidraw/components/ElementCanvasButtons.d.ts +0 -7
- package/dist/types/excalidraw/components/FollowMode/FollowMode.d.ts +0 -10
- package/dist/types/excalidraw/components/HandButton.d.ts +0 -10
- package/dist/types/excalidraw/components/MagicButton.d.ts +0 -10
- package/dist/types/excalidraw/components/MobileToolBar.d.ts +0 -12
- package/dist/types/excalidraw/cursor.d.ts +0 -5
- package/dist/types/excalidraw/scene/scroll.d.ts +0 -18
- package/dist/types/excalidraw/scene/zoom.d.ts +0 -12
- package/dist/types/excalidraw/scroll.d.ts +0 -46
|
@@ -24,13 +24,13 @@ export declare const clearAppStateForLocalStorage: (appState: Partial<AppState>)
|
|
|
24
24
|
selectedLinearElement?: import("@excalidraw/element").LinearElementEditor | null | undefined;
|
|
25
25
|
isBindingEnabled?: boolean | undefined;
|
|
26
26
|
isMidpointSnappingEnabled?: boolean | undefined;
|
|
27
|
+
gridModeEnabled?: boolean | undefined;
|
|
27
28
|
zenModeEnabled?: boolean | undefined;
|
|
28
29
|
shouldCacheIgnoreZoom?: boolean | undefined;
|
|
29
30
|
exportScale?: number | undefined;
|
|
30
31
|
currentItemArrowType?: "round" | "sharp" | "elbow" | undefined;
|
|
31
|
-
bindMode?: import("@excalidraw/element/types").BindMode | undefined;
|
|
32
32
|
gridSize?: number | undefined;
|
|
33
|
-
|
|
33
|
+
bindMode?: import("@excalidraw/element/types").BindMode | undefined;
|
|
34
34
|
objectsSnapModeEnabled?: boolean | undefined;
|
|
35
35
|
wheelZoomsOnDefault?: boolean | undefined;
|
|
36
36
|
gridStep?: number | undefined;
|
|
@@ -47,7 +47,7 @@ export declare const clearAppStateForLocalStorage: (appState: Partial<AppState>)
|
|
|
47
47
|
metric: import("./types").NormaliseMetric;
|
|
48
48
|
} | undefined;
|
|
49
49
|
boxSelectionMode?: import("./types").BoxSelectionMode | undefined;
|
|
50
|
-
bindingPreference?: "
|
|
50
|
+
bindingPreference?: "enabled" | "disabled" | undefined;
|
|
51
51
|
preferredSelectionTool?: {
|
|
52
52
|
type: "selection" | "lasso";
|
|
53
53
|
initialized: boolean;
|
|
@@ -90,11 +90,16 @@ export declare const clearAppStateForLocalStorage: (appState: Partial<AppState>)
|
|
|
90
90
|
lockedMultiSelections?: {
|
|
91
91
|
[groupId: string]: true;
|
|
92
92
|
} | undefined;
|
|
93
|
+
colorTopPicks?: {
|
|
94
|
+
elementStroke: readonly string[] | null;
|
|
95
|
+
elementBackground: readonly string[] | null;
|
|
96
|
+
bucketFill: readonly string[] | null;
|
|
97
|
+
} | undefined;
|
|
93
98
|
};
|
|
94
99
|
export declare const cleanAppStateForExport: (appState: Partial<AppState>) => {
|
|
95
100
|
viewBackgroundColor?: string | undefined;
|
|
96
|
-
gridSize?: number | undefined;
|
|
97
101
|
gridModeEnabled?: boolean | undefined;
|
|
102
|
+
gridSize?: number | undefined;
|
|
98
103
|
gridStep?: number | undefined;
|
|
99
104
|
lockedMultiSelections?: {
|
|
100
105
|
[groupId: string]: true;
|
|
@@ -102,8 +107,8 @@ export declare const cleanAppStateForExport: (appState: Partial<AppState>) => {
|
|
|
102
107
|
};
|
|
103
108
|
export declare const clearAppStateForDatabase: (appState: Partial<AppState>) => {
|
|
104
109
|
viewBackgroundColor?: string | undefined;
|
|
105
|
-
gridSize?: number | undefined;
|
|
106
110
|
gridModeEnabled?: boolean | undefined;
|
|
111
|
+
gridSize?: number | undefined;
|
|
107
112
|
gridStep?: number | undefined;
|
|
108
113
|
lockedMultiSelections?: {
|
|
109
114
|
[groupId: string]: true;
|
|
@@ -1,15 +1,22 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { NonDeletedElementsMap, NonDeletedSceneElementsMap } from "@excalidraw/element/types";
|
|
2
2
|
import "./Actions.scss";
|
|
3
|
-
import type { AppClassProperties,
|
|
3
|
+
import type { AppClassProperties, UIAppState, AppState } from "../types";
|
|
4
4
|
import type { ActionManager } from "../actions/manager";
|
|
5
|
-
export
|
|
6
|
-
|
|
5
|
+
export { canChangeStrokeColor, canChangeBackgroundColor, } from "./shapeActionPredicates";
|
|
6
|
+
/**
|
|
7
|
+
* Full styles panel: the wide, always-expanded layout used on desktop when the
|
|
8
|
+
* UI is in "full" mode.
|
|
9
|
+
*/
|
|
7
10
|
export declare const SelectedShapeActions: ({ appState, elementsMap, renderAction, app, }: {
|
|
8
11
|
appState: UIAppState;
|
|
9
12
|
elementsMap: NonDeletedElementsMap | NonDeletedSceneElementsMap;
|
|
10
13
|
renderAction: ActionManager["renderAction"];
|
|
11
14
|
app: AppClassProperties;
|
|
12
15
|
}) => import("react/jsx-runtime").JSX.Element;
|
|
16
|
+
/**
|
|
17
|
+
* Compact styles panel — the collapsed, popover-driven layout used on tablets
|
|
18
|
+
* and on desktop when the UI is in "compact" mode.
|
|
19
|
+
*/
|
|
13
20
|
export declare const CompactShapeActions: ({ appState, elementsMap, renderAction, app, setAppState, }: {
|
|
14
21
|
appState: UIAppState;
|
|
15
22
|
elementsMap: NonDeletedElementsMap | NonDeletedSceneElementsMap;
|
|
@@ -17,6 +24,11 @@ export declare const CompactShapeActions: ({ appState, elementsMap, renderAction
|
|
|
17
24
|
app: AppClassProperties;
|
|
18
25
|
setAppState: React.Component<any, AppState>["setState"];
|
|
19
26
|
}) => import("react/jsx-runtime").JSX.Element;
|
|
27
|
+
/**
|
|
28
|
+
* Mobile styles panel — the horizontal action bar used on phones, with an
|
|
29
|
+
* overflow measurement that promotes duplicate/delete out of the popover when
|
|
30
|
+
* there is room.
|
|
31
|
+
*/
|
|
20
32
|
export declare const MobileShapeActions: ({ appState, elementsMap, renderAction, app, setAppState, }: {
|
|
21
33
|
appState: UIAppState;
|
|
22
34
|
elementsMap: NonDeletedElementsMap | NonDeletedSceneElementsMap;
|
|
@@ -24,15 +36,8 @@ export declare const MobileShapeActions: ({ appState, elementsMap, renderAction,
|
|
|
24
36
|
app: AppClassProperties;
|
|
25
37
|
setAppState: React.Component<any, AppState>["setState"];
|
|
26
38
|
}) => import("react/jsx-runtime").JSX.Element;
|
|
27
|
-
export declare const
|
|
28
|
-
activeTool: UIAppState["activeTool"];
|
|
29
|
-
setAppState: React.Component<any, AppState>["setState"];
|
|
30
|
-
app: AppClassProperties;
|
|
31
|
-
UIOptions: AppProps["UIOptions"];
|
|
32
|
-
}) => import("react/jsx-runtime").JSX.Element;
|
|
33
|
-
export declare const ZoomActions: ({ renderAction, zoom, }: {
|
|
39
|
+
export declare const ZoomActions: ({ renderAction, }: {
|
|
34
40
|
renderAction: ActionManager["renderAction"];
|
|
35
|
-
zoom: Zoom;
|
|
36
41
|
}) => import("react/jsx-runtime").JSX.Element;
|
|
37
42
|
export declare const UndoRedoActions: ({ renderAction, className, }: {
|
|
38
43
|
renderAction: ActionManager["renderAction"];
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import type { ArrowEndpoint } from "@excalidraw/element";
|
|
2
|
+
import type { ExcalidrawElement, ExcalidrawTextElement, FixedPoint, NonDeleted } from "@excalidraw/element/types";
|
|
3
|
+
import type App from "./App";
|
|
4
|
+
import type { AppState } from "../types";
|
|
5
|
+
/**
|
|
6
|
+
* The text tool's interaction with arrows: the hover affordance showing where
|
|
7
|
+
* a click would attach text to an arrow — a free endpoint (binds the arrow to
|
|
8
|
+
* a new text element positioned against that endpoint) or the arrow's midpoint
|
|
9
|
+
* (adds a label bound to the arrow) — and the endpoint-bound flavor of
|
|
10
|
+
* drag-sizing a new text.
|
|
11
|
+
*
|
|
12
|
+
* The scene-level logic lives in `@excalidraw/element`'s `arrowEndpointText.ts`.
|
|
13
|
+
*/
|
|
14
|
+
export declare class AppArrowText {
|
|
15
|
+
private app;
|
|
16
|
+
constructor(app: App);
|
|
17
|
+
/**
|
|
18
|
+
* With the text tool active, an arrow under the cursor is a target for
|
|
19
|
+
* attaching text. Returns where the text would land (if anywhere), and keeps
|
|
20
|
+
* `appState.hoveredArrowTextAnchor` — which drives the highlight — in sync.
|
|
21
|
+
*/
|
|
22
|
+
updateHoveredAnchor: (scenePointer: {
|
|
23
|
+
x: number;
|
|
24
|
+
y: number;
|
|
25
|
+
}) => AppState["hoveredArrowTextAnchor"];
|
|
26
|
+
/**
|
|
27
|
+
* Re-evaluates the hovered anchor at the last known pointer position — for
|
|
28
|
+
* events that change what a click would do without the pointer moving,
|
|
29
|
+
* i.e. the ctrl/cmd binding toggle. (Events that invalidate the anchor
|
|
30
|
+
* wholesale — tool switches, finalize, deselect — clear it directly
|
|
31
|
+
* instead.)
|
|
32
|
+
*/
|
|
33
|
+
refresh: () => void;
|
|
34
|
+
/**
|
|
35
|
+
* A free arrow endpoint a new text could be bound to. Binding an endpoint is
|
|
36
|
+
* an arrow binding, so it follows the binding toggle (ctrl/cmd) like every
|
|
37
|
+
* other one — holding it makes the text tool drop plain text instead.
|
|
38
|
+
*/
|
|
39
|
+
getBindableEndpointAtPosition(x: number, y: number): ArrowEndpoint | null;
|
|
40
|
+
/**
|
|
41
|
+
* Mirrors what `handleTextOnPointerDown` would do at this position, so the
|
|
42
|
+
* highlight can't promise something the click won't deliver.
|
|
43
|
+
*/
|
|
44
|
+
private getAnchorAtPosition;
|
|
45
|
+
/**
|
|
46
|
+
* How a text should be created to read as a label for this endpoint — the
|
|
47
|
+
* side midpoint to bind, the alignment that pins it, and the scene position
|
|
48
|
+
* it must sit at. `targetStrokeWidth` is the caller's to provide so it can
|
|
49
|
+
* guarantee it matches the stroke width the text is then created with — the
|
|
50
|
+
* binding gap derives from it (see `getTextBindingForArrowEndpoint`).
|
|
51
|
+
*/
|
|
52
|
+
getTextBinding({ arrow, startOrEnd }: ArrowEndpoint, targetStrokeWidth: number): {
|
|
53
|
+
fixedPoint: FixedPoint;
|
|
54
|
+
textAlign: import("@excalidraw/element/types").TextAlign;
|
|
55
|
+
verticalAlign: import("@excalidraw/element/types").VerticalAlign;
|
|
56
|
+
anchor: import("@excalidraw/math").GlobalPoint;
|
|
57
|
+
} | null;
|
|
58
|
+
/**
|
|
59
|
+
* Binds the arrow endpoint to the created text, at the side midpoint the
|
|
60
|
+
* placement resolved (`getTextBinding`'s `fixedPoint`).
|
|
61
|
+
*/
|
|
62
|
+
bindText({ arrow, startOrEnd }: ArrowEndpoint, text: NonDeleted<ExcalidrawTextElement>, fixedPoint: FixedPoint): void;
|
|
63
|
+
/**
|
|
64
|
+
* A text bound to an arrow endpoint can't be positioned by the drag — the
|
|
65
|
+
* binding already placed it — so only its width is dragged out. Returns
|
|
66
|
+
* whether it owned the drag.
|
|
67
|
+
*/
|
|
68
|
+
maybeDragNewText(newElement: ExcalidrawElement, pointerCoords: {
|
|
69
|
+
x: number;
|
|
70
|
+
y: number;
|
|
71
|
+
}): boolean;
|
|
72
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import type { Theme } from "@excalidraw/element/types";
|
|
2
|
+
import type App from "./App";
|
|
3
|
+
type ScenePoint = {
|
|
4
|
+
x: number;
|
|
5
|
+
y: number;
|
|
6
|
+
};
|
|
7
|
+
/** Owns bucket-fill interaction and App-bound scene mutations. */
|
|
8
|
+
export declare class AppBucketFill {
|
|
9
|
+
private app;
|
|
10
|
+
constructor(app: App);
|
|
11
|
+
private temporaryEyeDropper;
|
|
12
|
+
/**
|
|
13
|
+
* The click armed on pointer down, committed on pointer up. Deferring the
|
|
14
|
+
* scene mutation to pointer up is what lets a pinch/pan second finger, a
|
|
15
|
+
* long-press context menu, or a pointercancel abort the fill — on pointer
|
|
16
|
+
* down the editor cannot yet know the gesture will stay a single-pointer
|
|
17
|
+
* click.
|
|
18
|
+
*/
|
|
19
|
+
private pending;
|
|
20
|
+
/** Arm a fill at the pointer-down position; nothing mutates yet. */
|
|
21
|
+
handlePointerDown: (scenePointer: ScenePoint) => void;
|
|
22
|
+
/**
|
|
23
|
+
* Commit the armed fill, at the pointer-DOWN position (what the user
|
|
24
|
+
* aimed at). No-op when the gesture was aborted in the meantime.
|
|
25
|
+
*/
|
|
26
|
+
handlePointerUp: () => void;
|
|
27
|
+
/** Abort the armed fill (second finger, context menu, pointercancel). */
|
|
28
|
+
cancel: () => void;
|
|
29
|
+
cycleBackgroundColor: () => void;
|
|
30
|
+
openTemporaryEyeDropper: () => void;
|
|
31
|
+
closeTemporaryEyeDropper: () => void;
|
|
32
|
+
/**
|
|
33
|
+
* Apply the current bucket fill settings to an existing fill-compatible
|
|
34
|
+
* element (no-op when nothing would change). One undoable step.
|
|
35
|
+
*/
|
|
36
|
+
private restyle;
|
|
37
|
+
private fill;
|
|
38
|
+
/**
|
|
39
|
+
* The color the bucket fill tool actually fills with: the shared
|
|
40
|
+
* `currentItemBackgroundColor`, falling back to green when that is
|
|
41
|
+
* transparent (the tool's picker doesn't offer transparent, but the shared
|
|
42
|
+
* state can hold it from the generic shape picker).
|
|
43
|
+
*/
|
|
44
|
+
getBucketFillBackgroundColor: (backgroundColor: string,
|
|
45
|
+
/** supply only for display purposes such as when applying to the cursor */
|
|
46
|
+
theme?: Theme) => string;
|
|
47
|
+
}
|
|
48
|
+
export {};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { AppState } from "../types";
|
|
2
|
+
import type App from "./App";
|
|
3
|
+
/**
|
|
4
|
+
* Captures all cursor management for the interactive canvas.
|
|
5
|
+
*
|
|
6
|
+
* The canvas cursor is set exclusively imperatively, through this class —
|
|
7
|
+
* never via inline styles or React-rendered `style.cursor`, which React
|
|
8
|
+
* would rewrite on rerender whenever the computed value changes, clobbering
|
|
9
|
+
* cursors set here.
|
|
10
|
+
*/
|
|
11
|
+
export declare class AppCursor {
|
|
12
|
+
private app;
|
|
13
|
+
private toolCursorMemo;
|
|
14
|
+
private eraserCanvasCache;
|
|
15
|
+
private eraserPreviewDataURL;
|
|
16
|
+
constructor(app: App);
|
|
17
|
+
private get canvas();
|
|
18
|
+
set: (cursor: string) => void;
|
|
19
|
+
/**
|
|
20
|
+
* Resets to the resting cursor — the cursor shown when no interaction or
|
|
21
|
+
* hover affordance overrides it: the view-mode grab cursor when
|
|
22
|
+
* drag-to-pan applies, the active tool's cursor otherwise.
|
|
23
|
+
*/
|
|
24
|
+
reset: () => void;
|
|
25
|
+
/** applies the given tool's cursor (defaults to the active tool) */
|
|
26
|
+
applyForTool: (activeTool?: AppState["activeTool"]) => void;
|
|
27
|
+
/** clears the inline cursor so the environment default (CSS) applies */
|
|
28
|
+
private clear;
|
|
29
|
+
private applyEraser;
|
|
30
|
+
}
|