@eigenpal/docx-js-editor 0.0.11 → 0.0.13

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 (99) hide show
  1. package/dist/DocumentAgent-Ci6_T-XM.d.ts +412 -0
  2. package/dist/DocumentAgent-DEGFgYEN.d.cts +412 -0
  3. package/dist/FindReplaceDialog-BAACAU67.cjs +1 -0
  4. package/dist/FindReplaceDialog-RWYDRWHF.js +1 -0
  5. package/dist/FootnotePropertiesDialog-BC6JIPDA.cjs +1 -0
  6. package/dist/FootnotePropertiesDialog-CWQF5EBK.js +1 -0
  7. package/dist/HyperlinkDialog-EG2BSLPD.cjs +1 -0
  8. package/dist/HyperlinkDialog-YAVK64F4.js +1 -0
  9. package/dist/ImagePositionDialog-IGYS5KMK.cjs +1 -0
  10. package/dist/ImagePositionDialog-S6SMH7XH.js +1 -0
  11. package/dist/ImagePropertiesDialog-UO5QUIBS.js +1 -0
  12. package/dist/ImagePropertiesDialog-VGV4E4SN.cjs +1 -0
  13. package/dist/TablePropertiesDialog-VBOU4DID.js +1 -0
  14. package/dist/TablePropertiesDialog-WRM47JI6.cjs +1 -0
  15. package/dist/{types-BALm1KBi.d.cts → agentApi-CbVUCZRu.d.cts} +1 -308
  16. package/dist/{types-BALm1KBi.d.ts → agentApi-CbVUCZRu.d.ts} +1 -308
  17. package/dist/chunk-2ASOEN3V.js +1 -0
  18. package/dist/chunk-6MBDPZVD.js +111 -0
  19. package/dist/chunk-6YLNNCRZ.cjs +10 -0
  20. package/dist/chunk-BVQ2QRHA.cjs +4 -0
  21. package/dist/chunk-COP5BIBZ.js +10 -0
  22. package/dist/chunk-CZ7W7MCM.cjs +2 -0
  23. package/dist/chunk-E6XDMUAM.js +4 -0
  24. package/dist/chunk-EMKABJPH.js +1 -0
  25. package/dist/{chunk-TRAQI6RX.cjs → chunk-EPCZ24TY.cjs} +5 -5
  26. package/dist/chunk-ESI4BSBF.js +1 -0
  27. package/dist/chunk-FLECKDK4.cjs +58 -0
  28. package/dist/chunk-ITWEFKGQ.cjs +1 -0
  29. package/dist/chunk-KESNGXGO.js +1 -0
  30. package/dist/chunk-KVAT5SVD.js +2 -0
  31. package/dist/chunk-L34XFLQZ.cjs +1 -0
  32. package/dist/chunk-M7F2CUUD.js +2 -0
  33. package/dist/chunk-MDPDH7KS.js +58 -0
  34. package/dist/chunk-MTX3EEBJ.js +258 -0
  35. package/dist/chunk-NT2REEAA.cjs +1 -0
  36. package/dist/{chunk-PM4Y7OFN.js → chunk-OTG4NABM.js} +5 -5
  37. package/dist/chunk-OW5H5DNE.cjs +1 -0
  38. package/dist/chunk-PJVI53AH.js +2 -0
  39. package/dist/chunk-PNMZPPPI.cjs +2 -0
  40. package/dist/chunk-SF53KLDZ.cjs +1 -0
  41. package/dist/chunk-TOI5W3HK.js +8 -0
  42. package/dist/chunk-UAVOWAIF.cjs +8 -0
  43. package/dist/chunk-VN7XH644.cjs +258 -0
  44. package/dist/chunk-W4DUKACP.cjs +111 -0
  45. package/dist/chunk-XS2AQFMF.cjs +2 -0
  46. package/dist/chunk-ZDYHAYN6.js +1 -0
  47. package/dist/clipboard-BOocwmAM.d.ts +539 -0
  48. package/dist/clipboard-Cx7cb3kX.d.cts +539 -0
  49. package/dist/{colorResolver-BNj-uZ58.d.ts → colorResolver-CIDiSPWd.d.cts} +3 -411
  50. package/dist/{colorResolver-DiMquGWR.d.cts → colorResolver-KXbUgzWC.d.ts} +3 -411
  51. package/dist/core-plugins.cjs +1 -1
  52. package/dist/core-plugins.d.cts +4 -3
  53. package/dist/core-plugins.d.ts +4 -3
  54. package/dist/core-plugins.js +1 -1
  55. package/dist/core.cjs +1 -0
  56. package/dist/core.d.cts +23 -0
  57. package/dist/core.d.ts +23 -0
  58. package/dist/core.js +1 -0
  59. package/dist/headless.cjs +2 -2
  60. package/dist/headless.d.cts +8 -175
  61. package/dist/headless.d.ts +8 -175
  62. package/dist/headless.js +1 -1
  63. package/dist/index.cjs +9 -378
  64. package/dist/index.d.cts +17 -4161
  65. package/dist/index.d.ts +17 -4161
  66. package/dist/index.js +9 -378
  67. package/dist/insertOperations-CzB5b-Of.d.ts +176 -0
  68. package/dist/insertOperations-DKVmCV32.d.cts +176 -0
  69. package/dist/mcp-cli.js +21 -21
  70. package/dist/mcp.cjs +10 -10
  71. package/dist/mcp.d.cts +2 -1
  72. package/dist/mcp.d.ts +2 -1
  73. package/dist/mcp.js +9 -9
  74. package/dist/processTemplate-BHBTDAIC.js +1 -0
  75. package/dist/processTemplate-QOEAXCKA.cjs +1 -0
  76. package/dist/react-Be1YOl4z.d.ts +1356 -0
  77. package/dist/react-DPuSVbgY.d.cts +1356 -0
  78. package/dist/react.cjs +1 -0
  79. package/dist/react.css +1 -0
  80. package/dist/react.d.cts +9 -0
  81. package/dist/react.d.ts +9 -0
  82. package/dist/react.js +1 -0
  83. package/dist/{registry-CzqAPdui.d.ts → registry-D4tvj9f3.d.ts} +1 -1
  84. package/dist/{registry-BUTMLqSj.d.cts → registry-ngv6Bumt.d.cts} +1 -1
  85. package/dist/types-D96elyJF.d.cts +310 -0
  86. package/dist/types-xMzSPT4i.d.ts +310 -0
  87. package/dist/ui.cjs +1 -0
  88. package/dist/ui.d.cts +2103 -0
  89. package/dist/ui.d.ts +2103 -0
  90. package/dist/ui.js +1 -0
  91. package/dist/variableDetector-CPxKo9jP.d.cts +173 -0
  92. package/dist/variableDetector-DeM1N-_L.d.ts +173 -0
  93. package/package.json +85 -10
  94. package/dist/chunk-GQ4JYQWC.js +0 -58
  95. package/dist/chunk-H3JNHCD7.cjs +0 -10
  96. package/dist/chunk-L2UUZRZI.js +0 -10
  97. package/dist/chunk-QOIY4Y6N.cjs +0 -9
  98. package/dist/chunk-QYKJKSKZ.cjs +0 -58
  99. package/dist/chunk-TPUJJJWA.js +0 -9
