@domternal/react 0.7.0 → 0.7.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (57) hide show
  1. package/README.md +1 -1
  2. package/package.json +1 -1
  3. package/dist/Domternal.d.ts +0 -79
  4. package/dist/Domternal.d.ts.map +0 -1
  5. package/dist/DomternalEditor.d.ts +0 -48
  6. package/dist/DomternalEditor.d.ts.map +0 -1
  7. package/dist/DomternalFloatingMenu.d.ts +0 -36
  8. package/dist/DomternalFloatingMenu.d.ts.map +0 -1
  9. package/dist/EditorContent.d.ts +0 -22
  10. package/dist/EditorContent.d.ts.map +0 -1
  11. package/dist/EditorContext.d.ts +0 -36
  12. package/dist/EditorContext.d.ts.map +0 -1
  13. package/dist/bubble-menu/DomternalBubbleMenu.d.ts +0 -22
  14. package/dist/bubble-menu/DomternalBubbleMenu.d.ts.map +0 -1
  15. package/dist/bubble-menu/useBubbleMenu.d.ts +0 -56
  16. package/dist/bubble-menu/useBubbleMenu.d.ts.map +0 -1
  17. package/dist/emoji-picker/DomternalEmojiPicker.d.ts +0 -11
  18. package/dist/emoji-picker/DomternalEmojiPicker.d.ts.map +0 -1
  19. package/dist/emoji-picker/useEmojiPicker.d.ts +0 -24
  20. package/dist/emoji-picker/useEmojiPicker.d.ts.map +0 -1
  21. package/dist/index.d.ts.map +0 -1
  22. package/dist/node-views/NodeViewContent.d.ts +0 -11
  23. package/dist/node-views/NodeViewContent.d.ts.map +0 -1
  24. package/dist/node-views/NodeViewWrapper.d.ts +0 -11
  25. package/dist/node-views/NodeViewWrapper.d.ts.map +0 -1
  26. package/dist/node-views/ReactNodeViewContext.d.ts +0 -12
  27. package/dist/node-views/ReactNodeViewContext.d.ts.map +0 -1
  28. package/dist/node-views/ReactNodeViewRenderer.d.ts +0 -101
  29. package/dist/node-views/ReactNodeViewRenderer.d.ts.map +0 -1
  30. package/dist/notion-color-picker/DomternalNotionColorPicker.d.ts +0 -25
  31. package/dist/notion-color-picker/DomternalNotionColorPicker.d.ts.map +0 -1
  32. package/dist/notion-color-picker/index.d.ts +0 -5
  33. package/dist/notion-color-picker/index.d.ts.map +0 -1
  34. package/dist/notion-color-picker/useNotionColorPicker.d.ts +0 -47
  35. package/dist/notion-color-picker/useNotionColorPicker.d.ts.map +0 -1
  36. package/dist/toolbar/DomternalToolbar.d.ts +0 -12
  37. package/dist/toolbar/DomternalToolbar.d.ts.map +0 -1
  38. package/dist/toolbar/ToolbarButton.d.ts +0 -15
  39. package/dist/toolbar/ToolbarButton.d.ts.map +0 -1
  40. package/dist/toolbar/ToolbarDropdown.d.ts +0 -17
  41. package/dist/toolbar/ToolbarDropdown.d.ts.map +0 -1
  42. package/dist/toolbar/ToolbarDropdownPanel.d.ts +0 -10
  43. package/dist/toolbar/ToolbarDropdownPanel.d.ts.map +0 -1
  44. package/dist/toolbar/useComputedStyle.d.ts +0 -12
  45. package/dist/toolbar/useComputedStyle.d.ts.map +0 -1
  46. package/dist/toolbar/useKeyboardNav.d.ts +0 -6
  47. package/dist/toolbar/useKeyboardNav.d.ts.map +0 -1
  48. package/dist/toolbar/useToolbarController.d.ts +0 -21
  49. package/dist/toolbar/useToolbarController.d.ts.map +0 -1
  50. package/dist/toolbar/useToolbarIcons.d.ts +0 -12
  51. package/dist/toolbar/useToolbarIcons.d.ts.map +0 -1
  52. package/dist/toolbar/useTooltip.d.ts +0 -5
  53. package/dist/toolbar/useTooltip.d.ts.map +0 -1
  54. package/dist/useEditor.d.ts +0 -80
  55. package/dist/useEditor.d.ts.map +0 -1
  56. package/dist/useEditorState.d.ts +0 -27
  57. package/dist/useEditorState.d.ts.map +0 -1
package/README.md CHANGED
@@ -8,7 +8,7 @@ Use it headless with vanilla JS/TS, add the built-in toolbar and theme, or drop
8
8
 
9
9
  ## Links
10
10
 
