tetrons 2.3.24 → 2.3.26

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.
@@ -369,3 +369,195 @@
369
369
  padding: 0.5rem;
370
370
  text-align: left;
371
371
  }
372
+
373
+ .icon-btn {
374
+ padding: 0.5rem;
375
+ background: transparent;
376
+ border: none;
377
+ cursor: pointer;
378
+ }
379
+
380
+ .stop-btn {
381
+ background-color: #dc2626;
382
+ color: white;
383
+ margin-right: 20px;
384
+ }
385
+
386
+ .stop-btn:hover {
387
+ background-color: #b91c1c;
388
+ }
389
+
390
+ .voice-modal {
391
+ position: fixed;
392
+ inset: 0;
393
+ background: rgba(0, 0, 0, 0.5);
394
+ z-index: 9999;
395
+ display: flex;
396
+ align-items: center;
397
+ justify-content: center;
398
+ }
399
+
400
+ .voice-modal-content {
401
+ background: white;
402
+ padding: 2rem;
403
+ border-radius: 12px;
404
+ text-align: center;
405
+ box-shadow: 0 0 20px rgba(0, 0, 0, 0.2);
406
+ }
407
+
408
+ .ai-button {
409
+ padding: 8px 16px;
410
+ background: linear-gradient(to right, #7f00ff, #4f46e5);
411
+ color: white;
412
+ font-weight: bold;
413
+ border: none;
414
+ border-radius: 6px;
415
+ box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
416
+ cursor: pointer;
417
+ transition: background 0.3s ease, transform 0.2s ease;
418
+ }
419
+
420
+ .ai-button:hover {
421
+ background: linear-gradient(to right, #6b00d6, #4338ca);
422
+ transform: translateY(-1px);
423
+ }
424
+
425
+ .ai-button:active {
426
+ transform: scale(0.97);
427
+ }
428
+
429
+ .prompt-container {
430
+ margin-top: 0.5rem;
431
+ display: flex;
432
+ flex-direction: column;
433
+ gap: 0.5rem;
434
+ }
435
+
436
+ .prompt-textarea {
437
+ width: 100%;
438
+ padding: 8px;
439
+ font-size: 14px;
440
+ border-radius: 4px;
441
+ border: 1px solid #ccc;
442
+ resize: vertical;
443
+ }
444
+
445
+ .prompt-actions {
446
+ display: flex;
447
+ gap: 0.5rem;
448
+ }
449
+
450
+ .prompt-submit-btn {
451
+ padding: 6px 12px;
452
+ background-color: #4f46e5;
453
+ color: #fff;
454
+ border-radius: 4px;
455
+ border: none;
456
+ cursor: pointer;
457
+ transition: background-color 0.2s ease;
458
+ }
459
+
460
+ .prompt-submit-btn:disabled {
461
+ cursor: not-allowed;
462
+ opacity: 0.6;
463
+ }
464
+
465
+ .prompt-cancel-btn {
466
+ padding: 6px 12px;
467
+ background-color: #e5e7eb;
468
+ color: #000;
469
+ border-radius: 4px;
470
+ border: none;
471
+ cursor: pointer;
472
+ }
473
+
474
+ .ai-error-message {
475
+ color: red;
476
+ font-size: 13px;
477
+ margin-top: 0.5rem;
478
+ }
479
+
480
+ .ai-modal-backdrop {
481
+ position: fixed;
482
+ inset: 0;
483
+ z-index: 9999;
484
+ display: flex;
485
+ align-items: center;
486
+ justify-content: center;
487
+ background-color: rgba(0, 0, 0, 0.4);
488
+ -webkit-backdrop-filter: blur(4px);
489
+ backdrop-filter: blur(4px);
490
+ }
491
+
492
+ .ai-modal-content {
493
+ background-color: #ffffff;
494
+ border-radius: 16px;
495
+ box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
496
+ padding: 1.5rem;
497
+ width: 90%;
498
+ max-width: 28rem;
499
+ }
500
+
501
+ .ai-modal-title {
502
+ font-size: 1.125rem;
503
+ font-weight: 600;
504
+ margin-bottom: 0.5rem;
505
+ }
506
+
507
+ .ai-modal-textarea {
508
+ width: 100%;
509
+ border: 1px solid #ccc;
510
+ border-radius: 0.5rem;
511
+ padding: 0.5rem;
512
+ font-size: 0.875rem;
513
+ min-height: 100px;
514
+ resize: none;
515
+ }
516
+
517
+ .ai-modal-error {
518
+ font-size: 0.875rem;
519
+ color: red;
520
+ margin-top: 0.5rem;
521
+ }
522
+
523
+ .ai-modal-actions {
524
+ display: flex;
525
+ justify-content: flex-end;
526
+ gap: 0.5rem;
527
+ margin-top: 1rem;
528
+ }
529
+
530
+ .ai-cancel-btn {
531
+ font-size: 0.875rem;
532
+ padding: 0.5rem 1rem;
533
+ background-color: #e5e7eb;
534
+ color: #000;
535
+ border: none;
536
+ border-radius: 0.375rem;
537
+ cursor: pointer;
538
+ transition: background-color 0.2s ease;
539
+ }
540
+
541
+ .ai-cancel-btn:hover {
542
+ background-color: #d1d5db;
543
+ }
544
+
545
+ .ai-submit-btn {
546
+ font-size: 0.875rem;
547
+ padding: 0.5rem 1rem;
548
+ background-color: #2563eb;
549
+ color: white;
550
+ border: none;
551
+ border-radius: 0.375rem;
552
+ cursor: pointer;
553
+ transition: background-color 0.2s ease;
554
+ }
555
+
556
+ .ai-submit-btn:hover {
557
+ background-color: #1d4ed8;
558
+ }
559
+
560
+ .ai-submit-btn:disabled {
561
+ opacity: 0.5;
562
+ cursor: not-allowed;
563
+ }
@@ -369,3 +369,195 @@
369
369
  padding: 0.5rem;
370
370
  text-align: left;
371
371
  }
372
+
373
+ .icon-btn {
374
+ padding: 0.5rem;
375
+ background: transparent;
376
+ border: none;
377
+ cursor: pointer;
378
+ }
379
+
380
+ .stop-btn {
381
+ background-color: #dc2626;
382
+ color: white;
383
+ margin-right: 20px;
384
+ }
385
+
386
+ .stop-btn:hover {
387
+ background-color: #b91c1c;
388
+ }
389
+
390
+ .voice-modal {
391
+ position: fixed;
392
+ inset: 0;
393
+ background: rgba(0, 0, 0, 0.5);
394
+ z-index: 9999;
395
+ display: flex;
396
+ align-items: center;
397
+ justify-content: center;
398
+ }
399
+
400
+ .voice-modal-content {
401
+ background: white;
402
+ padding: 2rem;
403
+ border-radius: 12px;
404
+ text-align: center;
405
+ box-shadow: 0 0 20px rgba(0, 0, 0, 0.2);
406
+ }
407
+
408
+ .ai-button {
409
+ padding: 8px 16px;
410
+ background: linear-gradient(to right, #7f00ff, #4f46e5);
411
+ color: white;
412
+ font-weight: bold;
413
+ border: none;
414
+ border-radius: 6px;
415
+ box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
416
+ cursor: pointer;
417
+ transition: background 0.3s ease, transform 0.2s ease;
418
+ }
419
+
420
+ .ai-button:hover {
421
+ background: linear-gradient(to right, #6b00d6, #4338ca);
422
+ transform: translateY(-1px);
423
+ }
424
+
425
+ .ai-button:active {
426
+ transform: scale(0.97);
427
+ }
428
+
429
+ .prompt-container {
430
+ margin-top: 0.5rem;
431
+ display: flex;
432
+ flex-direction: column;
433
+ gap: 0.5rem;
434
+ }
435
+
436
+ .prompt-textarea {
437
+ width: 100%;
438
+ padding: 8px;
439
+ font-size: 14px;
440
+ border-radius: 4px;
441
+ border: 1px solid #ccc;
442
+ resize: vertical;
443
+ }
444
+
445
+ .prompt-actions {
446
+ display: flex;
447
+ gap: 0.5rem;
448
+ }
449
+
450
+ .prompt-submit-btn {
451
+ padding: 6px 12px;
452
+ background-color: #4f46e5;
453
+ color: #fff;
454
+ border-radius: 4px;
455
+ border: none;
456
+ cursor: pointer;
457
+ transition: background-color 0.2s ease;
458
+ }
459
+
460
+ .prompt-submit-btn:disabled {
461
+ cursor: not-allowed;
462
+ opacity: 0.6;
463
+ }
464
+
465
+ .prompt-cancel-btn {
466
+ padding: 6px 12px;
467
+ background-color: #e5e7eb;
468
+ color: #000;
469
+ border-radius: 4px;
470
+ border: none;
471
+ cursor: pointer;
472
+ }
473
+
474
+ .ai-error-message {
475
+ color: red;
476
+ font-size: 13px;
477
+ margin-top: 0.5rem;
478
+ }
479
+
480
+ .ai-modal-backdrop {
481
+ position: fixed;
482
+ inset: 0;
483
+ z-index: 9999;
484
+ display: flex;
485
+ align-items: center;
486
+ justify-content: center;
487
+ background-color: rgba(0, 0, 0, 0.4);
488
+ -webkit-backdrop-filter: blur(4px);
489
+ backdrop-filter: blur(4px);
490
+ }
491
+
492
+ .ai-modal-content {
493
+ background-color: #ffffff;
494
+ border-radius: 16px;
495
+ box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
496
+ padding: 1.5rem;
497
+ width: 90%;
498
+ max-width: 28rem;
499
+ }
500
+
501
+ .ai-modal-title {
502
+ font-size: 1.125rem;
503
+ font-weight: 600;
504
+ margin-bottom: 0.5rem;
505
+ }
506
+
507
+ .ai-modal-textarea {
508
+ width: 100%;
509
+ border: 1px solid #ccc;
510
+ border-radius: 0.5rem;
511
+ padding: 0.5rem;
512
+ font-size: 0.875rem;
513
+ min-height: 100px;
514
+ resize: none;
515
+ }
516
+
517
+ .ai-modal-error {
518
+ font-size: 0.875rem;
519
+ color: red;
520
+ margin-top: 0.5rem;
521
+ }
522
+
523
+ .ai-modal-actions {
524
+ display: flex;
525
+ justify-content: flex-end;
526
+ gap: 0.5rem;
527
+ margin-top: 1rem;
528
+ }
529
+
530
+ .ai-cancel-btn {
531
+ font-size: 0.875rem;
532
+ padding: 0.5rem 1rem;
533
+ background-color: #e5e7eb;
534
+ color: #000;
535
+ border: none;
536
+ border-radius: 0.375rem;
537
+ cursor: pointer;
538
+ transition: background-color 0.2s ease;
539
+ }
540
+
541
+ .ai-cancel-btn:hover {
542
+ background-color: #d1d5db;
543
+ }
544
+
545
+ .ai-submit-btn {
546
+ font-size: 0.875rem;
547
+ padding: 0.5rem 1rem;
548
+ background-color: #2563eb;
549
+ color: white;
550
+ border: none;
551
+ border-radius: 0.375rem;
552
+ cursor: pointer;
553
+ transition: background-color 0.2s ease;
554
+ }
555
+
556
+ .ai-submit-btn:hover {
557
+ background-color: #1d4ed8;
558
+ }
559
+
560
+ .ai-submit-btn:disabled {
561
+ opacity: 0.5;
562
+ cursor: not-allowed;
563
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tetrons",
3
- "version": "2.3.24",
3
+ "version": "2.3.26",
4
4
  "description": "A Next.js project written in TypeScript",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -11,48 +11,57 @@
11
11
  "lint": "next lint"
12
12
  },
13
13
  "dependencies": {
14
- "@emoji-mart/react": "^1.1.1",
15
- "@tiptap/extension-code-block-lowlight": "^2.14.0",
16
- "@tiptap/extension-color": "^2.14.0",
17
- "@tiptap/extension-highlight": "^2.14.0",
18
- "@tiptap/extension-image": "^2.14.0",
19
- "@tiptap/extension-link": "^2.14.0",
20
- "@tiptap/extension-table": "^2.14.0",
21
- "@tiptap/extension-table-cell": "^2.14.0",
22
- "@tiptap/extension-table-header": "^2.14.0",
23
- "@tiptap/extension-table-row": "^2.14.0",
24
- "@tiptap/extension-text-align": "^2.14.0",
25
- "@tiptap/extension-underline": "^2.14.0",
26
- "@tiptap/react": "^2.12.0",
27
- "@tiptap/starter-kit": "^2.12.0",
28
- "docx": "^9.5.0",
29
- "dom-to-pdf": "^0.3.2",
30
- "html2pdf.js": "^0.10.3",
31
- "lowlight": "^3.3.0",
32
- "mongoose": "^8.16.0",
33
- "react-icons": "^5.5.0",
34
- "typo-js": "^1.2.5"
14
+ "@emoji-mart/react": "1.1.1",
15
+ "@tiptap/core": "2.24.1",
16
+ "@tiptap/extension-code-block-lowlight": "2.24.1",
17
+ "@tiptap/extension-color": "2.24.1",
18
+ "@tiptap/extension-highlight": "2.24.1",
19
+ "@tiptap/extension-image": "2.24.1",
20
+ "@tiptap/extension-link": "2.24.1",
21
+ "@tiptap/extension-table": "2.24.1",
22
+ "@tiptap/extension-table-cell": "2.24.1",
23
+ "@tiptap/extension-table-header": "2.24.1",
24
+ "@tiptap/extension-table-row": "2.24.1",
25
+ "@tiptap/extension-text-align": "2.24.1",
26
+ "@tiptap/extension-text-style": "2.24.1",
27
+ "@tiptap/extension-underline": "2.24.1",
28
+ "@tiptap/react": "2.24.1",
29
+ "@tiptap/starter-kit": "2.24.1",
30
+ "@uiball/loaders": "1.3.1",
31
+ "docx": "9.5.0",
32
+ "dom-to-pdf": "0.3.2",
33
+ "dotenv": "17.0.1",
34
+ "formidable": "3.5.4",
35
+ "framer-motion": "12.23.0",
36
+ "html2pdf.js": "0.10.3",
37
+ "lowlight": "3.3.0",
38
+ "mime": "4.0.7",
39
+ "mongoose": "8.16.0",
40
+ "openai": "^4.40.0",
41
+ "react-icons": "5.5.0",
42
+ "typo-js": "1.2.5"
35
43
  },
36
44
  "peerDependencies": {
37
- "next": "^15.3.2",
38
- "react": ">=18.3.1 <20",
39
- "react-dom": ">=18.3.1 <20"
45
+ "next": "15.3.2",
46
+ "react": "18.3.1",
47
+ "react-dom": "18.3.1"
40
48
  },
41
49
  "devDependencies": {
42
- "@eslint/eslintrc": "^3",
43
- "@types/node": "^20",
44
- "@types/react": "^19",
45
- "@types/react-dom": "^19",
46
- "autoprefixer": "^10.4.21",
47
- "copyfiles": "^2.4.1",
48
- "eslint": "^9",
49
- "eslint-config-next": "^15.3.2",
50
- "tsup": "^8.5.0",
51
- "typescript": "^5"
50
+ "@eslint/eslintrc": "3.0.0",
51
+ "@types/formidable": "3.4.5",
52
+ "@types/node": "20.9.0",
53
+ "@types/react": "^18.2.21",
54
+ "@types/react-dom": "^18.2.7",
55
+ "autoprefixer": "10.4.21",
56
+ "copyfiles": "2.4.1",
57
+ "eslint": "9.0.0",
58
+ "eslint-config-next": "15.3.2",
59
+ "tsup": "8.5.0",
60
+ "typescript": "5.4.5"
52
61
  },
53
62
  "repository": {
54
63
  "type": "git",
55
- "url": "git+https://github.com/your-repo/tetrons.git"
64
+ "url": "git+https://github.com/Finapsys/Tetrons.git"
56
65
  },
57
66
  "keywords": [
58
67
  "nextjs",
@@ -65,8 +74,7 @@
65
74
  "exports": {
66
75
  ".": {
67
76
  "import": "./dist/index.js",
68
- "require": "./dist/index.js",
69
- "types": "./dist/index.d.ts"
77
+ "require": "./dist/index.js"
70
78
  },
71
79
  "./style.css": "./dist/styles/tetrons.css"
72
80
  },
@@ -76,7 +84,7 @@
76
84
  "dist/components"
77
85
  ],
78
86
  "bugs": {
79
- "url": "https://github.com/your-repo/tetrons/issues"
87
+ "url": "https://github.com/Finapsys/Tetrons/issues"
80
88
  },
81
- "homepage": "https://github.com/your-repo/tetrons#readme"
89
+ "homepage": "https://github.com/Finapsys/Tetrons#readme"
82
90
  }
package/dist/app/page.jsx DELETED
@@ -1,51 +0,0 @@
1
- "use client";
2
- import { useEffect, useState } from "react";
3
- import EditorContent from "../components/tetrons/EditorContent";
4
- import "../styles/tetrons.css";
5
- export default function Home() {
6
- const [apiKey, setApiKey] = useState(null);
7
- const [loading, setLoading] = useState(true);
8
- useEffect(() => {
9
- const fetchOrGenerateApiKey = async () => {
10
- let key = localStorage.getItem("tetrons-key");
11
- if (!key) {
12
- try {
13
- const res = await fetch("/api/register", {
14
- method: "POST",
15
- headers: { "Content-Type": "application/json" },
16
- body: JSON.stringify({
17
- email: "developer@finapsys.co.in",
18
- organization: "FCSPL",
19
- version: "platinum",
20
- }),
21
- });
22
- const data = await res.json();
23
- if (!res.ok || !data.apiKey) {
24
- throw new Error(data.error || "Failed to register for API key");
25
- }
26
- key = data.apiKey;
27
- if (key) {
28
- localStorage.setItem("tetrons-key", key);
29
- }
30
- }
31
- catch (err) {
32
- console.error("❌ Failed to fetch or register API key:", err);
33
- }
34
- }
35
- setApiKey(key);
36
- setLoading(false);
37
- };
38
- fetchOrGenerateApiKey();
39
- }, []);
40
- if (loading) {
41
- return <div className="text-center p-4">⏳ Loading Editor...</div>;
42
- }
43
- if (!apiKey) {
44
- return <div className="text-red-600 text-center">❌ API key not found</div>;
45
- }
46
- return (<main className="flex flex-col h-screen overflow-hidden">
47
- <div className="flex-1 overflow-auto flex flex-col">
48
- <EditorContent apiKey={apiKey}/>
49
- </div>
50
- </main>);
51
- }
@@ -1,7 +0,0 @@
1
- import React from "react";
2
- import { Editor } from "@tiptap/react";
3
- interface MiscGroupProps {
4
- editor: Editor;
5
- }
6
- export default function MiscGroup({ editor }: MiscGroupProps): React.JSX.Element;
7
- export {};
@@ -1,55 +0,0 @@
1
- import React from "react";
2
- import { MdUndo, MdRedo, MdRefresh, MdVisibility, MdCode, MdSpellcheck, } from "react-icons/md";
3
- import ToolbarButton from "./ToolbarButton";
4
- import { checkGrammar } from "../../../utils/checkGrammar";
5
- export default function MiscGroup({ editor }) {
6
- const handlePreview = () => {
7
- const html = editor.getHTML();
8
- const previewWindow = window.open("", "_blank");
9
- if (previewWindow) {
10
- previewWindow.document.open();
11
- previewWindow.document.write(`
12
- <html>
13
- <head>
14
- <title>Preview</title>
15
- <style>
16
- body { font-family: sans-serif; padding: 2rem; line-height: 1.6; }
17
- </style>
18
- </head>
19
- <body>${html}</body>
20
- </html>
21
- `);
22
- previewWindow.document.close();
23
- }
24
- };
25
- const handleGrammarCheck = async () => {
26
- const text = editor.getText();
27
- try {
28
- const issues = await checkGrammar(text);
29
- if (issues.length === 0) {
30
- alert("✅ No grammar issues found.");
31
- return;
32
- }
33
- let message = "🔎 Grammar Suggestions:\n\n";
34
- issues.forEach((issue, idx) => {
35
- const replacements = issue.replacements
36
- .map((r) => r.value)
37
- .join(", ");
38
- message += `${idx + 1}. "${issue.context.text}"\n→ ${replacements}\nReason: ${issue.message}\n\n`;
39
- });
40
- alert(message);
41
- }
42
- catch (err) {
43
- console.error(err);
44
- alert("❌ Failed to check grammar. Please try again later.");
45
- }
46
- };
47
- return (<div className="misc-group">
48
- <ToolbarButton icon={MdUndo} label="Undo" onClick={() => editor.chain().focus().undo().run()} disabled={!editor.can().undo()}/>
49
- <ToolbarButton icon={MdRedo} label="Redo" onClick={() => editor.chain().focus().redo().run()} disabled={!editor.can().redo()}/>
50
- <ToolbarButton icon={MdRefresh} label="Reset Formatting" onClick={() => editor.chain().focus().unsetAllMarks().clearNodes().run()}/>
51
- <ToolbarButton icon={MdCode} label="Toggle Code Block" onClick={() => editor.chain().focus().toggleCodeBlock().run()} isActive={editor.isActive("codeBlock")}/>
52
- <ToolbarButton icon={MdVisibility} label="Preview" onClick={handlePreview}/>
53
- <ToolbarButton icon={MdSpellcheck} label="Check Grammar" onClick={handleGrammarCheck}/>
54
- </div>);
55
- }
@@ -1,6 +0,0 @@
1
- import React from "react";
2
- import type { Editor } from "@tiptap/react";
3
- export default function TetronsToolbar({ editor, version, }: {
4
- editor: Editor;
5
- version: "free" | "pro" | "premium" | "platinum";
6
- }): React.JSX.Element;
@@ -1,25 +0,0 @@
1
- export interface GrammarMatch {
2
- message: string;
3
- shortMessage: string;
4
- offset: number;
5
- length: number;
6
- replacements: {
7
- value: string;
8
- }[];
9
- context: {
10
- text: string;
11
- offset: number;
12
- length: number;
13
- };
14
- sentence: string;
15
- rule: {
16
- id: string;
17
- description: string;
18
- issueType: string;
19
- category: {
20
- id: string;
21
- name: string;
22
- };
23
- };
24
- }
25
- export declare function checkGrammar(text: string): Promise<GrammarMatch[]>;
@@ -1,17 +0,0 @@
1
- export async function checkGrammar(text) {
2
- const response = await fetch("https://api.languagetool.org/v2/check", {
3
- method: "POST",
4
- headers: {
5
- "Content-Type": "application/x-www-form-urlencoded",
6
- },
7
- body: new URLSearchParams({
8
- text,
9
- language: "en-US",
10
- }),
11
- });
12
- if (!response.ok) {
13
- throw new Error("Grammar check failed");
14
- }
15
- const result = await response.json();
16
- return result.matches;
17
- }