@eigenpal/docx-js-editor 0.0.30 → 0.0.31

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 (47) hide show
  1. package/dist/{ClipboardManager-D0D4aUKE.d.ts → ClipboardManager-C0rTRkVQ.d.ts} +29 -1
  2. package/dist/{ClipboardManager-t936d0KD.d.mts → ClipboardManager-CgpKW2At.d.mts} +29 -1
  3. package/dist/PageSetupDialog-2SKHDRTF.js +1 -0
  4. package/dist/PageSetupDialog-SMQJXEBL.mjs +1 -0
  5. package/dist/{chunk-MRWJ3GNH.js → chunk-3Y6ZBC3P.js} +2 -2
  6. package/dist/{chunk-YGTSQZRK.mjs → chunk-6CSL7T4S.mjs} +1 -1
  7. package/dist/chunk-A2DPBJHE.mjs +258 -0
  8. package/dist/chunk-CQR767EJ.mjs +1 -0
  9. package/dist/{chunk-IRO7KGGC.js → chunk-DJI7XTMH.js} +2 -2
  10. package/dist/{chunk-Z35FA4M4.mjs → chunk-FFNGY4AB.mjs} +5 -5
  11. package/dist/chunk-HIITS47V.js +258 -0
  12. package/dist/{chunk-VHWEKJ35.js → chunk-N2UPYG75.js} +5 -5
  13. package/dist/{chunk-VR6PT4IZ.js → chunk-NKJBKWYY.js} +13 -13
  14. package/dist/{chunk-CQRI4YUS.mjs → chunk-OBTGZZLM.mjs} +13 -13
  15. package/dist/{chunk-I6LFWQFR.mjs → chunk-TQATISQV.mjs} +1 -1
  16. package/dist/chunk-ZKKL54FH.js +1 -0
  17. package/dist/core-plugins-reexport.js +1 -1
  18. package/dist/core-plugins-reexport.mjs +1 -1
  19. package/dist/core-reexport.d.mts +2 -2
  20. package/dist/core-reexport.d.ts +2 -2
  21. package/dist/core-reexport.js +1 -1
  22. package/dist/core-reexport.mjs +1 -1
  23. package/dist/headless-reexport.js +2 -2
  24. package/dist/headless-reexport.mjs +1 -1
  25. package/dist/index.d.mts +10 -27
  26. package/dist/index.d.ts +10 -27
  27. package/dist/index.js +23 -66
  28. package/dist/index.mjs +23 -66
  29. package/dist/mcp-reexport.js +10 -10
  30. package/dist/mcp-reexport.mjs +8 -8
  31. package/dist/{react-C-pJU0Y4.d.mts → react-B2h6vE3D.d.mts} +118 -83
  32. package/dist/{react-By80Gfi-.d.ts → react-CAc4htNH.d.ts} +118 -83
  33. package/dist/react.d.mts +2 -2
  34. package/dist/react.d.ts +2 -2
  35. package/dist/react.js +1 -1
  36. package/dist/react.mjs +1 -1
  37. package/dist/selectionRects-D45BP6HQ.js +1 -0
  38. package/dist/selectionRects-Z72BKRLU.mjs +1 -0
  39. package/package.json +1 -1
  40. package/dist/PageSetupDialog-3QCVUNDL.mjs +0 -1
  41. package/dist/PageSetupDialog-ZZTFPZKJ.js +0 -1
  42. package/dist/chunk-G72SXG7G.js +0 -258
  43. package/dist/chunk-MVCTPHRR.mjs +0 -258
  44. package/dist/chunk-QQ63M65M.js +0 -1
  45. package/dist/chunk-TDEHAPMZ.mjs +0 -1
  46. package/dist/selectionRects-6TRAXB7D.js +0 -1
  47. package/dist/selectionRects-IS7ZAS3A.mjs +0 -1
@@ -4,12 +4,113 @@ import * as prosemirror_view from 'prosemirror-view';
4
4
  import { EditorView } from 'prosemirror-view';
5
5
  import * as prosemirror_state from 'prosemirror-state';
6
6
  import { EditorState, Transaction } from 'prosemirror-state';
7
- import { T as TextFormatting, K as ParagraphFormatting, D as Document, a3 as Theme, e as Table } from './agentApi-BVHzyk2l.js';
7
+ import { T as TextFormatting, K as ParagraphFormatting, D as Document, a3 as Theme, C as Comment, e as Table } from './agentApi-BVHzyk2l.js';
8
+ import { F as SidebarItem, g as EditorPluginCore, k as PluginPanelProps, R as RenderedDomContext, G as SidebarItemContext, f as EditorHandle, h as ErrorNotification, m as SavedDocumentData, d as AutoSaveStatus, e as ClipboardSelection } from './ClipboardManager-C0rTRkVQ.js';
8
9
  import { e as PrintOptions, g as TableContext, T as TableAction, P as ParsedClipboardContent } from './clipboard-B7N7Kx2X.js';
9
10
  import { g as DocxInput, D as DocumentAgent } from './DocumentAgent-CRCXiBT7.js';
10
- import { g as EditorPluginCore, k as PluginPanelProps, R as RenderedDomContext, f as EditorHandle, h as ErrorNotification, m as SavedDocumentData, d as AutoSaveStatus, e as ClipboardSelection } from './ClipboardManager-D0D4aUKE.js';
11
11
  import * as react_jsx_runtime from 'react/jsx-runtime';
12
12
 
