@starrykit/slides-editor 0.1.26

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.
Files changed (80) hide show
  1. package/dist/components/block-manipulation-overlay.d.ts +36 -0
  2. package/dist/components/color-picker.d.ts +10 -0
  3. package/dist/components/context-menu.d.ts +26 -0
  4. package/dist/components/editor-header.d.ts +19 -0
  5. package/dist/components/editor-workspace.d.ts +88 -0
  6. package/dist/components/floating-toolbar-attribute-dialog.d.ts +9 -0
  7. package/dist/components/floating-toolbar-feature.d.ts +8 -0
  8. package/dist/components/floating-toolbar-fields.d.ts +37 -0
  9. package/dist/components/floating-toolbar-parts.d.ts +47 -0
  10. package/dist/components/floating-toolbar-popovers.d.ts +44 -0
  11. package/dist/components/floating-toolbar-sections.d.ts +19 -0
  12. package/dist/components/floating-toolbar-types.d.ts +41 -0
  13. package/dist/components/floating-toolbar.d.ts +4 -0
  14. package/dist/components/image-crop-overlay.d.ts +9 -0
  15. package/dist/components/presenter-view.d.ts +14 -0
  16. package/dist/components/slide-sidebar.d.ts +20 -0
  17. package/dist/components/stage-canvas.d.ts +88 -0
  18. package/dist/components/ui/accordion.d.ts +7 -0
  19. package/dist/components/ui/button.d.ts +13 -0
  20. package/dist/components/ui/context-menu.d.ts +25 -0
  21. package/dist/components/ui/dialog.d.ts +10 -0
  22. package/dist/components/ui/input.d.ts +3 -0
  23. package/dist/components/ui/popover.d.ts +10 -0
  24. package/dist/components/ui/scroll-area.d.ts +5 -0
  25. package/dist/components/ui/select.d.ts +15 -0
  26. package/dist/components/ui/separator.d.ts +4 -0
  27. package/dist/components/ui/tabs.d.ts +11 -0
  28. package/dist/components/ui/textarea.d.ts +3 -0
  29. package/dist/components/ui/toggle-group.d.ts +9 -0
  30. package/dist/components/ui/toggle.d.ts +9 -0
  31. package/dist/components/ui/tooltip.d.ts +7 -0
  32. package/dist/editor-operations.d.ts +17 -0
  33. package/dist/hooks/block-manipulation-geometry.d.ts +27 -0
  34. package/dist/hooks/block-manipulation-operations.d.ts +10 -0
  35. package/dist/hooks/block-manipulation-overlay.d.ts +12 -0
  36. package/dist/hooks/block-manipulation-types.d.ts +81 -0
  37. package/dist/hooks/editor-keyboard-geometry.d.ts +22 -0
  38. package/dist/hooks/editor-keyboard-operations.d.ts +11 -0
  39. package/dist/hooks/editor-keyboard-types.d.ts +38 -0
  40. package/dist/hooks/iframe-active-text-session.d.ts +12 -0
  41. package/dist/hooks/iframe-editing-session.d.ts +10 -0
  42. package/dist/hooks/iframe-text-document-events.d.ts +26 -0
  43. package/dist/hooks/iframe-text-editing-dom.d.ts +12 -0
  44. package/dist/hooks/iframe-text-editing-types.d.ts +38 -0
  45. package/dist/hooks/object-clipboard-commands.d.ts +28 -0
  46. package/dist/hooks/use-block-manipulation.d.ts +3 -0
  47. package/dist/hooks/use-editor-element-actions.d.ts +42 -0
  48. package/dist/hooks/use-editor-keyboard-shortcuts.d.ts +3 -0
  49. package/dist/hooks/use-editor-slide-actions.d.ts +21 -0
  50. package/dist/hooks/use-iframe-text-editing.d.ts +3 -0
  51. package/dist/hooks/use-image-crop.d.ts +40 -0
  52. package/dist/hooks/use-marquee-selection.d.ts +17 -0
  53. package/dist/hooks/use-selection-overlay-actions.d.ts +41 -0
  54. package/dist/hooks/use-slide-history.d.ts +17 -0
  55. package/dist/hooks/use-slide-inspector.d.ts +24 -0
  56. package/dist/hooks/use-slide-thumbnails.d.ts +2 -0
  57. package/dist/hooks/use-stage-viewport.d.ts +13 -0
  58. package/dist/index.d.ts +14 -0
  59. package/dist/index.js +11508 -0
  60. package/dist/lib/block-snap-constants.d.ts +8 -0
  61. package/dist/lib/block-snap-guides.d.ts +6 -0
  62. package/dist/lib/block-snap-targets.d.ts +13 -0
  63. package/dist/lib/block-snap-types.d.ts +32 -0
  64. package/dist/lib/block-snapping.d.ts +17 -0
  65. package/dist/lib/collect-css-properties.d.ts +5 -0
  66. package/dist/lib/editor-selection-operations.d.ts +58 -0
  67. package/dist/lib/editor-selection-structure.d.ts +7 -0
  68. package/dist/lib/element-tool-commit.d.ts +17 -0
  69. package/dist/lib/element-tool-model.d.ts +17 -0
  70. package/dist/lib/element-tool-types.d.ts +35 -0
  71. package/dist/lib/element-tool-values.d.ts +22 -0
  72. package/dist/lib/image-crop.d.ts +24 -0
  73. package/dist/lib/motion.d.ts +8 -0
  74. package/dist/lib/selection-overlay.d.ts +4 -0
  75. package/dist/lib/style-controls.d.ts +17 -0
  76. package/dist/lib/thumbnail-renderer.d.ts +2 -0
  77. package/dist/lib/utils.d.ts +3 -0
  78. package/dist/logo-starry-slides-6GYA6NPA.png +0 -0
  79. package/package.json +38 -0
  80. package/src/styles/index.css +88 -0
