@djangocfg/ui-tools 2.1.291 → 2.1.293

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.d.cts CHANGED
@@ -374,11 +374,11 @@ interface PlaygroundConfig {
374
374
  * rendered back-to-back in the docs column. Scrollspy picks the
375
375
  * active schema based on what's visible. */
376
376
  schemaGrouping?: 'selector' | 'sections';
377
- /** Optional URL-hash sync. When enabled, the viewer reads/writes
378
- * ``#<schemaId>/<anchor>`` on the browser location. Falsy value (the
379
- * default) keeps the viewer hash-free. Set to an object with
380
- * ``{ enabled: true }`` to opt in; future fields (e.g. a custom
381
- * adapter) stay backwards compatible. */
377
+ /** URL-hash sync. When enabled, the viewer reads/writes
378
+ * ``#<schemaId>/<anchor>`` on the browser location so deep-links
379
+ * to a specific endpoint work out of the box. Defaults to ``true``
380
+ * pass ``false`` (or ``{ enabled: false }``) to opt out if the host
381
+ * page already manages the hash itself. */
382
382
  urlSync?: boolean | {
383
383
  enabled: boolean;
384
384
  };
@@ -2455,6 +2455,25 @@ interface MentionItem {
2455
2455
  description?: string;
2456
2456
  thumbnail?: string;
2457
2457
  }
2458
+ /**
2459
+ * Attributes available when rendering a mention to markdown.
2460
+ *
2461
+ * Same shape Tiptap stores on the `mention` node — `id` is the stable
2462
+ * identifier the suggestion popover injected, `label` is the human text
2463
+ * shown to the user. Either field may be empty if the upstream config
2464
+ * never populated it; renderers should fall back accordingly.
2465
+ */
2466
+ interface MentionAttrs {
2467
+ id: string;
2468
+ label: string;
2469
+ }
2470
+ /**
2471
+ * Function that converts a mention node into its markdown serialization.
2472
+ *
2473
+ * The returned string is what `@tiptap/markdown` writes into the markdown
2474
+ * output of `MarkdownEditor.getMarkdown()`.
2475
+ */
2476
+ type MentionMarkdownRenderer = (attrs: MentionAttrs) => string;
2458
2477
  /** Mention configuration */
2459
2478
  interface MentionConfig {
2460
2479
  /** Trigger character (default: '@') */
@@ -2463,6 +2482,18 @@ interface MentionConfig {
2463
2482
  items: MentionItem[];
2464
2483
  /** Max dropdown items (default: 5) */
2465
2484
  maxItems?: number;
2485
+ /**
2486
+ * Custom serializer for mentions when `MarkdownEditor.getMarkdown()` runs.
2487
+ *
2488
+ * Defaults to `mentionPresets.plainAt` which yields `@<label>` (or `@<id>`
2489
+ * when `label` is missing). Use one of `mentionPresets`, or supply your
2490
+ * own function for full control over how mentions appear in the output
2491
+ * markdown string.
2492
+ *
2493
+ * Note: this only affects the *markdown* output. `editor.getText()` and
2494
+ * the rendered DOM still go through `renderText` (`@<label>` by default).
2495
+ */
2496
+ renderMarkdown?: MentionMarkdownRenderer;
2466
2497
  }
2467
2498
 
2468
2499
  interface MarkdownEditorProps {
@@ -2496,6 +2527,35 @@ interface MarkdownEditorProps {
2496
2527
  }
2497
2528
  declare function MarkdownEditor({ value, onChange, placeholder, minHeight, className, disabled, showToolbar, mentions, onMentionIdsChange, }: MarkdownEditorProps): react_jsx_runtime.JSX.Element;
2498
2529
 
2530
+ /**
2531
+ * Built-in serializers for the `MentionConfig.renderMarkdown` callback.
2532
+ *
2533
+ * Pick one based on what consumes the markdown:
2534
+ *
2535
+ * - LLM / chat composer → `plainAt` (the default)
2536
+ * - Plain text export → `plainLabel`
2537
+ * - Web app with deep-link → `markdownLink(baseUrl)`
2538
+ * - Notion / Linear-style → `customUri(scheme, kind)`
2539
+ * - Slack-style id refs → `slackStyle`
2540
+ * - HTML-allowing renderer → `htmlSpan(className?)`
2541
+ *
2542
+ * Or pass a custom function — the type is just `(attrs) => string`.
2543
+ */
2544
+ declare const mentionPresets: {
2545
+ /** "@Label" — default, ideal for chat where LLMs read the text. */
2546
+ plainAt: MentionMarkdownRenderer;
2547
+ /** "Label" — bare label, no @ prefix. */
2548
+ plainLabel: MentionMarkdownRenderer;
2549
+ /** "[@Label](baseUrl/id)" — clickable markdown link. */
2550
+ markdownLink: (baseUrl: string) => MentionMarkdownRenderer;
2551
+ /** "@[Label](scheme://kind/id)" — Notion / Linear-style custom URI. */
2552
+ customUri: (scheme: string, kind: string) => MentionMarkdownRenderer;
2553
+ /** "<@id>" — Slack-style id-only reference (label dropped — receivers resolve it). */
2554
+ slackStyle: MentionMarkdownRenderer;
2555
+ /** Inline HTML span — for products that consume markdown with raw HTML allowed. */
2556
+ htmlSpan: (className?: string) => MentionMarkdownRenderer;
2557
+ };
2558
+
2499
2559
  interface BlobUrlEntry {
2500
2560
  url: string;
2501
2561
  refCount: number;
@@ -2674,4 +2734,4 @@ declare function useBlobUrlCleanup(key: string | null): void;
2674
2734
  */
2675
2735
  declare function generateContentKey(content: ArrayBuffer): string;
2676
2736
 
2677
- export { type ApiKey, 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 };
2737
+ export { type ApiKey, 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 MentionAttrs, type MentionConfig, type MentionItem, type MentionMarkdownRenderer, 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, mentionPresets, 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
@@ -374,11 +374,11 @@ interface PlaygroundConfig {
374
374
  * rendered back-to-back in the docs column. Scrollspy picks the
375
375
  * active schema based on what's visible. */
376
376
  schemaGrouping?: 'selector' | 'sections';
377
- /** Optional URL-hash sync. When enabled, the viewer reads/writes
378
- * ``#<schemaId>/<anchor>`` on the browser location. Falsy value (the
379
- * default) keeps the viewer hash-free. Set to an object with
380
- * ``{ enabled: true }`` to opt in; future fields (e.g. a custom
381
- * adapter) stay backwards compatible. */
377
+ /** URL-hash sync. When enabled, the viewer reads/writes
378
+ * ``#<schemaId>/<anchor>`` on the browser location so deep-links
379
+ * to a specific endpoint work out of the box. Defaults to ``true``
380
+ * pass ``false`` (or ``{ enabled: false }``) to opt out if the host
381
+ * page already manages the hash itself. */
382
382
  urlSync?: boolean | {
383
383
  enabled: boolean;
384
384
  };
@@ -2455,6 +2455,25 @@ interface MentionItem {
2455
2455
  description?: string;
2456
2456
  thumbnail?: string;
2457
2457
  }
2458
+ /**
2459
+ * Attributes available when rendering a mention to markdown.
2460
+ *
2461
+ * Same shape Tiptap stores on the `mention` node — `id` is the stable
2462
+ * identifier the suggestion popover injected, `label` is the human text
2463
+ * shown to the user. Either field may be empty if the upstream config
2464
+ * never populated it; renderers should fall back accordingly.
2465
+ */
2466
+ interface MentionAttrs {
2467
+ id: string;
2468
+ label: string;
2469
+ }
2470
+ /**
2471
+ * Function that converts a mention node into its markdown serialization.
2472
+ *
2473
+ * The returned string is what `@tiptap/markdown` writes into the markdown
2474
+ * output of `MarkdownEditor.getMarkdown()`.
2475
+ */
2476
+ type MentionMarkdownRenderer = (attrs: MentionAttrs) => string;
2458
2477
  /** Mention configuration */
2459
2478
  interface MentionConfig {
2460
2479
  /** Trigger character (default: '@') */
@@ -2463,6 +2482,18 @@ interface MentionConfig {
2463
2482
  items: MentionItem[];
2464
2483
  /** Max dropdown items (default: 5) */
2465
2484
  maxItems?: number;
2485
+ /**
2486
+ * Custom serializer for mentions when `MarkdownEditor.getMarkdown()` runs.
2487
+ *
2488
+ * Defaults to `mentionPresets.plainAt` which yields `@<label>` (or `@<id>`
2489
+ * when `label` is missing). Use one of `mentionPresets`, or supply your
2490
+ * own function for full control over how mentions appear in the output
2491
+ * markdown string.
2492
+ *
2493
+ * Note: this only affects the *markdown* output. `editor.getText()` and
2494
+ * the rendered DOM still go through `renderText` (`@<label>` by default).
2495
+ */
2496
+ renderMarkdown?: MentionMarkdownRenderer;
2466
2497
  }
2467
2498
 
2468
2499
  interface MarkdownEditorProps {
@@ -2496,6 +2527,35 @@ interface MarkdownEditorProps {
2496
2527
  }
2497
2528
  declare function MarkdownEditor({ value, onChange, placeholder, minHeight, className, disabled, showToolbar, mentions, onMentionIdsChange, }: MarkdownEditorProps): react_jsx_runtime.JSX.Element;
2498
2529
 
2530
+ /**
2531
+ * Built-in serializers for the `MentionConfig.renderMarkdown` callback.
2532
+ *
2533
+ * Pick one based on what consumes the markdown:
2534
+ *
2535
+ * - LLM / chat composer → `plainAt` (the default)
2536
+ * - Plain text export → `plainLabel`
2537
+ * - Web app with deep-link → `markdownLink(baseUrl)`
2538
+ * - Notion / Linear-style → `customUri(scheme, kind)`
2539
+ * - Slack-style id refs → `slackStyle`
2540
+ * - HTML-allowing renderer → `htmlSpan(className?)`
2541
+ *
2542
+ * Or pass a custom function — the type is just `(attrs) => string`.
2543
+ */
2544
+ declare const mentionPresets: {
2545
+ /** "@Label" — default, ideal for chat where LLMs read the text. */
2546
+ plainAt: MentionMarkdownRenderer;
2547
+ /** "Label" — bare label, no @ prefix. */
2548
+ plainLabel: MentionMarkdownRenderer;
2549
+ /** "[@Label](baseUrl/id)" — clickable markdown link. */
2550
+ markdownLink: (baseUrl: string) => MentionMarkdownRenderer;
2551
+ /** "@[Label](scheme://kind/id)" — Notion / Linear-style custom URI. */
2552
+ customUri: (scheme: string, kind: string) => MentionMarkdownRenderer;
2553
+ /** "<@id>" — Slack-style id-only reference (label dropped — receivers resolve it). */
2554
+ slackStyle: MentionMarkdownRenderer;
2555
+ /** Inline HTML span — for products that consume markdown with raw HTML allowed. */
2556
+ htmlSpan: (className?: string) => MentionMarkdownRenderer;
2557
+ };
2558
+
2499
2559
  interface BlobUrlEntry {
2500
2560
  url: string;
2501
2561
  refCount: number;
@@ -2674,4 +2734,4 @@ declare function useBlobUrlCleanup(key: string | null): void;
2674
2734
  */
2675
2735
  declare function generateContentKey(content: ArrayBuffer): string;
2676
2736
 
2677
- export { type ApiKey, 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 };
2737
+ export { type ApiKey, 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 MentionAttrs, type MentionConfig, type MentionItem, type MentionMarkdownRenderer, 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, mentionPresets, 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
@@ -23,6 +23,7 @@ import Placeholder from '@tiptap/extension-placeholder';
23
23
  import Mention from '@tiptap/extension-mention';
24
24
  import { Markdown } from '@tiptap/markdown';
25
25
  import { Bold, Italic, Strikethrough, Code, Heading1, Heading2, Heading3, List, ListOrdered, Quote, Minus } from 'lucide-react';
26
+ import { autoUpdate, computePosition, offset, flip, shift } from '@floating-ui/dom';
26
27
 
27
28
  function Spinner({ className }) {
28
29
  const t = useAppT();
@@ -237,7 +238,7 @@ function OpenapiLoadingFallback() {
237
238
  }
238
239
  __name(OpenapiLoadingFallback, "OpenapiLoadingFallback");
239
240
  var LazyDocsLayout = createLazyComponent(
240
- () => import('./DocsLayout-JPXFUKAR.mjs').then((mod) => ({ default: mod.DocsLayout })),
241
+ () => import('./DocsLayout-XB55R7YG.mjs').then((mod) => ({ default: mod.DocsLayout })),
241
242
  {
242
243
  displayName: "LazyDocsLayout",
243
244
  fallback: /* @__PURE__ */ jsx(OpenapiLoadingFallback, {})
@@ -392,7 +393,7 @@ function LottiePlayer(props) {
392
393
  }
393
394
  __name(LottiePlayer, "LottiePlayer");
394
395
  var DocsLayout = lazy(
395
- () => import('./DocsLayout-JPXFUKAR.mjs').then((mod) => ({ default: mod.DocsLayout }))
396
+ () => import('./DocsLayout-XB55R7YG.mjs').then((mod) => ({ default: mod.DocsLayout }))
396
397
  );
397
398
  var LoadingFallback7 = /* @__PURE__ */ __name(() => /* @__PURE__ */ jsx("div", { className: "flex items-center justify-center min-h-[400px]", children: /* @__PURE__ */ jsx("div", { className: "text-muted-foreground", children: "Loading API Playground..." }) }), "LoadingFallback");
398
399
  var Playground = /* @__PURE__ */ __name(({ config }) => {
@@ -1195,6 +1196,38 @@ function createMentionSuggestion(config) {
1195
1196
  render: /* @__PURE__ */ __name(() => {
1196
1197
  let component = null;
1197
1198
  let popup = null;
1199
+ let cleanupAutoUpdate = null;
1200
+ let getReferenceRect = null;
1201
+ const buildVirtualElement = /* @__PURE__ */ __name(() => ({
1202
+ getBoundingClientRect: /* @__PURE__ */ __name(() => {
1203
+ const rect = getReferenceRect?.();
1204
+ return rect ?? new DOMRect(0, 0, 0, 0);
1205
+ }, "getBoundingClientRect")
1206
+ }), "buildVirtualElement");
1207
+ const updatePosition = /* @__PURE__ */ __name(() => {
1208
+ if (!popup) return;
1209
+ const virtualEl = buildVirtualElement();
1210
+ void computePosition(virtualEl, popup, {
1211
+ placement: "bottom-start",
1212
+ middleware: [
1213
+ offset(4),
1214
+ flip({ fallbackPlacements: ["top-start"] }),
1215
+ shift({ padding: 8 })
1216
+ ]
1217
+ }).then(({ x, y }) => {
1218
+ if (!popup) return;
1219
+ popup.style.transform = `translate3d(${Math.round(x)}px, ${Math.round(y)}px, 0)`;
1220
+ });
1221
+ }, "updatePosition");
1222
+ const teardown = /* @__PURE__ */ __name(() => {
1223
+ cleanupAutoUpdate?.();
1224
+ cleanupAutoUpdate = null;
1225
+ popup?.remove();
1226
+ popup = null;
1227
+ component?.destroy();
1228
+ component = null;
1229
+ getReferenceRect = null;
1230
+ }, "teardown");
1198
1231
  return {
1199
1232
  onStart: /* @__PURE__ */ __name((props) => {
1200
1233
  component = new ReactRenderer(MentionList, {
@@ -1207,14 +1240,12 @@ function createMentionSuggestion(config) {
1207
1240
  editor: props.editor
1208
1241
  });
1209
1242
  popup = document.createElement("div");
1210
- popup.style.cssText = "position: absolute; z-index: 99999;";
1243
+ popup.style.cssText = "position: absolute; top: 0; left: 0; z-index: 99999;";
1211
1244
  popup.appendChild(component.element);
1212
- const rect = props.clientRect?.();
1213
- if (rect) {
1214
- popup.style.top = `${rect.bottom + window.scrollY + 4}px`;
1215
- popup.style.left = `${rect.left + window.scrollX}px`;
1216
- }
1217
1245
  document.body.appendChild(popup);
1246
+ getReferenceRect = /* @__PURE__ */ __name(() => props.clientRect?.() ?? null, "getReferenceRect");
1247
+ const virtualEl = buildVirtualElement();
1248
+ cleanupAutoUpdate = autoUpdate(virtualEl, popup, updatePosition);
1218
1249
  }, "onStart"),
1219
1250
  onUpdate: /* @__PURE__ */ __name((props) => {
1220
1251
  component?.updateProps({
@@ -1223,29 +1254,41 @@ function createMentionSuggestion(config) {
1223
1254
  props.command({ id: item.id, label: item.label });
1224
1255
  }, "command")
1225
1256
  });
1226
- const rect = props.clientRect?.();
1227
- if (rect && popup) {
1228
- popup.style.top = `${rect.bottom + window.scrollY + 4}px`;
1229
- popup.style.left = `${rect.left + window.scrollX}px`;
1230
- }
1257
+ getReferenceRect = /* @__PURE__ */ __name(() => props.clientRect?.() ?? null, "getReferenceRect");
1258
+ updatePosition();
1231
1259
  }, "onUpdate"),
1232
1260
  onKeyDown: /* @__PURE__ */ __name((props) => {
1233
1261
  if (props.event.key === "Escape") {
1234
- popup?.remove();
1235
- component?.destroy();
1262
+ teardown();
1236
1263
  return true;
1237
1264
  }
1238
1265
  return component?.ref?.onKeyDown(props.event) ?? false;
1239
1266
  }, "onKeyDown"),
1240
1267
  onExit: /* @__PURE__ */ __name(() => {
1241
- popup?.remove();
1242
- component?.destroy();
1268
+ teardown();
1243
1269
  }, "onExit")
1244
1270
  };
1245
1271
  }, "render")
1246
1272
  };
1247
1273
  }
1248
1274
  __name(createMentionSuggestion, "createMentionSuggestion");
1275
+
1276
+ // src/tools/MarkdownEditor/mentionPresets.ts
1277
+ var escapeMd = /* @__PURE__ */ __name((s) => s.replace(/([\\\[\]()_*~`])/g, "\\$1"), "escapeMd");
1278
+ var mentionPresets = {
1279
+ /** "@Label" — default, ideal for chat where LLMs read the text. */
1280
+ plainAt: /* @__PURE__ */ __name((({ label, id }) => `@${label || id}`), "plainAt"),
1281
+ /** "Label" — bare label, no @ prefix. */
1282
+ plainLabel: /* @__PURE__ */ __name((({ label, id }) => label || id), "plainLabel"),
1283
+ /** "[@Label](baseUrl/id)" — clickable markdown link. */
1284
+ markdownLink: /* @__PURE__ */ __name((baseUrl) => ({ label, id }) => `[@${escapeMd(label || id)}](${baseUrl}${encodeURIComponent(id)})`, "markdownLink"),
1285
+ /** "@[Label](scheme://kind/id)" — Notion / Linear-style custom URI. */
1286
+ customUri: /* @__PURE__ */ __name((scheme, kind) => ({ label, id }) => `@[${escapeMd(label || id)}](${scheme}://${kind}/${encodeURIComponent(id)})`, "customUri"),
1287
+ /** "<@id>" — Slack-style id-only reference (label dropped — receivers resolve it). */
1288
+ slackStyle: /* @__PURE__ */ __name((({ id }) => `<@${id}>`), "slackStyle"),
1289
+ /** Inline HTML span — for products that consume markdown with raw HTML allowed. */
1290
+ htmlSpan: /* @__PURE__ */ __name((className = "mention") => ({ label, id }) => `<span class="${className}" data-mention-id="${encodeURIComponent(id)}">@${escapeMd(label || id)}</span>`, "htmlSpan")
1291
+ };
1249
1292
  function getMarkdown(editor) {
1250
1293
  const storage = editor.storage.markdown;
1251
1294
  if (!storage?.manager) return editor.getText();
@@ -1289,8 +1332,19 @@ function MarkdownEditor({
1289
1332
  Markdown
1290
1333
  ];
1291
1334
  if (mentions) {
1335
+ const renderMarkdown = mentions.renderMarkdown ?? mentionPresets.plainAt;
1292
1336
  exts.push(
1293
- Mention.configure({
1337
+ Mention.extend({
1338
+ renderMarkdown(node) {
1339
+ const raw = node.attrs;
1340
+ const attrs = {
1341
+ id: raw?.id ?? "",
1342
+ label: raw?.label ?? ""
1343
+ };
1344
+ if (!attrs.id && !attrs.label) return "";
1345
+ return renderMarkdown(attrs);
1346
+ }
1347
+ }).configure({
1294
1348
  HTMLAttributes: { class: "markdown-mention" },
1295
1349
  suggestion: createMentionSuggestion(mentions),
1296
1350
  renderText: /* @__PURE__ */ __name(({ node }) => `@${node.attrs.label}`, "renderText")
@@ -1359,6 +1413,6 @@ function MarkdownToolbar({ editor }) {
1359
1413
  }
1360
1414
  __name(MarkdownToolbar, "MarkdownToolbar");
1361
1415
 
1362
- 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, OpenapiViewer_default as OpenapiViewer, Spinner, createLazyComponent, useEditor, useEditorContext, useLanguage, useMonaco };
1416
+ 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, OpenapiViewer_default as OpenapiViewer, Spinner, createLazyComponent, mentionPresets, useEditor, useEditorContext, useLanguage, useMonaco };
1363
1417
  //# sourceMappingURL=index.mjs.map
1364
1418
  //# sourceMappingURL=index.mjs.map