@editora/themes 1.0.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 Ajay Kumar
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,444 @@
1
+ # @editora/themes
2
+
3
+ Themes and styling system for Editora Rich Text Editor with built-in light/dark mode support and customizable design tokens.
4
+
5
+ ## 📦 Installation
6
+
7
+ ```bash
8
+ npm install @editora/themes
9
+ ```
10
+
11
+ ## 🎯 Overview
12
+
13
+ The themes package provides a comprehensive styling system using CSS variables, making it easy to customize the editor's appearance and support multiple themes.
14
+
15
+ ## ✨ Features
16
+
17
+ - **Light & Dark Themes**: Pre-built themes with automatic system detection
18
+ - **CSS Variables**: Fully customizable using CSS custom properties
19
+ - **Responsive**: Mobile-friendly and adaptive layouts
20
+ - **Accessible**: High contrast ratios and WCAG compliance
21
+ - **Modern Design**: Clean, professional appearance
22
+ - **Easy Customization**: Override any variable to match your brand
23
+
24
+ ## 🚀 Quick Start
25
+
26
+ ### Basic Usage
27
+
28
+ ```tsx
29
+ import '@editora/themes/styles';
30
+ import { RichTextEditor } from '@editora/react';
31
+
32
+ function App() {
33
+ return <RichTextEditor theme="light" />;
34
+ }
35
+ ```
36
+
37
+ ### With Theme Toggle
38
+
39
+ ```tsx
40
+ import '@editora/themes/styles';
41
+ import { RichTextEditor } from '@editora/react';
42
+ import { useState } from 'react';
43
+
44
+ function App() {
45
+ const [theme, setTheme] = useState<'light' | 'dark'>('light');
46
+
47
+ return (
48
+ <div data-theme={theme}>
49
+ <button onClick={() => setTheme(theme === 'light' ? 'dark' : 'light')}>
50
+ Toggle Theme
51
+ </button>
52
+
53
+ <RichTextEditor theme={theme} />
54
+ </div>
55
+ );
56
+ }
57
+ ```
58
+
59
+ ### Auto Theme Detection
60
+
61
+ ```tsx
62
+ import '@editora/themes/styles';
63
+ import { RichTextEditor } from '@editora/react';
64
+
65
+ function App() {
66
+ return <RichTextEditor theme="auto" />;
67
+ }
68
+ ```
69
+
70
+ ## 🎨 Built-in Themes
71
+
72
+ ### Light Theme (Default)
73
+
74
+ Clean, professional light theme suitable for most applications.
75
+
76
+ ```tsx
77
+ <RichTextEditor theme="light" />
78
+ ```
79
+
80
+ ### Dark Theme
81
+
82
+ Modern dark theme with comfortable colors for low-light environments.
83
+
84
+ ```tsx
85
+ <RichTextEditor theme="dark" />
86
+ ```
87
+
88
+ ### Auto Theme
89
+
90
+ Automatically matches system preferences.
91
+
92
+ ```tsx
93
+ <RichTextEditor theme="auto" />
94
+ ```
95
+
96
+ ## 🔧 Customization
97
+
98
+ ### CSS Variables
99
+
100
+ All theme colors and sizes use CSS variables for easy customization.
101
+
102
+ #### Color Variables
103
+
104
+ ```css
105
+ :root {
106
+ /* Primary colors */
107
+ --editora-primary: #0066cc;
108
+ --editora-primary-hover: #0052a3;
109
+ --editora-primary-active: #003d7a;
110
+
111
+ /* Background colors */
112
+ --editora-bg: #ffffff;
113
+ --editora-bg-secondary: #f5f5f5;
114
+ --editora-bg-tertiary: #e0e0e0;
115
+
116
+ /* Text colors */
117
+ --editora-text: #000000;
118
+ --editora-text-secondary: #666666;
119
+ --editora-text-muted: #999999;
120
+
121
+ /* Border colors */
122
+ --editora-border: #cccccc;
123
+ --editora-border-focus: #0066cc;
124
+
125
+ /* Toolbar */
126
+ --editora-toolbar-bg: #f5f5f5;
127
+ --editora-toolbar-border: #cccccc;
128
+ --editora-toolbar-button-hover: #e0e0e0;
129
+ --editora-toolbar-button-active: #d0d0d0;
130
+
131
+ /* Content area */
132
+ --editora-content-bg: #ffffff;
133
+ --editora-content-padding: 16px;
134
+
135
+ /* Selection */
136
+ --editora-selection-bg: rgba(0, 102, 204, 0.2);
137
+
138
+ /* Status colors */
139
+ --editora-error: #dc3545;
140
+ --editora-warning: #ffc107;
141
+ --editora-success: #28a745;
142
+ --editora-info: #17a2b8;
143
+ }
144
+ ```
145
+
146
+ #### Dark Theme Variables
147
+
148
+ ```css
149
+ [data-theme="dark"] {
150
+ --editora-primary: #3399ff;
151
+ --editora-primary-hover: #5cadff;
152
+ --editora-primary-active: #1f8cff;
153
+
154
+ --editora-bg: #1e1e1e;
155
+ --editora-bg-secondary: #2d2d2d;
156
+ --editora-bg-tertiary: #3d3d3d;
157
+
158
+ --editora-text: #ffffff;
159
+ --editora-text-secondary: #cccccc;
160
+ --editora-text-muted: #999999;
161
+
162
+ --editora-border: #444444;
163
+ --editora-border-focus: #3399ff;
164
+
165
+ --editora-toolbar-bg: #2d2d2d;
166
+ --editora-toolbar-border: #444444;
167
+ --editora-toolbar-button-hover: #3d3d3d;
168
+ --editora-toolbar-button-active: #4d4d4d;
169
+
170
+ --editora-content-bg: #1e1e1e;
171
+
172
+ --editora-selection-bg: rgba(51, 153, 255, 0.3);
173
+ }
174
+ ```
175
+
176
+ #### Size Variables
177
+
178
+ ```css
179
+ :root {
180
+ /* Font sizes */
181
+ --editora-font-size-sm: 12px;
182
+ --editora-font-size-base: 14px;
183
+ --editora-font-size-lg: 16px;
184
+
185
+ /* Spacing */
186
+ --editora-spacing-xs: 4px;
187
+ --editora-spacing-sm: 8px;
188
+ --editora-spacing-md: 16px;
189
+ --editora-spacing-lg: 24px;
190
+ --editora-spacing-xl: 32px;
191
+
192
+ /* Border radius */
193
+ --editora-radius-sm: 2px;
194
+ --editora-radius-md: 4px;
195
+ --editora-radius-lg: 8px;
196
+
197
+ /* Shadows */
198
+ --editora-shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
199
+ --editora-shadow-md: 0 2px 4px rgba(0, 0, 0, 0.1);
200
+ --editora-shadow-lg: 0 4px 8px rgba(0, 0, 0, 0.15);
201
+
202
+ /* Z-indexes */
203
+ --editora-z-dropdown: 1000;
204
+ --editora-z-modal: 2000;
205
+ --editora-z-tooltip: 3000;
206
+ }
207
+ ```
208
+
209
+ ### Custom Theme Example
210
+
211
+ ```css
212
+ /* custom-theme.css */
213
+ @import '@editora/themes/styles';
214
+
215
+ :root {
216
+ /* Brand colors */
217
+ --editora-primary: #7c3aed;
218
+ --editora-primary-hover: #6d28d9;
219
+ --editora-primary-active: #5b21b6;
220
+
221
+ /* Custom toolbar */
222
+ --editora-toolbar-bg: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
223
+ --editora-toolbar-button-hover: rgba(255, 255, 255, 0.1);
224
+
225
+ /* Rounded corners */
226
+ --editora-radius-md: 12px;
227
+
228
+ /* Custom font */
229
+ --editora-font-family: 'Inter', system-ui, sans-serif;
230
+ }
231
+ ```
232
+
233
+ ## 💡 Usage Examples
234
+
235
+ ### Brand Customization
236
+
237
+ ```css
238
+ /* Match your brand colors */
239
+ :root {
240
+ --editora-primary: #ff6b6b;
241
+ --editora-primary-hover: #ff5252;
242
+ --editora-toolbar-bg: #ffffff;
243
+ --editora-border: #e0e0e0;
244
+ }
245
+
246
+ .my-editor {
247
+ border-radius: 8px;
248
+ box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
249
+ }
250
+ ```
251
+
252
+ ### Compact Mode
253
+
254
+ ```css
255
+ /* Smaller toolbar and spacing */
256
+ :root {
257
+ --editora-toolbar-height: 32px;
258
+ --editora-spacing-md: 8px;
259
+ --editora-font-size-base: 12px;
260
+ }
261
+ ```
262
+
263
+ ### High Contrast Mode
264
+
265
+ ```css
266
+ /* Improve accessibility */
267
+ [data-theme="high-contrast"] {
268
+ --editora-bg: #000000;
269
+ --editora-text: #ffffff;
270
+ --editora-border: #ffffff;
271
+ --editora-primary: #ffff00;
272
+ }
273
+ ```
274
+
275
+ ### Minimal Theme
276
+
277
+ ```css
278
+ /* Clean, distraction-free editing */
279
+ :root {
280
+ --editora-toolbar-bg: transparent;
281
+ --editora-toolbar-border: none;
282
+ --editora-border: transparent;
283
+ }
284
+
285
+ .rte-toolbar {
286
+ border-bottom: 1px solid var(--editora-border);
287
+ }
288
+ ```
289
+
290
+ ## 📱 Responsive Styles
291
+
292
+ The theme automatically adapts to different screen sizes:
293
+
294
+ ```css
295
+ /* Mobile adjustments */
296
+ @media (max-width: 768px) {
297
+ :root {
298
+ --editora-toolbar-height: 48px; /* Larger touch targets */
299
+ --editora-font-size-base: 16px; /* Prevent zoom on iOS */
300
+ --editora-spacing-md: 12px;
301
+ }
302
+ }
303
+
304
+ /* Tablet */
305
+ @media (min-width: 769px) and (max-width: 1024px) {
306
+ :root {
307
+ --editora-content-padding: 20px;
308
+ }
309
+ }
310
+
311
+ /* Desktop */
312
+ @media (min-width: 1025px) {
313
+ :root {
314
+ --editora-content-padding: 24px;
315
+ }
316
+ }
317
+ ```
318
+
319
+ ## 🌙 Dark Mode Implementation
320
+
321
+ ### System Preference Detection
322
+
323
+ ```tsx
324
+ import { useEffect, useState } from 'react';
325
+
326
+ function useTheme() {
327
+ const [theme, setTheme] = useState<'light' | 'dark'>('light');
328
+
329
+ useEffect(() => {
330
+ const mediaQuery = window.matchMedia('(prefers-color-scheme: dark)');
331
+ setTheme(mediaQuery.matches ? 'dark' : 'light');
332
+
333
+ const handler = (e: MediaQueryListEvent) => {
334
+ setTheme(e.matches ? 'dark' : 'light');
335
+ };
336
+
337
+ mediaQuery.addEventListener('change', handler);
338
+ return () => mediaQuery.removeEventListener('change', handler);
339
+ }, []);
340
+
341
+ return theme;
342
+ }
343
+
344
+ function App() {
345
+ const theme = useTheme();
346
+
347
+ return (
348
+ <div data-theme={theme}>
349
+ <RichTextEditor />
350
+ </div>
351
+ );
352
+ }
353
+ ```
354
+
355
+ ### Manual Theme Toggle
356
+
357
+ ```tsx
358
+ function App() {
359
+ const [theme, setTheme] = useState(() => {
360
+ return localStorage.getItem('theme') || 'light';
361
+ });
362
+
363
+ const toggleTheme = () => {
364
+ const newTheme = theme === 'light' ? 'dark' : 'light';
365
+ setTheme(newTheme);
366
+ localStorage.setItem('theme', newTheme);
367
+ };
368
+
369
+ return (
370
+ <div data-theme={theme}>
371
+ <button onClick={toggleTheme}>
372
+ {theme === 'light' ? '🌙' : '☀️'}
373
+ </button>
374
+ <RichTextEditor />
375
+ </div>
376
+ );
377
+ }
378
+ ```
379
+
380
+ ## 🎨 Component-Specific Styling
381
+
382
+ ### Toolbar Customization
383
+
384
+ ```css
385
+ .rte-toolbar {
386
+ background: linear-gradient(to right, #667eea, #764ba2);
387
+ border-radius: 8px 8px 0 0;
388
+ }
389
+
390
+ .rte-toolbar-button {
391
+ color: white;
392
+ border-radius: 4px;
393
+ transition: all 0.2s;
394
+ }
395
+
396
+ .rte-toolbar-button:hover {
397
+ background: rgba(255, 255, 255, 0.2);
398
+ transform: translateY(-1px);
399
+ }
400
+ ```
401
+
402
+ ### Content Area Styling
403
+
404
+ ```css
405
+ .rte-content {
406
+ font-family: 'Georgia', serif;
407
+ font-size: 18px;
408
+ line-height: 1.6;
409
+ max-width: 800px;
410
+ margin: 0 auto;
411
+ padding: 40px;
412
+ }
413
+
414
+ .rte-content h1 {
415
+ color: var(--editora-primary);
416
+ border-bottom: 2px solid var(--editora-border);
417
+ padding-bottom: 0.3em;
418
+ }
419
+ ```
420
+
421
+ ### Dialog Styling
422
+
423
+ ```css
424
+ .rte-dialog {
425
+ border-radius: var(--editora-radius-lg);
426
+ box-shadow: var(--editora-shadow-lg);
427
+ }
428
+
429
+ .rte-dialog-header {
430
+ background: var(--editora-bg-secondary);
431
+ border-radius: var(--editora-radius-lg) var(--editora-radius-lg) 0 0;
432
+ }
433
+ ```
434
+
435
+ ## 📄 License
436
+
437
+ MIT © [Ajay Kumar](https://github.com/ajaykr089)
438
+
439
+ ## 🔗 Links
440
+
441
+ - [Documentation](https://github.com/ajaykr089/Editora#readme)
442
+ - [GitHub Repository](https://github.com/ajaykr089/Editora)
443
+ - [Issue Tracker](https://github.com/ajaykr089/Editora/issues)
444
+ - [npm Package](https://www.npmjs.com/package/@editora/themes)
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});function h(e,t){e.setAttribute("data-theme",t),e.classList.toggle("dark",t==="dark")}function m(e){return""}function r(e){document.documentElement.setAttribute("data-theme",e),document.documentElement.classList.toggle("dark",e==="dark")}function n(){return document.documentElement.getAttribute("data-theme")==="dark"?"dark":"light"}function u(){const t=n()==="light"?"dark":"light";return r(t),t}function i(){return n()==="dark"}function o(){return n()==="light"}const a={light:"light",dark:"dark"};exports.applyTheme=h;exports.getCurrentTheme=n;exports.getThemeCSS=m;exports.isDarkTheme=i;exports.isLightTheme=o;exports.setGlobalTheme=r;exports.themes=a;exports.toggleTheme=u;
@@ -0,0 +1,36 @@
1
+ function u(t, e) {
2
+ t.setAttribute("data-theme", e), t.classList.toggle("dark", e === "dark");
3
+ }
4
+ function o(t) {
5
+ return "";
6
+ }
7
+ function r(t) {
8
+ document.documentElement.setAttribute("data-theme", t), document.documentElement.classList.toggle("dark", t === "dark");
9
+ }
10
+ function n() {
11
+ return document.documentElement.getAttribute("data-theme") === "dark" ? "dark" : "light";
12
+ }
13
+ function c() {
14
+ const e = n() === "light" ? "dark" : "light";
15
+ return r(e), e;
16
+ }
17
+ function i() {
18
+ return n() === "dark";
19
+ }
20
+ function a() {
21
+ return n() === "light";
22
+ }
23
+ const d = {
24
+ light: "light",
25
+ dark: "dark"
26
+ };
27
+ export {
28
+ u as applyTheme,
29
+ n as getCurrentTheme,
30
+ o as getThemeCSS,
31
+ i as isDarkTheme,
32
+ a as isLightTheme,
33
+ r as setGlobalTheme,
34
+ d as themes,
35
+ c as toggleTheme
36
+ };
package/package.json ADDED
@@ -0,0 +1,58 @@
1
+ {
2
+ "name": "@editora/themes",
3
+ "version": "1.0.0",
4
+ "description": "Themes and styling system for Editora Rich Text Editor with light/dark mode support",
5
+ "author": "Ajay Kumar <ajaykr089@gmail.com>",
6
+ "license": "MIT",
7
+ "repository": {
8
+ "type": "git",
9
+ "url": "https://github.com/ajaykr089/Editora.git",
10
+ "directory": "packages/themes"
11
+ },
12
+ "homepage": "https://github.com/ajaykr089/Editora#readme",
13
+ "bugs": {
14
+ "url": "https://github.com/ajaykr089/Editora/issues"
15
+ },
16
+ "keywords": [
17
+ "themes",
18
+ "styling",
19
+ "css",
20
+ "dark-mode",
21
+ "light-mode",
22
+ "design-system",
23
+ "css-variables"
24
+ ],
25
+ "main": "dist/index.cjs.js",
26
+ "module": "dist/index.esm.js",
27
+ "types": "dist/index.d.ts",
28
+ "style": "src/index.css",
29
+ "exports": {
30
+ ".": {
31
+ "types": "./dist/index.d.ts",
32
+ "import": "./dist/index.esm.js",
33
+ "require": "./dist/index.cjs.js"
34
+ },
35
+ "./styles": "./src/index.css"
36
+ },
37
+ "files": [
38
+ "dist",
39
+ "src/*.css",
40
+ "src/themes/*.css",
41
+ "README.md",
42
+ "LICENSE"
43
+ ],
44
+ "scripts": {
45
+ "build": "vite build",
46
+ "dev": "vite build --watch",
47
+ "clean": "rm -rf dist",
48
+ "prepublishOnly": "npm run build"
49
+ },
50
+ "devDependencies": {
51
+ "typescript": "^5.0.0",
52
+ "vite": "^7.3.1"
53
+ },
54
+ "publishConfig": {
55
+ "access": "public"
56
+ },
57
+ "gitHead": "e26546f8b2455c9a27eceb61818db31fd81fb518"
58
+ }