@@ -0,0 +1,15 @@
1
+ import { Select as SelectPrimitive } from "radix-ui";
2
+ import type * as React from "react";
3
+ declare function Select({ ...props }: React.ComponentProps<typeof SelectPrimitive.Root>): import("react/jsx-runtime").JSX.Element;
4
+ declare function SelectGroup({ ...props }: React.ComponentProps<typeof SelectPrimitive.Group>): import("react/jsx-runtime").JSX.Element;
5
+ declare function SelectValue({ ...props }: React.ComponentProps<typeof SelectPrimitive.Value>): import("react/jsx-runtime").JSX.Element;
6
+ declare function SelectTrigger({ className, size, children, ...props }: React.ComponentProps<typeof SelectPrimitive.Trigger> & {
7
+ size?: "sm" | "default";
8
+ }): import("react/jsx-runtime").JSX.Element;
9
+ declare function SelectContent({ className, children, position, align, ...props }: React.ComponentProps<typeof SelectPrimitive.Content>): import("react/jsx-runtime").JSX.Element;
10
+ declare function SelectLabel({ className, ...props }: React.ComponentProps<typeof SelectPrimitive.Label>): import("react/jsx-runtime").JSX.Element;
11
+ declare function SelectItem({ className, children, ...props }: React.ComponentProps<typeof SelectPrimitive.Item>): import("react/jsx-runtime").JSX.Element;
12
+ declare function SelectSeparator({ className, ...props }: React.ComponentProps<typeof SelectPrimitive.Separator>): import("react/jsx-runtime").JSX.Element;
13
+ declare function SelectScrollUpButton({ className, ...props }: React.ComponentProps<typeof SelectPrimitive.ScrollUpButton>): import("react/jsx-runtime").JSX.Element;
14
+ declare function SelectScrollDownButton({ className, ...props }: React.ComponentProps<typeof SelectPrimitive.ScrollDownButton>): import("react/jsx-runtime").JSX.Element;
15
+ export { Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, };
@@ -0,0 +1,4 @@
1
+ import { Separator as SeparatorPrimitive } from "radix-ui";
2
+ import type * as React from "react";
3
+ declare function Separator({ className, orientation, decorative, ...props }: React.ComponentProps<typeof SeparatorPrimitive.Root>): import("react/jsx-runtime").JSX.Element;
4
+ export { Separator };
@@ -0,0 +1,11 @@
1
+ import { type VariantProps } from "class-variance-authority";
2
+ import { Tabs as TabsPrimitive } from "radix-ui";
3
+ import type * as React from "react";
4
+ declare function Tabs({ className, orientation, ...props }: React.ComponentProps<typeof TabsPrimitive.Root>): import("react/jsx-runtime").JSX.Element;
5
+ declare const tabsListVariants: (props?: ({
6
+ variant?: "line" | "default" | null | undefined;
7
+ } & import("class-variance-authority/types").ClassProp) | undefined) => string;
8
+ declare function TabsList({ className, variant, ...props }: React.ComponentProps<typeof TabsPrimitive.List> & VariantProps<typeof tabsListVariants>): import("react/jsx-runtime").JSX.Element;
9
+ declare function TabsTrigger({ className, ...props }: React.ComponentProps<typeof TabsPrimitive.Trigger>): import("react/jsx-runtime").JSX.Element;
10
+ declare function TabsContent({ className, ...props }: React.ComponentProps<typeof TabsPrimitive.Content>): import("react/jsx-runtime").JSX.Element;
11
+ export { Tabs, TabsList, TabsTrigger, TabsContent, tabsListVariants };
@@ -0,0 +1,3 @@
1
+ import type * as React from "react";
2
+ declare function Textarea({ className, ...props }: React.ComponentProps<"textarea">): import("react/jsx-runtime").JSX.Element;
3
+ export { Textarea };
@@ -0,0 +1,9 @@
1
+ import type { VariantProps } from "class-variance-authority";
2
+ import { ToggleGroup as ToggleGroupPrimitive } from "radix-ui";
3
+ import * as React from "react";
4
+ import { toggleVariants } from "./toggle";
5
+ declare function ToggleGroup({ className, variant, size, spacing, children, ...props }: React.ComponentProps<typeof ToggleGroupPrimitive.Root> & VariantProps<typeof toggleVariants> & {
6
+ spacing?: number;
7
+ }): import("react/jsx-runtime").JSX.Element;
8
+ declare function ToggleGroupItem({ className, children, variant, size, ...props }: React.ComponentProps<typeof ToggleGroupPrimitive.Item> & VariantProps<typeof toggleVariants>): import("react/jsx-runtime").JSX.Element;
9
+ export { ToggleGroup, ToggleGroupItem };
@@ -0,0 +1,9 @@
1
+ import { type VariantProps } from "class-variance-authority";
2
+ import { Toggle as TogglePrimitive } from "radix-ui";
3
+ import type * as React from "react";
4
+ declare const toggleVariants: (props?: ({
5
+ variant?: "default" | "outline" | null | undefined;
6
+ size?: "default" | "sm" | "lg" | null | undefined;
7
+ } & import("class-variance-authority/types").ClassProp) | undefined) => string;
8
+ declare function Toggle({ className, variant, size, ...props }: React.ComponentProps<typeof TogglePrimitive.Root> & VariantProps<typeof toggleVariants>): import("react/jsx-runtime").JSX.Element;
9
+ export { Toggle, toggleVariants };
@@ -0,0 +1,7 @@
1
+ import { Tooltip as TooltipPrimitive } from "radix-ui";
2
+ import type * as React from "react";
3
+ declare function TooltipProvider({ delayDuration, ...props }: React.ComponentProps<typeof TooltipPrimitive.Provider>): import("react/jsx-runtime").JSX.Element;
4
+ declare function Tooltip({ ...props }: React.ComponentProps<typeof TooltipPrimitive.Root>): import("react/jsx-runtime").JSX.Element;
5
+ declare function TooltipTrigger({ ...props }: React.ComponentProps<typeof TooltipPrimitive.Trigger>): import("react/jsx-runtime").JSX.Element;
6
+ declare function TooltipContent({ className, sideOffset, children, ...props }: React.ComponentProps<typeof TooltipPrimitive.Content>): import("react/jsx-runtime").JSX.Element;
7
+ export { Tooltip, TooltipTrigger, TooltipContent, TooltipProvider };
@@ -0,0 +1,17 @@
1
+ import { type AttributeUpdateOperation, type SlideModel, type StyleUpdateOperation } from "@starrykit/slides-core";
2
+ export declare function getInlineStyleValue(slide: SlideModel, elementId: string, propertyName: string): string;
3
+ export declare function getHtmlAttributeValue(slide: SlideModel, elementId: string, attributeName: string): string;
4
+ export declare function getLockedSlideElementId(slide: SlideModel, elementId: string): string | null | undefined;
5
+ export declare function isSlideElementLocked(slide: SlideModel, elementId: string): boolean;
6
+ export declare function createStyleUpdateOperation({ elementId, nextValue, propertyName, slide, }: {
7
+ elementId: string;
8
+ nextValue: string;
9
+ propertyName: string;
10
+ slide: SlideModel;
11
+ }): StyleUpdateOperation | null;
12
+ export declare function createAttributeUpdateOperation({ attributeName, elementId, nextValue, slide, }: {
13
+ attributeName: string;
14
+ elementId: string;
15
+ nextValue: string;
16
+ slide: SlideModel;
17
+ }): AttributeUpdateOperation | null;
@@ -0,0 +1,27 @@
1
+ import { type EditableElement, type SlideModel, type StageGeometry, type StageRect } from "@starrykit/slides-core";
2
+ import type { ResizeHandlePosition } from "../lib/block-snap-types";
3
+ import type { ManipulationSession } from "./block-manipulation-types";
4
+ export declare function px(value: number): string;
5
+ export declare function clampSize(value: number): number;
6
+ export declare function clampStageSize(value: number, scale: number): number;
7
+ export declare function isLayoutEditable(element: EditableElement | undefined): boolean;
8
+ export declare function isManipulable(element: EditableElement | undefined): boolean;
9
+ export declare function unionStageRects(rects: StageRect[]): StageRect;
10
+ export declare function getRotationDeltaDegrees(pointerX: number, pointerY: number, centerX: number, centerY: number): number;
11
+ export declare function createResizedStageRect({ resizeHandle, scale, stageDeltaX, stageDeltaY, startStageRect, }: {
12
+ resizeHandle: ResizeHandlePosition | null;
13
+ scale: number;
14
+ stageDeltaX: number;
15
+ stageDeltaY: number;
16
+ startStageRect: StageRect;
17
+ }): StageRect;
18
+ export declare function getManipulationElementIds({ activeSlide, doc, mode, selectedElementId, selectedElementIds, }: {
19
+ activeSlide: SlideModel;
20
+ doc: Document;
21
+ mode: "move" | "resize" | "rotate";
22
+ selectedElementId: string;
23
+ selectedElementIds: string[];
24
+ }): string[];
25
+ export declare function getResizeParentElementId(node: HTMLElement, targetNodes: Record<string, HTMLElement>): string | null;
26
+ export declare function applyGeometryScaledResize(session: ManipulationSession, nextSelectionRect: StageRect, geometry: StageGeometry): void;
27
+ export declare function getParentStageRectKey(node: HTMLElement | null): string;
@@ -0,0 +1,10 @@
1
+ import { type AtomicSlideOperation, type ElementLayoutStyleSnapshot, type ElementLayoutUpdateOperation } from "@starrykit/slides-core";
2
+ import type { ManipulationSession } from "./block-manipulation-types";
3
+ export declare function applyLayoutSnapshot(node: HTMLElement, snapshot: ElementLayoutStyleSnapshot): void;
4
+ export declare function createLayoutUpdateOperations(session: ManipulationSession): ElementLayoutUpdateOperation[];
5
+ export declare function toLayoutCommitOperation(session: ManipulationSession, operations: ElementLayoutUpdateOperation[]): ElementLayoutUpdateOperation | {
6
+ type: "operation.batch";
7
+ slideId: string;
8
+ operations: AtomicSlideOperation[];
9
+ timestamp: number;
10
+ };
@@ -0,0 +1,12 @@
1
+ import type { EditableElement, StageRect } from "@starrykit/slides-core";
2
+ import type { SnapGuide } from "../lib/block-snap-types";
3
+ import type { BlockManipulationOverlay } from "./block-manipulation-types";
4
+ export declare function createBlockManipulationOverlay({ isEditingText, isManipulating, isLocked, selectedElement, selectedElementId, snapGuides, stageRect, }: {
5
+ isEditingText: boolean;
6
+ isManipulating: boolean;
7
+ isLocked: boolean;
8
+ selectedElement: EditableElement | undefined;
9
+ selectedElementId: string | null;
10
+ snapGuides: SnapGuide[];
11
+ stageRect: StageRect | null;
12
+ }): BlockManipulationOverlay | null;
@@ -0,0 +1,81 @@
1
+ import type { EditableElement, ElementLayoutStyleSnapshot, ElementLayoutUpdateOperation, SlideBatchOperation, SlideModel, StageGeometry, StageRect } from "@starrykit/slides-core";
2
+ import type { RefObject } from "react";
3
+ import type { ResizeHandleCorner, ResizeHandlePosition, SnapGuide, SnapTarget } from "../lib/block-snap-types";
4
+ export type ManipulationMode = "move" | "resize" | "rotate";
5
+ export interface BlockManipulationOverlay {
6
+ selectionBounds: StageRect;
7
+ snapGuides: SnapGuide[];
8
+ resizeHandles: Array<{
9
+ position: ResizeHandlePosition;
10
+ x: number;
11
+ y: number;
12
+ }>;
13
+ rotationZones: Array<{
14
+ corner: ResizeHandleCorner;
15
+ x: number;
16
+ y: number;
17
+ }>;
18
+ }
19
+ export interface ManipulationSession {
20
+ slideId: string;
21
+ elementId: string;
22
+ elementIds: string[];
23
+ mode: ManipulationMode;
24
+ resizeHandle: ResizeHandlePosition | null;
25
+ startPointer: {
26
+ x: number;
27
+ y: number;
28
+ };
29
+ startStageRect: StageRect;
30
+ centerPoint: {
31
+ x: number;
32
+ y: number;
33
+ };
34
+ previousStyle: ElementLayoutStyleSnapshot;
35
+ previousStyles: Record<string, ElementLayoutStyleSnapshot>;
36
+ startComputedMargins: Record<string, {
37
+ top: number;
38
+ right: number;
39
+ bottom: number;
40
+ left: number;
41
+ }>;
42
+ startElementStageRects: Record<string, StageRect>;
43
+ resizeParentElementIds: Record<string, string | null>;
44
+ startParentStageRects: Record<string, StageRect>;
45
+ targetNodes: Record<string, HTMLElement>;
46
+ snapTargets: {
47
+ vertical: SnapTarget[];
48
+ horizontal: SnapTarget[];
49
+ };
50
+ }
51
+ export interface UseBlockManipulationOptions {
52
+ activeSlide: SlideModel | undefined;
53
+ selectedElement: EditableElement | undefined;
54
+ selectedElementId: string | null;
55
+ selectedElementIds: string[];
56
+ selectedStageRect: StageRect | null;
57
+ iframeRef: RefObject<HTMLIFrameElement | null>;
58
+ stageGeometry: StageGeometry;
59
+ isEditingText: boolean;
60
+ onCommitOperation: (operation: ElementLayoutUpdateOperation | SlideBatchOperation) => void;
61
+ isElementLocked: (elementId: string) => boolean;
62
+ }
63
+ export interface UseBlockManipulationResult {
64
+ manipulationOverlay: BlockManipulationOverlay | null;
65
+ isManipulating: boolean;
66
+ suppressBackgroundClear: boolean;
67
+ beginMove: (event: PointerStartLike, targetElementId?: string) => void;
68
+ beginResize: (position: ResizeHandlePosition, event: PointerStartLike) => void;
69
+ beginRotate: (event: PointerStartLike) => void;
70
+ }
71
+ export interface PointerStartLike {
72
+ clientX: number;
73
+ clientY: number;
74
+ sourceWindow?: Window | null;
75
+ toStagePoint?: (clientX: number, clientY: number) => {
76
+ x: number;
77
+ y: number;
78
+ };
79
+ preventDefault: () => void;
80
+ stopPropagation: () => void;
81
+ }
@@ -0,0 +1,22 @@
1
+ import type { SlideModel } from "@starrykit/slides-core";
2
+ import type { RefObject } from "react";
3
+ import type { SlideRect } from "./editor-keyboard-types";
4
+ export declare function roundCssNumber(value: number): number;
5
+ export declare function placeCopiedElement(elementHtml: string, rect: SlideRect): string;
6
+ export declare function elementRectToSlideRect(elementRect: DOMRect, rootRect: DOMRect): SlideRect;
7
+ export declare function getSlideBounds(iframeRef: RefObject<HTMLIFrameElement | null>, activeSlide: SlideModel, fallback: {
8
+ width: number;
9
+ height: number;
10
+ }): {
11
+ width: number;
12
+ height: number;
13
+ };
14
+ export declare function offsetSlideRect(rect: SlideRect, offsetX: number, offsetY: number): SlideRect;
15
+ export declare function getUnionRect(rects: SlideRect[]): SlideRect | null;
16
+ export declare function getClampedPasteDelta(sourceRect: SlideRect, preferredOffset: number, slide: {
17
+ width: number;
18
+ height: number;
19
+ }): {
20
+ x: number;
21
+ y: number;
22
+ };
@@ -0,0 +1,11 @@
1
+ import { type AtomicSlideOperation, type EditableElement, type SlideOperation } from "@starrykit/slides-core";
2
+ export declare const ARROW_DELTAS: Record<string, {
3
+ x: number;
4
+ y: number;
5
+ }>;
6
+ export declare function isEditableElementTarget(target: EventTarget | null): boolean;
7
+ export declare function isLayoutEditable(element: EditableElement | undefined): boolean;
8
+ export declare function getShortcutStep(event: KeyboardEvent): number;
9
+ export declare function getAllSelectableElementIds(doc: Document | null | undefined): string[];
10
+ export declare function createIdMapForCopiedElement(html: string, sourceElementId: string, nextElementId: string): Record<string, string>;
11
+ export declare function commitOperations(slideId: string, operations: AtomicSlideOperation[], onCommitOperation: (operation: SlideOperation) => void): boolean;
@@ -0,0 +1,38 @@
1
+ import type { ElementInsertOperation, ElementLayoutUpdateOperation, ElementRemoveOperation, SlideModel, SlideOperation } from "@starrykit/slides-core";
2
+ import type { RefObject } from "react";
3
+ export interface ClipboardPayload {
4
+ elements: Array<{
5
+ sourceElementId: string;
6
+ html: string;
7
+ rect: SlideRect;
8
+ parentElementId: string | null;
9
+ previousSiblingElementId: string | null;
10
+ nextSiblingElementId: string | null;
11
+ }>;
12
+ unionRect: SlideRect;
13
+ }
14
+ export interface SlideRect {
15
+ x: number;
16
+ y: number;
17
+ width: number;
18
+ height: number;
19
+ }
20
+ export interface UseEditorKeyboardShortcutsOptions {
21
+ activeSlide: SlideModel | undefined;
22
+ selectedElementIds: string[];
23
+ lockedElementIds: string[];
24
+ iframeRef: RefObject<HTMLIFrameElement | null>;
25
+ slideWidth: number;
26
+ slideHeight: number;
27
+ isEditingText: boolean;
28
+ isSidebarFocused: boolean;
29
+ canUndo: boolean;
30
+ canRedo: boolean;
31
+ onEscapeSelection: () => boolean;
32
+ onNavigateSlide: (direction: "previous" | "next") => boolean;
33
+ onCommitOperation: (operation: ElementInsertOperation | ElementLayoutUpdateOperation | ElementRemoveOperation | SlideOperation) => void;
34
+ onSelectElementIds: (elementIds: string[]) => void;
35
+ onDeleteSlide: (slideId: string) => boolean;
36
+ onUndo: () => void;
37
+ onRedo: () => void;
38
+ }
@@ -0,0 +1,12 @@
1
+ import { type SlideModel } from "@starrykit/slides-core";
2
+ import { type RefObject } from "react";
3
+ import type { TextEditingState } from "./iframe-text-editing-types";
4
+ declare function useActiveTextEditingSession({ activeSlide, cancelTextEditRef, commitTextEditRef, iframeRef, textEditing, textEditingRef, }: {
5
+ activeSlide: SlideModel | undefined;
6
+ cancelTextEditRef: RefObject<() => void>;
7
+ commitTextEditRef: RefObject<(elementId: string, nextText: string) => void>;
8
+ iframeRef: RefObject<HTMLIFrameElement | null>;
9
+ textEditing: TextEditingState | null;
10
+ textEditingRef: RefObject<TextEditingState | null>;
11
+ }): void;
12
+ export { useActiveTextEditingSession };
@@ -0,0 +1,10 @@
1
+ export declare function nextSingleSelection(value: string | null): string[];
2
+ export declare function ensureSelectionContainsTarget(currentIds: string[], targetId: string): string[];
3
+ export declare function clearSelectionForEscape({ selectedElementIds, activeGroupScopeId, }: {
4
+ selectedElementIds: string[];
5
+ activeGroupScopeId: string | null;
6
+ }): {
7
+ handled: boolean;
8
+ nextSelection: string[];
9
+ exitGroupScope: boolean;
10
+ };
@@ -0,0 +1,26 @@
1
+ import { type SlideModel } from "@starrykit/slides-core";
2
+ import { type RefObject } from "react";
3
+ import type { TextEditingState } from "./iframe-text-editing-types";
4
+ interface UseIframeTextDocumentEventsOptions {
5
+ activeGroupScopeIdRef: RefObject<string | null>;
6
+ activeSlide: SlideModel | undefined;
7
+ beginGroupEditingScope: (elementId: string) => void;
8
+ beginTextEditing: (elementId: string) => void;
9
+ clearPreselection: () => void;
10
+ commitTextEditRef: RefObject<(elementId: string, nextText: string) => void>;
11
+ iframeRef: RefObject<HTMLIFrameElement | null>;
12
+ isElementLocked?: (elementId: string) => boolean;
13
+ onBeginPointerMove?: (elementId: string, clientX: number, clientY: number, pointerOptions?: {
14
+ sourceWindow?: Window | null;
15
+ toStagePoint?: (clientX: number, clientY: number) => {
16
+ x: number;
17
+ y: number;
18
+ };
19
+ }) => void;
20
+ openPointerSelectionContextMenu: (clientX: number, clientY: number) => boolean;
21
+ setPreselectedElementId: (updater: (currentId: string | null) => string | null) => void;
22
+ setSelectedElementIds: (updater: string[] | ((currentIds: string[]) => string[])) => void;
23
+ textEditingRef: RefObject<TextEditingState | null>;
24
+ }
25
+ declare function useIframeTextDocumentEvents({ activeGroupScopeIdRef, activeSlide, beginGroupEditingScope, beginTextEditing, clearPreselection, commitTextEditRef, iframeRef, isElementLocked, onBeginPointerMove, openPointerSelectionContextMenu, setPreselectedElementId, setSelectedElementIds, textEditingRef, }: UseIframeTextDocumentEventsOptions): void;
26
+ export { useIframeTextDocumentEvents };
@@ -0,0 +1,12 @@
1
+ export declare function getEditableSelectionTarget(target: Element): HTMLElement | null;
2
+ export declare function getDeepestEditableElementFromPoint(doc: Document, x: number, y: number, activeGroupScopeId: string | null): HTMLElement | null;
3
+ export declare function getOutermostSelectedAncestorFromPoint(doc: Document, x: number, y: number, activeGroupScopeId: string | null, selectedElementIds: string[]): HTMLElement | null;
4
+ export declare function applyGroupScopeFocus(doc: Document, activeGroupScopeId: string | null): void;
5
+ export declare function getEditableSelectionTargetInScope(target: Element, activeGroupScopeId: string | null): HTMLElement | null;
6
+ export declare function ensureEditingTextStyle(doc: Document): void;
7
+ export declare function setNativeTextSelectionEnabled(doc: Document, enabled: boolean): void;
8
+ export declare function selectEditableNodeEnd(editableNode: HTMLElement): void;
9
+ export declare function getEditableTextTargetFromPoint(doc: Document, point: {
10
+ x: number;
11
+ y: number;
12
+ }, activeScopeId: string | null): HTMLElement | null;
@@ -0,0 +1,38 @@
1
+ import type { SlideModel, TextUpdateOperation } from "@starrykit/slides-core";
2
+ import type { Dispatch, RefObject, SetStateAction } from "react";
3
+ export interface TextEditingState {
4
+ slideId: string;
5
+ elementId: string;
6
+ initialText: string;
7
+ }
8
+ export interface UseIframeTextEditingOptions {
9
+ activeSlide: SlideModel | undefined;
10
+ iframeRef: RefObject<HTMLIFrameElement | null>;
11
+ onCommitOperation: (operation: TextUpdateOperation) => void;
12
+ isElementLocked?: (elementId: string) => boolean;
13
+ onOpenSelectionContextMenu?: (clientX: number, clientY: number) => void;
14
+ onBeginPointerMove?: (elementId: string, clientX: number, clientY: number, pointerOptions?: {
15
+ sourceWindow?: Window | null;
16
+ toStagePoint?: (clientX: number, clientY: number) => {
17
+ x: number;
18
+ y: number;
19
+ };
20
+ }) => void;
21
+ }
22
+ export interface UseIframeTextEditingResult {
23
+ selectedElementId: string | null;
24
+ selectedElementIds: string[];
25
+ preselectedElementId: string | null;
26
+ activeGroupScopeId: string | null;
27
+ isEditingText: boolean;
28
+ setSelectedElementId: Dispatch<SetStateAction<string | null>>;
29
+ setSelectedElementIds: Dispatch<SetStateAction<string[]>>;
30
+ beginTextEditing: (elementId: string) => void;
31
+ beginGroupEditingScope: (elementId: string) => void;
32
+ exitGroupEditingScope: () => void;
33
+ clearSelection: () => boolean;
34
+ clearPreselection: () => void;
35
+ updatePointerPreselection: (clientX: number, clientY: number) => string | null;
36
+ retargetPointerSelection: (clientX: number, clientY: number, additive: boolean) => string | null;
37
+ openPointerSelectionContextMenu: (clientX: number, clientY: number) => boolean;
38
+ }
@@ -0,0 +1,28 @@
1
+ import { type ElementInsertOperation, type ElementRemoveOperation, type SlideModel } from "@starrykit/slides-core";
2
+ import type { RefObject } from "react";
3
+ import { commitOperations } from "./editor-keyboard-operations";
4
+ import type { ClipboardPayload } from "./editor-keyboard-types";
5
+ export declare function copyObjectSelection({ slide, selectedElementIds, iframeRef, }: {
6
+ slide: SlideModel | undefined;
7
+ selectedElementIds: string[];
8
+ iframeRef: RefObject<HTMLIFrameElement | null>;
9
+ }): ClipboardPayload | null;
10
+ export declare function createRemoveObjectSelectionOperations({ slide, selectedElementIds, }: {
11
+ slide: SlideModel | undefined;
12
+ selectedElementIds: string[];
13
+ }): ElementRemoveOperation[];
14
+ export declare function createPasteObjectSelection({ slide, payload, iframeRef, slideSize, }: {
15
+ slide: SlideModel | undefined;
16
+ payload: ClipboardPayload | null;
17
+ iframeRef: RefObject<HTMLIFrameElement | null>;
18
+ slideSize: {
19
+ width: number;
20
+ height: number;
21
+ };
22
+ }): {
23
+ operations: ElementInsertOperation[];
24
+ selectedElementIds: string[];
25
+ nextClipboard: ClipboardPayload;
26
+ nextHtmlSource: string;
27
+ } | null;
28
+ export declare function commitObjectOperations(slideId: string, operations: ElementInsertOperation[] | ElementRemoveOperation[], onCommitOperation: Parameters<typeof commitOperations>[2]): boolean;
@@ -0,0 +1,3 @@
1
+ import type { UseBlockManipulationOptions, UseBlockManipulationResult } from "./block-manipulation-types";
2
+ declare function useBlockManipulation({ activeSlide, selectedElement, selectedElementId, selectedElementIds, selectedStageRect, iframeRef, stageGeometry, isEditingText, onCommitOperation, isElementLocked, }: UseBlockManipulationOptions): UseBlockManipulationResult;
3
+ export { useBlockManipulation };
@@ -0,0 +1,42 @@
1
+ import type { SlideModel, SlideOperation, StageRect } from "@starrykit/slides-core";
2
+ import type { RefObject } from "react";
3
+ interface UseEditorElementActionsOptions {
4
+ activeSlide: SlideModel | undefined;
5
+ iframeRef: RefObject<HTMLIFrameElement | null>;
6
+ selectedElementId: string | null;
7
+ selectedElementIds: string[];
8
+ isSelectedElementLocked: boolean;
9
+ selectionOverlay: StageRect | null;
10
+ stage: {
11
+ offsetX: number;
12
+ offsetY: number;
13
+ scale: number;
14
+ width: number;
15
+ height: number;
16
+ };
17
+ onCommitOperation: (operation: SlideOperation) => void;
18
+ onSelectElementIds: (elementIds: string[]) => void;
19
+ onLockedElementIdsBySlideIdChange: (updater: (current: Record<string, string[]>) => Record<string, string[]>) => void;
20
+ }
21
+ declare function useEditorElementActions({ activeSlide, iframeRef, selectedElementId, selectedElementIds, isSelectedElementLocked, selectionOverlay, stage, onCommitOperation, onSelectElementIds, onLockedElementIdsBySlideIdChange, }: UseEditorElementActionsOptions): {
22
+ attributeValues: {
23
+ locked: string;
24
+ ariaLabel: string;
25
+ linkUrl: string;
26
+ };
27
+ commitStyleChange: (propertyName: string, nextValue: string) => void;
28
+ commitStyleChanges: (changes: Array<{
29
+ propertyName: string;
30
+ nextValue: string;
31
+ }>) => void;
32
+ previewStyleChange: (propertyName: string, nextValue: string | null) => void;
33
+ commitAttributeChange: (attributeName: string, nextValue: string) => void;
34
+ commitLayerAction: (action: string) => void;
35
+ duplicateSelection: () => void;
36
+ deleteSelection: () => void;
37
+ groupSelection: () => void;
38
+ ungroupSelection: () => void;
39
+ commitArrangeAction: (action: string) => void;
40
+ distributeSelection: (action: string) => void;
41
+ };
42
+ export { useEditorElementActions };
@@ -0,0 +1,3 @@
1
+ import type { UseEditorKeyboardShortcutsOptions } from "./editor-keyboard-types";
2
+ declare function useEditorKeyboardShortcuts({ activeSlide, selectedElementIds, lockedElementIds, iframeRef, slideWidth, slideHeight, isEditingText, isSidebarFocused, canUndo, canRedo, onEscapeSelection, onNavigateSlide, onCommitOperation, onSelectElementIds, onDeleteSlide, onUndo, onRedo, }: UseEditorKeyboardShortcutsOptions): void;
3
+ export { useEditorKeyboardShortcuts };
@@ -0,0 +1,21 @@
1
+ import type { SlideModel, SlideOperation } from "@starrykit/slides-core";
2
+ interface UseEditorSlideActionsOptions {
3
+ slides: SlideModel[];
4
+ activeSlide: SlideModel | undefined;
5
+ activeSlideId: string;
6
+ onCommitOperation: (operation: SlideOperation) => void;
7
+ onActiveSlideChange: (slideId: string) => void;
8
+ onClearSelection: () => void;
9
+ }
10
+ declare function useEditorSlideActions({ slides, activeSlide, activeSlideId, onCommitOperation, onActiveSlideChange, onClearSelection, }: UseEditorSlideActionsOptions): {
11
+ selectSlideByDirection: (direction: "previous" | "next") => boolean;
12
+ addSlideAfterActive: () => void;
13
+ addSlideAbove: (slideId: string) => void;
14
+ addSlideBelow: (slideId: string) => void;
15
+ duplicateSlide: (slideId: string) => void;
16
+ deleteSlide: (slideId: string) => boolean;
17
+ toggleSlideHidden: (slideId: string) => void;
18
+ renameSlide: (slideId: string, nextTitle: string) => void;
19
+ reorderSlide: (slideId: string, targetIndex: number) => void;
20
+ };
21
+ export { useEditorSlideActions };
@@ -0,0 +1,3 @@
1
+ import type { UseIframeTextEditingOptions, UseIframeTextEditingResult } from "./iframe-text-editing-types";
2
+ declare function useIframeTextEditing({ activeSlide, iframeRef, onCommitOperation, isElementLocked, onOpenSelectionContextMenu, onBeginPointerMove, }: UseIframeTextEditingOptions): UseIframeTextEditingResult;
3
+ export { useIframeTextEditing };
@@ -0,0 +1,40 @@
1
+ import type { SlideModel, SlideOperation, StageRect } from "@starrykit/slides-core";
2
+ import type { MouseEvent as ReactMouseEvent, RefObject } from "react";
3
+ import type { ResizeHandleCorner } from "../lib/block-snap-types";
4
+ import { type CropRadii } from "../lib/image-crop";
5
+ interface UseImageCropOptions {
6
+ activeSlide: SlideModel | undefined;
7
+ selectedElementId: string | null;
8
+ selectedElementType: string;
9
+ selectedStageRect: StageRect | null;
10
+ stageGeometry: {
11
+ scale: number;
12
+ offsetX: number;
13
+ offsetY: number;
14
+ slideWidth: number;
15
+ slideHeight: number;
16
+ };
17
+ iframeRef: RefObject<HTMLIFrameElement | null>;
18
+ isEditingText: boolean;
19
+ isSelectedElementLocked: boolean;
20
+ onCommitOperation: (operation: SlideOperation) => void;
21
+ }
22
+ interface ImageCropOverlay {
23
+ cropBounds: StageRect;
24
+ cropRadii: CropRadii;
25
+ selectionBounds: StageRect;
26
+ handles: Array<{
27
+ corner: ResizeHandleCorner;
28
+ x: number;
29
+ y: number;
30
+ }>;
31
+ }
32
+ declare function useImageCrop({ activeSlide, selectedElementId, selectedElementType, selectedStageRect, stageGeometry, iframeRef, isEditingText, isSelectedElementLocked, onCommitOperation, }: UseImageCropOptions): {
33
+ beginCropMode: () => void;
34
+ beginCropResize: (corner: ResizeHandleCorner, event: ReactMouseEvent<HTMLButtonElement>) => void;
35
+ cropOverlay: ImageCropOverlay | null;
36
+ exitCropMode: () => void;
37
+ isCropMode: boolean;
38
+ };
39
+ export { useImageCrop };
40
+ export type { ImageCropOverlay };
@@ -0,0 +1,17 @@
1
+ import { type SlideModel, type StageGeometry, type StageRect } from "@starrykit/slides-core";
2
+ import { type Dispatch, type RefObject, type SetStateAction } from "react";
3
+ interface UseMarqueeSelectionOptions {
4
+ activeGroupScopeId: string | null;
5
+ activeSlide: SlideModel | undefined;
6
+ iframeRef: RefObject<HTMLIFrameElement | null>;
7
+ isEditingText: boolean;
8
+ onClearPreselection: () => void;
9
+ onSelectElementIds: Dispatch<SetStateAction<string[]>>;
10
+ selectedElementIds: string[];
11
+ stageGeometry: StageGeometry;
12
+ }
13
+ export declare function useMarqueeSelection({ activeGroupScopeId, activeSlide, iframeRef, isEditingText, onClearPreselection, onSelectElementIds, selectedElementIds, stageGeometry, }: UseMarqueeSelectionOptions): {
14
+ marqueeOverlay: StageRect | null;
15
+ isMarqueeSelecting: boolean;
16
+ };
17
+ export {};
@@ -0,0 +1,41 @@
1
+ import { type EditableElement } from "@starrykit/slides-core";
2
+ import type { MouseEvent as ReactMouseEvent, RefObject } from "react";
3
+ import type { ResizeHandlePosition } from "../lib/block-snap-types";
4
+ import type { PointerStartLike } from "./block-manipulation-types";
5
+ interface OverlayPointerDown {
6
+ clientX: number;
7
+ clientY: number;
8
+ additive: boolean;
9
+ targetElementId: string | null;
10
+ }
11
+ interface UseSelectionOverlayActionsOptions {
12
+ selectedElementId: string | null;
13
+ selectedElementIds: string[];
14
+ selectedElement: EditableElement | undefined;
15
+ activeGroupScopeId: string | null;
16
+ isSelectedElementLocked: boolean;
17
+ suppressBackgroundClear: boolean;
18
+ iframeRef: RefObject<HTMLIFrameElement | null>;
19
+ overlayPointerDownRef: RefObject<OverlayPointerDown | null>;
20
+ onToolbarSuppressedChange: (suppressed: boolean) => void;
21
+ onPointerPreselectionUpdate: (clientX: number, clientY: number) => string | null;
22
+ onPointerSelectionRetarget: (clientX: number, clientY: number, additive: boolean) => void;
23
+ onSelectionContextMenuOpen: (clientX: number, clientY: number) => void;
24
+ onBeginMove: (event: PointerStartLike, targetElementId?: string) => void;
25
+ onBeginResize: (position: ResizeHandlePosition, event: PointerStartLike) => void;
26
+ onBeginRotate: (event: PointerStartLike) => void;
27
+ onBeginTextEditing: (elementId: string) => void;
28
+ onBeginGroupEditingScope: (elementId: string) => void;
29
+ onClearSelection: () => void;
30
+ }
31
+ declare function useSelectionOverlayActions({ selectedElementId, selectedElementIds, selectedElement, activeGroupScopeId, isSelectedElementLocked, suppressBackgroundClear, iframeRef, overlayPointerDownRef, onToolbarSuppressedChange, onPointerPreselectionUpdate, onPointerSelectionRetarget, onSelectionContextMenuOpen, onBeginMove, onBeginResize, onBeginRotate, onBeginTextEditing, onBeginGroupEditingScope, onClearSelection, }: UseSelectionOverlayActionsOptions): {
32
+ onSelectionOverlayMouseDown: (event: ReactMouseEvent<HTMLDivElement>) => void;
33
+ onSelectionOverlayMouseMove: (event: ReactMouseEvent<HTMLDivElement>) => void;
34
+ onSelectionOverlayContextMenu: (event: ReactMouseEvent<HTMLDivElement>) => void;
35
+ onSelectionOverlayMouseUp: (event: ReactMouseEvent<HTMLDivElement>) => void;
36
+ onResizeHandleMouseDown: (position: ResizeHandlePosition, event: ReactMouseEvent<HTMLButtonElement>) => void;
37
+ onCornerRotationZoneMouseDown: (event: ReactMouseEvent<HTMLButtonElement>) => void;
38
+ onSelectionOverlayDoubleClick: (event: ReactMouseEvent<HTMLDivElement>) => void;
39
+ onBackgroundClick: () => void;
40
+ };
41
+ export { useSelectionOverlayActions };
@@ -0,0 +1,17 @@
1
+ import { type SlideModel, type SlideOperation } from "@starrykit/slides-core";
2
+ interface SlideHistoryResult {
3
+ slides: SlideModel[];
4
+ activeSlide: SlideModel | undefined;
5
+ activeSlideId: string;
6
+ undoDepth: number;
7
+ redoDepth: number;
8
+ setActiveSlideId: (slideId: string) => void;
9
+ commitOperation: (operation: SlideOperation) => SlideModel[];
10
+ runUndo: () => void;
11
+ runRedo: () => void;
12
+ }
13
+ interface UseSlideHistoryOptions {
14
+ onSlidesChange?: (slides: SlideModel[]) => void;
15
+ }
16
+ declare function useSlideHistory(loadedSlides: SlideModel[], options?: UseSlideHistoryOptions): SlideHistoryResult;
17
+ export { useSlideHistory };