package/dist/ui.js ADDED
@@ -0,0 +1 @@
1
+ export{B as CellBackgroundPicker,a as ContextMenu,A as DEFAULT_CELL_COLORS,ha as InsertImageDialog,ra as InsertSymbolDialog,aa as InsertTableDialog,Ea as KeyboardShortcutsDialog,P as LoadingIndicator,ya as PasteSpecialDialog,q as PrintButton,r as PrintStyles,g as ResponsePreview,X as ResponsiveToolbar,Y as ResponsiveToolbarGroup,qa as SYMBOL_CATEGORIES,z as TableInsertButtons,y as TableMergeButton,k as TextContextMenu,J as UnsavedIndicator,ma as calculateFitDimensions,ea as clampTableConfig,D as createCellColorOption,O as createChangeTracker,ca as createDefaultTableConfig,j as createErrorResponse,i as createMockResponse,G as createShadingFromColor,Z as createToolbarItem,_ as createToolbarItems,na as dataUrlToBlob,V as delay,pa as formatFileSize,w as formatPrintPageRange,La as formatShortcutKeys,fa as formatTableDimensions,c as getActionShortcut,f as getAllActions,Ka as getAllCategories,N as getAllIndicatorPositions,M as getAllIndicatorVariants,U as getAllLoadingSizes,T as getAllLoadingVariants,Ba as getAllPasteOptions,Ja as getCategoryLabel,F as getCellColorName,H as getColorFromShading,Ia as getCommonShortcuts,I as getContrastingTextColor,e as getDefaultActions,C as getDefaultCellColors,Ca as getDefaultPasteOption,u as getDefaultPrintOptions,Ga as getDefaultShortcuts,o as getDefaultTextContextMenuItems,la as getImageAcceptString,oa as getImageDimensions,S as getLoadingVariantLabel,Aa as getPasteOption,$ as getRecommendedPriority,Ha as getShortcutsByCategory,ka as getSupportedImageExtensions,ta as getSymbolCategories,va as getSymbolUnicodeInfo,ua as getSymbolsByCategory,ga as getTablePresets,m as getTextActionLabel,n as getTextActionShortcut,L as getVariantLabel,d as isActionAvailable,E as isDefaultCellColor,Da as isPasteSpecialShortcut,x as isPrintSupported,p as isTextActionAvailable,ja as isValidImageFile,da as isValidTableConfig,t as openPrintWindow,v as parsePageRange,wa as searchSymbols,xa as symbolFromCodePoint,s as triggerPrint,b as useContextMenu,ia as useInsertImageDialog,sa as useInsertSymbolDialog,ba as useInsertTableDialog,Fa as useKeyboardShortcutsDialog,Q as useLoading,R as useLoadingOperations,za as usePasteSpecial,h as useResponsePreview,W as useResponsiveToolbar,l as useTextContextMenu,K as useUnsavedChanges}from'./chunk-6MBDPZVD.js';import'./chunk-EMKABJPH.js';export{i as AlignmentButtons,g as ColorPicker,b as FontPicker,f as FontSizePicker,O as HorizontalRuler,l as LineSpacingPicker,j as ListButtons,H as PageNavigator,z as PageNumberIndicator,m as StylePicker,p as TableBorderColorPicker,o as TableBorderPicker,q as TableBorderWidthPicker,r as TableCellFillPicker,s as TableMoreDropdown,T as TableToolbar,x as Toolbar,u as ToolbarButton,v as ToolbarGroup,w as ToolbarSeparator,y as VariablePanel,n as ZoomControl,Z as addColumn,X as addRow,N as calculateProgress,G as calculateScrollToPage,F as calculateVisiblePage,K as clampPageNumber,k as createDefaultListState,B as createPageFormat,U as createTableContext,_ as deleteColumn,Y as deleteRow,A as formatPageOrdinal,M as formatPageRange,W as getCellAt,V as getColumnCount,R as getMarginInUnits,L as getNavigationShortcuts,C as getPageProgress,Q as getRulerDimensions,D as isFirstPage,E as isLastPage,J as isValidPageNumber,$ as mergeCells,S as parseMarginFromUnits,I as parsePageInput,P as positionToMargin,aa as splitCell}from'./chunk-E6XDMUAM.js';export{d as HyperlinkDialog,m as useHyperlinkDialog}from'./chunk-PJVI53AH.js';import'./chunk-ZDYHAYN6.js';export{n as FindReplaceDialog,a as createDefaultFindOptions,c as createSearchPattern,b as escapeRegexString,d as findAllMatches,j as findInDocument,k as findInParagraph,i as getDefaultHighlightOptions,g as getMatchCountText,h as isEmptySearch,e as replaceAllInContent,f as replaceFirstInContent,l as scrollToMatch,m as useFindReplace}from'./chunk-KVAT5SVD.js';import'./chunk-3IYNTJO5.js';
@@ -0,0 +1,173 @@
1
+ import { h as Document, i as DocumentBody, P as Paragraph } from './agentApi-CbVUCZRu.cjs';
2
+
3
+ /**
4
+ * DOCX Repacker - Repack modified document into valid DOCX
5
+ *
6
+ * Takes a Document with modified content and creates a new DOCX file
7
+ * by updating document.xml while preserving all other files from
8
+ * the original ZIP archive.
9
+ *
10
+ * This ensures round-trip fidelity:
11
+ * - styles.xml, theme1.xml, fontTable.xml remain untouched
12
+ * - Media files preserved
13
+ * - Relationships preserved
14
+ * - Only document.xml is updated with new content
15
+ *
16
+ * OOXML Package Structure:
17
+ * - [Content_Types].xml - Content type declarations
18
+ * - _rels/.rels - Package relationships
19
+ * - word/document.xml - Main document (modified)
20
+ * - word/styles.xml - Styles (preserved)
21
+ * - word/theme/theme1.xml - Theme (preserved)
22
+ * - word/numbering.xml - Numbering (preserved)
23
+ * - word/fontTable.xml - Font table (preserved)
24
+ * - word/settings.xml - Settings (preserved)
25
+ * - word/header*.xml - Headers (preserved)
26
+ * - word/footer*.xml - Footers (preserved)
27
+ * - word/footnotes.xml - Footnotes (preserved)
28
+ * - word/endnotes.xml - Endnotes (preserved)
29
+ * - word/media/* - Media files (preserved)
30
+ * - word/_rels/document.xml.rels - Document relationships (preserved)
31
+ * - docProps/* - Document properties (preserved)
32
+ */
33
+
34
+ /**
35
+ * Options for repacking DOCX
36
+ */
37
+ interface RepackOptions {
38
+ /** Compression level (0-9, default: 6) */
39
+ compressionLevel?: number;
40
+ /** Whether to update modification date in docProps/core.xml */
41
+ updateModifiedDate?: boolean;
42
+ /** Custom modifier name for lastModifiedBy */
43
+ modifiedBy?: string;
44
+ }
45
+ /**
46
+ * Repack a Document into a valid DOCX file
47
+ *
48
+ * @param doc - Document with modified content
49
+ * @param options - Optional repack options
50
+ * @returns Promise resolving to DOCX as ArrayBuffer
51
+ * @throws Error if document has no original buffer for round-trip
52
+ */
53
+ declare function repackDocx(doc: Document, options?: RepackOptions): Promise<ArrayBuffer>;
54
+ /**
55
+ * Create a new DOCX from a Document (without requiring original buffer)
56
+ *
57
+ * @param doc - Document to serialize
58
+ * @returns Promise resolving to DOCX as ArrayBuffer
59
+ */
60
+ declare function createDocx(doc: Document): Promise<ArrayBuffer>;
61
+
62
+ /**
63
+ * Variable Detector Utility
64
+ *
65
+ * Scans a DOCX document for template variables in the format {variable_name}
66
+ * (standard docxtemplater syntax).
67
+ * Returns a unique, sorted list of variable names found in the document.
68
+ */
69
+
70
+ /**
71
+ * Result of variable detection
72
+ */
73
+ interface VariableDetectionResult {
74
+ /** Unique variable names sorted alphabetically */
75
+ variables: string[];
76
+ /** Total count of variable occurrences */
77
+ totalOccurrences: number;
78
+ /** Variables by location */
79
+ byLocation: {
80
+ body: string[];
81
+ headers: string[];
82
+ footers: string[];
83
+ footnotes: string[];
84
+ endnotes: string[];
85
+ textBoxes: string[];
86
+ };
87
+ /** Variable occurrences with positions */
88
+ occurrences: VariableOccurrence[];
89
+ }
90
+ /**
91
+ * A single variable occurrence with location info
92
+ */
93
+ interface VariableOccurrence {
94
+ /** Variable name (without braces) */
95
+ name: string;
96
+ /** Location type */
97
+ location: 'body' | 'header' | 'footer' | 'footnote' | 'endnote' | 'textBox';
98
+ /** Paragraph index within location */
99
+ paragraphIndex?: number;
100
+ /** Section index (for headers/footers) */
101
+ sectionIndex?: number;
102
+ }
103
+ /**
104
+ * Detect all template variables in a document
105
+ *
106
+ * @param doc - The parsed document
107
+ * @returns Array of unique variable names sorted alphabetically
108
+ */
109
+ declare function detectVariables(doc: Document): string[];
110
+ /**
111
+ * Detect variables with detailed information
112
+ *
113
+ * @param doc - The parsed document
114
+ * @returns Detailed detection result
115
+ */
116
+ declare function detectVariablesDetailed(doc: Document): VariableDetectionResult;
117
+ /**
118
+ * Detect variables in document body
119
+ */
120
+ declare function detectVariablesInBody(body: DocumentBody): string[];
121
+ /**
122
+ * Detect variables in a paragraph
123
+ */
124
+ declare function detectVariablesInParagraph(paragraph: Paragraph): string[];
125
+ /**
126
+ * Extract variable names from text
127
+ *
128
+ * @param text - The text to search
129
+ * @returns Array of variable names (without braces)
130
+ */
131
+ declare function extractVariablesFromText(text: string): string[];
132
+ /**
133
+ * Check if text contains template variables
134
+ */
135
+ declare function hasTemplateVariables(text: string): boolean;
136
+ /**
137
+ * Check if a variable name is valid
138
+ */
139
+ declare function isValidVariableName(name: string): boolean;
140
+ /**
141
+ * Sanitize a variable name
142
+ */
143
+ declare function sanitizeVariableName(name: string): string;
144
+ /**
145
+ * Format a variable name with braces (standard docxtemplater syntax)
146
+ */
147
+ declare function formatVariable(name: string): string;
148
+ /**
149
+ * Parse a variable string to get the name
150
+ */
151
+ declare function parseVariable(variable: string): string | null;
152
+ /**
153
+ * Replace variables in text with values
154
+ *
155
+ * @param text - The text containing variables
156
+ * @param values - Map of variable name to replacement value
157
+ * @returns Text with variables replaced
158
+ */
159
+ declare function replaceVariables(text: string, values: Record<string, string>): string;
160
+ /**
161
+ * Replace all variables in text with a placeholder
162
+ *
163
+ * @param text - The text containing variables
164
+ * @param placeholder - Placeholder to use (default: empty string)
165
+ * @returns Text with variables replaced
166
+ */
167
+ declare function removeVariables(text: string, placeholder?: string): string;
168
+ /**
169
+ * Check if document has any template variables
170
+ */
171
+ declare function documentHasVariables(doc: Document): boolean;
172
+
173
+ export { type VariableDetectionResult as V, type VariableOccurrence as a, detectVariablesDetailed as b, createDocx as c, detectVariables as d, detectVariablesInBody as e, detectVariablesInParagraph as f, documentHasVariables as g, extractVariablesFromText as h, formatVariable as i, hasTemplateVariables as j, isValidVariableName as k, repackDocx as l, replaceVariables as m, parseVariable as p, removeVariables as r, sanitizeVariableName as s };
@@ -0,0 +1,173 @@
1
+ import { h as Document, i as DocumentBody, P as Paragraph } from './agentApi-CbVUCZRu.js';
2
+
3
+ /**
4
+ * DOCX Repacker - Repack modified document into valid DOCX
5
+ *
6
+ * Takes a Document with modified content and creates a new DOCX file
7
+ * by updating document.xml while preserving all other files from
8
+ * the original ZIP archive.
9
+ *
10
+ * This ensures round-trip fidelity:
11
+ * - styles.xml, theme1.xml, fontTable.xml remain untouched
12
+ * - Media files preserved
13
+ * - Relationships preserved
14
+ * - Only document.xml is updated with new content
15
+ *
16
+ * OOXML Package Structure:
17
+ * - [Content_Types].xml - Content type declarations
18
+ * - _rels/.rels - Package relationships
19
+ * - word/document.xml - Main document (modified)
20
+ * - word/styles.xml - Styles (preserved)
21
+ * - word/theme/theme1.xml - Theme (preserved)
22
+ * - word/numbering.xml - Numbering (preserved)
23
+ * - word/fontTable.xml - Font table (preserved)
24
+ * - word/settings.xml - Settings (preserved)
25
+ * - word/header*.xml - Headers (preserved)
26
+ * - word/footer*.xml - Footers (preserved)
27
+ * - word/footnotes.xml - Footnotes (preserved)
28
+ * - word/endnotes.xml - Endnotes (preserved)
29
+ * - word/media/* - Media files (preserved)
30
+ * - word/_rels/document.xml.rels - Document relationships (preserved)
31
+ * - docProps/* - Document properties (preserved)
32
+ */
33
+
34
+ /**
35
+ * Options for repacking DOCX
36
+ */
37
+ interface RepackOptions {
38
+ /** Compression level (0-9, default: 6) */
39
+ compressionLevel?: number;
40
+ /** Whether to update modification date in docProps/core.xml */
41
+ updateModifiedDate?: boolean;
42
+ /** Custom modifier name for lastModifiedBy */
43
+ modifiedBy?: string;
44
+ }
45
+ /**
46
+ * Repack a Document into a valid DOCX file
47
+ *
48
+ * @param doc - Document with modified content
49
+ * @param options - Optional repack options
50
+ * @returns Promise resolving to DOCX as ArrayBuffer
51
+ * @throws Error if document has no original buffer for round-trip
52
+ */
53
+ declare function repackDocx(doc: Document, options?: RepackOptions): Promise<ArrayBuffer>;
54
+ /**
55
+ * Create a new DOCX from a Document (without requiring original buffer)
56
+ *
57
+ * @param doc - Document to serialize
58
+ * @returns Promise resolving to DOCX as ArrayBuffer
59
+ */
60
+ declare function createDocx(doc: Document): Promise<ArrayBuffer>;
61
+
62
+ /**
63
+ * Variable Detector Utility
64
+ *
65
+ * Scans a DOCX document for template variables in the format {variable_name}
66
+ * (standard docxtemplater syntax).
67
+ * Returns a unique, sorted list of variable names found in the document.
68
+ */
69
+
70
+ /**
71
+ * Result of variable detection
72
+ */
73
+ interface VariableDetectionResult {
74
+ /** Unique variable names sorted alphabetically */
75
+ variables: string[];
76
+ /** Total count of variable occurrences */
77
+ totalOccurrences: number;
78
+ /** Variables by location */
79
+ byLocation: {
80
+ body: string[];
81
+ headers: string[];
82
+ footers: string[];
83
+ footnotes: string[];
84
+ endnotes: string[];
85
+ textBoxes: string[];
86
+ };
87
+ /** Variable occurrences with positions */
88
+ occurrences: VariableOccurrence[];
89
+ }
90
+ /**
91
+ * A single variable occurrence with location info
92
+ */
93
+ interface VariableOccurrence {
94
+ /** Variable name (without braces) */
95
+ name: string;
96
+ /** Location type */
97
+ location: 'body' | 'header' | 'footer' | 'footnote' | 'endnote' | 'textBox';
98
+ /** Paragraph index within location */
99
+ paragraphIndex?: number;
100
+ /** Section index (for headers/footers) */
101
+ sectionIndex?: number;
102
+ }
103
+ /**
104
+ * Detect all template variables in a document
105
+ *
106
+ * @param doc - The parsed document
107
+ * @returns Array of unique variable names sorted alphabetically
108
+ */
109
+ declare function detectVariables(doc: Document): string[];
110
+ /**
111
+ * Detect variables with detailed information
112
+ *
113
+ * @param doc - The parsed document
114
+ * @returns Detailed detection result
115
+ */
116
+ declare function detectVariablesDetailed(doc: Document): VariableDetectionResult;
117
+ /**
118
+ * Detect variables in document body
119
+ */
120
+ declare function detectVariablesInBody(body: DocumentBody): string[];
121
+ /**
122
+ * Detect variables in a paragraph
123
+ */
124
+ declare function detectVariablesInParagraph(paragraph: Paragraph): string[];
125
+ /**
126
+ * Extract variable names from text
127
+ *
128
+ * @param text - The text to search
129
+ * @returns Array of variable names (without braces)
130
+ */
131
+ declare function extractVariablesFromText(text: string): string[];
132
+ /**
133
+ * Check if text contains template variables
134
+ */
135
+ declare function hasTemplateVariables(text: string): boolean;
136
+ /**
137
+ * Check if a variable name is valid
138
+ */
139
+ declare function isValidVariableName(name: string): boolean;
140
+ /**
141
+ * Sanitize a variable name
142
+ */
143
+ declare function sanitizeVariableName(name: string): string;
144
+ /**
145
+ * Format a variable name with braces (standard docxtemplater syntax)
146
+ */
147
+ declare function formatVariable(name: string): string;
148
+ /**
149
+ * Parse a variable string to get the name
150
+ */
151
+ declare function parseVariable(variable: string): string | null;
152
+ /**
153
+ * Replace variables in text with values
154
+ *
155
+ * @param text - The text containing variables
156
+ * @param values - Map of variable name to replacement value
157
+ * @returns Text with variables replaced
158
+ */
159
+ declare function replaceVariables(text: string, values: Record<string, string>): string;
160
+ /**
161
+ * Replace all variables in text with a placeholder
162
+ *
163
+ * @param text - The text containing variables
164
+ * @param placeholder - Placeholder to use (default: empty string)
165
+ * @returns Text with variables replaced
166
+ */
167
+ declare function removeVariables(text: string, placeholder?: string): string;
168
+ /**
169
+ * Check if document has any template variables
170
+ */
171
+ declare function documentHasVariables(doc: Document): boolean;
172
+
173
+ export { type VariableDetectionResult as V, type VariableOccurrence as a, detectVariablesDetailed as b, createDocx as c, detectVariables as d, detectVariablesInBody as e, detectVariablesInParagraph as f, documentHasVariables as g, extractVariablesFromText as h, formatVariable as i, hasTemplateVariables as j, isValidVariableName as k, repackDocx as l, replaceVariables as m, parseVariable as p, removeVariables as r, sanitizeVariableName as s };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eigenpal/docx-js-editor",
3
- "version": "0.0.11",
3
+ "version": "0.0.13",
4
4
  "description": "A browser-based DOCX template editor with variable insertion support",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",
