mathlean-canvas 0.3.2 → 0.3.4

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.
Files changed (72) hide show
  1. package/README.md +213 -68
  2. package/dist/InlineMathLiveField.d.ts +17 -0
  3. package/dist/MathCanvas/components/CanvasOverlayViewport.d.ts +21 -0
  4. package/dist/MathCanvas/components/ObjectOverlays.d.ts +36 -0
  5. package/dist/MathCanvas/components/Toolbar.d.ts +34 -0
  6. package/dist/MathCanvas/components/icons.d.ts +61 -0
  7. package/dist/MathCanvas/constants.d.ts +70 -0
  8. package/dist/MathCanvas/core/hooks/useCanvasEditorFocus.d.ts +32 -0
  9. package/dist/MathCanvas/core/hooks/useCanvasGlobalActions.d.ts +41 -0
  10. package/dist/MathCanvas/core/hooks/useCanvasGlobalDragEffects.d.ts +35 -0
  11. package/dist/MathCanvas/core/hooks/useCanvasHistory.d.ts +13 -0
  12. package/dist/MathCanvas/core/hooks/useCanvasKeyboardShortcuts.d.ts +76 -0
  13. package/dist/MathCanvas/core/hooks/useCanvasSnapshot.d.ts +24 -0
  14. package/dist/MathCanvas/core/hooks/useCanvasStageInteractions.d.ts +104 -0
  15. package/dist/MathCanvas/core/hooks/useCanvasTransformers.d.ts +28 -0
  16. package/dist/MathCanvas/core/hooks/useCanvasViewport.d.ts +25 -0
  17. package/dist/MathCanvas/core/index.d.ts +9 -0
  18. package/dist/MathCanvas/features/geometry/components/CoordinatePlaneLayer.d.ts +15 -0
  19. package/dist/MathCanvas/features/geometry/components/GeometryLayer.d.ts +65 -0
  20. package/dist/MathCanvas/features/geometry/components/GeometryOverlays.d.ts +57 -0
  21. package/dist/MathCanvas/features/geometry/hooks/useGeometryCanvasActions.d.ts +29 -0
  22. package/dist/MathCanvas/features/geometry/hooks/useGeometryRenderData.d.ts +60 -0
  23. package/dist/MathCanvas/features/geometry/hooks/useGeometryState.d.ts +147 -0
  24. package/dist/MathCanvas/features/geometry/index.d.ts +6 -0
  25. package/dist/MathCanvas/features/graph/components/GraphLayer.d.ts +39 -0
  26. package/dist/MathCanvas/features/graph/components/GraphNodeEditor.d.ts +14 -0
  27. package/dist/MathCanvas/features/graph/hooks/useGraphCanvasActions.d.ts +44 -0
  28. package/dist/MathCanvas/features/graph/hooks/useGraphState.d.ts +77 -0
  29. package/dist/MathCanvas/features/graph/index.d.ts +4 -0
  30. package/dist/MathCanvas/features/grid/components/CellMathEditor.d.ts +17 -0
  31. package/dist/MathCanvas/features/grid/components/GridObjectOverlays.d.ts +71 -0
  32. package/dist/MathCanvas/features/grid/components/MatrixBlock.d.ts +20 -0
  33. package/dist/MathCanvas/features/grid/components/MatrixBrackets.d.ts +6 -0
  34. package/dist/MathCanvas/features/grid/components/MatrixEditorBlock.d.ts +50 -0
  35. package/dist/MathCanvas/features/grid/components/MatrixLayer.d.ts +31 -0
  36. package/dist/MathCanvas/features/grid/components/TableBlock.d.ts +21 -0
  37. package/dist/MathCanvas/features/grid/components/TableEditorBlock.d.ts +46 -0
  38. package/dist/MathCanvas/features/grid/hooks/useGridCanvasActions.d.ts +66 -0
  39. package/dist/MathCanvas/features/grid/hooks/useGridObjectState.d.ts +147 -0
  40. package/dist/MathCanvas/features/grid/index.d.ts +5 -0
  41. package/dist/MathCanvas/features/grid/utils/matrixOps.d.ts +36 -0
  42. package/dist/MathCanvas/features/plot/components/PlotControls.d.ts +28 -0
  43. package/dist/MathCanvas/features/plot/components/PlotLayer.d.ts +30 -0
  44. package/dist/MathCanvas/features/plot/index.d.ts +2 -0
  45. package/dist/MathCanvas/features/plot/utils/plotCompiler.d.ts +18 -0
  46. package/dist/MathCanvas/features/plot/utils/plotModel.d.ts +16 -0
  47. package/dist/MathCanvas/features/stroke/components/StrokeLayer.d.ts +8 -0
  48. package/dist/MathCanvas/features/stroke/hooks/useStrokeState.d.ts +33 -0
  49. package/dist/MathCanvas/features/stroke/index.d.ts +2 -0
  50. package/dist/MathCanvas/features/text/components/BlockRenderers.d.ts +24 -0
  51. package/dist/MathCanvas/features/text/components/InlineMathBubble.d.ts +36 -0
  52. package/dist/MathCanvas/features/text/components/TextBlockEditor.d.ts +46 -0
  53. package/dist/MathCanvas/features/text/components/TextBlockMenu.d.ts +25 -0
  54. package/dist/MathCanvas/features/text/components/TextBlockView.d.ts +22 -0
  55. package/dist/MathCanvas/features/text/components/TextInteractionLayer.d.ts +29 -0
  56. package/dist/MathCanvas/features/text/hooks/useTextBlockActions.d.ts +40 -0
  57. package/dist/MathCanvas/features/text/hooks/useTextBlockEditingActions.d.ts +57 -0
  58. package/dist/MathCanvas/features/text/hooks/useTextBlockLayoutEffects.d.ts +62 -0
  59. package/dist/MathCanvas/features/text/hooks/useTextBlockRenderHelpers.d.ts +16 -0
  60. package/dist/MathCanvas/features/text/hooks/useTextboxResize.d.ts +19 -0
  61. package/dist/MathCanvas/features/text/index.d.ts +12 -0
  62. package/dist/MathCanvas/features/text/utils/textLayout.d.ts +33 -0
  63. package/dist/MathCanvas/types.d.ts +241 -0
  64. package/dist/MathCanvas/utils/geometryMath.d.ts +13 -0
  65. package/dist/MathCanvas/utils/graphDirection.d.ts +3 -0
  66. package/dist/MathCanvas/utils/latex.d.ts +20 -0
  67. package/dist/MathCanvas.d.ts +7 -0
  68. package/dist/index.d.ts +3 -0
  69. package/dist/index.js +63216 -11372
  70. package/dist/inlineMathModel.d.ts +26 -0
  71. package/dist/useInlineMathSession.d.ts +67 -0
  72. package/package.json +5 -2
