@yoopta/ui 6.0.0-beta.1 → 6.0.0-beta.10
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/action-menu-list/action-menu-list.d.ts +49 -13
- package/dist/action-menu-list/action-menu-list.d.ts.map +1 -1
- package/dist/action-menu-list/context.d.ts +25 -0
- package/dist/action-menu-list/context.d.ts.map +1 -0
- package/dist/action-menu-list/index.d.ts +5 -5
- package/dist/action-menu-list/index.d.ts.map +1 -1
- package/dist/action-menu-list.js +1 -0
- package/dist/block-dnd/block-dnd-context.d.ts +5 -0
- package/dist/block-dnd/block-dnd-context.d.ts.map +1 -0
- package/dist/block-dnd/drag-handle.d.ts +4 -0
- package/dist/block-dnd/drag-handle.d.ts.map +1 -0
- package/dist/block-dnd/index.d.ts +7 -0
- package/dist/block-dnd/index.d.ts.map +1 -0
- package/dist/block-dnd/sortable-block.d.ts +3 -0
- package/dist/block-dnd/sortable-block.d.ts.map +1 -0
- package/dist/block-dnd/types.d.ts +78 -0
- package/dist/block-dnd/types.d.ts.map +1 -0
- package/dist/block-dnd/use-block-dnd.d.ts +29 -0
- package/dist/block-dnd/use-block-dnd.d.ts.map +1 -0
- package/dist/block-dnd.js +1 -0
- package/dist/block-options/block-options.d.ts +68 -8
- package/dist/block-options/block-options.d.ts.map +1 -1
- package/dist/block-options/context.d.ts +11 -0
- package/dist/block-options/context.d.ts.map +1 -0
- package/dist/block-options/hooks.d.ts +14 -894
- package/dist/block-options/hooks.d.ts.map +1 -1
- package/dist/block-options/index.d.ts +2 -3
- package/dist/block-options/index.d.ts.map +1 -1
- package/dist/block-options.js +1 -0
- package/dist/chunks/_tslib-5e145dfd.js +1 -0
- package/dist/chunks/floating-ui.react-727e4287.js +5 -0
- package/dist/chunks/highlight-color-picker-ce0b19ac.js +1 -0
- package/dist/chunks/index-e0185864.js +1 -0
- package/dist/chunks/style-inject.es-e87a8d02.js +1 -0
- package/dist/chunks/throttle-dea4a39e.js +1 -0
- package/dist/element-options/components/element-options-color-picker.d.ts +6 -0
- package/dist/element-options/components/element-options-color-picker.d.ts.map +1 -0
- package/dist/element-options/components/element-options-content.d.ts +6 -0
- package/dist/element-options/components/element-options-content.d.ts.map +1 -0
- package/dist/element-options/components/element-options-group.d.ts +6 -0
- package/dist/element-options/components/element-options-group.d.ts.map +1 -0
- package/dist/element-options/components/element-options-input.d.ts +6 -0
- package/dist/element-options/components/element-options-input.d.ts.map +1 -0
- package/dist/element-options/components/element-options-label.d.ts +6 -0
- package/dist/element-options/components/element-options-label.d.ts.map +1 -0
- package/dist/element-options/components/element-options-root.d.ts +6 -0
- package/dist/element-options/components/element-options-root.d.ts.map +1 -0
- package/dist/element-options/components/element-options-select.d.ts +6 -0
- package/dist/element-options/components/element-options-select.d.ts.map +1 -0
- package/dist/element-options/components/element-options-separator.d.ts +6 -0
- package/dist/element-options/components/element-options-separator.d.ts.map +1 -0
- package/dist/element-options/components/element-options-slider.d.ts +6 -0
- package/dist/element-options/components/element-options-slider.d.ts.map +1 -0
- package/dist/element-options/components/element-options-toggle.d.ts +6 -0
- package/dist/element-options/components/element-options-toggle.d.ts.map +1 -0
- package/dist/element-options/components/element-options-trigger.d.ts +6 -0
- package/dist/element-options/components/element-options-trigger.d.ts.map +1 -0
- package/dist/element-options/context/element-options-context.d.ts +13 -0
- package/dist/element-options/context/element-options-context.d.ts.map +1 -0
- package/dist/element-options/index.d.ts +64 -0
- package/dist/element-options/index.d.ts.map +1 -0
- package/dist/element-options/types.d.ts +107 -0
- package/dist/element-options/types.d.ts.map +1 -0
- package/dist/element-options.js +14 -0
- package/dist/floating-block-actions/context.d.ts +15 -0
- package/dist/floating-block-actions/context.d.ts.map +1 -0
- package/dist/floating-block-actions/floating-block-actions.d.ts +30 -7
- package/dist/floating-block-actions/floating-block-actions.d.ts.map +1 -1
- package/dist/floating-block-actions/hooks.d.ts +1 -29
- package/dist/floating-block-actions/hooks.d.ts.map +1 -1
- package/dist/floating-block-actions/index.d.ts +3 -4
- package/dist/floating-block-actions/index.d.ts.map +1 -1
- package/dist/floating-block-actions.js +1 -1
- package/dist/floating-toolbar/context.d.ts +12 -0
- package/dist/floating-toolbar/context.d.ts.map +1 -0
- package/dist/floating-toolbar/floating-toolbar.d.ts +44 -0
- package/dist/floating-toolbar/floating-toolbar.d.ts.map +1 -0
- package/dist/floating-toolbar/index.d.ts +5 -0
- package/dist/floating-toolbar/index.d.ts.map +1 -0
- package/dist/floating-toolbar.js +1 -0
- package/dist/highlight-color-picker.js +1 -0
- package/dist/index.d.ts +10 -6
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -5
- package/dist/overlay.js +1 -0
- package/dist/portal.js +1 -0
- package/dist/selection-box/SelectionBox.d.ts +19 -0
- package/dist/selection-box/SelectionBox.d.ts.map +1 -0
- package/dist/selection-box/hooks.d.ts +7 -0
- package/dist/selection-box/hooks.d.ts.map +1 -0
- package/dist/selection-box/index.d.ts +4 -0
- package/dist/selection-box/index.d.ts.map +1 -0
- package/dist/selection-box.js +1 -0
- package/dist/slash-command-menu/index.d.ts +0 -1
- package/dist/slash-command-menu/index.d.ts.map +1 -1
- package/dist/slash-command-menu.js +1 -0
- package/package.json +88 -7
- package/dist/action-menu-list/hooks.d.ts +0 -912
- package/dist/action-menu-list/hooks.d.ts.map +0 -1
- package/dist/action-menu-list/store.d.ts +0 -22
- package/dist/action-menu-list/store.d.ts.map +0 -1
- package/dist/action-menu-list/store.test.d.ts +0 -2
- package/dist/action-menu-list/store.test.d.ts.map +0 -1
- package/dist/block-options/store.d.ts +0 -15
- package/dist/block-options/store.d.ts.map +0 -1
- package/dist/block-options/store.test.d.ts +0 -2
- package/dist/block-options/store.test.d.ts.map +0 -1
- package/dist/floating-block-actions/store.d.ts +0 -19
- package/dist/floating-block-actions/store.d.ts.map +0 -1
- package/dist/floating-block-actions/store.test.d.ts +0 -2
- package/dist/floating-block-actions/store.test.d.ts.map +0 -1
- package/dist/index-16ebe43d.js +0 -10
- package/dist/theme/ThemeProvider.d.ts +0 -16
- package/dist/theme/ThemeProvider.d.ts.map +0 -1
- package/dist/theme/ThemeToggle.d.ts +0 -6
- package/dist/theme/ThemeToggle.d.ts.map +0 -1
- package/dist/theme/index.d.ts +0 -5
- package/dist/theme/index.d.ts.map +0 -1
- package/dist/theme/useTheme.d.ts +0 -8
- package/dist/theme/useTheme.d.ts.map +0 -1
- package/dist/toolbar/hooks.d.ts +0 -879
- package/dist/toolbar/hooks.d.ts.map +0 -1
- package/dist/toolbar/index.d.ts +0 -6
- package/dist/toolbar/index.d.ts.map +0 -1
- package/dist/toolbar/store.d.ts +0 -12
- package/dist/toolbar/store.d.ts.map +0 -1
- package/dist/toolbar/store.test.d.ts +0 -2
- package/dist/toolbar/store.test.d.ts.map +0 -1
- package/dist/toolbar/toolbar.d.ts +0 -20
- package/dist/toolbar/toolbar.d.ts.map +0 -1
|
@@ -1,27 +1,63 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { HTMLAttributes, ReactNode } from 'react';
|
|
2
|
+
import type { Placement } from '@floating-ui/react';
|
|
2
3
|
import type { ActionMenuItem } from './types';
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
import './action-menu-list.css';
|
|
5
|
+
type ActionMenuListApi = {
|
|
6
|
+
/** Available actions from editor plugins */
|
|
7
|
+
actions: ActionMenuItem[];
|
|
8
|
+
/** Currently selected action */
|
|
9
|
+
selectedAction: ActionMenuItem | null;
|
|
10
|
+
/** Execute action (toggle block type) */
|
|
11
|
+
onSelect: (type: string) => void;
|
|
12
|
+
/** Whether actions list is empty */
|
|
13
|
+
empty: boolean;
|
|
6
14
|
};
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
15
|
+
type ActionMenuListRootProps = {
|
|
16
|
+
children: ReactNode | ((api: ActionMenuListApi) => ReactNode);
|
|
17
|
+
/** Controlled open state */
|
|
18
|
+
open?: boolean;
|
|
19
|
+
/** Callback when open state changes */
|
|
20
|
+
onOpenChange?: (open: boolean) => void;
|
|
21
|
+
/** Default open state for uncontrolled usage */
|
|
22
|
+
defaultOpen?: boolean;
|
|
23
|
+
/** Anchor element for positioning */
|
|
24
|
+
anchor?: HTMLElement | null;
|
|
25
|
+
/** View mode - 'small' for compact, 'default' for full */
|
|
26
|
+
view?: 'small' | 'default';
|
|
27
|
+
/** Placement relative to anchor */
|
|
28
|
+
placement?: Placement;
|
|
29
|
+
className?: string;
|
|
30
|
+
};
|
|
31
|
+
type ActionMenuListContentProps = {
|
|
32
|
+
children?: ReactNode;
|
|
33
|
+
className?: string;
|
|
34
|
+
} & HTMLAttributes<HTMLDivElement>;
|
|
35
|
+
type ActionMenuListGroupProps = HTMLAttributes<HTMLDivElement>;
|
|
36
|
+
type ActionMenuListItemProps = HTMLAttributes<HTMLButtonElement> & {
|
|
37
|
+
action?: ActionMenuItem;
|
|
10
38
|
selected?: boolean;
|
|
11
39
|
icon?: string | ReactNode;
|
|
12
40
|
};
|
|
13
|
-
|
|
41
|
+
type ActionMenuListEmptyProps = HTMLAttributes<HTMLDivElement>;
|
|
14
42
|
export declare const ActionMenuList: {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
43
|
+
({ children, open: controlledOpen, onOpenChange: controlledOnOpenChange, defaultOpen, anchor, view, placement, className, }: ActionMenuListRootProps): import("react/jsx-runtime").JSX.Element;
|
|
44
|
+
displayName: string;
|
|
45
|
+
} & {
|
|
46
|
+
Root: {
|
|
47
|
+
({ children, open: controlledOpen, onOpenChange: controlledOnOpenChange, defaultOpen, anchor, view, placement, className, }: ActionMenuListRootProps): import("react/jsx-runtime").JSX.Element;
|
|
48
|
+
displayName: string;
|
|
49
|
+
};
|
|
50
|
+
Content: import("react").ForwardRefExoticComponent<{
|
|
51
|
+
children?: ReactNode;
|
|
52
|
+
className?: string | undefined;
|
|
53
|
+
} & HTMLAttributes<HTMLDivElement> & import("react").RefAttributes<HTMLDivElement>>;
|
|
19
54
|
Group: import("react").ForwardRefExoticComponent<ActionMenuListGroupProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
20
55
|
Item: import("react").ForwardRefExoticComponent<HTMLAttributes<HTMLButtonElement> & {
|
|
21
|
-
action
|
|
56
|
+
action?: ActionMenuItem | undefined;
|
|
22
57
|
selected?: boolean | undefined;
|
|
23
58
|
icon?: string | ReactNode;
|
|
24
59
|
} & import("react").RefAttributes<HTMLButtonElement>>;
|
|
25
60
|
Empty: import("react").ForwardRefExoticComponent<ActionMenuListEmptyProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
26
61
|
};
|
|
62
|
+
export type { ActionMenuListRootProps, ActionMenuListContentProps, ActionMenuListGroupProps, ActionMenuListItemProps, ActionMenuListEmptyProps, ActionMenuListApi, };
|
|
27
63
|
//# sourceMappingURL=action-menu-list.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"action-menu-list.d.ts","sourceRoot":"","sources":["../../src/action-menu-list/action-menu-list.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"action-menu-list.d.ts","sourceRoot":"","sources":["../../src/action-menu-list/action-menu-list.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAiB,cAAc,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEtE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAKpD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAI9C,OAAO,wBAAwB,CAAC;AAEhC,KAAK,iBAAiB,GAAG;IACvB,4CAA4C;IAC5C,OAAO,EAAE,cAAc,EAAE,CAAC;IAC1B,gCAAgC;IAChC,cAAc,EAAE,cAAc,GAAG,IAAI,CAAC;IACtC,yCAAyC;IACzC,QAAQ,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IACjC,oCAAoC;IACpC,KAAK,EAAE,OAAO,CAAC;CAChB,CAAC;AAEF,KAAK,uBAAuB,GAAG;IAC7B,QAAQ,EAAE,SAAS,GAAG,CAAC,CAAC,GAAG,EAAE,iBAAiB,KAAK,SAAS,CAAC,CAAC;IAC9D,4BAA4B;IAC5B,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,uCAAuC;IACvC,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;IACvC,gDAAgD;IAChD,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,qCAAqC;IACrC,MAAM,CAAC,EAAE,WAAW,GAAG,IAAI,CAAC;IAC5B,0DAA0D;IAC1D,IAAI,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IAC3B,mCAAmC;IACnC,SAAS,CAAC,EAAE,SAAS,CAAC;IACtB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AAmHF,KAAK,0BAA0B,GAAG;IAChC,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,GAAG,cAAc,CAAC,cAAc,CAAC,CAAC;AAuDnC,KAAK,wBAAwB,GAAG,cAAc,CAAC,cAAc,CAAC,CAAC;AAY/D,KAAK,uBAAuB,GAAG,cAAc,CAAC,iBAAiB,CAAC,GAAG;IACjE,MAAM,CAAC,EAAE,cAAc,CAAC;IACxB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,IAAI,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CAC3B,CAAC;AAgDF,KAAK,wBAAwB,GAAG,cAAc,CAAC,cAAc,CAAC,CAAC;AAY/D,eAAO,MAAM,cAAc;iIA9OxB,uBAAuB;;;;qIAAvB,uBAAuB;;;;mBAyGb,SAAS;;;;;;;eAwEb,MAAM,GAAG,SAAS;;;CAmEzB,CAAC;AAEH,YAAY,EACV,uBAAuB,EACvB,0BAA0B,EAC1B,wBAAwB,EACxB,uBAAuB,EACvB,wBAAwB,EACxB,iBAAiB,GAClB,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { CSSProperties } from 'react';
|
|
2
|
+
import type { ActionMenuItem } from './types';
|
|
3
|
+
export type ActionMenuListContextValue = {
|
|
4
|
+
/** Whether menu is open */
|
|
5
|
+
isOpen: boolean;
|
|
6
|
+
/** Current view mode */
|
|
7
|
+
view: 'small' | 'default';
|
|
8
|
+
/** Available actions from editor plugins */
|
|
9
|
+
actions: ActionMenuItem[];
|
|
10
|
+
/** Currently selected/hovered action */
|
|
11
|
+
selectedAction: ActionMenuItem | null;
|
|
12
|
+
/** Select an action (hover) */
|
|
13
|
+
setSelectedAction: (action: ActionMenuItem) => void;
|
|
14
|
+
/** Execute action (toggle block) */
|
|
15
|
+
onSelect: (type: string) => void;
|
|
16
|
+
/** Close the menu */
|
|
17
|
+
close: () => void;
|
|
18
|
+
/** Floating styles for positioning */
|
|
19
|
+
floatingStyles: CSSProperties;
|
|
20
|
+
/** Ref setter for floating element */
|
|
21
|
+
setFloatingRef: (node: HTMLElement | null) => void;
|
|
22
|
+
};
|
|
23
|
+
export declare const ActionMenuListContext: import("react").Context<ActionMenuListContextValue | null>;
|
|
24
|
+
export declare const useActionMenuListContext: () => ActionMenuListContextValue;
|
|
25
|
+
//# sourceMappingURL=context.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../src/action-menu-list/context.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAC3C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAE9C,MAAM,MAAM,0BAA0B,GAAG;IACvC,2BAA2B;IAC3B,MAAM,EAAE,OAAO,CAAC;IAChB,wBAAwB;IACxB,IAAI,EAAE,OAAO,GAAG,SAAS,CAAC;IAC1B,4CAA4C;IAC5C,OAAO,EAAE,cAAc,EAAE,CAAC;IAC1B,wCAAwC;IACxC,cAAc,EAAE,cAAc,GAAG,IAAI,CAAC;IACtC,+BAA+B;IAC/B,iBAAiB,EAAE,CAAC,MAAM,EAAE,cAAc,KAAK,IAAI,CAAC;IACpD,oCAAoC;IACpC,QAAQ,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IACjC,qBAAqB;IACrB,KAAK,EAAE,MAAM,IAAI,CAAC;IAClB,sCAAsC;IACtC,cAAc,EAAE,aAAa,CAAC;IAC9B,sCAAsC;IACtC,cAAc,EAAE,CAAC,IAAI,EAAE,WAAW,GAAG,IAAI,KAAK,IAAI,CAAC;CACpD,CAAC;AAEF,eAAO,MAAM,qBAAqB,4DAAyD,CAAC;AAE5F,eAAO,MAAM,wBAAwB,kCAQpC,CAAC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export { ActionMenuList } from './action-menu-list';
|
|
2
|
-
export {
|
|
3
|
-
export {
|
|
4
|
-
export type {
|
|
5
|
-
export type {
|
|
6
|
-
|
|
2
|
+
export type { ActionMenuListApi, ActionMenuListContentProps, ActionMenuListEmptyProps, ActionMenuListGroupProps, ActionMenuListItemProps, ActionMenuListRootProps, } from './action-menu-list';
|
|
3
|
+
export { useActionMenuListContext } from './context';
|
|
4
|
+
export type { ActionMenuItem } from './types';
|
|
5
|
+
export type { ActionMenuListContextValue } from './context';
|
|
6
|
+
export { filterToggleActions, mapActionMenuItems } from './utils';
|
|
7
7
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/action-menu-list/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/action-menu-list/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACpD,YAAY,EACV,iBAAiB,EACjB,0BAA0B,EAC1B,wBAAwB,EACxB,wBAAwB,EACxB,uBAAuB,EACvB,uBAAuB,GACxB,MAAM,oBAAoB,CAAC;AAG5B,OAAO,EAAE,wBAAwB,EAAE,MAAM,WAAW,CAAC;AAGrD,YAAY,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAC9C,YAAY,EAAE,0BAA0B,EAAE,MAAM,WAAW,CAAC;AAG5D,OAAO,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{_ as t}from"./chunks/_tslib-5e145dfd.js";import{jsx as i,jsxs as o,Fragment as e}from"react/jsx-runtime";import{createContext as n,useContext as a,forwardRef as l,useState as s,useMemo as r,useCallback as c,isValidElement as u,cloneElement as p}from"react";import{d,u as m,f as y,s as g,o as v,a as h,c as f}from"./chunks/floating-ui.react-727e4287.js";import{Blocks as b,getAllowedPluginsFromElement as x,getRootBlockElement as w,useYooptaEditor as k}from"@yoopta/editor";import{s as j}from"./chunks/style-inject.es-e87a8d02.js";import{Portal as N}from"./portal.js";import{Overlay as O}from"./overlay.js";import"react-dom";const A=n(null),z=()=>{const t=a(A);if(!t)throw new Error("ActionMenuList components must be used within <ActionMenuList>");return t};function M(t){const i=Object.keys(t.plugins);let o=null;if("number"==typeof t.path.current){const i=b.getBlockSlate(t,{at:t.path.current});i&&(o=x(t,i))}let e=i;return o&&o.length>0&&(e="string"==typeof i[0]?i.filter(t=>o.includes(t)):i.filter(t=>o.includes(t.type))),e.map(i=>{var o,e,n,a,l,s;if("string"==typeof i){return{type:i,title:(null===(e=null===(o=t.plugins[i].options)||void 0===o?void 0:o.display)||void 0===e?void 0:e.title)||i,description:null===(a=null===(n=t.plugins[i].options)||void 0===n?void 0:n.display)||void 0===a?void 0:a.description,icon:null===(s=null===(l=t.plugins[i].options)||void 0===l?void 0:l.display)||void 0===s?void 0:s.icon}}return i})}function S(t,i){var o;const e=t.plugins[i];if(!e)return!1;const n=w(e.elements);return"void"!==(null===(o=null==n?void 0:n.props)||void 0===o?void 0:o.nodeType)}j(".yoopta-ui-action-menu-list-overlay{background:transparent;z-index:var(--yoopta-ui-action-menu-z-index,9999)}.yoopta-ui-action-menu-list{bottom:auto;left:0;margin:0;position:absolute;right:auto;top:0;z-index:var(--yoopta-ui-action-menu-z-index,9999)}.yoopta-ui-action-menu-list-content{background:hsl(var(--yoopta-ui-background));border:1px solid hsl(var(--yoopta-ui-border));border-radius:var(--yoopta-ui-action-menu-radius,.5rem);box-shadow:var(\n --yoopta-ui-action-menu-shadow,0 4px 6px -1px rgba(0,0,0,.1),0 2px 4px -2px rgba(0,0,0,.1)\n );max-height:var(--yoopta-ui-action-menu-max-height,330px);overflow-x:hidden;overflow-y:auto;padding:var(--yoopta-ui-action-menu-padding,.5rem);-webkit-user-select:none;-moz-user-select:none;user-select:none}.yoopta-ui-action-menu-list-group{color:hsl(var(--yoopta-ui-foreground));overflow:hidden;padding:0}.yoopta-ui-action-menu-list-item{align-items:center;background:transparent;border:none;border-radius:var(--yoopta-ui-action-menu-item-radius,.375rem);color:hsl(var(--yoopta-ui-foreground));cursor:pointer;display:flex;font-size:var(--yoopta-ui-action-menu-item-font-size,.875rem);gap:var(--yoopta-ui-action-menu-item-gap,.5rem);margin-bottom:.125rem;outline:none;padding:var(--yoopta-ui-action-menu-item-padding,.5rem);text-align:left;transition:background-color .15s ease-out;width:100%}.yoopta-ui-action-menu-list-item:last-child{margin-bottom:0}.yoopta-ui-action-menu-list-item:hover,.yoopta-ui-action-menu-list-item[data-selected=true]{background:hsl(var(--yoopta-ui-accent))}.yoopta-ui-action-menu-list-item:focus-visible{outline:2px solid hsl(var(--yoopta-ui-ring));outline-offset:2px}.yoopta-ui-action-menu-list-item-icon{align-items:center;background:hsl(var(--yoopta-ui-background));border:1px solid hsl(var(--yoopta-ui-border));border-radius:var(--yoopta-ui-action-menu-icon-radius,.375rem);display:flex;flex-shrink:0;justify-content:center}.yoopta-ui-action-menu-list-item-icon img,.yoopta-ui-action-menu-list-item-icon svg{height:100%;-o-object-fit:contain;object-fit:contain;width:100%}.yoopta-ui-action-menu-list-item-content{flex:1;min-width:0}.yoopta-ui-action-menu-list-item-title{font-weight:500;line-height:1.25}.yoopta-ui-action-menu-list-item-description{color:hsl(var(--yoopta-ui-muted-foreground));font-size:var(--yoopta-ui-action-menu-item-description-font-size,.75rem);line-height:1.25;margin-top:.125rem;max-width:200px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.yoopta-ui-action-menu-list-empty{color:hsl(var(--yoopta-ui-muted-foreground));font-size:var(--yoopta-ui-action-menu-empty-font-size,.75rem);padding:var(--yoopta-ui-action-menu-empty-padding,.5rem);text-align:left}.yoopta-ui-action-menu-list-small{max-height:280px;min-width:180px;padding:.375rem}.yoopta-ui-action-menu-list-small .yoopta-ui-action-menu-list-item{font-size:.8125rem;gap:.375rem;padding:.375rem .5rem}.yoopta-ui-action-menu-list-small .yoopta-ui-action-menu-list-item-icon{height:20px;padding:2px;width:20px}.yoopta-ui-action-menu-list-small .yoopta-ui-action-menu-list-item-title{font-size:.8125rem}.yoopta-ui-action-menu-list-small .yoopta-ui-action-menu-list-item-description{display:none}.yoopta-ui-action-menu-list-default{min-width:244px}.yoopta-ui-action-menu-list-default .yoopta-ui-action-menu-list-item-icon{height:40px;padding:6px;width:40px}.yoopta-ui-action-menu-list-content::-webkit-scrollbar{width:8px}.yoopta-ui-action-menu-list-content::-webkit-scrollbar-track{background:transparent}.yoopta-ui-action-menu-list-content::-webkit-scrollbar-thumb{background:hsl(var(--yoopta-ui-border));border-radius:4px}.yoopta-ui-action-menu-list-content::-webkit-scrollbar-thumb:hover{background:hsl(var(--yoopta-ui-muted-foreground))}");const C=({children:t,open:o,onOpenChange:e,defaultOpen:n=!1,anchor:a=null,view:l="default",placement:u="bottom-start",className:p=""})=>{var d;const b=k(),[x,j]=s(n),N=void 0!==o,O=N?o:x,z=r(()=>M(b).filter(t=>S(b,t.type)).filter(t=>{var i,o,e;const n=b.plugins[t.type],a=w(n.elements);return"inline"!==(null===(i=null==a?void 0:a.props)||void 0===i?void 0:i.nodeType)&&"inlineVoid"!==(null===(o=null==a?void 0:a.props)||void 0===o?void 0:o.nodeType)&&"void"!==(null===(e=null==a?void 0:a.props)||void 0===e?void 0:e.nodeType)}),[b]),[C,L]=s(null!==(d=z[0])&&void 0!==d?d:null),{refs:E,floatingStyles:$,context:F}=m({elements:{reference:a},placement:u,open:O,middleware:[y(),g(),v(10)],whileElementsMounted:h}),{isMounted:T,styles:B}=f(F,{duration:100}),I=r(()=>Object.assign(Object.assign(Object.assign({},$),B),{minWidth:"small"===l?200:244}),[$,B,l]),P=c(()=>{var t;N||j(!1),null==e||e(!1),L(null!==(t=z[0])&&void 0!==t?t:null)},[N,e,z]),R=c(t=>{Array.isArray(b.path.selected)&&b.path.selected.length>0?b.batchOperations(()=>{b.path.selected.forEach(i=>{b.toggleBlock(t,{preserveContent:!0,focus:!0,at:i})})}):b.toggleBlock(t,{preserveContent:!0,focus:!0,at:b.path.current}),P()},[b,P]),G=r(()=>({isOpen:T,view:l,actions:z,selectedAction:C,setSelectedAction:L,onSelect:R,close:P,floatingStyles:I,setFloatingRef:E.setFloating}),[T,l,z,C,R,P,I,E.setFloating]),_={actions:z,selectedAction:C,onSelect:R,empty:0===z.length},D="function"==typeof t?t(_):t;return i(A.Provider,Object.assign({value:G},{children:i("div",Object.assign({className:p},{children:D}))}))};C.displayName="ActionMenuList";const L=l((o,e)=>{var{children:n,className:a=""}=o,l=t(o,["children","className"]);const{isOpen:s,floatingStyles:r,setFloatingRef:c,actions:u,selectedAction:p,setSelectedAction:m,onSelect:y,view:g,close:v}=z(),h=d([e,c]);if(!s)return null;const f=null!=n?n:0===u.length?i(F,{}):i(E,{children:u.map(t=>i($,{action:t,selected:t.type===(null==p?void 0:p.type),onMouseEnter:()=>m(t),onClick:()=>y(t.type)},t.type))});return i(N,Object.assign({id:"yoopta-ui-action-menu-list-portal"},{children:i(O,Object.assign({lockScroll:!1,onClick:v,className:"yoopta-ui-action-menu-list-overlay"},{children:i("div",Object.assign({ref:h,role:"listbox",tabIndex:0,className:`yoopta-ui-action-menu-list-content yoopta-ui-action-menu-list-${g} ${a}`,style:r,onMouseDown:t=>t.stopPropagation(),onClick:t=>t.stopPropagation()},l,{children:f}))}))}))});L.displayName="ActionMenuList.Content";const E=l((o,e)=>{var{children:n,className:a=""}=o,l=t(o,["children","className"]);return i("div",Object.assign({ref:e,className:`yoopta-ui-action-menu-list-group ${a}`},l,{children:n}))});E.displayName="ActionMenuList.Group";const $=l((n,a)=>{var{action:l,selected:s,icon:r,className:c="",children:d}=n,m=t(n,["action","selected","icon","className","children"]);const y=null!=r?r:null==l?void 0:l.icon;return o("button",Object.assign({ref:a,type:"button",className:`yoopta-ui-action-menu-list-item ${s?"selected":""} ${c}`,"data-action-menu-item-type":null==l?void 0:l.type,"data-selected":s,"aria-pressed":s},m,{children:[l&&o(e,{children:[y&&i("div",Object.assign({className:"yoopta-ui-action-menu-list-item-icon"},{children:(t=>{if(!t)return null;if("string"==typeof t)return i("img",{src:t,alt:"icon"});if(u(t))return p(t);return i(t,{})})(y)})),o("div",Object.assign({className:"yoopta-ui-action-menu-list-item-content"},{children:[i("div",Object.assign({className:"yoopta-ui-action-menu-list-item-title"},{children:null==l?void 0:l.title})),(null==l?void 0:l.description)&&i("div",Object.assign({className:"yoopta-ui-action-menu-list-item-description"},{children:null==l?void 0:l.description}))]}))]}),d]}))});$.displayName="ActionMenuList.Item";const F=l((o,e)=>{var{children:n,className:a=""}=o,l=t(o,["children","className"]);return i("div",Object.assign({ref:e,className:`yoopta-ui-action-menu-list-empty ${a}`},l,{children:null!=n?n:"No actions available"}))});F.displayName="ActionMenuList.Empty";const T=Object.assign(C,{Root:C,Content:L,Group:E,Item:$,Empty:F});export{T as ActionMenuList,S as filterToggleActions,M as mapActionMenuItems,z as useActionMenuListContext};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { BlockDndContextProps, BlockDndContextValue } from './types';
|
|
2
|
+
import './block-dnd.css';
|
|
3
|
+
export declare const useBlockDndContext: () => BlockDndContextValue;
|
|
4
|
+
export declare const BlockDndContext: ({ editor, children, onDragStart, onDragEnd, renderDragOverlay, enableMultiDrag, }: BlockDndContextProps) => import("react/jsx-runtime").JSX.Element;
|
|
5
|
+
//# sourceMappingURL=block-dnd-context.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"block-dnd-context.d.ts","sourceRoot":"","sources":["../../src/block-dnd/block-dnd-context.tsx"],"names":[],"mappings":"AAeA,OAAO,KAAK,EAAE,oBAAoB,EAAE,oBAAoB,EAAqB,MAAM,SAAS,CAAC;AAC7F,OAAO,iBAAiB,CAAC;AAIzB,eAAO,MAAM,kBAAkB,QAAO,oBAMrC,CAAC;AAQF,eAAO,MAAM,eAAe,sFAOzB,oBAAoB,4CAgNtB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"drag-handle.d.ts","sourceRoot":"","sources":["../../src/block-dnd/drag-handle.tsx"],"names":[],"mappings":";AAIA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAE/C,eAAO,MAAM,UAAU,+GA2KtB,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export { BlockDndContext, useBlockDndContext } from './block-dnd-context';
|
|
2
|
+
export { SortableBlock } from './sortable-block';
|
|
3
|
+
export { DragHandle } from './drag-handle';
|
|
4
|
+
export { useBlockDnd, getOrderedBlockIds } from './use-block-dnd';
|
|
5
|
+
export type { BlockDndContextProps, BlockDndContextValue, SortableBlockData, SortableBlockProps, DragHandleProps, DropIndicatorProps, } from './types';
|
|
6
|
+
export type { UseBlockDndOptions, UseBlockDndReturn } from './use-block-dnd';
|
|
7
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/block-dnd/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAC1E,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,WAAW,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAClE,YAAY,EACV,oBAAoB,EACpB,oBAAoB,EACpB,iBAAiB,EACjB,kBAAkB,EAClB,eAAe,EACf,kBAAkB,GACnB,MAAM,SAAS,CAAC;AACjB,YAAY,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sortable-block.d.ts","sourceRoot":"","sources":["../../src/block-dnd/sortable-block.tsx"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAElD,eAAO,MAAM,aAAa,yDAA0E,kBAAkB,4CAkErH,CAAC"}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
import type { DragEndEvent, DragStartEvent, UniqueIdentifier } from '@dnd-kit/core';
|
|
3
|
+
import type { YooEditor, YooptaBlockData } from '@yoopta/editor';
|
|
4
|
+
export type SortableBlockData = {
|
|
5
|
+
/** setActivatorNodeRef from useSortable */
|
|
6
|
+
setActivatorNodeRef: (node: HTMLElement | null) => void;
|
|
7
|
+
/** listeners from useSortable */
|
|
8
|
+
listeners: Record<string, (event: any) => void>;
|
|
9
|
+
/** attributes from useSortable */
|
|
10
|
+
attributes: Record<string, any>;
|
|
11
|
+
};
|
|
12
|
+
export type BlockDndContextValue = {
|
|
13
|
+
/** Currently dragging block ID */
|
|
14
|
+
activeId: UniqueIdentifier | null;
|
|
15
|
+
/** Currently dragging block data */
|
|
16
|
+
activeBlock: YooptaBlockData | null;
|
|
17
|
+
/** Whether drag is in progress */
|
|
18
|
+
isDragging: boolean;
|
|
19
|
+
/** IDs of blocks being dragged (for multi-select) */
|
|
20
|
+
draggedIds: UniqueIdentifier[];
|
|
21
|
+
/** The editor instance */
|
|
22
|
+
editor: YooEditor;
|
|
23
|
+
/** Register sortable data for a block */
|
|
24
|
+
registerSortable: (blockId: string, data: SortableBlockData) => void;
|
|
25
|
+
/** Unregister sortable data for a block */
|
|
26
|
+
unregisterSortable: (blockId: string) => void;
|
|
27
|
+
/** Get sortable data for a block */
|
|
28
|
+
getSortable: (blockId: string) => SortableBlockData | null;
|
|
29
|
+
};
|
|
30
|
+
export type BlockDndContextProps = {
|
|
31
|
+
/** The Yoopta editor instance */
|
|
32
|
+
editor: YooEditor;
|
|
33
|
+
/** Children to render */
|
|
34
|
+
children: ReactNode;
|
|
35
|
+
/** Called when drag starts */
|
|
36
|
+
onDragStart?: (event: DragStartEvent, blocks: YooptaBlockData[]) => void;
|
|
37
|
+
/** Called when drag ends */
|
|
38
|
+
onDragEnd?: (event: DragEndEvent, moved: boolean) => void;
|
|
39
|
+
/** Custom drag overlay render */
|
|
40
|
+
renderDragOverlay?: (blocks: YooptaBlockData[]) => ReactNode;
|
|
41
|
+
/** Enable multi-block drag when blocks are selected */
|
|
42
|
+
enableMultiDrag?: boolean;
|
|
43
|
+
};
|
|
44
|
+
export type SortableBlockProps = {
|
|
45
|
+
/** Unique block ID */
|
|
46
|
+
id: string;
|
|
47
|
+
/** Block index in the list */
|
|
48
|
+
index?: number;
|
|
49
|
+
/** Children to render */
|
|
50
|
+
children: ReactNode;
|
|
51
|
+
/** Additional class name */
|
|
52
|
+
className?: string;
|
|
53
|
+
/** Whether this block is disabled for dragging */
|
|
54
|
+
disabled?: boolean;
|
|
55
|
+
/** If true, listeners won't be applied to the block (use DragHandle instead) */
|
|
56
|
+
useDragHandle?: boolean;
|
|
57
|
+
};
|
|
58
|
+
export type DragHandleProps = {
|
|
59
|
+
/** Block ID this handle controls */
|
|
60
|
+
blockId: string | null;
|
|
61
|
+
/** Children (usually an icon) */
|
|
62
|
+
children: ReactNode;
|
|
63
|
+
/** Additional class name */
|
|
64
|
+
className?: string;
|
|
65
|
+
/** Called when drag handle is clicked (not dragged) */
|
|
66
|
+
onClick?: (e: MouseEvent) => void;
|
|
67
|
+
/** If true, merges props and event handlers with the child element */
|
|
68
|
+
asChild?: boolean;
|
|
69
|
+
};
|
|
70
|
+
export type DropIndicatorProps = {
|
|
71
|
+
/** Whether to show the indicator */
|
|
72
|
+
isVisible: boolean;
|
|
73
|
+
/** Position: 'before' or 'after' the target block */
|
|
74
|
+
position?: 'before' | 'after';
|
|
75
|
+
/** Additional class name */
|
|
76
|
+
className?: string;
|
|
77
|
+
};
|
|
78
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/block-dnd/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,KAAK,EAAE,YAAY,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AACpF,OAAO,KAAK,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAEjE,MAAM,MAAM,iBAAiB,GAAG;IAC9B,2CAA2C;IAC3C,mBAAmB,EAAE,CAAC,IAAI,EAAE,WAAW,GAAG,IAAI,KAAK,IAAI,CAAC;IACxD,iCAAiC;IACjC,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,CAAC,KAAK,EAAE,GAAG,KAAK,IAAI,CAAC,CAAC;IAChD,kCAAkC;IAClC,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;CACjC,CAAC;AAEF,MAAM,MAAM,oBAAoB,GAAG;IACjC,kCAAkC;IAClC,QAAQ,EAAE,gBAAgB,GAAG,IAAI,CAAC;IAClC,oCAAoC;IACpC,WAAW,EAAE,eAAe,GAAG,IAAI,CAAC;IACpC,kCAAkC;IAClC,UAAU,EAAE,OAAO,CAAC;IACpB,qDAAqD;IACrD,UAAU,EAAE,gBAAgB,EAAE,CAAC;IAC/B,0BAA0B;IAC1B,MAAM,EAAE,SAAS,CAAC;IAClB,yCAAyC;IACzC,gBAAgB,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,iBAAiB,KAAK,IAAI,CAAC;IACrE,2CAA2C;IAC3C,kBAAkB,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;IAC9C,oCAAoC;IACpC,WAAW,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,iBAAiB,GAAG,IAAI,CAAC;CAC5D,CAAC;AAEF,MAAM,MAAM,oBAAoB,GAAG;IACjC,iCAAiC;IACjC,MAAM,EAAE,SAAS,CAAC;IAClB,yBAAyB;IACzB,QAAQ,EAAE,SAAS,CAAC;IACpB,8BAA8B;IAC9B,WAAW,CAAC,EAAE,CAAC,KAAK,EAAE,cAAc,EAAE,MAAM,EAAE,eAAe,EAAE,KAAK,IAAI,CAAC;IACzE,4BAA4B;IAC5B,SAAS,CAAC,EAAE,CAAC,KAAK,EAAE,YAAY,EAAE,KAAK,EAAE,OAAO,KAAK,IAAI,CAAC;IAC1D,iCAAiC;IACjC,iBAAiB,CAAC,EAAE,CAAC,MAAM,EAAE,eAAe,EAAE,KAAK,SAAS,CAAC;IAC7D,uDAAuD;IACvD,eAAe,CAAC,EAAE,OAAO,CAAC;CAC3B,CAAC;AAEF,MAAM,MAAM,kBAAkB,GAAG;IAC/B,sBAAsB;IACtB,EAAE,EAAE,MAAM,CAAC;IACX,8BAA8B;IAC9B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,yBAAyB;IACzB,QAAQ,EAAE,SAAS,CAAC;IACpB,4BAA4B;IAC5B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,kDAAkD;IAClD,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,gFAAgF;IAChF,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB,CAAC;AAEF,MAAM,MAAM,eAAe,GAAG;IAC5B,oCAAoC;IACpC,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,iCAAiC;IACjC,QAAQ,EAAE,SAAS,CAAC;IACpB,4BAA4B;IAC5B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,uDAAuD;IACvD,OAAO,CAAC,EAAE,CAAC,CAAC,EAAE,UAAU,KAAK,IAAI,CAAC;IAClC,sEAAsE;IACtE,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB,CAAC;AAEF,MAAM,MAAM,kBAAkB,GAAG;IAC/B,oCAAoC;IACpC,SAAS,EAAE,OAAO,CAAC;IACnB,qDAAqD;IACrD,QAAQ,CAAC,EAAE,QAAQ,GAAG,OAAO,CAAC;IAC9B,4BAA4B;IAC5B,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { YooEditor } from '@yoopta/editor';
|
|
2
|
+
export type UseBlockDndOptions = {
|
|
3
|
+
blockId?: string | null;
|
|
4
|
+
};
|
|
5
|
+
export type UseBlockDndReturn = {
|
|
6
|
+
/** Whether any block is being dragged */
|
|
7
|
+
isDragging: boolean;
|
|
8
|
+
/** Whether this specific block is being dragged */
|
|
9
|
+
isBlockDragging: boolean;
|
|
10
|
+
/** Whether this block is part of a multi-drag selection */
|
|
11
|
+
isPartOfMultiDrag: boolean;
|
|
12
|
+
/** Number of blocks being dragged */
|
|
13
|
+
dragCount: number;
|
|
14
|
+
/** IDs of blocks being dragged */
|
|
15
|
+
draggedIds: string[];
|
|
16
|
+
/** Move a block to a new position */
|
|
17
|
+
moveBlock: (blockId: string, toIndex: number) => void;
|
|
18
|
+
/** Move multiple blocks to a new position */
|
|
19
|
+
moveBlocks: (blockIds: string[], toIndex: number) => void;
|
|
20
|
+
};
|
|
21
|
+
/**
|
|
22
|
+
* Hook to access block DnD state and actions
|
|
23
|
+
*/
|
|
24
|
+
export declare const useBlockDnd: (options?: UseBlockDndOptions) => UseBlockDndReturn;
|
|
25
|
+
/**
|
|
26
|
+
* Get sorted block IDs from the editor
|
|
27
|
+
*/
|
|
28
|
+
export declare const getOrderedBlockIds: (editor: YooEditor) => string[];
|
|
29
|
+
//# sourceMappingURL=use-block-dnd.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-block-dnd.d.ts","sourceRoot":"","sources":["../../src/block-dnd/use-block-dnd.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAIhD,MAAM,MAAM,kBAAkB,GAAG;IAC/B,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CACzB,CAAC;AAEF,MAAM,MAAM,iBAAiB,GAAG;IAC9B,yCAAyC;IACzC,UAAU,EAAE,OAAO,CAAC;IACpB,mDAAmD;IACnD,eAAe,EAAE,OAAO,CAAC;IACzB,2DAA2D;IAC3D,iBAAiB,EAAE,OAAO,CAAC;IAC3B,qCAAqC;IACrC,SAAS,EAAE,MAAM,CAAC;IAClB,kCAAkC;IAClC,UAAU,EAAE,MAAM,EAAE,CAAC;IACrB,qCAAqC;IACrC,SAAS,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;IACtD,6CAA6C;IAC7C,UAAU,EAAE,CAAC,QAAQ,EAAE,MAAM,EAAE,EAAE,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;CAC3D,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,WAAW,aAAa,kBAAkB,KAAQ,iBAiD9D,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,kBAAkB,WAAY,SAAS,KAAG,MAAM,EAM5D,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{jsxs as e,jsx as t,Fragment as n}from"react/jsx-runtime";import r,{useMemo as o,useLayoutEffect as i,useEffect as a,useRef as l,useCallback as c,useState as s,createContext as d,memo as u,useReducer as g,useContext as v,cloneElement as f,forwardRef as h,isValidElement as p}from"react";import{unstable_batchedUpdates as b,createPortal as y}from"react-dom";import{Blocks as m}from"@yoopta/editor";import{s as w}from"./chunks/style-inject.es-e87a8d02.js";const x="undefined"!=typeof window&&void 0!==window.document&&void 0!==window.document.createElement;function D(e){const t=Object.prototype.toString.call(e);return"[object Window]"===t||"[object global]"===t}function k(e){return"nodeType"in e}function C(e){var t,n;return e?D(e)?e:k(e)&&null!=(t=null==(n=e.ownerDocument)?void 0:n.defaultView)?t:window:window}function R(e){const{Document:t}=C(e);return e instanceof t}function E(e){return!D(e)&&e instanceof C(e).HTMLElement}function N(e){return e instanceof C(e).SVGElement}function O(e){return e?D(e)?e.document:k(e)?R(e)?e:E(e)||N(e)?e.ownerDocument:document:document:document}const S=x?i:a;function I(e){const t=l(e);return S(()=>{t.current=e}),c(function(){for(var e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];return null==t.current?void 0:t.current(...n)},[])}function A(e,t){void 0===t&&(t=[e]);const n=l(e);return S(()=>{n.current!==e&&(n.current=e)},t),n}function T(e,t){const n=l();return o(()=>{const t=e(n.current);return n.current=t,t},[...t])}function M(e){const t=I(e),n=l(null),r=c(e=>{e!==n.current&&(null==t||t(e,n.current)),n.current=e},[]);return[n,r]}function j(e){const t=l();return a(()=>{t.current=e},[e]),t.current}let L={};function B(e,t){return o(()=>{if(t)return t;const n=null==L[e]?0:L[e]+1;return L[e]=n,e+"-"+n},[e,t])}function P(e){return function(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),o=1;o<n;o++)r[o-1]=arguments[o];return r.reduce((t,n)=>{const r=Object.entries(n);for(const[n,o]of r){const r=t[n];null!=r&&(t[n]=r+e*o)}return t},{...t})}}const z=P(1),Y=P(-1);function F(e){if(!e)return!1;const{KeyboardEvent:t}=C(e.target);return t&&e instanceof t}function X(e){if(function(e){if(!e)return!1;const{TouchEvent:t}=C(e.target);return t&&e instanceof t}(e)){if(e.touches&&e.touches.length){const{clientX:t,clientY:n}=e.touches[0];return{x:t,y:n}}if(e.changedTouches&&e.changedTouches.length){const{clientX:t,clientY:n}=e.changedTouches[0];return{x:t,y:n}}}return function(e){return"clientX"in e&&"clientY"in e}(e)?{x:e.clientX,y:e.clientY}:null}const K=Object.freeze({Translate:{toString(e){if(!e)return;const{x:t,y:n}=e;return"translate3d("+(t?Math.round(t):0)+"px, "+(n?Math.round(n):0)+"px, 0)"}},Scale:{toString(e){if(!e)return;const{scaleX:t,scaleY:n}=e;return"scaleX("+t+") scaleY("+n+")"}},Transform:{toString(e){if(e)return[K.Translate.toString(e),K.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:n,easing:r}=e;return t+" "+n+"ms "+r}}}),W="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function U(e){return e.matches(W)?e:e.querySelector(W)}const H={display:"none"};function J(e){let{id:t,value:n}=e;return r.createElement("div",{id:t,style:H},n)}function V(e){let{id:t,announcement:n,ariaLiveType:o="assertive"}=e;return r.createElement("div",{id:t,style:{position:"fixed",top:0,left:0,width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(100%)",whiteSpace:"nowrap"},role:"status","aria-live":o,"aria-atomic":!0},n)}const q=d(null);const G={draggable:"\n To pick up a draggable item, press the space bar.\n While dragging, use the arrow keys to move the item.\n Press space again to drop the item in its new position, or press escape to cancel.\n "},Q={onDragStart(e){let{active:t}=e;return"Picked up draggable item "+t.id+"."},onDragOver(e){let{active:t,over:n}=e;return n?"Draggable item "+t.id+" was moved over droppable area "+n.id+".":"Draggable item "+t.id+" is no longer over a droppable area."},onDragEnd(e){let{active:t,over:n}=e;return n?"Draggable item "+t.id+" was dropped over droppable area "+n.id:"Draggable item "+t.id+" was dropped."},onDragCancel(e){let{active:t}=e;return"Dragging was cancelled. Draggable item "+t.id+" was dropped."}};function Z(e){let{announcements:t=Q,container:n,hiddenTextDescribedById:i,screenReaderInstructions:l=G}=e;const{announce:d,announcement:u}=function(){const[e,t]=s("");return{announce:c(e=>{null!=e&&t(e)},[]),announcement:e}}(),g=B("DndLiveRegion"),[f,h]=s(!1);if(a(()=>{h(!0)},[]),function(e){const t=v(q);a(()=>{if(!t)throw new Error("useDndMonitor must be used within a children of <DndContext>");return t(e)},[e,t])}(o(()=>({onDragStart(e){let{active:n}=e;d(t.onDragStart({active:n}))},onDragMove(e){let{active:n,over:r}=e;t.onDragMove&&d(t.onDragMove({active:n,over:r}))},onDragOver(e){let{active:n,over:r}=e;d(t.onDragOver({active:n,over:r}))},onDragEnd(e){let{active:n,over:r}=e;d(t.onDragEnd({active:n,over:r}))},onDragCancel(e){let{active:n,over:r}=e;d(t.onDragCancel({active:n,over:r}))}}),[d,t])),!f)return null;const p=r.createElement(r.Fragment,null,r.createElement(J,{id:i,value:l.draggable}),r.createElement(V,{id:g,announcement:u}));return n?y(p,n):p}var $;function _(){}function ee(e,t){return o(()=>({sensor:e,options:null!=t?t:{}}),[e,t])}!function(e){e.DragStart="dragStart",e.DragMove="dragMove",e.DragEnd="dragEnd",e.DragCancel="dragCancel",e.DragOver="dragOver",e.RegisterDroppable="registerDroppable",e.SetDroppableDisabled="setDroppableDisabled",e.UnregisterDroppable="unregisterDroppable"}($||($={}));const te=Object.freeze({x:0,y:0});function ne(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function re(e,t){const n=X(e);if(!n)return"0 0";return(n.x-t.left)/t.width*100+"% "+(n.y-t.top)/t.height*100+"%"}function oe(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return n-r}function ie(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return r-n}function ae(e){let{left:t,top:n,height:r,width:o}=e;return[{x:t,y:n},{x:t+o,y:n},{x:t,y:n+r},{x:t+o,y:n+r}]}function le(e,t){if(!e||0===e.length)return null;const[n]=e;return t?n[t]:n}function ce(e,t,n){return void 0===t&&(t=e.left),void 0===n&&(n=e.top),{x:t+.5*e.width,y:n+.5*e.height}}const se=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const o=ce(t,t.left,t.top),i=[];for(const e of r){const{id:t}=e,r=n.get(t);if(r){const n=ne(ce(r),o);i.push({id:t,data:{droppableContainer:e,value:n}})}}return i.sort(oe)};function de(e,t){const n=Math.max(t.top,e.top),r=Math.max(t.left,e.left),o=Math.min(t.left+t.width,e.left+e.width),i=Math.min(t.top+t.height,e.top+e.height),a=o-r,l=i-n;if(r<o&&n<i){const n=t.width*t.height,r=e.width*e.height,o=a*l;return Number((o/(n+r-o)).toFixed(4))}return 0}const ue=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const o=[];for(const e of r){const{id:r}=e,i=n.get(r);if(i){const n=de(i,t);n>0&&o.push({id:r,data:{droppableContainer:e,value:n}})}}return o.sort(ie)};function ge(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:te}function ve(e){return function(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),o=1;o<n;o++)r[o-1]=arguments[o];return r.reduce((t,n)=>({...t,top:t.top+e*n.y,bottom:t.bottom+e*n.y,left:t.left+e*n.x,right:t.right+e*n.x}),{...t})}}const fe=ve(1);function he(e){if(e.startsWith("matrix3d(")){const t=e.slice(9,-1).split(/, /);return{x:+t[12],y:+t[13],scaleX:+t[0],scaleY:+t[5]}}if(e.startsWith("matrix(")){const t=e.slice(7,-1).split(/, /);return{x:+t[4],y:+t[5],scaleX:+t[0],scaleY:+t[3]}}return null}const pe={ignoreTransform:!1};function be(e,t){void 0===t&&(t=pe);let n=e.getBoundingClientRect();if(t.ignoreTransform){const{transform:t,transformOrigin:r}=C(e).getComputedStyle(e);t&&(n=function(e,t,n){const r=he(t);if(!r)return e;const{scaleX:o,scaleY:i,x:a,y:l}=r,c=e.left-a-(1-o)*parseFloat(n),s=e.top-l-(1-i)*parseFloat(n.slice(n.indexOf(" ")+1)),d=o?e.width/o:e.width,u=i?e.height/i:e.height;return{width:d,height:u,top:s,right:c+d,bottom:s+u,left:c}}(n,t,r))}const{top:r,left:o,width:i,height:a,bottom:l,right:c}=n;return{top:r,left:o,width:i,height:a,bottom:l,right:c}}function ye(e){return be(e,{ignoreTransform:!0})}function me(e,t){const n=[];return e?function r(o){if(null!=t&&n.length>=t)return n;if(!o)return n;if(R(o)&&null!=o.scrollingElement&&!n.includes(o.scrollingElement))return n.push(o.scrollingElement),n;if(!E(o)||N(o))return n;if(n.includes(o))return n;const i=C(e).getComputedStyle(o);return o!==e&&function(e,t){void 0===t&&(t=C(e).getComputedStyle(e));const n=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].some(e=>{const r=t[e];return"string"==typeof r&&n.test(r)})}(o,i)&&n.push(o),function(e,t){return void 0===t&&(t=C(e).getComputedStyle(e)),"fixed"===t.position}(o,i)?n:r(o.parentNode)}(e):n}function we(e){const[t]=me(e,1);return null!=t?t:null}function xe(e){return x&&e?D(e)?e:k(e)?R(e)||e===O(e).scrollingElement?window:E(e)?e:null:null:null}function De(e){return D(e)?e.scrollX:e.scrollLeft}function ke(e){return D(e)?e.scrollY:e.scrollTop}function Ce(e){return{x:De(e),y:ke(e)}}var Re;function Ee(e){return!(!x||!e)&&e===document.scrollingElement}function Ne(e){const t={x:0,y:0},n=Ee(e)?{height:window.innerHeight,width:window.innerWidth}:{height:e.clientHeight,width:e.clientWidth},r={x:e.scrollWidth-n.width,y:e.scrollHeight-n.height};return{isTop:e.scrollTop<=t.y,isLeft:e.scrollLeft<=t.x,isBottom:e.scrollTop>=r.y,isRight:e.scrollLeft>=r.x,maxScroll:r,minScroll:t}}!function(e){e[e.Forward=1]="Forward",e[e.Backward=-1]="Backward"}(Re||(Re={}));const Oe={x:.2,y:.2};function Se(e,t,n,r,o){let{top:i,left:a,right:l,bottom:c}=n;void 0===r&&(r=10),void 0===o&&(o=Oe);const{isTop:s,isBottom:d,isLeft:u,isRight:g}=Ne(e),v={x:0,y:0},f={x:0,y:0},h=t.height*o.y,p=t.width*o.x;return!s&&i<=t.top+h?(v.y=Re.Backward,f.y=r*Math.abs((t.top+h-i)/h)):!d&&c>=t.bottom-h&&(v.y=Re.Forward,f.y=r*Math.abs((t.bottom-h-c)/h)),!g&&l>=t.right-p?(v.x=Re.Forward,f.x=r*Math.abs((t.right-p-l)/p)):!u&&a<=t.left+p&&(v.x=Re.Backward,f.x=r*Math.abs((t.left+p-a)/p)),{direction:v,speed:f}}function Ie(e){if(e===document.scrollingElement){const{innerWidth:e,innerHeight:t}=window;return{top:0,left:0,right:e,bottom:t,width:e,height:t}}const{top:t,left:n,right:r,bottom:o}=e.getBoundingClientRect();return{top:t,left:n,right:r,bottom:o,width:e.clientWidth,height:e.clientHeight}}function Ae(e){return e.reduce((e,t)=>z(e,Ce(t)),te)}function Te(e,t){if(void 0===t&&(t=be),!e)return;const{top:n,left:r,bottom:o,right:i}=t(e);we(e)&&(o<=0||i<=0||n>=window.innerHeight||r>=window.innerWidth)&&e.scrollIntoView({block:"center",inline:"center"})}const Me=[["x",["left","right"],function(e){return e.reduce((e,t)=>e+De(t),0)}],["y",["top","bottom"],function(e){return e.reduce((e,t)=>e+ke(t),0)}]];class je{constructor(e,t){this.rect=void 0,this.width=void 0,this.height=void 0,this.top=void 0,this.bottom=void 0,this.right=void 0,this.left=void 0;const n=me(t),r=Ae(n);this.rect={...e},this.width=e.width,this.height=e.height;for(const[e,t,o]of Me)for(const i of t)Object.defineProperty(this,i,{get:()=>{const t=o(n),a=r[e]-t;return this.rect[i]+a},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class Le{constructor(e){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(e=>{var t;return null==(t=this.target)?void 0:t.removeEventListener(...e)})},this.target=e}add(e,t,n){var r;null==(r=this.target)||r.addEventListener(e,t,n),this.listeners.push([e,t,n])}}function Be(e,t){const n=Math.abs(e.x),r=Math.abs(e.y);return"number"==typeof t?Math.sqrt(n**2+r**2)>t:"x"in t&&"y"in t?n>t.x&&r>t.y:"x"in t?n>t.x:"y"in t&&r>t.y}var Pe,ze;function Ye(e){e.preventDefault()}function Fe(e){e.stopPropagation()}!function(e){e.Click="click",e.DragStart="dragstart",e.Keydown="keydown",e.ContextMenu="contextmenu",e.Resize="resize",e.SelectionChange="selectionchange",e.VisibilityChange="visibilitychange"}(Pe||(Pe={})),function(e){e.Space="Space",e.Down="ArrowDown",e.Right="ArrowRight",e.Left="ArrowLeft",e.Up="ArrowUp",e.Esc="Escape",e.Enter="Enter",e.Tab="Tab"}(ze||(ze={}));const Xe={start:[ze.Space,ze.Enter],cancel:[ze.Esc],end:[ze.Space,ze.Enter,ze.Tab]},Ke=(e,t)=>{let{currentCoordinates:n}=t;switch(e.code){case ze.Right:return{...n,x:n.x+25};case ze.Left:return{...n,x:n.x-25};case ze.Down:return{...n,y:n.y+25};case ze.Up:return{...n,y:n.y-25}}};class We{constructor(e){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=e;const{event:{target:t}}=e;this.props=e,this.listeners=new Le(O(t)),this.windowListeners=new Le(C(t)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(Pe.Resize,this.handleCancel),this.windowListeners.add(Pe.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(Pe.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:e,onStart:t}=this.props,n=e.node.current;n&&Te(n),t(te)}handleKeyDown(e){if(F(e)){const{active:t,context:n,options:r}=this.props,{keyboardCodes:o=Xe,coordinateGetter:i=Ke,scrollBehavior:a="smooth"}=r,{code:l}=e;if(o.end.includes(l))return void this.handleEnd(e);if(o.cancel.includes(l))return void this.handleCancel(e);const{collisionRect:c}=n.current,s=c?{x:c.left,y:c.top}:te;this.referenceCoordinates||(this.referenceCoordinates=s);const d=i(e,{active:t,context:n.current,currentCoordinates:s});if(d){const t=Y(d,s),r={x:0,y:0},{scrollableAncestors:o}=n.current;for(const n of o){const o=e.code,{isTop:i,isRight:l,isLeft:c,isBottom:s,maxScroll:u,minScroll:g}=Ne(n),v=Ie(n),f={x:Math.min(o===ze.Right?v.right-v.width/2:v.right,Math.max(o===ze.Right?v.left:v.left+v.width/2,d.x)),y:Math.min(o===ze.Down?v.bottom-v.height/2:v.bottom,Math.max(o===ze.Down?v.top:v.top+v.height/2,d.y))},h=o===ze.Right&&!l||o===ze.Left&&!c,p=o===ze.Down&&!s||o===ze.Up&&!i;if(h&&f.x!==d.x){const e=n.scrollLeft+t.x,i=o===ze.Right&&e<=u.x||o===ze.Left&&e>=g.x;if(i&&!t.y)return void n.scrollTo({left:e,behavior:a});r.x=i?n.scrollLeft-e:o===ze.Right?n.scrollLeft-u.x:n.scrollLeft-g.x,r.x&&n.scrollBy({left:-r.x,behavior:a});break}if(p&&f.y!==d.y){const e=n.scrollTop+t.y,i=o===ze.Down&&e<=u.y||o===ze.Up&&e>=g.y;if(i&&!t.x)return void n.scrollTo({top:e,behavior:a});r.y=i?n.scrollTop-e:o===ze.Down?n.scrollTop-u.y:n.scrollTop-g.y,r.y&&n.scrollBy({top:-r.y,behavior:a});break}}this.handleMove(e,z(Y(d,this.referenceCoordinates),r))}}}handleMove(e,t){const{onMove:n}=this.props;e.preventDefault(),n(t)}handleEnd(e){const{onEnd:t}=this.props;e.preventDefault(),this.detach(),t()}handleCancel(e){const{onCancel:t}=this.props;e.preventDefault(),this.detach(),t()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}}function Ue(e){return Boolean(e&&"distance"in e)}function He(e){return Boolean(e&&"delay"in e)}We.activators=[{eventName:"onKeyDown",handler:(e,t,n)=>{let{keyboardCodes:r=Xe,onActivation:o}=t,{active:i}=n;const{code:a}=e.nativeEvent;if(r.start.includes(a)){const t=i.activatorNode.current;return(!t||e.target===t)&&(e.preventDefault(),null==o||o({event:e.nativeEvent}),!0)}return!1}}];class Je{constructor(e,t,n){var r;void 0===n&&(n=function(e){const{EventTarget:t}=C(e);return e instanceof t?e:O(e)}(e.event.target)),this.props=void 0,this.events=void 0,this.autoScrollEnabled=!0,this.document=void 0,this.activated=!1,this.initialCoordinates=void 0,this.timeoutId=null,this.listeners=void 0,this.documentListeners=void 0,this.windowListeners=void 0,this.props=e,this.events=t;const{event:o}=e,{target:i}=o;this.props=e,this.events=t,this.document=O(i),this.documentListeners=new Le(this.document),this.listeners=new Le(n),this.windowListeners=new Le(C(i)),this.initialCoordinates=null!=(r=X(o))?r:te,this.handleStart=this.handleStart.bind(this),this.handleMove=this.handleMove.bind(this),this.handleEnd=this.handleEnd.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.removeTextSelection=this.removeTextSelection.bind(this),this.attach()}attach(){const{events:e,props:{options:{activationConstraint:t,bypassActivationConstraint:n}}}=this;if(this.listeners.add(e.move.name,this.handleMove,{passive:!1}),this.listeners.add(e.end.name,this.handleEnd),e.cancel&&this.listeners.add(e.cancel.name,this.handleCancel),this.windowListeners.add(Pe.Resize,this.handleCancel),this.windowListeners.add(Pe.DragStart,Ye),this.windowListeners.add(Pe.VisibilityChange,this.handleCancel),this.windowListeners.add(Pe.ContextMenu,Ye),this.documentListeners.add(Pe.Keydown,this.handleKeydown),t){if(null!=n&&n({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(He(t))return this.timeoutId=setTimeout(this.handleStart,t.delay),void this.handlePending(t);if(Ue(t))return void this.handlePending(t)}this.handleStart()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),null!==this.timeoutId&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handlePending(e,t){const{active:n,onPending:r}=this.props;r(n,e,this.initialCoordinates,t)}handleStart(){const{initialCoordinates:e}=this,{onStart:t}=this.props;e&&(this.activated=!0,this.documentListeners.add(Pe.Click,Fe,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(Pe.SelectionChange,this.removeTextSelection),t(e))}handleMove(e){var t;const{activated:n,initialCoordinates:r,props:o}=this,{onMove:i,options:{activationConstraint:a}}=o;if(!r)return;const l=null!=(t=X(e))?t:te,c=Y(r,l);if(!n&&a){if(Ue(a)){if(null!=a.tolerance&&Be(c,a.tolerance))return this.handleCancel();if(Be(c,a.distance))return this.handleStart()}return He(a)&&Be(c,a.tolerance)?this.handleCancel():void this.handlePending(a,c)}e.cancelable&&e.preventDefault(),i(l)}handleEnd(){const{onAbort:e,onEnd:t}=this.props;this.detach(),this.activated||e(this.props.active),t()}handleCancel(){const{onAbort:e,onCancel:t}=this.props;this.detach(),this.activated||e(this.props.active),t()}handleKeydown(e){e.code===ze.Esc&&this.handleCancel()}removeTextSelection(){var e;null==(e=this.document.getSelection())||e.removeAllRanges()}}const Ve={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};class qe extends Je{constructor(e){const{event:t}=e,n=O(t.target);super(e,Ve,n)}}qe.activators=[{eventName:"onPointerDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return!(!n.isPrimary||0!==n.button)&&(null==r||r({event:n}),!0)}}];const Ge={move:{name:"mousemove"},end:{name:"mouseup"}};var Qe;!function(e){e[e.RightClick=2]="RightClick"}(Qe||(Qe={}));(class extends Je{constructor(e){super(e,Ge,O(e.event.target))}}).activators=[{eventName:"onMouseDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return n.button!==Qe.RightClick&&(null==r||r({event:n}),!0)}}];const Ze={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}};var $e,_e;function et(e){let{acceleration:t,activator:n=$e.Pointer,canScroll:r,draggingRect:i,enabled:s,interval:d=5,order:u=_e.TreeOrder,pointerCoordinates:g,scrollableAncestors:v,scrollableAncestorRects:f,delta:h,threshold:p}=e;const b=function(e){let{delta:t,disabled:n}=e;const r=j(t);return T(e=>{if(n||!r||!e)return tt;const o={x:Math.sign(t.x-r.x),y:Math.sign(t.y-r.y)};return{x:{[Re.Backward]:e.x[Re.Backward]||-1===o.x,[Re.Forward]:e.x[Re.Forward]||1===o.x},y:{[Re.Backward]:e.y[Re.Backward]||-1===o.y,[Re.Forward]:e.y[Re.Forward]||1===o.y}}},[n,t,r])}({delta:h,disabled:!s}),[y,m]=function(){const e=l(null);return[c((t,n)=>{e.current=setInterval(t,n)},[]),c(()=>{null!==e.current&&(clearInterval(e.current),e.current=null)},[])]}(),w=l({x:0,y:0}),x=l({x:0,y:0}),D=o(()=>{switch(n){case $e.Pointer:return g?{top:g.y,bottom:g.y,left:g.x,right:g.x}:null;case $e.DraggableRect:return i}},[n,i,g]),k=l(null),C=c(()=>{const e=k.current;if(!e)return;const t=w.current.x*x.current.x,n=w.current.y*x.current.y;e.scrollBy(t,n)},[]),R=o(()=>u===_e.TreeOrder?[...v].reverse():v,[u,v]);a(()=>{if(s&&v.length&&D){for(const e of R){if(!1===(null==r?void 0:r(e)))continue;const n=v.indexOf(e),o=f[n];if(!o)continue;const{direction:i,speed:a}=Se(e,o,D,t,p);for(const e of["x","y"])b[e][i[e]]||(a[e]=0,i[e]=0);if(a.x>0||a.y>0)return m(),k.current=e,y(C,d),w.current=a,void(x.current=i)}w.current={x:0,y:0},x.current={x:0,y:0},m()}else m()},[t,C,r,m,s,d,JSON.stringify(D),JSON.stringify(b),y,v,R,f,JSON.stringify(p)])}(class extends Je{constructor(e){super(e,Ze)}static setup(){return window.addEventListener(Ze.move.name,e,{capture:!1,passive:!1}),function(){window.removeEventListener(Ze.move.name,e)};function e(){}}}).activators=[{eventName:"onTouchStart",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;const{touches:o}=n;return!(o.length>1)&&(null==r||r({event:n}),!0)}}],function(e){e[e.Pointer=0]="Pointer",e[e.DraggableRect=1]="DraggableRect"}($e||($e={})),function(e){e[e.TreeOrder=0]="TreeOrder",e[e.ReversedTreeOrder=1]="ReversedTreeOrder"}(_e||(_e={}));const tt={x:{[Re.Backward]:!1,[Re.Forward]:!1},y:{[Re.Backward]:!1,[Re.Forward]:!1}};var nt,rt;!function(e){e[e.Always=0]="Always",e[e.BeforeDragging=1]="BeforeDragging",e[e.WhileDragging=2]="WhileDragging"}(nt||(nt={})),function(e){e.Optimized="optimized"}(rt||(rt={}));const ot=new Map;function it(e,t){return T(n=>e?n||("function"==typeof t?t(e):e):null,[t,e])}function at(e){let{callback:t,disabled:n}=e;const r=I(t),i=o(()=>{if(n||"undefined"==typeof window||void 0===window.ResizeObserver)return;const{ResizeObserver:e}=window;return new e(r)},[n]);return a(()=>()=>null==i?void 0:i.disconnect(),[i]),i}function lt(e){return new je(be(e),e)}function ct(e,t,n){void 0===t&&(t=lt);const[r,i]=s(null);function l(){i(r=>{if(!e)return null;var o;if(!1===e.isConnected)return null!=(o=null!=r?r:n)?o:null;const i=t(e);return JSON.stringify(r)===JSON.stringify(i)?r:i})}const c=function(e){let{callback:t,disabled:n}=e;const r=I(t),i=o(()=>{if(n||"undefined"==typeof window||void 0===window.MutationObserver)return;const{MutationObserver:e}=window;return new e(r)},[r,n]);return a(()=>()=>null==i?void 0:i.disconnect(),[i]),i}({callback(t){if(e)for(const n of t){const{type:t,target:r}=n;if("childList"===t&&r instanceof HTMLElement&&r.contains(e)){l();break}}}}),d=at({callback:l});return S(()=>{l(),e?(null==d||d.observe(e),null==c||c.observe(document.body,{childList:!0,subtree:!0})):(null==d||d.disconnect(),null==c||c.disconnect())},[e]),r}const st=[];function dt(e,t){void 0===t&&(t=[]);const n=l(null);return a(()=>{n.current=null},t),a(()=>{const t=e!==te;t&&!n.current&&(n.current=e),!t&&n.current&&(n.current=null)},[e]),n.current?Y(e,n.current):te}function ut(e){return o(()=>e?function(e){const t=e.innerWidth,n=e.innerHeight;return{top:0,left:0,right:t,bottom:n,width:t,height:n}}(e):null,[e])}const gt=[];function vt(e){if(!e)return null;if(e.children.length>1)return e;const t=e.children[0];return E(t)?t:e}const ft=[{sensor:qe,options:{}},{sensor:We,options:{}}],ht={current:{}},pt={draggable:{measure:ye},droppable:{measure:ye,strategy:nt.WhileDragging,frequency:rt.Optimized},dragOverlay:{measure:be}};class bt extends Map{get(e){var t;return null!=e&&null!=(t=super.get(e))?t:void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(e=>{let{disabled:t}=e;return!t})}getNodeFor(e){var t,n;return null!=(t=null==(n=this.get(e))?void 0:n.node.current)?t:void 0}}const yt={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new bt,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:_},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:pt,measureDroppableContainers:_,windowRect:null,measuringScheduled:!1},mt={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:_,draggableNodes:new Map,over:null,measureDroppableContainers:_},wt=d(mt),xt=d(yt);function Dt(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new bt}}}function kt(e,t){switch(t.type){case $.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case $.DragMove:return null==e.draggable.active?e:{...e,draggable:{...e.draggable,translate:{x:t.coordinates.x-e.draggable.initialCoordinates.x,y:t.coordinates.y-e.draggable.initialCoordinates.y}}};case $.DragEnd:case $.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case $.RegisterDroppable:{const{element:n}=t,{id:r}=n,o=new bt(e.droppable.containers);return o.set(r,n),{...e,droppable:{...e.droppable,containers:o}}}case $.SetDroppableDisabled:{const{id:n,key:r,disabled:o}=t,i=e.droppable.containers.get(n);if(!i||r!==i.key)return e;const a=new bt(e.droppable.containers);return a.set(n,{...i,disabled:o}),{...e,droppable:{...e.droppable,containers:a}}}case $.UnregisterDroppable:{const{id:n,key:r}=t,o=e.droppable.containers.get(n);if(!o||r!==o.key)return e;const i=new bt(e.droppable.containers);return i.delete(n),{...e,droppable:{...e.droppable,containers:i}}}default:return e}}function Ct(e){let{disabled:t}=e;const{active:n,activatorEvent:r,draggableNodes:o}=v(wt),i=j(r),l=j(null==n?void 0:n.id);return a(()=>{if(!t&&!r&&i&&null!=l){if(!F(i))return;if(document.activeElement===i.target)return;const e=o.get(l);if(!e)return;const{activatorNode:t,node:n}=e;if(!t.current&&!n.current)return;requestAnimationFrame(()=>{for(const e of[t.current,n.current]){if(!e)continue;const t=U(e);if(t){t.focus();break}}})}},[r,t,o,l,i]),null}function Rt(e,t){let{transform:n,...r}=t;return null!=e&&e.length?e.reduce((e,t)=>t({transform:e,...r}),n):n}const Et=d({...te,scaleX:1,scaleY:1});var Nt;!function(e){e[e.Uninitialized=0]="Uninitialized",e[e.Initializing=1]="Initializing",e[e.Initialized=2]="Initialized"}(Nt||(Nt={}));const Ot=u(function(e){var t,n,i,d;let{id:u,accessibility:v,autoScroll:f=!0,children:h,sensors:p=ft,collisionDetection:y=ue,measuring:m,modifiers:w,...D}=e;const k=g(kt,void 0,Dt),[R,N]=k,[O,I]=function(){const[e]=s(()=>new Set),t=c(t=>(e.add(t),()=>e.delete(t)),[e]);return[c(t=>{let{type:n,event:r}=t;e.forEach(e=>{var t;return null==(t=e[n])?void 0:t.call(e,r)})},[e]),t]}(),[j,L]=s(Nt.Uninitialized),P=j===Nt.Initialized,{draggable:{active:Y,nodes:F,translate:K},droppable:{containers:W}}=R,U=null!=Y?F.get(Y):null,H=l({initial:null,translated:null}),J=o(()=>{var e;return null!=Y?{id:Y,data:null!=(e=null==U?void 0:U.data)?e:ht,rect:H}:null},[Y,U]),V=l(null),[G,Q]=s(null),[_,ee]=s(null),ne=A(D,Object.values(D)),re=B("DndDescribedBy",u),oe=o(()=>W.getEnabled(),[W]),ie=o(()=>({draggable:{...pt.draggable,...null==ae?void 0:ae.draggable},droppable:{...pt.droppable,...null==ae?void 0:ae.droppable},dragOverlay:{...pt.dragOverlay,...null==ae?void 0:ae.dragOverlay}}),[null==(ae=m)?void 0:ae.draggable,null==ae?void 0:ae.droppable,null==ae?void 0:ae.dragOverlay]);var ae;const{droppableRects:ce,measureDroppableContainers:se,measuringScheduled:de}=function(e,t){let{dragging:n,dependencies:r,config:o}=t;const[i,d]=s(null),{frequency:u,measure:g,strategy:v}=o,f=l(e),h=function(){switch(v){case nt.Always:return!1;case nt.BeforeDragging:return n;default:return!n}}(),p=A(h),b=c(function(e){void 0===e&&(e=[]),p.current||d(t=>null===t?e:t.concat(e.filter(e=>!t.includes(e))))},[p]),y=l(null),m=T(t=>{if(h&&!n)return ot;if(!t||t===ot||f.current!==e||null!=i){const t=new Map;for(let n of e){if(!n)continue;if(i&&i.length>0&&!i.includes(n.id)&&n.rect.current){t.set(n.id,n.rect.current);continue}const e=n.node.current,r=e?new je(g(e),e):null;n.rect.current=r,r&&t.set(n.id,r)}return t}return t},[e,i,n,h,g]);return a(()=>{f.current=e},[e]),a(()=>{h||b()},[n,h]),a(()=>{i&&i.length>0&&d(null)},[JSON.stringify(i)]),a(()=>{h||"number"!=typeof u||null!==y.current||(y.current=setTimeout(()=>{b(),y.current=null},u))},[u,h,b,...r]),{droppableRects:m,measureDroppableContainers:b,measuringScheduled:null!=i}}(oe,{dragging:P,dependencies:[K.x,K.y],config:ie.droppable}),ve=function(e,t){const n=null!=t?e.get(t):void 0,r=n?n.node.current:null;return T(e=>{var n;return null==t?null:null!=(n=null!=r?r:e)?n:null},[r,t])}(F,Y),he=o(()=>_?X(_):null,[_]),pe=function(){const e=!1===(null==G?void 0:G.autoScrollEnabled),t="object"==typeof f?!1===f.enabled:!1===f,n=P&&!e&&!t;if("object"==typeof f)return{...f,enabled:n};return{enabled:n}}(),ye=function(e,t){return it(e,t)}(ve,ie.draggable.measure);!function(e){let{activeNode:t,measure:n,initialRect:r,config:o=!0}=e;const i=l(!1),{x:a,y:c}="boolean"==typeof o?{x:o,y:o}:o;S(()=>{if(!a&&!c||!t)return void(i.current=!1);if(i.current||!r)return;const e=null==t?void 0:t.node.current;if(!e||!1===e.isConnected)return;const o=ge(n(e),r);if(a||(o.x=0),c||(o.y=0),i.current=!0,Math.abs(o.x)>0||Math.abs(o.y)>0){const t=we(e);t&&t.scrollBy({top:o.y,left:o.x})}},[t,a,c,r,n])}({activeNode:null!=Y?F.get(Y):null,config:pe.layoutShiftCompensation,initialRect:ye,measure:ie.draggable.measure});const De=ct(ve,ie.draggable.measure,ye),ke=ct(ve?ve.parentElement:null),Re=l({activatorEvent:null,active:null,activeNode:ve,collisionRect:null,collisions:null,droppableRects:ce,draggableNodes:F,draggingNode:null,draggingNodeRect:null,droppableContainers:W,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),Ne=W.getNodeFor(null==(t=Re.current.over)?void 0:t.id),Oe=function(e){let{measure:t}=e;const[n,r]=s(null),i=at({callback:c(e=>{for(const{target:n}of e)if(E(n)){r(e=>{const r=t(n);return e?{...e,width:r.width,height:r.height}:r});break}},[t])}),a=c(e=>{const n=vt(e);null==i||i.disconnect(),n&&(null==i||i.observe(n)),r(n?t(n):null)},[t,i]),[l,d]=M(a);return o(()=>({nodeRef:l,rect:n,setRef:d}),[n,l,d])}({measure:ie.dragOverlay.measure}),Se=null!=(n=Oe.nodeRef.current)?n:ve,Ie=P?null!=(i=Oe.rect)?i:De:null,Te=Boolean(Oe.nodeRef.current&&Oe.rect),Me=ge(Le=Te?null:De,it(Le));var Le;const Be=ut(Se?C(Se):null),Pe=function(e){const t=l(e),n=T(n=>e?n&&n!==st&&e&&t.current&&e.parentNode===t.current.parentNode?n:me(e):st,[e]);return a(()=>{t.current=e},[e]),n}(P?null!=Ne?Ne:ve:null),ze=function(e,t){void 0===t&&(t=be);const[n]=e,r=ut(n?C(n):null),[o,i]=s(gt);function a(){i(()=>e.length?e.map(e=>Ee(e)?r:new je(t(e),e)):gt)}const l=at({callback:a});return S(()=>{null==l||l.disconnect(),a(),e.forEach(e=>null==l?void 0:l.observe(e))},[e]),o}(Pe),Ye=Rt(w,{transform:{x:K.x-Me.x,y:K.y-Me.y,scaleX:1,scaleY:1},activatorEvent:_,active:J,activeNodeRect:De,containerNodeRect:ke,draggingNodeRect:Ie,over:Re.current.over,overlayNodeRect:Oe.rect,scrollableAncestors:Pe,scrollableAncestorRects:ze,windowRect:Be}),Fe=he?z(he,K):null,Xe=function(e){const[t,n]=s(null),r=l(e),i=c(e=>{const t=xe(e.target);t&&n(e=>e?(e.set(t,Ce(t)),new Map(e)):null)},[]);return a(()=>{const t=r.current;if(e!==t){o(t);const a=e.map(e=>{const t=xe(e);return t?(t.addEventListener("scroll",i,{passive:!0}),[t,Ce(t)]):null}).filter(e=>null!=e);n(a.length?new Map(a):null),r.current=e}return()=>{o(e),o(t)};function o(e){e.forEach(e=>{const t=xe(e);null==t||t.removeEventListener("scroll",i)})}},[i,e]),o(()=>e.length?t?Array.from(t.values()).reduce((e,t)=>z(e,t),te):Ae(e):te,[e,t])}(Pe),Ke=dt(Xe),We=dt(Xe,[De]),Ue=z(Ye,Ke),He=Ie?fe(Ie,Ye):null,Je=J&&He?y({active:J,collisionRect:He,droppableRects:ce,droppableContainers:oe,pointerCoordinates:Fe}):null,Ve=le(Je,"id"),[qe,Ge]=s(null),Qe=function(e,t,n){return{...e,scaleX:t&&n?t.width/n.width:1,scaleY:t&&n?t.height/n.height:1}}(Te?Ye:z(Ye,We),null!=(d=null==qe?void 0:qe.rect)?d:null,De),Ze=l(null),$e=c((e,t)=>{let{sensor:n,options:r}=t;if(null==V.current)return;const o=F.get(V.current);if(!o)return;const i=e.nativeEvent,a=new n({active:V.current,activeNode:o,event:i,options:r,context:Re,onAbort(e){if(!F.get(e))return;const{onDragAbort:t}=ne.current,n={id:e};null==t||t(n),O({type:"onDragAbort",event:n})},onPending(e,t,n,r){if(!F.get(e))return;const{onDragPending:o}=ne.current,i={id:e,constraint:t,initialCoordinates:n,offset:r};null==o||o(i),O({type:"onDragPending",event:i})},onStart(e){const t=V.current;if(null==t)return;const n=F.get(t);if(!n)return;const{onDragStart:r}=ne.current,o={activatorEvent:i,active:{id:t,data:n.data,rect:H}};b(()=>{null==r||r(o),L(Nt.Initializing),N({type:$.DragStart,initialCoordinates:e,active:t}),O({type:"onDragStart",event:o}),Q(Ze.current),ee(i)})},onMove(e){N({type:$.DragMove,coordinates:e})},onEnd:l($.DragEnd),onCancel:l($.DragCancel)});function l(e){return async function(){const{active:t,collisions:n,over:r,scrollAdjustedTranslate:o}=Re.current;let a=null;if(t&&o){const{cancelDrop:l}=ne.current;if(a={activatorEvent:i,active:t,collisions:n,delta:o,over:r},e===$.DragEnd&&"function"==typeof l){await Promise.resolve(l(a))&&(e=$.DragCancel)}}V.current=null,b(()=>{N({type:e}),L(Nt.Uninitialized),Ge(null),Q(null),ee(null),Ze.current=null;const t=e===$.DragEnd?"onDragEnd":"onDragCancel";if(a){const e=ne.current[t];null==e||e(a),O({type:t,event:a})}})}}Ze.current=a},[F]),_e=c((e,t)=>(n,r)=>{const o=n.nativeEvent,i=F.get(r);if(null!==V.current||!i||o.dndKit||o.defaultPrevented)return;const a={active:i};!0===e(n,t.options,a)&&(o.dndKit={capturedBy:t.sensor},V.current=r,$e(n,t))},[F,$e]),tt=function(e,t){return o(()=>e.reduce((e,n)=>{const{sensor:r}=n;return[...e,...r.activators.map(e=>({eventName:e.eventName,handler:t(e.handler,n)}))]},[]),[e,t])}(p,_e);!function(e){a(()=>{if(!x)return;const t=e.map(e=>{let{sensor:t}=e;return null==t.setup?void 0:t.setup()});return()=>{for(const e of t)null==e||e()}},e.map(e=>{let{sensor:t}=e;return t}))}(p),S(()=>{De&&j===Nt.Initializing&&L(Nt.Initialized)},[De,j]),a(()=>{const{onDragMove:e}=ne.current,{active:t,activatorEvent:n,collisions:r,over:o}=Re.current;if(!t||!n)return;const i={active:t,activatorEvent:n,collisions:r,delta:{x:Ue.x,y:Ue.y},over:o};b(()=>{null==e||e(i),O({type:"onDragMove",event:i})})},[Ue.x,Ue.y]),a(()=>{const{active:e,activatorEvent:t,collisions:n,droppableContainers:r,scrollAdjustedTranslate:o}=Re.current;if(!e||null==V.current||!t||!o)return;const{onDragOver:i}=ne.current,a=r.get(Ve),l=a&&a.rect.current?{id:a.id,rect:a.rect.current,data:a.data,disabled:a.disabled}:null,c={active:e,activatorEvent:t,collisions:n,delta:{x:o.x,y:o.y},over:l};b(()=>{Ge(l),null==i||i(c),O({type:"onDragOver",event:c})})},[Ve]),S(()=>{Re.current={activatorEvent:_,active:J,activeNode:ve,collisionRect:He,collisions:Je,droppableRects:ce,draggableNodes:F,draggingNode:Se,draggingNodeRect:Ie,droppableContainers:W,over:qe,scrollableAncestors:Pe,scrollAdjustedTranslate:Ue},H.current={initial:Ie,translated:He}},[J,ve,Je,He,F,Se,Ie,ce,W,qe,Pe,Ue]),et({...pe,delta:K,draggingRect:He,pointerCoordinates:Fe,scrollableAncestors:Pe,scrollableAncestorRects:ze});const rt=o(()=>({active:J,activeNode:ve,activeNodeRect:De,activatorEvent:_,collisions:Je,containerNodeRect:ke,dragOverlay:Oe,draggableNodes:F,droppableContainers:W,droppableRects:ce,over:qe,measureDroppableContainers:se,scrollableAncestors:Pe,scrollableAncestorRects:ze,measuringConfiguration:ie,measuringScheduled:de,windowRect:Be}),[J,ve,De,_,Je,ke,Oe,F,W,ce,qe,se,Pe,ze,ie,de,Be]),lt=o(()=>({activatorEvent:_,activators:tt,active:J,activeNodeRect:De,ariaDescribedById:{draggable:re},dispatch:N,draggableNodes:F,over:qe,measureDroppableContainers:se}),[_,tt,J,De,N,re,F,qe,se]);return r.createElement(q.Provider,{value:I},r.createElement(wt.Provider,{value:lt},r.createElement(xt.Provider,{value:rt},r.createElement(Et.Provider,{value:Qe},h)),r.createElement(Ct,{disabled:!1===(null==v?void 0:v.restoreFocus)})),r.createElement(Z,{...v,hiddenTextDescribedById:re}))}),St=d(null),It="button";function At(e){let{id:t,data:n,disabled:r=!1,attributes:i}=e;const a=B("Draggable"),{activators:l,activatorEvent:c,active:s,activeNodeRect:d,ariaDescribedById:u,draggableNodes:g,over:f}=v(wt),{role:h=It,roleDescription:p="draggable",tabIndex:b=0}=null!=i?i:{},y=(null==s?void 0:s.id)===t,m=v(y?Et:St),[w,x]=M(),[D,k]=M(),C=function(e,t){return o(()=>e.reduce((e,n)=>{let{eventName:r,handler:o}=n;return e[r]=e=>{o(e,t)},e},{}),[e,t])}(l,t),R=A(n);S(()=>(g.set(t,{id:t,key:a,node:w,activatorNode:D,data:R}),()=>{const e=g.get(t);e&&e.key===a&&g.delete(t)}),[g,t]);return{active:s,activatorEvent:c,activeNodeRect:d,attributes:o(()=>({role:h,tabIndex:b,"aria-disabled":r,"aria-pressed":!(!y||h!==It)||void 0,"aria-roledescription":p,"aria-describedby":u.draggable}),[r,h,b,y,p,u.draggable]),isDragging:y,listeners:r?void 0:C,node:w,over:f,setNodeRef:x,setActivatorNodeRef:k,transform:m}}function Tt(){return v(xt)}const Mt={timeout:25};function jt(e){let{animation:t,children:n}=e;const[o,i]=s(null),[a,l]=s(null),c=j(n);return n||o||!c||i(c),S(()=>{if(!a)return;const e=null==o?void 0:o.key,n=null==o?void 0:o.props.id;null!=e&&null!=n?Promise.resolve(t(n,a)).then(()=>{i(null)}):i(null)},[t,o,a]),r.createElement(r.Fragment,null,n,o?f(o,{ref:l}):null)}const Lt={x:0,y:0,scaleX:1,scaleY:1};function Bt(e){let{children:t}=e;return r.createElement(wt.Provider,{value:mt},r.createElement(Et.Provider,{value:Lt},t))}const Pt={position:"fixed",touchAction:"none"},zt=e=>F(e)?"transform 250ms ease":void 0,Yt=h((e,t)=>{let{as:n,activatorEvent:o,adjustScale:i,children:a,className:l,rect:c,style:s,transform:d,transition:u=zt}=e;if(!c)return null;const g=i?d:{...d,scaleX:1,scaleY:1},v={...Pt,width:c.width,height:c.height,top:c.top,left:c.left,transform:K.Transform.toString(g),transformOrigin:i&&o?re(o,c):void 0,transition:"function"==typeof u?u(o):u,...s};return r.createElement(n,{className:l,style:v,ref:t},a)}),Ft=e=>t=>{let{active:n,dragOverlay:r}=t;const o={},{styles:i,className:a}=e;if(null!=i&&i.active)for(const[e,t]of Object.entries(i.active))void 0!==t&&(o[e]=n.node.style.getPropertyValue(e),n.node.style.setProperty(e,t));if(null!=i&&i.dragOverlay)for(const[e,t]of Object.entries(i.dragOverlay))void 0!==t&&r.node.style.setProperty(e,t);return null!=a&&a.active&&n.node.classList.add(a.active),null!=a&&a.dragOverlay&&r.node.classList.add(a.dragOverlay),function(){for(const[e,t]of Object.entries(o))n.node.style.setProperty(e,t);null!=a&&a.active&&n.node.classList.remove(a.active)}},Xt={duration:250,easing:"ease",keyframes:e=>{let{transform:{initial:t,final:n}}=e;return[{transform:K.Transform.toString(t)},{transform:K.Transform.toString(n)}]},sideEffects:Ft({styles:{active:{opacity:"0"}}})};function Kt(e){let{config:t,draggableNodes:n,droppableContainers:r,measuringConfiguration:o}=e;return I((e,i)=>{if(null===t)return;const a=n.get(e);if(!a)return;const l=a.node.current;if(!l)return;const c=vt(i);if(!c)return;const{transform:s}=C(i).getComputedStyle(i),d=he(s);if(!d)return;const u="function"==typeof t?t:function(e){const{duration:t,easing:n,sideEffects:r,keyframes:o}={...Xt,...e};return e=>{let{active:i,dragOverlay:a,transform:l,...c}=e;if(!t)return;const s={x:a.rect.left-i.rect.left,y:a.rect.top-i.rect.top},d={scaleX:1!==l.scaleX?i.rect.width*l.scaleX/a.rect.width:1,scaleY:1!==l.scaleY?i.rect.height*l.scaleY/a.rect.height:1},u={x:l.x-s.x,y:l.y-s.y,...d},g=o({...c,active:i,dragOverlay:a,transform:{initial:l,final:u}}),[v]=g,f=g[g.length-1];if(JSON.stringify(v)===JSON.stringify(f))return;const h=null==r?void 0:r({active:i,dragOverlay:a,...c}),p=a.node.animate(g,{duration:t,easing:n,fill:"forwards"});return new Promise(e=>{p.onfinish=()=>{null==h||h(),e()}})}}(t);return Te(l,o.draggable.measure),u({active:{id:e,data:a.data,node:l,rect:o.draggable.measure(l)},draggableNodes:n,dragOverlay:{node:i,rect:o.dragOverlay.measure(c)},droppableContainers:r,measuringConfiguration:o,transform:d})})}let Wt=0;function Ut(e){return o(()=>{if(null!=e)return Wt++,Wt},[e])}const Ht=r.memo(e=>{let{adjustScale:t=!1,children:n,dropAnimation:o,style:i,transition:a,modifiers:l,wrapperElement:c="div",className:s,zIndex:d=999}=e;const{activatorEvent:u,active:g,activeNodeRect:f,containerNodeRect:h,draggableNodes:p,droppableContainers:b,dragOverlay:y,over:m,measuringConfiguration:w,scrollableAncestors:x,scrollableAncestorRects:D,windowRect:k}=Tt(),C=v(Et),R=Ut(null==g?void 0:g.id),E=Rt(l,{activatorEvent:u,active:g,activeNodeRect:f,containerNodeRect:h,draggingNodeRect:y.rect,over:m,overlayNodeRect:y.rect,scrollableAncestors:x,scrollableAncestorRects:D,transform:C,windowRect:k}),N=it(f),O=Kt({config:o,draggableNodes:p,droppableContainers:b,measuringConfiguration:w}),S=N?y.setRef:void 0;return r.createElement(Bt,null,r.createElement(jt,{animation:O},g&&R?r.createElement(Yt,{key:R,id:g.id,ref:S,as:c,activatorEvent:u,adjustScale:t,className:s,transition:a,rect:N,style:{zIndex:d,...i},transform:E},n):null))});function Jt(e,t,n){const r=e.slice();return r.splice(n<0?r.length+n:n,0,r.splice(t,1)[0]),r}function Vt(e,t){return e.reduce((e,n,r)=>{const o=t.get(n);return o&&(e[r]=o),e},Array(e.length))}function qt(e){return null!==e&&e>=0}const Gt=e=>{let{rects:t,activeIndex:n,overIndex:r,index:o}=e;const i=Jt(t,r,n),a=t[o],l=i[o];return l&&a?{x:l.left-a.left,y:l.top-a.top,scaleX:l.width/a.width,scaleY:l.height/a.height}:null},Qt={scaleX:1,scaleY:1},Zt=e=>{var t;let{activeIndex:n,activeNodeRect:r,index:o,rects:i,overIndex:a}=e;const l=null!=(t=i[n])?t:r;if(!l)return null;if(o===n){const e=i[a];return e?{x:0,y:n<a?e.top+e.height-(l.top+l.height):e.top-l.top,...Qt}:null}const c=function(e,t,n){const r=e[t],o=e[t-1],i=e[t+1];if(!r)return 0;if(n<t)return o?r.top-(o.top+o.height):i?i.top-(r.top+r.height):0;return i?i.top-(r.top+r.height):o?r.top-(o.top+o.height):0}(i,o,n);return o>n&&o<=a?{x:0,y:-l.height-c,...Qt}:o<n&&o>=a?{x:0,y:l.height+c,...Qt}:{x:0,y:0,...Qt}};const $t="Sortable",_t=r.createContext({activeIndex:-1,containerId:$t,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:Gt,disabled:{draggable:!1,droppable:!1}});function en(e){let{children:t,id:n,items:i,strategy:c=Gt,disabled:s=!1}=e;const{active:d,dragOverlay:u,droppableRects:g,over:v,measureDroppableContainers:f}=Tt(),h=B($t,n),p=Boolean(null!==u.rect),b=o(()=>i.map(e=>"object"==typeof e&&"id"in e?e.id:e),[i]),y=null!=d,m=d?b.indexOf(d.id):-1,w=v?b.indexOf(v.id):-1,x=l(b),D=!function(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}(b,x.current),k=-1!==w&&-1===m||D,C=function(e){return"boolean"==typeof e?{draggable:e,droppable:e}:e}(s);S(()=>{D&&y&&f(b)},[D,b,y,f]),a(()=>{x.current=b},[b]);const R=o(()=>({activeIndex:m,containerId:h,disabled:C,disableTransforms:k,items:b,overIndex:w,useDragOverlay:p,sortedRects:Vt(b,g),strategy:c}),[m,h,C.draggable,C.droppable,k,b,w,g,p,c]);return r.createElement(_t.Provider,{value:R},t)}const tn=e=>{let{id:t,items:n,activeIndex:r,overIndex:o}=e;return Jt(n,r,o).indexOf(t)},nn=e=>{let{containerId:t,isSorting:n,wasDragging:r,index:o,items:i,newIndex:a,previousItems:l,previousContainerId:c,transition:s}=e;return!(!s||!r)&&((l===i||o!==a)&&(!!n||a!==o&&t===c))},rn={duration:200,easing:"ease"},on="transform",an=K.Transition.toString({property:on,duration:0,easing:"linear"}),ln={roleDescription:"sortable"};function cn(e){let{animateLayoutChanges:t=nn,attributes:n,disabled:r,data:i,getNewIndex:d=tn,id:u,strategy:g,resizeObserverConfig:f,transition:h=rn}=e;const{items:p,containerId:b,activeIndex:y,disabled:m,disableTransforms:w,sortedRects:x,overIndex:D,useDragOverlay:k,strategy:C}=v(_t),R=function(e,t){var n,r;if("boolean"==typeof e)return{draggable:e,droppable:!1};return{draggable:null!=(n=null==e?void 0:e.draggable)?n:t.draggable,droppable:null!=(r=null==e?void 0:e.droppable)?r:t.droppable}}(r,m),E=p.indexOf(u),N=o(()=>({sortable:{containerId:b,index:E,items:p},...i}),[b,i,E,p]),O=o(()=>p.slice(p.indexOf(u)),[p,u]),{rect:I,node:T,isOver:j,setNodeRef:L}=function(e){let{data:t,disabled:n=!1,id:r,resizeObserverConfig:o}=e;const i=B("Droppable"),{active:s,dispatch:d,over:u,measureDroppableContainers:g}=v(wt),f=l({disabled:n}),h=l(!1),p=l(null),b=l(null),{disabled:y,updateMeasurementsFor:m,timeout:w}={...Mt,...o},x=A(null!=m?m:r),D=at({callback:c(()=>{h.current?(null!=b.current&&clearTimeout(b.current),b.current=setTimeout(()=>{g(Array.isArray(x.current)?x.current:[x.current]),b.current=null},w)):h.current=!0},[w]),disabled:y||!s}),k=c((e,t)=>{D&&(t&&(D.unobserve(t),h.current=!1),e&&D.observe(e))},[D]),[C,R]=M(k),E=A(t);return a(()=>{D&&C.current&&(D.disconnect(),h.current=!1,D.observe(C.current))},[C,D]),a(()=>(d({type:$.RegisterDroppable,element:{id:r,key:i,disabled:n,node:C,rect:p,data:E}}),()=>d({type:$.UnregisterDroppable,key:i,id:r})),[r]),a(()=>{n!==f.current.disabled&&(d({type:$.SetDroppableDisabled,id:r,key:i,disabled:n}),f.current.disabled=n)},[r,i,n,d]),{active:s,rect:p,isOver:(null==u?void 0:u.id)===r,node:C,over:u,setNodeRef:R}}({id:u,data:N,disabled:R.droppable,resizeObserverConfig:{updateMeasurementsFor:O,...f}}),{active:P,activatorEvent:z,activeNodeRect:Y,attributes:X,setNodeRef:W,listeners:U,isDragging:H,over:J,setActivatorNodeRef:V,transform:q}=At({id:u,data:N,attributes:{...ln,...n},disabled:R.draggable}),G=function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return o(()=>e=>{t.forEach(t=>t(e))},t)}(L,W),Q=Boolean(P),Z=Q&&!w&&qt(y)&&qt(D),_=!k&&H,ee=_&&Z?q:null,te=Z?null!=ee?ee:(null!=g?g:C)({rects:x,activeNodeRect:Y,activeIndex:y,overIndex:D,index:E}):null,ne=qt(y)&&qt(D)?d({id:u,items:p,activeIndex:y,overIndex:D}):E,re=null==P?void 0:P.id,oe=l({activeId:re,items:p,newIndex:ne,containerId:b}),ie=p!==oe.current.items,ae=t({active:P,containerId:b,isDragging:H,isSorting:Q,id:u,index:E,items:p,newIndex:oe.current.newIndex,previousItems:oe.current.items,previousContainerId:oe.current.containerId,transition:h,wasDragging:null!=oe.current.activeId}),le=function(e){let{disabled:t,index:n,node:r,rect:o}=e;const[i,c]=s(null),d=l(n);return S(()=>{if(!t&&n!==d.current&&r.current){const e=o.current;if(e){const t=be(r.current,{ignoreTransform:!0}),n={x:e.left-t.left,y:e.top-t.top,scaleX:e.width/t.width,scaleY:e.height/t.height};(n.x||n.y)&&c(n)}}n!==d.current&&(d.current=n)},[t,n,r,o]),a(()=>{i&&c(null)},[i]),i}({disabled:!ae,index:E,node:T,rect:I});return a(()=>{Q&&oe.current.newIndex!==ne&&(oe.current.newIndex=ne),b!==oe.current.containerId&&(oe.current.containerId=b),p!==oe.current.items&&(oe.current.items=p)},[Q,ne,b,p]),a(()=>{if(re===oe.current.activeId)return;if(re&&!oe.current.activeId)return void(oe.current.activeId=re);const e=setTimeout(()=>{oe.current.activeId=re},50);return()=>clearTimeout(e)},[re]),{active:P,activeIndex:y,attributes:X,data:N,rect:I,index:E,newIndex:ne,items:p,isOver:j,isSorting:Q,isDragging:H,listeners:U,node:T,overIndex:D,over:J,setNodeRef:G,setActivatorNodeRef:V,setDroppableNodeRef:L,setDraggableNodeRef:W,transform:null!=le?le:te,transition:function(){if(le||ie&&oe.current.newIndex===E)return an;if(_&&!F(z)||!h)return;if(Q||ae)return K.Transition.toString({...h,property:on});return}()}}function sn(e){if(!e)return!1;const t=e.data.current;return!!(t&&"sortable"in t&&"object"==typeof t.sortable&&"containerId"in t.sortable&&"items"in t.sortable&&"index"in t.sortable)}const dn=[ze.Down,ze.Right,ze.Up,ze.Left],un=(e,t)=>{let{context:{active:n,collisionRect:r,droppableRects:o,droppableContainers:i,over:a,scrollableAncestors:l}}=t;if(dn.includes(e.code)){if(e.preventDefault(),!n||!r)return;const t=[];i.getEnabled().forEach(n=>{if(!n||null!=n&&n.disabled)return;const i=o.get(n.id);if(i)switch(e.code){case ze.Down:r.top<i.top&&t.push(n);break;case ze.Up:r.top>i.top&&t.push(n);break;case ze.Left:r.left>i.left&&t.push(n);break;case ze.Right:r.left<i.left&&t.push(n)}});const c=(e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const o=ae(t),i=[];for(const e of r){const{id:t}=e,r=n.get(t);if(r){const n=ae(r),a=o.reduce((e,t,r)=>e+ne(n[r],t),0),l=Number((a/4).toFixed(4));i.push({id:t,data:{droppableContainer:e,value:l}})}}return i.sort(oe)})({active:n,collisionRect:r,droppableRects:o,droppableContainers:t,pointerCoordinates:null});let s=le(c,"id");if(s===(null==a?void 0:a.id)&&c.length>1&&(s=c[1].id),null!=s){const e=i.get(n.id),t=i.get(s),a=t?o.get(t.id):null,c=null==t?void 0:t.node.current;if(c&&a&&e&&t){const n=me(c).some((e,t)=>l[t]!==e),o=gn(e,t),i=function(e,t){if(!sn(e)||!sn(t))return!1;if(!gn(e,t))return!1;return e.data.current.sortable.index<t.data.current.sortable.index}(e,t),s=n||!o?{x:0,y:0}:{x:i?r.width-a.width:0,y:i?r.height-a.height:0},d={x:a.left,y:a.top};return s.x&&s.y?d:Y(d,s)}}}};function gn(e,t){return!(!sn(e)||!sn(t))&&e.data.current.sortable.containerId===t.data.current.sortable.containerId}w('.yoopta-block-dnd-sortable{position:relative;transition:transform .2s ease,opacity .2s ease}.yoopta-block-dnd-sortable--dragging{cursor:grabbing;z-index:1000}.yoopta-block-dnd-drop-indicator{background-color:var(--yoopta-block-dnd-indicator-color,#3b82f6);border-radius:1px;height:2px;left:0;pointer-events:none;position:absolute;right:0;top:0;z-index:100}.yoopta-block-dnd-drop-indicator:after,.yoopta-block-dnd-drop-indicator:before{background-color:var(--yoopta-block-dnd-indicator-color,#3b82f6);border-radius:50%;content:"";height:6px;position:absolute;top:50%;transform:translateY(-50%);width:6px}.yoopta-block-dnd-drop-indicator:before{left:-3px}.yoopta-block-dnd-drop-indicator:after{right:-3px}.yoopta-block-dnd-handle{cursor:grab;transition:opacity .15s ease}.yoopta-block-dnd-handle:hover{opacity:.8}.yoopta-block-dnd-handle:focus{outline:none}.yoopta-block-dnd-handle:focus-visible{border-radius:4px;outline:2px solid var(--yoopta-block-dnd-focus-ring,#3b82f6);outline-offset:2px}.yoopta-block-dnd-handle--holding{cursor:grabbing;opacity:.7}.yoopta-block-dnd-handle--dragging{cursor:grabbing;opacity:.5}.yoopta-block-dnd-handle:disabled{cursor:not-allowed;opacity:.3}.yoopta-block-dnd-overlay{align-items:center;animation:yoopta-block-dnd-overlay-fade-in .15s ease;background-color:var(--yoopta-block-dnd-overlay-bg,#fff);border:1px solid var(--yoopta-block-dnd-overlay-border,#e5e7eb);border-radius:8px;box-shadow:0 10px 25px -5px rgba(0,0,0,.1),0 8px 10px -6px rgba(0,0,0,.1);display:flex;gap:10px;min-width:140px;padding:10px 14px;pointer-events:none}.yoopta-block-dnd-overlay-icon{align-items:center;color:var(--yoopta-block-dnd-overlay-icon-color,#6b7280);display:flex;flex-shrink:0;height:20px;justify-content:center;width:20px}.yoopta-block-dnd-overlay-content{align-items:center;display:flex;flex:1;min-width:0}.yoopta-block-dnd-overlay-text{color:var(--yoopta-block-dnd-overlay-text,#374151);font-size:13px;font-weight:500;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.yoopta-block-dnd-overlay-text strong{color:var(--yoopta-block-dnd-overlay-text-accent,#1f2937);font-weight:600}[data-block-dnd-dragging=true]{opacity:.5;pointer-events:none}.yoopta-block-dnd-sortable:focus{outline:none}.yoopta-block-dnd-sortable:focus-visible{border-radius:4px;outline:2px solid var(--yoopta-block-dnd-focus-ring,#3b82f6);outline-offset:2px}@media (prefers-color-scheme:dark){.yoopta-block-dnd-handle:hover{opacity:.9}.yoopta-block-dnd-overlay{background-color:var(--yoopta-block-dnd-overlay-bg,#1f2937);border-color:var(--yoopta-block-dnd-overlay-border,#374151)}.yoopta-block-dnd-overlay-icon{color:var(--yoopta-block-dnd-overlay-icon-color,#9ca3af)}.yoopta-block-dnd-overlay-text{color:var(--yoopta-block-dnd-overlay-text,#f3f4f6)}.yoopta-block-dnd-overlay-text strong{color:var(--yoopta-block-dnd-overlay-text-accent,#fff)}}@keyframes yoopta-block-dnd-overlay-fade-in{0%{opacity:0;transform:scale(.95) translateY(-4px)}to{opacity:1;transform:scale(1) translateY(0)}}');const vn=d(null),fn=()=>{const e=v(vn);if(!e)throw new Error("useBlockDndContext must be used within a BlockDndContext");return e},hn=({transform:e})=>Object.assign(Object.assign({},e),{x:0}),pn=({editor:r,children:i,onDragStart:a,onDragEnd:d,renderDragOverlay:u,enableMultiDrag:g=!0})=>{var v;const[f,h]=s(null),[p,b]=s([]),y=l(new Map),w=o(()=>Object.keys(r.children).sort((e,t)=>r.children[e].meta.order-r.children[t].meta.order),[r.children]),x=f&&null!==(v=r.children[f])&&void 0!==v?v:null,D=o(()=>p.map(e=>r.children[e]).filter(Boolean),[p,r.children]),k=function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return o(()=>[...t].filter(e=>null!=e),[...t])}(ee(qe,{activationConstraint:{distance:5}}),ee(We,{coordinateGetter:un})),C=c(e=>{const{active:t}=e;h(t.id);const n=r.path.selected;let o=[t.id];if(g&&Array.isArray(n)&&n.length>1){const e=n.map(e=>{const t=m.getBlock(r,{at:e});return null==t?void 0:t.id}).filter(e=>void 0!==e);e.includes(t.id)&&(o=e)}b(o);const i=o.map(e=>r.children[e]).filter(Boolean);null==a||a(e,i)},[r,g,a]),R=c(e=>{const{active:t,over:n}=e;if(h(null),b([]),!n||t.id===n.id)return void(null==d||d(e,!1));const o=r.children[t.id],i=r.children[n.id];if(!o||!i)return void(null==d||d(e,!1));const a=o.meta.order,l=i.meta.order;a!==l?(r.batchOperations(()=>{if(p.length>1){const e=[...p].sort((e,t)=>{var n,o,i,a;return(null!==(o=null===(n=r.children[e])||void 0===n?void 0:n.meta.order)&&void 0!==o?o:0)-(null!==(a=null===(i=r.children[t])||void 0===i?void 0:i.meta.order)&&void 0!==a?a:0)}),t=l;e.forEach((e,n)=>{r.moveBlock(e,t+n)})}else r.moveBlock(t.id,l)}),r.setPath({current:l,selected:null}),null==d||d(e,!0)):null==d||d(e,!1)},[r,p,d]),E=c((e,t)=>{y.current.set(e,t)},[]),N=c(e=>{y.current.delete(e)},[]),O=c(e=>y.current.get(e)||null,[]),S=o(()=>({activeId:f,activeBlock:x,isDragging:null!==f,draggedIds:p,editor:r,registerSortable:E,unregisterSortable:N,getSortable:O}),[f,x,p,r,E,N,O]),I=D.length>0&&e("div",Object.assign({className:"yoopta-block-dnd-overlay"},{children:[t("div",Object.assign({className:"yoopta-block-dnd-overlay-icon"},{children:t("svg",Object.assign({width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg"},{children:t("path",{d:"M6 2h4M6 8h4M6 14h4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}))})),t("div",Object.assign({className:"yoopta-block-dnd-overlay-content"},{children:t("span",Object.assign({className:"yoopta-block-dnd-overlay-text"},{children:1===D.length?t(n,{children:"Moving block"}):e(n,{children:["Moving ",t("strong",{children:D.length})," blocks"]})}))}))]}));return t(vn.Provider,Object.assign({value:S},{children:e(Ot,Object.assign({sensors:k,collisionDetection:se,onDragStart:C,onDragEnd:R,modifiers:[hn]},{children:[t(en,Object.assign({items:w,strategy:Zt},{children:i})),t(Ht,Object.assign({dropAnimation:null},{children:f?u?u(D):I:null}))]}))}))},bn=({id:n,children:r,className:o,disabled:i=!1,useDragHandle:l=!1})=>{const{draggedIds:c,isDragging:s,registerSortable:d,unregisterSortable:u}=fn(),{attributes:g,listeners:v,setNodeRef:f,setActivatorNodeRef:h,transform:p,transition:b,isDragging:y,isOver:m}=cn({id:n,disabled:i});a(()=>{if(l)return d(n,{setActivatorNodeRef:h,listeners:v,attributes:g}),()=>{u(n)}},[n,l,h,v,g,d,u]);const w=c.includes(n)&&c.length>1,x=y||s&&c.includes(n),D={transform:K.Transform.toString(p),transition:b,opacity:x?.5:1,position:"relative"},k=["yoopta-block-dnd-sortable",y&&"yoopta-block-dnd-sortable--dragging",m&&"yoopta-block-dnd-sortable--over",w&&"yoopta-block-dnd-sortable--multi",o].filter(Boolean).join(" ");return e("div",Object.assign({ref:f,style:D,className:k},l?{}:g,l?{}:v,{"data-block-dnd-id":n,"data-block-dnd-dragging":x||void 0,"data-block-dnd-over":m||void 0},{children:[r,m&&!y&&t("div",{className:"yoopta-block-dnd-drop-indicator"})]}))},yn=h(({blockId:e,children:n,className:r,onClick:o,asChild:i=!1},d)=>{const{isDragging:u,getSortable:g}=fn(),[v,h]=s(!1),b=l(!1),y=e?g(e):null,m=l(d);m.current=d;const w=c(e=>{y&&y.setActivatorNodeRef(e);const t=m.current;"function"==typeof t?t(e):t&&(t.current=e)},[y]);a(()=>{if(!u){const e=setTimeout(()=>{b.current=!1,h(!1)},100);return()=>clearTimeout(e)}b.current=!0,h(!0)},[u]);const x=c(e=>{b.current||u||null==o||o(e)},[u,o]),D=["yoopta-block-dnd-handle",v&&"yoopta-block-dnd-handle--holding",u&&"yoopta-block-dnd-handle--dragging",r].filter(Boolean).join(" ");if(!y||!e){if(i&&p(n)){const e=n.props,t=e.ref,o=e=>{"function"==typeof d?d(e):d&&(d.current=e),t&&("function"==typeof t?t(e):t&&"current"in t&&(t.current=e))};return f(n,Object.assign(Object.assign({},e),{ref:o,className:r,disabled:!0}))}return t("button",Object.assign({type:"button",ref:d,className:r,disabled:!0},{children:n}))}if(i&&p(n)){const t=n.props,r=t.ref,o=e=>{y&&y.setActivatorNodeRef(e);const t=m.current;"function"==typeof t?t(e):t&&(t.current=e),r&&("function"==typeof r?r(e):r&&"current"in r&&(r.current=e))};return f(n,Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},t),{ref:o,className:[D,t.className].filter(Boolean).join(" "),onClick:e=>{var n;x(e),null===(n=t.onClick)||void 0===n||n.call(t,e)}}),y.attributes),y.listeners),{"data-block-dnd-handle":!0,"data-block-id":e,"aria-label":t["aria-label"]||"Drag to reorder block",title:t.title||"Drag to reorder"}))}return t("button",Object.assign({type:"button",ref:w,className:D,onClick:x},y.attributes,y.listeners,{"data-block-dnd-handle":!0,"data-block-id":e,"aria-label":"Drag to reorder block",title:"Drag to reorder"},{children:n}))});yn.displayName="DragHandle";const mn=(e={})=>{const{blockId:t}=e,n=fn(),{isDragging:r,draggedIds:i,editor:a}=n,l=o(()=>!!t&&i.includes(t),[t,i]),s=o(()=>!!t&&(i.includes(t)&&i.length>1),[t,i]),d=c((e,t)=>{a.moveBlock(e,t)},[a]),u=c((e,t)=>{a.batchOperations(()=>{[...e].sort((e,t)=>{var n,r,o,i;return(null!==(r=null===(n=a.children[e])||void 0===n?void 0:n.meta.order)&&void 0!==r?r:0)-(null!==(i=null===(o=a.children[t])||void 0===o?void 0:o.meta.order)&&void 0!==i?i:0)}).forEach((e,n)=>{a.moveBlock(e,t+n)})})},[a]);return{isDragging:r,isBlockDragging:l,isPartOfMultiDrag:s,dragCount:i.length,draggedIds:i,moveBlock:d,moveBlocks:u}},wn=e=>Object.keys(e.children).sort((t,n)=>e.children[t].meta.order-e.children[n].meta.order);export{pn as BlockDndContext,yn as DragHandle,bn as SortableBlock,wn as getOrderedBlockIds,mn as useBlockDnd,fn as useBlockDndContext};
|
|
@@ -1,30 +1,90 @@
|
|
|
1
1
|
import type { CSSProperties, ReactNode } from 'react';
|
|
2
2
|
import './block-options.css';
|
|
3
|
+
type Placement = 'top' | 'right' | 'bottom' | 'left';
|
|
4
|
+
type Align = 'start' | 'center' | 'end';
|
|
3
5
|
type BlockOptionsRootProps = {
|
|
4
6
|
children: ReactNode;
|
|
5
|
-
|
|
7
|
+
/** Controlled open state */
|
|
8
|
+
open?: boolean;
|
|
9
|
+
/** Callback when open state changes */
|
|
10
|
+
onOpenChange?: (open: boolean) => void;
|
|
11
|
+
/** Default open state for uncontrolled usage */
|
|
12
|
+
defaultOpen?: boolean;
|
|
13
|
+
/** External anchor element for positioning (use when no Trigger is present) */
|
|
14
|
+
anchor?: HTMLElement | null;
|
|
15
|
+
};
|
|
16
|
+
type BlockOptionsTriggerProps = {
|
|
17
|
+
children: ReactNode;
|
|
18
|
+
/** Merge props onto child element instead of wrapping */
|
|
19
|
+
asChild?: boolean;
|
|
20
|
+
className?: string;
|
|
21
|
+
};
|
|
22
|
+
type BlockOptionsPortalProps = {
|
|
23
|
+
children: ReactNode;
|
|
24
|
+
};
|
|
25
|
+
type BlockOptionsContentProps = {
|
|
26
|
+
children: ReactNode;
|
|
6
27
|
className?: string;
|
|
7
|
-
|
|
28
|
+
style?: CSSProperties;
|
|
29
|
+
/** Placement relative to trigger */
|
|
30
|
+
side?: Placement;
|
|
31
|
+
/** Alignment relative to trigger */
|
|
32
|
+
align?: Align;
|
|
33
|
+
/** Offset from trigger in pixels */
|
|
34
|
+
sideOffset?: number;
|
|
8
35
|
};
|
|
9
36
|
type BlockOptionsGroupProps = {
|
|
10
37
|
children: ReactNode;
|
|
11
38
|
className?: string;
|
|
12
39
|
};
|
|
40
|
+
type BlockOptionsItemProps = {
|
|
41
|
+
children: ReactNode;
|
|
42
|
+
/** Called when item is selected */
|
|
43
|
+
onSelect?: (event: React.MouseEvent) => void;
|
|
44
|
+
className?: string;
|
|
45
|
+
disabled?: boolean;
|
|
46
|
+
icon?: ReactNode;
|
|
47
|
+
/** Visual variant */
|
|
48
|
+
variant?: 'default' | 'destructive';
|
|
49
|
+
/** Keep menu open after selection */
|
|
50
|
+
keepOpen?: boolean;
|
|
51
|
+
} & Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, 'onSelect'>;
|
|
13
52
|
type BlockOptionsSeparatorProps = {
|
|
14
53
|
className?: string;
|
|
15
54
|
};
|
|
16
|
-
|
|
17
|
-
|
|
55
|
+
type BlockOptionsLabelProps = {
|
|
56
|
+
children: ReactNode;
|
|
57
|
+
className?: string;
|
|
58
|
+
};
|
|
59
|
+
export declare const BlockOptions: {
|
|
60
|
+
({ children, open: controlledOpen, onOpenChange: controlledOnOpenChange, defaultOpen, anchor, }: BlockOptionsRootProps): import("react/jsx-runtime").JSX.Element;
|
|
61
|
+
displayName: string;
|
|
62
|
+
} & {
|
|
63
|
+
Root: {
|
|
64
|
+
({ children, open: controlledOpen, onOpenChange: controlledOnOpenChange, defaultOpen, anchor, }: BlockOptionsRootProps): import("react/jsx-runtime").JSX.Element;
|
|
65
|
+
displayName: string;
|
|
66
|
+
};
|
|
67
|
+
Trigger: import("react").ForwardRefExoticComponent<BlockOptionsTriggerProps & import("react").RefAttributes<HTMLButtonElement>>;
|
|
68
|
+
Portal: {
|
|
69
|
+
({ children }: BlockOptionsPortalProps): import("react/jsx-runtime").JSX.Element;
|
|
70
|
+
displayName: string;
|
|
71
|
+
};
|
|
72
|
+
Content: import("react").ForwardRefExoticComponent<BlockOptionsContentProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
18
73
|
Group: import("react").ForwardRefExoticComponent<BlockOptionsGroupProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
19
|
-
|
|
74
|
+
Item: import("react").ForwardRefExoticComponent<{
|
|
20
75
|
children: ReactNode;
|
|
21
|
-
|
|
76
|
+
/** Called when item is selected */
|
|
77
|
+
onSelect?: ((event: React.MouseEvent) => void) | undefined;
|
|
22
78
|
className?: string | undefined;
|
|
23
79
|
disabled?: boolean | undefined;
|
|
24
80
|
icon?: ReactNode;
|
|
81
|
+
/** Visual variant */
|
|
25
82
|
variant?: "default" | "destructive" | undefined;
|
|
26
|
-
|
|
83
|
+
/** Keep menu open after selection */
|
|
84
|
+
keepOpen?: boolean | undefined;
|
|
85
|
+
} & Omit<import("react").ButtonHTMLAttributes<HTMLButtonElement>, "onSelect"> & import("react").RefAttributes<HTMLButtonElement>>;
|
|
27
86
|
Separator: import("react").ForwardRefExoticComponent<BlockOptionsSeparatorProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
87
|
+
Label: import("react").ForwardRefExoticComponent<BlockOptionsLabelProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
28
88
|
};
|
|
29
|
-
export {};
|
|
89
|
+
export type { BlockOptionsRootProps, BlockOptionsTriggerProps, BlockOptionsContentProps, BlockOptionsGroupProps, BlockOptionsItemProps, BlockOptionsSeparatorProps, BlockOptionsLabelProps, };
|
|
30
90
|
//# sourceMappingURL=block-options.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"block-options.d.ts","sourceRoot":"","sources":["../../src/block-options/block-options.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,
|
|
1
|
+
{"version":3,"file":"block-options.d.ts","sourceRoot":"","sources":["../../src/block-options/block-options.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAgB,SAAS,EAAE,MAAM,OAAO,CAAC;AAkBpE,OAAO,qBAAqB,CAAC;AAE7B,KAAK,SAAS,GAAG,KAAK,GAAG,OAAO,GAAG,QAAQ,GAAG,MAAM,CAAC;AACrD,KAAK,KAAK,GAAG,OAAO,GAAG,QAAQ,GAAG,KAAK,CAAC;AAExC,KAAK,qBAAqB,GAAG;IAC3B,QAAQ,EAAE,SAAS,CAAC;IACpB,4BAA4B;IAC5B,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,uCAAuC;IACvC,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;IACvC,gDAAgD;IAChD,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,+EAA+E;IAC/E,MAAM,CAAC,EAAE,WAAW,GAAG,IAAI,CAAC;CAC7B,CAAC;AA6CF,KAAK,wBAAwB,GAAG;IAC9B,QAAQ,EAAE,SAAS,CAAC;IACpB,yDAAyD;IACzD,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AAsCF,KAAK,uBAAuB,GAAG;IAC7B,QAAQ,EAAE,SAAS,CAAC;CACrB,CAAC;AAQF,KAAK,wBAAwB,GAAG;IAC9B,QAAQ,EAAE,SAAS,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,aAAa,CAAC;IACtB,oCAAoC;IACpC,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,oCAAoC;IACpC,KAAK,CAAC,EAAE,KAAK,CAAC;IACd,oCAAoC;IACpC,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB,CAAC;AAmEF,KAAK,sBAAsB,GAAG;IAC5B,QAAQ,EAAE,SAAS,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AAYF,KAAK,qBAAqB,GAAG;IAC3B,QAAQ,EAAE,SAAS,CAAC;IACpB,mCAAmC;IACnC,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC,UAAU,KAAK,IAAI,CAAC;IAC7C,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,qBAAqB;IACrB,OAAO,CAAC,EAAE,SAAS,GAAG,aAAa,CAAC;IACpC,qCAAqC;IACrC,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB,GAAG,IAAI,CAAC,KAAK,CAAC,oBAAoB,CAAC,iBAAiB,CAAC,EAAE,UAAU,CAAC,CAAC;AA0CpE,KAAK,0BAA0B,GAAG;IAChC,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AAUF,KAAK,sBAAsB,GAAG;IAC5B,QAAQ,EAAE,SAAS,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AAYF,eAAO,MAAM,YAAY;qGAtQtB,qBAAqB;;;;yGAArB,qBAAqB;;;;;uBAoFkB,uBAAuB;;;;;;kBAmGrD,SAAS;QACnB,mCAAmC;4BAChB,gBAAgB,KAAK,IAAI;;;eAGrC,SAAS;QAChB,qBAAqB;;QAErB,qCAAqC;;;;;CAgFrC,CAAC;AAEH,YAAY,EACV,qBAAqB,EACrB,wBAAwB,EACxB,wBAAwB,EACxB,sBAAsB,EACtB,qBAAqB,EACrB,0BAA0B,EAC1B,sBAAsB,GACvB,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
export type BlockOptionsContextValue = {
|
|
3
|
+
open: boolean;
|
|
4
|
+
onOpenChange: (open: boolean) => void;
|
|
5
|
+
triggerRef: HTMLElement | null;
|
|
6
|
+
setTriggerRef: (ref: HTMLElement | null) => void;
|
|
7
|
+
contentId: string;
|
|
8
|
+
};
|
|
9
|
+
export declare const BlockOptionsContext: import("react").Context<BlockOptionsContextValue | null>;
|
|
10
|
+
export declare const useBlockOptionsContext: () => BlockOptionsContextValue;
|
|
11
|
+
//# sourceMappingURL=context.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../src/block-options/context.tsx"],"names":[],"mappings":";AAEA,MAAM,MAAM,wBAAwB,GAAG;IACrC,IAAI,EAAE,OAAO,CAAC;IACd,YAAY,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;IACtC,UAAU,EAAE,WAAW,GAAG,IAAI,CAAC;IAC/B,aAAa,EAAE,CAAC,GAAG,EAAE,WAAW,GAAG,IAAI,KAAK,IAAI,CAAC;IACjD,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC;AAEF,eAAO,MAAM,mBAAmB,0DAAuD,CAAC;AAExF,eAAO,MAAM,sBAAsB,gCAMlC,CAAC"}
|