@@ -12,6 +12,21 @@
12
12
  "import": "./dist/index.js",
13
13
  "require": "./dist/index.cjs"
14
14
  },
15
+ "./core": {
16
+ "types": "./dist/core.d.ts",
17
+ "import": "./dist/core.js",
18
+ "require": "./dist/core.cjs"
19
+ },
20
+ "./react": {
21
+ "types": "./dist/react.d.ts",
22
+ "import": "./dist/react.js",
23
+ "require": "./dist/react.cjs"
24
+ },
25
+ "./ui": {
26
+ "types": "./dist/ui.d.ts",
27
+ "import": "./dist/ui.js",
28
+ "require": "./dist/ui.cjs"
29
+ },
15
30
  "./headless": {
16
31
  "types": "./dist/headless.d.ts",
17
32
  "import": "./dist/headless.js",
@@ -29,9 +44,34 @@
29
44
  },
30
45
  "./styles.css": "./dist/styles.css"
31
46
  },
47
+ "typesVersions": {
48
+ "*": {
49
+ "core": [
50
+ "./dist/core.d.ts"
51
+ ],
52
+ "react": [
53
+ "./dist/react.d.ts"
54
+ ],
55
+ "ui": [
56
+ "./dist/ui.d.ts"
57
+ ],
58
+ "headless": [
59
+ "./dist/headless.d.ts"
60
+ ],
61
+ "core-plugins": [
62
+ "./dist/core-plugins.d.ts"
63
+ ],
64
+ "mcp": [
65
+ "./dist/mcp.d.ts"
66
+ ]
67
+ }
68
+ },
32
69
  "bin": {
33
70
  "docx-editor-mcp": "./dist/mcp-cli.js"
34
71
  },