11
- <u>[Website](https://domternal.dev)</u> &nbsp;&nbsp;&nbsp;•&nbsp;&nbsp;&nbsp; <u>[Documentation](https://domternal.dev/v1/introduction)</u>
11
+ <u>[Website](https://domternal.dev)</u> &nbsp;&nbsp;&nbsp;•&nbsp;&nbsp;&nbsp; <u>[Documentation](https://domternal.dev/v1/introduction)</u> &nbsp;&nbsp;&nbsp;•&nbsp;&nbsp;&nbsp;
12
12
  <u>[StackBlitz (Angular)](https://stackblitz.com/edit/domternal-angular-full-example)</u> &nbsp;&nbsp;&nbsp;•&nbsp;&nbsp;&nbsp; <u>[StackBlitz (React)](https://stackblitz.com/edit/domternal-react-full-example)</u> &nbsp;&nbsp;&nbsp;•&nbsp;&nbsp;&nbsp; <u>[StackBlitz (Vue)](https://stackblitz.com/edit/domternal-vue-full-example)</u> &nbsp;&nbsp;&nbsp;•&nbsp;&nbsp;&nbsp; <u>[StackBlitz (Vanilla TS)](https://stackblitz.com/edit/domternal-vanilla-full-example)</u>
13
13
 
14
14
  ## Features
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@domternal/react",
3
- "version": "0.7.0",
3
+ "version": "0.7.1",
4
4
  "description": "React components for Domternal editor",
5
5
  "author": "https://github.com/ThomasNowHere",
6
6
  "license": "MIT",
@@ -1,79 +0,0 @@
1
- import { type DependencyList, type ReactNode } from 'react';
2
- import { type UseEditorOptions } from './useEditor.js';
3
- import { type DomternalToolbarProps } from './toolbar/DomternalToolbar.js';
4
- import { type DomternalBubbleMenuProps } from './bubble-menu/DomternalBubbleMenu.js';
5
- import { type DomternalFloatingMenuProps } from './DomternalFloatingMenu.js';
6
- import { type DomternalEmojiPickerProps } from './emoji-picker/DomternalEmojiPicker.js';
7
- export interface DomternalProps extends UseEditorOptions {
8
- /** Optional dependency array for forced editor recreation. */
9
- deps?: DependencyList;
10
- children: ReactNode;
11
- }
12
- /**
13
- * Composable root component that creates an editor and provides it to all
14
- * subcomponents via context. No need to pass `editor` prop to children.
15
- *
16
- * @example
17
- * ```tsx
18
- * <Domternal extensions={[Bold, Italic]} content="<p>Hello</p>">
19
- * <Domternal.Toolbar />
20
- * <Domternal.Content />
21
- * <Domternal.BubbleMenu contexts={{ text: ['bold', 'italic'] }} />
22
- * <Domternal.EmojiPicker emojis={emojis} />
23
- * </Domternal>
24
- * ```
25
- *
26
- * @example SSR-safe with loading state
27
- * ```tsx
28
- * <Domternal extensions={extensions} immediatelyRender={false}>
29
- * <Domternal.Loading>Loading editor...</Domternal.Loading>
30
- * <Domternal.Toolbar />
31
- * <Domternal.Content />
32
- * </Domternal>
33
- * ```
34
- */
35
- export declare function Domternal({ children, deps, ...options }: DomternalProps): ReactNode;
36
- export declare namespace Domternal {
37
- var Content: typeof DomternalContent;
38
- var Loading: typeof DomternalLoading;
39
- var Toolbar: typeof DomternalToolbarSub;
40
- var BubbleMenu: typeof DomternalBubbleMenuSub;
41
- var FloatingMenu: typeof DomternalFloatingMenuSub;
42
- var EmojiPicker: typeof DomternalEmojiPickerSub;
43
- }
44
- /** Renders the editor content area. Mounts the editor view DOM from context. */
45
- declare function DomternalContent({ className }: {
46
- className?: string;
47
- }): ReactNode;
48
- declare namespace DomternalContent {
49
- var displayName: string;
50
- }
51
- /** Renders children only while editor is not yet ready (SSR loading state). */
52
- declare function DomternalLoading({ children }: {
53
- children: ReactNode;
54
- }): ReactNode;
55
- declare namespace DomternalLoading {
56
- var displayName: string;
57
- }
58
- /** Toolbar subcomponent. Uses editor from context automatically. */
59
- declare function DomternalToolbarSub(props: Omit<DomternalToolbarProps, 'editor'>): ReactNode;
60
- declare namespace DomternalToolbarSub {
61
- var displayName: string;
62
- }
63
- /** BubbleMenu subcomponent. Uses editor from context automatically. */
64
- declare function DomternalBubbleMenuSub(props: Omit<DomternalBubbleMenuProps, 'editor'>): ReactNode;
65
- declare namespace DomternalBubbleMenuSub {
66
- var displayName: string;
67
- }
68
- /** FloatingMenu subcomponent. Uses editor from context automatically. */
69
- declare function DomternalFloatingMenuSub(props: Omit<DomternalFloatingMenuProps, 'editor'>): ReactNode;
70
- declare namespace DomternalFloatingMenuSub {
71
- var displayName: string;
72
- }
73
- /** EmojiPicker subcomponent. Uses editor from context automatically. */
74
- declare function DomternalEmojiPickerSub(props: Omit<DomternalEmojiPickerProps, 'editor'>): ReactNode;
75
- declare namespace DomternalEmojiPickerSub {
76
- var displayName: string;
77
- }
78
- export {};
79
- //# sourceMappingURL=Domternal.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Domternal.d.ts","sourceRoot":"","sources":["../src/Domternal.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAqB,KAAK,cAAc,EAAE,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAC/E,OAAO,EAAa,KAAK,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAElE,OAAO,EAAoB,KAAK,qBAAqB,EAAE,MAAM,+BAA+B,CAAC;AAC7F,OAAO,EAAuB,KAAK,wBAAwB,EAAE,MAAM,sCAAsC,CAAC;AAC1G,OAAO,EAAyB,KAAK,0BAA0B,EAAE,MAAM,4BAA4B,CAAC;AACpG,OAAO,EAAwB,KAAK,yBAAyB,EAAE,MAAM,wCAAwC,CAAC;AAI9G,MAAM,WAAW,cAAe,SAAQ,gBAAgB;IACtD,8DAA8D;IAC9D,IAAI,CAAC,EAAE,cAAc,CAAC;IACtB,QAAQ,EAAE,SAAS,CAAC;CACrB;AAED;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAgB,SAAS,CAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,EAAE,cAAc,GAAG,SAAS,CAQnF;yBARe,SAAS;;;;;;;;AAYzB,gFAAgF;AAChF,iBAAS,gBAAgB,CAAC,EAAE,SAAS,EAAE,EAAE;IAAE,SAAS,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,SAAS,CAqB1E;kBArBQ,gBAAgB;;;AAuBzB,+EAA+E;AAC/E,iBAAS,gBAAgB,CAAC,EAAE,QAAQ,EAAE,EAAE;IAAE,QAAQ,EAAE,SAAS,CAAA;CAAE,GAAG,SAAS,CAI1E;kBAJQ,gBAAgB;;;AAMzB,oEAAoE;AACpE,iBAAS,mBAAmB,CAAC,KAAK,EAAE,IAAI,CAAC,qBAAqB,EAAE,QAAQ,CAAC,GAAG,SAAS,CAEpF;kBAFQ,mBAAmB;;;AAI5B,uEAAuE;AACvE,iBAAS,sBAAsB,CAAC,KAAK,EAAE,IAAI,CAAC,wBAAwB,EAAE,QAAQ,CAAC,GAAG,SAAS,CAE1F;kBAFQ,sBAAsB;;;AAI/B,yEAAyE;AACzE,iBAAS,wBAAwB,CAAC,KAAK,EAAE,IAAI,CAAC,0BAA0B,EAAE,QAAQ,CAAC,GAAG,SAAS,CAE9F;kBAFQ,wBAAwB;;;AAIjC,wEAAwE;AACxE,iBAAS,uBAAuB,CAAC,KAAK,EAAE,IAAI,CAAC,yBAAyB,EAAE,QAAQ,CAAC,GAAG,SAAS,CAE5F;kBAFQ,uBAAuB"}
@@ -1,48 +0,0 @@
1
- import type { Content, JSONContent, Editor } from '@domternal/core';
2
- import { type UseEditorOptions } from './useEditor.js';
3
- export interface DomternalEditorProps extends Omit<UseEditorOptions, 'outputFormat'> {
4
- /** Additional CSS class for the .dm-editor wrapper. */
5
- className?: string;
6
- /** Output format for onChange. @default 'html' */
7
- outputFormat?: 'html' | 'json';
8
- /** Controlled value. When provided, editor content syncs to this value. */
9
- value?: Content;
10
- /** Called when content changes (controlled mode). */
11
- onChange?: (value: string | JSONContent) => void;
12
- /** Additional content rendered inside the dm-editor wrapper. */
13
- children?: React.ReactNode;
14
- }
15
- export interface DomternalEditorRef {
16
- editor: Editor | null;
17
- htmlContent: string;
18
- jsonContent: JSONContent | null;
19
- isEmpty: boolean;
20
- isFocused: boolean;
21
- isEditable: boolean;
22
- }
23
- /**
24
- * All-in-one editor component with integrated state management and context.
25
- *
26
- * Wraps children with EditorProvider automatically, so toolbar, bubble menu,
27
- * and emoji picker components can access the editor via context.
28
- *
29
- * @example
30
- * ```tsx
31
- * const editorRef = useRef<DomternalEditorRef>(null);
32
- *
33
- * <DomternalEditor
34
- * ref={editorRef}
35
- * extensions={[Bold, Italic, Heading]}
36
- * content="<p>Hello</p>"
37
- * onUpdate={({ editor }) => console.log(editor.getHTML())}
38
- * />
39
- * ```
40
- *
41
- * @example Controlled mode
42
- * ```tsx
43
- * const [html, setHtml] = useState('<p>Hello</p>');
44
- * <DomternalEditor value={html} onChange={setHtml} outputFormat="html" />
45
- * ```
46
- */
47
- export declare const DomternalEditor: import("react").ForwardRefExoticComponent<DomternalEditorProps & import("react").RefAttributes<DomternalEditorRef>>;
48
- //# sourceMappingURL=DomternalEditor.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"DomternalEditor.d.ts","sourceRoot":"","sources":["../src/DomternalEditor.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AACpE,OAAO,EAAa,KAAK,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAIlE,MAAM,WAAW,oBAAqB,SAAQ,IAAI,CAAC,gBAAgB,EAAE,cAAc,CAAC;IAClF,uDAAuD;IACvD,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,kDAAkD;IAClD,YAAY,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAC/B,2EAA2E;IAC3E,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,qDAAqD;IACrD,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,GAAG,WAAW,KAAK,IAAI,CAAC;IACjD,gEAAgE;IAChE,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CAC5B;AAED,MAAM,WAAW,kBAAkB;IACjC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,WAAW,GAAG,IAAI,CAAC;IAChC,OAAO,EAAE,OAAO,CAAC;IACjB,SAAS,EAAE,OAAO,CAAC;IACnB,UAAU,EAAE,OAAO,CAAC;CACrB;AAED;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,eAAO,MAAM,eAAe,qHA4E3B,CAAC"}
@@ -1,36 +0,0 @@
1
- import { type ReactNode } from 'react';
2
- import type { Editor, FloatingMenuItemsOverride, IconSet } from '@domternal/core';
3
- import type { FloatingMenuKeymap, FloatingMenuOptions } from '@domternal/extension-block-menu';
4
- export interface DomternalFloatingMenuProps {
5
- /** The editor instance. If omitted, uses EditorProvider context. */
6
- editor?: Editor;
7
- /** Custom visibility predicate. */
8
- shouldShow?: FloatingMenuOptions['shouldShow'];
9
- /** Pixel offset from trigger anchor. @default 0 */
10
- offset?: number;
11
- /** Items override (array replaces defaults; function transforms them). */
12
- items?: FloatingMenuItemsOverride;
13
- /** Keyboard shortcuts for entering the menu via keyboard. */
14
- keymap?: FloatingMenuKeymap;
15
- /** Custom icon set (falls back to `@domternal/core`'s `defaultIcons`). */
16
- icons?: IconSet;
17
- /**
18
- * When true, the menu does NOT auto-show on every empty paragraph;
19
- * it only opens when the BlockHandle `+` button (or any caller of
20
- * `showFloatingMenu`) explicitly triggers it. Notion-style behaviour.
21
- * @default false
22
- */
23
- requireExplicitTrigger?: boolean;
24
- /**
25
- * Optional custom content. When provided, the default grouped-item
26
- * rendering is skipped and children are rendered inside the menu element.
27
- */
28
- children?: ReactNode;
29
- }
30
- /**
31
- * Block-insert floating menu. Renders defaults collected from the editor's
32
- * extensions via `addFloatingMenuItems()`; pass `items` to override or
33
- * `children` to render a fully custom UI.
34
- */
35
- export declare function DomternalFloatingMenu({ editor: editorProp, shouldShow, offset, items, keymap, icons, requireExplicitTrigger, children, }: DomternalFloatingMenuProps): ReactNode;
36
- //# sourceMappingURL=DomternalFloatingMenu.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"DomternalFloatingMenu.d.ts","sourceRoot":"","sources":["../src/DomternalFloatingMenu.tsx"],"names":[],"mappings":"AAAA,OAAO,EAUL,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AAMf,OAAO,KAAK,EACV,MAAM,EAEN,yBAAyB,EACzB,OAAO,EACR,MAAM,iBAAiB,CAAC;AAEzB,OAAO,KAAK,EACV,kBAAkB,EAClB,mBAAmB,EACpB,MAAM,iCAAiC,CAAC;AAGzC,MAAM,WAAW,0BAA0B;IACzC,oEAAoE;IACpE,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,mCAAmC;IACnC,UAAU,CAAC,EAAE,mBAAmB,CAAC,YAAY,CAAC,CAAC;IAC/C,mDAAmD;IACnD,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,0EAA0E;IAC1E,KAAK,CAAC,EAAE,yBAAyB,CAAC;IAClC,6DAA6D;IAC7D,MAAM,CAAC,EAAE,kBAAkB,CAAC;IAC5B,0EAA0E;IAC1E,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB;;;;;OAKG;IACH,sBAAsB,CAAC,EAAE,OAAO,CAAC;IACjC;;;OAGG;IACH,QAAQ,CAAC,EAAE,SAAS,CAAC;CACtB;AAED;;;;GAIG;AACH,wBAAgB,qBAAqB,CAAC,EACpC,MAAM,EAAE,UAAU,EAClB,UAAU,EACV,MAAU,EACV,KAAK,EACL,MAAM,EACN,KAAK,EACL,sBAA8B,EAC9B,QAAQ,GACT,EAAE,0BAA0B,GAAG,SAAS,CAiMxC"}
@@ -1,22 +0,0 @@
1
- import { type HTMLAttributes, type Ref, type ReactNode } from 'react';
2
- import type { Editor } from '@domternal/core';
3
- export interface EditorContentProps extends HTMLAttributes<HTMLDivElement> {
4
- /** The editor instance to render. */
5
- editor: Editor | null;
6
- /** Ref to the underlying div element. */
7
- innerRef?: Ref<HTMLDivElement>;
8
- }
9
- /**
10
- * Renders the ProseMirror editor view into a div element.
11
- *
12
- * Use this with `useEditor` for a flexible, decoupled pattern where the
13
- * editor hook and rendering are separated:
14
- *
15
- * @example
16
- * ```tsx
17
- * const { editor } = useEditor({ extensions, content });
18
- * return <EditorContent editor={editor} className="my-editor" />;
19
- * ```
20
- */
21
- export declare function EditorContent({ editor, innerRef, ...htmlProps }: EditorContentProps): ReactNode;
22
- //# sourceMappingURL=EditorContent.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"EditorContent.d.ts","sourceRoot":"","sources":["../src/EditorContent.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAqB,KAAK,cAAc,EAAE,KAAK,GAAG,EAAE,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AACzF,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAE9C,MAAM,WAAW,kBAAmB,SAAQ,cAAc,CAAC,cAAc,CAAC;IACxE,qCAAqC;IACrC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,yCAAyC;IACzC,QAAQ,CAAC,EAAE,GAAG,CAAC,cAAc,CAAC,CAAC;CAChC;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,aAAa,CAAC,EAAE,MAAM,EAAE,QAAQ,EAAE,GAAG,SAAS,EAAE,EAAE,kBAAkB,GAAG,SAAS,CA6B/F"}
@@ -1,36 +0,0 @@
1
- import { type ReactNode } from 'react';
2
- import type { Editor } from '@domternal/core';
3
- interface EditorContextValue {
4
- editor: Editor | null;
5
- }
6
- export interface EditorProviderProps {
7
- /** The editor instance to provide to descendants. */
8
- editor: Editor | null;
9
- children: ReactNode;
10
- }
11
- /**
12
- * Provides an editor instance to all descendant components via React Context.
13
- *
14
- * Components like DomternalToolbar, DomternalBubbleMenu, DomternalFloatingMenu,
15
- * and DomternalEmojiPicker will automatically use this editor when no explicit
16
- * `editor` prop is passed.
17
- *
18
- * @example
19
- * ```tsx
20
- * const { editor } = useEditor({ extensions, content });
21
- *
22
- * <EditorProvider editor={editor}>
23
- * <DomternalToolbar />
24
- * <EditorContent editor={editor} />
25
- * <DomternalBubbleMenu contexts={{ text: ['bold', 'italic'] }} />
26
- * </EditorProvider>
27
- * ```
28
- */
29
- export declare function EditorProvider({ editor, children }: EditorProviderProps): ReactNode;
30
- /**
31
- * Access the editor instance from the nearest EditorProvider.
32
- * Returns `{ editor: null }` when used outside a provider, no throw.
33
- */
34
- export declare function useCurrentEditor(): EditorContextValue;
35
- export {};
36
- //# sourceMappingURL=EditorContext.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"EditorContext.d.ts","sourceRoot":"","sources":["../src/EditorContext.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAsC,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAC3E,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAE9C,UAAU,kBAAkB;IAC1B,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;CACvB;AAID,MAAM,WAAW,mBAAmB;IAClC,qDAAqD;IACrD,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,QAAQ,EAAE,SAAS,CAAC;CACrB;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,cAAc,CAAC,EAAE,MAAM,EAAE,QAAQ,EAAE,EAAE,mBAAmB,GAAG,SAAS,CAGnF;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,IAAI,kBAAkB,CAErD"}
@@ -1,22 +0,0 @@
1
- import { type ReactNode } from 'react';
2
- import type { Editor, BubbleMenuOptions } from '@domternal/core';
3
- export interface DomternalBubbleMenuProps {
4
- /** The editor instance. If omitted, uses EditorProvider context. */
5
- editor?: Editor;
6
- /** Custom visibility function. */
7
- shouldShow?: BubbleMenuOptions['shouldShow'];
8
- /** Position relative to selection. @default 'top' */
9
- placement?: 'top' | 'bottom';
10
- /** Pixel offset from selection. @default 8 */
11
- offset?: number;
12
- /** Debounce delay in ms. @default 0 */
13
- updateDelay?: number;
14
- /** Fixed item names, e.g. ['bold', 'italic', 'code']. */
15
- items?: string[];
16
- /** Context-aware: map context names to item arrays, true for all, or null to disable. */
17
- contexts?: Record<string, string[] | true | null>;
18
- /** Additional content rendered after buttons. */
19
- children?: React.ReactNode;
20
- }
21
- export declare function DomternalBubbleMenu({ editor: editorProp, shouldShow, placement, offset, updateDelay, items, contexts, children, }: DomternalBubbleMenuProps): ReactNode;
22
- //# sourceMappingURL=DomternalBubbleMenu.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"DomternalBubbleMenu.d.ts","sourceRoot":"","sources":["../../src/bubble-menu/DomternalBubbleMenu.tsx"],"names":[],"mappings":"AAAA,OAAO,EAKL,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AACf,OAAO,KAAK,EAAE,MAAM,EAAE,iBAAiB,EAAkC,MAAM,iBAAiB,CAAC;AAKjG,MAAM,WAAW,wBAAwB;IACvC,oEAAoE;IACpE,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,kCAAkC;IAClC,UAAU,CAAC,EAAE,iBAAiB,CAAC,YAAY,CAAC,CAAC;IAC7C,qDAAqD;IACrD,SAAS,CAAC,EAAE,KAAK,GAAG,QAAQ,CAAC;IAC7B,8CAA8C;IAC9C,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,uCAAuC;IACvC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,yDAAyD;IACzD,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;IACjB,yFAAyF;IACzF,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,GAAG,IAAI,GAAG,IAAI,CAAC,CAAC;IAClD,iDAAiD;IACjD,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CAC5B;AAMD,wBAAgB,mBAAmB,CAAC,EAClC,MAAM,EAAE,UAAU,EAClB,UAAU,EACV,SAAS,EACT,MAAM,EACN,WAAW,EACX,KAAK,EACL,QAAQ,EACR,QAAQ,GACT,EAAE,wBAAwB,GAAG,SAAS,CAyItC"}
@@ -1,56 +0,0 @@
1
- import { type MouseEvent as ReactMouseEvent, type RefObject } from 'react';
2
- import type { Editor, ToolbarButton, ToolbarDropdown, BubbleMenuOptions } from '@domternal/core';
3
- interface BubbleMenuSeparator {
4
- type: 'separator';
5
- name: string;
6
- }
7
- export type BubbleMenuItem = ToolbarButton | ToolbarDropdown | BubbleMenuSeparator;
8
- /**
9
- * Live state for the bubble-menu trailing buttons. Mirrors Angular's
10
- * `syncTrailingButtonsState` output. Computed per editor transaction and
11
- * coalesced into a single object so each transaction triggers at most one
12
- * re-render.
13
- */
14
- export interface BubbleMenuTrailingState {
15
- /** True when current selection is a NodeSelection (image, HR, ...). Trailing buttons hide in that case. */
16
- isNodeSelection: boolean;
17
- /** True when the `notionColorPicker` extension is loaded on this editor (cached once per editor). */
18
- showColorPickerButton: boolean;
19
- /** True when the `blockContextMenu` extension is loaded on this editor (cached once per editor). */
20
- showBlockMenuButton: boolean;
21
- /** True when the selection spans more than one top-level block (multi-block "..." disable). */
22
- blockMenuButtonDisabled: boolean;
23
- /** CSS color value for the "A" trigger glyph (e.g. `var(--dm-block-text-yellow)`), or null. */
24
- currentTextColorVar: string | null;
25
- /** CSS color value for the "A" trigger underline, or null. */
26
- currentBgColorVar: string | null;
27
- /** True when any token-based text or background color is applied at the cursor. */
28
- hasAnyColor: boolean;
29
- }
30
- export interface UseBubbleMenuOptions {
31
- editor: Editor | null;
32
- shouldShow?: BubbleMenuOptions['shouldShow'] | undefined;
33
- placement?: 'top' | 'bottom' | undefined;
34
- offset?: number | undefined;
35
- updateDelay?: number | undefined;
36
- items?: string[] | undefined;
37
- contexts?: Record<string, string[] | true | null> | undefined;
38
- }
39
- export interface UseBubbleMenuResult {
40
- menuRef: RefObject<HTMLDivElement | null>;
41
- resolvedItems: BubbleMenuItem[];
42
- isItemActive: (item: ToolbarButton) => boolean;
43
- isItemDisabled: (item: ToolbarButton) => boolean;
44
- executeCommand: (item: ToolbarButton, event?: ReactMouseEvent | MouseEvent) => void;
45
- activeVersion: number;
46
- getCachedIcon: (name: string) => string;
47
- /** Live trailing-button state (color preview, node-selection gate, multi-block disable). */
48
- trailing: BubbleMenuTrailingState;
49
- /** Open the Notion color picker by emitting `notionColorOpen` with the trigger as anchor. */
50
- openColorPicker: (anchor: HTMLElement) => void;
51
- /** Open the block context menu by dispatching `dm:block-context-menu-open` on `.dm-editor`. */
52
- openBlockContextMenu: (anchor: HTMLElement) => void;
53
- }
54
- export declare function useBubbleMenu(options: UseBubbleMenuOptions): UseBubbleMenuResult;
55
- export {};
56
- //# sourceMappingURL=useBubbleMenu.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"useBubbleMenu.d.ts","sourceRoot":"","sources":["../../src/bubble-menu/useBubbleMenu.ts"],"names":[],"mappings":"AAAA,OAAO,EAA+B,KAAK,UAAU,IAAI,eAAe,EAAE,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAQxG,OAAO,KAAK,EAAE,MAAM,EAAE,aAAa,EAAE,eAAe,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AAsBjG,UAAU,mBAAmB;IAAG,IAAI,EAAE,WAAW,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE;AACjE,MAAM,MAAM,cAAc,GAAG,aAAa,GAAG,eAAe,GAAG,mBAAmB,CAAC;AAEnF;;;;;GAKG;AACH,MAAM,WAAW,uBAAuB;IACtC,2GAA2G;IAC3G,eAAe,EAAE,OAAO,CAAC;IACzB,qGAAqG;IACrG,qBAAqB,EAAE,OAAO,CAAC;IAC/B,oGAAoG;IACpG,mBAAmB,EAAE,OAAO,CAAC;IAC7B,+FAA+F;IAC/F,uBAAuB,EAAE,OAAO,CAAC;IACjC,+FAA+F;IAC/F,mBAAmB,EAAE,MAAM,GAAG,IAAI,CAAC;IACnC,8DAA8D;IAC9D,iBAAiB,EAAE,MAAM,GAAG,IAAI,CAAC;IACjC,mFAAmF;IACnF,WAAW,EAAE,OAAO,CAAC;CACtB;AA8BD,MAAM,WAAW,oBAAoB;IACnC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,UAAU,CAAC,EAAE,iBAAiB,CAAC,YAAY,CAAC,GAAG,SAAS,CAAC;IACzD,SAAS,CAAC,EAAE,KAAK,GAAG,QAAQ,GAAG,SAAS,CAAC;IACzC,MAAM,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC5B,WAAW,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACjC,KAAK,CAAC,EAAE,MAAM,EAAE,GAAG,SAAS,CAAC;IAC7B,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,GAAG,IAAI,GAAG,IAAI,CAAC,GAAG,SAAS,CAAC;CAC/D;AAED,MAAM,WAAW,mBAAmB;IAClC,OAAO,EAAE,SAAS,CAAC,cAAc,GAAG,IAAI,CAAC,CAAC;IAC1C,aAAa,EAAE,cAAc,EAAE,CAAC;IAChC,YAAY,EAAE,CAAC,IAAI,EAAE,aAAa,KAAK,OAAO,CAAC;IAC/C,cAAc,EAAE,CAAC,IAAI,EAAE,aAAa,KAAK,OAAO,CAAC;IACjD,cAAc,EAAE,CAAC,IAAI,EAAE,aAAa,EAAE,KAAK,CAAC,EAAE,eAAe,GAAG,UAAU,KAAK,IAAI,CAAC;IACpF,aAAa,EAAE,MAAM,CAAC;IACtB,aAAa,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,MAAM,CAAC;IACxC,4FAA4F;IAC5F,QAAQ,EAAE,uBAAuB,CAAC;IAClC,6FAA6F;IAC7F,eAAe,EAAE,CAAC,MAAM,EAAE,WAAW,KAAK,IAAI,CAAC;IAC/C,+FAA+F;IAC/F,oBAAoB,EAAE,CAAC,MAAM,EAAE,WAAW,KAAK,IAAI,CAAC;CACrD;AAED,wBAAgB,aAAa,CAAC,OAAO,EAAE,oBAAoB,GAAG,mBAAmB,CAgahF"}
@@ -1,11 +0,0 @@
1
- import { type ReactNode } from 'react';
2
- import type { Editor } from '@domternal/core';
3
- import { type EmojiPickerItem } from './useEmojiPicker.js';
4
- export interface DomternalEmojiPickerProps {
5
- /** The editor instance. If omitted, uses EditorProvider context. */
6
- editor?: Editor;
7
- /** Array of emoji items with emoji, name, and group. */
8
- emojis: EmojiPickerItem[];
9
- }
10
- export declare function DomternalEmojiPicker({ editor: editorProp, emojis }: DomternalEmojiPickerProps): ReactNode;
11
- //# sourceMappingURL=DomternalEmojiPicker.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"DomternalEmojiPicker.d.ts","sourceRoot":"","sources":["../../src/emoji-picker/DomternalEmojiPicker.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAyB,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAC9D,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAE9C,OAAO,EAAkB,KAAK,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAsB3E,MAAM,WAAW,yBAAyB;IACxC,oEAAoE;IACpE,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,wDAAwD;IACxD,MAAM,EAAE,eAAe,EAAE,CAAC;CAC3B;AAED,wBAAgB,oBAAoB,CAAC,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,EAAE,yBAAyB,GAAG,SAAS,CAuJzG"}
@@ -1,24 +0,0 @@
1
- import { type RefObject } from 'react';
2
- import type { Editor } from '@domternal/core';
3
- export interface EmojiPickerItem {
4
- emoji: string;
5
- name: string;
6
- group: string;
7
- }
8
- export interface UseEmojiPickerResult {
9
- isOpen: boolean;
10
- searchQuery: string;
11
- activeCategory: string;
12
- categories: Map<string, EmojiPickerItem[]>;
13
- categoryNames: string[];
14
- filteredEmojis: EmojiPickerItem[];
15
- frequentlyUsed: EmojiPickerItem[];
16
- pickerRef: RefObject<HTMLDivElement | null>;
17
- selectEmoji: (item: EmojiPickerItem) => void;
18
- onSearch: (event: React.ChangeEvent<HTMLInputElement>) => void;
19
- scrollToCategory: (cat: string) => void;
20
- onGridScroll: () => void;
21
- close: () => void;
22
- }
23
- export declare function useEmojiPicker(editor: Editor | null, emojis: EmojiPickerItem[]): UseEmojiPickerResult;
24
- //# sourceMappingURL=useEmojiPicker.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"useEmojiPicker.d.ts","sourceRoot":"","sources":["../../src/emoji-picker/useEmojiPicker.ts"],"names":[],"mappings":"AAAA,OAAO,EAAqD,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAE1F,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAE9C,MAAM,WAAW,eAAe;IAC9B,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,oBAAoB;IACnC,MAAM,EAAE,OAAO,CAAC;IAChB,WAAW,EAAE,MAAM,CAAC;IACpB,cAAc,EAAE,MAAM,CAAC;IACvB,UAAU,EAAE,GAAG,CAAC,MAAM,EAAE,eAAe,EAAE,CAAC,CAAC;IAC3C,aAAa,EAAE,MAAM,EAAE,CAAC;IACxB,cAAc,EAAE,eAAe,EAAE,CAAC;IAClC,cAAc,EAAE,eAAe,EAAE,CAAC;IAClC,SAAS,EAAE,SAAS,CAAC,cAAc,GAAG,IAAI,CAAC,CAAC;IAC5C,WAAW,EAAE,CAAC,IAAI,EAAE,eAAe,KAAK,IAAI,CAAC;IAC7C,QAAQ,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC,WAAW,CAAC,gBAAgB,CAAC,KAAK,IAAI,CAAC;IAC/D,gBAAgB,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC;IACxC,YAAY,EAAE,MAAM,IAAI,CAAC;IACzB,KAAK,EAAE,MAAM,IAAI,CAAC;CACnB;AAED,wBAAgB,cAAc,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,EAAE,MAAM,EAAE,eAAe,EAAE,GAAG,oBAAoB,CAyNrG"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AAC/D,YAAY,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AACvD,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,YAAY,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACtE,YAAY,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AAG9D,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,YAAY,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAGrD,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,YAAY,EAAE,oBAAoB,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AACrF,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,YAAY,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAC7D,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AACjE,YAAY,EAAE,qBAAqB,EAAE,MAAM,+BAA+B,CAAC;AAC3E,OAAO,EAAE,mBAAmB,EAAE,MAAM,sCAAsC,CAAC;AAC3E,YAAY,EAAE,wBAAwB,EAAE,MAAM,sCAAsC,CAAC;AACrF,OAAO,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AACnE,YAAY,EAAE,0BAA0B,EAAE,MAAM,4BAA4B,CAAC;AAC7E,OAAO,EAAE,oBAAoB,EAAE,MAAM,wCAAwC,CAAC;AAC9E,YAAY,EAAE,yBAAyB,EAAE,MAAM,wCAAwC,CAAC;AACxF,YAAY,EAAE,eAAe,EAAE,MAAM,kCAAkC,CAAC;AACxE,OAAO,EAAE,0BAA0B,EAAE,oBAAoB,EAAE,MAAM,gCAAgC,CAAC;AAClG,YAAY,EACV,+BAA+B,EAC/B,2BAA2B,EAC3B,0BAA0B,GAC3B,MAAM,gCAAgC,CAAC;AAGxC,OAAO,EAAE,qBAAqB,EAAE,MAAM,uCAAuC,CAAC;AAC9E,YAAY,EAAE,kBAAkB,EAAE,4BAA4B,EAAE,MAAM,uCAAuC,CAAC;AAC9G,OAAO,EAAE,eAAe,EAAE,MAAM,iCAAiC,CAAC;AAClE,YAAY,EAAE,oBAAoB,EAAE,MAAM,iCAAiC,CAAC;AAC5E,OAAO,EAAE,eAAe,EAAE,MAAM,iCAAiC,CAAC;AAClE,YAAY,EAAE,oBAAoB,EAAE,MAAM,iCAAiC,CAAC;AAC5E,OAAO,EAAE,gBAAgB,EAAE,MAAM,sCAAsC,CAAC;AAGxE,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AACzC,YAAY,EAAE,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAGzF,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC3E,YAAY,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC"}
@@ -1,11 +0,0 @@
1
- import type { ElementType, HTMLAttributes, ReactNode } from 'react';
2
- export interface NodeViewContentProps extends HTMLAttributes<HTMLElement> {
3
- /** The HTML element type to render. @default 'div' */
4
- as?: ElementType;
5
- }
6
- /**
7
- * Placeholder for editable nested content within a custom React node view.
8
- * ProseMirror manages the content DOM inside this element.
9
- */
10
- export declare function NodeViewContent({ as: Tag, style, ...props }: NodeViewContentProps): ReactNode;
11
- //# sourceMappingURL=NodeViewContent.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"NodeViewContent.d.ts","sourceRoot":"","sources":["../../src/node-views/NodeViewContent.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAGpE,MAAM,WAAW,oBAAqB,SAAQ,cAAc,CAAC,WAAW,CAAC;IACvE,sDAAsD;IACtD,EAAE,CAAC,EAAE,WAAW,CAAC;CAClB;AAED;;;GAGG;AACH,wBAAgB,eAAe,CAAC,EAAE,EAAE,EAAE,GAAW,EAAE,KAAK,EAAE,GAAG,KAAK,EAAE,EAAE,oBAAoB,GAAG,SAAS,CAWrG"}
@@ -1,11 +0,0 @@
1
- import type { ElementType, HTMLAttributes, ReactNode } from 'react';
2
- export interface NodeViewWrapperProps extends HTMLAttributes<HTMLElement> {
3
- /** The HTML element type to render. @default 'div' */
4
- as?: ElementType;
5
- }
6
- /**
7
- * Container component for custom React node views.
8
- * Handles drag events and marks the element as a node view wrapper.
9
- */
10
- export declare function NodeViewWrapper({ as: Tag, style, ...props }: NodeViewWrapperProps): ReactNode;
11
- //# sourceMappingURL=NodeViewWrapper.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"NodeViewWrapper.d.ts","sourceRoot":"","sources":["../../src/node-views/NodeViewWrapper.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAGpE,MAAM,WAAW,oBAAqB,SAAQ,cAAc,CAAC,WAAW,CAAC;IACvE,sDAAsD;IACtD,EAAE,CAAC,EAAE,WAAW,CAAC;CAClB;AAED;;;GAGG;AACH,wBAAgB,eAAe,CAAC,EAAE,EAAE,EAAE,GAAW,EAAE,KAAK,EAAE,GAAG,KAAK,EAAE,EAAE,oBAAoB,GAAG,SAAS,CAWrG"}
@@ -1,12 +0,0 @@
1
- import { type RefCallback } from 'react';
2
- export interface ReactNodeViewContextValue {
3
- onDragStart: (event: DragEvent) => void;
4
- nodeViewContentRef: RefCallback<HTMLElement>;
5
- }
6
- export declare const ReactNodeViewProvider: import("react").Provider<ReactNodeViewContextValue | null>;
7
- /**
8
- * Access node view internals from within a custom React node view component.
9
- * Used by NodeViewWrapper and NodeViewContent.
10
- */
11
- export declare function useReactNodeView(): ReactNodeViewContextValue;
12
- //# sourceMappingURL=ReactNodeViewContext.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ReactNodeViewContext.d.ts","sourceRoot":"","sources":["../../src/node-views/ReactNodeViewContext.tsx"],"names":[],"mappings":"AAAA,OAAO,EAA6B,KAAK,WAAW,EAAE,MAAM,OAAO,CAAC;AAEpE,MAAM,WAAW,yBAAyB;IACxC,WAAW,EAAE,CAAC,KAAK,EAAE,SAAS,KAAK,IAAI,CAAC;IACxC,kBAAkB,EAAE,WAAW,CAAC,WAAW,CAAC,CAAC;CAC9C;AAID,eAAO,MAAM,qBAAqB,4DAAgC,CAAC;AAEnE;;;GAGG;AACH,wBAAgB,gBAAgB,IAAI,yBAAyB,CAM5D"}
@@ -1,101 +0,0 @@
1
- import type { Editor } from '@domternal/core';
2
- /** ProseMirror node shape passed to node views. */
3
- interface PMNode {
4
- type: {
5
- name: string;
6
- spec: {
7
- group?: string;
8
- };
9
- };
10
- attrs: Record<string, unknown>;
11
- textContent: string;
12
- nodeSize: number;
13
- }
14
- /**
15
- * Props passed to custom React node view components.
16
- */
17
- export interface ReactNodeViewProps {
18
- /** The editor instance. */
19
- editor: Editor;
20
- /** The ProseMirror node being rendered. */
21
- node: PMNode;
22
- /** Whether this node is selected via NodeSelection. */
23
- selected: boolean;
24
- /** Get the document position of this node. */
25
- getPos: () => number;
26
- /** Update the node's attributes. */
27
- updateAttributes: (attrs: Record<string, unknown>) => void;
28
- /** Delete this node from the document. */
29
- deleteNode: () => void;
30
- /** The extension that created this node view (name, options). Injected by core. */
31
- extension: {
32
- name: string;
33
- options: Record<string, unknown>;
34
- };
35
- /** ProseMirror decorations applied to this node. */
36
- decorations: unknown[];
37
- }
38
- export interface ReactNodeViewRendererOptions {
39
- /** Wrapper element tag. @default 'div' for block, 'span' for inline */
40
- as?: string;
41
- /** Additional CSS class on the wrapper element. */
42
- className?: string;
43
- /** Tag for the content DOM element. Set to null for no editable content. @default 'div' */
44
- contentDOMElement?: string | null;
45
- }
46
- /**
47
- * Converts a React component into a ProseMirror NodeView constructor.
48
- *
49
- * Returns a function matching ProseMirror's native `(node, view, getPos, decorations)` signature.
50
- * The editor and extension context are automatically injected by core via `__domternalContext`.
51
- *
52
- * @example
53
- * ```ts
54
- * const ImageExtension = Image.extend({
55
- * addNodeView() {
56
- * return ReactNodeViewRenderer(ImageComponent);
57
- * }
58
- * });
59
- * ```
60
- *
61
- * @example Accessing extension options in the component
62
- * ```tsx
63
- * function ImageComponent({ node, extension, decorations }: ReactNodeViewProps) {
64
- * const maxWidth = extension.options.maxWidth as number;
65
- * return <NodeViewWrapper><img src={node.attrs.src} style={{ maxWidth }} /></NodeViewWrapper>;
66
- * }
67
- * ```
68
- */
69
- export declare function ReactNodeViewRenderer(component: React.ComponentType<ReactNodeViewProps>, options?: ReactNodeViewRendererOptions): (node: PMNode, view: unknown, getPos: () => number, decorations: unknown[]) => ReactNodeView;
70
- interface ReactNodeViewInit {
71
- editor: Editor;
72
- node: PMNode;
73
- getPos: () => number;
74
- decorations: unknown[];
75
- extension: {
76
- name: string;
77
- options: Record<string, unknown>;
78
- };
79
- }
80
- declare class ReactNodeView {
81
- dom: HTMLElement;
82
- contentDOM: HTMLElement | null;
83
- private root;
84
- private component;
85
- private editor;
86
- private node;
87
- private getPos;
88
- private decorations;
89
- private extension;
90
- private selected;
91
- constructor(component: React.ComponentType<ReactNodeViewProps>, init: ReactNodeViewInit, options: ReactNodeViewRendererOptions);
92
- private render;
93
- update(node: PMNode, decorations: unknown[]): boolean;
94
- selectNode(): void;
95
- deselectNode(): void;
96
- destroy(): void;
97
- ignoreMutation(mutation: MutationRecord): boolean;
98
- stopEvent(): boolean;
99
- }
100
- export {};
101
- //# sourceMappingURL=ReactNodeViewRenderer.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ReactNodeViewRenderer.d.ts","sourceRoot":"","sources":["../../src/node-views/ReactNodeViewRenderer.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,MAAM,EAAmB,MAAM,iBAAiB,CAAC;AAE/D,mDAAmD;AACnD,UAAU,MAAM;IACd,IAAI,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE;YAAE,KAAK,CAAC,EAAE,MAAM,CAAA;SAAE,CAAA;KAAE,CAAC;IACjD,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC/B,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC,2BAA2B;IAC3B,MAAM,EAAE,MAAM,CAAC;IACf,2CAA2C;IAC3C,IAAI,EAAE,MAAM,CAAC;IACb,uDAAuD;IACvD,QAAQ,EAAE,OAAO,CAAC;IAClB,8CAA8C;IAC9C,MAAM,EAAE,MAAM,MAAM,CAAC;IACrB,oCAAoC;IACpC,gBAAgB,EAAE,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,IAAI,CAAC;IAC3D,0CAA0C;IAC1C,UAAU,EAAE,MAAM,IAAI,CAAC;IACvB,mFAAmF;IACnF,SAAS,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;KAAE,CAAC;IAC9D,oDAAoD;IACpD,WAAW,EAAE,OAAO,EAAE,CAAC;CACxB;AAED,MAAM,WAAW,4BAA4B;IAC3C,uEAAuE;IACvE,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,mDAAmD;IACnD,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,2FAA2F;IAC3F,iBAAiB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CACnC;AAED;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAgB,qBAAqB,CACnC,SAAS,EAAE,KAAK,CAAC,aAAa,CAAC,kBAAkB,CAAC,EAClD,OAAO,GAAE,4BAAiC,GACzC,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,MAAM,EAAE,WAAW,EAAE,OAAO,EAAE,KAAK,aAAa,CAkB9F;AAED,UAAU,iBAAiB;IACzB,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,MAAM,CAAC;IACrB,WAAW,EAAE,OAAO,EAAE,CAAC;IACvB,SAAS,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;KAAE,CAAC;CAC/D;AAED,cAAM,aAAa;IACjB,GAAG,EAAE,WAAW,CAAC;IACjB,UAAU,EAAE,WAAW,GAAG,IAAI,CAAQ;IACtC,OAAO,CAAC,IAAI,CAAO;IACnB,OAAO,CAAC,SAAS,CAA0C;IAC3D,OAAO,CAAC,MAAM,CAAS;IACvB,OAAO,CAAC,IAAI,CAAS;IACrB,OAAO,CAAC,MAAM,CAAe;IAC7B,OAAO,CAAC,WAAW,CAAY;IAC/B,OAAO,CAAC,SAAS,CAAqD;IACtE,OAAO,CAAC,QAAQ,CAAS;gBAGvB,SAAS,EAAE,KAAK,CAAC,aAAa,CAAC,kBAAkB,CAAC,EAClD,IAAI,EAAE,iBAAiB,EACvB,OAAO,EAAE,4BAA4B;IA8BvC,OAAO,CAAC,MAAM;IA0Cd,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,WAAW,EAAE,OAAO,EAAE,GAAG,OAAO;IAQrD,UAAU,IAAI,IAAI;IAKlB,YAAY,IAAI,IAAI;IAKpB,OAAO,IAAI,IAAI;IAMf,cAAc,CAAC,QAAQ,EAAE,cAAc,GAAG,OAAO;IAKjD,SAAS,IAAI,OAAO;CAGrB"}
@@ -1,25 +0,0 @@
1
- /**
2
- * DomternalNotionColorPicker
3
- *
4
- * Notion-style inline color picker rendered via `createPortal` into the
5
- * `.dm-editor` host. The portal target keeps the panel inside the editor's
6
- * CSS-variable scope (theme tokens cascade) without imperative DOM moves.
7
- *
8
- * Opens in response to the `notionColorOpen` event emitted by the bubble
9
- * menu's "A" trigger. Two sections: text color (top), background color
10
- * (bottom). Each section is a default-swatch plus the named-token palette.
11
- *
12
- * The default UI is rendered when no `children` prop is provided. Pass
13
- * `children` to take over rendering while keeping the hook's lifecycle.
14
- */
15
- import { type ReactNode } from 'react';
16
- import type { Editor } from '@domternal/core';
17
- import { type UseNotionColorPickerResult } from './useNotionColorPicker.js';
18
- export interface DomternalNotionColorPickerProps {
19
- /** The editor instance. If omitted, uses EditorProvider context. */
20
- editor?: Editor;
21
- /** Custom panel content. When provided, replaces the default swatch grid. */
22
- children?: ReactNode | ((api: UseNotionColorPickerResult) => ReactNode);
23
- }
24
- export declare function DomternalNotionColorPicker({ editor: editorProp, children, }: DomternalNotionColorPickerProps): ReactNode;
25
- //# sourceMappingURL=DomternalNotionColorPicker.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"DomternalNotionColorPicker.d.ts","sourceRoot":"","sources":["../../src/notion-color-picker/DomternalNotionColorPicker.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AACH,OAAO,EAEL,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AAEf,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAG9C,OAAO,EAAwB,KAAK,0BAA0B,EAAE,MAAM,2BAA2B,CAAC;AAElG,MAAM,WAAW,+BAA+B;IAC9C,oEAAoE;IACpE,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,6EAA6E;IAC7E,QAAQ,CAAC,EAAE,SAAS,GAAG,CAAC,CAAC,GAAG,EAAE,0BAA0B,KAAK,SAAS,CAAC,CAAC;CACzE;AAED,wBAAgB,0BAA0B,CAAC,EACzC,MAAM,EAAE,UAAU,EAClB,QAAQ,GACT,EAAE,+BAA+B,GAAG,SAAS,CAkI7C"}
@@ -1,5 +0,0 @@
1
- export { DomternalNotionColorPicker } from './DomternalNotionColorPicker.js';
2
- export type { DomternalNotionColorPickerProps } from './DomternalNotionColorPicker.js';
3
- export { useNotionColorPicker } from './useNotionColorPicker.js';
4
- export type { UseNotionColorPickerOptions, UseNotionColorPickerResult } from './useNotionColorPicker.js';
5
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/notion-color-picker/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,0BAA0B,EAAE,MAAM,iCAAiC,CAAC;AAC7E,YAAY,EAAE,+BAA+B,EAAE,MAAM,iCAAiC,CAAC;AACvF,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AACjE,YAAY,EAAE,2BAA2B,EAAE,0BAA0B,EAAE,MAAM,2BAA2B,CAAC"}
@@ -1,47 +0,0 @@
1
- /**
2
- * useNotionColorPicker
3
- *
4
- * State and effect plumbing for the Notion-style inline color picker. Listens
5
- * for the `notionColorOpen` event emitted by the bubble menu's "A" trigger,
6
- * tracks the active text/background tokens, and exposes the imperative
7
- * commands consumers need (`applyText`, `applyBg`, `close`).
8
- *
9
- * The default component (`DomternalNotionColorPicker`) consumes this hook and
10
- * renders the panel via `createPortal`. Consumers building custom UIs can
11
- * call this hook directly.
12
- */
13
- import { type KeyboardEvent as ReactKeyboardEvent, type RefObject } from 'react';
14
- import type { Editor } from '@domternal/core';
15
- export interface UseNotionColorPickerOptions {
16
- editor: Editor | null;
17
- }
18
- export interface UseNotionColorPickerResult {
19
- /** Whether the picker panel is currently open. */
20
- isOpen: boolean;
21
- /** Editor host element (`.dm-editor`) used as the portal target. Null until the editor is ready. */
22
- hostEl: HTMLElement | null;
23
- /** Anchor element the picker positions against (the bubble-menu "A" trigger button). */
24
- anchorEl: HTMLElement | null;
25
- /** Ref to the panel root, used by the picker UI for positioning + focus management. */
26
- panelRef: RefObject<HTMLDivElement | null>;
27
- /** Currently applied text token at the cursor, or null when default. */
28
- currentTextToken: string | null;
29
- /** Currently applied background token at the cursor, or null when default. */
30
- currentBgToken: string | null;
31
- /** Named-token palette (read from the NotionColorPicker extension options). */
32
- palette: readonly string[];
33
- /** Apply a text color token to the current selection. Picker stays open. */
34
- applyText: (token: string | null) => void;
35
- /** Apply a background color token to the current selection. Picker stays open. */
36
- applyBg: (token: string | null) => void;
37
- /** Close the picker. When `refocus` is true, returns focus to the anchor button. */
38
- close: (opts?: {
39
- refocus?: boolean;
40
- }) => void;
41
- /** Display label for a palette token (defaults to title-case fallback). */
42
- tokenLabel: (token: string) => string;
43
- /** Arrow / Home / End keyboard navigation across the 5-column swatch grid. */
44
- onPanelKeydown: (event: ReactKeyboardEvent<HTMLDivElement>) => void;
45
- }
46
- export declare function useNotionColorPicker(options: UseNotionColorPickerOptions): UseNotionColorPickerResult;
47
- //# sourceMappingURL=useNotionColorPicker.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"useNotionColorPicker.d.ts","sourceRoot":"","sources":["../../src/notion-color-picker/useNotionColorPicker.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,OAAO,EAKL,KAAK,aAAa,IAAI,kBAAkB,EACxC,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AACf,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AA8B9C,MAAM,WAAW,2BAA2B;IAC1C,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;CACvB;AAED,MAAM,WAAW,0BAA0B;IACzC,kDAAkD;IAClD,MAAM,EAAE,OAAO,CAAC;IAChB,oGAAoG;IACpG,MAAM,EAAE,WAAW,GAAG,IAAI,CAAC;IAC3B,wFAAwF;IACxF,QAAQ,EAAE,WAAW,GAAG,IAAI,CAAC;IAC7B,uFAAuF;IACvF,QAAQ,EAAE,SAAS,CAAC,cAAc,GAAG,IAAI,CAAC,CAAC;IAC3C,wEAAwE;IACxE,gBAAgB,EAAE,MAAM,GAAG,IAAI,CAAC;IAChC,8EAA8E;IAC9E,cAAc,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9B,+EAA+E;IAC/E,OAAO,EAAE,SAAS,MAAM,EAAE,CAAC;IAC3B,4EAA4E;IAC5E,SAAS,EAAE,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,KAAK,IAAI,CAAC;IAC1C,kFAAkF;IAClF,OAAO,EAAE,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,KAAK,IAAI,CAAC;IACxC,oFAAoF;IACpF,KAAK,EAAE,CAAC,IAAI,CAAC,EAAE;QAAE,OAAO,CAAC,EAAE,OAAO,CAAA;KAAE,KAAK,IAAI,CAAC;IAC9C,2EAA2E;IAC3E,UAAU,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM,CAAC;IACtC,8EAA8E;IAC9E,cAAc,EAAE,CAAC,KAAK,EAAE,kBAAkB,CAAC,cAAc,CAAC,KAAK,IAAI,CAAC;CACrE;AAED,wBAAgB,oBAAoB,CAClC,OAAO,EAAE,2BAA2B,GACnC,0BAA0B,CAsP5B"}
@@ -1,12 +0,0 @@
1
- import { type ReactNode } from 'react';
2
- import type { Editor, IconSet, ToolbarLayoutEntry } from '@domternal/core';
3
- export interface DomternalToolbarProps {
4
- /** The editor instance. If omitted, uses EditorProvider context. */
5
- editor?: Editor;
6
- /** Custom icon set. When provided, only these icons are used (no defaultIcons fallback). */
7
- icons?: IconSet;
8
- /** Custom toolbar layout. */
9
- layout?: ToolbarLayoutEntry[];
10
- }
11
- export declare function DomternalToolbar({ editor: editorProp, icons, layout }: DomternalToolbarProps): ReactNode;
12
- //# sourceMappingURL=DomternalToolbar.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"DomternalToolbar.d.ts","sourceRoot":"","sources":["../../src/toolbar/DomternalToolbar.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAyB,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAC9D,OAAO,KAAK,EACV,MAAM,EACN,OAAO,EAGP,kBAAkB,EACnB,MAAM,iBAAiB,CAAC;AAUzB,MAAM,WAAW,qBAAqB;IACpC,oEAAoE;IACpE,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,4FAA4F;IAC5F,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,6BAA6B;IAC7B,MAAM,CAAC,EAAE,kBAAkB,EAAE,CAAC;CAC/B;AAED,wBAAgB,gBAAgB,CAAC,EAAE,MAAM,EAAE,UAAU,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE,qBAAqB,GAAG,SAAS,CAiKxG"}
@@ -1,15 +0,0 @@
1
- import type { ReactNode } from 'react';
2
- import type { ToolbarButton as ToolbarButtonType } from '@domternal/core';
3
- export interface ToolbarButtonProps {
4
- item: ToolbarButtonType;
5
- isActive: boolean;
6
- isDisabled: boolean;
7
- tabIndex: number;
8
- tooltip: string;
9
- iconHtml: string;
10
- ariaExpanded?: string | null;
11
- onClick: (item: ToolbarButtonType, event: React.MouseEvent) => void;
12
- onFocus: (name: string) => void;
13
- }
14
- export declare function ToolbarButton({ item, isActive, isDisabled, tabIndex, tooltip, iconHtml, ariaExpanded, onClick, onFocus, }: ToolbarButtonProps): ReactNode;
15
- //# sourceMappingURL=ToolbarButton.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ToolbarButton.d.ts","sourceRoot":"","sources":["../../src/toolbar/ToolbarButton.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,KAAK,EAAE,aAAa,IAAI,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AAE1E,MAAM,WAAW,kBAAkB;IACjC,IAAI,EAAE,iBAAiB,CAAC;IACxB,QAAQ,EAAE,OAAO,CAAC;IAClB,UAAU,EAAE,OAAO,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;IACjB,YAAY,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,OAAO,EAAE,CAAC,IAAI,EAAE,iBAAiB,EAAE,KAAK,EAAE,KAAK,CAAC,UAAU,KAAK,IAAI,CAAC;IACpE,OAAO,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;CACjC;AAED,wBAAgB,aAAa,CAAC,EAC5B,IAAI,EACJ,QAAQ,EACR,UAAU,EACV,QAAQ,EACR,OAAO,EACP,QAAQ,EACR,YAAY,EACZ,OAAO,EACP,OAAO,GACR,EAAE,kBAAkB,GAAG,SAAS,CAiBhC"}
@@ -1,17 +0,0 @@
1
- import type { ReactNode } from 'react';
2
- import type { ToolbarButton, ToolbarDropdown as ToolbarDropdownType } from '@domternal/core';
3
- export interface ToolbarDropdownProps {
4
- dropdown: ToolbarDropdownType;
5
- isOpen: boolean;
6
- isActive: (name: string) => boolean;
7
- isDropdownActive: boolean;
8
- isDisabled: boolean;
9
- tabIndex: number;
10
- triggerHtml: string;
11
- getCachedItemContent: (icon: string, label: string, mode?: 'icon-text' | 'text' | 'icon') => string;
12
- onToggle: (dropdown: ToolbarDropdownType) => void;
13
- onItemClick: (item: ToolbarButton, event: React.MouseEvent) => void;
14
- onFocus: (name: string) => void;
15
- }
16
- export declare function ToolbarDropdown({ dropdown, isOpen, isActive, isDropdownActive, isDisabled, tabIndex, triggerHtml, getCachedItemContent, onToggle, onItemClick, onFocus, }: ToolbarDropdownProps): ReactNode;
17
- //# sourceMappingURL=ToolbarDropdown.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ToolbarDropdown.d.ts","sourceRoot":"","sources":["../../src/toolbar/ToolbarDropdown.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,KAAK,EAAE,aAAa,EAAE,eAAe,IAAI,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AAG7F,MAAM,WAAW,oBAAoB;IACnC,QAAQ,EAAE,mBAAmB,CAAC;IAC9B,MAAM,EAAE,OAAO,CAAC;IAChB,QAAQ,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC;IACpC,gBAAgB,EAAE,OAAO,CAAC;IAC1B,UAAU,EAAE,OAAO,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,MAAM,CAAC;IACpB,oBAAoB,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,WAAW,GAAG,MAAM,GAAG,MAAM,KAAK,MAAM,CAAC;IACpG,QAAQ,EAAE,CAAC,QAAQ,EAAE,mBAAmB,KAAK,IAAI,CAAC;IAClD,WAAW,EAAE,CAAC,IAAI,EAAE,aAAa,EAAE,KAAK,EAAE,KAAK,CAAC,UAAU,KAAK,IAAI,CAAC;IACpE,OAAO,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;CACjC;AAED,wBAAgB,eAAe,CAAC,EAC9B,QAAQ,EACR,MAAM,EACN,QAAQ,EACR,gBAAgB,EAChB,UAAU,EACV,QAAQ,EACR,WAAW,EACX,oBAAoB,EACpB,QAAQ,EACR,WAAW,EACX,OAAO,GACR,EAAE,oBAAoB,GAAG,SAAS,CA4BlC"}
@@ -1,10 +0,0 @@
1
- import type { ReactNode } from 'react';
2
- import type { ToolbarButton, ToolbarDropdown } from '@domternal/core';
3
- export interface ToolbarDropdownPanelProps {
4
- dropdown: ToolbarDropdown;
5
- isActive: (name: string) => boolean;
6
- getCachedItemContent: (icon: string, label: string, mode?: 'icon-text' | 'text' | 'icon') => string;
7
- onItemClick: (item: ToolbarButton, event: React.MouseEvent) => void;
8
- }
9
- export declare function ToolbarDropdownPanel({ dropdown, isActive, getCachedItemContent, onItemClick, }: ToolbarDropdownPanelProps): ReactNode;
10
- //# sourceMappingURL=ToolbarDropdownPanel.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ToolbarDropdownPanel.d.ts","sourceRoot":"","sources":["../../src/toolbar/ToolbarDropdownPanel.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,KAAK,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAEtE,MAAM,WAAW,yBAAyB;IACxC,QAAQ,EAAE,eAAe,CAAC;IAC1B,QAAQ,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC;IACpC,oBAAoB,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,WAAW,GAAG,MAAM,GAAG,MAAM,KAAK,MAAM,CAAC;IACpG,WAAW,EAAE,CAAC,IAAI,EAAE,aAAa,EAAE,KAAK,EAAE,KAAK,CAAC,UAAU,KAAK,IAAI,CAAC;CACrE;AAED,wBAAgB,oBAAoB,CAAC,EACnC,QAAQ,EACR,QAAQ,EACR,oBAAoB,EACpB,WAAW,GACZ,EAAE,yBAAyB,GAAG,SAAS,CA8DvC"}
@@ -1,12 +0,0 @@
1
- import type { Editor } from '@domternal/core';
2
- /**
3
- * Read a CSS property value at the current cursor position.
4
- * Prefers inline style (explicit mark) over computed style (inherited).
5
- */
6
- export declare function getComputedStyleAtCursor(editor: Editor, prop: string): string | null;
7
- /**
8
- * Read only inline style at the current cursor position (no computed fallback).
9
- * Used for font-family to avoid reading browser default inheritance.
10
- */
11
- export declare function getInlineStyleAtCursor(editor: Editor, prop: string): string | null;
12
- //# sourceMappingURL=useComputedStyle.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"useComputedStyle.d.ts","sourceRoot":"","sources":["../../src/toolbar/useComputedStyle.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAE9C;;;GAGG;AACH,wBAAgB,wBAAwB,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAcpF;AAED;;;GAGG;AACH,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAYlF"}
@@ -1,6 +0,0 @@
1
- import type { ToolbarController } from '@domternal/core';
2
- export declare function useKeyboardNav(controllerRef: React.RefObject<ToolbarController | null>, toolbarRef: React.RefObject<HTMLDivElement | null>, closeDropdown: () => void): {
3
- onKeyDown: (event: React.KeyboardEvent) => void;
4
- focusCurrentButton: () => void;
5
- };
6
- //# sourceMappingURL=useKeyboardNav.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"useKeyboardNav.d.ts","sourceRoot":"","sources":["../../src/toolbar/useKeyboardNav.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AAEzD,wBAAgB,cAAc,CAC5B,aAAa,EAAE,KAAK,CAAC,SAAS,CAAC,iBAAiB,GAAG,IAAI,CAAC,EACxD,UAAU,EAAE,KAAK,CAAC,SAAS,CAAC,cAAc,GAAG,IAAI,CAAC,EAClD,aAAa,EAAE,MAAM,IAAI,GACxB;IACD,SAAS,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC,aAAa,KAAK,IAAI,CAAC;IAChD,kBAAkB,EAAE,MAAM,IAAI,CAAC;CAChC,CA6EA"}
@@ -1,21 +0,0 @@
1
- import { type RefObject } from 'react';
2
- import { ToolbarController } from '@domternal/core';
3
- import type { Editor, ToolbarButton, ToolbarDropdown, ToolbarGroup, ToolbarLayoutEntry } from '@domternal/core';
4
- export interface UseToolbarControllerResult {
5
- controller: RefObject<ToolbarController | null>;
6
- groups: ToolbarGroup[];
7
- focusedIndex: number;
8
- openDropdown: string | null;
9
- activeVersion: number;
10
- toolbarRef: RefObject<HTMLDivElement | null>;
11
- isActive: (name: string) => boolean;
12
- isDisabled: (name: string) => boolean;
13
- isDropdownActive: (dropdown: ToolbarDropdown) => boolean;
14
- getAriaExpanded: (item: ToolbarButton) => string | null;
15
- getFlatIndex: (name: string) => number;
16
- handleDropdownToggle: (dropdown: ToolbarDropdown) => void;
17
- closeDropdown: () => void;
18
- syncState: () => void;
19
- }
20
- export declare function useToolbarController(editor: Editor | null, layout?: ToolbarLayoutEntry[]): UseToolbarControllerResult;
21
- //# sourceMappingURL=useToolbarController.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"useToolbarController.d.ts","sourceRoot":"","sources":["../../src/toolbar/useToolbarController.ts"],"names":[],"mappings":"AAAA,OAAO,EAA4C,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AACjF,OAAO,EACL,iBAAiB,EAElB,MAAM,iBAAiB,CAAC;AACzB,OAAO,KAAK,EACV,MAAM,EACN,aAAa,EACb,eAAe,EAEf,YAAY,EACZ,kBAAkB,EACnB,MAAM,iBAAiB,CAAC;AAEzB,MAAM,WAAW,0BAA0B;IACzC,UAAU,EAAE,SAAS,CAAC,iBAAiB,GAAG,IAAI,CAAC,CAAC;IAChD,MAAM,EAAE,YAAY,EAAE,CAAC;IACvB,YAAY,EAAE,MAAM,CAAC;IACrB,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,aAAa,EAAE,MAAM,CAAC;IACtB,UAAU,EAAE,SAAS,CAAC,cAAc,GAAG,IAAI,CAAC,CAAC;IAC7C,QAAQ,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC;IACpC,UAAU,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC;IACtC,gBAAgB,EAAE,CAAC,QAAQ,EAAE,eAAe,KAAK,OAAO,CAAC;IACzD,eAAe,EAAE,CAAC,IAAI,EAAE,aAAa,KAAK,MAAM,GAAG,IAAI,CAAC;IACxD,YAAY,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,MAAM,CAAC;IACvC,oBAAoB,EAAE,CAAC,QAAQ,EAAE,eAAe,KAAK,IAAI,CAAC;IAC1D,aAAa,EAAE,MAAM,IAAI,CAAC;IAC1B,SAAS,EAAE,MAAM,IAAI,CAAC;CACvB;AAED,wBAAgB,oBAAoB,CAClC,MAAM,EAAE,MAAM,GAAG,IAAI,EACrB,MAAM,CAAC,EAAE,kBAAkB,EAAE,GAC5B,0BAA0B,CAsK5B"}
@@ -1,12 +0,0 @@
1
- import type { IconSet, ToolbarButton, ToolbarDropdown } from '@domternal/core';
2
- export declare const DROPDOWN_CARET = "<svg class=\"dm-dropdown-caret\" width=\"10\" height=\"10\" viewBox=\"0 0 10 10\"><path d=\"M2 4l3 3 3-3\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/></svg>";
3
- export interface UseToolbarIconsResult {
4
- resolveIconSvg: (name: string) => string;
5
- getCachedIcon: (name: string) => string;
6
- getCachedTriggerLabel: (label: string, isIcon?: boolean) => string;
7
- getCachedTriggerIcon: (iconName: string) => string;
8
- getCachedItemContent: (iconName: string, label: string, displayMode?: 'icon-text' | 'text' | 'icon') => string;
9
- getDropdownTriggerHtml: (dropdown: ToolbarDropdown, activeItem: ToolbarButton | undefined) => string;
10
- }
11
- export declare function useToolbarIcons(icons?: IconSet | null): UseToolbarIconsResult;
12
- //# sourceMappingURL=useToolbarIcons.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"useToolbarIcons.d.ts","sourceRoot":"","sources":["../../src/toolbar/useToolbarIcons.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,OAAO,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAE/E,eAAO,MAAM,cAAc,qOAAiN,CAAC;AAE7O,MAAM,WAAW,qBAAqB;IACpC,cAAc,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,MAAM,CAAC;IACzC,aAAa,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,MAAM,CAAC;IACxC,qBAAqB,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,OAAO,KAAK,MAAM,CAAC;IACnE,oBAAoB,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,MAAM,CAAC;IACnD,oBAAoB,EAAE,CAAC,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,WAAW,CAAC,EAAE,WAAW,GAAG,MAAM,GAAG,MAAM,KAAK,MAAM,CAAC;IAC/G,sBAAsB,EAAE,CAAC,QAAQ,EAAE,eAAe,EAAE,UAAU,EAAE,aAAa,GAAG,SAAS,KAAK,MAAM,CAAC;CACtG;AAED,wBAAgB,eAAe,CAAC,KAAK,CAAC,EAAE,OAAO,GAAG,IAAI,GAAG,qBAAqB,CA8G7E"}
@@ -1,5 +0,0 @@
1
- import type { ToolbarButton } from '@domternal/core';
2
- export declare function useTooltip(): {
3
- getTooltip: (item: ToolbarButton) => string;
4
- };
5
- //# sourceMappingURL=useTooltip.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"useTooltip.d.ts","sourceRoot":"","sources":["../../src/toolbar/useTooltip.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAIrD,wBAAgB,UAAU,IAAI;IAAE,UAAU,EAAE,CAAC,IAAI,EAAE,aAAa,KAAK,MAAM,CAAA;CAAE,CAiB5E"}
@@ -1,80 +0,0 @@
1
- import { type DependencyList } from 'react';
2
- import { Editor } from '@domternal/core';
3
- import type { Content, AnyExtension, FocusPosition } from '@domternal/core';
4
- export declare const DEFAULT_EXTENSIONS: AnyExtension[];
5
- export interface UseEditorOptions {
6
- /** Custom extensions to add to the editor. */
7
- extensions?: AnyExtension[];
8
- /** Initial editor content (HTML string or JSON). */
9
- content?: Content;
10
- /** Whether the editor is editable. @default true */
11
- editable?: boolean;
12
- /** Where to autofocus on mount. @default false */
13
- autofocus?: FocusPosition;
14
- /** Output format for content comparison. @default 'html' */
15
- outputFormat?: 'html' | 'json';
16
- /**
17
- * Set to false to delay editor creation to useEffect (SSR-safe).
18
- * When false, the editor will be null during server-side rendering
19
- * and created only after the component mounts in the browser.
20
- * @default true
21
- */
22
- immediatelyRender?: boolean;
23
- /** Called when the editor instance is created. */
24
- onCreate?: (editor: Editor) => void;
25
- /** Called when the document content changes. */
26
- onUpdate?: (props: {
27
- editor: Editor;
28
- }) => void;
29
- /** Called when the selection changes without content change. */
30
- onSelectionChange?: (props: {
31
- editor: Editor;
32
- }) => void;
33
- /** Called when the editor gains focus. */
34
- onFocus?: (props: {
35
- editor: Editor;
36
- event: FocusEvent;
37
- }) => void;
38
- /** Called when the editor loses focus. */
39
- onBlur?: (props: {
40
- editor: Editor;
41
- event: FocusEvent;
42
- }) => void;
43
- /** Called before the editor is destroyed. */
44
- onDestroy?: () => void;
45
- }
46
- /**
47
- * Core hook for creating and managing a Domternal editor instance.
48
- *
49
- * @param options - Editor configuration
50
- * @param deps - Optional dependency array. When any value changes, the editor
51
- * is destroyed and recreated (content is preserved). Useful for dynamic
52
- * configuration that requires a full editor rebuild.
53
- *
54
- * @example
55
- * ```tsx
56
- * const { editor, editorRef } = useEditor({ extensions, content });
57
- * return <div className="dm-editor"><div ref={editorRef} /></div>;
58
- * ```
59
- *
60
- * @example SSR-safe usage (Next.js)
61
- * ```tsx
62
- * const { editor, editorRef } = useEditor({
63
- * extensions,
64
- * content,
65
- * immediatelyRender: false,
66
- * });
67
- * ```
68
- *
69
- * @example With deps for forced recreation
70
- * ```tsx
71
- * const { editor, editorRef } = useEditor({ extensions, content }, [locale]);
72
- * // Editor is recreated when locale changes
73
- * ```
74
- */
75
- export interface UseEditorResult {
76
- editor: Editor | null;
77
- editorRef: React.RefObject<HTMLDivElement | null>;
78
- }
79
- export declare function useEditor(options?: UseEditorOptions, deps?: DependencyList): UseEditorResult;
80
- //# sourceMappingURL=useEditor.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"useEditor.d.ts","sourceRoot":"","sources":["../src/useEditor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,cAAc,EAA+B,MAAM,OAAO,CAAC;AACzE,OAAO,EACL,MAAM,EAMP,MAAM,iBAAiB,CAAC;AACzB,OAAO,KAAK,EAAE,OAAO,EAAE,YAAY,EAAE,aAAa,EAA0C,MAAM,iBAAiB,CAAC;AAEpH,eAAO,MAAM,kBAAkB,EAAE,YAAY,EAAqD,CAAC;AAEnG,MAAM,WAAW,gBAAgB;IAC/B,8CAA8C;IAC9C,UAAU,CAAC,EAAE,YAAY,EAAE,CAAC;IAC5B,oDAAoD;IACpD,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,oDAAoD;IACpD,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,kDAAkD;IAClD,SAAS,CAAC,EAAE,aAAa,CAAC;IAC1B,4DAA4D;IAC5D,YAAY,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAC/B;;;;;OAKG;IACH,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,kDAAkD;IAClD,QAAQ,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;IACpC,gDAAgD;IAChD,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE;QAAE,MAAM,EAAE,MAAM,CAAA;KAAE,KAAK,IAAI,CAAC;IAC/C,gEAAgE;IAChE,iBAAiB,CAAC,EAAE,CAAC,KAAK,EAAE;QAAE,MAAM,EAAE,MAAM,CAAA;KAAE,KAAK,IAAI,CAAC;IACxD,0CAA0C;IAC1C,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,UAAU,CAAA;KAAE,KAAK,IAAI,CAAC;IACjE,0CAA0C;IAC1C,MAAM,CAAC,EAAE,CAAC,KAAK,EAAE;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,UAAU,CAAA;KAAE,KAAK,IAAI,CAAC;IAChE,6CAA6C;IAC7C,SAAS,CAAC,EAAE,MAAM,IAAI,CAAC;CACxB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,MAAM,WAAW,eAAe;IAC9B,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,SAAS,EAAE,KAAK,CAAC,SAAS,CAAC,cAAc,GAAG,IAAI,CAAC,CAAC;CACnD;AAED,wBAAgB,SAAS,CAAC,OAAO,GAAE,gBAAqB,EAAE,IAAI,CAAC,EAAE,cAAc,GAAG,eAAe,CAiKhG"}
@@ -1,27 +0,0 @@
1
- import type { Editor, JSONContent } from '@domternal/core';
2
- /**
3
- * Full editor state returned when no selector is provided.
4
- */
5
- export interface EditorState {
6
- htmlContent: string;
7
- jsonContent: JSONContent | null;
8
- isEmpty: boolean;
9
- isFocused: boolean;
10
- isEditable: boolean;
11
- }
12
- /**
13
- * Subscribe to editor state changes.
14
- *
15
- * **Overload 1 - Full state:**
16
- * ```tsx
17
- * const { htmlContent, isEmpty } = useEditorState(editor);
18
- * ```
19
- *
20
- * **Overload 2 - Selector (granular, avoids unnecessary re-renders):**
21
- * ```tsx
22
- * const isBold = useEditorState(editor, (ed) => ed.isActive('bold'));
23
- * ```
24
- */
25
- export declare function useEditorState(editor: Editor | null): EditorState;
26
- export declare function useEditorState<T>(editor: Editor | null, selector: (editor: Editor) => T): T | undefined;
27
- //# sourceMappingURL=useEditorState.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"useEditorState.d.ts","sourceRoot":"","sources":["../src/useEditorState.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAE3D;;GAEG;AACH,MAAM,WAAW,WAAW;IAC1B,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,WAAW,GAAG,IAAI,CAAC;IAChC,OAAO,EAAE,OAAO,CAAC;IACjB,SAAS,EAAE,OAAO,CAAC;IACnB,UAAU,EAAE,OAAO,CAAC;CACrB;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,cAAc,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,GAAG,WAAW,CAAC;AACnE,wBAAgB,cAAc,CAAC,CAAC,EAAE,MAAM,EAAE,MAAM,GAAG,IAAI,EAAE,QAAQ,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,CAAC,GAAG,CAAC,GAAG,SAAS,CAAC"}