@embedpdf/plugin-ui 2.0.0-next.1 → 2.0.0-next.2

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 (56) hide show
  1. package/dist/index.cjs +1 -1
  2. package/dist/index.cjs.map +1 -1
  3. package/dist/index.js +235 -146
  4. package/dist/index.js.map +1 -1
  5. package/dist/lib/actions.d.ts +31 -15
  6. package/dist/lib/schema.d.ts +51 -10
  7. package/dist/lib/selectors.d.ts +5 -5
  8. package/dist/lib/types.d.ts +39 -23
  9. package/dist/lib/ui-plugin.d.ts +11 -8
  10. package/dist/lib/utils/consts.d.ts +3 -0
  11. package/dist/lib/utils/schema-merger.d.ts +1 -1
  12. package/dist/lib/utils/stylesheet-generator.d.ts +17 -0
  13. package/dist/preact/adapter.d.ts +1 -1
  14. package/dist/preact/index.cjs +1 -1
  15. package/dist/preact/index.cjs.map +1 -1
  16. package/dist/preact/index.js +143 -38
  17. package/dist/preact/index.js.map +1 -1
  18. package/dist/react/adapter.d.ts +1 -1
  19. package/dist/react/index.cjs +1 -1
  20. package/dist/react/index.cjs.map +1 -1
  21. package/dist/react/index.js +143 -38
  22. package/dist/react/index.js.map +1 -1
  23. package/dist/shared/hooks/index.d.ts +1 -0
  24. package/dist/shared/hooks/use-schema-renderer.d.ts +41 -9
  25. package/dist/shared/hooks/use-ui-container.d.ts +39 -0
  26. package/dist/shared/root.d.ts +1 -1
  27. package/dist/shared/types.d.ts +31 -6
  28. package/dist/shared-preact/hooks/index.d.ts +1 -0
  29. package/dist/shared-preact/hooks/use-schema-renderer.d.ts +41 -9
  30. package/dist/shared-preact/hooks/use-ui-container.d.ts +39 -0
  31. package/dist/shared-preact/root.d.ts +1 -1
  32. package/dist/shared-preact/types.d.ts +31 -6
  33. package/dist/shared-react/hooks/index.d.ts +1 -0
  34. package/dist/shared-react/hooks/use-schema-renderer.d.ts +41 -9
  35. package/dist/shared-react/hooks/use-ui-container.d.ts +39 -0
  36. package/dist/shared-react/root.d.ts +1 -1
  37. package/dist/shared-react/types.d.ts +31 -6
  38. package/dist/svelte/hooks/index.d.ts +1 -0
  39. package/dist/svelte/hooks/use-schema-renderer.svelte.d.ts +55 -12
  40. package/dist/svelte/hooks/use-ui-container.svelte.d.ts +41 -0
  41. package/dist/svelte/hooks/use-ui.svelte.d.ts +2 -2
  42. package/dist/svelte/index.cjs +1 -1
  43. package/dist/svelte/index.cjs.map +1 -1
  44. package/dist/svelte/index.js +112 -20
  45. package/dist/svelte/index.js.map +1 -1
  46. package/dist/svelte/types.d.ts +31 -6
  47. package/dist/vue/hooks/index.d.ts +1 -0
  48. package/dist/vue/hooks/use-schema-renderer.d.ts +41 -9
  49. package/dist/vue/hooks/use-ui-container.d.ts +39 -0
  50. package/dist/vue/hooks/use-ui.d.ts +148 -20
  51. package/dist/vue/index.cjs +1 -1
  52. package/dist/vue/index.cjs.map +1 -1
  53. package/dist/vue/index.js +126 -25
  54. package/dist/vue/index.js.map +1 -1
  55. package/dist/vue/types.d.ts +31 -6
  56. package/package.json +12 -12
@@ -1,5 +1,5 @@
1
1
  import { ComponentType } from '../react/adapter.ts';