72
+ "sideEffects": [
73
+ "*.css"
74
+ ],
35
75
  "files": [
36
76
  "dist"
37
77
  ],
@@ -56,11 +96,20 @@
56
96
  "lint:fix": "eslint src/ --fix",
57
97
  "format": "prettier --write \"src/**/*.{ts,tsx,js,jsx,json,css}\"",
58
98
  "format:check": "prettier --check \"src/**/*.{ts,tsx,js,jsx,json,css}\"",
99
+ "size": "size-limit",
59
100
  "prepare": "husky"
60
101
  },
61
102
  "peerDependencies": {
62
103
  "react": "^18.0.0 || ^19.0.0",
63
- "react-dom": "^18.0.0 || ^19.0.0"
104
+ "react-dom": "^18.0.0 || ^19.0.0",
105
+ "prosemirror-commands": "^1.5.2",
106
+ "prosemirror-dropcursor": "^1.8.2",
107
+ "prosemirror-history": "^1.4.0",
108
+ "prosemirror-keymap": "^1.2.2",
109
+ "prosemirror-model": "^1.19.4",
110
+ "prosemirror-state": "^1.4.3",
111
+ "prosemirror-tables": "^1.8.5",
112
+ "prosemirror-view": "^1.32.7"
64
113
  },
65
114
  "peerDependenciesMeta": {
66
115
  "react": {
@@ -68,6 +117,30 @@
68
117
  },
69
118
  "react-dom": {
70
119
  "optional": true
120
+ },
121
+ "prosemirror-commands": {
122
+ "optional": true
123
+ },
124
+ "prosemirror-dropcursor": {
125
+ "optional": true
126
+ },
127
+ "prosemirror-history": {
128
+ "optional": true
129
+ },
130
+ "prosemirror-keymap": {
131
+ "optional": true
132
+ },
133
+ "prosemirror-model": {
134
+ "optional": true
135
+ },
136
+ "prosemirror-state": {
137
+ "optional": true
138
+ },
139
+ "prosemirror-tables": {
140
+ "optional": true
141
+ },
142
+ "prosemirror-view": {
143
+ "optional": true
71
144
  }
72
145
  },
