@dev_bachani/math-editor 0.0.1

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.
@@ -0,0 +1,116 @@
1
+ /**
2
+ * Core type definitions for Mathex
3
+ */
4
+ /**
5
+ * Configuration for a single keyboard button
6
+ */
7
+ export interface ButtonConfig {
8
+ /** Text/symbol displayed on the button */
9
+ display: string;
10
+ /** LaTeX string to insert when button is clicked */
11
+ latex: string;
12
+ /** Type of button for styling purposes */
13
+ type: 'symbol' | 'number' | 'operator' | 'function' | 'action' | 'letter' | 'variable';
14
+ /** Button style (background color variant) */
15
+ style?: 'white' | 'gray-light' | 'gray-medium' | 'gray-dark' | 'blue';
16
+ /** Button size variant */
17
+ size?: 'standard' | 'wide' | 'extra-wide';
18
+ /** Optional tooltip description */
19
+ description?: string;
20
+ /** Optional dual-character configuration for shift-toggle buttons */
21
+ dualChar?: {
22
+ /** Primary character (shown clear when shift is OFF) */
23
+ primary: string;
24
+ /** Primary LaTeX to insert when shift is OFF */
25
+ primaryLatex: string;
26
+ /** Secondary character (shown clear when shift is ON) */
27
+ secondary: string;
28
+ /** Secondary LaTeX to insert when shift is ON */
29
+ secondaryLatex: string;
30
+ };
31
+ }
32
+ /**
33
+ * Configuration for a function category in the functions panel
34
+ */
35
+ export interface FunctionCategory {
36
+ /** Unique identifier for the category */
37
+ id: string;
38
+ /** Display name for the category header */
39
+ name: string;
40
+ /** List of functions in this category */
41
+ functions: FunctionConfig[];
42
+ }
43
+ /**
44
+ * Configuration for a single function button
45
+ */
46
+ export interface FunctionConfig {
47
+ /** Label displayed on the function button */
48
+ display: string;
49
+ /** LaTeX string to insert when function is selected */
50
+ latex: string;
51
+ /** Optional tooltip description */
52
+ description?: string;
53
+ }
54
+ /**
55
+ * Keyboard mode configuration
56
+ */
57
+ export interface KeyboardMode {
58
+ /** Unique identifier for the mode */
59
+ id: string;
60
+ /** Display name for the mode */
61
+ name: string;
62
+ /** 2D array of button configurations (rows and columns) */
63
+ buttons: ButtonConfig[][];
64
+ /** IDs of function categories to include in this mode */
65
+ functionCategories: string[];
66
+ }
67
+ /**
68
+ * Theme configuration for styling
69
+ */
70
+ export interface ThemeConfig {
71
+ colors?: {
72
+ primary?: string;
73
+ background?: string;
74
+ text?: string;
75
+ border?: string;
76
+ buttonHover?: string;
77
+ error?: string;
78
+ };
79
+ sizing?: {
80
+ fontSize?: string;
81
+ buttonWidth?: string;
82
+ buttonHeight?: string;
83
+ };
84
+ spacing?: {
85
+ buttonGap?: string;
86
+ sectionGap?: string;
87
+ };
88
+ }
89
+ /**
90
+ * Cursor state within a math input
91
+ */
92
+ export interface CursorState {
93
+ /** Character index in the LaTeX string */
94
+ position: number;
95
+ /** Optional selection range */
96
+ selection?: {
97
+ start: number;
98
+ end: number;
99
+ };
100
+ }
101
+ /**
102
+ * Internal state for a single MathInput component
103
+ */
104
+ export interface MathInputState {
105
+ /** Unique identifier for this input */
106
+ id: string;
107
+ /** Current LaTeX string */
108
+ latex: string;
109
+ /** Cursor state */
110
+ cursor: CursorState;
111
+ /** Whether this input is focused */
112
+ focused: boolean;
113
+ /** Any rendering error */
114
+ error: Error | null;
115
+ }
116
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B,0CAA0C;IAC1C,OAAO,EAAE,MAAM,CAAC;IAChB,oDAAoD;IACpD,KAAK,EAAE,MAAM,CAAC;IACd,0CAA0C;IAC1C,IAAI,EAAE,QAAQ,GAAG,QAAQ,GAAG,UAAU,GAAG,UAAU,GAAG,QAAQ,GAAG,QAAQ,GAAG,UAAU,CAAC;IACvF,8CAA8C;IAC9C,KAAK,CAAC,EAAE,OAAO,GAAG,YAAY,GAAG,aAAa,GAAG,WAAW,GAAG,MAAM,CAAC;IACtE,0BAA0B;IAC1B,I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IACF,MAAM,CAAC,EAAE;QACP,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,WAAW,CAAC,EAAE,MAAM,CAAC;QACrB,YAAY,CAAC,EAAE,MAAM,CAAC;KACvB,CAAC;IACF,OAAO,CAAC,EAAE;QACR,SAAS,CAAC,EAAE,MAAM,CAAC;QACnB,UAAU,CAAC,EAAE,MAAM,CAAC;KACrB,CAAC;CACH;AAED;;GAEG;AACH,MAAM,WAAW,WAAW;IAC1B,0CAA0C;IAC1C,QAAQ,EAAE,MAAM,CAAC;IACjB,+BAA+B;IAC/B,SAAS,CAAC,EAAE;QACV,KAAK,EAAE,MAAM,CAAC;QACd,GAAG,EAAE,MAAM,CAAC;KACb,CAAC;CACH;AAED;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,uCAAuC;IACvC,EAAE,EAAE,MAAM,CAAC;IACX,2BAA2B;IAC3B,KAAK,EAAE,MAAM,CAAC;IACd,mBAAmB;IACnB,MAAM,EAAE,WAAW,CAAC;IACpB,oCAAoC;IACpC,OAAO,EAAE,OAAO,CAAC;IACjB,0BAA0B;IAC1B,KAAK,EAAE,KAAK,GAAG,IAAI,CAAC;CACrB"}
package/package.json ADDED
@@ -0,0 +1,75 @@
1
+ {
2
+ "name": "@dev_bachani/math-editor",
3
+ "version": "0.0.1",
4
+ "description": "A Desmos-like math equation editor component library for React",
5
+ "type": "module",
6
+ "main": "./dist/mathex.cjs",
7
+ "module": "./dist/mathex.js",
8
+ "types": "./dist/index.d.ts",
9
+ "exports": {
10
+ ".": {
11
+ "types": "./dist/index.d.ts",
12
+ "import": "./dist/mathex.js",
13
+ "require": "./dist/mathex.cjs"
14
+ },
15
+ "./dist/style.css": "./dist/style.css"
16
+ },
17
+ "files": [
18
+ "dist"
19
+ ],
20
+ "keywords": [
21
+ "math",
22
+ "equation",
23
+ "editor",
24
+ "react",
25
+ "latex",
26
+ "katex",
27
+ "desmos",
28
+ "wysiwyg",
29
+ "educational"
30
+ ],
31
+ "license": "MIT",
32
+ "repository": {
33
+ "type": "git",
34
+ "url": "https://github.com/Dev22603/Mathex.git"
35
+ },
36
+ "scripts": {
37
+ "dev": "vite",
38
+ "build": "tsc -b && vite build",
39
+ "build:lib": "tsc -b && vite build --config vite.config.lib.ts",
40
+ "lint": "eslint .",
41
+ "lint:fix": "eslint . --fix",
42
+ "format": "prettier --write \"src/**/*.{ts,tsx,css}\"",
43
+ "preview": "vite preview",
44
+ "typecheck": "tsc --noEmit"
45
+ },
46
+ "peerDependencies": {
47
+ "react": "^18.0.0 || ^19.0.0",
48
+ "react-dom": "^18.0.0 || ^19.0.0"
49
+ },
50
+ "dependencies": {
51
+ "clsx": "^2.1.1",
52
+ "jquery": "^3.7.1",
53
+ "katex": "^0.16.11",
54
+ "mathquill": "^0.10.1-a"
55
+ },
56
+ "devDependencies": {
57
+ "@eslint/js": "^9.39.1",
58
+ "@types/katex": "^0.16.7",
59
+ "@types/node": "^24.10.1",
60
+ "@types/react": "^19.2.5",
61
+ "@types/react-dom": "^19.2.3",
62
+ "@vitejs/plugin-react": "^5.1.1",
63
+ "eslint": "^9.39.1",
64
+ "eslint-plugin-react-hooks": "^7.0.1",
65
+ "eslint-plugin-react-refresh": "^0.4.24",
66
+ "globals": "^16.5.0",
67
+ "prettier": "^3.4.2",
68
+ "react": "^19.2.0",
69
+ "react-dom": "^19.2.0",
70
+ "typescript": "~5.9.3",
71
+ "typescript-eslint": "^8.46.4",
72
+ "vite": "^7.2.4",
73
+ "vite-plugin-dts": "^4.5.0"
74
+ }
75
+ }