nextext-editor 0.1.1 β†’ 0.1.2

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 CHANGED
@@ -1,387 +1,329 @@
1
- # HyperText Editor
1
+ # NextText Editor
2
2
 
3
- > The rich text editor built for the AI era. Handle unlimited AI-generated content at 60 FPS.
3
+ > A modern, customizable rich text editor for React with shadcn/ui patterns, Tailwind CSS styling, and collaborative editing powered by Loro CRDT.
4
4
 
5
- [![Performance](https://img.shields.io/badge/FPS-60-success)](https://github.com)
6
- [![Memory](https://img.shields.io/badge/Memory-12x%20less-blue)](https://github.com)
7
- [![License](https://img.shields.io/badge/license-MIT-green)](https://github.com)
5
+ [![npm version](https://img.shields.io/npm/v/nextext-editor)](https://www.npmjs.com/package/nextext-editor)
8
6
 
9
- ## Why HyperText?
7
+ ## Preview
10
8
 
11
- **Traditional editors** (TipTap, ProseMirror, Quill) **choke** when handling AI-generated content:
12
-
13
- - 🐌 Laggy scrolling with 2,000+ paragraphs
14
- - πŸ’Ύ Memory bloat (500MB+ for large docs)
15
- - πŸ“± Crashes on mobile devices
16
- - ⚠️ Poor UX for AI writing assistants
17
-
18
- **HyperText** uses **virtual scrolling** to render only what's visible:
19
-
20
- ```
21
- TipTap (10K blocks): HyperText (10K blocks):
22
- β”œβ”€ Renders: 10,000 nodes β”œβ”€ Renders: ~40 nodes
23
- β”œβ”€ Memory: 580MB β”œβ”€ Memory: 48MB (12x less!)
24
- └─ Scroll: 22 FPS (janky) └─ Scroll: 60 FPS (smooth!)
25
- ```
26
-
27
- ## Perfect For AI Applications
28
-
29
- ### βœ… AI Writing Assistants
30
- ```typescript
31
- // Stream ChatGPT responses without lag
32
- const { content, updateContent } = useLoroEditor()
33
-
34
- const streamAI = async () => {
35
- const response = await fetch('/api/ai/generate')
36
- const stream = response.body.getReader()
37
-
38
- while (true) {
39
- const { done, value } = await stream.read()
40
- if (done) break
41
-
42
- updateContent(content + decode(value))
43
- // βœ… Smooth even when AI generates 10,000+ words
44
- }
45
- }
46
- ```
47
-
48
- ### βœ… Document Generation Platforms
49
- Generate 20-page contracts, proposals, reportsβ€”all at 60 FPS.
50
-
51
- ### βœ… Real-Time AI Suggestions
52
- Analyze entire documents and display 100+ AI suggestions without lag.
53
-
54
- ### βœ… Collaborative AI Editing
55
- Built-in Loro CRDT for real-time collaboration (zero config).
9
+ ![NextText Editor Screenshot](./assets/editor-screenshot.png)
56
10
 
57
11
  ## Features
58
12
 
59
- - ⚑ **Virtual Scrolling** - Unlimited document size, constant 60 FPS
60
- - πŸ€– **AI-First** - Smooth streaming, real-time updates, no lag
61
- - πŸ”„ **Built-in Collaboration** - Loro CRDT (vs TipTap's 50+ line Y.js setup)
62
- - πŸ’Ύ **Memory Efficient** - 12x less memory than TipTap
63
- - πŸ“± **Mobile Optimized** - Low memory, high performance
64
- - 🎨 **Rich Formatting** - Bold, italic, headings, lists, colors, code blocks
65
- - ⌨️ **Google Docs UI** - Familiar toolbar, keyboard shortcuts
66
- - πŸ” **Live Preview** - HTML, Text, JSON modes
67
-
68
- ## Quick Start
69
-
70
- ### Installation
71
-
72
- ```bash
73
- npm install
74
- ```
13
+ - 🎨 **Rich Formatting** - Bold, italic, underline, strikethrough, inline code, text color, and highlighting
14
+ - πŸ“ **Block Types** - Headings (H1-H6), paragraphs, bullet lists, numbered lists, blockquotes, code blocks, horizontal rules
15
+ - πŸ–ΌοΈ **Media Support** - Image upload with drag-and-drop (max 5MB, auto-styled)
16
+ - πŸ“Š **Tables** - Insert and edit tables with styled cells
17
+ - πŸ”„ **Built-in Collaboration** - Loro CRDT for conflict-free real-time editing
18
+ - 🎨 **Customizable Design** - shadcn/ui-inspired design tokens for easy theming
19
+ - πŸ“± **Responsive** - Works seamlessly on desktop and mobile
20
+ - ⌨️ **Keyboard Shortcuts** - Familiar shortcuts (Ctrl/Cmd+B, I, U, Z, Y)
21
+ - πŸ” **Live Preview** - View your content in HTML, Text, or JSON format
22
+ - πŸ“Š **Word & Character Count** - Real-time statistics display
23
+ - 🎯 **TypeScript** - Fully typed for better DX
75
24
 
76
- ### Development
25
+ ## Installation
77
26
 
78
27
  ```bash
79
- npm run dev
28
+ npm install nextext-editor
29
+ # or
30
+ yarn add nextext-editor
31
+ # or
32
+ pnpm add nextext-editor
80
33
  ```
81
34
 
82
- Open `http://localhost:5173` in your browser.
35
+ ## Quick Start
83
36
 
84
- ### AI Integration Example
37
+ ### Basic Usage
85
38
 
86
- ```typescript
87
- import { useLoroEditor } from './hooks/useLoroEditor'
88
- import { VirtualizedEditor } from './components/VirtualizedEditor'
39
+ ```tsx
40
+ import { EditorBlock } from 'nextext-editor';
41
+ import 'nextext-editor/styles.css';
89
42
 
90
- function AIWritingApp() {
91
- const { content, updateContent } = useLoroEditor()
43
+ function App() {
44
+ return <EditorBlock placeholder="Start writing..." />;
45
+ }
46
+ ```
92
47
 
93
- const generateWithAI = async (prompt: string) => {
94
- const response = await openai.chat.completions.create({
95
- messages: [{ role: 'user', content: prompt }],
96
- stream: true,
97
- })
48
+ ### With Preview Panel
98
49
 
99
- let aiContent = ''
100
- for await (const chunk of response) {
101
- aiContent += chunk.choices[0]?.delta?.content || ''
102
- updateContent(content + aiContent)
103
- }
104
- }
50
+ ```tsx
51
+ import { EditorBlock } from 'nextext-editor';
52
+ import 'nextext-editor/styles.css';
105
53
 
54
+ function App() {
106
55
  return (
107
- <div>
108
- <VirtualizedEditor />
109
- <button onClick={() => generateWithAI('Write a blog post')}>
110
- Generate with AI
111
- </button>
112
- </div>
113
- )
56
+ <EditorBlock
57
+ showPreview
58
+ placeholder="Start writing..."
59
+ />
60
+ );
114
61
  }
115
62
  ```
116
63
 
117
- ## Performance Test
118
-
119
- Run the built-in performance lab to see the difference:
64
+ ### Controlled Mode with External State
120
65
 
121
- 1. Click "Performance Test" in the header
122
- 2. Generate 10,000 blocks **without** virtualization
123
- - Watch FPS drop to ~20-30
124
- - Memory spikes to 500MB+
125
- 3. Enable virtualization
126
- - FPS jumps to 60
127
- - Memory drops to ~50MB
128
- 4. Use auto-scroll to stress test
66
+ ```tsx
67
+ import { useState } from 'react';
68
+ import { EditorBlock } from 'nextext-editor';
69
+ import 'nextext-editor/styles.css';
129
70
 
130
- **See the difference yourself!**
71
+ function App() {
72
+ const [content, setContent] = useState('<p>Initial content</p>');
131
73
 
132
- ## Comparison with TipTap
74
+ return (
75
+ <EditorBlock
76
+ externalContent={content}
77
+ onContentChange={setContent}
78
+ showPreview
79
+ />
80
+ );
81
+ }
82
+ ```
133
83
 
134
- | Feature | TipTap | HyperText |
135
- |---------|--------|-----------|
136
- | **Max document size** | ~2,000 ΒΆ | Unlimited |
137
- | **FPS (10K blocks)** | 22 FPS | 60 FPS |
138
- | **Memory (10K blocks)** | 580MB | 48MB |
139
- | **AI streaming** | Laggy | Smooth |
140
- | **Collaboration setup** | 50+ lines | 3 lines |
141
- | **Mobile performance** | Poor | Excellent |
142
- | **Extension ecosystem** | 100+ | Growing |
84
+ ### Using Loro CRDT for Collaboration
143
85
 
144
- **See detailed comparison**: [VS_TIPTAP_PROSEMIRROR.md](./VS_TIPTAP_PROSEMIRROR.md)
86
+ ```tsx
87
+ import { useLoroEditor, EditorBlock } from 'nextext-editor';
88
+ import 'nextext-editor/styles.css';
145
89
 
146
- ## AI Use Cases
90
+ function CollaborativeEditor() {
91
+ const { content, updateContent, loroDoc } = useLoroEditor();
147
92
 
148
- ### 1. AI Writing Assistant (like Jasper.ai)
149
- Stream AI content without performance issues.
93
+ // Share loroDoc with other clients for real-time sync
150
94
 
151
- ### 2. Document Generator (Contracts, Proposals)
152
- Generate 20-page documents instantly without lag.
95
+ return (
96
+ <EditorBlock
97
+ externalContent={content}
98
+ onContentChange={updateContent}
99
+ />
100
+ );
101
+ }
102
+ ```
153
103
 
154
- ### 3. Real-Time Suggestions (like Grammarly)
155
- Analyze 10,000 words and show suggestions while maintaining 60 FPS.
104
+ ### Using Editor Directly (Headless)
156
105
 
157
- ### 4. Collaborative AI Editing
158
- Team + AI editing simultaneously with Loro CRDT handling conflicts automatically.
106
+ If you want to build your own toolbar and UI, use the low-level `Editor` component:
159
107
 
160
- **More examples**: [MARKETING.md#ai-use-cases](./MARKETING.md#ai-use-cases-the-killer-feature)
108
+ ```tsx
109
+ import { useState } from 'react';
110
+ import { Editor } from 'nextext-editor';
111
+ import 'nextext-editor/styles.css';
161
112
 
162
- ## Architecture
113
+ function CustomEditor() {
114
+ const [content, setContent] = useState('<p>Start typing...</p>');
163
115
 
164
- ```
165
- HyperText
166
- β”œβ”€β”€ RichTextEditor (Standard mode)
167
- β”‚ β”œβ”€β”€ Toolbar (Google Docs style)
168
- β”‚ β”œβ”€β”€ ContentEditable area
169
- β”‚ └── Preview (HTML/Text/JSON)
170
- β”‚
171
- β”œβ”€β”€ VirtualizedEditor (Performance mode)
172
- β”‚ β”œβ”€β”€ TanStack Virtual (render only visible)
173
- β”‚ β”œβ”€β”€ Block parser (split into chunks)
174
- β”‚ └── Dynamic measurements
175
- β”‚
176
- β”œβ”€β”€ PerformanceTest (Benchmarking lab)
177
- β”‚ β”œβ”€β”€ Generate up to 20K blocks
178
- β”‚ β”œβ”€β”€ Real-time FPS measurement
179
- β”‚ β”œβ”€β”€ Memory monitoring
180
- β”‚ └── Auto-scroll testing
181
- β”‚
182
- └── Loro CRDT (Collaboration)
183
- β”œβ”€β”€ Conflict-free merging
184
- β”œβ”€β”€ Offline support
185
- └── Real-time sync
116
+ return (
117
+ <div>
118
+ <div className="my-custom-toolbar">
119
+ <button onClick={() => document.execCommand('bold')}>Bold</button>
120
+ <button onClick={() => document.execCommand('italic')}>Italic</button>
121
+ </div>
122
+ <Editor
123
+ content={content}
124
+ onContentChange={setContent}
125
+ placeholder="Write something..."
126
+ />
127
+ </div>
128
+ );
129
+ }
186
130
  ```
187
131
 
188
132
  ## Tech Stack
189
133
 
190
134
  - **React 18** - UI framework
191
135
  - **TypeScript** - Type safety
192
- - **Loro CRDT** - Collaboration (built-in)
193
- - **TanStack Virtual** - Virtual scrolling
194
- - **TanStack Query** - Data fetching
136
+ - **Loro CRDT** - Conflict-free collaboration
195
137
  - **Tailwind CSS v4** - Styling
196
- - **Vite 6** - Build tool
197
138
  - **Lucide React** - Icons
139
+ - **Vite** - Build tool
198
140
 
199
- ## Documentation
141
+ ## API Reference
200
142
 
201
- - [Performance Test Guide](./PERFORMANCE_TEST_GUIDE.md)
202
- - [FPS Measurement Explained](./FPS_MEASUREMENT_EXPLAINED.md)
203
- - [vs TipTap/ProseMirror](./VS_TIPTAP_PROSEMIRROR.md)
204
- - [Marketing & Positioning](./MARKETING.md)
143
+ ### Editor Props (Core ContentEditable Component)
205
144
 
206
- ## Keyboard Shortcuts
145
+ | Prop | Type | Default | Description |
146
+ |------|------|---------|-------------|
147
+ | `content` | `string` | **required** | HTML content to display |
148
+ | `onContentChange` | `(html: string) => void` | **required** | Called when content changes |
149
+ | `placeholder` | `string` | `"Start typing..."` | Placeholder text when empty |
150
+ | `className` | `string` | - | Custom class for the editable area |
151
+ | `tokens` | `EditorTokens` | `editorTokens` | Custom design tokens |
207
152
 
208
- - **Ctrl/Cmd + B**: Bold
209
- - **Ctrl/Cmd + I**: Italic
210
- - **Ctrl/Cmd + U**: Underline
211
- - **Ctrl/Cmd + Z**: Undo
212
- - **Ctrl/Cmd + Y**: Redo
153
+ ### EditorBlock Props (Complete Editor with Toolbar & Preview)
213
154
 
214
- ## Project Structure (Monorepo)
155
+ | Prop | Type | Default | Description |
156
+ |------|------|---------|-------------|
157
+ | `initialContent` | `string` | - | Initial HTML content |
158
+ | `showPreview` | `boolean` | `false` | Show live preview panel |
159
+ | `showToolbar` | `boolean` | `true` | Show formatting toolbar |
160
+ | `externalContent` | `string` | - | Controlled content (for controlled mode) |
161
+ | `onContentChange` | `(html: string) => void` | - | Content change callback |
162
+ | `className` | `string` | - | Custom container class |
163
+ | `placeholder` | `string` | `"Start typing..."` | Placeholder text |
164
+ | `tokens` | `EditorTokens` | `editorTokens` | Custom design tokens |
215
165
 
216
- ```
217
- hyper-text/
218
- β”œβ”€β”€ packages/
219
- β”‚ └── editor/ # @hyper-text/editor (NPM package)
220
- β”‚ β”œβ”€β”€ src/
221
- β”‚ β”‚ β”œβ”€β”€ components/
222
- β”‚ β”‚ β”‚ β”œβ”€β”€ Editor.tsx # Main editor (virtualized + standard)
223
- β”‚ β”‚ β”‚ β”œβ”€β”€ Toolbar.tsx # Google Docs toolbar
224
- β”‚ β”‚ β”‚ β”œβ”€β”€ HeadingSelector.tsx
225
- β”‚ β”‚ β”‚ β”œβ”€β”€ ColorPicker.tsx
226
- β”‚ β”‚ β”‚ └── Preview.tsx
227
- β”‚ β”‚ β”œβ”€β”€ hooks/
228
- β”‚ β”‚ β”‚ └── useLoroEditor.ts # Loro CRDT hook
229
- β”‚ β”‚ β”œβ”€β”€ types/
230
- β”‚ β”‚ β”‚ └── editor.ts # TypeScript types
231
- β”‚ β”‚ └── styles/
232
- β”‚ β”‚ └── editor.css # Editor styles
233
- β”‚ β”œβ”€β”€ package.json
234
- β”‚ └── vite.config.ts # Library build config
235
- β”‚
236
- β”œβ”€β”€ apps/
237
- β”‚ └── demo/ # @hyper-text/demo (Demo app)
238
- β”‚ β”œβ”€β”€ src/
239
- β”‚ β”‚ β”œβ”€β”€ components/
240
- β”‚ β”‚ β”‚ β”œβ”€β”€ PerformanceTestEditor.tsx
241
- β”‚ β”‚ β”‚ └── Sidebar.tsx
242
- β”‚ β”‚ └── App.tsx
243
- β”‚ └── package.json
244
- β”‚
245
- β”œβ”€β”€ pnpm-workspace.yaml # PNPM workspaces config
246
- β”œβ”€β”€ package.json # Root monorepo scripts
247
- β”œβ”€β”€ tsconfig.json # Root TypeScript config
248
- └── README.md
249
- ```
166
+ ### useLoroEditor Hook
250
167
 
251
- ## πŸ“Š Bundle Size
168
+ Returns an object with:
252
169
 
253
- | Package | Size (minified) | Size (gzipped) |
254
- |---------|-----------------|----------------|
255
- | `@hyper-text/editor` | ~45KB | ~15KB |
170
+ ```tsx
171
+ {
172
+ content: string; // Current HTML content
173
+ format: TextFormat; // Current text format state
174
+ updateContent: (html: string) => void; // Update content
175
+ insertText: (text: string, position?: number) => void; // Insert text
176
+ deleteText: (start: number, length: number) => void; // Delete text
177
+ applyFormat: (start: number, end: number, format: TextFormat) => void; // Apply formatting
178
+ getSnapshot: () => Uint8Array; // Export Loro snapshot
179
+ loadSnapshot: (snapshot: Uint8Array) => void; // Import Loro snapshot
180
+ loroDoc: Loro | null; // Raw Loro document instance
181
+ }
182
+ ```
256
183
 
257
- Run `pnpm analyze` to generate interactive bundle analysis.
184
+ ### Design Tokens
258
185
 
259
- ## Quick Start
186
+ Customize the editor's appearance by passing custom tokens:
260
187
 
261
- ### Prerequisites
188
+ ```tsx
189
+ import { EditorBlock, editorTokens } from 'nextext-editor';
190
+
191
+ const customTokens = {
192
+ ...editorTokens,
193
+ container: {
194
+ ...editorTokens.container,
195
+ base: 'w-full bg-slate-900 rounded-xl border border-slate-700',
196
+ },
197
+ editor: {
198
+ ...editorTokens.editor,
199
+ base: 'min-h-[500px] p-8 text-slate-100',
200
+ },
201
+ };
262
202
 
263
- - Node.js 18+
264
- - pnpm 8+
203
+ function App() {
204
+ return <EditorBlock tokens={customTokens} />;
205
+ }
206
+ ```
265
207
 
266
- ### Installation
208
+ ## Toolbar Actions
209
+
210
+ The editor supports these formatting actions:
211
+
212
+ ### Text Formatting
213
+ - `bold` - Toggle bold text
214
+ - `italic` - Toggle italic text
215
+ - `underline` - Toggle underline
216
+ - `strikethrough` - Toggle strikethrough
217
+ - `code` - Toggle inline code
218
+ - `textColor` - Change text color
219
+ - `highlight` - Change background color
220
+ - `clearMarks` - Remove all formatting
221
+
222
+ ### Block Types
223
+ - `paragraph` - Normal paragraph
224
+ - `h1`, `h2`, `h3`, `h4`, `h5`, `h6` - Headings
225
+ - `bulletList` - Unordered list
226
+ - `numberedList` - Ordered list
227
+ - `codeBlock` - Code block
228
+ - `blockquote` - Blockquote
229
+ - `clearNodes` - Reset to paragraph
230
+
231
+ ### Content
232
+ - `image` - Upload image (max 5MB)
233
+ - `table` - Insert 3x3 table
234
+ - `horizontalRule` - Insert horizontal line
235
+ - `hardBreak` - Insert line break
236
+
237
+ ### History
238
+ - `undo` - Undo last change
239
+ - `redo` - Redo last change
267
240
 
268
- ```bash
269
- # Install dependencies
270
- pnpm install
241
+ ## Keyboard Shortcuts
271
242
 
272
- # Build the editor package first
273
- pnpm build:editor
243
+ - **Ctrl/Cmd + B** - Bold
244
+ - **Ctrl/Cmd + I** - Italic
245
+ - **Ctrl/Cmd + U** - Underline
246
+ - **Ctrl/Cmd + Z** - Undo
247
+ - **Ctrl/Cmd + Y** - Redo
274
248
 
275
- # Start the demo app
276
- pnpm dev
277
- ```
249
+ ## Architecture
278
250
 
279
- ### Available Scripts
251
+ The editor follows a clean component hierarchy:
280
252
 
281
- ```bash
282
- pnpm dev # Run demo app in dev mode
283
- pnpm build # Build all packages
284
- pnpm build:editor # Build editor package only
285
- pnpm analyze # Generate bundle size treemap
286
- pnpm clean # Clean all dist folders
253
+ ```
254
+ Editor (Core - in components/)
255
+ └── Low-level contentEditable component
256
+ └── Handles HTML editing, cursor management, keyboard events
257
+
258
+ EditorBlock (Complete Editor - in block/)
259
+ β”œβ”€β”€ Uses Editor component
260
+ β”œβ”€β”€ Adds Toolbar
261
+ β”œβ”€β”€ Adds Preview panel
262
+ β”œβ”€β”€ Adds word/character count
263
+ └── Integrates with Loro CRDT via useLoroEditor hook
287
264
  ```
288
265
 
289
- ## Using @hyper-text/editor
290
-
291
- ### Installation
292
-
293
- ```bash
294
- pnpm add @hyper-text/editor
266
+ **File Structure:**
267
+ ```
268
+ src/
269
+ β”œβ”€β”€ components/
270
+ β”‚ β”œβ”€β”€ Editor.tsx ← Core contentEditable (low-level)
271
+ β”‚ β”œβ”€β”€ Toolbar.tsx
272
+ β”‚ β”œβ”€β”€ Preview.tsx
273
+ β”‚ └── ...
274
+ β”œβ”€β”€ block/
275
+ β”‚ └── EditorBlock.tsx ← Complete editor (high-level)
276
+ β”œβ”€β”€ hooks/
277
+ β”‚ └── useLoroEditor.ts
278
+ └── index.ts
295
279
  ```
296
280
 
297
- ### Basic Usage
281
+ ## Exported Components
298
282
 
299
283
  ```tsx
300
- import { Editor } from '@hyper-text/editor';
301
- import '@hyper-text/editor/styles.css';
302
-
303
- function App() {
304
- return <Editor showVirtualizationToggle showPreview />;
305
- }
284
+ import {
285
+ Editor, // Core contentEditable component (low-level)
286
+ EditorBlock, // Complete editor with toolbar & preview (high-level)
287
+ Toolbar, // Formatting toolbar component
288
+ Preview, // Preview panel component
289
+ ColorPicker, // Color picker dropdown
290
+ HeadingSelector, // Heading selector dropdown
291
+ } from 'nextext-editor';
306
292
  ```
307
293
 
308
- ### With External State
294
+ ## Exported Utilities
309
295
 
310
296
  ```tsx
311
- import { Editor, useLoroEditor } from '@hyper-text/editor';
312
- import '@hyper-text/editor/styles.css';
313
-
314
- function App() {
315
- const { content, updateContent } = useLoroEditor();
316
-
317
- return (
318
- <Editor
319
- externalContent={content}
320
- onContentChange={updateContent}
321
- enableVirtualization
322
- />
323
- );
324
- }
297
+ import {
298
+ useLoroEditor, // Loro CRDT hook
299
+ editorTokens, // Default design tokens
300
+ cn, // className utility (clsx + tailwind-merge)
301
+ } from 'nextext-editor';
325
302
  ```
326
303
 
327
- ### Editor Props
328
-
329
- | Prop | Type | Default | Description |
330
- |------|------|---------|-------------|
331
- | `enableVirtualization` | `boolean` | `false` | Enable virtualized rendering |
332
- | `showVirtualizationToggle` | `boolean` | `false` | Show virtualization toggle |
333
- | `showPreview` | `boolean` | `true` | Show HTML/Text/JSON preview |
334
- | `externalContent` | `string` | - | Controlled content |
335
- | `onContentChange` | `(html: string) => void` | - | Content change handler |
304
+ ## TypeScript Types
336
305
 
337
- ## TipTap Performance Comparison
338
-
339
- We've built a **real-time benchmark tool** comparing HyperText vs TipTap:
340
-
341
- ```bash
342
- pnpm dev
343
- # Navigate to "vs TipTap" in the sidebar
306
+ ```tsx
307
+ import type {
308
+ TextFormat, // Text formatting state
309
+ EditorState, // Editor state
310
+ ToolbarAction, // Toolbar action types
311
+ PreviewMode, // Preview mode ('html' | 'text' | 'json')
312
+ EditorTokens, // Design tokens type
313
+ EditorBlockProps, // EditorBlock props
314
+ } from 'nextext-editor';
344
315
  ```
345
316
 
346
- **Results with 10,000 blocks:**
347
- - **HyperText**: 60 FPS, 48 MB memory, 300 DOM nodes
348
- - **TipTap**: 22 FPS, 580 MB memory, 30,000 DOM nodes
349
-
350
- **HyperText is 2.7x faster and uses 12x less memory.** [See full comparison β†’](./TIPTAP_COMPARISON.md)
351
-
352
- ## Roadmap
353
-
354
- - [x] Image upload/paste (just added!)
355
- - [x] TipTap performance comparison tool
356
- - [ ] Table support
357
- - [ ] Markdown import/export
358
- - [ ] Real-time collaboration server
359
- - [ ] Browser extension
360
- - [ ] Plugins API
361
- - [ ] More AI integrations (OpenAI, Anthropic, Cohere)
362
- - [ ] Mobile app (React Native)
363
-
364
- ## Why This Matters
365
-
366
- **AI is changing how we create content.**
367
-
368
- - ChatGPT generates 2,000+ words per response
369
- - Claude can write 4,000+ word articles
370
- - AI tools generate entire documents in seconds
371
-
372
- **Traditional editors weren't built for this.**
373
-
374
- HyperText was. Built for the AI era. Built for performance. Built for scale.
375
-
376
317
  ## License
377
318
 
378
- MIT
319
+ MIT Β© [NaveenChand](https://github.com/NaveenChand755)
379
320
 
380
321
  ## Contributing
381
322
 
382
- Contributions welcome! Please open issues or submit pull requests.
323
+ Contributions are welcome! Please check out the [GitHub repository](https://github.com/NaveenChand755/hyper-text).
383
324
 
384
- ---
325
+ ## Support
385
326
 
386
- Built with ❀️ for developers building AI-powered apps.
387
- # hyper-text
327
+ - πŸ› [Report Issues](https://github.com/NaveenChand755/hyper-text/issues)
328
+ - πŸ’¬ [Discussions](https://github.com/NaveenChand755/hyper-text/discussions)
329
+ - πŸ“– [Documentation](https://github.com/NaveenChand755/hyper-text#readme)
@@ -0,0 +1,38 @@
1
+ import { default as React } from 'react';
2
+ import { editorTokens } from '../lib/tokens';
3
+ export interface EditorBlockProps {
4
+ /**
5
+ * Initial content (HTML string)
6
+ */
7
+ initialContent?: string;
8
+ /**
9
+ * Show preview panel
10
+ */
11
+ showPreview?: boolean;
12
+ /**
13
+ * Show toolbar
14
+ */
15
+ showToolbar?: boolean;
16
+ /**
17
+ * External content control (for controlled component)
18
+ */
19
+ externalContent?: string;
20
+ /**
21
+ * Content change handler (for controlled component)
22
+ */
23
+ onContentChange?: (content: string) => void;
24
+ /**
25
+ * Custom class name for container
26
+ */
27
+ className?: string;
28
+ /**
29
+ * Placeholder text
30
+ */
31
+ placeholder?: string;
32
+ /**
33
+ * Custom design tokens
34
+ */
35
+ tokens?: typeof editorTokens;
36
+ }
37
+ export declare const EditorBlock: React.NamedExoticComponent<EditorBlockProps>;
38
+ export default EditorBlock;