@lyfie/luthor 0.0.4 → 1.1.0

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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Rahul Anand
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,176 @@
1
+ # Luthor
2
+
3
+ **Type-safe rich text editor for React developers**
4
+
5
+ Built on Meta's Lexical. Headless, extensible, and production-ready.
6
+
7
+ [![npm version](https://badge.fury.io/js/%40luthor%2Feditor.svg)](https://badge.fury.io/js/%40luthor%2Feditor)
8
+ [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT)
9
+
10
+ **[🚀 Demo](https://luthor.lyfie.app/demo)** • **[📖 Documentation](https://luthor.lyfie.app/docs)** • **[⚡ Playground](https://stackblitz.com/edit/vitejs-vite-bpg2kpze?file=src%2FEditor.tsx)**
11
+
12
+ ![Luthor Editor](https://github.com/user-attachments/assets/ec547406-0ab0-4e69-b9d7-ccd050adf78a)
13
+
14
+ ---
15
+
16
+ ## Why Luthor?
17
+
18
+ Rich text editors shouldn't be a nightmare. Luthor makes building them delightful:
19
+
20
+ - **🔒 Type-safe everything** - Commands and states inferred from your extensions. No runtime surprises.
21
+ - **🎨 Headless & flexible** - Build any UI you want. Style it your way.
22
+ - **🧩 Modular extensions** - Add only what you need, when you need it.
23
+ - **⚡ Production features** - HTML/Markdown export, image handling, tables, undo/redo.
24
+ - **⚛️ React-first** - Hooks, components, and patterns you already know.
25
+
26
+ ```tsx
27
+ // Your extensions define your API - TypeScript knows everything ✨
28
+ const extensions = [boldExtension, listExtension, imageExtension] as const;
29
+ const { Provider, useEditor } = createEditorSystem<typeof extensions>();
30
+
31
+ function MyEditor() {
32
+ const { commands, activeStates } = useEditor();
33
+
34
+ // TypeScript autocompletes and validates these
35
+ commands.toggleBold(); // ✅ Available
36
+ commands.toggleUnorderedList(); // ✅ Available
37
+ commands.insertImage(); // ✅ Available
38
+ commands.nonExistent(); // ❌ TypeScript error
39
+ }
40
+ ```
41
+
42
+ ## Quick Start
43
+
44
+ ```bash
45
+ npm install @lyfie/luthor
46
+ ```
47
+
48
+ Install the Lexical peer dependencies:
49
+
50
+ ```bash
51
+ npm install lexical @lexical/react @lexical/html @lexical/markdown @lexical/list @lexical/rich-text @lexical/selection @lexical/utils
52
+ ```
53
+
54
+ ```tsx
55
+ import {
56
+ createEditorSystem,
57
+ boldExtension,
58
+ italicExtension,
59
+ listExtension,
60
+ RichText,
61
+ } from "@lyfie/luthor";
62
+
63
+ const extensions = [boldExtension, italicExtension, listExtension] as const;
64
+ const { Provider, useEditor } = createEditorSystem<typeof extensions>();
65
+
66
+ function Toolbar() {
67
+ const { commands, activeStates } = useEditor();
68
+ return (
69
+ <div className="toolbar">
70
+ <button
71
+ onClick={() => commands.toggleBold()}
72
+ className={activeStates.bold ? "active" : ""}
73
+ >
74
+ Bold
75
+ </button>
76
+ <button
77
+ onClick={() => commands.toggleItalic()}
78
+ className={activeStates.italic ? "active" : ""}
79
+ >
80
+ Italic
81
+ </button>
82
+ <button onClick={() => commands.toggleUnorderedList()}>
83
+ Bullet List
84
+ </button>
85
+ </div>
86
+ );
87
+ }
88
+
89
+ function Editor() {
90
+ return (
91
+ <div className="editor-container">
92
+ <Toolbar />
93
+ <RichText placeholder="Start writing..." />
94
+ </div>
95
+ );
96
+ }
97
+
98
+ export default function App() {
99
+ return (
100
+ <Provider extensions={extensions}>
101
+ <Editor />
102
+ </Provider>
103
+ );
104
+ }
105
+ ```
106
+
107
+ **That's it.** You now have a fully functional, type-safe rich text editor.
108
+
109
+ ## Features
110
+
111
+ ### 🎨 Built-in Extensions (25+)
112
+ - **Text Formatting**: Bold, italic, underline, strikethrough, inline code
113
+ - **Structure**: Headings, lists (with nesting), quotes, horizontal rules
114
+ - **Rich Content**: Tables, images (upload/paste/alignment), links, code blocks
115
+ - **Advanced**: History (undo/redo), command palette, floating toolbar, context menus
116
+
117
+ ### 🎯 Smart List Handling
118
+ - Toggle lists with intelligent nesting behavior
119
+ - Context-aware toolbar (indent/outdent appear when needed)
120
+ - Nested lists without keyboard shortcuts
121
+ - Clean UX that matches modern editors
122
+
123
+ ### 📤 Export & Import
124
+ - **HTML** with semantic markup
125
+ - **Markdown** with GitHub Flavored syntax
126
+ - **JSON** for structured data
127
+ - Custom transformers for specialized formats
128
+
129
+ ### 🎨 Theming & Styling
130
+ - CSS classes or Tailwind utilities
131
+ - Custom themes for consistent styling
132
+ - Dark mode support
133
+ - Accessible by default
134
+
135
+ ## Real World Usage
136
+
137
+ Luthor powers editors in:
138
+ - Content management systems
139
+ - Documentation platforms
140
+ - Blog editors
141
+ - Note-taking applications
142
+ - Comment systems
143
+ - Collaborative writing tools
144
+
145
+ ## Community & Support
146
+
147
+ - **[💬 Discord](https://discord.gg/RAMYSDRag7)** - Get help, share ideas
148
+ - **[🐛 GitHub Issues](https://github.com/lyfie-app/luthor/issues)** - Bug reports, feature requests
149
+ - **[💭 Discussions](https://github.com/lyfie-app/luthor/discussions)** - Questions, showcase your projects
150
+
151
+ ## Contributing
152
+
153
+ We welcome contributions! Whether you:
154
+ - Find and report bugs
155
+ - Suggest new features
156
+ - Contribute code or documentation
157
+ - Share projects built with Luthor
158
+ - Star the repo to show support
159
+
160
+ Check our [Contributing Guide](./CONTRIBUTING.md) to get started.
161
+
162
+ ## Support This Project
163
+
164
+ Luthor is free and open source, built by developers for developers. If it's helping you build better editors, consider supporting its development:
165
+
166
+ - **⭐ Star this repository** to show your support
167
+ - **💝 [Sponsor the project](https://github.com/sponsors/rahulnsanand)** to help with maintenance and new features
168
+ - **📢 Share Luthor** with other developers
169
+
170
+ Your support keeps this project alive and helps us build better tools for the React community.
171
+
172
+ ---
173
+
174
+ **Built with ❤️ by [Rahul NS Anand](https://github.com/rahulnsanand)**
175
+
176
+ MIT License - Use it however you want.</content>