@@ -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,16 @@
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
+ findTextBlockNearPoint: (x: number, y: number) => TextBlock | null;
14
+ getTextMathAxisY: (block: TextBlock) => number | null;
15
+ };
16
+ 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";
@@ -0,0 +1,33 @@
1
+ import { type CSSProperties } from "react";
2
+ import type { TextBlock, TextStyleRange, TextboxResizeAnchor } from "../../../types";
3
+ export declare function getBlockFontSize(block?: Pick<TextBlock, "fontSize"> | null): number;
4
+ export declare function normalizeTextStyleRanges(ranges: TextStyleRange[] | undefined, contentLength: number): {
5
+ start: number;
6
+ end: number;
7
+ id: string;
8
+ bold?: boolean;
9
+ italic?: boolean;
10
+ underline?: boolean;
11
+ color?: string;
12
+ }[];
13
+ export declare function getStyleRangeCss(range: TextStyleRange): CSSProperties;
14
+ export declare function mergeTextRangeStyles(ranges: TextStyleRange[]): CSSProperties;
15
+ export declare function renderStyledText(value: string, absoluteStart: number, ranges: TextStyleRange[], keyPrefix: string): " " | import("react").DetailedReactHTMLElement<{
16
+ key: string;
17
+ style: CSSProperties | undefined;
18
+ }, HTMLElement>[];
19
+ export declare function measureEditorTextWidth(content: string, fontSize?: number): number;
20
+ export declare function measureTextWidth(content: string, fontFamily: string, fontSize?: number): number;
21
+ export declare function clampTextBlockWidth(width: number, maxWidth: number): number;
22
+ export declare function getTextBlockWrapWidth(block: Pick<TextBlock, "width" | "manualWidth">, maxWidth: number): number;
23
+ export declare function getAutoTextBlockWidth(contentWidth: number, maxWidth: number): number;
24
+ export declare function clampTextFontSize(fontSize: number): number;
25
+ export declare function isTextboxSideAnchor(anchor: TextboxResizeAnchor): anchor is "middle-left" | "middle-right";
26
+ export declare function getTextboxResizeCursor(anchor: TextboxResizeAnchor): "ew-resize" | "nesw-resize" | "nwse-resize";
27
+ export declare function shouldTextBlockWrap(block: Pick<TextBlock, "manualWidth" | "width">, maxWidth?: number): boolean;
28
+ export declare function measureMirrorContentBounds(container: HTMLElement): {
29
+ width: number;
30
+ height: number;
31
+ overflowsInline: boolean;
32
+ };
33
+ export declare function canRenderLatex(value: string): boolean;
@@ -0,0 +1,241 @@
1
+ import type { Stage } from "react-konva";
2
+ import type { MathJsonExpression } from "@cortex-js/compute-engine/math-json";
3
+ export type Tool = "select" | "pan" | "pen" | "eraser" | "text" | "graph" | "plot" | "matrix" | "table" | "geometry";
4
+ export type DrawingTool = "pen" | "eraser";
5
+ export type RenderMode = "plain" | "latex";
6
+ export type GeometryMode = "point" | "segment" | "angle" | "circle" | "label" | "midpoint" | "perpendicular" | "parallel" | "fixed" | "regular" | "rightAngle" | "equalSide";
7
+ export type GeometryObjectKind = "point" | "segment" | "polygon" | "angle" | "circle";
8
+ export type GeometryDirection = "left" | "right" | "up" | "down";
9
+ export type GraphDirection = "upLeft" | "up" | "upRight" | "left" | "right" | "downLeft" | "down" | "downRight";
10
+ export type CoordinatePlaneMode = "blank" | "grid" | "plane";
11
+ export type GeometryLabelTarget = {
12
+ kind: "segment" | "angle" | "circle";
13
+ id: string;
14
+ };
15
+ export type GeometryLabelOffset = {
16
+ x: number;
17
+ y: number;
18
+ };
19
+ export type Stroke = {
20
+ id: string;
21
+ points: number[];
22
+ tool: DrawingTool;
23
+ strokeWidth?: number;
24
+ color?: string;
25
+ };
26
+ export type TextStyleRange = {
27
+ id: string;
28
+ start: number;
29
+ end: number;
30
+ bold?: boolean;
31
+ italic?: boolean;
32
+ underline?: boolean;
33
+ color?: string;
34
+ };
35
+ export type TextBlock = {
36
+ id: string;
37
+ x: number;
38
+ y: number;
39
+ width: number;
40
+ height: number;
41
+ content: string;
42
+ renderMode: RenderMode;
43
+ fontSize?: number;
44
+ manualWidth?: boolean;
45
+ styles?: TextStyleRange[];
46
+ };
47
+ export type GraphNode = {
48
+ id: string;
49
+ x: number;
50
+ y: number;
51
+ width: number;
52
+ height: number;
53
+ label: string;
54
+ shape: "circle";
55
+ };
56
+ export type GraphEdge = {
57
+ id: string;
58
+ sourceId: string;
59
+ targetId: string;
60
+ directed?: boolean;
61
+ };
62
+ export type PlotEquation = {
63
+ id: string;
64
+ latex: string;
65
+ mathJson: MathJsonExpression | null;
66
+ color: string;
67
+ };
68
+ export type PlotFunction = {
69
+ id: string;
70
+ x: number;
71
+ y: number;
72
+ width: number;
73
+ height: number;
74
+ latex: string;
75
+ mathJson: MathJsonExpression | null;
76
+ color: string;
77
+ scale?: number;
78
+ equations?: PlotEquation[];
79
+ equationPanelX?: number;
80
+ equationPanelY?: number;
81
+ };
82
+ export type GraphClipboard = {
83
+ nodes: Array<GraphNode & {
84
+ offsetX: number;
85
+ offsetY: number;
86
+ }>;
87
+ edges: GraphEdge[];
88
+ primaryNodeId: string;
89
+ };
90
+ export type TextboxResizeAnchor = "middle-left" | "middle-right" | "top-left" | "top-right" | "bottom-left" | "bottom-right";
91
+ export type TextboxResizeDrag = {
92
+ blockId: string;
93
+ anchor: TextboxResizeAnchor;
94
+ startClientX: number;
95
+ startClientY: number;
96
+ startX: number;
97
+ startY: number;
98
+ startWidth: number;
99
+ startHeight: number;
100
+ startFontSize: number;
101
+ didPushHistory: boolean;
102
+ };
103
+ export type MatrixObject = {
104
+ id: string;
105
+ x: number;
106
+ y: number;
107
+ rows: number;
108
+ cols: number;
109
+ cells: string[][];
110
+ rowSeparators: MatrixSeparator[];
111
+ colSeparators: MatrixSeparator[];
112
+ };
113
+ export type MatrixSeparatorSegment = {
114
+ index: number;
115
+ start: number;
116
+ end: number;
117
+ };
118
+ export type MatrixSeparator = number | MatrixSeparatorSegment;
119
+ export type TableObject = {
120
+ id: string;
121
+ x: number;
122
+ y: number;
123
+ rows: number;
124
+ cols: number;
125
+ cells: string[][];
126
+ };
127
+ export type GeoPoint = {
128
+ id: string;
129
+ x: number;
130
+ y: number;
131
+ label?: string;
132
+ derived?: {
133
+ kind: "midpoint";
134
+ a: string;
135
+ b: string;
136
+ };
137
+ };
138
+ export type GeoSegment = {
139
+ id: string;
140
+ a: string;
141
+ b: string;
142
+ label?: string;
143
+ showLength?: boolean;
144
+ labelOffset?: GeometryLabelOffset;
145
+ equalMarker?: number;
146
+ };
147
+ export type GeoPolygon = {
148
+ id: string;
149
+ pointIds: string[];
150
+ label?: string;
151
+ };
152
+ export type GeoAngle = {
153
+ id: string;
154
+ a: string;
155
+ b: string;
156
+ c: string;
157
+ label?: string;
158
+ showArc?: boolean;
159
+ labelOffset?: GeometryLabelOffset;
160
+ };
161
+ export type GeoCircle = {
162
+ id: string;
163
+ centerId: string;
164
+ radiusPointId?: string;
165
+ radiusValue?: string;
166
+ label?: string;
167
+ labelOffset?: GeometryLabelOffset;
168
+ };
169
+ export type GeoHelperSegment = {
170
+ id: string;
171
+ kind: "perpendicular" | "parallel";
172
+ baseA: string;
173
+ baseB: string;
174
+ through: string;
175
+ length: number;
176
+ };
177
+ export type GeoRightAngleMarker = {
178
+ id: string;
179
+ a: string;
180
+ b: string;
181
+ c: string;
182
+ };
183
+ export type GridSelection = {
184
+ kind: "matrix" | "table";
185
+ id: string;
186
+ startRow: number;
187
+ endRow: number;
188
+ startCol: number;
189
+ endCol: number;
190
+ mode: "cell" | "row" | "column" | "upperTriangle" | "lowerTriangle" | "diagonal" | "antiDiagonal";
191
+ excludedCells?: string[];
192
+ };
193
+ export type CanvasState = {
194
+ strokes: Stroke[];
195
+ blocks: TextBlock[];
196
+ graphNodes: GraphNode[];
197
+ graphEdges: GraphEdge[];
198
+ plots: PlotFunction[];
199
+ matrices: MatrixObject[];
200
+ tables: TableObject[];
201
+ geoPoints: GeoPoint[];
202
+ geoSegments: GeoSegment[];
203
+ geoPolygons: GeoPolygon[];
204
+ geoAngles: GeoAngle[];
205
+ geoCircles: GeoCircle[];
206
+ geoHelperSegments: GeoHelperSegment[];
207
+ geoRightAngleMarkers: GeoRightAngleMarker[];
208
+ coordinatePlaneMode: CoordinatePlaneMode;
209
+ renderMode: RenderMode;
210
+ };
211
+ export type StageMouseEvent = Parameters<NonNullable<React.ComponentProps<typeof Stage>["onMouseDown"]>>[0];
212
+ export type StageTouchEvent = Parameters<NonNullable<React.ComponentProps<typeof Stage>["onTouchStart"]>>[0];
213
+ export type StagePointerEvent = StageMouseEvent | StageTouchEvent;
214
+ export type StageClickEvent = Parameters<NonNullable<React.ComponentProps<typeof Stage>["onClick"]>>[0];
215
+ export type StageTapEvent = Parameters<NonNullable<React.ComponentProps<typeof Stage>["onTap"]>>[0];
216
+ export type StageActivationEvent = StageClickEvent | StageTapEvent;
217
+ export type MathCanvasTheme = {
218
+ bg: string;
219
+ bgAlt: string;
220
+ surface: string;
221
+ surfaceHover: string;
222
+ border: string;
223
+ text: string;
224
+ textMuted: string;
225
+ danger: string;
226
+ dangerBorder: string;
227
+ dangerBg: string;
228
+ edge: string;
229
+ edgeActive: string;
230
+ node: string;
231
+ nodeHover: string;
232
+ nodeActive: string;
233
+ eraser: string;
234
+ };
235
+ export type MathCanvasProps = {
236
+ darkMode?: boolean;
237
+ className?: string;
238
+ style?: React.CSSProperties;
239
+ initialState?: CanvasState;
240
+ onStateChange?: (state: CanvasState) => void;
241
+ };
@@ -0,0 +1,13 @@
1
+ import type { GeoPoint } from "../types";
2
+ export declare function getPointLabel(index: number): string;
3
+ export declare function distanceToLineSegment(px: number, py: number, ax: number, ay: number, bx: number, by: number): number;
4
+ export declare function getAngleBetweenPoints(a: GeoPoint, b: GeoPoint, c: GeoPoint): {
5
+ start: number;
6
+ end: number;
7
+ delta: number;
8
+ };
9
+ export declare function buildAngleArcPoints(a: GeoPoint, b: GeoPoint, c: GeoPoint, radius?: number): number[];
10
+ export declare function getAngleLabelPoint(a: GeoPoint, b: GeoPoint, c: GeoPoint, radius?: number): {
11
+ x: number;
12
+ y: number;
13
+ };
@@ -0,0 +1,3 @@
1
+ import type { GraphDirection } from "../types";
2
+ export declare const getGraphDirectionFromArrowKey: (key: string) => GraphDirection | null;
3
+ export declare const getGraphDirectionFromArrowKeys: (keys: Set<string>, latestKey: string) => GraphDirection | null;
@@ -0,0 +1,20 @@
1
+ export declare function shouldPreferDisplayStyle(expression: string, displayMode: boolean): boolean;
2
+ export declare function getPreferredRenderedLatex(expression: string, displayMode: boolean): string;
3
+ export declare function canRenderLatex(value: string): boolean;
4
+ export declare function parseLatexSegments(content: string): ({
5
+ id: string;
6
+ type: "math";
7
+ value: string;
8
+ fallback: string;
9
+ displayMode: boolean;
10
+ start: number;
11
+ end: number;
12
+ } | {
13
+ id: string;
14
+ type: "text";
15
+ value: string;
16
+ start: number;
17
+ end: number;
18
+ fallback?: undefined;
19
+ displayMode?: undefined;
20
+ })[];
@@ -0,0 +1,7 @@
1
+ import "katex/dist/katex.min.css";
2
+ import "mathlive";
3
+ import "mathlive/fonts.css";
4
+ import "mathlive/static.css";
5
+ export type { CanvasState, MathCanvasProps, GeoPoint, GeoSegment, GeoPolygon, GeoAngle, GeoCircle, GeoHelperSegment, GeoRightAngleMarker, } from "./MathCanvas/types";
6
+ import type { MathCanvasProps } from "./MathCanvas/types";
7
+ export default function MathCanvas({ darkMode, className, style, initialState, onStateChange }: MathCanvasProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,3 @@
1
+ export { default } from "./MathCanvas";
2
+ export { default as MathCanvas } from "./MathCanvas";
3
+ export type { CanvasState, MathCanvasProps } from "./MathCanvas";