@djangocfg/ui-tools 2.1.241 → 2.1.243

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/dist/index.css CHANGED
@@ -3,4 +3,166 @@
3
3
  box-shadow: 0 0 0 2px hsl(var(--ring));
4
4
  transition: box-shadow 150ms;
5
5
  }
6
+
7
+ /* src/tools/MarkdownEditor/styles.css */
8
+ .markdown-editor .markdown-editor-content {
9
+ outline: none;
10
+ }
11
+ .markdown-editor .tiptap h1 {
12
+ font-size: 1.5em;
13
+ font-weight: 700;
14
+ margin: 0.5em 0 0.25em;
15
+ line-height: 1.3;
16
+ }
17
+ .markdown-editor .tiptap h2 {
18
+ font-size: 1.25em;
19
+ font-weight: 600;
20
+ margin: 0.5em 0 0.25em;
21
+ line-height: 1.3;
22
+ }
23
+ .markdown-editor .tiptap h3 {
24
+ font-size: 1.1em;
25
+ font-weight: 600;
26
+ margin: 0.4em 0 0.2em;
27
+ line-height: 1.3;
28
+ }
29
+ .markdown-editor .tiptap p {
30
+ margin: 0.25em 0;
31
+ }
32
+ .markdown-editor .tiptap ul,
33
+ .markdown-editor .tiptap ol {
34
+ padding-left: 1.5em;
35
+ margin: 0.25em 0;
36
+ }
37
+ .markdown-editor .tiptap ul {
38
+ list-style: disc;
39
+ }
40
+ .markdown-editor .tiptap ol {
41
+ list-style: decimal;
42
+ }
43
+ .markdown-editor .tiptap li {
44
+ margin: 0.1em 0;
45
+ }
46
+ .markdown-editor .tiptap blockquote {
47
+ border-left: 3px solid var(--border, #333);
48
+ padding-left: 1em;
49
+ margin: 0.5em 0;
50
+ opacity: 0.8;
51
+ }
52
+ .markdown-editor .tiptap hr {
53
+ border: none;
54
+ border-top: 1px solid var(--border, #333);
55
+ margin: 0.75em 0;
56
+ }
57
+ .markdown-editor .tiptap code {
58
+ background: var(--muted, #222);
59
+ padding: 0.15em 0.3em;
60
+ border-radius: 0.25em;
61
+ font-size: 0.9em;
62
+ font-family: monospace;
63
+ }
64
+ .markdown-editor .tiptap strong {
65
+ font-weight: 700;
66
+ }
67
+ .markdown-editor .tiptap em {
68
+ font-style: italic;
69
+ }
70
+ .markdown-editor .tiptap s {
71
+ text-decoration: line-through;
72
+ }
73
+ .markdown-editor .tiptap p.is-editor-empty:first-child::before {
74
+ content: attr(data-placeholder);
75
+ float: left;
76
+ pointer-events: none;
77
+ height: 0;
78
+ opacity: 0.4;
79
+ }
80
+ .markdown-editor:focus-within {
81
+ border-color: var(--color-ring, hsl(var(--ring, 0 0% 60%)));
82
+ box-shadow: 0 0 0 2px var(--color-ring, hsl(var(--ring, 0 0% 60%) / 0.3));
83
+ }
84
+ .markdown-mention {
85
+ background: var(--color-primary, hsl(var(--primary)));
86
+ color: var(--color-primary-foreground, #fff);
87
+ padding: 1px 6px;
88
+ border-radius: 4px;
89
+ font-size: 0.9em;
90
+ font-weight: 500;
91
+ cursor: default;
92
+ }
93
+ .markdown-mention-list {
94
+ background: var(--color-popover, hsl(var(--popover, 0 0% 8%)));
95
+ color: var(--color-popover-foreground, hsl(var(--popover-foreground, 0 0% 98%)));
96
+ border: 1px solid var(--color-border, hsl(var(--border, 0 0% 15%)));
97
+ border-radius: 8px;
98
+ padding: 4px;
99
+ min-width: 220px;
100
+ max-height: 260px;
101
+ overflow-y: auto;
102
+ box-shadow: 0 8px 30px rgba(0, 0, 0, 0.5);
103
+ }
104
+ .markdown-mention-item {
105
+ display: flex;
106
+ align-items: center;
107
+ gap: 8px;
108
+ width: 100%;
109
+ padding: 6px 8px;
110
+ border: none;
111
+ background: transparent;
112
+ border-radius: 4px;
113
+ cursor: pointer;
114
+ text-align: left;
115
+ font-size: 13px;
116
+ transition: background 0.1s;
117
+ }
118
+ .markdown-mention-item:hover,
119
+ .markdown-mention-item.selected {
120
+ background: var(--color-muted, hsl(var(--muted, 0 0% 15%)));
121
+ }
122
+ .markdown-mention-avatar {
123
+ width: 24px;
124
+ height: 24px;
125
+ border-radius: 50%;
126
+ object-fit: cover;
127
+ flex-shrink: 0;
128
+ }
129
+ .markdown-mention-info {
130
+ display: flex;
131
+ flex-direction: column;
132
+ min-width: 0;
133
+ }
134
+ .markdown-mention-name {
135
+ font-weight: 500;
136
+ white-space: nowrap;
137
+ overflow: hidden;
138
+ text-overflow: ellipsis;
139
+ }
140
+ .markdown-mention-desc {
141
+ font-size: 11px;
142
+ opacity: 0.6;
143
+ white-space: nowrap;
144
+ overflow: hidden;
145
+ text-overflow: ellipsis;
146
+ }
147
+ .markdown-toolbar-btn {
148
+ display: flex;
149
+ align-items: center;
150
+ justify-content: center;
151
+ width: 28px;
152
+ height: 28px;
153
+ border-radius: 4px;
154
+ border: none;
155
+ background: transparent;
156
+ cursor: pointer;
157
+ opacity: 0.5;
158
+ transition: opacity 0.15s, background 0.15s;
159
+ }
160
+ .markdown-toolbar-btn:hover {
161
+ opacity: 1;
162
+ background: var(--muted, #222);
163
+ }
164
+ .markdown-toolbar-btn.active {
165
+ opacity: 1;
166
+ background: var(--muted, #222);
167
+ }
6
168
  /*# sourceMappingURL=index.css.map */
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/components/FloatingToolbar/FloatingToolbar.css"],"sourcesContent":["/* Focus ring when scroll isolation is unlocked */\n.scroll-unlocked {\n box-shadow: 0 0 0 2px hsl(var(--ring));\n transition: box-shadow 150ms;\n}\n"],"mappings":";AACA,CAAC;AACC,cAAY,EAAE,EAAE,EAAE,IAAI,IAAI,IAAI;AAC9B,cAAY,WAAW;AACzB;","names":[]}
1
+ {"version":3,"sources":["../src/components/FloatingToolbar/FloatingToolbar.css","../src/tools/MarkdownEditor/styles.css"],"sourcesContent":["/* Focus ring when scroll isolation is unlocked */\n.scroll-unlocked {\n box-shadow: 0 0 0 2px hsl(var(--ring));\n transition: box-shadow 150ms;\n}\n",".markdown-editor .markdown-editor-content {\n outline: none;\n}\n\n.markdown-editor .tiptap h1 {\n font-size: 1.5em;\n font-weight: 700;\n margin: 0.5em 0 0.25em;\n line-height: 1.3;\n}\n\n.markdown-editor .tiptap h2 {\n font-size: 1.25em;\n font-weight: 600;\n margin: 0.5em 0 0.25em;\n line-height: 1.3;\n}\n\n.markdown-editor .tiptap h3 {\n font-size: 1.1em;\n font-weight: 600;\n margin: 0.4em 0 0.2em;\n line-height: 1.3;\n}\n\n.markdown-editor .tiptap p {\n margin: 0.25em 0;\n}\n\n.markdown-editor .tiptap ul,\n.markdown-editor .tiptap ol {\n padding-left: 1.5em;\n margin: 0.25em 0;\n}\n\n.markdown-editor .tiptap ul {\n list-style: disc;\n}\n\n.markdown-editor .tiptap ol {\n list-style: decimal;\n}\n\n.markdown-editor .tiptap li {\n margin: 0.1em 0;\n}\n\n.markdown-editor .tiptap blockquote {\n border-left: 3px solid var(--border, #333);\n padding-left: 1em;\n margin: 0.5em 0;\n opacity: 0.8;\n}\n\n.markdown-editor .tiptap hr {\n border: none;\n border-top: 1px solid var(--border, #333);\n margin: 0.75em 0;\n}\n\n.markdown-editor .tiptap code {\n background: var(--muted, #222);\n padding: 0.15em 0.3em;\n border-radius: 0.25em;\n font-size: 0.9em;\n font-family: monospace;\n}\n\n.markdown-editor .tiptap strong {\n font-weight: 700;\n}\n\n.markdown-editor .tiptap em {\n font-style: italic;\n}\n\n.markdown-editor .tiptap s {\n text-decoration: line-through;\n}\n\n.markdown-editor .tiptap p.is-editor-empty:first-child::before {\n content: attr(data-placeholder);\n float: left;\n pointer-events: none;\n height: 0;\n opacity: 0.4;\n}\n\n/* Focus ring */\n.markdown-editor:focus-within {\n border-color: var(--color-ring, hsl(var(--ring, 0 0% 60%)));\n box-shadow: 0 0 0 2px var(--color-ring, hsl(var(--ring, 0 0% 60%) / 0.3));\n}\n\n/* Mention inline chip */\n.markdown-mention {\n background: var(--color-primary, hsl(var(--primary)));\n color: var(--color-primary-foreground, #fff);\n padding: 1px 6px;\n border-radius: 4px;\n font-size: 0.9em;\n font-weight: 500;\n cursor: default;\n}\n\n/* Mention dropdown */\n.markdown-mention-list {\n background: var(--color-popover, hsl(var(--popover, 0 0% 8%)));\n color: var(--color-popover-foreground, hsl(var(--popover-foreground, 0 0% 98%)));\n border: 1px solid var(--color-border, hsl(var(--border, 0 0% 15%)));\n border-radius: 8px;\n padding: 4px;\n min-width: 220px;\n max-height: 260px;\n overflow-y: auto;\n box-shadow: 0 8px 30px rgba(0, 0, 0, 0.5);\n}\n\n.markdown-mention-item {\n display: flex;\n align-items: center;\n gap: 8px;\n width: 100%;\n padding: 6px 8px;\n border: none;\n background: transparent;\n border-radius: 4px;\n cursor: pointer;\n text-align: left;\n font-size: 13px;\n transition: background 0.1s;\n}\n\n.markdown-mention-item:hover,\n.markdown-mention-item.selected {\n background: var(--color-muted, hsl(var(--muted, 0 0% 15%)));\n}\n\n.markdown-mention-avatar {\n width: 24px;\n height: 24px;\n border-radius: 50%;\n object-fit: cover;\n flex-shrink: 0;\n}\n\n.markdown-mention-info {\n display: flex;\n flex-direction: column;\n min-width: 0;\n}\n\n.markdown-mention-name {\n font-weight: 500;\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n}\n\n.markdown-mention-desc {\n font-size: 11px;\n opacity: 0.6;\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n}\n\n/* Toolbar buttons */\n.markdown-toolbar-btn {\n display: flex;\n align-items: center;\n justify-content: center;\n width: 28px;\n height: 28px;\n border-radius: 4px;\n border: none;\n background: transparent;\n cursor: pointer;\n opacity: 0.5;\n transition: opacity 0.15s, background 0.15s;\n}\n\n.markdown-toolbar-btn:hover {\n opacity: 1;\n background: var(--muted, #222);\n}\n\n.markdown-toolbar-btn.active {\n opacity: 1;\n background: var(--muted, #222);\n}\n"],"mappings":"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","names":[]}
package/dist/index.d.cts CHANGED
@@ -2387,6 +2387,38 @@ declare function useEditor(): UseEditorReturn;
2387
2387
  */
2388
2388
  declare function useLanguage(filename: string | undefined): string;
2389
2389
 
2390
+ /** Item that can be mentioned via @ trigger */
2391
+ interface MentionItem {
2392
+ id: string;
2393
+ label: string;
2394
+ description?: string;
2395
+ thumbnail?: string;
2396
+ }
2397
+ /** Mention configuration */
2398
+ interface MentionConfig {
2399
+ /** Trigger character (default: '@') */
2400
+ trigger?: string;
2401
+ /** Available items */
2402
+ items: MentionItem[];
2403
+ /** Max dropdown items (default: 5) */
2404
+ maxItems?: number;
2405
+ }
2406
+
2407
+ interface MarkdownEditorProps {
2408
+ value: string;
2409
+ onChange: (value: string) => void;
2410
+ placeholder?: string;
2411
+ minHeight?: number;
2412
+ className?: string;
2413
+ disabled?: boolean;
2414
+ showToolbar?: boolean;
2415
+ /** @mention autocomplete config */
2416
+ mentions?: MentionConfig;
2417
+ /** Called when mentioned IDs change */
2418
+ onMentionIdsChange?: (ids: string[]) => void;
2419
+ }
2420
+ declare function MarkdownEditor({ value, onChange, placeholder, minHeight, className, disabled, showToolbar, mentions, onMentionIdsChange, }: MarkdownEditorProps): react_jsx_runtime.JSX.Element;
2421
+
2390
2422
  interface BlobUrlEntry {
2391
2423
  url: string;
2392
2424
  refCount: number;
@@ -2565,4 +2597,4 @@ declare function useBlobUrlCleanup(key: string | null): void;
2565
2597
  */
2566
2598
  declare function generateContentKey(content: ArrayBuffer): string;
2567
2599
 
2568
- export { ArrayFieldItemTemplate, ArrayFieldTemplate, type AspectRatioValue, type AudioLevels, AudioReactiveCover, type AudioReactiveCoverProps, BaseInputTemplate, type BlobSource, COLOR_SCHEMES, COLOR_SCHEME_INFO, CardLoadingFallback, CheckboxWidget, ColorWidget, type CreateLazyComponentOptions, type CreateVideoErrorFallbackOptions, CronScheduler, type CronSchedulerContextValue, type CronSchedulerProps, CronSchedulerProvider, type CronSchedulerState, CustomInput, type DASHSource, type DataUrlSource, DayChips, DiffEditor, type DiffEditorProps, EFFECT_ANIMATIONS, Editor, type EditorContextValue, type EditorFile, type EditorOptions, type EditorProps, EditorProvider, type EditorRef, type EffectColorScheme, type EffectColors, type EffectConfig$1 as EffectConfig, type EffectIntensity, type EffectLayer, type EffectVariant, type EqualizerOptions, type ErrorFallbackProps, ErrorListTemplate, FieldTemplate, GlowEffect, type GlowEffectData, type HLSSource, type HybridAudioContextValue, type HybridAudioControls, HybridAudioPlayer, type HybridAudioPlayerProps, HybridAudioProvider, type HybridAudioProviderProps, type HybridAudioState, type HybridCompactPlayerProps, HybridSimplePlayer, type HybridSimplePlayerProps, HybridWaveform, type HybridWaveformProps, type HybridWebAudioAPI, INTENSITY_CONFIG, INTENSITY_INFO, type ImageFile, ImageViewer, type ImageViewerProps, JsonSchemaForm, type JsonSchemaFormProps, JsonTreeComponent as JsonTree, type JsonTreeConfig, type JsonTreeProps, LazyCronScheduler, LazyHybridAudioPlayer, LazyHybridCompactPlayer, LazyHybridSimplePlayer, LazyImageViewer, LazyJsonSchemaForm, LazyJsonTree, LazyLottiePlayer, LazyMapContainer, LazyMapView, LazyMermaid, LazyOpenapiViewer, LazyPrettyCode, LazyVideoPlayer, LazyWrapper, type LazyWrapperProps, LoadingFallback, type LoadingFallbackProps, type LottieDirection, LottiePlayer, type LottiePlayerProps, type LottieSize, type LottieSpeed, type MapContainerProps, MapLoadingFallback, type MapStyleKey, type MapViewport, MarkdownMessage, type MarkdownMessageProps, type MarkerData, Mermaid, type MermaidProps, MeshEffect, type MonthDay, MonthDayGrid, NativeProvider, NumberWidget, ObjectFieldTemplate, Playground as OpenapiViewer, OrbsEffect, type PlayerMode, type PlaygroundConfig, type PlaygroundProps$1 as PlaygroundProps, PrettyCode, type PrettyCodeProps$1 as PrettyCodeProps, type ResolveFileSourceOptions, SchedulePreview, type ScheduleType, ScheduleTypeSelector, type SchemaSource, SelectWidget, type SimpleStreamSource, SliderWidget, Spinner, SpotlightEffect, StreamProvider, type StreamSource, SwitchWidget, TextWidget, TimeSelector, type UrlSource, type UseAudioBusReturn, type UseAudioVisualizationReturn, type UseCollapsibleContentOptions, type UseCollapsibleContentResult, type UseEditorReturn, type UseHybridAudioOptions, type UseHybridAudioReturn, type UseLottieOptions, type UseLottieReturn, type UseMonacoReturn, type UseVisualizationReturn, VARIANT_INFO, VideoControls, VideoErrorFallback, type VideoErrorFallbackProps, VideoPlayer, type VideoPlayerContextValue, type VideoPlayerProps, VideoPlayerProvider, type VideoPlayerProviderProps, type VideoPlayerRef, type VideoSourceUnion, VidstackProvider, type VimeoSource, type VisualizationColorScheme, type VisualizationIntensity, VisualizationProvider, type VisualizationProviderProps, type VisualizationSettings, type VisualizationVariant, type WeekDay, type YouTubeSource, buildCron, calculateGlowLayers, calculateMeshGradients, calculateOrbs, calculateSpotlight, createLazyComponent, createVideoErrorFallback, formatTime, generateContentKey, getColors, getEffectConfig, getRequiredFields, hasRequiredFields, humanizeCron, isSimpleStreamSource, isValidCron, mergeDefaults, normalizeFormData, parseCron, prepareEffectColors, resolveFileSource, resolvePlayerMode, resolveStreamSource, safeJsonParse, safeJsonStringify, useAudioBus, useAudioBusStore, useAudioCache, useAudioVisualization, useBlobUrlCleanup, useCollapsibleContent, useCronCustom, useCronMonthDays, useCronPreview, useCronScheduler, useCronSchedulerContext, useCronTime, useCronType, useCronWeekDays, useEditor, useEditorContext, useHybridAudio, useHybridAudioAnalysis, useHybridAudioContext, useHybridAudioControls, useHybridAudioLevels, useHybridAudioState, useHybridWebAudio, useImageCache, useLanguage, useLottie, useMediaCacheStore, useMonaco, useVideoCache, useVideoPlayerContext, useVideoPlayerSettings, useVisualization, validateRequiredFields, validateSchema };
2600
+ export { ArrayFieldItemTemplate, ArrayFieldTemplate, type AspectRatioValue, type AudioLevels, AudioReactiveCover, type AudioReactiveCoverProps, BaseInputTemplate, type BlobSource, COLOR_SCHEMES, COLOR_SCHEME_INFO, CardLoadingFallback, CheckboxWidget, ColorWidget, type CreateLazyComponentOptions, type CreateVideoErrorFallbackOptions, CronScheduler, type CronSchedulerContextValue, type CronSchedulerProps, CronSchedulerProvider, type CronSchedulerState, CustomInput, type DASHSource, type DataUrlSource, DayChips, DiffEditor, type DiffEditorProps, EFFECT_ANIMATIONS, Editor, type EditorContextValue, type EditorFile, type EditorOptions, type EditorProps, EditorProvider, type EditorRef, type EffectColorScheme, type EffectColors, type EffectConfig$1 as EffectConfig, type EffectIntensity, type EffectLayer, type EffectVariant, type EqualizerOptions, type ErrorFallbackProps, ErrorListTemplate, FieldTemplate, GlowEffect, type GlowEffectData, type HLSSource, type HybridAudioContextValue, type HybridAudioControls, HybridAudioPlayer, type HybridAudioPlayerProps, HybridAudioProvider, type HybridAudioProviderProps, type HybridAudioState, type HybridCompactPlayerProps, HybridSimplePlayer, type HybridSimplePlayerProps, HybridWaveform, type HybridWaveformProps, type HybridWebAudioAPI, INTENSITY_CONFIG, INTENSITY_INFO, type ImageFile, ImageViewer, type ImageViewerProps, JsonSchemaForm, type JsonSchemaFormProps, JsonTreeComponent as JsonTree, type JsonTreeConfig, type JsonTreeProps, LazyCronScheduler, LazyHybridAudioPlayer, LazyHybridCompactPlayer, LazyHybridSimplePlayer, LazyImageViewer, LazyJsonSchemaForm, LazyJsonTree, LazyLottiePlayer, LazyMapContainer, LazyMapView, LazyMermaid, LazyOpenapiViewer, LazyPrettyCode, LazyVideoPlayer, LazyWrapper, type LazyWrapperProps, LoadingFallback, type LoadingFallbackProps, type LottieDirection, LottiePlayer, type LottiePlayerProps, type LottieSize, type LottieSpeed, type MapContainerProps, MapLoadingFallback, type MapStyleKey, type MapViewport, MarkdownEditor, type MarkdownEditorProps, MarkdownMessage, type MarkdownMessageProps, type MarkerData, type MentionConfig, type MentionItem, Mermaid, type MermaidProps, MeshEffect, type MonthDay, MonthDayGrid, NativeProvider, NumberWidget, ObjectFieldTemplate, Playground as OpenapiViewer, OrbsEffect, type PlayerMode, type PlaygroundConfig, type PlaygroundProps$1 as PlaygroundProps, PrettyCode, type PrettyCodeProps$1 as PrettyCodeProps, type ResolveFileSourceOptions, SchedulePreview, type ScheduleType, ScheduleTypeSelector, type SchemaSource, SelectWidget, type SimpleStreamSource, SliderWidget, Spinner, SpotlightEffect, StreamProvider, type StreamSource, SwitchWidget, TextWidget, TimeSelector, type UrlSource, type UseAudioBusReturn, type UseAudioVisualizationReturn, type UseCollapsibleContentOptions, type UseCollapsibleContentResult, type UseEditorReturn, type UseHybridAudioOptions, type UseHybridAudioReturn, type UseLottieOptions, type UseLottieReturn, type UseMonacoReturn, type UseVisualizationReturn, VARIANT_INFO, VideoControls, VideoErrorFallback, type VideoErrorFallbackProps, VideoPlayer, type VideoPlayerContextValue, type VideoPlayerProps, VideoPlayerProvider, type VideoPlayerProviderProps, type VideoPlayerRef, type VideoSourceUnion, VidstackProvider, type VimeoSource, type VisualizationColorScheme, type VisualizationIntensity, VisualizationProvider, type VisualizationProviderProps, type VisualizationSettings, type VisualizationVariant, type WeekDay, type YouTubeSource, buildCron, calculateGlowLayers, calculateMeshGradients, calculateOrbs, calculateSpotlight, createLazyComponent, createVideoErrorFallback, formatTime, generateContentKey, getColors, getEffectConfig, getRequiredFields, hasRequiredFields, humanizeCron, isSimpleStreamSource, isValidCron, mergeDefaults, normalizeFormData, parseCron, prepareEffectColors, resolveFileSource, resolvePlayerMode, resolveStreamSource, safeJsonParse, safeJsonStringify, useAudioBus, useAudioBusStore, useAudioCache, useAudioVisualization, useBlobUrlCleanup, useCollapsibleContent, useCronCustom, useCronMonthDays, useCronPreview, useCronScheduler, useCronSchedulerContext, useCronTime, useCronType, useCronWeekDays, useEditor, useEditorContext, useHybridAudio, useHybridAudioAnalysis, useHybridAudioContext, useHybridAudioControls, useHybridAudioLevels, useHybridAudioState, useHybridWebAudio, useImageCache, useLanguage, useLottie, useMediaCacheStore, useMonaco, useVideoCache, useVideoPlayerContext, useVideoPlayerSettings, useVisualization, validateRequiredFields, validateSchema };
package/dist/index.d.ts CHANGED
@@ -2387,6 +2387,38 @@ declare function useEditor(): UseEditorReturn;
2387
2387
  */
2388
2388
  declare function useLanguage(filename: string | undefined): string;
2389
2389
 
2390
+ /** Item that can be mentioned via @ trigger */
2391
+ interface MentionItem {
2392
+ id: string;
2393
+ label: string;
2394
+ description?: string;
2395
+ thumbnail?: string;
2396
+ }
2397
+ /** Mention configuration */
2398
+ interface MentionConfig {
2399
+ /** Trigger character (default: '@') */
2400
+ trigger?: string;
2401
+ /** Available items */
2402
+ items: MentionItem[];
2403
+ /** Max dropdown items (default: 5) */
2404
+ maxItems?: number;
2405
+ }
2406
+
2407
+ interface MarkdownEditorProps {
2408
+ value: string;
2409
+ onChange: (value: string) => void;
2410
+ placeholder?: string;
2411
+ minHeight?: number;
2412
+ className?: string;
2413
+ disabled?: boolean;
2414
+ showToolbar?: boolean;
2415
+ /** @mention autocomplete config */
2416
+ mentions?: MentionConfig;
2417
+ /** Called when mentioned IDs change */
2418
+ onMentionIdsChange?: (ids: string[]) => void;
2419
+ }
2420
+ declare function MarkdownEditor({ value, onChange, placeholder, minHeight, className, disabled, showToolbar, mentions, onMentionIdsChange, }: MarkdownEditorProps): react_jsx_runtime.JSX.Element;
2421
+
2390
2422
  interface BlobUrlEntry {
2391
2423
  url: string;
2392
2424
  refCount: number;
@@ -2565,4 +2597,4 @@ declare function useBlobUrlCleanup(key: string | null): void;
2565
2597
  */
2566
2598
  declare function generateContentKey(content: ArrayBuffer): string;
2567
2599
 
2568
- export { ArrayFieldItemTemplate, ArrayFieldTemplate, type AspectRatioValue, type AudioLevels, AudioReactiveCover, type AudioReactiveCoverProps, BaseInputTemplate, type BlobSource, COLOR_SCHEMES, COLOR_SCHEME_INFO, CardLoadingFallback, CheckboxWidget, ColorWidget, type CreateLazyComponentOptions, type CreateVideoErrorFallbackOptions, CronScheduler, type CronSchedulerContextValue, type CronSchedulerProps, CronSchedulerProvider, type CronSchedulerState, CustomInput, type DASHSource, type DataUrlSource, DayChips, DiffEditor, type DiffEditorProps, EFFECT_ANIMATIONS, Editor, type EditorContextValue, type EditorFile, type EditorOptions, type EditorProps, EditorProvider, type EditorRef, type EffectColorScheme, type EffectColors, type EffectConfig$1 as EffectConfig, type EffectIntensity, type EffectLayer, type EffectVariant, type EqualizerOptions, type ErrorFallbackProps, ErrorListTemplate, FieldTemplate, GlowEffect, type GlowEffectData, type HLSSource, type HybridAudioContextValue, type HybridAudioControls, HybridAudioPlayer, type HybridAudioPlayerProps, HybridAudioProvider, type HybridAudioProviderProps, type HybridAudioState, type HybridCompactPlayerProps, HybridSimplePlayer, type HybridSimplePlayerProps, HybridWaveform, type HybridWaveformProps, type HybridWebAudioAPI, INTENSITY_CONFIG, INTENSITY_INFO, type ImageFile, ImageViewer, type ImageViewerProps, JsonSchemaForm, type JsonSchemaFormProps, JsonTreeComponent as JsonTree, type JsonTreeConfig, type JsonTreeProps, LazyCronScheduler, LazyHybridAudioPlayer, LazyHybridCompactPlayer, LazyHybridSimplePlayer, LazyImageViewer, LazyJsonSchemaForm, LazyJsonTree, LazyLottiePlayer, LazyMapContainer, LazyMapView, LazyMermaid, LazyOpenapiViewer, LazyPrettyCode, LazyVideoPlayer, LazyWrapper, type LazyWrapperProps, LoadingFallback, type LoadingFallbackProps, type LottieDirection, LottiePlayer, type LottiePlayerProps, type LottieSize, type LottieSpeed, type MapContainerProps, MapLoadingFallback, type MapStyleKey, type MapViewport, MarkdownMessage, type MarkdownMessageProps, type MarkerData, Mermaid, type MermaidProps, MeshEffect, type MonthDay, MonthDayGrid, NativeProvider, NumberWidget, ObjectFieldTemplate, Playground as OpenapiViewer, OrbsEffect, type PlayerMode, type PlaygroundConfig, type PlaygroundProps$1 as PlaygroundProps, PrettyCode, type PrettyCodeProps$1 as PrettyCodeProps, type ResolveFileSourceOptions, SchedulePreview, type ScheduleType, ScheduleTypeSelector, type SchemaSource, SelectWidget, type SimpleStreamSource, SliderWidget, Spinner, SpotlightEffect, StreamProvider, type StreamSource, SwitchWidget, TextWidget, TimeSelector, type UrlSource, type UseAudioBusReturn, type UseAudioVisualizationReturn, type UseCollapsibleContentOptions, type UseCollapsibleContentResult, type UseEditorReturn, type UseHybridAudioOptions, type UseHybridAudioReturn, type UseLottieOptions, type UseLottieReturn, type UseMonacoReturn, type UseVisualizationReturn, VARIANT_INFO, VideoControls, VideoErrorFallback, type VideoErrorFallbackProps, VideoPlayer, type VideoPlayerContextValue, type VideoPlayerProps, VideoPlayerProvider, type VideoPlayerProviderProps, type VideoPlayerRef, type VideoSourceUnion, VidstackProvider, type VimeoSource, type VisualizationColorScheme, type VisualizationIntensity, VisualizationProvider, type VisualizationProviderProps, type VisualizationSettings, type VisualizationVariant, type WeekDay, type YouTubeSource, buildCron, calculateGlowLayers, calculateMeshGradients, calculateOrbs, calculateSpotlight, createLazyComponent, createVideoErrorFallback, formatTime, generateContentKey, getColors, getEffectConfig, getRequiredFields, hasRequiredFields, humanizeCron, isSimpleStreamSource, isValidCron, mergeDefaults, normalizeFormData, parseCron, prepareEffectColors, resolveFileSource, resolvePlayerMode, resolveStreamSource, safeJsonParse, safeJsonStringify, useAudioBus, useAudioBusStore, useAudioCache, useAudioVisualization, useBlobUrlCleanup, useCollapsibleContent, useCronCustom, useCronMonthDays, useCronPreview, useCronScheduler, useCronSchedulerContext, useCronTime, useCronType, useCronWeekDays, useEditor, useEditorContext, useHybridAudio, useHybridAudioAnalysis, useHybridAudioContext, useHybridAudioControls, useHybridAudioLevels, useHybridAudioState, useHybridWebAudio, useImageCache, useLanguage, useLottie, useMediaCacheStore, useMonaco, useVideoCache, useVideoPlayerContext, useVideoPlayerSettings, useVisualization, validateRequiredFields, validateSchema };
2600
+ export { ArrayFieldItemTemplate, ArrayFieldTemplate, type AspectRatioValue, type AudioLevels, AudioReactiveCover, type AudioReactiveCoverProps, BaseInputTemplate, type BlobSource, COLOR_SCHEMES, COLOR_SCHEME_INFO, CardLoadingFallback, CheckboxWidget, ColorWidget, type CreateLazyComponentOptions, type CreateVideoErrorFallbackOptions, CronScheduler, type CronSchedulerContextValue, type CronSchedulerProps, CronSchedulerProvider, type CronSchedulerState, CustomInput, type DASHSource, type DataUrlSource, DayChips, DiffEditor, type DiffEditorProps, EFFECT_ANIMATIONS, Editor, type EditorContextValue, type EditorFile, type EditorOptions, type EditorProps, EditorProvider, type EditorRef, type EffectColorScheme, type EffectColors, type EffectConfig$1 as EffectConfig, type EffectIntensity, type EffectLayer, type EffectVariant, type EqualizerOptions, type ErrorFallbackProps, ErrorListTemplate, FieldTemplate, GlowEffect, type GlowEffectData, type HLSSource, type HybridAudioContextValue, type HybridAudioControls, HybridAudioPlayer, type HybridAudioPlayerProps, HybridAudioProvider, type HybridAudioProviderProps, type HybridAudioState, type HybridCompactPlayerProps, HybridSimplePlayer, type HybridSimplePlayerProps, HybridWaveform, type HybridWaveformProps, type HybridWebAudioAPI, INTENSITY_CONFIG, INTENSITY_INFO, type ImageFile, ImageViewer, type ImageViewerProps, JsonSchemaForm, type JsonSchemaFormProps, JsonTreeComponent as JsonTree, type JsonTreeConfig, type JsonTreeProps, LazyCronScheduler, LazyHybridAudioPlayer, LazyHybridCompactPlayer, LazyHybridSimplePlayer, LazyImageViewer, LazyJsonSchemaForm, LazyJsonTree, LazyLottiePlayer, LazyMapContainer, LazyMapView, LazyMermaid, LazyOpenapiViewer, LazyPrettyCode, LazyVideoPlayer, LazyWrapper, type LazyWrapperProps, LoadingFallback, type LoadingFallbackProps, type LottieDirection, LottiePlayer, type LottiePlayerProps, type LottieSize, type LottieSpeed, type MapContainerProps, MapLoadingFallback, type MapStyleKey, type MapViewport, MarkdownEditor, type MarkdownEditorProps, MarkdownMessage, type MarkdownMessageProps, type MarkerData, type MentionConfig, type MentionItem, Mermaid, type MermaidProps, MeshEffect, type MonthDay, MonthDayGrid, NativeProvider, NumberWidget, ObjectFieldTemplate, Playground as OpenapiViewer, OrbsEffect, type PlayerMode, type PlaygroundConfig, type PlaygroundProps$1 as PlaygroundProps, PrettyCode, type PrettyCodeProps$1 as PrettyCodeProps, type ResolveFileSourceOptions, SchedulePreview, type ScheduleType, ScheduleTypeSelector, type SchemaSource, SelectWidget, type SimpleStreamSource, SliderWidget, Spinner, SpotlightEffect, StreamProvider, type StreamSource, SwitchWidget, TextWidget, TimeSelector, type UrlSource, type UseAudioBusReturn, type UseAudioVisualizationReturn, type UseCollapsibleContentOptions, type UseCollapsibleContentResult, type UseEditorReturn, type UseHybridAudioOptions, type UseHybridAudioReturn, type UseLottieOptions, type UseLottieReturn, type UseMonacoReturn, type UseVisualizationReturn, VARIANT_INFO, VideoControls, VideoErrorFallback, type VideoErrorFallbackProps, VideoPlayer, type VideoPlayerContextValue, type VideoPlayerProps, VideoPlayerProvider, type VideoPlayerProviderProps, type VideoPlayerRef, type VideoSourceUnion, VidstackProvider, type VimeoSource, type VisualizationColorScheme, type VisualizationIntensity, VisualizationProvider, type VisualizationProviderProps, type VisualizationSettings, type VisualizationVariant, type WeekDay, type YouTubeSource, buildCron, calculateGlowLayers, calculateMeshGradients, calculateOrbs, calculateSpotlight, createLazyComponent, createVideoErrorFallback, formatTime, generateContentKey, getColors, getEffectConfig, getRequiredFields, hasRequiredFields, humanizeCron, isSimpleStreamSource, isValidCron, mergeDefaults, normalizeFormData, parseCron, prepareEffectColors, resolveFileSource, resolvePlayerMode, resolveStreamSource, safeJsonParse, safeJsonStringify, useAudioBus, useAudioBusStore, useAudioCache, useAudioVisualization, useBlobUrlCleanup, useCollapsibleContent, useCronCustom, useCronMonthDays, useCronPreview, useCronScheduler, useCronSchedulerContext, useCronTime, useCronType, useCronWeekDays, useEditor, useEditorContext, useHybridAudio, useHybridAudioAnalysis, useHybridAudioContext, useHybridAudioControls, useHybridAudioLevels, useHybridAudioState, useHybridWebAudio, useImageCache, useLanguage, useLottie, useMediaCacheStore, useMonaco, useVideoCache, useVideoPlayerContext, useVideoPlayerSettings, useVisualization, validateRequiredFields, validateSchema };
package/dist/index.mjs CHANGED
@@ -21,6 +21,12 @@ import remarkGfm from 'remark-gfm';
21
21
  import { CopyButton } from '@djangocfg/ui-core/components';
22
22
  import { useResolvedTheme } from '@djangocfg/ui-core/hooks';
23
23
  import '@djangocfg/ui-core/styles/palette';
24
+ import { ReactRenderer, useEditor as useEditor$1, EditorContent } from '@tiptap/react';
25
+ import StarterKit from '@tiptap/starter-kit';
26
+ import Placeholder from '@tiptap/extension-placeholder';
27
+ import Mention from '@tiptap/extension-mention';
28
+ import { Markdown } from '@tiptap/markdown';
29
+ import { Bold, Italic, Strikethrough, Code, Heading1, Heading2, Heading3, List, ListOrdered, Quote, Minus } from 'lucide-react';
24
30
 
25
31
  function Spinner({ className }) {
26
32
  const t = useAppT();
@@ -1604,7 +1610,218 @@ function useLanguage(filename) {
1604
1610
  }, [filename]);
1605
1611
  }
1606
1612
  __name(useLanguage, "useLanguage");
1613
+ var MentionList = forwardRef(
1614
+ ({ items, command }, ref) => {
1615
+ const [selectedIndex, setSelectedIndex] = useState(0);
1616
+ useEffect(() => setSelectedIndex(0), [items]);
1617
+ const select = useCallback(
1618
+ (index) => {
1619
+ const item = items[index];
1620
+ if (item) command(item);
1621
+ },
1622
+ [items, command]
1623
+ );
1624
+ useImperativeHandle(ref, () => ({
1625
+ onKeyDown: /* @__PURE__ */ __name((event) => {
1626
+ if (event.key === "ArrowUp") {
1627
+ setSelectedIndex((i) => (i + items.length - 1) % items.length);
1628
+ return true;
1629
+ }
1630
+ if (event.key === "ArrowDown") {
1631
+ setSelectedIndex((i) => (i + 1) % items.length);
1632
+ return true;
1633
+ }
1634
+ if (event.key === "Enter") {
1635
+ select(selectedIndex);
1636
+ return true;
1637
+ }
1638
+ return false;
1639
+ }, "onKeyDown")
1640
+ }));
1641
+ if (items.length === 0) return null;
1642
+ return /* @__PURE__ */ jsx("div", { className: "markdown-mention-list", children: items.map((item, i) => {
1643
+ const isSelected = i === selectedIndex;
1644
+ const cls = `markdown-mention-item ${isSelected ? "selected" : ""}`;
1645
+ return /* @__PURE__ */ jsxs("button", { type: "button", className: cls, onClick: () => select(i), children: [
1646
+ item.thumbnail && /* @__PURE__ */ jsx("img", { src: item.thumbnail, alt: "", className: "markdown-mention-avatar" }),
1647
+ /* @__PURE__ */ jsxs("div", { className: "markdown-mention-info", children: [
1648
+ /* @__PURE__ */ jsx("span", { className: "markdown-mention-name", children: item.label }),
1649
+ item.description && /* @__PURE__ */ jsx("span", { className: "markdown-mention-desc", children: item.description })
1650
+ ] })
1651
+ ] }, item.id);
1652
+ }) });
1653
+ }
1654
+ );
1655
+ MentionList.displayName = "MentionList";
1656
+
1657
+ // src/tools/MarkdownEditor/createMentionSuggestion.ts
1658
+ function createMentionSuggestion(config) {
1659
+ const { maxItems = 5, trigger = "@" } = config;
1660
+ return {
1661
+ char: trigger,
1662
+ items: /* @__PURE__ */ __name(({ query }) => {
1663
+ const q = query.toLowerCase();
1664
+ return config.items.filter((item) => item.label.toLowerCase().includes(q)).slice(0, maxItems);
1665
+ }, "items"),
1666
+ render: /* @__PURE__ */ __name(() => {
1667
+ let component = null;
1668
+ let popup = null;
1669
+ return {
1670
+ onStart: /* @__PURE__ */ __name((props) => {
1671
+ component = new ReactRenderer(MentionList, {
1672
+ props: {
1673
+ items: props.items,
1674
+ command: /* @__PURE__ */ __name((item) => {
1675
+ props.command({ id: item.id, label: item.label });
1676
+ }, "command")
1677
+ },
1678
+ editor: props.editor
1679
+ });
1680
+ popup = document.createElement("div");
1681
+ popup.style.cssText = "position: absolute; z-index: 99999;";
1682
+ popup.appendChild(component.element);
1683
+ const rect = props.clientRect?.();
1684
+ if (rect) {
1685
+ popup.style.top = `${rect.bottom + window.scrollY + 4}px`;
1686
+ popup.style.left = `${rect.left + window.scrollX}px`;
1687
+ }
1688
+ document.body.appendChild(popup);
1689
+ }, "onStart"),
1690
+ onUpdate: /* @__PURE__ */ __name((props) => {
1691
+ component?.updateProps({
1692
+ items: props.items,
1693
+ command: /* @__PURE__ */ __name((item) => {
1694
+ props.command({ id: item.id, label: item.label });
1695
+ }, "command")
1696
+ });
1697
+ const rect = props.clientRect?.();
1698
+ if (rect && popup) {
1699
+ popup.style.top = `${rect.bottom + window.scrollY + 4}px`;
1700
+ popup.style.left = `${rect.left + window.scrollX}px`;
1701
+ }
1702
+ }, "onUpdate"),
1703
+ onKeyDown: /* @__PURE__ */ __name((props) => {
1704
+ if (props.event.key === "Escape") {
1705
+ popup?.remove();
1706
+ component?.destroy();
1707
+ return true;
1708
+ }
1709
+ return component?.ref?.onKeyDown(props.event) ?? false;
1710
+ }, "onKeyDown"),
1711
+ onExit: /* @__PURE__ */ __name(() => {
1712
+ popup?.remove();
1713
+ component?.destroy();
1714
+ }, "onExit")
1715
+ };
1716
+ }, "render")
1717
+ };
1718
+ }
1719
+ __name(createMentionSuggestion, "createMentionSuggestion");
1720
+ function getMarkdown(editor) {
1721
+ const storage = editor.storage.markdown;
1722
+ if (!storage?.manager) return editor.getText();
1723
+ return storage.manager.serialize(editor.getJSON());
1724
+ }
1725
+ __name(getMarkdown, "getMarkdown");
1726
+ function extractMentionIds(editor) {
1727
+ const ids = [];
1728
+ editor.state.doc.descendants((node) => {
1729
+ if (node.type.name === "mention" && node.attrs.id) {
1730
+ ids.push(node.attrs.id);
1731
+ }
1732
+ });
1733
+ return [...new Set(ids)];
1734
+ }
1735
+ __name(extractMentionIds, "extractMentionIds");
1736
+ function MarkdownEditor({
1737
+ value,
1738
+ onChange,
1739
+ placeholder = "Write markdown...",
1740
+ minHeight = 120,
1741
+ className = "",
1742
+ disabled = false,
1743
+ showToolbar = true,
1744
+ mentions,
1745
+ onMentionIdsChange
1746
+ }) {
1747
+ const isExternalUpdate = useRef(false);
1748
+ const extensions = useMemo(() => {
1749
+ const exts = [
1750
+ StarterKit.configure({ heading: { levels: [1, 2, 3] } }),
1751
+ Placeholder.configure({ placeholder }),
1752
+ Markdown
1753
+ ];
1754
+ if (mentions) {
1755
+ exts.push(
1756
+ Mention.configure({
1757
+ HTMLAttributes: { class: "markdown-mention" },
1758
+ suggestion: createMentionSuggestion(mentions),
1759
+ renderText: /* @__PURE__ */ __name(({ node }) => `@${node.attrs.label}`, "renderText")
1760
+ })
1761
+ );
1762
+ }
1763
+ return exts;
1764
+ }, [placeholder, mentions]);
1765
+ const editor = useEditor$1({
1766
+ immediatelyRender: false,
1767
+ editable: !disabled,
1768
+ extensions,
1769
+ content: value,
1770
+ onUpdate: /* @__PURE__ */ __name(({ editor: editor2 }) => {
1771
+ if (isExternalUpdate.current) return;
1772
+ onChange(getMarkdown(editor2));
1773
+ if (onMentionIdsChange) {
1774
+ onMentionIdsChange(extractMentionIds(editor2));
1775
+ }
1776
+ }, "onUpdate"),
1777
+ editorProps: {
1778
+ attributes: {
1779
+ class: "markdown-editor-content focus:outline-none text-sm",
1780
+ style: `min-height: ${minHeight}px`
1781
+ }
1782
+ }
1783
+ });
1784
+ useEffect(() => {
1785
+ if (!editor) return;
1786
+ const current = getMarkdown(editor);
1787
+ if (current !== value) {
1788
+ isExternalUpdate.current = true;
1789
+ editor.commands.setContent(value);
1790
+ isExternalUpdate.current = false;
1791
+ }
1792
+ }, [value, editor]);
1793
+ const wrapperClass = `markdown-editor rounded-md border border-input bg-background ${disabled ? "opacity-60" : ""} ${className}`.trim();
1794
+ return /* @__PURE__ */ jsxs("div", { className: wrapperClass, children: [
1795
+ showToolbar && editor && /* @__PURE__ */ jsx(MarkdownToolbar, { editor }),
1796
+ /* @__PURE__ */ jsx("div", { className: "px-3 py-2", children: /* @__PURE__ */ jsx(EditorContent, { editor }) })
1797
+ ] });
1798
+ }
1799
+ __name(MarkdownEditor, "MarkdownEditor");
1800
+ function MarkdownToolbar({ editor }) {
1801
+ const items = useMemo(() => [
1802
+ { icon: Bold, title: "Bold", action: /* @__PURE__ */ __name(() => editor.chain().focus().toggleBold().run(), "action"), active: editor.isActive("bold") },
1803
+ { icon: Italic, title: "Italic", action: /* @__PURE__ */ __name(() => editor.chain().focus().toggleItalic().run(), "action"), active: editor.isActive("italic") },
1804
+ { icon: Strikethrough, title: "Strike", action: /* @__PURE__ */ __name(() => editor.chain().focus().toggleStrike().run(), "action"), active: editor.isActive("strike") },
1805
+ { icon: Code, title: "Code", action: /* @__PURE__ */ __name(() => editor.chain().focus().toggleCode().run(), "action"), active: editor.isActive("code") },
1806
+ null,
1807
+ { icon: Heading1, title: "H1", action: /* @__PURE__ */ __name(() => editor.chain().focus().toggleHeading({ level: 1 }).run(), "action"), active: editor.isActive("heading", { level: 1 }) },
1808
+ { icon: Heading2, title: "H2", action: /* @__PURE__ */ __name(() => editor.chain().focus().toggleHeading({ level: 2 }).run(), "action"), active: editor.isActive("heading", { level: 2 }) },
1809
+ { icon: Heading3, title: "H3", action: /* @__PURE__ */ __name(() => editor.chain().focus().toggleHeading({ level: 3 }).run(), "action"), active: editor.isActive("heading", { level: 3 }) },
1810
+ null,
1811
+ { icon: List, title: "Bullet list", action: /* @__PURE__ */ __name(() => editor.chain().focus().toggleBulletList().run(), "action"), active: editor.isActive("bulletList") },
1812
+ { icon: ListOrdered, title: "Ordered list", action: /* @__PURE__ */ __name(() => editor.chain().focus().toggleOrderedList().run(), "action"), active: editor.isActive("orderedList") },
1813
+ { icon: Quote, title: "Quote", action: /* @__PURE__ */ __name(() => editor.chain().focus().toggleBlockquote().run(), "action"), active: editor.isActive("blockquote") },
1814
+ { icon: Minus, title: "Divider", action: /* @__PURE__ */ __name(() => editor.chain().focus().setHorizontalRule().run(), "action"), active: false }
1815
+ ], [editor]);
1816
+ return /* @__PURE__ */ jsx("div", { className: "flex items-center gap-0.5 px-2 py-1.5 border-b border-border", children: items.map((item, i) => {
1817
+ if (!item) return /* @__PURE__ */ jsx("div", { className: "w-px h-4 bg-border mx-1" }, i);
1818
+ const Icon = item.icon;
1819
+ const btnClass = `markdown-toolbar-btn ${item.active ? "active" : ""}`;
1820
+ return /* @__PURE__ */ jsx("button", { type: "button", onClick: item.action, title: item.title, className: btnClass, children: /* @__PURE__ */ jsx(Icon, { style: { width: 14, height: 14 } }) }, i);
1821
+ }) });
1822
+ }
1823
+ __name(MarkdownToolbar, "MarkdownToolbar");
1607
1824
 
1608
- export { CardLoadingFallback, CronScheduler, DiffEditor, Editor, EditorProvider, LazyCronScheduler, LazyHybridAudioPlayer, LazyHybridCompactPlayer, LazyHybridSimplePlayer, LazyImageViewer, LazyJsonSchemaForm, LazyJsonTree, LazyLottiePlayer, LazyMapContainer, LazyMapView, LazyMermaid, LazyOpenapiViewer, LazyPrettyCode, LazyVideoPlayer, LazyWrapper, LoadingFallback, LottiePlayer, MapLoadingFallback, MarkdownMessage, Mermaid_default as Mermaid, OpenapiViewer_default as OpenapiViewer, Spinner, createLazyComponent, useCollapsibleContent, useEditor, useEditorContext, useLanguage, useMonaco };
1825
+ export { CardLoadingFallback, CronScheduler, DiffEditor, Editor, EditorProvider, LazyCronScheduler, LazyHybridAudioPlayer, LazyHybridCompactPlayer, LazyHybridSimplePlayer, LazyImageViewer, LazyJsonSchemaForm, LazyJsonTree, LazyLottiePlayer, LazyMapContainer, LazyMapView, LazyMermaid, LazyOpenapiViewer, LazyPrettyCode, LazyVideoPlayer, LazyWrapper, LoadingFallback, LottiePlayer, MapLoadingFallback, MarkdownEditor, MarkdownMessage, Mermaid_default as Mermaid, OpenapiViewer_default as OpenapiViewer, Spinner, createLazyComponent, useCollapsibleContent, useEditor, useEditorContext, useLanguage, useMonaco };
1609
1826
  //# sourceMappingURL=index.mjs.map
1610
1827
  //# sourceMappingURL=index.mjs.map