mathlean-canvas 0.3.1 → 0.3.3
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/README.md +213 -68
- package/dist/InlineMathLiveField.d.ts +17 -0
- package/dist/MathCanvas/components/CanvasOverlayViewport.d.ts +21 -0
- package/dist/MathCanvas/components/ObjectOverlays.d.ts +36 -0
- package/dist/MathCanvas/components/Toolbar.d.ts +34 -0
- package/dist/MathCanvas/components/icons.d.ts +58 -0
- package/dist/MathCanvas/constants.d.ts +70 -0
- package/dist/MathCanvas/core/hooks/useCanvasEditorFocus.d.ts +32 -0
- package/dist/MathCanvas/core/hooks/useCanvasGlobalActions.d.ts +41 -0
- package/dist/MathCanvas/core/hooks/useCanvasGlobalDragEffects.d.ts +35 -0
- package/dist/MathCanvas/core/hooks/useCanvasHistory.d.ts +13 -0
- package/dist/MathCanvas/core/hooks/useCanvasKeyboardShortcuts.d.ts +76 -0
- package/dist/MathCanvas/core/hooks/useCanvasSnapshot.d.ts +23 -0
- package/dist/MathCanvas/core/hooks/useCanvasStageInteractions.d.ts +103 -0
- package/dist/MathCanvas/core/hooks/useCanvasTransformers.d.ts +28 -0
- package/dist/MathCanvas/core/hooks/useCanvasViewport.d.ts +25 -0
- package/dist/MathCanvas/core/index.d.ts +9 -0
- package/dist/MathCanvas/features/geometry/components/CoordinatePlaneLayer.d.ts +15 -0
- package/dist/MathCanvas/features/geometry/components/GeometryLayer.d.ts +65 -0
- package/dist/MathCanvas/features/geometry/components/GeometryOverlays.d.ts +57 -0
- package/dist/MathCanvas/features/geometry/hooks/useGeometryCanvasActions.d.ts +29 -0
- package/dist/MathCanvas/features/geometry/hooks/useGeometryRenderData.d.ts +60 -0
- package/dist/MathCanvas/features/geometry/hooks/useGeometryState.d.ts +147 -0
- package/dist/MathCanvas/features/geometry/index.d.ts +6 -0
- package/dist/MathCanvas/features/graph/components/GraphLayer.d.ts +39 -0
- package/dist/MathCanvas/features/graph/components/GraphNodeEditor.d.ts +14 -0
- package/dist/MathCanvas/features/graph/hooks/useGraphCanvasActions.d.ts +44 -0
- package/dist/MathCanvas/features/graph/hooks/useGraphState.d.ts +77 -0
- package/dist/MathCanvas/features/graph/index.d.ts +4 -0
- package/dist/MathCanvas/features/grid/components/CellMathEditor.d.ts +17 -0
- package/dist/MathCanvas/features/grid/components/GridObjectOverlays.d.ts +71 -0
- package/dist/MathCanvas/features/grid/components/MatrixBlock.d.ts +20 -0
- package/dist/MathCanvas/features/grid/components/MatrixBrackets.d.ts +6 -0
- package/dist/MathCanvas/features/grid/components/MatrixEditorBlock.d.ts +50 -0
- package/dist/MathCanvas/features/grid/components/MatrixLayer.d.ts +31 -0
- package/dist/MathCanvas/features/grid/components/TableBlock.d.ts +21 -0
- package/dist/MathCanvas/features/grid/components/TableEditorBlock.d.ts +46 -0
- package/dist/MathCanvas/features/grid/hooks/useGridCanvasActions.d.ts +66 -0
- package/dist/MathCanvas/features/grid/hooks/useGridObjectState.d.ts +147 -0
- package/dist/MathCanvas/features/grid/index.d.ts +5 -0
- package/dist/MathCanvas/features/grid/utils/matrixOps.d.ts +36 -0
- package/dist/MathCanvas/features/stroke/components/StrokeLayer.d.ts +8 -0
- package/dist/MathCanvas/features/stroke/hooks/useStrokeState.d.ts +33 -0
- package/dist/MathCanvas/features/stroke/index.d.ts +2 -0
- package/dist/MathCanvas/features/text/components/BlockRenderers.d.ts +24 -0
- package/dist/MathCanvas/features/text/components/InlineMathBubble.d.ts +36 -0
- package/dist/MathCanvas/features/text/components/TextBlockEditor.d.ts +46 -0
- package/dist/MathCanvas/features/text/components/TextBlockMenu.d.ts +25 -0
- package/dist/MathCanvas/features/text/components/TextBlockView.d.ts +22 -0
- package/dist/MathCanvas/features/text/components/TextInteractionLayer.d.ts +29 -0
- package/dist/MathCanvas/features/text/hooks/useTextBlockActions.d.ts +40 -0
- package/dist/MathCanvas/features/text/hooks/useTextBlockEditingActions.d.ts +57 -0
- package/dist/MathCanvas/features/text/hooks/useTextBlockLayoutEffects.d.ts +62 -0
- package/dist/MathCanvas/features/text/hooks/useTextBlockRenderHelpers.d.ts +15 -0
- package/dist/MathCanvas/features/text/hooks/useTextboxResize.d.ts +19 -0
- package/dist/MathCanvas/features/text/index.d.ts +12 -0
- package/dist/MathCanvas/features/text/utils/textLayout.d.ts +33 -0
- package/dist/MathCanvas/types.d.ts +219 -0
- package/dist/MathCanvas/utils/geometryMath.d.ts +13 -0
- package/dist/MathCanvas/utils/graphDirection.d.ts +3 -0
- package/dist/MathCanvas/utils/latex.d.ts +20 -0
- package/dist/MathCanvas.d.ts +7 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +11777 -10143
- package/dist/inlineMathModel.d.ts +26 -0
- package/dist/useInlineMathSession.d.ts +67 -0
- package/package.json +6 -2
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
import { type MutableRefObject } from "react";
|
|
2
|
+
import type { CanvasState, GridSelection, MatrixObject, TableObject } from "../../../types";
|
|
3
|
+
type UseGridObjectStateOptions = {
|
|
4
|
+
initialState?: Pick<CanvasState, "matrices" | "tables">;
|
|
5
|
+
pushHistoryStateRef: MutableRefObject<() => void>;
|
|
6
|
+
};
|
|
7
|
+
export declare function useGridObjectState({ initialState, pushHistoryStateRef, }: UseGridObjectStateOptions): {
|
|
8
|
+
beginGridSelection: (kind: "matrix" | "table", id: string, row: number, col: number, mode?: "cell" | "row" | "column") => void;
|
|
9
|
+
beginGridStructureDrag: (kind: "matrix" | "table", id: string, mode: "row" | "column", index: number) => void;
|
|
10
|
+
beginMatrixEditing: (id: string, cell?: {
|
|
11
|
+
row: number;
|
|
12
|
+
col: number;
|
|
13
|
+
}) => void;
|
|
14
|
+
beginTableEditing: (id: string, cell?: {
|
|
15
|
+
row: number;
|
|
16
|
+
col: number;
|
|
17
|
+
}) => void;
|
|
18
|
+
clearGridSelectionCells: () => void;
|
|
19
|
+
clearMatrixEditing: () => void;
|
|
20
|
+
clearMatrixSelection: () => void;
|
|
21
|
+
clearTableEditing: () => void;
|
|
22
|
+
clearTableSelection: () => void;
|
|
23
|
+
commitMatrixEditing: () => void;
|
|
24
|
+
commitTableEditing: () => void;
|
|
25
|
+
createMatrixObject: (id: string, x: number, y: number, rows: number, cols: number) => void;
|
|
26
|
+
createTableObject: (id: string, x: number, y: number, rows: number, cols: number) => void;
|
|
27
|
+
editingMatrixCell: {
|
|
28
|
+
row: number;
|
|
29
|
+
col: number;
|
|
30
|
+
} | null;
|
|
31
|
+
editingMatrixId: string | null;
|
|
32
|
+
editingTableCell: {
|
|
33
|
+
row: number;
|
|
34
|
+
col: number;
|
|
35
|
+
} | null;
|
|
36
|
+
editingTableId: string | null;
|
|
37
|
+
endGridSelectionDrag: () => void;
|
|
38
|
+
extendGridSelection: (kind: "matrix" | "table", id: string, row: number, col: number) => void;
|
|
39
|
+
extendGridSelectionWithKeyboard: (kind: "matrix" | "table", id: string, row: number, col: number, nextRow: number, nextCol: number) => void;
|
|
40
|
+
deleteSelectedMatrix: () => void;
|
|
41
|
+
deleteSelectedTable: () => void;
|
|
42
|
+
deleteGridSelectionStructure: () => void;
|
|
43
|
+
fillIdentityMatrix: (id: string) => void;
|
|
44
|
+
findMatrixAtPoint: (x: number, y: number) => MatrixObject | null;
|
|
45
|
+
findTableAtPoint: (x: number, y: number) => TableObject | null;
|
|
46
|
+
getMatrixById: (id: string | null) => MatrixObject | null;
|
|
47
|
+
getGridSelectionClipboardText: () => string;
|
|
48
|
+
getMatrixColSeparatorIndexForCell: (colIndex: number, colCount: number) => number | null;
|
|
49
|
+
getMatrixRowSeparatorIndexForCell: (rowIndex: number, rowCount: number) => number | null;
|
|
50
|
+
getTableById: (id: string | null) => TableObject | null;
|
|
51
|
+
gridKeyboardSelectionAnchorRef: import("react").RefObject<{
|
|
52
|
+
kind: "matrix" | "table";
|
|
53
|
+
id: string;
|
|
54
|
+
row: number;
|
|
55
|
+
col: number;
|
|
56
|
+
} | null>;
|
|
57
|
+
gridMoveDragRef: import("react").RefObject<{
|
|
58
|
+
kind: "matrix" | "table";
|
|
59
|
+
id: string;
|
|
60
|
+
mode: "row" | "column";
|
|
61
|
+
startIndex: number;
|
|
62
|
+
endIndex: number;
|
|
63
|
+
targetIndex: number;
|
|
64
|
+
} | null>;
|
|
65
|
+
gridMovePreview: {
|
|
66
|
+
kind: "matrix" | "table";
|
|
67
|
+
id: string;
|
|
68
|
+
mode: "row" | "column";
|
|
69
|
+
targetIndex: number;
|
|
70
|
+
} | null;
|
|
71
|
+
gridSelection: GridSelection | null;
|
|
72
|
+
gridSelectionDragRef: import("react").RefObject<{
|
|
73
|
+
kind: "matrix" | "table";
|
|
74
|
+
id: string;
|
|
75
|
+
anchorRow: number;
|
|
76
|
+
anchorCol: number;
|
|
77
|
+
mode: "cell" | "row" | "column";
|
|
78
|
+
} | null>;
|
|
79
|
+
isCellInGridSelection: (kind: "matrix" | "table", id: string, row: number, col: number) => boolean;
|
|
80
|
+
insertGridSelectionStructure: () => void;
|
|
81
|
+
matrixInputRefs: import("react").RefObject<Record<string, HTMLInputElement | null>>;
|
|
82
|
+
matrixLatexPopover: {
|
|
83
|
+
matrixId: string;
|
|
84
|
+
left: number;
|
|
85
|
+
top: number;
|
|
86
|
+
} | null;
|
|
87
|
+
matrixNodeRefs: import("react").RefObject<Record<string, import("konva/lib/shapes/Rect").Rect | null>>;
|
|
88
|
+
matrixOverlayRefs: import("react").RefObject<Record<string, HTMLDivElement | null>>;
|
|
89
|
+
matrices: MatrixObject[];
|
|
90
|
+
matrixTransformerRef: import("react").RefObject<import("konva/lib/shapes/Transformer").Transformer | null>;
|
|
91
|
+
selectedMatrixId: string | null;
|
|
92
|
+
selectedTableId: string | null;
|
|
93
|
+
selectWholeMatrix: (id: string) => void;
|
|
94
|
+
moveGridSelectionRangeToIndex: (kind: "matrix" | "table", id: string, mode: "row" | "column", startIndex: number, endIndex: number, targetIndex: number) => void;
|
|
95
|
+
moveGridSelectionStructure: (direction: "up" | "down" | "left" | "right") => void;
|
|
96
|
+
pasteGridSelectionClipboardText: (text: string) => void;
|
|
97
|
+
resizeMatrix: (id: string, nextRows: number, nextCols: number) => void;
|
|
98
|
+
resizeTable: (id: string, nextRows: number, nextCols: number) => void;
|
|
99
|
+
rotateMatrixClockwise: (id: string) => void;
|
|
100
|
+
rotateMatrixCounterclockwise: (id: string) => void;
|
|
101
|
+
setEditingMatrixCell: import("react").Dispatch<import("react").SetStateAction<{
|
|
102
|
+
row: number;
|
|
103
|
+
col: number;
|
|
104
|
+
} | null>>;
|
|
105
|
+
setEditingMatrixId: import("react").Dispatch<import("react").SetStateAction<string | null>>;
|
|
106
|
+
setEditingTableCell: import("react").Dispatch<import("react").SetStateAction<{
|
|
107
|
+
row: number;
|
|
108
|
+
col: number;
|
|
109
|
+
} | null>>;
|
|
110
|
+
setEditingTableId: import("react").Dispatch<import("react").SetStateAction<string | null>>;
|
|
111
|
+
setGridMovePreview: import("react").Dispatch<import("react").SetStateAction<{
|
|
112
|
+
kind: "matrix" | "table";
|
|
113
|
+
id: string;
|
|
114
|
+
mode: "row" | "column";
|
|
115
|
+
targetIndex: number;
|
|
116
|
+
} | null>>;
|
|
117
|
+
setGridSelection: import("react").Dispatch<import("react").SetStateAction<GridSelection | null>>;
|
|
118
|
+
setMatrices: import("react").Dispatch<import("react").SetStateAction<MatrixObject[]>>;
|
|
119
|
+
setMatrixLatexPopover: import("react").Dispatch<import("react").SetStateAction<{
|
|
120
|
+
matrixId: string;
|
|
121
|
+
left: number;
|
|
122
|
+
top: number;
|
|
123
|
+
} | null>>;
|
|
124
|
+
setSelectedMatrixId: import("react").Dispatch<import("react").SetStateAction<string | null>>;
|
|
125
|
+
setSelectedTableId: import("react").Dispatch<import("react").SetStateAction<string | null>>;
|
|
126
|
+
setTables: import("react").Dispatch<import("react").SetStateAction<TableObject[]>>;
|
|
127
|
+
skipNextMatrixCreationRef: import("react").RefObject<boolean>;
|
|
128
|
+
tableInputRefs: import("react").RefObject<Record<string, HTMLInputElement | null>>;
|
|
129
|
+
tableNodeRefs: import("react").RefObject<Record<string, import("konva/lib/shapes/Rect").Rect | null>>;
|
|
130
|
+
tableOverlayRefs: import("react").RefObject<Record<string, HTMLDivElement | null>>;
|
|
131
|
+
tables: TableObject[];
|
|
132
|
+
tableTransformerRef: import("react").RefObject<import("konva/lib/shapes/Transformer").Transformer | null>;
|
|
133
|
+
toggleMatrixColSeparator: (id: string, colIndex: number, useSelectionRange?: boolean) => void;
|
|
134
|
+
toggleMatrixRowSeparator: (id: string, rowIndex: number, useSelectionRange?: boolean) => void;
|
|
135
|
+
transformGridSelectionToAntiDiagonal: () => void;
|
|
136
|
+
transformGridSelectionToDiagonal: () => void;
|
|
137
|
+
transformGridSelectionToLowerTriangular: () => void;
|
|
138
|
+
transformGridSelectionToUpperTriangular: () => void;
|
|
139
|
+
transformSelectedMatrixRegion: (transform: "rotateClockwise" | "rotateCounterclockwise" | "transpose") => void;
|
|
140
|
+
transposeMatrix: (id: string) => void;
|
|
141
|
+
updateMatrix: (id: string, updater: (matrix: MatrixObject) => MatrixObject) => void;
|
|
142
|
+
updateGridStructureDragTarget: (kind: "matrix" | "table", id: string, mode: "row" | "column", index: number) => void;
|
|
143
|
+
updateMatrixSelectionCells: (id: string, row: number, col: number, value: string) => void;
|
|
144
|
+
updateTable: (id: string, updater: (table: TableObject) => TableObject) => void;
|
|
145
|
+
updateTableSelectionCells: (id: string, row: number, col: number, value: string) => void;
|
|
146
|
+
};
|
|
147
|
+
export {};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { default as GridObjectOverlays } from "./components/GridObjectOverlays";
|
|
2
|
+
export { default as MatrixLayer } from "./components/MatrixLayer";
|
|
3
|
+
export { useGridCanvasActions } from "./hooks/useGridCanvasActions";
|
|
4
|
+
export { useGridObjectState } from "./hooks/useGridObjectState";
|
|
5
|
+
export { getMatrixWidth, getTableWidth, matrixToLatex } from "./utils/matrixOps";
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import type { GridSelection, MatrixObject, MatrixSeparator, MatrixSeparatorSegment, TableObject, TextBlock } from "../../../types";
|
|
2
|
+
export declare function createEmptyMatrixCells(rows: number, cols: number): string[][];
|
|
3
|
+
export declare function resizeMatrixCells(cells: string[][], nextRows: number, nextCols: number, fillValue?: string): string[][];
|
|
4
|
+
export declare function matrixSeparatorToSegment(separator: MatrixSeparator, maxEnd: number): MatrixSeparatorSegment;
|
|
5
|
+
export declare function normalizeMatrixSeparatorSegment(segment: MatrixSeparatorSegment, maxEnd: number): MatrixSeparatorSegment;
|
|
6
|
+
export declare function resizeSeparatorSegments(separators: MatrixSeparator[], maxExclusive: number, maxEnd: number): MatrixSeparatorSegment[];
|
|
7
|
+
export declare const resizeSeparatorIndices: typeof resizeSeparatorSegments;
|
|
8
|
+
export declare function getMatrixRowSeparatorSegments(matrix: MatrixObject): MatrixSeparatorSegment[];
|
|
9
|
+
export declare function getMatrixColSeparatorSegments(matrix: MatrixObject): MatrixSeparatorSegment[];
|
|
10
|
+
export declare function hasAnyMatrixSeparatorAtIndex(separators: MatrixSeparator[], index: number, maxEnd: number): boolean;
|
|
11
|
+
export declare function toggleMatrixSeparatorSegment(separators: MatrixSeparator[], index: number, start: number, end: number, maxEnd: number): MatrixSeparatorSegment[];
|
|
12
|
+
export declare function getMatrixColumnWidths(matrix: MatrixObject): number[];
|
|
13
|
+
export declare function getMatrixContentWidth(matrix: MatrixObject): number;
|
|
14
|
+
export declare function getMatrixColumnOffset(columnWidths: number[], colIndex: number): number;
|
|
15
|
+
export declare function getMatrixColumnSpanWidth(columnWidths: number[], startCol: number, endCol: number): number;
|
|
16
|
+
export declare function getMatrixRowOffset(rowIndex: number): number;
|
|
17
|
+
export declare function getMatrixRowSpanHeight(startRow: number, endRow: number): number;
|
|
18
|
+
export declare function matrixToLatex(matrix: MatrixObject): string;
|
|
19
|
+
export declare function getMatrixWidth(matrix: MatrixObject): number;
|
|
20
|
+
export declare function getMatrixHeight(matrix: MatrixObject): number;
|
|
21
|
+
export declare function getMatrixAxisY(matrix: MatrixObject): number;
|
|
22
|
+
export declare function getTableColumnWidths(table: TableObject): number[];
|
|
23
|
+
export declare function getTableWidth(table: TableObject): number;
|
|
24
|
+
export declare function getTableHeight(table: TableObject): number;
|
|
25
|
+
export declare function getTableAxisY(table: TableObject): number;
|
|
26
|
+
export declare function snapMatrixPositionToAxes(matrix: MatrixObject, x: number, y: number, matrices: MatrixObject[], blocks: TextBlock[], getTextMathAxisY: (block: TextBlock) => number | null): {
|
|
27
|
+
x: number;
|
|
28
|
+
y: number;
|
|
29
|
+
};
|
|
30
|
+
export declare function snapTablePositionToAxes(table: TableObject, x: number, y: number, tables: TableObject[], matrices: MatrixObject[], blocks: TextBlock[], getTextMathAxisY: (block: TextBlock) => number | null): {
|
|
31
|
+
x: number;
|
|
32
|
+
y: number;
|
|
33
|
+
};
|
|
34
|
+
export declare function normalizeGridSelection(selection: GridSelection): GridSelection;
|
|
35
|
+
export declare function getGridCellKey(row: number, col: number): string;
|
|
36
|
+
export declare function isCellSelectedByGridSelection(selection: GridSelection, kind: "matrix" | "table", id: string, row: number, col: number): boolean;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { MathCanvasTheme, Stroke } from "../../../types";
|
|
2
|
+
type StrokeLayerProps = {
|
|
3
|
+
strokes: Stroke[];
|
|
4
|
+
colors: MathCanvasTheme;
|
|
5
|
+
penWidth: number;
|
|
6
|
+
};
|
|
7
|
+
export default function StrokeLayer({ strokes, colors, penWidth }: StrokeLayerProps): import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { type MutableRefObject } from "react";
|
|
2
|
+
import type { CanvasState, Stroke, Tool } from "../../../types";
|
|
3
|
+
type UseStrokeStateOptions = {
|
|
4
|
+
initialState?: Pick<CanvasState, "strokes">;
|
|
5
|
+
defaultPenColor: string;
|
|
6
|
+
pushHistoryStateRef: MutableRefObject<() => void>;
|
|
7
|
+
};
|
|
8
|
+
export declare function useStrokeState({ initialState, defaultPenColor, pushHistoryStateRef }: UseStrokeStateOptions): {
|
|
9
|
+
clearEraserPreview: () => void;
|
|
10
|
+
eraserPreview: {
|
|
11
|
+
x: number;
|
|
12
|
+
y: number;
|
|
13
|
+
radius: number;
|
|
14
|
+
visible: boolean;
|
|
15
|
+
};
|
|
16
|
+
eraseAtPoint: (x: number, y: number, radius: number, createId: () => string) => void;
|
|
17
|
+
extendStroke: (x: number, y: number) => void;
|
|
18
|
+
isDrawing: import("react").RefObject<boolean>;
|
|
19
|
+
isErasing: import("react").RefObject<boolean>;
|
|
20
|
+
penColor: string;
|
|
21
|
+
penColorOptions: readonly [string, "#d14343", "#2f6fed", "#2f9e44", "#c89b0e", "#f2d21b"];
|
|
22
|
+
penWidth: 2 | 12 | 8 | 6 | 4;
|
|
23
|
+
setStrokes: import("react").Dispatch<import("react").SetStateAction<Stroke[]>>;
|
|
24
|
+
setPenColor: import("react").Dispatch<import("react").SetStateAction<string>>;
|
|
25
|
+
setPenWidth: import("react").Dispatch<import("react").SetStateAction<2 | 12 | 8 | 6 | 4>>;
|
|
26
|
+
setShowPenSizes: import("react").Dispatch<import("react").SetStateAction<boolean>>;
|
|
27
|
+
showPenSizes: boolean;
|
|
28
|
+
showPenSizePreviewBriefly: () => void;
|
|
29
|
+
startStroke: (x: number, y: number, tool: Tool, strokeWidth: number, color: string, createId: () => string) => boolean;
|
|
30
|
+
strokes: Stroke[];
|
|
31
|
+
updateEraserPreview: (x: number, y: number) => number;
|
|
32
|
+
};
|
|
33
|
+
export {};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { RenderMode, TextStyleRange } from "../../../types";
|
|
2
|
+
export declare function InlineKatex({ expression, fallback, displayMode, }: {
|
|
3
|
+
expression: string;
|
|
4
|
+
fallback: string;
|
|
5
|
+
displayMode?: boolean;
|
|
6
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
export declare function RenderKatexExpression({ expression, fallback, displayMode, }: {
|
|
8
|
+
expression: string;
|
|
9
|
+
fallback: string;
|
|
10
|
+
displayMode?: boolean;
|
|
11
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
12
|
+
export declare function RenderBlockContent({ content, renderMode, styles, }: {
|
|
13
|
+
content: string;
|
|
14
|
+
renderMode: RenderMode;
|
|
15
|
+
styles?: TextStyleRange[];
|
|
16
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
17
|
+
export declare function RenderEditableBlockContent({ content, renderMode, styles, activeMathStart, caretPosition, hideActiveMath, }: {
|
|
18
|
+
content: string;
|
|
19
|
+
renderMode: RenderMode;
|
|
20
|
+
styles?: TextStyleRange[];
|
|
21
|
+
activeMathStart?: number | null;
|
|
22
|
+
caretPosition?: number | null;
|
|
23
|
+
hideActiveMath?: boolean;
|
|
24
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import type { Dispatch, RefObject, SetStateAction } from "react";
|
|
2
|
+
import type { MathfieldElement } from "mathlive";
|
|
3
|
+
import type { ActiveInlineMathSession, InlineMathPreview } from "../../../../useInlineMathSession";
|
|
4
|
+
import type { MathCanvasTheme, TextBlock } from "../../../types";
|
|
5
|
+
type InlineMathEditorRect = {
|
|
6
|
+
left: number;
|
|
7
|
+
top: number;
|
|
8
|
+
width: number;
|
|
9
|
+
height: number;
|
|
10
|
+
} | null;
|
|
11
|
+
type InlineMathBubbleProps = {
|
|
12
|
+
activeInlineMathAtomId: string | null;
|
|
13
|
+
activeInlineMathDraft: string;
|
|
14
|
+
activeInlineMathSession: ActiveInlineMathSession | null;
|
|
15
|
+
activateInlineMathFallback: () => void;
|
|
16
|
+
cancelActiveInlineMathDraft: () => void;
|
|
17
|
+
colors: MathCanvasTheme;
|
|
18
|
+
commitActiveInlineMathDraft: () => void;
|
|
19
|
+
darkMode: boolean;
|
|
20
|
+
editingBlock: TextBlock | null;
|
|
21
|
+
editingBlockId: string | null;
|
|
22
|
+
exitActiveInlineMathDraft: (direction: "before" | "after") => void;
|
|
23
|
+
handleInlineMathLatexChange: (latex: string) => void;
|
|
24
|
+
inlineMathBubbleRef: RefObject<HTMLDivElement | null>;
|
|
25
|
+
inlineMathEditorMode: "mathlive" | "fallback";
|
|
26
|
+
inlineMathEditorRect: InlineMathEditorRect;
|
|
27
|
+
inlineMathFieldRef: RefObject<MathfieldElement | null>;
|
|
28
|
+
latexPreview: InlineMathPreview;
|
|
29
|
+
markInlineMathEditorReady: () => void;
|
|
30
|
+
openTextBlockMenu: (block: TextBlock) => void;
|
|
31
|
+
setActiveInlineMathDraft: Dispatch<SetStateAction<string>>;
|
|
32
|
+
setRenderMode: Dispatch<SetStateAction<"plain" | "latex">>;
|
|
33
|
+
setSelectedBlockId: Dispatch<SetStateAction<string | null>>;
|
|
34
|
+
};
|
|
35
|
+
export default function InlineMathBubble({ activeInlineMathAtomId, activeInlineMathDraft, activeInlineMathSession, activateInlineMathFallback, cancelActiveInlineMathDraft, colors, commitActiveInlineMathDraft, darkMode, editingBlock, editingBlockId, exitActiveInlineMathDraft, handleInlineMathLatexChange, inlineMathBubbleRef, inlineMathEditorMode, inlineMathEditorRect, inlineMathFieldRef, latexPreview, markInlineMathEditorReady, openTextBlockMenu, setActiveInlineMathDraft, setRenderMode, setSelectedBlockId, }: InlineMathBubbleProps): import("react/jsx-runtime").JSX.Element | null;
|
|
36
|
+
export {};
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import type { Dispatch, MouseEvent, MutableRefObject, RefObject, SetStateAction } from "react";
|
|
2
|
+
import type { MathfieldElement } from "mathlive";
|
|
3
|
+
import type { ActiveInlineMathSession } from "../../../../useInlineMathSession";
|
|
4
|
+
import type { MathCanvasTheme, RenderMode, TextBlock, TextboxResizeAnchor } from "../../../types";
|
|
5
|
+
type MathOverlayCaret = {
|
|
6
|
+
left: number;
|
|
7
|
+
top: number;
|
|
8
|
+
height: number;
|
|
9
|
+
} | null;
|
|
10
|
+
type TextBlockEditorProps = {
|
|
11
|
+
activeInlineMathSession: ActiveInlineMathSession | null;
|
|
12
|
+
activeInlineMathSessionRef: MutableRefObject<ActiveInlineMathSession | null>;
|
|
13
|
+
beginTextboxResize: (block: TextBlock, anchor: TextboxResizeAnchor, event: MouseEvent<HTMLDivElement>) => void;
|
|
14
|
+
clearEditing: () => void;
|
|
15
|
+
colors: MathCanvasTheme;
|
|
16
|
+
commitActiveInlineMathDraft: () => void;
|
|
17
|
+
commitEditing: () => void;
|
|
18
|
+
editableMirrorContentRef: RefObject<HTMLDivElement | null>;
|
|
19
|
+
editableMirrorRef: RefObject<HTMLDivElement | null>;
|
|
20
|
+
editingBlock: TextBlock | null;
|
|
21
|
+
editingDisplayValue: string;
|
|
22
|
+
editingHeight: number;
|
|
23
|
+
editingSelection: number;
|
|
24
|
+
editingValue: string;
|
|
25
|
+
editingWidth: number;
|
|
26
|
+
inlineMathBubbleRef: RefObject<HTMLDivElement | null>;
|
|
27
|
+
inlineMathFieldRef: RefObject<MathfieldElement | null>;
|
|
28
|
+
insertInlineMathAtSelection: (start: number, end: number) => void;
|
|
29
|
+
isOpeningInlineMathSessionRef: MutableRefObject<boolean>;
|
|
30
|
+
latexPreviewStart: number | null;
|
|
31
|
+
mathOverlayCaret: MathOverlayCaret;
|
|
32
|
+
openTextBlockMenu: (block: TextBlock) => void;
|
|
33
|
+
rememberEditingSelection: (target: HTMLTextAreaElement) => void;
|
|
34
|
+
reopenInlineMathSessionAtBoundary: (direction: "before" | "after") => boolean;
|
|
35
|
+
setEditingValue: Dispatch<SetStateAction<string>>;
|
|
36
|
+
setRenderMode: Dispatch<SetStateAction<RenderMode>>;
|
|
37
|
+
setSelectedBlockId: Dispatch<SetStateAction<string | null>>;
|
|
38
|
+
size: {
|
|
39
|
+
width: number;
|
|
40
|
+
height: number;
|
|
41
|
+
};
|
|
42
|
+
textareaRef: RefObject<HTMLTextAreaElement | null>;
|
|
43
|
+
toggleLatexMode: () => void;
|
|
44
|
+
};
|
|
45
|
+
export default function TextBlockEditor({ activeInlineMathSession, activeInlineMathSessionRef, beginTextboxResize, clearEditing, colors, commitActiveInlineMathDraft, commitEditing, editableMirrorContentRef, editableMirrorRef, editingBlock, editingDisplayValue, editingHeight, editingSelection, editingValue, editingWidth, inlineMathBubbleRef, inlineMathFieldRef, insertInlineMathAtSelection, isOpeningInlineMathSessionRef, latexPreviewStart, mathOverlayCaret, openTextBlockMenu, rememberEditingSelection, reopenInlineMathSessionAtBoundary, setEditingValue, setRenderMode, setSelectedBlockId, size, textareaRef, toggleLatexMode, }: TextBlockEditorProps): import("react/jsx-runtime").JSX.Element | null;
|
|
46
|
+
export {};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { Dispatch, SetStateAction } from "react";
|
|
2
|
+
import type { MathCanvasTheme, TextBlock, TextStyleRange } from "../../../types";
|
|
3
|
+
type TextBlockMenuState = {
|
|
4
|
+
blockId: string;
|
|
5
|
+
panel: "format" | "color" | null;
|
|
6
|
+
} | null;
|
|
7
|
+
type TextBlockMenuProps = {
|
|
8
|
+
blockWidths: Record<string, number>;
|
|
9
|
+
colors: MathCanvasTheme;
|
|
10
|
+
copyTextBlock: (block: TextBlock) => Promise<void>;
|
|
11
|
+
deleteTextBlock: (id: string) => void;
|
|
12
|
+
editingBlockId: string | null;
|
|
13
|
+
getBlockById: (id: string | null) => TextBlock | null;
|
|
14
|
+
getResolvedEditingValue: () => string;
|
|
15
|
+
getTextboxSelectionRange: (blockId: string, contentLength: number) => {
|
|
16
|
+
start: number;
|
|
17
|
+
end: number;
|
|
18
|
+
} | null;
|
|
19
|
+
penColorOptions: readonly string[];
|
|
20
|
+
setTextBlockMenu: Dispatch<SetStateAction<TextBlockMenuState>>;
|
|
21
|
+
textBlockMenu: TextBlockMenuState;
|
|
22
|
+
updateTextBlockStyle: (blockId: string, patch: Partial<Omit<TextStyleRange, "id" | "start" | "end">>) => void;
|
|
23
|
+
};
|
|
24
|
+
export default function TextBlockMenu({ blockWidths, colors, copyTextBlock, deleteTextBlock, editingBlockId, getBlockById, getResolvedEditingValue, getTextboxSelectionRange, penColorOptions, setTextBlockMenu, textBlockMenu, updateTextBlockStyle, }: TextBlockMenuProps): import("react/jsx-runtime").JSX.Element | null;
|
|
25
|
+
export {};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { Dispatch, MutableRefObject, SetStateAction } from "react";
|
|
2
|
+
import type { MathCanvasTheme, RenderMode, TextBlock, Tool } from "../../../types";
|
|
3
|
+
type TextBlockViewProps = {
|
|
4
|
+
block: TextBlock;
|
|
5
|
+
blockWidths: Record<string, number>;
|
|
6
|
+
clearGraphSelection: () => void;
|
|
7
|
+
clearMatrixSelection: () => void;
|
|
8
|
+
colors: MathCanvasTheme;
|
|
9
|
+
openTextBlockMenu: (block: TextBlock) => void;
|
|
10
|
+
overlayRefs: MutableRefObject<Record<string, HTMLDivElement | null>>;
|
|
11
|
+
selectedBlockId: string | null;
|
|
12
|
+
setRenderMode: Dispatch<SetStateAction<RenderMode>>;
|
|
13
|
+
setSelectedBlockId: Dispatch<SetStateAction<string | null>>;
|
|
14
|
+
size: {
|
|
15
|
+
width: number;
|
|
16
|
+
height: number;
|
|
17
|
+
};
|
|
18
|
+
startEditing: (id: string, selectionOverride?: number | null) => void;
|
|
19
|
+
tool: Tool;
|
|
20
|
+
};
|
|
21
|
+
export default function TextBlockView({ block, blockWidths, clearGraphSelection, clearMatrixSelection, colors, openTextBlockMenu, overlayRefs, selectedBlockId, setRenderMode, setSelectedBlockId, size, startEditing, tool, }: TextBlockViewProps): import("react/jsx-runtime").JSX.Element;
|
|
22
|
+
export {};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type Konva from "konva";
|
|
2
|
+
import type { Dispatch, MutableRefObject, SetStateAction } from "react";
|
|
3
|
+
import type { MathCanvasTheme, RenderMode, TextBlock, Tool } from "../../../types";
|
|
4
|
+
type TextInteractionLayerProps = {
|
|
5
|
+
blocks: TextBlock[];
|
|
6
|
+
blockWidths: Record<string, number>;
|
|
7
|
+
blockHeights: Record<string, number>;
|
|
8
|
+
size: {
|
|
9
|
+
width: number;
|
|
10
|
+
height: number;
|
|
11
|
+
};
|
|
12
|
+
tool: Tool;
|
|
13
|
+
colors: MathCanvasTheme;
|
|
14
|
+
blockNodeRefs: MutableRefObject<Record<string, Konva.Rect | null>>;
|
|
15
|
+
transformerRef: MutableRefObject<Konva.Transformer | null>;
|
|
16
|
+
graphTransformerRef: MutableRefObject<Konva.Transformer | null>;
|
|
17
|
+
matrixTransformerRef: MutableRefObject<Konva.Transformer | null>;
|
|
18
|
+
tableTransformerRef: MutableRefObject<Konva.Transformer | null>;
|
|
19
|
+
clearGraphSelection: () => void;
|
|
20
|
+
clearMatrixSelection: () => void;
|
|
21
|
+
openTextBlockMenu: (block: TextBlock) => void;
|
|
22
|
+
pushHistoryState: () => void;
|
|
23
|
+
setRenderMode: Dispatch<SetStateAction<RenderMode>>;
|
|
24
|
+
setSelectedBlockId: Dispatch<SetStateAction<string | null>>;
|
|
25
|
+
startEditing: (id: string) => void;
|
|
26
|
+
updateBlock: (id: string, updater: (block: TextBlock) => TextBlock) => void;
|
|
27
|
+
};
|
|
28
|
+
export default function TextInteractionLayer({ blocks, blockWidths, blockHeights, size, tool, colors, blockNodeRefs, transformerRef, graphTransformerRef, matrixTransformerRef, tableTransformerRef, clearGraphSelection, clearMatrixSelection, openTextBlockMenu, pushHistoryState, setRenderMode, setSelectedBlockId, startEditing, updateBlock, }: TextInteractionLayerProps): import("react/jsx-runtime").JSX.Element;
|
|
29
|
+
export {};
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import type { Dispatch, MutableRefObject, SetStateAction } from "react";
|
|
2
|
+
import type { TextBlock, TextStyleRange } from "../../../types";
|
|
3
|
+
type TextBlockMenu = {
|
|
4
|
+
blockId: string;
|
|
5
|
+
panel: "color" | "format" | null;
|
|
6
|
+
};
|
|
7
|
+
type UseTextBlockActionsOptions = {
|
|
8
|
+
blocks: TextBlock[];
|
|
9
|
+
clearEditing: () => void;
|
|
10
|
+
createId: () => string;
|
|
11
|
+
editingBlockId: string | null;
|
|
12
|
+
editingSelection: number;
|
|
13
|
+
editingSelectionEnd: number;
|
|
14
|
+
getResolvedEditingValue: () => string;
|
|
15
|
+
lastEditingSelectionRangeRef: MutableRefObject<{
|
|
16
|
+
blockId: string;
|
|
17
|
+
start: number;
|
|
18
|
+
end: number;
|
|
19
|
+
} | null>;
|
|
20
|
+
pushHistoryState: () => void;
|
|
21
|
+
selectedBlockId: string | null;
|
|
22
|
+
setBlocks: Dispatch<SetStateAction<TextBlock[]>>;
|
|
23
|
+
setEditingValue: Dispatch<SetStateAction<string>>;
|
|
24
|
+
setSelectedBlockId: Dispatch<SetStateAction<string | null>>;
|
|
25
|
+
setTextBlockMenu: Dispatch<SetStateAction<TextBlockMenu | null>>;
|
|
26
|
+
textareaRef: MutableRefObject<HTMLTextAreaElement | null>;
|
|
27
|
+
};
|
|
28
|
+
export declare function useTextBlockActions({ blocks, clearEditing, createId, editingBlockId, editingSelection, editingSelectionEnd, getResolvedEditingValue, lastEditingSelectionRangeRef, pushHistoryState, selectedBlockId, setBlocks, setEditingValue, setSelectedBlockId, setTextBlockMenu, textareaRef, }: UseTextBlockActionsOptions): {
|
|
29
|
+
copyTextBlock: (block: TextBlock) => Promise<void>;
|
|
30
|
+
deleteTextBlock: (blockId: string) => void;
|
|
31
|
+
getBlockById: (id: string | null) => TextBlock | null;
|
|
32
|
+
getTextboxSelectionRange: (blockId: string, contentLength: number) => {
|
|
33
|
+
start: number;
|
|
34
|
+
end: number;
|
|
35
|
+
} | null;
|
|
36
|
+
openTextBlockMenu: (block: TextBlock) => void;
|
|
37
|
+
updateBlock: (id: string, updater: (block: TextBlock) => TextBlock) => void;
|
|
38
|
+
updateTextBlockStyle: (blockId: string, stylePatch: Omit<TextStyleRange, "id" | "start" | "end">) => void;
|
|
39
|
+
};
|
|
40
|
+
export {};
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import type { Dispatch, MutableRefObject, SetStateAction } from "react";
|
|
2
|
+
import { type InlineMathAtom } from "../../../../inlineMathModel";
|
|
3
|
+
import type { RenderMode, TextBlock } from "../../../types";
|
|
4
|
+
type UseTextBlockEditingActionsOptions = {
|
|
5
|
+
blocks: TextBlock[];
|
|
6
|
+
clearGraphEditing: () => void;
|
|
7
|
+
clearGraphSelection: () => void;
|
|
8
|
+
clearMatrixEditing: () => void;
|
|
9
|
+
clearMatrixSelection: () => void;
|
|
10
|
+
createId: () => string;
|
|
11
|
+
editingBlockId: string | null;
|
|
12
|
+
editingHeight: number;
|
|
13
|
+
editingWidth: number;
|
|
14
|
+
getResolvedEditingValue: () => string;
|
|
15
|
+
lastEditingSelectionRangeRef: MutableRefObject<{
|
|
16
|
+
blockId: string;
|
|
17
|
+
start: number;
|
|
18
|
+
end: number;
|
|
19
|
+
} | null>;
|
|
20
|
+
pushHistoryState: () => void;
|
|
21
|
+
renderMode: RenderMode;
|
|
22
|
+
resetInlineMathState: () => void;
|
|
23
|
+
selectedBlockId: string | null;
|
|
24
|
+
setBlocks: Dispatch<SetStateAction<TextBlock[]>>;
|
|
25
|
+
setEditingBlockId: Dispatch<SetStateAction<string | null>>;
|
|
26
|
+
setEditingHeight: Dispatch<SetStateAction<number>>;
|
|
27
|
+
setEditingInlineMathAtoms: Dispatch<SetStateAction<InlineMathAtom[]>>;
|
|
28
|
+
setEditingSelection: Dispatch<SetStateAction<number>>;
|
|
29
|
+
setEditingSelectionEnd: Dispatch<SetStateAction<number>>;
|
|
30
|
+
setEditingValue: Dispatch<SetStateAction<string>>;
|
|
31
|
+
setEditingWidth: Dispatch<SetStateAction<number>>;
|
|
32
|
+
setInlineMathEditorRect: Dispatch<SetStateAction<{
|
|
33
|
+
left: number;
|
|
34
|
+
top: number;
|
|
35
|
+
width: number;
|
|
36
|
+
height: number;
|
|
37
|
+
} | null>>;
|
|
38
|
+
setMathOverlayCaret: Dispatch<SetStateAction<{
|
|
39
|
+
left: number;
|
|
40
|
+
top: number;
|
|
41
|
+
height: number;
|
|
42
|
+
} | null>>;
|
|
43
|
+
setRenderMode: Dispatch<SetStateAction<RenderMode>>;
|
|
44
|
+
setSelectedBlockId: Dispatch<SetStateAction<string | null>>;
|
|
45
|
+
size: {
|
|
46
|
+
width: number;
|
|
47
|
+
height: number;
|
|
48
|
+
};
|
|
49
|
+
};
|
|
50
|
+
export declare function useTextBlockEditingActions({ blocks, clearGraphEditing, clearGraphSelection, clearMatrixEditing, clearMatrixSelection, createId, editingBlockId, editingHeight, editingWidth, getResolvedEditingValue, lastEditingSelectionRangeRef, pushHistoryState, renderMode, resetInlineMathState, selectedBlockId, setBlocks, setEditingBlockId, setEditingHeight, setEditingInlineMathAtoms, setEditingSelection, setEditingSelectionEnd, setEditingValue, setEditingWidth, setInlineMathEditorRect, setMathOverlayCaret, setRenderMode, setSelectedBlockId, size, }: UseTextBlockEditingActionsOptions): {
|
|
51
|
+
clearEditing: () => void;
|
|
52
|
+
commitEditing: () => void;
|
|
53
|
+
createTextBlock: (x: number, y: number) => void;
|
|
54
|
+
rememberEditingSelection: (target: HTMLTextAreaElement) => void;
|
|
55
|
+
startEditing: (id: string, selectionOverride?: number | null) => void;
|
|
56
|
+
};
|
|
57
|
+
export {};
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { type Dispatch, type MutableRefObject, type SetStateAction } from "react";
|
|
2
|
+
import { type InlineMathAtom } from "../../../../inlineMathModel";
|
|
3
|
+
import type { RenderMode, TextBlock } from "../../../types";
|
|
4
|
+
type InlineMathSession = {
|
|
5
|
+
start: number;
|
|
6
|
+
} | null;
|
|
7
|
+
type LatexPreview = {
|
|
8
|
+
start?: number;
|
|
9
|
+
fallback: string;
|
|
10
|
+
caretOffset?: number;
|
|
11
|
+
} | null;
|
|
12
|
+
type UseTextBlockLayoutEffectsOptions = {
|
|
13
|
+
activeInlineMathDraft: string;
|
|
14
|
+
activeInlineMathSession: InlineMathSession;
|
|
15
|
+
blockHeights: Record<string, number>;
|
|
16
|
+
blockWidths: Record<string, number>;
|
|
17
|
+
blocks: TextBlock[];
|
|
18
|
+
containerRef: MutableRefObject<HTMLDivElement | null>;
|
|
19
|
+
editableMirrorContentRef: MutableRefObject<HTMLDivElement | null>;
|
|
20
|
+
editableMirrorRef: MutableRefObject<HTMLDivElement | null>;
|
|
21
|
+
editingBlockId: string | null;
|
|
22
|
+
editingDisplayValue: string;
|
|
23
|
+
editingHeight: number;
|
|
24
|
+
editingSelection: number;
|
|
25
|
+
editingValue: string;
|
|
26
|
+
editingWidth: number;
|
|
27
|
+
inlineMathEditorRect: {
|
|
28
|
+
left: number;
|
|
29
|
+
top: number;
|
|
30
|
+
width: number;
|
|
31
|
+
height: number;
|
|
32
|
+
} | null;
|
|
33
|
+
inlineMathBubbleRef: MutableRefObject<HTMLDivElement | null>;
|
|
34
|
+
inlineMathFieldRef: MutableRefObject<HTMLElement | null>;
|
|
35
|
+
latexPreview: LatexPreview;
|
|
36
|
+
overlayRefs: MutableRefObject<Record<string, HTMLDivElement | null>>;
|
|
37
|
+
renderMode: RenderMode;
|
|
38
|
+
resetInlineMathState: () => void;
|
|
39
|
+
setBlockHeights: Dispatch<SetStateAction<Record<string, number>>>;
|
|
40
|
+
setBlockWidths: Dispatch<SetStateAction<Record<string, number>>>;
|
|
41
|
+
setEditingHeight: Dispatch<SetStateAction<number>>;
|
|
42
|
+
setEditingInlineMathAtoms: Dispatch<SetStateAction<InlineMathAtom[]>>;
|
|
43
|
+
setEditingWidth: Dispatch<SetStateAction<number>>;
|
|
44
|
+
setInlineMathEditorRect: Dispatch<SetStateAction<{
|
|
45
|
+
left: number;
|
|
46
|
+
top: number;
|
|
47
|
+
width: number;
|
|
48
|
+
height: number;
|
|
49
|
+
} | null>>;
|
|
50
|
+
setMathOverlayCaret: Dispatch<SetStateAction<{
|
|
51
|
+
left: number;
|
|
52
|
+
top: number;
|
|
53
|
+
height: number;
|
|
54
|
+
} | null>>;
|
|
55
|
+
size: {
|
|
56
|
+
width: number;
|
|
57
|
+
height: number;
|
|
58
|
+
};
|
|
59
|
+
textareaRef: MutableRefObject<HTMLTextAreaElement | null>;
|
|
60
|
+
};
|
|
61
|
+
export declare function useTextBlockLayoutEffects({ activeInlineMathDraft, activeInlineMathSession, blocks, containerRef, editableMirrorContentRef, editableMirrorRef, editingBlockId, editingDisplayValue, editingHeight, editingSelection, editingValue, editingWidth, inlineMathEditorRect, inlineMathBubbleRef, inlineMathFieldRef, latexPreview, overlayRefs, renderMode, resetInlineMathState, setBlockHeights, setBlockWidths, setEditingHeight, setEditingInlineMathAtoms, setEditingWidth, setInlineMathEditorRect, setMathOverlayCaret, size, textareaRef, }: UseTextBlockLayoutEffectsOptions): void;
|
|
62
|
+
export {};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { TextBlock } from "../../../types";
|
|
2
|
+
type UseTextBlockRenderHelpersOptions = {
|
|
3
|
+
blockHeights: Record<string, number>;
|
|
4
|
+
blockWidths: Record<string, number>;
|
|
5
|
+
blocks: TextBlock[];
|
|
6
|
+
size: {
|
|
7
|
+
width: number;
|
|
8
|
+
height: number;
|
|
9
|
+
};
|
|
10
|
+
};
|
|
11
|
+
export declare function useTextBlockRenderHelpers({ blockHeights, blockWidths, blocks, size, }: UseTextBlockRenderHelpersOptions): {
|
|
12
|
+
findTextBlockBlockingCreation: (x: number, y: number) => TextBlock | null;
|
|
13
|
+
getTextMathAxisY: (block: TextBlock) => number | null;
|
|
14
|
+
};
|
|
15
|
+
export {};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { type Dispatch, type SetStateAction } from "react";
|
|
2
|
+
import type { TextBlock, TextboxResizeAnchor } from "../../../types";
|
|
3
|
+
type UseTextboxResizeOptions = {
|
|
4
|
+
editingHeight: number;
|
|
5
|
+
editingWidth: number;
|
|
6
|
+
getBlockById: (id: string | null) => TextBlock | null;
|
|
7
|
+
pushHistoryState: () => void;
|
|
8
|
+
setEditingHeight: Dispatch<SetStateAction<number>>;
|
|
9
|
+
setEditingWidth: Dispatch<SetStateAction<number>>;
|
|
10
|
+
size: {
|
|
11
|
+
width: number;
|
|
12
|
+
height: number;
|
|
13
|
+
};
|
|
14
|
+
updateBlock: (id: string, updater: (block: TextBlock) => TextBlock) => void;
|
|
15
|
+
};
|
|
16
|
+
export declare function useTextboxResize({ editingHeight, editingWidth, getBlockById, pushHistoryState, setEditingHeight, setEditingWidth, size, updateBlock, }: UseTextboxResizeOptions): {
|
|
17
|
+
beginTextboxResize: (block: TextBlock, anchor: TextboxResizeAnchor, event: React.MouseEvent<HTMLDivElement>) => void;
|
|
18
|
+
};
|
|
19
|
+
export {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export { default as InlineMathBubble } from "./components/InlineMathBubble";
|
|
2
|
+
export { default as TextBlockEditor } from "./components/TextBlockEditor";
|
|
3
|
+
export { default as TextBlockMenu } from "./components/TextBlockMenu";
|
|
4
|
+
export { default as TextBlockView } from "./components/TextBlockView";
|
|
5
|
+
export { default as TextInteractionLayer } from "./components/TextInteractionLayer";
|
|
6
|
+
export { InlineKatex, RenderBlockContent, RenderEditableBlockContent, RenderKatexExpression, } from "./components/BlockRenderers";
|
|
7
|
+
export { useTextBlockActions } from "./hooks/useTextBlockActions";
|
|
8
|
+
export { useTextBlockEditingActions } from "./hooks/useTextBlockEditingActions";
|
|
9
|
+
export { useTextBlockLayoutEffects } from "./hooks/useTextBlockLayoutEffects";
|
|
10
|
+
export { useTextBlockRenderHelpers } from "./hooks/useTextBlockRenderHelpers";
|
|
11
|
+
export { useTextboxResize } from "./hooks/useTextboxResize";
|
|
12
|
+
export { canRenderLatex } from "./utils/textLayout";
|