@underverse-ui/underverse 1.0.23 → 1.0.24
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.cjs +225 -4
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +35 -2
- package/dist/index.d.ts +35 -2
- package/dist/index.js +226 -7
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -2829,12 +2829,36 @@ declare function useSmartTranslations(namespace: string): (key: string) => strin
|
|
|
2829
2829
|
*/
|
|
2830
2830
|
declare function useSmartLocale(): Locale$1;
|
|
2831
2831
|
|
|
2832
|
+
type UEditorUploadImageForSaveResult = string | ({
|
|
2833
|
+
url: string;
|
|
2834
|
+
} & Record<string, unknown>);
|
|
2835
|
+
type UEditorUploadImageForSave = (file: File) => Promise<UEditorUploadImageForSaveResult>;
|
|
2836
|
+
type UEditorPrepareContentUploadMeta = Record<string, unknown>;
|
|
2837
|
+
type UEditorPrepareContentForSaveResult = {
|
|
2838
|
+
html: string;
|
|
2839
|
+
uploaded: Array<{
|
|
2840
|
+
url: string;
|
|
2841
|
+
file?: File;
|
|
2842
|
+
meta?: UEditorPrepareContentUploadMeta;
|
|
2843
|
+
}>;
|
|
2844
|
+
errors: Array<{
|
|
2845
|
+
index: number;
|
|
2846
|
+
reason: string;
|
|
2847
|
+
}>;
|
|
2848
|
+
};
|
|
2849
|
+
type UEditorPrepareContentForSaveOptions = {
|
|
2850
|
+
throwOnError?: boolean;
|
|
2851
|
+
};
|
|
2852
|
+
interface UEditorRef {
|
|
2853
|
+
prepareContentForSave: (options?: UEditorPrepareContentForSaveOptions) => Promise<UEditorPrepareContentForSaveResult>;
|
|
2854
|
+
}
|
|
2832
2855
|
interface UEditorProps {
|
|
2833
2856
|
content?: string;
|
|
2834
2857
|
onChange?: (content: string) => void;
|
|
2835
2858
|
onHtmlChange?: (html: string) => void;
|
|
2836
2859
|
onJsonChange?: (json: object) => void;
|
|
2837
2860
|
uploadImage?: (file: File) => Promise<string> | string;
|
|
2861
|
+
uploadImageForSave?: UEditorUploadImageForSave;
|
|
2838
2862
|
imageInsertMode?: "base64" | "upload";
|
|
2839
2863
|
placeholder?: string;
|
|
2840
2864
|
className?: string;
|
|
@@ -2851,7 +2875,16 @@ interface UEditorProps {
|
|
|
2851
2875
|
}
|
|
2852
2876
|
type UEditorVariant = NonNullable<UEditorProps["variant"]>;
|
|
2853
2877
|
|
|
2854
|
-
declare const UEditor:
|
|
2878
|
+
declare const UEditor: React__default.ForwardRefExoticComponent<UEditorProps & React__default.RefAttributes<UEditorRef>>;
|
|
2879
|
+
|
|
2880
|
+
declare class UEditorPrepareContentForSaveError extends Error {
|
|
2881
|
+
readonly result: UEditorPrepareContentForSaveResult;
|
|
2882
|
+
constructor(result: UEditorPrepareContentForSaveResult);
|
|
2883
|
+
}
|
|
2884
|
+
declare function prepareUEditorContentForSave({ html, uploadImageForSave, }: {
|
|
2885
|
+
html: string;
|
|
2886
|
+
uploadImageForSave?: UEditorUploadImageForSave;
|
|
2887
|
+
}): Promise<UEditorPrepareContentForSaveResult>;
|
|
2855
2888
|
|
|
2856
2889
|
declare const underverseMessages: {
|
|
2857
2890
|
readonly en: {
|
|
@@ -3630,4 +3663,4 @@ declare function getUnderverseMessages(locale?: UnderverseLocale): {
|
|
|
3630
3663
|
};
|
|
3631
3664
|
};
|
|
3632
3665
|
|
|
3633
|
-
export { AccessDenied, Alert, AreaChart, type AreaChartDataPoint, type AreaChartProps, type AreaChartSeries, Avatar, Badge, Badge as BadgeBase, BarChart, type BarChartDataPoint, type BarChartProps, type BarChartSeries, BatteryProgress, BottomSheet, Breadcrumb, Button, ButtonLoading, type ButtonProps, Calendar, type CalendarEvent, type CalendarProps, CalendarTimeline, type CalendarTimelineDateInput, type CalendarTimelineDayRangeMode, type CalendarTimelineEvent, type CalendarTimelineFormatters, type CalendarTimelineGroup, type CalendarTimelineInteractions, type CalendarTimelineLabels, type CalendarTimelineProps, type CalendarTimelineResource, type CalendarTimelineSize, type CalendarTimelineView, type CalendarTimelineVirtualization, Card, Carousel, CategoryTreeSelect, Checkbox, type CheckboxProps, CircularProgress, ClientOnly, ColorPicker, type ColorPickerProps, Combobox, type ComboboxProps, CompactPagination, type CompactPaginationProps, DataTable, type DataTableColumn, type DataTableDensity, type DataTableQuery, type DataTableSize, DatePicker, type DatePickerProps, DateRangePicker, DateTimePicker, type DateTimePickerProps, date as DateUtils, Drawer, DropdownMenu, DropdownMenuItem, DropdownMenuSeparator, FallingIcons, FileUpload, type FileUploadProps, FloatingContacts, ForceInternalTranslationsProvider, Form, FormActions, FormCheckbox, FormControl, FormDescription, FormField, FormInput, FormItem, FormLabel, FormMessage, FormSubmitButton, GaugeChart, type GaugeChartProps, GlobalLoading, GradientBadge, Grid, GridItem, type GridItemProps, type GridProps, ImageUpload, InlineLoading, Input, type InputProps, InteractiveBadge, Label, type LanguageOption, LanguageSwitcherHeadless as LanguageSwitcher, LanguageSwitcherHeadless, type LanguageSwitcherHeadlessProps, type LanguageSwitcherHeadlessProps as LanguageSwitcherProps, LineChart, type LineChartDataPoint, type LineChartProps, type LineChartSeries, List, ListItem, LoadingBar, LoadingDots, LoadingProgress, LoadingSpinner, type Locale$1 as Locale, MiniProgress, Modal, MonthYearPicker, MonthYearPicker as MonthYearPickerBase, type MonthYearPickerProps, MultiCombobox, type MultiComboboxProps, MusicPlayer, MusicPlayer as MusicPlayerDefault, type MusicPlayerProps, NotificationBadge, NotificationModal, NumberInput, OverlayControls, PageLoading, Pagination, type PaginationProps, PasswordInput, PieChart, type PieChartDataPoint, type PieChartProps, PillTabs, Popover, Progress, PulseBadge, RadarChart, type RadarChartDataPoint, type RadarChartProps, type RadarChartSeries, RadioGroup, RadioGroupItem, SIZE_STYLES_BTN, ScrollArea, SearchInput, Section, SegmentedProgress, SelectDropdown, Sheet, SidebarSheet, SimplePagination, type SimplePaginationProps, SimpleTabs, Skeleton, SkeletonAvatar, SkeletonButton, SkeletonCard, SkeletonList, SkeletonMessage, SkeletonPost, SkeletonTable, SkeletonText, SlideOver, Slider, SmartImage, type Song, type Sorter, Sparkline, type SparklineDataPoint, type SparklineProps, StatusBadge, StepProgress, type SupportedLocale, Switch, Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableRow, Tabs, TagBadge, TagInput, TagInput as TagInputBase, type TagInputProps, Textarea, type ThemeMode, ThemeToggleHeadless as ThemeToggle, ThemeToggleHeadless, type ThemeToggleHeadlessProps, type ThemeToggleHeadlessProps as ThemeToggleProps, TimePicker, type TimePickerProps, Timeline, TimelineItem, ToastProvider, Tooltip, TranslationProvider, type TranslationProviderProps, type Translations, UEditor, type UEditorProps, type UEditorVariant, type UnderverseLocale, UnderverseProvider, type UnderverseProviderProps, type UploadedFile, VARIANT_STYLES_ALERT, VARIANT_STYLES_BTN, VerticalTabs, Watermark, type WatermarkProps, cn$1 as cn, cn as cnLocal, getAnimationStyles, getUnderverseMessages, injectAnimationStyles, shadcnAnimationStyles, underverseMessages, useFormField, useShadCNAnimations, useSmartLocale, useSmartTranslations, useToast, useTranslations as useUnderverseI18n, useLocale as useUnderverseI18nLocale, useUnderverseLocale, useUnderverseTranslations };
|
|
3666
|
+
export { AccessDenied, Alert, AreaChart, type AreaChartDataPoint, type AreaChartProps, type AreaChartSeries, Avatar, Badge, Badge as BadgeBase, BarChart, type BarChartDataPoint, type BarChartProps, type BarChartSeries, BatteryProgress, BottomSheet, Breadcrumb, Button, ButtonLoading, type ButtonProps, Calendar, type CalendarEvent, type CalendarProps, CalendarTimeline, type CalendarTimelineDateInput, type CalendarTimelineDayRangeMode, type CalendarTimelineEvent, type CalendarTimelineFormatters, type CalendarTimelineGroup, type CalendarTimelineInteractions, type CalendarTimelineLabels, type CalendarTimelineProps, type CalendarTimelineResource, type CalendarTimelineSize, type CalendarTimelineView, type CalendarTimelineVirtualization, Card, Carousel, CategoryTreeSelect, Checkbox, type CheckboxProps, CircularProgress, ClientOnly, ColorPicker, type ColorPickerProps, Combobox, type ComboboxProps, CompactPagination, type CompactPaginationProps, DataTable, type DataTableColumn, type DataTableDensity, type DataTableQuery, type DataTableSize, DatePicker, type DatePickerProps, DateRangePicker, DateTimePicker, type DateTimePickerProps, date as DateUtils, Drawer, DropdownMenu, DropdownMenuItem, DropdownMenuSeparator, FallingIcons, FileUpload, type FileUploadProps, FloatingContacts, ForceInternalTranslationsProvider, Form, FormActions, FormCheckbox, FormControl, FormDescription, FormField, FormInput, FormItem, FormLabel, FormMessage, FormSubmitButton, GaugeChart, type GaugeChartProps, GlobalLoading, GradientBadge, Grid, GridItem, type GridItemProps, type GridProps, ImageUpload, InlineLoading, Input, type InputProps, InteractiveBadge, Label, type LanguageOption, LanguageSwitcherHeadless as LanguageSwitcher, LanguageSwitcherHeadless, type LanguageSwitcherHeadlessProps, type LanguageSwitcherHeadlessProps as LanguageSwitcherProps, LineChart, type LineChartDataPoint, type LineChartProps, type LineChartSeries, List, ListItem, LoadingBar, LoadingDots, LoadingProgress, LoadingSpinner, type Locale$1 as Locale, MiniProgress, Modal, MonthYearPicker, MonthYearPicker as MonthYearPickerBase, type MonthYearPickerProps, MultiCombobox, type MultiComboboxProps, MusicPlayer, MusicPlayer as MusicPlayerDefault, type MusicPlayerProps, NotificationBadge, NotificationModal, NumberInput, OverlayControls, PageLoading, Pagination, type PaginationProps, PasswordInput, PieChart, type PieChartDataPoint, type PieChartProps, PillTabs, Popover, Progress, PulseBadge, RadarChart, type RadarChartDataPoint, type RadarChartProps, type RadarChartSeries, RadioGroup, RadioGroupItem, SIZE_STYLES_BTN, ScrollArea, SearchInput, Section, SegmentedProgress, SelectDropdown, Sheet, SidebarSheet, SimplePagination, type SimplePaginationProps, SimpleTabs, Skeleton, SkeletonAvatar, SkeletonButton, SkeletonCard, SkeletonList, SkeletonMessage, SkeletonPost, SkeletonTable, SkeletonText, SlideOver, Slider, SmartImage, type Song, type Sorter, Sparkline, type SparklineDataPoint, type SparklineProps, StatusBadge, StepProgress, type SupportedLocale, Switch, Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableRow, Tabs, TagBadge, TagInput, TagInput as TagInputBase, type TagInputProps, Textarea, type ThemeMode, ThemeToggleHeadless as ThemeToggle, ThemeToggleHeadless, type ThemeToggleHeadlessProps, type ThemeToggleHeadlessProps as ThemeToggleProps, TimePicker, type TimePickerProps, Timeline, TimelineItem, ToastProvider, Tooltip, TranslationProvider, type TranslationProviderProps, type Translations, UEditor, UEditorPrepareContentForSaveError, type UEditorPrepareContentForSaveOptions, type UEditorPrepareContentForSaveResult, type UEditorProps, type UEditorRef, type UEditorUploadImageForSave, type UEditorUploadImageForSaveResult, type UEditorVariant, type UnderverseLocale, UnderverseProvider, type UnderverseProviderProps, type UploadedFile, VARIANT_STYLES_ALERT, VARIANT_STYLES_BTN, VerticalTabs, Watermark, type WatermarkProps, cn$1 as cn, cn as cnLocal, getAnimationStyles, getUnderverseMessages, injectAnimationStyles, prepareUEditorContentForSave, shadcnAnimationStyles, underverseMessages, useFormField, useShadCNAnimations, useSmartLocale, useSmartTranslations, useToast, useTranslations as useUnderverseI18n, useLocale as useUnderverseI18nLocale, useUnderverseLocale, useUnderverseTranslations };
|
package/dist/index.d.ts
CHANGED
|
@@ -2829,12 +2829,36 @@ declare function useSmartTranslations(namespace: string): (key: string) => strin
|
|
|
2829
2829
|
*/
|
|
2830
2830
|
declare function useSmartLocale(): Locale$1;
|
|
2831
2831
|
|
|
2832
|
+
type UEditorUploadImageForSaveResult = string | ({
|
|
2833
|
+
url: string;
|
|
2834
|
+
} & Record<string, unknown>);
|
|
2835
|
+
type UEditorUploadImageForSave = (file: File) => Promise<UEditorUploadImageForSaveResult>;
|
|
2836
|
+
type UEditorPrepareContentUploadMeta = Record<string, unknown>;
|
|
2837
|
+
type UEditorPrepareContentForSaveResult = {
|
|
2838
|
+
html: string;
|
|
2839
|
+
uploaded: Array<{
|
|
2840
|
+
url: string;
|
|
2841
|
+
file?: File;
|
|
2842
|
+
meta?: UEditorPrepareContentUploadMeta;
|
|
2843
|
+
}>;
|
|
2844
|
+
errors: Array<{
|
|
2845
|
+
index: number;
|
|
2846
|
+
reason: string;
|
|
2847
|
+
}>;
|
|
2848
|
+
};
|
|
2849
|
+
type UEditorPrepareContentForSaveOptions = {
|
|
2850
|
+
throwOnError?: boolean;
|
|
2851
|
+
};
|
|
2852
|
+
interface UEditorRef {
|
|
2853
|
+
prepareContentForSave: (options?: UEditorPrepareContentForSaveOptions) => Promise<UEditorPrepareContentForSaveResult>;
|
|
2854
|
+
}
|
|
2832
2855
|
interface UEditorProps {
|
|
2833
2856
|
content?: string;
|
|
2834
2857
|
onChange?: (content: string) => void;
|
|
2835
2858
|
onHtmlChange?: (html: string) => void;
|
|
2836
2859
|
onJsonChange?: (json: object) => void;
|
|
2837
2860
|
uploadImage?: (file: File) => Promise<string> | string;
|
|
2861
|
+
uploadImageForSave?: UEditorUploadImageForSave;
|
|
2838
2862
|
imageInsertMode?: "base64" | "upload";
|
|
2839
2863
|
placeholder?: string;
|
|
2840
2864
|
className?: string;
|
|
@@ -2851,7 +2875,16 @@ interface UEditorProps {
|
|
|
2851
2875
|
}
|
|
2852
2876
|
type UEditorVariant = NonNullable<UEditorProps["variant"]>;
|
|
2853
2877
|
|
|
2854
|
-
declare const UEditor:
|
|
2878
|
+
declare const UEditor: React__default.ForwardRefExoticComponent<UEditorProps & React__default.RefAttributes<UEditorRef>>;
|
|
2879
|
+
|
|
2880
|
+
declare class UEditorPrepareContentForSaveError extends Error {
|
|
2881
|
+
readonly result: UEditorPrepareContentForSaveResult;
|
|
2882
|
+
constructor(result: UEditorPrepareContentForSaveResult);
|
|
2883
|
+
}
|
|
2884
|
+
declare function prepareUEditorContentForSave({ html, uploadImageForSave, }: {
|
|
2885
|
+
html: string;
|
|
2886
|
+
uploadImageForSave?: UEditorUploadImageForSave;
|
|
2887
|
+
}): Promise<UEditorPrepareContentForSaveResult>;
|
|
2855
2888
|
|
|
2856
2889
|
declare const underverseMessages: {
|
|
2857
2890
|
readonly en: {
|
|
@@ -3630,4 +3663,4 @@ declare function getUnderverseMessages(locale?: UnderverseLocale): {
|
|
|
3630
3663
|
};
|
|
3631
3664
|
};
|
|
3632
3665
|
|
|
3633
|
-
export { AccessDenied, Alert, AreaChart, type AreaChartDataPoint, type AreaChartProps, type AreaChartSeries, Avatar, Badge, Badge as BadgeBase, BarChart, type BarChartDataPoint, type BarChartProps, type BarChartSeries, BatteryProgress, BottomSheet, Breadcrumb, Button, ButtonLoading, type ButtonProps, Calendar, type CalendarEvent, type CalendarProps, CalendarTimeline, type CalendarTimelineDateInput, type CalendarTimelineDayRangeMode, type CalendarTimelineEvent, type CalendarTimelineFormatters, type CalendarTimelineGroup, type CalendarTimelineInteractions, type CalendarTimelineLabels, type CalendarTimelineProps, type CalendarTimelineResource, type CalendarTimelineSize, type CalendarTimelineView, type CalendarTimelineVirtualization, Card, Carousel, CategoryTreeSelect, Checkbox, type CheckboxProps, CircularProgress, ClientOnly, ColorPicker, type ColorPickerProps, Combobox, type ComboboxProps, CompactPagination, type CompactPaginationProps, DataTable, type DataTableColumn, type DataTableDensity, type DataTableQuery, type DataTableSize, DatePicker, type DatePickerProps, DateRangePicker, DateTimePicker, type DateTimePickerProps, date as DateUtils, Drawer, DropdownMenu, DropdownMenuItem, DropdownMenuSeparator, FallingIcons, FileUpload, type FileUploadProps, FloatingContacts, ForceInternalTranslationsProvider, Form, FormActions, FormCheckbox, FormControl, FormDescription, FormField, FormInput, FormItem, FormLabel, FormMessage, FormSubmitButton, GaugeChart, type GaugeChartProps, GlobalLoading, GradientBadge, Grid, GridItem, type GridItemProps, type GridProps, ImageUpload, InlineLoading, Input, type InputProps, InteractiveBadge, Label, type LanguageOption, LanguageSwitcherHeadless as LanguageSwitcher, LanguageSwitcherHeadless, type LanguageSwitcherHeadlessProps, type LanguageSwitcherHeadlessProps as LanguageSwitcherProps, LineChart, type LineChartDataPoint, type LineChartProps, type LineChartSeries, List, ListItem, LoadingBar, LoadingDots, LoadingProgress, LoadingSpinner, type Locale$1 as Locale, MiniProgress, Modal, MonthYearPicker, MonthYearPicker as MonthYearPickerBase, type MonthYearPickerProps, MultiCombobox, type MultiComboboxProps, MusicPlayer, MusicPlayer as MusicPlayerDefault, type MusicPlayerProps, NotificationBadge, NotificationModal, NumberInput, OverlayControls, PageLoading, Pagination, type PaginationProps, PasswordInput, PieChart, type PieChartDataPoint, type PieChartProps, PillTabs, Popover, Progress, PulseBadge, RadarChart, type RadarChartDataPoint, type RadarChartProps, type RadarChartSeries, RadioGroup, RadioGroupItem, SIZE_STYLES_BTN, ScrollArea, SearchInput, Section, SegmentedProgress, SelectDropdown, Sheet, SidebarSheet, SimplePagination, type SimplePaginationProps, SimpleTabs, Skeleton, SkeletonAvatar, SkeletonButton, SkeletonCard, SkeletonList, SkeletonMessage, SkeletonPost, SkeletonTable, SkeletonText, SlideOver, Slider, SmartImage, type Song, type Sorter, Sparkline, type SparklineDataPoint, type SparklineProps, StatusBadge, StepProgress, type SupportedLocale, Switch, Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableRow, Tabs, TagBadge, TagInput, TagInput as TagInputBase, type TagInputProps, Textarea, type ThemeMode, ThemeToggleHeadless as ThemeToggle, ThemeToggleHeadless, type ThemeToggleHeadlessProps, type ThemeToggleHeadlessProps as ThemeToggleProps, TimePicker, type TimePickerProps, Timeline, TimelineItem, ToastProvider, Tooltip, TranslationProvider, type TranslationProviderProps, type Translations, UEditor, type UEditorProps, type UEditorVariant, type UnderverseLocale, UnderverseProvider, type UnderverseProviderProps, type UploadedFile, VARIANT_STYLES_ALERT, VARIANT_STYLES_BTN, VerticalTabs, Watermark, type WatermarkProps, cn$1 as cn, cn as cnLocal, getAnimationStyles, getUnderverseMessages, injectAnimationStyles, shadcnAnimationStyles, underverseMessages, useFormField, useShadCNAnimations, useSmartLocale, useSmartTranslations, useToast, useTranslations as useUnderverseI18n, useLocale as useUnderverseI18nLocale, useUnderverseLocale, useUnderverseTranslations };
|
|
3666
|
+
export { AccessDenied, Alert, AreaChart, type AreaChartDataPoint, type AreaChartProps, type AreaChartSeries, Avatar, Badge, Badge as BadgeBase, BarChart, type BarChartDataPoint, type BarChartProps, type BarChartSeries, BatteryProgress, BottomSheet, Breadcrumb, Button, ButtonLoading, type ButtonProps, Calendar, type CalendarEvent, type CalendarProps, CalendarTimeline, type CalendarTimelineDateInput, type CalendarTimelineDayRangeMode, type CalendarTimelineEvent, type CalendarTimelineFormatters, type CalendarTimelineGroup, type CalendarTimelineInteractions, type CalendarTimelineLabels, type CalendarTimelineProps, type CalendarTimelineResource, type CalendarTimelineSize, type CalendarTimelineView, type CalendarTimelineVirtualization, Card, Carousel, CategoryTreeSelect, Checkbox, type CheckboxProps, CircularProgress, ClientOnly, ColorPicker, type ColorPickerProps, Combobox, type ComboboxProps, CompactPagination, type CompactPaginationProps, DataTable, type DataTableColumn, type DataTableDensity, type DataTableQuery, type DataTableSize, DatePicker, type DatePickerProps, DateRangePicker, DateTimePicker, type DateTimePickerProps, date as DateUtils, Drawer, DropdownMenu, DropdownMenuItem, DropdownMenuSeparator, FallingIcons, FileUpload, type FileUploadProps, FloatingContacts, ForceInternalTranslationsProvider, Form, FormActions, FormCheckbox, FormControl, FormDescription, FormField, FormInput, FormItem, FormLabel, FormMessage, FormSubmitButton, GaugeChart, type GaugeChartProps, GlobalLoading, GradientBadge, Grid, GridItem, type GridItemProps, type GridProps, ImageUpload, InlineLoading, Input, type InputProps, InteractiveBadge, Label, type LanguageOption, LanguageSwitcherHeadless as LanguageSwitcher, LanguageSwitcherHeadless, type LanguageSwitcherHeadlessProps, type LanguageSwitcherHeadlessProps as LanguageSwitcherProps, LineChart, type LineChartDataPoint, type LineChartProps, type LineChartSeries, List, ListItem, LoadingBar, LoadingDots, LoadingProgress, LoadingSpinner, type Locale$1 as Locale, MiniProgress, Modal, MonthYearPicker, MonthYearPicker as MonthYearPickerBase, type MonthYearPickerProps, MultiCombobox, type MultiComboboxProps, MusicPlayer, MusicPlayer as MusicPlayerDefault, type MusicPlayerProps, NotificationBadge, NotificationModal, NumberInput, OverlayControls, PageLoading, Pagination, type PaginationProps, PasswordInput, PieChart, type PieChartDataPoint, type PieChartProps, PillTabs, Popover, Progress, PulseBadge, RadarChart, type RadarChartDataPoint, type RadarChartProps, type RadarChartSeries, RadioGroup, RadioGroupItem, SIZE_STYLES_BTN, ScrollArea, SearchInput, Section, SegmentedProgress, SelectDropdown, Sheet, SidebarSheet, SimplePagination, type SimplePaginationProps, SimpleTabs, Skeleton, SkeletonAvatar, SkeletonButton, SkeletonCard, SkeletonList, SkeletonMessage, SkeletonPost, SkeletonTable, SkeletonText, SlideOver, Slider, SmartImage, type Song, type Sorter, Sparkline, type SparklineDataPoint, type SparklineProps, StatusBadge, StepProgress, type SupportedLocale, Switch, Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableRow, Tabs, TagBadge, TagInput, TagInput as TagInputBase, type TagInputProps, Textarea, type ThemeMode, ThemeToggleHeadless as ThemeToggle, ThemeToggleHeadless, type ThemeToggleHeadlessProps, type ThemeToggleHeadlessProps as ThemeToggleProps, TimePicker, type TimePickerProps, Timeline, TimelineItem, ToastProvider, Tooltip, TranslationProvider, type TranslationProviderProps, type Translations, UEditor, UEditorPrepareContentForSaveError, type UEditorPrepareContentForSaveOptions, type UEditorPrepareContentForSaveResult, type UEditorProps, type UEditorRef, type UEditorUploadImageForSave, type UEditorUploadImageForSaveResult, type UEditorVariant, type UnderverseLocale, UnderverseProvider, type UnderverseProviderProps, type UploadedFile, VARIANT_STYLES_ALERT, VARIANT_STYLES_BTN, VerticalTabs, Watermark, type WatermarkProps, cn$1 as cn, cn as cnLocal, getAnimationStyles, getUnderverseMessages, injectAnimationStyles, prepareUEditorContentForSave, shadcnAnimationStyles, underverseMessages, useFormField, useShadCNAnimations, useSmartLocale, useSmartTranslations, useToast, useTranslations as useUnderverseI18n, useLocale as useUnderverseI18nLocale, useUnderverseLocale, useUnderverseTranslations };
|
package/dist/index.js
CHANGED
|
@@ -14159,7 +14159,7 @@ function ImageUpload({
|
|
|
14159
14159
|
import { useState as useState33, useRef as useRef17, useCallback as useCallback14, useMemo as useMemo17 } from "react";
|
|
14160
14160
|
import {
|
|
14161
14161
|
Upload as Upload2,
|
|
14162
|
-
File,
|
|
14162
|
+
File as File2,
|
|
14163
14163
|
FileText,
|
|
14164
14164
|
FileImage,
|
|
14165
14165
|
FileVideo,
|
|
@@ -14241,7 +14241,7 @@ var getFileIcon = (mimeType, fileName) => {
|
|
|
14241
14241
|
case "c":
|
|
14242
14242
|
return FileCode;
|
|
14243
14243
|
default:
|
|
14244
|
-
return
|
|
14244
|
+
return File2;
|
|
14245
14245
|
}
|
|
14246
14246
|
};
|
|
14247
14247
|
var getFileTypeColor = (mimeType) => {
|
|
@@ -14454,7 +14454,7 @@ function FileUpload({
|
|
|
14454
14454
|
[uploadHandler, processFiles, handleRemove]
|
|
14455
14455
|
);
|
|
14456
14456
|
const renderFileItem = (file) => {
|
|
14457
|
-
const IconComponent = showTypeIcons ? getFileIcon(file.type, file.name) :
|
|
14457
|
+
const IconComponent = showTypeIcons ? getFileIcon(file.type, file.name) : File2;
|
|
14458
14458
|
const iconColor = getFileTypeColor(file.type);
|
|
14459
14459
|
const isImage = file.type.startsWith("image/") && file.url;
|
|
14460
14460
|
return /* @__PURE__ */ jsxs41(
|
|
@@ -21297,7 +21297,7 @@ function useSmartLocale() {
|
|
|
21297
21297
|
}
|
|
21298
21298
|
|
|
21299
21299
|
// ../../components/ui/UEditor/UEditor.tsx
|
|
21300
|
-
import { useEffect as useEffect36, useMemo as useMemo28 } from "react";
|
|
21300
|
+
import React72, { useEffect as useEffect36, useImperativeHandle as useImperativeHandle3, useMemo as useMemo28, useRef as useRef34 } from "react";
|
|
21301
21301
|
import { useTranslations as useTranslations7 } from "next-intl";
|
|
21302
21302
|
import { useEditor, EditorContent } from "@tiptap/react";
|
|
21303
21303
|
|
|
@@ -24259,14 +24259,207 @@ var CharacterCountDisplay = ({ editor, maxCharacters }) => {
|
|
|
24259
24259
|
] });
|
|
24260
24260
|
};
|
|
24261
24261
|
|
|
24262
|
+
// ../../components/ui/UEditor/prepare-content-for-save.ts
|
|
24263
|
+
var MIME_EXTENSION_MAP = {
|
|
24264
|
+
"image/png": "png",
|
|
24265
|
+
"image/jpeg": "jpg",
|
|
24266
|
+
"image/webp": "webp",
|
|
24267
|
+
"image/gif": "gif",
|
|
24268
|
+
"image/svg+xml": "svg",
|
|
24269
|
+
"image/bmp": "bmp",
|
|
24270
|
+
"image/x-icon": "ico",
|
|
24271
|
+
"image/avif": "avif"
|
|
24272
|
+
};
|
|
24273
|
+
function isDataImageUrl(value) {
|
|
24274
|
+
return /^data:image\//i.test(value.trim());
|
|
24275
|
+
}
|
|
24276
|
+
function parseDataImageUrl(dataUrl) {
|
|
24277
|
+
const value = dataUrl.trim();
|
|
24278
|
+
if (!isDataImageUrl(value)) return null;
|
|
24279
|
+
const commaIndex = value.indexOf(",");
|
|
24280
|
+
if (commaIndex < 0) return null;
|
|
24281
|
+
const header = value.slice(5, commaIndex);
|
|
24282
|
+
const base64Data = value.slice(commaIndex + 1).trim();
|
|
24283
|
+
if (!/;base64/i.test(header)) return null;
|
|
24284
|
+
const mime = header.split(";")[0]?.trim().toLowerCase();
|
|
24285
|
+
if (!mime || !base64Data) return null;
|
|
24286
|
+
return { mime, base64Data };
|
|
24287
|
+
}
|
|
24288
|
+
function decodeBase64ToBytes(base64Data) {
|
|
24289
|
+
const normalized = base64Data.replace(/\s+/g, "");
|
|
24290
|
+
const binary = atob(normalized);
|
|
24291
|
+
const bytes = new Uint8Array(binary.length);
|
|
24292
|
+
for (let i = 0; i < binary.length; i += 1) {
|
|
24293
|
+
bytes[i] = binary.charCodeAt(i);
|
|
24294
|
+
}
|
|
24295
|
+
return bytes;
|
|
24296
|
+
}
|
|
24297
|
+
function inferFileExtension(mime) {
|
|
24298
|
+
return MIME_EXTENSION_MAP[mime] ?? "bin";
|
|
24299
|
+
}
|
|
24300
|
+
function createFileFromDataImageUrl(dataUrl, index) {
|
|
24301
|
+
const parsed = parseDataImageUrl(dataUrl);
|
|
24302
|
+
if (!parsed) {
|
|
24303
|
+
throw new Error("Invalid data image URL format.");
|
|
24304
|
+
}
|
|
24305
|
+
const bytes = decodeBase64ToBytes(parsed.base64Data);
|
|
24306
|
+
const extension = inferFileExtension(parsed.mime);
|
|
24307
|
+
const name = `ueditor-image-${index + 1}.${extension}`;
|
|
24308
|
+
return new File([bytes], name, { type: parsed.mime });
|
|
24309
|
+
}
|
|
24310
|
+
function normalizeUploadResult(result) {
|
|
24311
|
+
if (typeof result === "string") {
|
|
24312
|
+
const url2 = result.trim();
|
|
24313
|
+
if (!url2) throw new Error("Upload handler returned an empty URL.");
|
|
24314
|
+
return { url: url2 };
|
|
24315
|
+
}
|
|
24316
|
+
if (!result || typeof result !== "object") {
|
|
24317
|
+
throw new Error("Upload handler returned invalid result.");
|
|
24318
|
+
}
|
|
24319
|
+
const url = typeof result.url === "string" ? result.url.trim() : "";
|
|
24320
|
+
if (!url) throw new Error("Upload handler object result is missing `url`.");
|
|
24321
|
+
const { url: _ignoredUrl, ...rest } = result;
|
|
24322
|
+
const meta = Object.keys(rest).length > 0 ? rest : void 0;
|
|
24323
|
+
return { url, meta };
|
|
24324
|
+
}
|
|
24325
|
+
function getErrorReason(error) {
|
|
24326
|
+
if (error instanceof Error && error.message) return error.message;
|
|
24327
|
+
if (typeof error === "string" && error.trim()) return error;
|
|
24328
|
+
return "Unknown upload error.";
|
|
24329
|
+
}
|
|
24330
|
+
function replaceSrcInTag(match, nextSrc) {
|
|
24331
|
+
if (!match.srcAttr) return match.tag;
|
|
24332
|
+
const { start, end, quote } = match.srcAttr;
|
|
24333
|
+
const escaped = quote === '"' ? nextSrc.replace(/"/g, """) : quote === "'" ? nextSrc.replace(/'/g, "'") : nextSrc;
|
|
24334
|
+
const srcAttr = quote ? `src=${quote}${escaped}${quote}` : `src=${escaped}`;
|
|
24335
|
+
return `${match.tag.slice(0, start)}${srcAttr}${match.tag.slice(end)}`;
|
|
24336
|
+
}
|
|
24337
|
+
function collectImgTagMatches(html) {
|
|
24338
|
+
const matches = [];
|
|
24339
|
+
const imgRegex = /<img\b[^>]*>/gi;
|
|
24340
|
+
const srcAttrRegex = /\bsrc\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s"'=<>`]+))/i;
|
|
24341
|
+
let tagMatch = imgRegex.exec(html);
|
|
24342
|
+
while (tagMatch) {
|
|
24343
|
+
const tag = tagMatch[0];
|
|
24344
|
+
const start = tagMatch.index;
|
|
24345
|
+
const end = start + tag.length;
|
|
24346
|
+
const srcMatch = srcAttrRegex.exec(tag);
|
|
24347
|
+
let srcAttr = null;
|
|
24348
|
+
if (srcMatch) {
|
|
24349
|
+
const value = srcMatch[1] ?? srcMatch[2] ?? srcMatch[3] ?? "";
|
|
24350
|
+
const quote = srcMatch[1] !== void 0 ? '"' : srcMatch[2] !== void 0 ? "'" : "";
|
|
24351
|
+
srcAttr = {
|
|
24352
|
+
start: srcMatch.index,
|
|
24353
|
+
end: srcMatch.index + srcMatch[0].length,
|
|
24354
|
+
value,
|
|
24355
|
+
quote
|
|
24356
|
+
};
|
|
24357
|
+
}
|
|
24358
|
+
matches.push({ start, end, tag, srcAttr });
|
|
24359
|
+
tagMatch = imgRegex.exec(html);
|
|
24360
|
+
}
|
|
24361
|
+
return matches;
|
|
24362
|
+
}
|
|
24363
|
+
var UEditorPrepareContentForSaveError = class extends Error {
|
|
24364
|
+
constructor(result) {
|
|
24365
|
+
super(
|
|
24366
|
+
`Failed to upload ${result.errors.length} image(s): ${result.errors.map((item) => `#${item.index} ${item.reason}`).join("; ")}`
|
|
24367
|
+
);
|
|
24368
|
+
this.name = "UEditorPrepareContentForSaveError";
|
|
24369
|
+
this.result = result;
|
|
24370
|
+
}
|
|
24371
|
+
};
|
|
24372
|
+
async function prepareUEditorContentForSave({
|
|
24373
|
+
html,
|
|
24374
|
+
uploadImageForSave
|
|
24375
|
+
}) {
|
|
24376
|
+
if (!html || !html.includes("<img")) {
|
|
24377
|
+
return { html, uploaded: [], errors: [] };
|
|
24378
|
+
}
|
|
24379
|
+
const imgMatches = collectImgTagMatches(html);
|
|
24380
|
+
if (imgMatches.length === 0) {
|
|
24381
|
+
return { html, uploaded: [], errors: [] };
|
|
24382
|
+
}
|
|
24383
|
+
const base64Candidates = [];
|
|
24384
|
+
for (const match of imgMatches) {
|
|
24385
|
+
if (!match.srcAttr) continue;
|
|
24386
|
+
const src = match.srcAttr.value.trim();
|
|
24387
|
+
if (!isDataImageUrl(src)) continue;
|
|
24388
|
+
base64Candidates.push({
|
|
24389
|
+
id: `${match.start}:${match.end}`,
|
|
24390
|
+
match,
|
|
24391
|
+
index: base64Candidates.length,
|
|
24392
|
+
src
|
|
24393
|
+
});
|
|
24394
|
+
}
|
|
24395
|
+
if (base64Candidates.length === 0) {
|
|
24396
|
+
return { html, uploaded: [], errors: [] };
|
|
24397
|
+
}
|
|
24398
|
+
if (!uploadImageForSave) {
|
|
24399
|
+
return {
|
|
24400
|
+
html,
|
|
24401
|
+
uploaded: [],
|
|
24402
|
+
errors: base64Candidates.map((item) => ({
|
|
24403
|
+
index: item.index,
|
|
24404
|
+
reason: "`uploadImageForSave` is required to transform base64 images before save."
|
|
24405
|
+
}))
|
|
24406
|
+
};
|
|
24407
|
+
}
|
|
24408
|
+
const uploaded = [];
|
|
24409
|
+
const errors = [];
|
|
24410
|
+
const replacements = /* @__PURE__ */ new Map();
|
|
24411
|
+
const uploadResults = await Promise.all(
|
|
24412
|
+
base64Candidates.map(async (candidate) => {
|
|
24413
|
+
try {
|
|
24414
|
+
const file = createFileFromDataImageUrl(candidate.src, candidate.index);
|
|
24415
|
+
const uploadResult = await uploadImageForSave(file);
|
|
24416
|
+
const normalized = normalizeUploadResult(uploadResult);
|
|
24417
|
+
return { candidate, file, ...normalized };
|
|
24418
|
+
} catch (error) {
|
|
24419
|
+
return { candidate, error: getErrorReason(error) };
|
|
24420
|
+
}
|
|
24421
|
+
})
|
|
24422
|
+
);
|
|
24423
|
+
for (const item of uploadResults) {
|
|
24424
|
+
if ("error" in item) {
|
|
24425
|
+
errors.push({
|
|
24426
|
+
index: item.candidate.index,
|
|
24427
|
+
reason: item.error ?? "Unknown upload error."
|
|
24428
|
+
});
|
|
24429
|
+
continue;
|
|
24430
|
+
}
|
|
24431
|
+
replacements.set(item.candidate.id, item.url);
|
|
24432
|
+
uploaded.push({
|
|
24433
|
+
url: item.url,
|
|
24434
|
+
file: item.file,
|
|
24435
|
+
meta: item.meta
|
|
24436
|
+
});
|
|
24437
|
+
}
|
|
24438
|
+
if (replacements.size === 0) {
|
|
24439
|
+
return { html, uploaded, errors };
|
|
24440
|
+
}
|
|
24441
|
+
let transformed = "";
|
|
24442
|
+
let cursor = 0;
|
|
24443
|
+
for (const match of imgMatches) {
|
|
24444
|
+
transformed += html.slice(cursor, match.start);
|
|
24445
|
+
const replacementKey = `${match.start}:${match.end}`;
|
|
24446
|
+
const replacementUrl = replacements.get(replacementKey);
|
|
24447
|
+
transformed += replacementUrl ? replaceSrcInTag(match, replacementUrl) : match.tag;
|
|
24448
|
+
cursor = match.end;
|
|
24449
|
+
}
|
|
24450
|
+
transformed += html.slice(cursor);
|
|
24451
|
+
return { html: transformed, uploaded, errors };
|
|
24452
|
+
}
|
|
24453
|
+
|
|
24262
24454
|
// ../../components/ui/UEditor/UEditor.tsx
|
|
24263
24455
|
import { jsx as jsx85, jsxs as jsxs78 } from "react/jsx-runtime";
|
|
24264
|
-
var UEditor = ({
|
|
24456
|
+
var UEditor = React72.forwardRef(({
|
|
24265
24457
|
content = "",
|
|
24266
24458
|
onChange,
|
|
24267
24459
|
onHtmlChange,
|
|
24268
24460
|
onJsonChange,
|
|
24269
24461
|
uploadImage,
|
|
24462
|
+
uploadImageForSave,
|
|
24270
24463
|
imageInsertMode = "base64",
|
|
24271
24464
|
placeholder,
|
|
24272
24465
|
className,
|
|
@@ -24280,9 +24473,10 @@ var UEditor = ({
|
|
|
24280
24473
|
minHeight = "200px",
|
|
24281
24474
|
maxHeight = "auto",
|
|
24282
24475
|
variant = "default"
|
|
24283
|
-
}) => {
|
|
24476
|
+
}, ref) => {
|
|
24284
24477
|
const t = useTranslations7("UEditor");
|
|
24285
24478
|
const effectivePlaceholder = placeholder ?? t("placeholder");
|
|
24479
|
+
const inFlightPrepareRef = useRef34(null);
|
|
24286
24480
|
const extensions = useMemo28(
|
|
24287
24481
|
() => buildUEditorExtensions({ placeholder: effectivePlaceholder, maxCharacters, uploadImage, imageInsertMode, editable }),
|
|
24288
24482
|
[effectivePlaceholder, maxCharacters, uploadImage, imageInsertMode, editable]
|
|
@@ -24392,6 +24586,28 @@ var UEditor = ({
|
|
|
24392
24586
|
onJsonChange?.(editor2.getJSON());
|
|
24393
24587
|
}
|
|
24394
24588
|
});
|
|
24589
|
+
useImperativeHandle3(
|
|
24590
|
+
ref,
|
|
24591
|
+
() => ({
|
|
24592
|
+
prepareContentForSave: async ({ throwOnError = false } = {}) => {
|
|
24593
|
+
if (!inFlightPrepareRef.current) {
|
|
24594
|
+
const htmlSnapshot = editor?.getHTML() ?? content ?? "";
|
|
24595
|
+
inFlightPrepareRef.current = prepareUEditorContentForSave({
|
|
24596
|
+
html: htmlSnapshot,
|
|
24597
|
+
uploadImageForSave
|
|
24598
|
+
}).finally(() => {
|
|
24599
|
+
inFlightPrepareRef.current = null;
|
|
24600
|
+
});
|
|
24601
|
+
}
|
|
24602
|
+
const result = await inFlightPrepareRef.current;
|
|
24603
|
+
if (throwOnError && result.errors.length > 0) {
|
|
24604
|
+
throw new UEditorPrepareContentForSaveError(result);
|
|
24605
|
+
}
|
|
24606
|
+
return result;
|
|
24607
|
+
}
|
|
24608
|
+
}),
|
|
24609
|
+
[content, editor, uploadImageForSave]
|
|
24610
|
+
);
|
|
24395
24611
|
useEffect36(() => {
|
|
24396
24612
|
if (editor && content !== editor.getHTML()) {
|
|
24397
24613
|
if (editor.isEmpty && content) {
|
|
@@ -24439,7 +24655,8 @@ var UEditor = ({
|
|
|
24439
24655
|
]
|
|
24440
24656
|
}
|
|
24441
24657
|
);
|
|
24442
|
-
};
|
|
24658
|
+
});
|
|
24659
|
+
UEditor.displayName = "UEditor";
|
|
24443
24660
|
var UEditor_default = UEditor;
|
|
24444
24661
|
|
|
24445
24662
|
// src/index.ts
|
|
@@ -24584,6 +24801,7 @@ export {
|
|
|
24584
24801
|
Tooltip,
|
|
24585
24802
|
TranslationProvider,
|
|
24586
24803
|
UEditor_default as UEditor,
|
|
24804
|
+
UEditorPrepareContentForSaveError,
|
|
24587
24805
|
UnderverseProvider,
|
|
24588
24806
|
VARIANT_STYLES_ALERT,
|
|
24589
24807
|
VARIANT_STYLES_BTN,
|
|
@@ -24594,6 +24812,7 @@ export {
|
|
|
24594
24812
|
getAnimationStyles,
|
|
24595
24813
|
getUnderverseMessages,
|
|
24596
24814
|
injectAnimationStyles,
|
|
24815
|
+
prepareUEditorContentForSave,
|
|
24597
24816
|
shadcnAnimationStyles2 as shadcnAnimationStyles,
|
|
24598
24817
|
underverseMessages,
|
|
24599
24818
|
useFormField,
|