@bernierllc/content-editor-ui 0.4.2 → 0.4.4

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
@@ -31,8 +31,8 @@ npm install @bernierllc/content-editor-ui
31
31
  import React from 'react';
32
32
  import { ContentEditor } from '@bernierllc/content-editor-ui';
33
33
  import { TamaguiProvider } from 'tamagui';
34
- import { ContentData } from '@bernierllc/content-autosave-manager';
35
- import { ContentType } from '@bernierllc/content-type-registry';
34
+ import type { ContentData } from '@bernierllc/content-editor-ui';
35
+ import { ContentTypeDefinition } from '@bernierllc/content-type-registry';
36
36
 
37
37
  function MyContentEditor() {
38
38
  const [content, setContent] = useState<ContentData>({
@@ -43,14 +43,15 @@ function MyContentEditor() {
43
43
  version: 1
44
44
  });
45
45
 
46
- const contentType: ContentType = {
46
+ // A ContentTypeDefinition from @bernierllc/content-type-registry.
47
+ // Display fields (icon, description) live at the top level.
48
+ const contentType: ContentTypeDefinition = {
47
49
  id: 'text',
48
50
  name: 'Text Content',
49
- schema: {},
50
- editorConfig: { component: null, fields: [] },
51
- storageAdapter: {},
52
- displayRenderer: { component: null },
53
- metadata: { description: 'Plain text content' }
51
+ description: 'Plain text content',
52
+ baseType: 'text',
53
+ icon: '📝',
54
+ schema, editor, storage, publishing // your registry's configs for this type
54
55
  };
55
56
 
56
57
  const handleAutoSave = (content: ContentData) => {
@@ -86,6 +87,23 @@ function MyContentEditor() {
86
87
  }
87
88
  ```
88
89
 
90
+ ## Migrating from 0.4.x content types
91
+
92
+ 0.4.1 read `icon`, `description` and `category` from `contentType.metadata`.
93
+ From 0.5.0 the editor and `ContentTypeSelector` take a `ContentTypeDefinition`
94
+ from `@bernierllc/content-type-registry`, with `icon` and `description` at the
95
+ top level (`category` stays in `metadata`).
96
+
97
+ The 0.4.x shape still works as `LegacyContentType`: it is
98
+ `@deprecated since 0.5.0; removed in 1.0.0`, and the selector logs one
99
+ `console.warn` the first time it renders one. To migrate, move `metadata.icon`
100
+ and `metadata.description` to the top level and pass a full
101
+ `ContentTypeDefinition`.
102
+
103
+ The package also ships as ESM from 0.5.0 (`"type": "module"`), because its
104
+ `lowlight` dependency is ESM-only and a CommonJS build could not load it.
105
+ Import it from an ESM module or a bundler; `require()` is not supported.
106
+
89
107
  ## API Reference
90
108
 
91
109
  ### ContentEditor
@@ -97,7 +115,7 @@ The main editor component.
97
115
  ```typescript
98
116
  interface ContentEditorProps {
99
117
  content: ContentData; // Content data to edit
100
- contentType: ContentType; // Content type configuration
118
+ contentType: ContentTypeDefinition; // Content type configuration
101
119
  config?: Partial<ContentEditorUIConfig>; // Editor configuration
102
120
  onAutoSave?: (content: ContentData) => void; // Auto-save callback
103
121
  onSave?: (content: ContentData, saveType: 'draft' | 'publish') => void; // Save callback
@@ -137,9 +155,9 @@ Component for selecting content types.
137
155
 
138
156
  ```typescript
139
157
  interface ContentTypeSelectorProps {
140
- contentTypes: ContentType[]; // Available content types
141
- selectedType?: ContentType; // Currently selected type
142
- onChange: (contentType: ContentType) => void; // Change callback
158
+ contentTypes: ContentTypeDefinition[]; // Available content types
159
+ selectedType?: ContentTypeDefinition; // Currently selected type
160
+ onChange: (contentType: ContentTypeDefinition) => void; // Change callback
143
161
  disabled?: boolean; // Whether selector is disabled
144
162
  placeholder?: string; // Custom placeholder
145
163
  showDescriptions?: boolean; // Whether to show descriptions
@@ -373,7 +391,7 @@ function MultiTypeEditor() {
373
391
  version: 1
374
392
  });
375
393
 
376
- const handleTypeChange = (contentType: ContentType) => {
394
+ const handleTypeChange = (contentType: ContentTypeDefinition) => {
377
395
  setSelectedType(contentType);
378
396
 
379
397
  // Update content metadata
@@ -0,0 +1,12 @@
1
+ import React from 'react';
2
+ import { ContentEditorProps } from './types.js';
3
+ /**
4
+ * The TipTap extensions the editor runs with. Every toolbar command must be
5
+ * registered here; the tests check the toolbar against this real list.
6
+ */
7
+ export declare const createEditorExtensions: (placeholder: string) => (import("@tiptap/react").Extension<import("@tiptap/starter-kit").StarterKitOptions, any> | import("@tiptap/react").Extension<import("@tiptap/extension-placeholder").PlaceholderOptions, any> | import("@tiptap/react").Extension<import("@tiptap/extension-color").ColorOptions, any> | import("@tiptap/react").Mark<import("@tiptap/extension-underline").UnderlineOptions, any> | import("@tiptap/react").Node<import("@tiptap/extension-table-row").TableRowOptions, any>)[];
8
+ /**
9
+ * Content editor component with TipTap and Tamagui
10
+ */
11
+ export declare const ContentEditor: React.FC<ContentEditorProps>;
12
+ //# sourceMappingURL=content-editor.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"content-editor.d.ts","sourceRoot":"","sources":["../src/content-editor.tsx"],"names":[],"mappings":"AAQA,OAAO,KAAmD,MAAM,OAAO,CAAC;AA6BxE,OAAO,EACL,kBAAkB,EAQnB,MAAM,YAAY,CAAC;AAIpB;;;GAGG;AACH,eAAO,MAAM,sBAAsB,GAAI,aAAa,MAAM,qdAkCzD,CAAC;AAmDF;;GAEG;AACH,eAAO,MAAM,aAAa,EAAE,KAAK,CAAC,EAAE,CAAC,kBAAkB,CAgStD,CAAC"}
@@ -0,0 +1,523 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ /*
3
+ Copyright (c) 2025 Bernier LLC
4
+
5
+ This file is licensed to the client under a limited-use license.
6
+ The client may use and modify this code *only within the scope of the project it was delivered for*.
7
+ Redistribution or use in other products or commercial offerings is not permitted without written consent from Bernier LLC.
8
+ */
9
+ import React, { useCallback, useEffect, useRef, useState } from 'react';
10
+ import { useEditor, EditorContent } from '@tiptap/react';
11
+ import StarterKit from '@tiptap/starter-kit';
12
+ import Image from '@tiptap/extension-image';
13
+ import Link from '@tiptap/extension-link';
14
+ import Placeholder from '@tiptap/extension-placeholder';
15
+ import TextAlign from '@tiptap/extension-text-align';
16
+ import Color from '@tiptap/extension-color';
17
+ import TextStyle from '@tiptap/extension-text-style';
18
+ import Highlight from '@tiptap/extension-highlight';
19
+ import Underline from '@tiptap/extension-underline';
20
+ import CodeBlockLowlight from '@tiptap/extension-code-block-lowlight';
21
+ import Table from '@tiptap/extension-table';
22
+ import TableRow from '@tiptap/extension-table-row';
23
+ import TableHeader from '@tiptap/extension-table-header';
24
+ import TableCell from '@tiptap/extension-table-cell';
25
+ import { common, createLowlight } from 'lowlight';
26
+ import { XStack, YStack, Button, Text, Separator, Spinner, ScrollView, Tooltip, Paragraph, useTheme } from 'tamagui';
27
+ const lowlight = createLowlight(common);
28
+ /**
29
+ * The TipTap extensions the editor runs with. Every toolbar command must be
30
+ * registered here; the tests check the toolbar against this real list.
31
+ */
32
+ export const createEditorExtensions = (placeholder) => [
33
+ StarterKit.configure({
34
+ codeBlock: false, // We'll use CodeBlockLowlight instead
35
+ }),
36
+ CodeBlockLowlight.configure({
37
+ lowlight,
38
+ }),
39
+ Image.configure({
40
+ HTMLAttributes: {
41
+ class: 'editor-image',
42
+ },
43
+ }),
44
+ Link.configure({
45
+ openOnClick: false,
46
+ HTMLAttributes: {
47
+ class: 'editor-link',
48
+ },
49
+ }),
50
+ Placeholder.configure({
51
+ placeholder,
52
+ }),
53
+ TextAlign.configure({
54
+ types: ['heading', 'paragraph'],
55
+ }),
56
+ Color.configure({ types: [TextStyle.name] }),
57
+ TextStyle,
58
+ Highlight.configure({ multicolor: true }),
59
+ Underline,
60
+ Table.configure({
61
+ resizable: true,
62
+ }),
63
+ TableRow,
64
+ TableHeader,
65
+ TableCell,
66
+ ];
67
+ /**
68
+ * Default editor configuration
69
+ */
70
+ const defaultConfig = {
71
+ enabled: true,
72
+ theme: 'light',
73
+ placeholder: 'Start writing...',
74
+ showWordCount: true,
75
+ showCharCount: true,
76
+ showAutoSaveStatus: true,
77
+ showToolbar: true,
78
+ showStatusBar: true,
79
+ height: '400px',
80
+ width: '100%'
81
+ };
82
+ /**
83
+ * Default toolbar configuration
84
+ */
85
+ const defaultToolbarConfig = {
86
+ enabled: true,
87
+ position: 'top',
88
+ items: [],
89
+ showFormatting: true,
90
+ showHeadings: true,
91
+ showLists: true,
92
+ showLink: true,
93
+ showImage: true,
94
+ showTable: true,
95
+ showCodeBlock: true,
96
+ showTextAlign: true,
97
+ showTextColor: true,
98
+ showHighlight: true
99
+ };
100
+ /**
101
+ * Default status bar configuration
102
+ */
103
+ const defaultStatusConfig = {
104
+ enabled: true,
105
+ position: 'bottom',
106
+ items: [],
107
+ showWordCount: true,
108
+ showCharCount: true,
109
+ showAutoSaveStatus: true,
110
+ showCursorPosition: false,
111
+ showEditorMode: false
112
+ };
113
+ /**
114
+ * Content editor component with TipTap and Tamagui
115
+ */
116
+ export const ContentEditor = ({ content, config = {}, onAutoSave, onSave, onChange, onFocus, onBlur, onError, readOnly = false, disabled = false, customToolbarItems = [], customStatusItems = [] }) => {
117
+ const theme = useTheme();
118
+ const [editorStats, setEditorStats] = useState({
119
+ wordCount: 0,
120
+ charCount: 0,
121
+ charCountNoSpaces: 0,
122
+ paragraphCount: 0,
123
+ headingCount: 0,
124
+ linkCount: 0,
125
+ imageCount: 0,
126
+ tableCount: 0,
127
+ codeBlockCount: 0,
128
+ readingTime: 0
129
+ });
130
+ const [autoSaveStatus, setAutoSaveStatus] = useState('idle');
131
+ const [lastSaveTime, setLastSaveTime] = useState(null);
132
+ const autoSaveTimeoutRef = useRef(null);
133
+ // Merge configuration with defaults
134
+ const editorConfig = { ...defaultConfig, ...config };
135
+ const toolbarConfig = { ...defaultToolbarConfig, ...config };
136
+ const statusConfig = { ...defaultStatusConfig, ...config };
137
+ // Initialize TipTap editor
138
+ const editor = useEditor({
139
+ extensions: createEditorExtensions(editorConfig.placeholder ?? ''),
140
+ content: content.data,
141
+ editable: !readOnly && !disabled,
142
+ onUpdate: ({ editor }) => {
143
+ const newContent = {
144
+ ...content,
145
+ data: editor.getJSON(),
146
+ lastModified: new Date()
147
+ };
148
+ onChange?.(newContent);
149
+ // Update statistics
150
+ updateEditorStatistics(editor);
151
+ // Trigger auto-save
152
+ if (onAutoSave && editorConfig.showAutoSaveStatus) {
153
+ triggerAutoSave(newContent);
154
+ }
155
+ },
156
+ onFocus: () => {
157
+ onFocus?.();
158
+ },
159
+ onBlur: () => {
160
+ onBlur?.();
161
+ },
162
+ onSelectionUpdate: () => {
163
+ // Update cursor position if needed
164
+ if (statusConfig.showCursorPosition) {
165
+ // Implementation for cursor position tracking
166
+ }
167
+ },
168
+ editorProps: {
169
+ attributes: {
170
+ class: 'prose prose-sm sm:prose lg:prose-lg xl:prose-2xl mx-auto focus:outline-none',
171
+ style: `min-height: ${editorConfig.height}; width: ${editorConfig.width};`,
172
+ },
173
+ },
174
+ });
175
+ /**
176
+ * Update editor statistics
177
+ */
178
+ const updateEditorStatistics = useCallback((editor) => {
179
+ const text = editor.getText();
180
+ const json = editor.getJSON();
181
+ // Count words
182
+ const words = text.trim().split(/\s+/).filter((word) => word.length > 0);
183
+ const wordCount = words.length;
184
+ // Count characters
185
+ const charCount = text.length;
186
+ const charCountNoSpaces = text.replace(/\s/g, '').length;
187
+ // Count paragraphs
188
+ const paragraphCount = json.content?.filter((node) => node.type === 'paragraph').length || 0;
189
+ // Count headings
190
+ const headingCount = json.content?.filter((node) => node.type === 'heading').length || 0;
191
+ // Count links
192
+ const linkCount = json.content?.filter((node) => node.content?.some((child) => child.type === 'link')).length || 0;
193
+ // Count images
194
+ const imageCount = json.content?.filter((node) => node.type === 'image').length || 0;
195
+ // Count tables
196
+ const tableCount = json.content?.filter((node) => node.type === 'table').length || 0;
197
+ // Count code blocks
198
+ const codeBlockCount = json.content?.filter((node) => node.type === 'codeBlock').length || 0;
199
+ // Estimate reading time (average 200 words per minute)
200
+ const readingTime = Math.ceil(wordCount / 200);
201
+ setEditorStats({
202
+ wordCount,
203
+ charCount,
204
+ charCountNoSpaces,
205
+ paragraphCount,
206
+ headingCount,
207
+ linkCount,
208
+ imageCount,
209
+ tableCount,
210
+ codeBlockCount,
211
+ readingTime
212
+ });
213
+ }, []);
214
+ /**
215
+ * Trigger auto-save with debounce
216
+ */
217
+ const triggerAutoSave = useCallback((content) => {
218
+ if (autoSaveTimeoutRef.current) {
219
+ clearTimeout(autoSaveTimeoutRef.current);
220
+ }
221
+ setAutoSaveStatus('saving');
222
+ autoSaveTimeoutRef.current = setTimeout(() => {
223
+ try {
224
+ onAutoSave?.(content);
225
+ setAutoSaveStatus('saved');
226
+ setLastSaveTime(new Date());
227
+ // Reset to idle after 2 seconds
228
+ setTimeout(() => {
229
+ setAutoSaveStatus('idle');
230
+ }, 2000);
231
+ }
232
+ catch (error) {
233
+ setAutoSaveStatus('error');
234
+ onError?.(error);
235
+ // Reset to idle after 5 seconds
236
+ setTimeout(() => {
237
+ setAutoSaveStatus('idle');
238
+ }, 5000);
239
+ }
240
+ }, 1000); // 1 second debounce
241
+ }, [onAutoSave, onError]);
242
+ /**
243
+ * Handle manual save
244
+ */
245
+ const handleSave = useCallback((saveType) => {
246
+ if (!editor)
247
+ return;
248
+ const contentToSave = {
249
+ ...content,
250
+ data: editor.getJSON(),
251
+ lastModified: new Date()
252
+ };
253
+ onSave?.(contentToSave, saveType);
254
+ }, [editor, content, onSave]);
255
+ /**
256
+ * Handle keyboard shortcuts
257
+ */
258
+ useEffect(() => {
259
+ if (!editor)
260
+ return;
261
+ const handleKeyDown = (event) => {
262
+ // Ctrl/Cmd + S for save
263
+ if ((event.ctrlKey || event.metaKey) && event.key === 's') {
264
+ event.preventDefault();
265
+ handleSave('draft');
266
+ }
267
+ // Ctrl/Cmd + Shift + S for publish
268
+ if ((event.ctrlKey || event.metaKey) && event.shiftKey && event.key === 'S') {
269
+ event.preventDefault();
270
+ handleSave('publish');
271
+ }
272
+ };
273
+ document.addEventListener('keydown', handleKeyDown);
274
+ return () => document.removeEventListener('keydown', handleKeyDown);
275
+ }, [editor, handleSave]);
276
+ /**
277
+ * Update statistics when editor changes
278
+ */
279
+ useEffect(() => {
280
+ if (editor) {
281
+ updateEditorStatistics(editor);
282
+ }
283
+ }, [editor, updateEditorStatistics]);
284
+ /**
285
+ * Cleanup auto-save timeout
286
+ */
287
+ useEffect(() => {
288
+ return () => {
289
+ if (autoSaveTimeoutRef.current) {
290
+ clearTimeout(autoSaveTimeoutRef.current);
291
+ }
292
+ };
293
+ }, []);
294
+ if (!editor) {
295
+ return (_jsxs(YStack, { padding: "$4", alignItems: "center", justifyContent: "center", children: [_jsx(Spinner, { size: "large" }), _jsx(Text, { marginTop: "$2", children: "Loading editor..." })] }));
296
+ }
297
+ return (_jsxs(YStack, { backgroundColor: theme['background']?.val, borderColor: theme['borderColor']?.val, borderWidth: 1, borderRadius: "$4", overflow: "hidden", ...(editorConfig.className !== undefined && { className: editorConfig.className }), ...(editorConfig.style !== undefined && { style: editorConfig.style }), children: [toolbarConfig.enabled && (_jsx(EditorToolbar, { editor: editor, config: toolbarConfig, customItems: customToolbarItems, onSave: handleSave, disabled: disabled })), _jsx(ScrollView, { flex: 1, padding: "$3", minHeight: editorConfig.height, maxHeight: "600px", children: _jsx(EditorContent, { editor: editor, style: {
298
+ outline: 'none',
299
+ minHeight: '200px'
300
+ } }) }), statusConfig.enabled && (_jsx(EditorStatusBar, { config: statusConfig, statistics: editorStats, autoSaveStatus: autoSaveStatus, lastSaveTime: lastSaveTime, customItems: customStatusItems, disabled: disabled }))] }));
301
+ };
302
+ const EditorToolbar = ({ editor, config, customItems, onSave, disabled }) => {
303
+ const theme = useTheme();
304
+ const toolbarItems = [
305
+ // Formatting buttons
306
+ ...(config.showFormatting ? [
307
+ {
308
+ id: 'bold',
309
+ type: 'button',
310
+ label: 'Bold',
311
+ icon: 'B',
312
+ tooltip: 'Bold (Ctrl+B)',
313
+ isActive: editor.isActive('bold'),
314
+ onClick: () => editor.chain().focus().toggleBold().run()
315
+ },
316
+ {
317
+ id: 'italic',
318
+ type: 'button',
319
+ label: 'Italic',
320
+ icon: 'I',
321
+ tooltip: 'Italic (Ctrl+I)',
322
+ isActive: editor.isActive('italic'),
323
+ onClick: () => editor.chain().focus().toggleItalic().run()
324
+ },
325
+ {
326
+ id: 'underline',
327
+ type: 'button',
328
+ label: 'Underline',
329
+ icon: 'U',
330
+ tooltip: 'Underline (Ctrl+U)',
331
+ isActive: editor.isActive('underline'),
332
+ onClick: () => editor.chain().focus().toggleUnderline().run()
333
+ },
334
+ {
335
+ id: 'strike',
336
+ type: 'button',
337
+ label: 'Strikethrough',
338
+ icon: 'S',
339
+ tooltip: 'Strikethrough',
340
+ isActive: editor.isActive('strike'),
341
+ onClick: () => editor.chain().focus().toggleStrike().run()
342
+ }
343
+ ] : []),
344
+ // Separator
345
+ { id: 'separator1', type: 'separator' },
346
+ // Heading buttons
347
+ ...(config.showHeadings ? [
348
+ {
349
+ id: 'h1',
350
+ type: 'button',
351
+ label: 'Heading 1',
352
+ icon: 'H1',
353
+ tooltip: 'Heading 1',
354
+ isActive: editor.isActive('heading', { level: 1 }),
355
+ onClick: () => editor.chain().focus().toggleHeading({ level: 1 }).run()
356
+ },
357
+ {
358
+ id: 'h2',
359
+ type: 'button',
360
+ label: 'Heading 2',
361
+ icon: 'H2',
362
+ tooltip: 'Heading 2',
363
+ isActive: editor.isActive('heading', { level: 2 }),
364
+ onClick: () => editor.chain().focus().toggleHeading({ level: 2 }).run()
365
+ },
366
+ {
367
+ id: 'h3',
368
+ type: 'button',
369
+ label: 'Heading 3',
370
+ icon: 'H3',
371
+ tooltip: 'Heading 3',
372
+ isActive: editor.isActive('heading', { level: 3 }),
373
+ onClick: () => editor.chain().focus().toggleHeading({ level: 3 }).run()
374
+ }
375
+ ] : []),
376
+ // Separator
377
+ { id: 'separator2', type: 'separator' },
378
+ // List buttons
379
+ ...(config.showLists ? [
380
+ {
381
+ id: 'bulletList',
382
+ type: 'button',
383
+ label: 'Bullet List',
384
+ icon: '•',
385
+ tooltip: 'Bullet List',
386
+ isActive: editor.isActive('bulletList'),
387
+ onClick: () => editor.chain().focus().toggleBulletList().run()
388
+ },
389
+ {
390
+ id: 'orderedList',
391
+ type: 'button',
392
+ label: 'Numbered List',
393
+ icon: '1.',
394
+ tooltip: 'Numbered List',
395
+ isActive: editor.isActive('orderedList'),
396
+ onClick: () => editor.chain().focus().toggleOrderedList().run()
397
+ }
398
+ ] : []),
399
+ // Separator
400
+ { id: 'separator3', type: 'separator' },
401
+ // Link and image buttons
402
+ ...(config.showLink ? [
403
+ {
404
+ id: 'link',
405
+ type: 'button',
406
+ label: 'Link',
407
+ icon: '🔗',
408
+ tooltip: 'Add Link',
409
+ isActive: editor.isActive('link'),
410
+ onClick: () => {
411
+ const url = window.prompt('Enter URL:');
412
+ if (url) {
413
+ editor.chain().focus().setLink({ href: url }).run();
414
+ }
415
+ }
416
+ }
417
+ ] : []),
418
+ ...(config.showImage ? [
419
+ {
420
+ id: 'image',
421
+ type: 'button',
422
+ label: 'Image',
423
+ icon: '🖼️',
424
+ tooltip: 'Add Image',
425
+ onClick: () => {
426
+ const url = window.prompt('Enter image URL:');
427
+ if (url) {
428
+ editor.chain().focus().setImage({ src: url }).run();
429
+ }
430
+ }
431
+ }
432
+ ] : []),
433
+ // Separator
434
+ { id: 'separator4', type: 'separator' },
435
+ // Save buttons
436
+ {
437
+ id: 'saveDraft',
438
+ type: 'button',
439
+ label: 'Save Draft',
440
+ icon: '💾',
441
+ tooltip: 'Save Draft (Ctrl+S)',
442
+ onClick: () => onSave('draft')
443
+ },
444
+ {
445
+ id: 'publish',
446
+ type: 'button',
447
+ label: 'Publish',
448
+ icon: '🚀',
449
+ tooltip: 'Publish (Ctrl+Shift+S)',
450
+ onClick: () => onSave('publish')
451
+ },
452
+ // Custom items
453
+ ...customItems
454
+ ];
455
+ return (_jsx(XStack, { padding: "$2", backgroundColor: theme['background']?.val, borderBottomWidth: 1, borderBottomColor: theme['borderColor']?.val, gap: "$2", flexWrap: "wrap", children: toolbarItems.map((item) => {
456
+ if (item.type === 'separator') {
457
+ return _jsx(Separator, { vertical: true, marginHorizontal: "$2" }, item.id);
458
+ }
459
+ if (item.type === 'custom' && item.component) {
460
+ const CustomComponent = item.component;
461
+ return (_jsx(CustomComponent, { ...item.props, editor: editor, disabled: disabled }, item.id));
462
+ }
463
+ const button = (_jsx(Button, { size: "$2", "aria-label": item.tooltip ?? item.label, variant: item.isActive ? 'outlined' : undefined, disabled: disabled || item.disabled, onPress: item.onClick, backgroundColor: item.isActive ? theme['primary']?.val : 'transparent', borderColor: item.isActive ? theme['primary']?.val : 'transparent', children: _jsx(Text, { fontSize: "$2", fontWeight: item.isActive ? 'bold' : 'normal', children: item.icon || item.label }) }));
464
+ if (!item.tooltip) {
465
+ return _jsx(React.Fragment, { children: button }, item.id);
466
+ }
467
+ return (_jsxs(Tooltip, { children: [_jsx(Tooltip.Trigger, { asChild: true, children: button }), _jsx(Tooltip.Content, { children: _jsx(Paragraph, { size: "$2", children: item.tooltip }) })] }, item.id));
468
+ }) }));
469
+ };
470
+ const EditorStatusBar = ({ config, statistics, autoSaveStatus, lastSaveTime, customItems, disabled }) => {
471
+ const theme = useTheme();
472
+ const statusItems = [
473
+ // Word count
474
+ ...(config.showWordCount ? [
475
+ {
476
+ id: 'wordCount',
477
+ type: 'text',
478
+ label: 'Words',
479
+ value: statistics.wordCount.toString()
480
+ }
481
+ ] : []),
482
+ // Character count
483
+ ...(config.showCharCount ? [
484
+ {
485
+ id: 'charCount',
486
+ type: 'text',
487
+ label: 'Characters',
488
+ value: statistics.charCount.toString()
489
+ }
490
+ ] : []),
491
+ // Auto-save status
492
+ ...(config.showAutoSaveStatus ? [
493
+ {
494
+ id: 'autoSave',
495
+ type: 'text',
496
+ label: 'Auto-save',
497
+ value: autoSaveStatus === 'saving' ? 'Saving...' :
498
+ autoSaveStatus === 'saved' ? 'Saved' :
499
+ autoSaveStatus === 'error' ? 'Error' : 'Idle',
500
+ color: autoSaveStatus === 'saving' ? theme['orange']?.val :
501
+ autoSaveStatus === 'saved' ? theme['green']?.val :
502
+ autoSaveStatus === 'error' ? theme['red']?.val : theme['gray']?.val
503
+ }
504
+ ] : []),
505
+ // Reading time
506
+ {
507
+ id: 'readingTime',
508
+ type: 'text',
509
+ label: 'Reading time',
510
+ value: `${statistics.readingTime} min`
511
+ },
512
+ // Custom items
513
+ ...customItems
514
+ ];
515
+ return (_jsxs(XStack, { padding: "$2", backgroundColor: theme['background']?.val, borderTopWidth: 1, borderTopColor: theme['borderColor']?.val, gap: "$3", alignItems: "center", justifyContent: "space-between", children: [_jsx(XStack, { gap: "$3", alignItems: "center", children: statusItems.map((item) => {
516
+ if (item.type === 'custom' && item.component) {
517
+ const CustomComponent = item.component;
518
+ return (_jsx(CustomComponent, { ...item.props, statistics: statistics, disabled: disabled }, item.id));
519
+ }
520
+ return (_jsxs(XStack, { gap: "$1", alignItems: "center", children: [_jsxs(Text, { fontSize: "$1", color: theme['gray']?.val, children: [item.label, ":"] }), _jsx(Text, { fontSize: "$1", fontWeight: "bold", color: item.color || theme['foreground']?.val, children: item.value })] }, item.id));
521
+ }) }), lastSaveTime && (_jsxs(Text, { fontSize: "$1", color: theme['gray']?.val, children: ["Last saved: ", lastSaveTime.toLocaleTimeString()] }))] }));
522
+ };
523
+ //# sourceMappingURL=content-editor.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"content-editor.js","sourceRoot":"","sources":["../src/content-editor.tsx"],"names":[],"mappings":";AAAA;;;;;;EAME;AAEF,OAAO,KAAK,EAAE,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACxE,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AACzD,OAAO,UAAU,MAAM,qBAAqB,CAAC;AAC7C,OAAO,KAAK,MAAM,yBAAyB,CAAC;AAC5C,OAAO,IAAI,MAAM,wBAAwB,CAAC;AAC1C,OAAO,WAAW,MAAM,+BAA+B,CAAC;AACxD,OAAO,SAAS,MAAM,8BAA8B,CAAC;AACrD,OAAO,KAAK,MAAM,yBAAyB,CAAC;AAC5C,OAAO,SAAS,MAAM,8BAA8B,CAAC;AACrD,OAAO,SAAS,MAAM,6BAA6B,CAAC;AACpD,OAAO,SAAS,MAAM,6BAA6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