@turnix-co/konva-editor 2.0.43 → 2.0.44

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.ts CHANGED
@@ -816,6 +816,92 @@ declare const getCompressionStats: (original: number[], simplified: number[]) =>
816
816
  reduction: string;
817
817
  };
818
818
 
819
+ /**
820
+ * Prepared image element with buffer data
821
+ */
822
+ type PreparedImageElement = Omit<ImageElement, 'src' | 'audioData'> & {
823
+ buffer: ArrayBuffer;
824
+ mimeType: string;
825
+ audioBuffer?: ArrayBuffer;
826
+ audioMimeType?: string;
827
+ };
828
+ /**
829
+ * Prepared video element with buffer data
830
+ */
831
+ type PreparedVideoElement = Omit<VideoElement, 'objectUrl' | 'videoData' | 'videoBlob' | 'audioData'> & {
832
+ buffer: ArrayBuffer;
833
+ mimeType: string;
834
+ audioBuffer?: ArrayBuffer;
835
+ audioMimeType?: string;
836
+ };
837
+ /**
838
+ * Prepared photo frame element with buffer data
839
+ */
840
+ type PreparedPhotoFrameElement = Omit<PhotoFrameElement, 'capturedImageUrl' | 'audioData'> & {
841
+ buffer?: ArrayBuffer;
842
+ mimeType?: string;
843
+ audioBuffer?: ArrayBuffer;
844
+ audioMimeType?: string;
845
+ };
846
+ /**
847
+ * Prepared slide data ready for publishing with buffers
848
+ */
849
+ type PreparedSlide = Omit<Slide, 'images' | 'videos' | 'photoFrames' | 'thumbnail'> & {
850
+ images: PreparedImageElement[];
851
+ videos: PreparedVideoElement[];
852
+ photoFrames: PreparedPhotoFrameElement[];
853
+ thumbnailBuffer?: ArrayBuffer;
854
+ thumbnailMimeType?: string;
855
+ };
856
+ /**
857
+ * Result of preparing slides for publishing
858
+ */
859
+ type PublishPayload = {
860
+ slides: PreparedSlide[];
861
+ totalSize: number;
862
+ };
863
+ /**
864
+ * Prepare slides for publishing by converting media to buffers embedded in slides
865
+ */
866
+ declare const prepareSlidesForPublishing: (slides: Slide[], options?: {
867
+ optimizeImages?: boolean;
868
+ maxImageWidth?: number;
869
+ maxImageHeight?: number;
870
+ imageQuality?: number;
871
+ /** Map of slideId to full-size thumbnail data URL for publishing */
872
+ fullSizeThumbnails?: Map<string, string>;
873
+ }) => Promise<PublishPayload>;
874
+ /**
875
+ * Convert ArrayBuffer to Base64 string (for JSON transmission)
876
+ */
877
+ declare const arrayBufferToBase64: (buffer: ArrayBuffer) => string;
878
+ /**
879
+ * Prepare FormData for multipart/form-data transmission
880
+ * This is more efficient than base64 encoding
881
+ */
882
+ declare const prepareFormData: (payload: PublishPayload) => FormData;
883
+ /**
884
+ * Generate a full-size thumbnail from a Konva stage
885
+ * Use this to create thumbnails at full resolution for publishing
886
+ * @param stageRef Reference to the Konva stage
887
+ * @param options Options for thumbnail generation
888
+ * @returns Data URL of the full-size thumbnail
889
+ */
890
+ declare const generateFullSizeThumbnail: (stageRef: React$1.RefObject<Konva.Stage | null>, options?: {
891
+ pixelRatio?: number;
892
+ mimeType?: "image/jpeg" | "image/png";
893
+ quality?: number;
894
+ }) => string | null;
895
+ /**
896
+ * Generate full-size thumbnails for all slides
897
+ * This should be called before publishing to create high-resolution thumbnails
898
+ * @param slides Array of slides
899
+ * @param stageRef Reference to the Konva stage
900
+ * @param switchToSlide Function to switch to a specific slide and wait for render
901
+ * @returns Map of slideId to full-size thumbnail data URL
902
+ */
903
+ declare const generateAllFullSizeThumbnails: (slides: Slide[], stageRef: React$1.RefObject<Konva.Stage | null>, switchToSlide: (slideId: string) => Promise<void>) => Promise<Map<string, string>>;
904
+
819
905
  declare const useDispatch: () => redux_thunk.ThunkDispatch<{
820
906
  toolbar: ToolbarState;
821
907
  canvas: {
@@ -833,4 +919,4 @@ declare const useSelector: <T>(selector: (state: RootState) => T) => T;
833
919
 
834
920
  declare const useSlidesPersistence: () => void;
835
921
 
836
- export { type ActionType, type ActivityType, type AppDispatch, BASIC_EDITOR_TOOLBAR_CONFIG, BottomToolbar, type BottomToolbarProps, Canvas, type CanvasProps, type ContextMenuConfig, DEFAULT_CONTEXT_MENU_CONFIG, DEFAULT_TOOLBAR_CONFIG, EditorRoot, type EditorRootProps, type ExportOptions, type FillInTheBlanks, type FlashcardElement, type ImageElement, type Line$1 as Line, type LongAnswer, type MediaType, type MultipleChoice, type PhotoFrameElement, PublishButton, type PublishButtonProps, type PublishProgress, type PublishResponse, type RootState, ScreenRecorder, type Shape, type ShapeType, type ShortAnswer, type Slide, SlideNavigation, type TextElement, type ToolType, Toolbar, type ToolbarActionsConfig, type ToolbarConfig, type ToolbarProps, type ToolbarToolsConfig, TopNavBar, type TopNavBarProps, type TrueFalse, VIEWER_TOOLBAR_CONFIG, type VideoElement, addFillInTheBlanks, addFlashcard, addImage, addImageAnnotation, addLine, addLongAnswer, addMultipleChoice, addPhotoFrame, addPhotoFrameAnnotation, addShape, addShortAnswer, addSlide, addText, addTrueFalse, addVideo, bringToFront, clearCanvas, clearImageAnnotations, clearPhotoFrameAnnotations, deleteFillInTheBlanks, deleteFlashcard, deleteImage, deleteLineById, deleteLongAnswer, deleteMultipleChoice, deletePhotoFrame, deleteShape, deleteShortAnswer, deleteSlide, deleteText, deleteTrueFalse, deleteVideo, duplicateFillInTheBlanks, duplicateFlashcard, duplicateImage, duplicateLine, duplicateLongAnswer, duplicateMultipleChoice, duplicatePhotoFrame, duplicateShape, duplicateShortAnswer, duplicateSlide, duplicateText, duplicateTrueFalse, duplicateVideo, editFlashcard, editMultipleChoice, exportSlideAsBlob, exportSlideAsImage, finalizeDrawing, getCompressionStats, getSlideDataURL, loadSlides, mergeToolbarConfig, nextFlashcard, previousFlashcard, redo, removeLine, reorderSlides, saveToHistory, selectAllSlides, selectCanAddSlide, selectCurrentSlide, selectCurrentSlideId, selectSlideById, sendToBack, setActivityType, setAltText, setAudioData, setBackgroundColor, setCurrentSlide, setEditingActivity, setEditingTextId, setLines, setLink, setPenColor, setShowFlashcardForm, setShowMcqForm, setSketchMode, setStrokeWidth, setTool, simplifyFlatPoints, simplifyLine, simplifyLines, store, toggleImageDrawingMode, toggleLock, togglePhotoFrameDrawingMode, toggleSketchMode, toggleVideoPlaying, undo, updateElementOrder, updateFillInTheBlanks, updateFlashcard, updateImage, updateImageAnnotation, updateLastLine, updateLinePosition, updateLineTransform, updateLongAnswer, updateMultipleChoice, updatePhotoFrame, updatePhotoFrameAnnotation, updateShape, updateShortAnswer, updateSlideThumbnail, updateText, updateTrueFalse, updateVideo, useDispatch, useSelector, useSlidesPersistence };
922
+ export { type ActionType, type ActivityType, type AppDispatch, BASIC_EDITOR_TOOLBAR_CONFIG, BottomToolbar, type BottomToolbarProps, Canvas, type CanvasProps, type ContextMenuConfig, DEFAULT_CONTEXT_MENU_CONFIG, DEFAULT_TOOLBAR_CONFIG, EditorRoot, type EditorRootProps, type ExportOptions, type FillInTheBlanks, type FlashcardElement, type ImageElement, type Line$1 as Line, type LongAnswer, type MediaType, type MultipleChoice, type PhotoFrameElement, type PreparedImageElement, type PreparedPhotoFrameElement, type PreparedSlide, type PreparedVideoElement, PublishButton, type PublishButtonProps, type PublishPayload, type PublishProgress, type PublishResponse, type RootState, ScreenRecorder, type Shape, type ShapeType, type ShortAnswer, type Slide, SlideNavigation, type TextElement, type ToolType, Toolbar, type ToolbarActionsConfig, type ToolbarConfig, type ToolbarProps, type ToolbarToolsConfig, TopNavBar, type TopNavBarProps, type TrueFalse, VIEWER_TOOLBAR_CONFIG, type VideoElement, addFillInTheBlanks, addFlashcard, addImage, addImageAnnotation, addLine, addLongAnswer, addMultipleChoice, addPhotoFrame, addPhotoFrameAnnotation, addShape, addShortAnswer, addSlide, addText, addTrueFalse, addVideo, arrayBufferToBase64, bringToFront, clearCanvas, clearImageAnnotations, clearPhotoFrameAnnotations, deleteFillInTheBlanks, deleteFlashcard, deleteImage, deleteLineById, deleteLongAnswer, deleteMultipleChoice, deletePhotoFrame, deleteShape, deleteShortAnswer, deleteSlide, deleteText, deleteTrueFalse, deleteVideo, duplicateFillInTheBlanks, duplicateFlashcard, duplicateImage, duplicateLine, duplicateLongAnswer, duplicateMultipleChoice, duplicatePhotoFrame, duplicateShape, duplicateShortAnswer, duplicateSlide, duplicateText, duplicateTrueFalse, duplicateVideo, editFlashcard, editMultipleChoice, exportSlideAsBlob, exportSlideAsImage, finalizeDrawing, generateAllFullSizeThumbnails, generateFullSizeThumbnail, getCompressionStats, getSlideDataURL, loadSlides, mergeToolbarConfig, nextFlashcard, prepareFormData, prepareSlidesForPublishing, previousFlashcard, redo, removeLine, reorderSlides, saveToHistory, selectAllSlides, selectCanAddSlide, selectCurrentSlide, selectCurrentSlideId, selectSlideById, sendToBack, setActivityType, setAltText, setAudioData, setBackgroundColor, setCurrentSlide, setEditingActivity, setEditingTextId, setLines, setLink, setPenColor, setShowFlashcardForm, setShowMcqForm, setSketchMode, setStrokeWidth, setTool, simplifyFlatPoints, simplifyLine, simplifyLines, store, toggleImageDrawingMode, toggleLock, togglePhotoFrameDrawingMode, toggleSketchMode, toggleVideoPlaying, undo, updateElementOrder, updateFillInTheBlanks, updateFlashcard, updateImage, updateImageAnnotation, updateLastLine, updateLinePosition, updateLineTransform, updateLongAnswer, updateMultipleChoice, updatePhotoFrame, updatePhotoFrameAnnotation, updateShape, updateShortAnswer, updateSlideThumbnail, updateText, updateTrueFalse, updateVideo, useDispatch, useSelector, useSlidesPersistence };