2
- import { ToolbarSchema, PanelSchema, MenuSchema, SelectionMenuSchema } from '../index.ts';
2
+ import { ToolbarSchema, SidebarSchema, ModalSchema, OverlaySchema, MenuSchema, SelectionMenuSchema } from '../index.ts';
3
3
  import { SelectionMenuPropsBase } from '../react/utils.ts';
4
4
  export type { SelectionMenuPropsBase };
5
5
  export type UIComponents = Record<string, ComponentType<BaseComponentProps>>;
@@ -23,17 +23,40 @@ export interface ToolbarRendererProps {
23
23
  }
24
24
  export type ToolbarRenderer = ComponentType<ToolbarRendererProps>;
25
25
  /**
26
- * Props for panel renderer
26
+ * Props for sidebar renderer
27
27
  * The app provides a component matching this contract
28
28
  */
29
- export interface PanelRendererProps {
30
- schema: PanelSchema;
29
+ export interface SidebarRendererProps {
30
+ schema: SidebarSchema;
31
31
  documentId: string;
32
32
  isOpen: boolean;
33
33
  onClose: () => void;
34
34
  className?: string;
35
35
  }
36
- export type PanelRenderer = ComponentType<PanelRendererProps>;
36
+ export type SidebarRenderer = ComponentType<SidebarRendererProps>;
37
+ /**
38
+ * Props for modal renderer (with animation lifecycle support)
39
+ * The app provides a component matching this contract
40
+ */
41
+ export interface ModalRendererProps {
42
+ schema: ModalSchema;
43
+ documentId: string;
44
+ isOpen: boolean;
45
+ onClose: () => void;
46
+ onExited: () => void;
47
+ className?: string;
48
+ }
49
+ export type ModalRenderer = ComponentType<ModalRendererProps>;
50
+ /**
51
+ * Props for overlay renderer
52
+ * The app provides a component matching this contract
53
+ */
54
+ export interface OverlayRendererProps {
55
+ schema: OverlaySchema;
56
+ documentId: string;
57
+ className?: string;
58
+ }
59
+ export type OverlayRenderer = ComponentType<OverlayRendererProps>;
37
60
  /**
38
61
  * Props for menu renderer
39
62
  * The app provides a component matching this contract
@@ -61,7 +84,9 @@ export type SelectionMenuRenderer = ComponentType<SelectionMenuRendererProps>;
61
84
  */
62
85
  export interface UIRenderers {
63
86
  toolbar: ToolbarRenderer;
64
- panel: PanelRenderer;
87
+ sidebar: SidebarRenderer;
88
+ modal?: ModalRenderer;
89
+ overlay?: OverlayRenderer;
65
90
  menu: MenuRenderer;
66
91
  selectionMenu: SelectionMenuRenderer;
67
92
  }
@@ -1,4 +1,5 @@
1
1
  export * from './use-ui';
2
+ export * from './use-ui-container';
2
3
  export * from './use-register-anchor';
3
4
  export * from './use-item-renderer';
4
5
  export * from './use-schema-renderer';
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * High-level hook for rendering UI from schema
3
3
  *
4
- * Provides simple functions to render toolbars and panels by placement+slot.
4
+ * Provides simple functions to render toolbars, sidebars, and modals.
5
5
  * Always passes isOpen state to renderers so they can control animations.
6
6
  *
7
7
  * Automatically subscribes to UI state changes for the given document.
@@ -23,9 +23,9 @@ export declare function useSchemaRenderer(documentId: string): {
23
23
  */
24
24
  renderToolbar: (placement: "top" | "bottom" | "left" | "right", slot: string) => import("preact").JSX.Element | null;
25
25
  /**
26
- * Render a panel by placement and slot
26
+ * Render a sidebar by placement and slot
27
27
  *
28
- * ALWAYS renders (when panel exists in slot) with isOpen state.
28
+ * ALWAYS renders (when sidebar exists in slot) with isOpen state.
29
29
  * Your renderer controls whether to display or animate.
30
30
  *
31
31
  * @param placement - 'left' | 'right' | 'top' | 'bottom'
@@ -33,11 +33,28 @@ export declare function useSchemaRenderer(documentId: string): {
33
33
  *
34
34
  * @example
35
35
  * ```tsx
36
- * {renderPanel('left', 'main')}
37
- * {renderPanel('right', 'main')}
36
+ * {renderSidebar('left', 'main')}
37
+ * {renderSidebar('right', 'main')}
38
38
  * ```
39
39
  */
40
- renderPanel: (placement: "left" | "right" | "top" | "bottom", slot: string) => import("preact").JSX.Element | null;
40
+ renderSidebar: (placement: "left" | "right" | "top" | "bottom", slot: string) => import("preact").JSX.Element | null;
41
+ /**
42
+ * Render the active modal (if any)
43
+ *
44
+ * Only one modal can be active at a time.
45
+ * Modals are defined in schema.modals.
46
+ *
47
+ * Supports animation lifecycle:
48
+ * - isOpen: true = visible
49
+ * - isOpen: false = animate out (modal still rendered)
50
+ * - onExited called after animation → modal removed
51
+ *
52
+ * @example
53
+ * ```tsx
54
+ * {renderModal()}
55
+ * ```
56
+ */
57
+ renderModal: () => import("preact").JSX.Element | null;
41
58
  /**
42
59
  * Helper: Get all active toolbars for this document
43
60
  * Useful for batch rendering or debugging
@@ -49,13 +66,28 @@ export declare function useSchemaRenderer(documentId: string): {
49
66
  isOpen: boolean;
50
67
  }[];
51
68
  /**
52
- * Helper: Get all active panels for this document
69
+ * Helper: Get all active sidebars for this document
53
70
  * Useful for batch rendering or debugging
54
71
  */
55
- getActivePanels: () => {
72
+ getActiveSidebars: () => {
56
73
  placement: string;
57
74
  slot: string;
58
- panelId: string;
75
+ sidebarId: string;
59
76
  isOpen: boolean;
60
77
  }[];
78
+ /**
79
+ * Render all enabled overlays
80
+ *
81
+ * Overlays are floating components positioned over the document content.
82
+ * Unlike modals, multiple overlays can be visible and they don't block interaction.
83
+ *
84
+ * @example
85
+ * ```tsx
86
+ * <div className="relative">
87
+ * {children}
88
+ * {renderOverlays()}
89
+ * </div>
90
+ * ```
91
+ */
92
+ renderOverlays: () => import("preact").JSX.Element | null;
61
93
  };
@@ -0,0 +1,39 @@
1
+ import { RefObject } from '../../preact/adapter.ts';
2
+ export interface UIContainerContextValue {
3
+ /** Reference to the UIRoot container element */
4
+ containerRef: RefObject<HTMLDivElement>;
5
+ /** Get the container element (may be null if not mounted) */
6
+ getContainer: () => HTMLDivElement | null;
7
+ }
8
+ export declare const UIContainerContext: import('preact').Context<UIContainerContextValue | null>;
9
+ /**
10
+ * Hook to access the UI container element.
11
+ *
12
+ * This provides access to the UIRoot container for:
13
+ * - Container query based responsiveness
14
+ * - Portaling elements to the root
15
+ * - Measuring container dimensions
16
+ *
17
+ * @example
18
+ * ```tsx
19
+ * function MyComponent() {
20
+ * const { containerRef, getContainer } = useUIContainer();
21
+ *
22
+ * // Use containerRef for ResizeObserver
23
+ * useEffect(() => {
24
+ * const container = getContainer();
25
+ * if (!container) return;
26
+ *
27
+ * const observer = new ResizeObserver(() => {
28
+ * console.log('Container width:', container.clientWidth);
29
+ * });
30
+ * observer.observe(container);
31
+ * return () => observer.disconnect();
32
+ * }, [getContainer]);
33
+ *
34
+ * // Or portal to the container
35
+ * return createPortal(<Modal />, getContainer()!);
36
+ * }
37
+ * ```
38
+ */
39
+ export declare function useUIContainer(): UIContainerContextValue;
@@ -8,5 +8,5 @@ interface UIRootProps extends HTMLAttributes<HTMLDivElement> {
8
8
  * 2. Managing the data-disabled-categories attribute
9
9
  * 3. Updating styles on locale changes
10
10
  */
11
- export declare function UIRoot({ children, ...restProps }: UIRootProps): import("preact").JSX.Element;
11
+ export declare function UIRoot({ children, style, ...restProps }: UIRootProps): import("preact").JSX.Element;
12
12
  export {};
@@ -1,5 +1,5 @@
1
1
  import { ComponentType } from '../preact/adapter.ts';
2
- import { ToolbarSchema, PanelSchema, MenuSchema, SelectionMenuSchema } from '../lib/index.ts';
2
+ import { ToolbarSchema, SidebarSchema, ModalSchema, OverlaySchema, MenuSchema, SelectionMenuSchema } from '../lib/index.ts';
3
3
  import { SelectionMenuPropsBase } from '../preact/utils.ts';
4
4
  export type { SelectionMenuPropsBase };
5
5
  export type UIComponents = Record<string, ComponentType<BaseComponentProps>>;
@@ -23,17 +23,40 @@ export interface ToolbarRendererProps {
23
23
  }
24
24
  export type ToolbarRenderer = ComponentType<ToolbarRendererProps>;
25
25
  /**
26
- * Props for panel renderer
26
+ * Props for sidebar renderer
27
27
  * The app provides a component matching this contract
28
28
  */
29
- export interface PanelRendererProps {
30
- schema: PanelSchema;
29
+ export interface SidebarRendererProps {
30
+ schema: SidebarSchema;
31
31
  documentId: string;
32
32
  isOpen: boolean;
33
33
  onClose: () => void;
34
34
  className?: string;
35
35
  }
36
- export type PanelRenderer = ComponentType<PanelRendererProps>;
36
+ export type SidebarRenderer = ComponentType<SidebarRendererProps>;
37
+ /**
38
+ * Props for modal renderer (with animation lifecycle support)
39
+ * The app provides a component matching this contract
40
+ */
41
+ export interface ModalRendererProps {
42
+ schema: ModalSchema;
43
+ documentId: string;
44
+ isOpen: boolean;
45
+ onClose: () => void;
46
+ onExited: () => void;
47
+ className?: string;
48
+ }
49
+ export type ModalRenderer = ComponentType<ModalRendererProps>;
50
+ /**
51
+ * Props for overlay renderer
52
+ * The app provides a component matching this contract
53
+ */
54
+ export interface OverlayRendererProps {
55
+ schema: OverlaySchema;
56
+ documentId: string;
57
+ className?: string;
58
+ }
59
+ export type OverlayRenderer = ComponentType<OverlayRendererProps>;
37
60
  /**
38
61
  * Props for menu renderer
39
62
  * The app provides a component matching this contract
@@ -61,7 +84,9 @@ export type SelectionMenuRenderer = ComponentType<SelectionMenuRendererProps>;
61
84
  */
62
85
  export interface UIRenderers {
63
86
  toolbar: ToolbarRenderer;
64
- panel: PanelRenderer;
87
+ sidebar: SidebarRenderer;
88
+ modal?: ModalRenderer;
89
+ overlay?: OverlayRenderer;
65
90
  menu: MenuRenderer;
66
91
  selectionMenu: SelectionMenuRenderer;
67
92
  }
@@ -1,4 +1,5 @@
1
1
  export * from './use-ui';
2
+ export * from './use-ui-container';
2
3
  export * from './use-register-anchor';
3
4
  export * from './use-item-renderer';
4
5
  export * from './use-schema-renderer';
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * High-level hook for rendering UI from schema
3
3
  *
4
- * Provides simple functions to render toolbars and panels by placement+slot.
4
+ * Provides simple functions to render toolbars, sidebars, and modals.
5
5
  * Always passes isOpen state to renderers so they can control animations.
6
6
  *
7
7
  * Automatically subscribes to UI state changes for the given document.
@@ -23,9 +23,9 @@ export declare function useSchemaRenderer(documentId: string): {
23
23
  */
24
24
  renderToolbar: (placement: "top" | "bottom" | "left" | "right", slot: string) => import("react/jsx-runtime").JSX.Element | null;
25
25
  /**
26
- * Render a panel by placement and slot
26
+ * Render a sidebar by placement and slot
27
27
  *
28
- * ALWAYS renders (when panel exists in slot) with isOpen state.
28
+ * ALWAYS renders (when sidebar exists in slot) with isOpen state.
29
29
  * Your renderer controls whether to display or animate.
30
30
  *
31
31
  * @param placement - 'left' | 'right' | 'top' | 'bottom'
@@ -33,11 +33,28 @@ export declare function useSchemaRenderer(documentId: string): {
33
33
  *
34
34
  * @example
35
35
  * ```tsx
36
- * {renderPanel('left', 'main')}
37
- * {renderPanel('right', 'main')}
36
+ * {renderSidebar('left', 'main')}
37
+ * {renderSidebar('right', 'main')}
38
38
  * ```
39
39
  */
40
- renderPanel: (placement: "left" | "right" | "top" | "bottom", slot: string) => import("react/jsx-runtime").JSX.Element | null;
40
+ renderSidebar: (placement: "left" | "right" | "top" | "bottom", slot: string) => import("react/jsx-runtime").JSX.Element | null;
41
+ /**
42
+ * Render the active modal (if any)
43
+ *
44
+ * Only one modal can be active at a time.
45
+ * Modals are defined in schema.modals.
46
+ *
47
+ * Supports animation lifecycle:
48
+ * - isOpen: true = visible
49
+ * - isOpen: false = animate out (modal still rendered)
50
+ * - onExited called after animation → modal removed
51
+ *
52
+ * @example
53
+ * ```tsx
54
+ * {renderModal()}
55
+ * ```
56
+ */
57
+ renderModal: () => import("react/jsx-runtime").JSX.Element | null;
41
58
  /**
42
59
  * Helper: Get all active toolbars for this document
43
60
  * Useful for batch rendering or debugging
@@ -49,13 +66,28 @@ export declare function useSchemaRenderer(documentId: string): {
49
66
  isOpen: boolean;
50
67
  }[];
51
68
  /**
52
- * Helper: Get all active panels for this document
69
+ * Helper: Get all active sidebars for this document
53
70
  * Useful for batch rendering or debugging
54
71
  */
55
- getActivePanels: () => {
72
+ getActiveSidebars: () => {
56
73
  placement: string;
57
74
  slot: string;
58
- panelId: string;
75
+ sidebarId: string;
59
76
  isOpen: boolean;
60
77
  }[];
78
+ /**
79
+ * Render all enabled overlays
80
+ *
81
+ * Overlays are floating components positioned over the document content.
82
+ * Unlike modals, multiple overlays can be visible and they don't block interaction.
83
+ *
84
+ * @example
85
+ * ```tsx
86
+ * <div className="relative">
87
+ * {children}
88
+ * {renderOverlays()}
89
+ * </div>
90
+ * ```
91
+ */
92
+ renderOverlays: () => import("react/jsx-runtime").JSX.Element | null;
61
93
  };
@@ -0,0 +1,39 @@
1
+ import { RefObject } from '../../react/adapter.ts';
2
+ export interface UIContainerContextValue {
3
+ /** Reference to the UIRoot container element */
4
+ containerRef: RefObject<HTMLDivElement>;
5
+ /** Get the container element (may be null if not mounted) */
6
+ getContainer: () => HTMLDivElement | null;
7
+ }
8
+ export declare const UIContainerContext: import('react').Context<UIContainerContextValue | null>;
9
+ /**
10
+ * Hook to access the UI container element.
11
+ *
12
+ * This provides access to the UIRoot container for:
13
+ * - Container query based responsiveness
14
+ * - Portaling elements to the root
15
+ * - Measuring container dimensions
16
+ *
17
+ * @example
18
+ * ```tsx
19
+ * function MyComponent() {
20
+ * const { containerRef, getContainer } = useUIContainer();
21
+ *
22
+ * // Use containerRef for ResizeObserver
23
+ * useEffect(() => {
24
+ * const container = getContainer();
25
+ * if (!container) return;
26
+ *
27
+ * const observer = new ResizeObserver(() => {
28
+ * console.log('Container width:', container.clientWidth);
29
+ * });
30
+ * observer.observe(container);
31
+ * return () => observer.disconnect();
32
+ * }, [getContainer]);
33
+ *
34
+ * // Or portal to the container
35
+ * return createPortal(<Modal />, getContainer()!);
36
+ * }
37
+ * ```
38
+ */
39
+ export declare function useUIContainer(): UIContainerContextValue;
@@ -8,5 +8,5 @@ interface UIRootProps extends HTMLAttributes<HTMLDivElement> {
8
8
  * 2. Managing the data-disabled-categories attribute
9
9
  * 3. Updating styles on locale changes
10
10
  */
11
- export declare function UIRoot({ children, ...restProps }: UIRootProps): import("react/jsx-runtime").JSX.Element;
11
+ export declare function UIRoot({ children, style, ...restProps }: UIRootProps): import("react/jsx-runtime").JSX.Element;
12
12
  export {};
@@ -1,5 +1,5 @@
1
1
  import { ComponentType } from '../react/adapter.ts';
2
- import { ToolbarSchema, PanelSchema, MenuSchema, SelectionMenuSchema } from '../lib/index.ts';
2
+ import { ToolbarSchema, SidebarSchema, ModalSchema, OverlaySchema, MenuSchema, SelectionMenuSchema } from '../lib/index.ts';
3
3
  import { SelectionMenuPropsBase } from '../react/utils.ts';
4
4
  export type { SelectionMenuPropsBase };
5
5
  export type UIComponents = Record<string, ComponentType<BaseComponentProps>>;
@@ -23,17 +23,40 @@ export interface ToolbarRendererProps {
23
23
  }
24
24
  export type ToolbarRenderer = ComponentType<ToolbarRendererProps>;
25
25
  /**
26
- * Props for panel renderer
26
+ * Props for sidebar renderer
27
27
  * The app provides a component matching this contract
28
28
  */
29
- export interface PanelRendererProps {
30
- schema: PanelSchema;
29
+ export interface SidebarRendererProps {
30
+ schema: SidebarSchema;
31
31
  documentId: string;
32
32
  isOpen: boolean;
33
33
  onClose: () => void;
34
34
  className?: string;
35
35
  }
36
- export type PanelRenderer = ComponentType<PanelRendererProps>;
36
+ export type SidebarRenderer = ComponentType<SidebarRendererProps>;
37
+ /**
38
+ * Props for modal renderer (with animation lifecycle support)
39
+ * The app provides a component matching this contract
40
+ */
41
+ export interface ModalRendererProps {
42
+ schema: ModalSchema;
43
+ documentId: string;
44
+ isOpen: boolean;
45
+ onClose: () => void;
46
+ onExited: () => void;
47
+ className?: string;
48
+ }
49
+ export type ModalRenderer = ComponentType<ModalRendererProps>;
50
+ /**
51
+ * Props for overlay renderer
52
+ * The app provides a component matching this contract
53
+ */
54
+ export interface OverlayRendererProps {
55
+ schema: OverlaySchema;
56
+ documentId: string;
57
+ className?: string;
58
+ }
59
+ export type OverlayRenderer = ComponentType<OverlayRendererProps>;
37
60
  /**
38
61
  * Props for menu renderer
39
62
  * The app provides a component matching this contract
@@ -61,7 +84,9 @@ export type SelectionMenuRenderer = ComponentType<SelectionMenuRendererProps>;
61
84
  */
62
85
  export interface UIRenderers {
63
86
  toolbar: ToolbarRenderer;
64
- panel: PanelRenderer;
87
+ sidebar: SidebarRenderer;
88
+ modal?: ModalRenderer;
89
+ overlay?: OverlayRenderer;
65
90
  menu: MenuRenderer;
66
91
  selectionMenu: SelectionMenuRenderer;
67
92
  }
@@ -1,4 +1,5 @@
1
1
  export * from './use-ui.svelte';
2
+ export * from './use-ui-container.svelte';
2
3
  export * from './use-register-anchor.svelte';
3
4
  export * from './use-item-renderer.svelte';
4
5
  export * from './use-schema-renderer.svelte';
@@ -1,18 +1,19 @@
1
1
  /**
2
2
  * High-level hook for rendering UI from schema
3
3
  *
4
- * Provides information about active toolbars and panels by placement+slot.
4
+ * Provides information about active toolbars, sidebars, and modals.
5
5
  * Always includes isOpen state so renderers can control animations.
6
6
  *
7
- * Use with Svelte's component binding to render toolbars and panels.
7
+ * Use with Svelte's component binding to render toolbars and sidebars.
8
8
  *
9
9
  * @example
10
10
  * ```svelte
11
11
  * <script lang="ts">
12
- * const { getToolbarInfo, getPanelInfo } = useSchemaRenderer(() => documentId);
12
+ * const { getToolbarInfo, getSidebarInfo, getModalInfo } = useSchemaRenderer(() => documentId);
13
13
  *
14
14
  * const topMainToolbar = $derived(getToolbarInfo('top', 'main'));
15
- * const leftMainPanel = $derived(getPanelInfo('left', 'main'));
15
+ * const leftMainSidebar = $derived(getSidebarInfo('left', 'main'));
16
+ * const modal = $derived(getModalInfo());
16
17
  * </script>
17
18
  *
18
19
  * {#if topMainToolbar}
@@ -42,19 +43,37 @@ export declare function useSchemaRenderer(getDocumentId: () => string | null): {
42
43
  onClose: (() => void) | undefined;
43
44
  } | null;
44
45
  /**
45
- * Get panel information by placement and slot
46
+ * Get sidebar information by placement and slot
46
47
  *
47
48
  * @param placement - 'left' | 'right' | 'top' | 'bottom'
48
49
  * @param slot - Slot name (e.g. 'main', 'secondary', 'inspector')
49
- * @returns Panel info or null if no panel in slot
50
+ * @returns Sidebar info or null if no sidebar in slot
50
51
  */
51
- getPanelInfo: (placement: "left" | "right" | "top" | "bottom", slot: string) => {
52
- renderer: import('..').PanelRenderer;
53
- schema: import('../../lib').PanelSchema;
52
+ getSidebarInfo: (placement: "left" | "right" | "top" | "bottom", slot: string) => {
53
+ renderer: import('..').SidebarRenderer;
54
+ schema: import('../../lib').SidebarSchema;
54
55
  documentId: string;
55
56
  isOpen: boolean;
56
57
  onClose: () => void;
57
58
  } | null;
59
+ /**
60
+ * Get modal information (if active)
61
+ *
62
+ * Supports animation lifecycle:
63
+ * - isOpen: true = visible
64
+ * - isOpen: false = animate out (modal still rendered)
65
+ * - onExited called after animation → modal removed
66
+ *
67
+ * @returns Modal info or null if no modal active
68
+ */
69
+ getModalInfo: () => {
70
+ renderer: import('..').ModalRenderer;
71
+ schema: import('../../lib').ModalSchema;
72
+ documentId: string;
73
+ isOpen: boolean;
74
+ onClose: () => void;
75
+ onExited: () => void;
76
+ } | null;
58
77
  /**
59
78
  * Helper: Get all active toolbars for this document
60
79
  * Useful for batch rendering or debugging
@@ -66,13 +85,37 @@ export declare function useSchemaRenderer(getDocumentId: () => string | null): {
66
85
  isOpen: boolean;
67
86
  }[];
68
87
  /**
69
- * Helper: Get all active panels for this document
88
+ * Helper: Get all active sidebars for this document
70
89
  * Useful for batch rendering or debugging
71
90
  */
72
- getActivePanels: () => {
91
+ getActiveSidebars: () => {
73
92
  placement: string;
74
93
  slot: string;
75
- panelId: string;
94
+ sidebarId: string;
76
95
  isOpen: boolean;
77
96
  }[];
97
+ /**
98
+ * Get overlay information for all enabled overlays
99
+ *
100
+ * Overlays are floating components positioned over the document content.
101
+ * Unlike modals, multiple overlays can be visible and they don't block interaction.
102
+ *
103
+ * @example
104
+ * ```svelte
105
+ * <script lang="ts">
106
+ * const { getOverlaysInfo } = useSchemaRenderer(() => documentId);
107
+ * const overlays = $derived(getOverlaysInfo());
108
+ * </script>
109
+ *
110
+ * {#each overlays as overlay (overlay.schema.id)}
111
+ * {@const OverlayRenderer = overlay.renderer}
112
+ * <OverlayRenderer schema={overlay.schema} documentId={overlay.documentId} />
113
+ * {/each}
114
+ * ```
115
+ */
116
+ getOverlaysInfo: () => {
117
+ renderer: import('..').OverlayRenderer;
118
+ schema: import('../../lib').OverlaySchema;
119
+ documentId: string;
120
+ }[];
78
121
  };
@@ -0,0 +1,41 @@
1
+ export interface UIContainerContextValue {
2
+ /** Get the container element (may be null if not mounted) */
3
+ getContainer: () => HTMLDivElement | null;
4
+ }
5
+ /**
6
+ * Set up the container context (called by UIRoot)
7
+ */
8
+ export declare function setUIContainerContext(value: UIContainerContextValue): void;
9
+ /**
10
+ * Hook to access the UI container element.
11
+ *
12
+ * This provides access to the UIRoot container for:
13
+ * - Container query based responsiveness
14
+ * - Portaling elements to the root
15
+ * - Measuring container dimensions
16
+ *
17
+ * @example
18
+ * ```svelte
19
+ * <script>
20
+ * import { useUIContainer } from '@embedpdf/plugin-ui/svelte';
21
+ * import { onMount, onDestroy } from 'svelte';
22
+ *
23
+ * const { getContainer } = useUIContainer();
24
+ *
25
+ * let observer;
26
+ *
27
+ * onMount(() => {
28
+ * const container = getContainer();
29
+ * if (!container) return;
30
+ *
31
+ * observer = new ResizeObserver(() => {
32
+ * console.log('Container width:', container.clientWidth);
33
+ * });
34
+ * observer.observe(container);
35
+ * });
36
+ *
37
+ * onDestroy(() => observer?.disconnect());
38
+ * </script>
39
+ * ```
40
+ */
41
+ export declare function useUIContainer(): UIContainerContextValue;
@@ -1,4 +1,4 @@
1
- import { UIPlugin, UIDocumentState, UISchema, UIScope } from '../../lib';
1
+ import { UIPlugin, UIDocumentState, UIScope } from '../../lib';
2
2
  /**
3
3
  * Hook to get the raw UI plugin instance.
4
4
  */
@@ -29,6 +29,6 @@ export declare const useUIState: (getDocumentId: () => string | null) => UseUISt
29
29
  * Returns an object with a reactive getter for the schema
30
30
  */
31
31
  export declare const useUISchema: () => {
32
- readonly schema: UISchema | null;
32
+ readonly schema: import('../../lib').UISchema | null;
33
33
  };
34
34
  export {};