13
+ /**
14
+ * React Plugin Interface for the DOCX Editor
15
+ *
16
+ * Extends the framework-agnostic EditorPluginCore with React-specific
17
+ * UI rendering capabilities (Panel component, renderOverlay).
18
+ */
19
+
20
+ /**
21
+ * React-specific editor plugin interface.
22
+ *
23
+ * Extends EditorPluginCore with:
24
+ * - Panel: React component for rendering in the annotation panel
25
+ * - renderOverlay: Function returning ReactNode for overlay rendering
26
+ */
27
+ /**
28
+ * Render props passed to each sidebar item.
29
+ */
30
+ interface SidebarItemRenderProps {
31
+ /** Whether this item is currently expanded/active. */
32
+ isExpanded: boolean;
33
+ /** Toggle expand/collapse for this item. */
34
+ onToggleExpand: () => void;
35
+ /** Ref callback to measure the rendered card height. */
36
+ measureRef: (el: HTMLDivElement | null) => void;
37
+ }
38
+ /**
39
+ * A sidebar item with React rendering, anchored to a document position.
40
+ */
41
+ interface ReactSidebarItem extends SidebarItem {
42
+ /** Render the card content. */
43
+ render: (props: SidebarItemRenderProps) => ReactNode;
44
+ /** Estimated height in pixels (for pre-layout before measurement). Default: 40. */
45
+ estimatedHeight?: number;
46
+ }
47
+ interface ReactEditorPlugin<TState = any> extends EditorPluginCore<TState> {
48
+ /**
49
+ * React component to render in the annotation panel area.
50
+ * Receives editor state and callbacks for interaction.
51
+ */
52
+ Panel?: React.ComponentType<PluginPanelProps<TState>>;
53
+ /**
54
+ * Render an overlay on top of the rendered pages.
55
+ * Use this for highlights, annotations, or other visual elements
56
+ * that need to be positioned relative to the document content.
57
+ */
58
+ renderOverlay?: (context: RenderedDomContext, state: TState, editorView: EditorView | null) => ReactNode;
59
+ /**
60
+ * Provide sidebar items anchored to document positions.
61
+ * Called whenever plugin state changes.
62
+ * Items from all plugins are merged and laid out together in a unified sidebar.
63
+ */
64
+ getSidebarItems?: (state: TState, context: SidebarItemContext) => ReactSidebarItem[];
65
+ }
66
+ /**
67
+ * Backwards-compatible alias — EditorPlugin is now ReactEditorPlugin.
68
+ */
69
+ type EditorPlugin<TState = any> = ReactEditorPlugin<TState>;
70
+ /**
71
+ * Context value provided to plugins and panels.
72
+ */
73
+ interface PluginContext {
74
+ /** All registered plugins */
75
+ plugins: EditorPlugin[];
76
+ /** Current editor view */
77
+ editorView: EditorView | null;
78
+ /** Set the editor view (called by editor on mount) */
79
+ setEditorView: (view: EditorView | null) => void;
80
+ /** Get plugin state by plugin ID */
81
+ getPluginState: <T>(pluginId: string) => T | undefined;
82
+ /** Update plugin state */
83
+ setPluginState: <T>(pluginId: string, state: T) => void;
84
+ /** Scroll to a position in the editor */
85
+ scrollToPosition: (pos: number) => void;
86
+ /** Select a range in the editor */
87
+ selectRange: (from: number, to: number) => void;
88
+ }
89
+ /**
90
+ * Props for the PluginHost component.
91
+ */
92
+ interface PluginHostProps {
93
+ /** Plugins to enable */
94
+ plugins: EditorPlugin[];
95
+ /** The editor component (passed as child) */
96
+ children: React.ReactElement;
97
+ /** Class name for the host container */
98
+ className?: string;
99
+ }
100
+ /**
101
+ * Ref interface for the PluginHost component.
102
+ */
103
+ interface PluginHostRef {
104
+ /** Get plugin state by plugin ID */
105
+ getPluginState: <T>(pluginId: string) => T | undefined;
106
+ /** Update plugin state for a plugin */
107
+ setPluginState: <T>(pluginId: string, state: T) => void;
108
+ /** Get the current editor view */
109
+ getEditorView: () => EditorView | null;
110
+ /** Force a refresh of all plugin states */
111
+ refreshPluginStates: () => void;
112
+ }
113
+
13
114
  /**
14
115
  * Selection State Utilities
15
116
  *
@@ -212,86 +313,6 @@ type Layout = {
212
313
  pageGap?: number;
213
314
  };
214
315
 
215
- /**
216
- * React Plugin Interface for the DOCX Editor
217
- *
218
- * Extends the framework-agnostic EditorPluginCore with React-specific
219
- * UI rendering capabilities (Panel component, renderOverlay).
220
- */
221
-
222
- /**
223
- * React-specific editor plugin interface.
224
- *
225
- * Extends EditorPluginCore with:
226
- * - Panel: React component for rendering in the annotation panel
227
- * - renderOverlay: Function returning ReactNode for overlay rendering
228
- */
229
- interface ReactEditorPlugin<TState = any> extends EditorPluginCore<TState> {
230
- /**
231
- * React component to render in the annotation panel area.
232
- * Receives editor state and callbacks for interaction.
233
- */
234
- Panel?: React.ComponentType<PluginPanelProps<TState>>;
235
- /**
236
- * Render an overlay on top of the rendered pages.
237
- * Use this for highlights, annotations, or other visual elements
238
- * that need to be positioned relative to the document content.
239
- *
240
- * @param context - The rendered DOM context for position lookup
241
- * @param state - Current plugin state
242
- * @param editorView - The editor view for dispatching transactions
243
- * @returns React node to render as overlay, or null
244
- */
245
- renderOverlay?: (context: RenderedDomContext, state: TState, editorView: EditorView | null) => ReactNode;
246
- }
247
- /**
248
- * Backwards-compatible alias — EditorPlugin is now ReactEditorPlugin.
249
- */
250
- type EditorPlugin<TState = any> = ReactEditorPlugin<TState>;
251
- /**
252
- * Context value provided to plugins and panels.
253
- */
254
- interface PluginContext {
255
- /** All registered plugins */
256
- plugins: EditorPlugin[];
257
- /** Current editor view */
258
- editorView: EditorView | null;
259
- /** Set the editor view (called by editor on mount) */
260
- setEditorView: (view: EditorView | null) => void;
261
- /** Get plugin state by plugin ID */
262
- getPluginState: <T>(pluginId: string) => T | undefined;
263
- /** Update plugin state */
264
- setPluginState: <T>(pluginId: string, state: T) => void;
265
- /** Scroll to a position in the editor */
266
- scrollToPosition: (pos: number) => void;
267
- /** Select a range in the editor */
268
- selectRange: (from: number, to: number) => void;
269
- }
270
- /**
271
- * Props for the PluginHost component.
272
- */
273
- interface PluginHostProps {
274
- /** Plugins to enable */
275
- plugins: EditorPlugin[];
276
- /** The editor component (passed as child) */
277
- children: React.ReactElement;
278
- /** Class name for the host container */
279
- className?: string;
280
- }
281
- /**
282
- * Ref interface for the PluginHost component.
283
- */
284
- interface PluginHostRef {
285
- /** Get plugin state by plugin ID */
286
- getPluginState: <T>(pluginId: string) => T | undefined;
287
- /** Update plugin state for a plugin */
288
- setPluginState: <T>(pluginId: string, state: T) => void;
289
- /** Get the current editor view */
290
- getEditorView: () => EditorView | null;
291
- /** Force a refresh of all plugin states */
292
- refreshPluginStates: () => void;
293
- }
294
-
295
316
  interface PagedEditorRef {
296
317
  /** Get the current document. */
297
318
  getDocument(): Document | null;
@@ -375,6 +396,8 @@ interface DocxEditorProps {
375
396
  loadingIndicator?: ReactNode;
376
397
  /** Whether to show the document outline sidebar (default: false) */
377
398
  showOutline?: boolean;
399
+ /** Whether to show the floating outline toggle button (default: true) */
400
+ showOutlineButton?: boolean;
378
401
  /** Whether to show print button in toolbar (default: true) */
379
402
  showPrintButton?: boolean;
380
403
  /** Print options for print preview */
@@ -391,6 +414,14 @@ interface DocxEditorProps {
391
414
  mode?: EditorMode;
392
415
  /** Callback when the editing mode changes */
393
416
  onModeChange?: (mode: EditorMode) => void;
417
+ /** Callback when a comment is added via the UI */
418
+ onCommentAdd?: (comment: Comment) => void;
419
+ /** Callback when a comment is resolved via the UI */
420
+ onCommentResolve?: (comment: Comment) => void;
421
+ /** Callback when a comment is deleted via the UI */
422
+ onCommentDelete?: (comment: Comment) => void;
423
+ /** Callback when a reply is added to a comment via the UI */
424
+ onCommentReply?: (reply: Comment, parent: Comment) => void;
394
425
  /**
395
426
  * Callback when rendered DOM context is ready (for plugin overlays).
396
427
  * Used by PluginHost to get access to the rendered page DOM for positioning.
@@ -401,6 +432,10 @@ interface DocxEditorProps {
401
432
  * Passed from PluginHost to render plugin-specific overlays.
402
433
  */
403
434
  pluginOverlays?: ReactNode;
435
+ /** Sidebar items from plugins (passed from PluginHost). */
436
+ pluginSidebarItems?: ReactSidebarItem[];
437
+ /** Rendered DOM context from PluginHost (for sidebar position resolution). */
438
+ pluginRenderedDomContext?: RenderedDomContext | null;
404
439
  /** Custom logo/icon for the title bar */
405
440
  renderLogo?: () => ReactNode;
406
441
  /** Document name shown in the title bar */
@@ -1051,4 +1086,4 @@ declare const PLUGIN_HOST_STYLES = "\n.plugin-host {\n display: flex;\n width:
1051
1086
  */
1052
1087
  declare const PluginHost: React$1.ForwardRefExoticComponent<PluginHostProps & React$1.RefAttributes<PluginHostRef>>;
1053
1088
 
1054
- export { getSelectionBoundingRect as $, type UseSelectionHighlightReturn as A, type UseTableSelectionOptions as B, type UseTableSelectionReturn as C, DEFAULT_SELECTION_STYLE as D, type EditorMode as E, type UseWheelZoomOptions as F, type UseWheelZoomReturn as G, HIGH_CONTRAST_SELECTION_STYLE as H, areSelectionStylesInjected as I, clampZoom as J, clearSelection as K, createSelectionChangeHandler as L, findNearestZoomPreset as M, formatZoom as N, generateOverlayElements as O, PLUGIN_HOST_STYLES as P, generateSelectionCSS as Q, type ReactEditorPlugin as R, SELECTION_CSS_VARS as S, type TableSelectionState as T, UnsupportedFeatureWarning as U, getHighlightRectStyle as V, getMergedSelectionRects as W, getNextZoomPreset as X, getPreviousZoomPreset as Y, ZOOM_PRESETS as Z, getSelectedText as _, DocxEditor as a, getSelectionRects as a0, getUserFriendlyMessage as a1, getZoomPresets as a2, hasActiveSelection as a3, highlightTextRange as a4, injectSelectionStyles as a5, isParseError as a6, isSelectionBackwards as a7, isSelectionWithin as a8, isZoomPreset as a9, mergeAdjacentRects as aa, normalizeSelectionDirection as ab, parseZoom as ac, removeSelectionStyles as ad, renderAsync as ae, selectRange as af, useAutoSave as ag, useClipboard as ah, useErrorNotifications as ai, useSelectionHighlight as aj, useTableSelection as ak, useWheelZoom as al, type DocxEditorHandle as b, type DocxEditorProps as c, type DocxEditorRef as d, type EditorPlugin as e, ErrorBoundary as f, type ErrorBoundaryProps as g, type ErrorContextValue as h, ErrorProvider as i, type HighlightRect as j, ParseErrorDisplay as k, type ParseErrorDisplayProps as l, type PluginContext as m, PluginHost as n, type PluginHostProps as o, type PluginHostRef as p, type RenderAsyncOptions as q, type SelectionHighlightConfig as r, type SelectionOverlayProps as s, type SelectionRange as t, type UnsupportedFeatureWarningProps as u, type UseAutoSaveOptions as v, type UseAutoSaveReturn as w, type UseClipboardOptions as x, type UseClipboardReturn as y, type UseSelectionHighlightOptions as z };
1089
+ export { getPreviousZoomPreset as $, type UseClipboardReturn as A, type UseSelectionHighlightOptions as B, type UseSelectionHighlightReturn as C, DEFAULT_SELECTION_STYLE as D, type EditorMode as E, type UseTableSelectionOptions as F, type UseTableSelectionReturn as G, HIGH_CONTRAST_SELECTION_STYLE as H, type UseWheelZoomOptions as I, type UseWheelZoomReturn as J, areSelectionStylesInjected as K, clampZoom as L, clearSelection as M, createSelectionChangeHandler as N, findNearestZoomPreset as O, PLUGIN_HOST_STYLES as P, formatZoom as Q, type ReactEditorPlugin as R, SELECTION_CSS_VARS as S, type TableSelectionState as T, UnsupportedFeatureWarning as U, generateOverlayElements as V, generateSelectionCSS as W, getHighlightRectStyle as X, getMergedSelectionRects as Y, ZOOM_PRESETS as Z, getNextZoomPreset as _, DocxEditor as a, getSelectedText as a0, getSelectionBoundingRect as a1, getSelectionRects as a2, getUserFriendlyMessage as a3, getZoomPresets as a4, hasActiveSelection as a5, highlightTextRange as a6, injectSelectionStyles as a7, isParseError as a8, isSelectionBackwards as a9, isSelectionWithin as aa, isZoomPreset as ab, mergeAdjacentRects as ac, normalizeSelectionDirection as ad, parseZoom as ae, removeSelectionStyles as af, renderAsync as ag, selectRange as ah, useAutoSave as ai, useClipboard as aj, useErrorNotifications as ak, useSelectionHighlight as al, useTableSelection as am, useWheelZoom as an, type DocxEditorHandle as b, type DocxEditorProps as c, type DocxEditorRef as d, type EditorPlugin as e, ErrorBoundary as f, type ErrorBoundaryProps as g, type ErrorContextValue as h, ErrorProvider as i, type HighlightRect as j, ParseErrorDisplay as k, type ParseErrorDisplayProps as l, type PluginContext as m, PluginHost as n, type PluginHostProps as o, type PluginHostRef as p, type ReactSidebarItem as q, type RenderAsyncOptions as r, type SelectionHighlightConfig as s, type SelectionOverlayProps as t, type SelectionRange as u, type SidebarItemRenderProps as v, type UnsupportedFeatureWarningProps as w, type UseAutoSaveOptions as x, type UseAutoSaveReturn as y, type UseClipboardOptions as z };
package/dist/react.d.mts CHANGED
@@ -1,6 +1,6 @@
1
- export { a as DocxEditor, b as DocxEditorHandle, c as DocxEditorProps, d as DocxEditorRef, e as EditorPlugin, f as ErrorBoundary, g as ErrorBoundaryProps, h as ErrorContextValue, i as ErrorProvider, P as PLUGIN_HOST_STYLES, k as ParseErrorDisplay, l as ParseErrorDisplayProps, m as PluginContext, n as PluginHost, o as PluginHostProps, p as PluginHostRef, q as RenderAsyncOptions, s as SelectionOverlayProps, T as TableSelectionState, U as UnsupportedFeatureWarning, u as UnsupportedFeatureWarningProps, v as UseAutoSaveOptions, w as UseAutoSaveReturn, x as UseClipboardOptions, y as UseClipboardReturn, z as UseSelectionHighlightOptions, A as UseSelectionHighlightReturn, B as UseTableSelectionOptions, C as UseTableSelectionReturn, F as UseWheelZoomOptions, G as UseWheelZoomReturn, Z as ZOOM_PRESETS, J as clampZoom, M as findNearestZoomPreset, N as formatZoom, O as generateOverlayElements, X as getNextZoomPreset, Y as getPreviousZoomPreset, a1 as getUserFriendlyMessage, a2 as getZoomPresets, a6 as isParseError, a9 as isZoomPreset, ac as parseZoom, ae as renderAsync, ag as useAutoSave, ah as useClipboard, ai as useErrorNotifications, aj as useSelectionHighlight, ak as useTableSelection, al as useWheelZoom } from './react-C-pJU0Y4.mjs';
1
+ export { a as DocxEditor, b as DocxEditorHandle, c as DocxEditorProps, d as DocxEditorRef, e as EditorPlugin, f as ErrorBoundary, g as ErrorBoundaryProps, h as ErrorContextValue, i as ErrorProvider, P as PLUGIN_HOST_STYLES, k as ParseErrorDisplay, l as ParseErrorDisplayProps, m as PluginContext, n as PluginHost, o as PluginHostProps, p as PluginHostRef, r as RenderAsyncOptions, t as SelectionOverlayProps, T as TableSelectionState, U as UnsupportedFeatureWarning, w as UnsupportedFeatureWarningProps, x as UseAutoSaveOptions, y as UseAutoSaveReturn, z as UseClipboardOptions, A as UseClipboardReturn, B as UseSelectionHighlightOptions, C as UseSelectionHighlightReturn, F as UseTableSelectionOptions, G as UseTableSelectionReturn, I as UseWheelZoomOptions, J as UseWheelZoomReturn, Z as ZOOM_PRESETS, L as clampZoom, O as findNearestZoomPreset, Q as formatZoom, V as generateOverlayElements, _ as getNextZoomPreset, $ as getPreviousZoomPreset, a3 as getUserFriendlyMessage, a4 as getZoomPresets, a8 as isParseError, ab as isZoomPreset, ae as parseZoom, ag as renderAsync, ai as useAutoSave, aj as useClipboard, ak as useErrorNotifications, al as useSelectionHighlight, am as useTableSelection, an as useWheelZoom } from './react-B2h6vE3D.mjs';
2
2
  export { g as DocxInput, t as toArrayBuffer } from './DocumentAgent-BqA9EJ3F.mjs';
3
- export { d as AutoSaveStatus, e as ClipboardSelection, h as ErrorNotification, i as ErrorSeverity, j as PanelConfig, k as PluginPanelProps, m as SavedDocumentData, T as TABLE_DATA_ATTRIBUTES, p as createSelectionFromDOM, t as formatLastSaveTime, u as formatStorageSize, v as getAutoSaveStatusLabel, w as getAutoSaveStorageSize, x as getSelectionRuns, z as isAutoSaveSupported } from './ClipboardManager-t936d0KD.mjs';
3
+ export { d as AutoSaveStatus, e as ClipboardSelection, h as ErrorNotification, i as ErrorSeverity, j as PanelConfig, k as PluginPanelProps, m as SavedDocumentData, T as TABLE_DATA_ATTRIBUTES, p as createSelectionFromDOM, t as formatLastSaveTime, u as formatStorageSize, v as getAutoSaveStatusLabel, w as getAutoSaveStorageSize, x as getSelectionRuns, z as isAutoSaveSupported } from './ClipboardManager-CgpKW2At.mjs';
4
4
  import 'react';
5
5
  import 'prosemirror-view';
6
6
  import 'prosemirror-state';
package/dist/react.d.ts CHANGED
@@ -1,6 +1,6 @@
1
- export { a as DocxEditor, b as DocxEditorHandle, c as DocxEditorProps, d as DocxEditorRef, e as EditorPlugin, f as ErrorBoundary, g as ErrorBoundaryProps, h as ErrorContextValue, i as ErrorProvider, P as PLUGIN_HOST_STYLES, k as ParseErrorDisplay, l as ParseErrorDisplayProps, m as PluginContext, n as PluginHost, o as PluginHostProps, p as PluginHostRef, q as RenderAsyncOptions, s as SelectionOverlayProps, T as TableSelectionState, U as UnsupportedFeatureWarning, u as UnsupportedFeatureWarningProps, v as UseAutoSaveOptions, w as UseAutoSaveReturn, x as UseClipboardOptions, y as UseClipboardReturn, z as UseSelectionHighlightOptions, A as UseSelectionHighlightReturn, B as UseTableSelectionOptions, C as UseTableSelectionReturn, F as UseWheelZoomOptions, G as UseWheelZoomReturn, Z as ZOOM_PRESETS, J as clampZoom, M as findNearestZoomPreset, N as formatZoom, O as generateOverlayElements, X as getNextZoomPreset, Y as getPreviousZoomPreset, a1 as getUserFriendlyMessage, a2 as getZoomPresets, a6 as isParseError, a9 as isZoomPreset, ac as parseZoom, ae as renderAsync, ag as useAutoSave, ah as useClipboard, ai as useErrorNotifications, aj as useSelectionHighlight, ak as useTableSelection, al as useWheelZoom } from './react-By80Gfi-.js';
1
+ export { a as DocxEditor, b as DocxEditorHandle, c as DocxEditorProps, d as DocxEditorRef, e as EditorPlugin, f as ErrorBoundary, g as ErrorBoundaryProps, h as ErrorContextValue, i as ErrorProvider, P as PLUGIN_HOST_STYLES, k as ParseErrorDisplay, l as ParseErrorDisplayProps, m as PluginContext, n as PluginHost, o as PluginHostProps, p as PluginHostRef, r as RenderAsyncOptions, t as SelectionOverlayProps, T as TableSelectionState, U as UnsupportedFeatureWarning, w as UnsupportedFeatureWarningProps, x as UseAutoSaveOptions, y as UseAutoSaveReturn, z as UseClipboardOptions, A as UseClipboardReturn, B as UseSelectionHighlightOptions, C as UseSelectionHighlightReturn, F as UseTableSelectionOptions, G as UseTableSelectionReturn, I as UseWheelZoomOptions, J as UseWheelZoomReturn, Z as ZOOM_PRESETS, L as clampZoom, O as findNearestZoomPreset, Q as formatZoom, V as generateOverlayElements, _ as getNextZoomPreset, $ as getPreviousZoomPreset, a3 as getUserFriendlyMessage, a4 as getZoomPresets, a8 as isParseError, ab as isZoomPreset, ae as parseZoom, ag as renderAsync, ai as useAutoSave, aj as useClipboard, ak as useErrorNotifications, al as useSelectionHighlight, am as useTableSelection, an as useWheelZoom } from './react-CAc4htNH.js';
2
2
  export { g as DocxInput, t as toArrayBuffer } from './DocumentAgent-CRCXiBT7.js';
3
- export { d as AutoSaveStatus, e as ClipboardSelection, h as ErrorNotification, i as ErrorSeverity, j as PanelConfig, k as PluginPanelProps, m as SavedDocumentData, T as TABLE_DATA_ATTRIBUTES, p as createSelectionFromDOM, t as formatLastSaveTime, u as formatStorageSize, v as getAutoSaveStatusLabel, w as getAutoSaveStorageSize, x as getSelectionRuns, z as isAutoSaveSupported } from './ClipboardManager-D0D4aUKE.js';
3
+ export { d as AutoSaveStatus, e as ClipboardSelection, h as ErrorNotification, i as ErrorSeverity, j as PanelConfig, k as PluginPanelProps, m as SavedDocumentData, T as TABLE_DATA_ATTRIBUTES, p as createSelectionFromDOM, t as formatLastSaveTime, u as formatStorageSize, v as getAutoSaveStatusLabel, w as getAutoSaveStorageSize, x as getSelectionRuns, z as isAutoSaveSupported } from './ClipboardManager-C0rTRkVQ.js';
4
4
  import 'react';
5
5
  import 'prosemirror-view';
6
6
  import 'prosemirror-state';
package/dist/react.js CHANGED
@@ -1 +1 @@
1
- 'use strict';var chunkG72SXG7G_js=require('./chunk-G72SXG7G.js');require('./chunk-QQ63M65M.js'),require('./chunk-2KHL5RSD.js'),require('./chunk-CTYOM6BE.js'),require('./chunk-PJVI53AH.js');var chunkFVUGBRDD_js=require('./chunk-FVUGBRDD.js');require('./chunk-MRWJ3GNH.js'),require('./chunk-4VUZBV2S.js'),require('./chunk-VHWEKJ35.js'),require('./chunk-PB7VMDDP.js'),require('./chunk-IRO7KGGC.js'),require('./chunk-AARNCPWR.js');var chunkVR6PT4IZ_js=require('./chunk-VR6PT4IZ.js');require('./chunk-BUEMG4NW.js'),require('./chunk-SE5EN2QL.js'),require('./chunk-IFPN3NT3.js'),require('./chunk-H5NTJZO4.js');Object.defineProperty(exports,"DocxEditor",{enumerable:true,get:function(){return chunkG72SXG7G_js.j}});Object.defineProperty(exports,"ErrorBoundary",{enumerable:true,get:function(){return chunkG72SXG7G_js.d}});Object.defineProperty(exports,"ErrorProvider",{enumerable:true,get:function(){return chunkG72SXG7G_js.c}});Object.defineProperty(exports,"PLUGIN_HOST_STYLES",{enumerable:true,get:function(){return chunkG72SXG7G_js.U}});Object.defineProperty(exports,"ParseErrorDisplay",{enumerable:true,get:function(){return chunkG72SXG7G_js.e}});Object.defineProperty(exports,"PluginHost",{enumerable:true,get:function(){return chunkG72SXG7G_js.V}});Object.defineProperty(exports,"UnsupportedFeatureWarning",{enumerable:true,get:function(){return chunkG72SXG7G_js.f}});Object.defineProperty(exports,"ZOOM_PRESETS",{enumerable:true,get:function(){return chunkG72SXG7G_js.m}});Object.defineProperty(exports,"clampZoom",{enumerable:true,get:function(){return chunkG72SXG7G_js.v}});Object.defineProperty(exports,"findNearestZoomPreset",{enumerable:true,get:function(){return chunkG72SXG7G_js.p}});Object.defineProperty(exports,"formatZoom",{enumerable:true,get:function(){return chunkG72SXG7G_js.s}});Object.defineProperty(exports,"generateOverlayElements",{enumerable:true,get:function(){return chunkG72SXG7G_js.S}});Object.defineProperty(exports,"getNextZoomPreset",{enumerable:true,get:function(){return chunkG72SXG7G_js.q}});Object.defineProperty(exports,"getPreviousZoomPreset",{enumerable:true,get:function(){return chunkG72SXG7G_js.r}});Object.defineProperty(exports,"getUserFriendlyMessage",{enumerable:true,get:function(){return chunkG72SXG7G_js.h}});Object.defineProperty(exports,"getZoomPresets",{enumerable:true,get:function(){return chunkG72SXG7G_js.o}});Object.defineProperty(exports,"isParseError",{enumerable:true,get:function(){return chunkG72SXG7G_js.g}});Object.defineProperty(exports,"isZoomPreset",{enumerable:true,get:function(){return chunkG72SXG7G_js.u}});Object.defineProperty(exports,"parseZoom",{enumerable:true,get:function(){return chunkG72SXG7G_js.t}});Object.defineProperty(exports,"renderAsync",{enumerable:true,get:function(){return chunkG72SXG7G_js.k}});Object.defineProperty(exports,"useAutoSave",{enumerable:true,get:function(){return chunkG72SXG7G_js.l}});Object.defineProperty(exports,"useClipboard",{enumerable:true,get:function(){return chunkG72SXG7G_js.T}});Object.defineProperty(exports,"useErrorNotifications",{enumerable:true,get:function(){return chunkG72SXG7G_js.b}});Object.defineProperty(exports,"useSelectionHighlight",{enumerable:true,get:function(){return chunkG72SXG7G_js.R}});Object.defineProperty(exports,"useTableSelection",{enumerable:true,get:function(){return chunkG72SXG7G_js.i}});Object.defineProperty(exports,"useWheelZoom",{enumerable:true,get:function(){return chunkG72SXG7G_js.n}});Object.defineProperty(exports,"TABLE_DATA_ATTRIBUTES",{enumerable:true,get:function(){return chunkFVUGBRDD_js.x}});Object.defineProperty(exports,"createSelectionFromDOM",{enumerable:true,get:function(){return chunkFVUGBRDD_js.F}});Object.defineProperty(exports,"formatLastSaveTime",{enumerable:true,get:function(){return chunkFVUGBRDD_js.s}});Object.defineProperty(exports,"formatStorageSize",{enumerable:true,get:function(){return chunkFVUGBRDD_js.v}});Object.defineProperty(exports,"getAutoSaveStatusLabel",{enumerable:true,get:function(){return chunkFVUGBRDD_js.t}});Object.defineProperty(exports,"getAutoSaveStorageSize",{enumerable:true,get:function(){return chunkFVUGBRDD_js.u}});Object.defineProperty(exports,"getSelectionRuns",{enumerable:true,get:function(){return chunkFVUGBRDD_js.E}});Object.defineProperty(exports,"isAutoSaveSupported",{enumerable:true,get:function(){return chunkFVUGBRDD_js.w}});Object.defineProperty(exports,"toArrayBuffer",{enumerable:true,get:function(){return chunkVR6PT4IZ_js.m}});
1
+ 'use strict';var chunkHIITS47V_js=require('./chunk-HIITS47V.js');require('./chunk-ZKKL54FH.js'),require('./chunk-2KHL5RSD.js'),require('./chunk-CTYOM6BE.js'),require('./chunk-PJVI53AH.js');var chunkFVUGBRDD_js=require('./chunk-FVUGBRDD.js');require('./chunk-3Y6ZBC3P.js'),require('./chunk-4VUZBV2S.js'),require('./chunk-N2UPYG75.js'),require('./chunk-PB7VMDDP.js'),require('./chunk-DJI7XTMH.js'),require('./chunk-AARNCPWR.js');var chunkNKJBKWYY_js=require('./chunk-NKJBKWYY.js');require('./chunk-BUEMG4NW.js'),require('./chunk-SE5EN2QL.js'),require('./chunk-IFPN3NT3.js'),require('./chunk-H5NTJZO4.js');Object.defineProperty(exports,"DocxEditor",{enumerable:true,get:function(){return chunkHIITS47V_js.j}});Object.defineProperty(exports,"ErrorBoundary",{enumerable:true,get:function(){return chunkHIITS47V_js.d}});Object.defineProperty(exports,"ErrorProvider",{enumerable:true,get:function(){return chunkHIITS47V_js.c}});Object.defineProperty(exports,"PLUGIN_HOST_STYLES",{enumerable:true,get:function(){return chunkHIITS47V_js.U}});Object.defineProperty(exports,"ParseErrorDisplay",{enumerable:true,get:function(){return chunkHIITS47V_js.e}});Object.defineProperty(exports,"PluginHost",{enumerable:true,get:function(){return chunkHIITS47V_js.V}});Object.defineProperty(exports,"UnsupportedFeatureWarning",{enumerable:true,get:function(){return chunkHIITS47V_js.f}});Object.defineProperty(exports,"ZOOM_PRESETS",{enumerable:true,get:function(){return chunkHIITS47V_js.m}});Object.defineProperty(exports,"clampZoom",{enumerable:true,get:function(){return chunkHIITS47V_js.v}});Object.defineProperty(exports,"findNearestZoomPreset",{enumerable:true,get:function(){return chunkHIITS47V_js.p}});Object.defineProperty(exports,"formatZoom",{enumerable:true,get:function(){return chunkHIITS47V_js.s}});Object.defineProperty(exports,"generateOverlayElements",{enumerable:true,get:function(){return chunkHIITS47V_js.S}});Object.defineProperty(exports,"getNextZoomPreset",{enumerable:true,get:function(){return chunkHIITS47V_js.q}});Object.defineProperty(exports,"getPreviousZoomPreset",{enumerable:true,get:function(){return chunkHIITS47V_js.r}});Object.defineProperty(exports,"getUserFriendlyMessage",{enumerable:true,get:function(){return chunkHIITS47V_js.h}});Object.defineProperty(exports,"getZoomPresets",{enumerable:true,get:function(){return chunkHIITS47V_js.o}});Object.defineProperty(exports,"isParseError",{enumerable:true,get:function(){return chunkHIITS47V_js.g}});Object.defineProperty(exports,"isZoomPreset",{enumerable:true,get:function(){return chunkHIITS47V_js.u}});Object.defineProperty(exports,"parseZoom",{enumerable:true,get:function(){return chunkHIITS47V_js.t}});Object.defineProperty(exports,"renderAsync",{enumerable:true,get:function(){return chunkHIITS47V_js.k}});Object.defineProperty(exports,"useAutoSave",{enumerable:true,get:function(){return chunkHIITS47V_js.l}});Object.defineProperty(exports,"useClipboard",{enumerable:true,get:function(){return chunkHIITS47V_js.T}});Object.defineProperty(exports,"useErrorNotifications",{enumerable:true,get:function(){return chunkHIITS47V_js.b}});Object.defineProperty(exports,"useSelectionHighlight",{enumerable:true,get:function(){return chunkHIITS47V_js.R}});Object.defineProperty(exports,"useTableSelection",{enumerable:true,get:function(){return chunkHIITS47V_js.i}});Object.defineProperty(exports,"useWheelZoom",{enumerable:true,get:function(){return chunkHIITS47V_js.n}});Object.defineProperty(exports,"TABLE_DATA_ATTRIBUTES",{enumerable:true,get:function(){return chunkFVUGBRDD_js.x}});Object.defineProperty(exports,"createSelectionFromDOM",{enumerable:true,get:function(){return chunkFVUGBRDD_js.F}});Object.defineProperty(exports,"formatLastSaveTime",{enumerable:true,get:function(){return chunkFVUGBRDD_js.s}});Object.defineProperty(exports,"formatStorageSize",{enumerable:true,get:function(){return chunkFVUGBRDD_js.v}});Object.defineProperty(exports,"getAutoSaveStatusLabel",{enumerable:true,get:function(){return chunkFVUGBRDD_js.t}});Object.defineProperty(exports,"getAutoSaveStorageSize",{enumerable:true,get:function(){return chunkFVUGBRDD_js.u}});Object.defineProperty(exports,"getSelectionRuns",{enumerable:true,get:function(){return chunkFVUGBRDD_js.E}});Object.defineProperty(exports,"isAutoSaveSupported",{enumerable:true,get:function(){return chunkFVUGBRDD_js.w}});Object.defineProperty(exports,"toArrayBuffer",{enumerable:true,get:function(){return chunkNKJBKWYY_js.m}});
package/dist/react.mjs CHANGED
@@ -1 +1 @@
1
- export{j as DocxEditor,d as ErrorBoundary,c as ErrorProvider,U as PLUGIN_HOST_STYLES,e as ParseErrorDisplay,V as PluginHost,f as UnsupportedFeatureWarning,m as ZOOM_PRESETS,v as clampZoom,p as findNearestZoomPreset,s as formatZoom,S as generateOverlayElements,q as getNextZoomPreset,r as getPreviousZoomPreset,h as getUserFriendlyMessage,o as getZoomPresets,g as isParseError,u as isZoomPreset,t as parseZoom,k as renderAsync,l as useAutoSave,T as useClipboard,b as useErrorNotifications,R as useSelectionHighlight,i as useTableSelection,n as useWheelZoom}from'./chunk-MVCTPHRR.mjs';import'./chunk-TDEHAPMZ.mjs';import'./chunk-7HZRJTOL.mjs';import'./chunk-XWBCP563.mjs';import'./chunk-AZRYS2WF.mjs';export{x as TABLE_DATA_ATTRIBUTES,F as createSelectionFromDOM,s as formatLastSaveTime,v as formatStorageSize,t as getAutoSaveStatusLabel,u as getAutoSaveStorageSize,E as getSelectionRuns,w as isAutoSaveSupported}from'./chunk-QTSXJRP6.mjs';import'./chunk-YGTSQZRK.mjs';import'./chunk-QAZ4233N.mjs';import'./chunk-Z35FA4M4.mjs';import'./chunk-DLVLK5FT.mjs';import'./chunk-I6LFWQFR.mjs';import'./chunk-M5F4SK3W.mjs';export{m as toArrayBuffer}from'./chunk-CQRI4YUS.mjs';import'./chunk-W53SI3XW.mjs';import'./chunk-LYBG4YI7.mjs';import'./chunk-WOHFANC5.mjs';import'./chunk-TAUMSKRE.mjs';
1
+ export{j as DocxEditor,d as ErrorBoundary,c as ErrorProvider,U as PLUGIN_HOST_STYLES,e as ParseErrorDisplay,V as PluginHost,f as UnsupportedFeatureWarning,m as ZOOM_PRESETS,v as clampZoom,p as findNearestZoomPreset,s as formatZoom,S as generateOverlayElements,q as getNextZoomPreset,r as getPreviousZoomPreset,h as getUserFriendlyMessage,o as getZoomPresets,g as isParseError,u as isZoomPreset,t as parseZoom,k as renderAsync,l as useAutoSave,T as useClipboard,b as useErrorNotifications,R as useSelectionHighlight,i as useTableSelection,n as useWheelZoom}from'./chunk-A2DPBJHE.mjs';import'./chunk-CQR767EJ.mjs';import'./chunk-7HZRJTOL.mjs';import'./chunk-XWBCP563.mjs';import'./chunk-AZRYS2WF.mjs';export{x as TABLE_DATA_ATTRIBUTES,F as createSelectionFromDOM,s as formatLastSaveTime,v as formatStorageSize,t as getAutoSaveStatusLabel,u as getAutoSaveStorageSize,E as getSelectionRuns,w as isAutoSaveSupported}from'./chunk-QTSXJRP6.mjs';import'./chunk-6CSL7T4S.mjs';import'./chunk-QAZ4233N.mjs';import'./chunk-FFNGY4AB.mjs';import'./chunk-DLVLK5FT.mjs';import'./chunk-TQATISQV.mjs';import'./chunk-M5F4SK3W.mjs';export{m as toArrayBuffer}from'./chunk-OBTGZZLM.mjs';import'./chunk-W53SI3XW.mjs';import'./chunk-LYBG4YI7.mjs';import'./chunk-WOHFANC5.mjs';import'./chunk-TAUMSKRE.mjs';
@@ -0,0 +1 @@
1
+ 'use strict';var chunkZKKL54FH_js=require('./chunk-ZKKL54FH.js');require('./chunk-H5NTJZO4.js');Object.defineProperty(exports,"getCaretPosition",{enumerable:true,get:function(){return chunkZKKL54FH_js.p}});Object.defineProperty(exports,"groupRectsByPage",{enumerable:true,get:function(){return chunkZKKL54FH_js.r}});Object.defineProperty(exports,"isMultiPageSelection",{enumerable:true,get:function(){return chunkZKKL54FH_js.q}});Object.defineProperty(exports,"selectionToRects",{enumerable:true,get:function(){return chunkZKKL54FH_js.o}});
@@ -0,0 +1 @@
1
+ export{p as getCaretPosition,r as groupRectsByPage,q as isMultiPageSelection,o as selectionToRects}from'./chunk-CQR767EJ.mjs';import'./chunk-TAUMSKRE.mjs';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eigenpal/docx-js-editor",
3
- "version": "0.0.30",
3
+ "version": "0.0.31",
4
4
  "description": "A browser-based DOCX template editor with variable insertion support",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",
@@ -1 +0,0 @@
1
- import'./chunk-LYBG4YI7.mjs';import'./chunk-TAUMSKRE.mjs';import {useState,useEffect,useCallback}from'react';import {jsx,jsxs}from'react/jsx-runtime';var I=[{label:'Letter (8.5" \xD7 11")',width:12240,height:15840},{label:'A4 (8.27" \xD7 11.69")',width:11906,height:16838},{label:'Legal (8.5" \xD7 14")',width:12240,height:20160},{label:'A3 (11.69" \xD7 16.54")',width:16838,height:23811},{label:'A5 (5.83" \xD7 8.27")',width:8391,height:11906},{label:'B5 (6.93" \xD7 9.84")',width:9979,height:14175},{label:'Executive (7.25" \xD7 10.5")',width:10440,height:15120}];function v(i){return Math.round(i/1440*100)/100}function f(i){return Math.round(i*1440)}function O(i,a){let h=Math.min(i,a),n=Math.max(i,a);return I.findIndex(l=>Math.abs(l.width-h)<20&&Math.abs(l.height-n)<20)}var Z={position:"fixed",top:0,left:0,right:0,bottom:0,backgroundColor:"rgba(0, 0, 0, 0.5)",display:"flex",alignItems:"center",justifyContent:"center",zIndex:1e4},q={backgroundColor:"white",borderRadius:8,boxShadow:"0 4px 20px rgba(0, 0, 0, 0.15)",minWidth:400,maxWidth:480,width:"100%",margin:20},J={padding:"16px 20px 12px",borderBottom:"1px solid var(--doc-border)",fontSize:16,fontWeight:600},Q={padding:"16px 20px",display:"flex",flexDirection:"column",gap:14},A={fontSize:12,fontWeight:600,color:"var(--doc-text-muted)",textTransform:"uppercase",letterSpacing:"0.5px"},c={display:"flex",alignItems:"center",gap:12},g={width:80,fontSize:13,color:"var(--doc-text-muted)"},b={flex:1,padding:"6px 8px",border:"1px solid var(--doc-border)",borderRadius:4,fontSize:13},W={...b},x={fontSize:11,color:"var(--doc-text-muted)",width:16},V={padding:"12px 20px 16px",borderTop:"1px solid var(--doc-border)",display:"flex",justifyContent:"flex-end",gap:8},H={padding:"6px 16px",fontSize:13,border:"1px solid var(--doc-border)",borderRadius:4,cursor:"pointer"},N=12240,B=15840,s=1440;function ee({isOpen:i,onClose:a,onApply:h,currentProps:n}){let[l,y]=useState(N),[u,m]=useState(B),[p,M]=useState("portrait"),[C,R]=useState(s),[P,z]=useState(s),[w,k]=useState(s),[T,D]=useState(s);useEffect(()=>{if(!i)return;let e=n?.pageWidth||N,r=n?.pageHeight||B,U=n?.orientation||(e>r?"landscape":"portrait");y(e),m(r),M(U),R(n?.marginTop??s),z(n?.marginBottom??s),k(n?.marginLeft??s),D(n?.marginRight??s);},[i,n]);let F=useCallback(e=>{if(e<0)return;let r=I[e];p==="landscape"?(y(r.height),m(r.width)):(y(r.width),m(r.height));},[p]),G=useCallback(e=>{e!==p&&(M(e),y(u),m(l));},[p,l,u]),E=useCallback(()=>{h({pageWidth:l,pageHeight:u,orientation:p,marginTop:C,marginBottom:P,marginLeft:w,marginRight:T}),a();},[l,u,p,C,P,w,T,h,a]),K=useCallback(e=>{e.key==="Escape"&&a(),e.key==="Enter"&&E();},[a,E]);if(!i)return null;let L=O(l,u);return jsx("div",{style:Z,onClick:a,onKeyDown:K,children:jsxs("div",{style:q,onClick:e=>e.stopPropagation(),onMouseDown:e=>e.stopPropagation(),role:"dialog","aria-label":"Page setup",children:[jsx("div",{style:J,children:"Page Setup"}),jsxs("div",{style:Q,children:[jsx("div",{style:A,children:"Page Size"}),jsxs("div",{style:c,children:[jsx("label",{style:g,children:"Size"}),jsxs("select",{style:W,value:L,onChange:e=>F(Number(e.target.value)),children:[I.map((e,r)=>jsx("option",{value:r,children:e.label},e.label)),L<0&&jsx("option",{value:-1,children:"Custom"})]})]}),jsxs("div",{style:c,children:[jsx("label",{style:g,children:"Orientation"}),jsxs("select",{style:W,value:p,onChange:e=>G(e.target.value),children:[jsx("option",{value:"portrait",children:"Portrait"}),jsx("option",{value:"landscape",children:"Landscape"})]})]}),jsx("div",{style:{...A,marginTop:4},children:"Margins"}),jsxs("div",{style:c,children:[jsx("label",{style:g,children:"Top"}),jsx("input",{type:"number",style:b,min:0,max:10,step:.1,value:v(C),onChange:e=>R(f(Number(e.target.value)||0))}),jsx("span",{style:x,children:"in"})]}),jsxs("div",{style:c,children:[jsx("label",{style:g,children:"Bottom"}),jsx("input",{type:"number",style:b,min:0,max:10,step:.1,value:v(P),onChange:e=>z(f(Number(e.target.value)||0))}),jsx("span",{style:x,children:"in"})]}),jsxs("div",{style:c,children:[jsx("label",{style:g,children:"Left"}),jsx("input",{type:"number",style:b,min:0,max:10,step:.1,value:v(w),onChange:e=>k(f(Number(e.target.value)||0))}),jsx("span",{style:x,children:"in"})]}),jsxs("div",{style:c,children:[jsx("label",{style:g,children:"Right"}),jsx("input",{type:"number",style:b,min:0,max:10,step:.1,value:v(T),onChange:e=>D(f(Number(e.target.value)||0))}),jsx("span",{style:x,children:"in"})]})]}),jsxs("div",{style:V,children:[jsx("button",{type:"button",style:H,onClick:a,children:"Cancel"}),jsx("button",{type:"button",style:{...H,backgroundColor:"var(--doc-primary)",color:"white",borderColor:"var(--doc-primary)"},onClick:E,children:"Apply"})]})]})})}export{ee as PageSetupDialog};
@@ -1 +0,0 @@
1
- 'use strict';require('./chunk-SE5EN2QL.js'),require('./chunk-H5NTJZO4.js');var react=require('react'),jsxRuntime=require('react/jsx-runtime');var I=[{label:'Letter (8.5" \xD7 11")',width:12240,height:15840},{label:'A4 (8.27" \xD7 11.69")',width:11906,height:16838},{label:'Legal (8.5" \xD7 14")',width:12240,height:20160},{label:'A3 (11.69" \xD7 16.54")',width:16838,height:23811},{label:'A5 (5.83" \xD7 8.27")',width:8391,height:11906},{label:'B5 (6.93" \xD7 9.84")',width:9979,height:14175},{label:'Executive (7.25" \xD7 10.5")',width:10440,height:15120}];function v(i){return Math.round(i/1440*100)/100}function f(i){return Math.round(i*1440)}function O(i,a){let h=Math.min(i,a),n=Math.max(i,a);return I.findIndex(l=>Math.abs(l.width-h)<20&&Math.abs(l.height-n)<20)}var Z={position:"fixed",top:0,left:0,right:0,bottom:0,backgroundColor:"rgba(0, 0, 0, 0.5)",display:"flex",alignItems:"center",justifyContent:"center",zIndex:1e4},q={backgroundColor:"white",borderRadius:8,boxShadow:"0 4px 20px rgba(0, 0, 0, 0.15)",minWidth:400,maxWidth:480,width:"100%",margin:20},J={padding:"16px 20px 12px",borderBottom:"1px solid var(--doc-border)",fontSize:16,fontWeight:600},Q={padding:"16px 20px",display:"flex",flexDirection:"column",gap:14},A={fontSize:12,fontWeight:600,color:"var(--doc-text-muted)",textTransform:"uppercase",letterSpacing:"0.5px"},c={display:"flex",alignItems:"center",gap:12},g={width:80,fontSize:13,color:"var(--doc-text-muted)"},b={flex:1,padding:"6px 8px",border:"1px solid var(--doc-border)",borderRadius:4,fontSize:13},W={...b},x={fontSize:11,color:"var(--doc-text-muted)",width:16},V={padding:"12px 20px 16px",borderTop:"1px solid var(--doc-border)",display:"flex",justifyContent:"flex-end",gap:8},H={padding:"6px 16px",fontSize:13,border:"1px solid var(--doc-border)",borderRadius:4,cursor:"pointer"},N=12240,B=15840,s=1440;function ee({isOpen:i,onClose:a,onApply:h,currentProps:n}){let[l,y]=react.useState(N),[u,m]=react.useState(B),[p,M]=react.useState("portrait"),[C,R]=react.useState(s),[P,z]=react.useState(s),[w,k]=react.useState(s),[T,D]=react.useState(s);react.useEffect(()=>{if(!i)return;let e=n?.pageWidth||N,r=n?.pageHeight||B,U=n?.orientation||(e>r?"landscape":"portrait");y(e),m(r),M(U),R(n?.marginTop??s),z(n?.marginBottom??s),k(n?.marginLeft??s),D(n?.marginRight??s);},[i,n]);let F=react.useCallback(e=>{if(e<0)return;let r=I[e];p==="landscape"?(y(r.height),m(r.width)):(y(r.width),m(r.height));},[p]),G=react.useCallback(e=>{e!==p&&(M(e),y(u),m(l));},[p,l,u]),E=react.useCallback(()=>{h({pageWidth:l,pageHeight:u,orientation:p,marginTop:C,marginBottom:P,marginLeft:w,marginRight:T}),a();},[l,u,p,C,P,w,T,h,a]),K=react.useCallback(e=>{e.key==="Escape"&&a(),e.key==="Enter"&&E();},[a,E]);if(!i)return null;let L=O(l,u);return jsxRuntime.jsx("div",{style:Z,onClick:a,onKeyDown:K,children:jsxRuntime.jsxs("div",{style:q,onClick:e=>e.stopPropagation(),onMouseDown:e=>e.stopPropagation(),role:"dialog","aria-label":"Page setup",children:[jsxRuntime.jsx("div",{style:J,children:"Page Setup"}),jsxRuntime.jsxs("div",{style:Q,children:[jsxRuntime.jsx("div",{style:A,children:"Page Size"}),jsxRuntime.jsxs("div",{style:c,children:[jsxRuntime.jsx("label",{style:g,children:"Size"}),jsxRuntime.jsxs("select",{style:W,value:L,onChange:e=>F(Number(e.target.value)),children:[I.map((e,r)=>jsxRuntime.jsx("option",{value:r,children:e.label},e.label)),L<0&&jsxRuntime.jsx("option",{value:-1,children:"Custom"})]})]}),jsxRuntime.jsxs("div",{style:c,children:[jsxRuntime.jsx("label",{style:g,children:"Orientation"}),jsxRuntime.jsxs("select",{style:W,value:p,onChange:e=>G(e.target.value),children:[jsxRuntime.jsx("option",{value:"portrait",children:"Portrait"}),jsxRuntime.jsx("option",{value:"landscape",children:"Landscape"})]})]}),jsxRuntime.jsx("div",{style:{...A,marginTop:4},children:"Margins"}),jsxRuntime.jsxs("div",{style:c,children:[jsxRuntime.jsx("label",{style:g,children:"Top"}),jsxRuntime.jsx("input",{type:"number",style:b,min:0,max:10,step:.1,value:v(C),onChange:e=>R(f(Number(e.target.value)||0))}),jsxRuntime.jsx("span",{style:x,children:"in"})]}),jsxRuntime.jsxs("div",{style:c,children:[jsxRuntime.jsx("label",{style:g,children:"Bottom"}),jsxRuntime.jsx("input",{type:"number",style:b,min:0,max:10,step:.1,value:v(P),onChange:e=>z(f(Number(e.target.value)||0))}),jsxRuntime.jsx("span",{style:x,children:"in"})]}),jsxRuntime.jsxs("div",{style:c,children:[jsxRuntime.jsx("label",{style:g,children:"Left"}),jsxRuntime.jsx("input",{type:"number",style:b,min:0,max:10,step:.1,value:v(w),onChange:e=>k(f(Number(e.target.value)||0))}),jsxRuntime.jsx("span",{style:x,children:"in"})]}),jsxRuntime.jsxs("div",{style:c,children:[jsxRuntime.jsx("label",{style:g,children:"Right"}),jsxRuntime.jsx("input",{type:"number",style:b,min:0,max:10,step:.1,value:v(T),onChange:e=>D(f(Number(e.target.value)||0))}),jsxRuntime.jsx("span",{style:x,children:"in"})]})]}),jsxRuntime.jsxs("div",{style:V,children:[jsxRuntime.jsx("button",{type:"button",style:H,onClick:a,children:"Cancel"}),jsxRuntime.jsx("button",{type:"button",style:{...H,backgroundColor:"var(--doc-primary)",color:"white",borderColor:"var(--doc-primary)"},onClick:E,children:"Apply"})]})]})})}exports.PageSetupDialog=ee;