73
146
  "dependencies": {
@@ -76,19 +149,12 @@
76
149
  "docxtemplater": "^3.50.0",
77
150
  "jszip": "^3.10.1",
78
151
  "pizzip": "^3.1.7",
79
- "prosemirror-commands": "^1.5.2",
80
- "prosemirror-dropcursor": "^1.8.2",
81
- "prosemirror-history": "^1.4.0",
82
- "prosemirror-keymap": "^1.2.2",
83
- "prosemirror-model": "^1.19.4",
84
- "prosemirror-state": "^1.4.3",
85
- "prosemirror-tables": "^1.8.5",
86
- "prosemirror-view": "^1.32.7",
87
152
  "xml-js": "^1.6.11"
88
153
  },
89
154
  "devDependencies": {
90
155
  "@happy-dom/global-registrator": "^13.3.8",
91
156
  "@playwright/test": "^1.58.1",
157
+ "@size-limit/file": "^12.0.0",
92
158
  "@testing-library/react": "^16.0.0",
93
159
  "@types/bun": "^1.0.0",
94
160
  "@types/react": "19.0.8",
@@ -105,8 +171,17 @@
105
171
  "lint-staged": "^16.2.7",
106
172
  "postcss": "^8.4.33",
107
173
  "prettier": "^3.8.1",
174
+ "prosemirror-commands": "^1.5.2",
175
+ "prosemirror-dropcursor": "^1.8.2",
176
+ "prosemirror-history": "^1.4.0",
177
+ "prosemirror-keymap": "^1.2.2",
178
+ "prosemirror-model": "^1.19.4",
179
+ "prosemirror-state": "^1.4.3",
180
+ "prosemirror-tables": "^1.8.5",
181
+ "prosemirror-view": "^1.32.7",
108
182
  "react": "^19.0.0",
109
183
  "react-dom": "^19.0.0",
184
+ "size-limit": "^12.0.0",
110
185
  "tailwindcss": "^3.4.1",
111
186
  "tailwindcss-animate": "^1.0.7",
112
187
  "tsup": "^8.0.1",