@zeke-02/docx-editor 0.5.1 → 0.5.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +204 -0
- package/dist/FindReplaceDialog-7SQOVQWH.js +1 -0
- package/dist/FindReplaceDialog-RK3A7MSK.mjs +1 -0
- package/dist/{FootnotePropertiesDialog-XQ7NIFIU.js → FootnotePropertiesDialog-2Q2SHVMR.js} +1 -1
- package/dist/{FootnotePropertiesDialog-TNVJJCY6.mjs → FootnotePropertiesDialog-ZKQXW3YO.mjs} +1 -1
- package/dist/{HyperlinkDialog-FR4IZZ7E.mjs → HyperlinkDialog-QV3CVFQU.mjs} +1 -1
- package/dist/HyperlinkDialog-XVAF7FVN.js +1 -0
- package/dist/{ImagePositionDialog-JSZSIKF5.mjs → ImagePositionDialog-EGRH3HPP.mjs} +1 -1
- package/dist/{ImagePositionDialog-2YXRAGZS.js → ImagePositionDialog-HIVHUTBT.js} +1 -1
- package/dist/ImagePropertiesDialog-67WLFIIZ.mjs +1 -0
- package/dist/ImagePropertiesDialog-HSM3JJ22.js +1 -0
- package/dist/KeyboardShortcutsDialog-5D_FoAp6.d.ts +395 -0
- package/dist/KeyboardShortcutsDialog-D7ihAj18.d.mts +395 -0
- package/dist/PageSetupDialog-642IAVG2.js +1 -0
- package/dist/PageSetupDialog-ERUQDHAY.mjs +1 -0
- package/dist/{SplitCellDialog-NP3JJYHD.mjs → SplitCellDialog-GFWCFCTD.mjs} +1 -1
- package/dist/{SplitCellDialog-JIAC3RYV.js → SplitCellDialog-M7WF7ANE.js} +1 -1
- package/dist/{TablePropertiesDialog-TIK4AA5M.mjs → TablePropertiesDialog-TZ7VCL6V.mjs} +1 -1
- package/dist/{TablePropertiesDialog-T7D4HSVP.js → TablePropertiesDialog-ZKU2FTUX.js} +1 -1
- package/dist/agentApi-C41hiW-n.d.mts +486 -0
- package/dist/agentApi-D4AZmNfB.d.ts +486 -0
- package/dist/chunk-2XXILKEQ.js +1 -0
- package/dist/chunk-35DG3R42.js +2 -0
- package/dist/chunk-47VJOBJD.mjs +60 -0
- package/dist/chunk-5UX5CD4C.js +1 -0
- package/dist/chunk-7QQSDIWK.mjs +2 -0
- package/dist/chunk-AW5TISUL.js +3 -0
- package/dist/chunk-AYMGSTNG.js +1 -0
- package/dist/chunk-B45ECEGY.js +18 -0
- package/dist/chunk-B7CCL7SL.mjs +2 -0
- package/dist/chunk-BRMTZRLJ.js +2 -0
- package/dist/chunk-D47GTKGU.js +2 -0
- package/dist/chunk-E6MQXELR.js +1 -0
- package/dist/chunk-F5SERL7X.mjs +2 -0
- package/dist/chunk-FWPVBFKQ.mjs +1 -0
- package/dist/chunk-GGQK26JO.js +2 -0
- package/dist/chunk-GM2S2WMT.mjs +1 -0
- package/dist/chunk-ILYKDR3C.js +1 -0
- package/dist/chunk-IP5NAYHL.js +60 -0
- package/dist/chunk-JPF5R2ZM.mjs +1 -0
- package/dist/chunk-KOXCF3CL.mjs +1 -0
- package/dist/chunk-KRLNX56Y.mjs +2 -0
- package/dist/chunk-LUJ6HCMH.mjs +1 -0
- package/dist/chunk-MKNSJOCN.js +70 -0
- package/dist/chunk-NIBCC7WQ.js +1 -0
- package/dist/chunk-NLFXR2VH.js +2 -0
- package/dist/chunk-ONIYA2FU.mjs +2 -0
- package/dist/chunk-ONNHQWAX.mjs +1 -0
- package/dist/chunk-RCIZ7OM3.mjs +70 -0
- package/dist/{chunk-EHFEG3TX.js → chunk-SNZ57XBI.js} +1 -1
- package/dist/chunk-SOTWG3KJ.mjs +1 -0
- package/dist/chunk-TYPGB4KF.js +1 -0
- package/dist/chunk-U7ZW2DOO.mjs +2 -0
- package/dist/{chunk-PKEOQIQO.mjs → chunk-WPI3YRFO.mjs} +1 -1
- package/dist/chunk-XQZTWWRF.mjs +18 -0
- package/dist/chunk-ZVAFVHWR.mjs +3 -0
- package/dist/chunk-ZXPCJWVY.js +2 -0
- package/dist/{agentApi-DLt94vXk.d.mts → content-B2MzIMwA.d.mts} +8 -755
- package/dist/{agentApi-DLt94vXk.d.ts → content-B2MzIMwA.d.ts} +8 -755
- package/dist/dialogs.d.mts +25 -0
- package/dist/dialogs.d.ts +25 -0
- package/dist/dialogs.js +1 -0
- package/dist/dialogs.mjs +1 -0
- package/dist/document-DZ_ZeZEH.d.ts +294 -0
- package/dist/document-Di1qGqLS.d.mts +294 -0
- package/dist/executor-EPEB53SJ.js +1 -0
- package/dist/executor-TVJ6K6MW.mjs +1 -0
- package/dist/findReplace-CpIoILbP.d.mts +138 -0
- package/dist/findReplace-pkMskVJU.d.ts +138 -0
- package/dist/hooks.d.mts +598 -0
- package/dist/hooks.d.ts +598 -0
- package/dist/hooks.js +1 -0
- package/dist/hooks.mjs +1 -0
- package/dist/index.d.mts +1013 -483
- package/dist/index.d.ts +1013 -483
- package/dist/index.js +40 -120
- package/dist/index.mjs +40 -120
- package/dist/layout-bridge-5GYGYKM5.mjs +1 -0
- package/dist/layout-bridge-QQDA7ELH.js +1 -0
- package/dist/plugin-api.d.mts +176 -0
- package/dist/plugin-api.d.ts +176 -0
- package/dist/plugin-api.js +260 -0
- package/dist/plugin-api.mjs +260 -0
- package/dist/processTemplate-BTBTR7AM.js +1 -0
- package/dist/{processTemplate-W2C5PXZB.mjs → processTemplate-MBX2KDLE.mjs} +1 -1
- package/dist/styles.css +1 -1
- package/dist/styles.d.mts +18 -0
- package/dist/styles.d.ts +18 -0
- package/dist/styles.js +1 -0
- package/dist/styles.mjs +1 -0
- package/dist/types-Bd_YzkhG.d.mts +281 -0
- package/dist/types-Bd_YzkhG.d.ts +281 -0
- package/dist/types-CkfDgB0O.d.mts +39 -0
- package/dist/types-DZUhB7Ao.d.mts +18 -0
- package/dist/types-DZUhB7Ao.d.ts +18 -0
- package/dist/types-DcxHFUSc.d.ts +39 -0
- package/dist/ui.d.mts +111 -552
- package/dist/ui.d.ts +111 -552
- package/dist/ui.js +111 -1
- package/dist/ui.mjs +111 -1
- package/dist/useFindReplace-DDs533b-.d.mts +261 -0
- package/dist/useFindReplace-eyhMSZZf.d.ts +261 -0
- package/package.json +41 -43
- package/dist/ClipboardManager-CVKX0v9q.d.ts +0 -464
- package/dist/ClipboardManager-V3aaMnWE.d.mts +0 -464
- package/dist/DocumentAgent-BWflKHpH.d.mts +0 -442
- package/dist/DocumentAgent-DsdXtetF.d.ts +0 -442
- package/dist/FindReplaceDialog-L3YF5HIS.mjs +0 -1
- package/dist/FindReplaceDialog-SEBWC5P7.js +0 -1
- package/dist/HyperlinkDialog-WEK6JSAC.js +0 -1
- package/dist/ImagePropertiesDialog-527MFLQO.mjs +0 -1
- package/dist/ImagePropertiesDialog-HG4K3IE7.js +0 -1
- package/dist/PageSetupDialog-GALVJMUB.js +0 -1
- package/dist/PageSetupDialog-TGQIAMI7.mjs +0 -1
- package/dist/TableToolbar-DUgmob2I.d.ts +0 -1273
- package/dist/TableToolbar-YL74HNS1.d.mts +0 -1273
- package/dist/chunk-23SXXIZS.js +0 -111
- package/dist/chunk-3F52AP2Q.js +0 -1
- package/dist/chunk-42O5GXM5.mjs +0 -82
- package/dist/chunk-54ULJEHM.mjs +0 -1
- package/dist/chunk-5XK326FI.mjs +0 -1
- package/dist/chunk-6WPRCJ5A.mjs +0 -1
- package/dist/chunk-76IYR7C7.mjs +0 -1
- package/dist/chunk-7BG7QY7I.js +0 -182
- package/dist/chunk-AGRIVA4G.js +0 -1
- package/dist/chunk-BTCQ2QI3.mjs +0 -3
- package/dist/chunk-BUEMG4NW.js +0 -1
- package/dist/chunk-BXRC4U3X.mjs +0 -2
- package/dist/chunk-CPAYKE6X.mjs +0 -1
- package/dist/chunk-DACWLFKI.mjs +0 -1
- package/dist/chunk-EPBFWE36.js +0 -2
- package/dist/chunk-FXES3YDB.js +0 -82
- package/dist/chunk-HI66BSGS.mjs +0 -9
- package/dist/chunk-INTPVEO6.mjs +0 -9
- package/dist/chunk-IOAGVW6Q.mjs +0 -2
- package/dist/chunk-JCEWC5QL.mjs +0 -4
- package/dist/chunk-JTIUFACT.js +0 -1
- package/dist/chunk-KUTCCI4X.mjs +0 -182
- package/dist/chunk-LUF7PWIC.js +0 -10
- package/dist/chunk-MGEN6GOE.mjs +0 -2
- package/dist/chunk-MOE2ZGUE.js +0 -18
- package/dist/chunk-MWLHJWB6.js +0 -9
- package/dist/chunk-OFYVDN3U.mjs +0 -2
- package/dist/chunk-P4VSHBGZ.js +0 -2
- package/dist/chunk-P5FQHIES.mjs +0 -1
- package/dist/chunk-PBC7XAYZ.js +0 -3
- package/dist/chunk-PEMB6SZT.js +0 -2
- package/dist/chunk-PQMSZTBB.js +0 -9
- package/dist/chunk-Q7UDQXAF.js +0 -1
- package/dist/chunk-QGTAIC5E.js +0 -1
- package/dist/chunk-QVPR2W5S.js +0 -1
- package/dist/chunk-R3QMYPL5.mjs +0 -59
- package/dist/chunk-RBUTXXQJ.mjs +0 -18
- package/dist/chunk-RRWYZ2TS.mjs +0 -111
- package/dist/chunk-SFUM35DH.js +0 -2
- package/dist/chunk-SNLC6EK2.js +0 -1
- package/dist/chunk-TMTLIGLZ.js +0 -59
- package/dist/chunk-TSE2PWFX.mjs +0 -10
- package/dist/chunk-UWYD42WV.js +0 -4
- package/dist/chunk-UXVACQCY.mjs +0 -1
- package/dist/chunk-W4EIKDM6.mjs +0 -2
- package/dist/chunk-W53SI3XW.mjs +0 -1
- package/dist/chunk-WNS2RBQD.js +0 -2
- package/dist/chunk-Z3KMSHUP.js +0 -1
- package/dist/core-plugins-reexport.d.mts +0 -31
- package/dist/core-plugins-reexport.d.ts +0 -31
- package/dist/core-plugins-reexport.js +0 -1
- package/dist/core-plugins-reexport.mjs +0 -1
- package/dist/core-reexport.d.mts +0 -340
- package/dist/core-reexport.d.ts +0 -340
- package/dist/core-reexport.js +0 -1
- package/dist/core-reexport.mjs +0 -1
- package/dist/documentSerializer-DtS_-oGA.d.mts +0 -664
- package/dist/documentSerializer-Wj1p2ASa.d.ts +0 -664
- package/dist/executor-C3VXF7QA.mjs +0 -1
- package/dist/executor-GDBV3AGV.js +0 -1
- package/dist/headless-reexport.d.mts +0 -197
- package/dist/headless-reexport.d.ts +0 -197
- package/dist/headless-reexport.js +0 -1
- package/dist/headless-reexport.mjs +0 -1
- package/dist/insertOperations-BTH1Asas.d.mts +0 -176
- package/dist/insertOperations-CbUnXAXH.d.ts +0 -176
- package/dist/layout-bridge-EA4DJ227.js +0 -1
- package/dist/layout-bridge-XDPSO6GO.mjs +0 -1
- package/dist/mcp-reexport.d.mts +0 -156
- package/dist/mcp-reexport.d.ts +0 -156
- package/dist/mcp-reexport.js +0 -16
- package/dist/mcp-reexport.mjs +0 -16
- package/dist/processTemplate-MJ2PCSO5.js +0 -1
- package/dist/react-B0W16SV6.d.ts +0 -1330
- package/dist/react-D0Pn1nww.d.mts +0 -1330
- package/dist/react.css +0 -1
- package/dist/react.d.mts +0 -10
- package/dist/react.d.ts +0 -10
- package/dist/react.js +0 -1
- package/dist/react.mjs +0 -1
- package/dist/registry-CH9V-IX0.d.ts +0 -165
- package/dist/registry-CWBKYlNW.d.mts +0 -165
- package/dist/types-UDsUq8D3.d.mts +0 -310
- package/dist/types-jbivc9Lj.d.ts +0 -310
- package/dist/variableDetector-CdQ7ZTzA.d.mts +0 -204
- package/dist/variableDetector-DsRV3A9z.d.ts +0 -204
- package/i18n/de.json +0 -792
- package/i18n/en.json +0 -792
- package/i18n/he.json +0 -792
- package/i18n/pl.json +0 -792
- package/i18n/pt-BR.json +0 -792
- package/i18n/tr.json +0 -792
- package/i18n/zh-CN.json +0 -792
- /package/dist/{chunk-YC5KZSYD.js → chunk-ESZ6JRTW.js} +0 -0
- /package/dist/{chunk-LVGJKS7Y.mjs → chunk-TZMMD6RR.mjs} +0 -0
|
@@ -0,0 +1,486 @@
|
|
|
1
|
+
import React__default, { CSSProperties } from 'react';
|
|
2
|
+
import { T as TextFormatting, P as ParagraphFormatting } from './content-B2MzIMwA.mjs';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Shared FontOption shape + normaliser used by FontPicker components
|
|
6
|
+
* in both adapters. Lifted from packages/react/src/components/ui/
|
|
7
|
+
* normalizeFontFamilies.ts so the type definition has a single home.
|
|
8
|
+
*/
|
|
9
|
+
interface FontOption {
|
|
10
|
+
name: string;
|
|
11
|
+
fontFamily: string;
|
|
12
|
+
category?: 'sans-serif' | 'serif' | 'monospace' | 'other';
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Print Utilities
|
|
17
|
+
*
|
|
18
|
+
* Provides print functionality with:
|
|
19
|
+
* - Print button component for toolbar
|
|
20
|
+
* - Print-specific CSS styles
|
|
21
|
+
* - Browser print dialog trigger
|
|
22
|
+
* - Page range utilities
|
|
23
|
+
*/
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Print options
|
|
27
|
+
*/
|
|
28
|
+
interface PrintOptions {
|
|
29
|
+
/** Whether to include headers */
|
|
30
|
+
includeHeaders?: boolean;
|
|
31
|
+
/** Whether to include footers */
|
|
32
|
+
includeFooters?: boolean;
|
|
33
|
+
/** Whether to include page numbers */
|
|
34
|
+
includePageNumbers?: boolean;
|
|
35
|
+
/** Page range to print (null = all) */
|
|
36
|
+
pageRange?: {
|
|
37
|
+
start: number;
|
|
38
|
+
end: number;
|
|
39
|
+
} | null;
|
|
40
|
+
/** Scale factor for printing (1.0 = 100%) */
|
|
41
|
+
scale?: number;
|
|
42
|
+
/** Whether to show background colors */
|
|
43
|
+
printBackground?: boolean;
|
|
44
|
+
/** Margins mode */
|
|
45
|
+
margins?: 'default' | 'none' | 'minimum';
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* PrintButton props
|
|
49
|
+
*/
|
|
50
|
+
interface PrintButtonProps {
|
|
51
|
+
/** Callback when print is triggered */
|
|
52
|
+
onPrint: () => void;
|
|
53
|
+
/** Whether the button is disabled */
|
|
54
|
+
disabled?: boolean;
|
|
55
|
+
/** Button label */
|
|
56
|
+
label?: string;
|
|
57
|
+
/** Additional CSS class */
|
|
58
|
+
className?: string;
|
|
59
|
+
/** Additional inline styles */
|
|
60
|
+
style?: CSSProperties;
|
|
61
|
+
/** Show icon */
|
|
62
|
+
showIcon?: boolean;
|
|
63
|
+
/** Compact mode */
|
|
64
|
+
compact?: boolean;
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* PrintButton - Standalone print button for toolbar
|
|
68
|
+
*/
|
|
69
|
+
declare function PrintButton({ onPrint, disabled, label: labelProp, className, style, showIcon, compact, }: PrintButtonProps): React__default.ReactElement;
|
|
70
|
+
/**
|
|
71
|
+
* PrintStyles - Injects print-specific CSS
|
|
72
|
+
*/
|
|
73
|
+
declare function PrintStyles(): React__default.ReactElement;
|
|
74
|
+
/**
|
|
75
|
+
* Trigger browser print dialog for the current document
|
|
76
|
+
*/
|
|
77
|
+
declare function triggerPrint(): void;
|
|
78
|
+
/**
|
|
79
|
+
* Create print-optimized document view in a new window
|
|
80
|
+
*/
|
|
81
|
+
declare function openPrintWindow(title: string | undefined, content: string): Window | null;
|
|
82
|
+
/**
|
|
83
|
+
* Get default print options
|
|
84
|
+
*/
|
|
85
|
+
declare function getDefaultPrintOptions(): PrintOptions;
|
|
86
|
+
/**
|
|
87
|
+
* Create page range from string (e.g., "1-5", "3", "1,3,5")
|
|
88
|
+
*/
|
|
89
|
+
declare function parsePageRange(input: string, maxPages: number): {
|
|
90
|
+
start: number;
|
|
91
|
+
end: number;
|
|
92
|
+
} | null;
|
|
93
|
+
/**
|
|
94
|
+
* Format page range for display
|
|
95
|
+
*/
|
|
96
|
+
declare function formatPageRange(range: {
|
|
97
|
+
start: number;
|
|
98
|
+
end: number;
|
|
99
|
+
} | null, totalPages: number): string;
|
|
100
|
+
/**
|
|
101
|
+
* Check if browser supports good print functionality
|
|
102
|
+
*/
|
|
103
|
+
declare function isPrintSupported(): boolean;
|
|
104
|
+
|
|
105
|
+
/**
|
|
106
|
+
* Agent API Types
|
|
107
|
+
*
|
|
108
|
+
* TypeScript interfaces for the agent API:
|
|
109
|
+
* - Position and Range types
|
|
110
|
+
* - Command types for document manipulation
|
|
111
|
+
* - Context types for AI agents
|
|
112
|
+
*/
|
|
113
|
+
|
|
114
|
+
/**
|
|
115
|
+
* Position within a document
|
|
116
|
+
*/
|
|
117
|
+
interface Position {
|
|
118
|
+
/** Index of the paragraph (0-indexed) */
|
|
119
|
+
paragraphIndex: number;
|
|
120
|
+
/** Offset within the paragraph in characters */
|
|
121
|
+
offset: number;
|
|
122
|
+
/** Optional: Content index within paragraph (run, hyperlink, etc.) */
|
|
123
|
+
contentIndex?: number;
|
|
124
|
+
/** Optional: Section index */
|
|
125
|
+
sectionIndex?: number;
|
|
126
|
+
}
|
|
127
|
+
/**
|
|
128
|
+
* Range within a document
|
|
129
|
+
*/
|
|
130
|
+
interface Range {
|
|
131
|
+
/** Start position */
|
|
132
|
+
start: Position;
|
|
133
|
+
/** End position */
|
|
134
|
+
end: Position;
|
|
135
|
+
/** Whether the range is collapsed (cursor position) */
|
|
136
|
+
collapsed?: boolean;
|
|
137
|
+
}
|
|
138
|
+
/**
|
|
139
|
+
* Base command interface
|
|
140
|
+
*/
|
|
141
|
+
interface BaseCommand {
|
|
142
|
+
/** Command type */
|
|
143
|
+
type: string;
|
|
144
|
+
/** Unique command ID (for undo tracking) */
|
|
145
|
+
id?: string;
|
|
146
|
+
}
|
|
147
|
+
/**
|
|
148
|
+
* Insert text at a position
|
|
149
|
+
*/
|
|
150
|
+
interface InsertTextCommand extends BaseCommand {
|
|
151
|
+
type: 'insertText';
|
|
152
|
+
/** Position to insert at */
|
|
153
|
+
position: Position;
|
|
154
|
+
/** Text to insert */
|
|
155
|
+
text: string;
|
|
156
|
+
/** Optional formatting for the inserted text */
|
|
157
|
+
formatting?: TextFormatting;
|
|
158
|
+
}
|
|
159
|
+
/**
|
|
160
|
+
* Replace text in a range
|
|
161
|
+
*/
|
|
162
|
+
interface ReplaceTextCommand extends BaseCommand {
|
|
163
|
+
type: 'replaceText';
|
|
164
|
+
/** Range to replace */
|
|
165
|
+
range: Range;
|
|
166
|
+
/** Replacement text */
|
|
167
|
+
text: string;
|
|
168
|
+
/** Optional formatting for the new text */
|
|
169
|
+
formatting?: TextFormatting;
|
|
170
|
+
}
|
|
171
|
+
/**
|
|
172
|
+
* Delete text in a range
|
|
173
|
+
*/
|
|
174
|
+
interface DeleteTextCommand extends BaseCommand {
|
|
175
|
+
type: 'deleteText';
|
|
176
|
+
/** Range to delete */
|
|
177
|
+
range: Range;
|
|
178
|
+
}
|
|
179
|
+
/**
|
|
180
|
+
* Apply formatting to a range
|
|
181
|
+
*/
|
|
182
|
+
interface FormatTextCommand extends BaseCommand {
|
|
183
|
+
type: 'formatText';
|
|
184
|
+
/** Range to format */
|
|
185
|
+
range: Range;
|
|
186
|
+
/** Formatting to apply */
|
|
187
|
+
formatting: Partial<TextFormatting>;
|
|
188
|
+
}
|
|
189
|
+
/**
|
|
190
|
+
* Apply paragraph formatting
|
|
191
|
+
*/
|
|
192
|
+
interface FormatParagraphCommand extends BaseCommand {
|
|
193
|
+
type: 'formatParagraph';
|
|
194
|
+
/** Paragraph index */
|
|
195
|
+
paragraphIndex: number;
|
|
196
|
+
/** Formatting to apply */
|
|
197
|
+
formatting: Partial<ParagraphFormatting>;
|
|
198
|
+
}
|
|
199
|
+
/**
|
|
200
|
+
* Apply a named style to a paragraph
|
|
201
|
+
*/
|
|
202
|
+
interface ApplyStyleCommand extends BaseCommand {
|
|
203
|
+
type: 'applyStyle';
|
|
204
|
+
/** Paragraph index */
|
|
205
|
+
paragraphIndex: number;
|
|
206
|
+
/** Style ID to apply */
|
|
207
|
+
styleId: string;
|
|
208
|
+
}
|
|
209
|
+
/**
|
|
210
|
+
* Insert a table at a position
|
|
211
|
+
*/
|
|
212
|
+
interface InsertTableCommand extends BaseCommand {
|
|
213
|
+
type: 'insertTable';
|
|
214
|
+
/** Position to insert at */
|
|
215
|
+
position: Position;
|
|
216
|
+
/** Number of rows */
|
|
217
|
+
rows: number;
|
|
218
|
+
/** Number of columns */
|
|
219
|
+
columns: number;
|
|
220
|
+
/** Optional table data */
|
|
221
|
+
data?: string[][];
|
|
222
|
+
/** Optional header row */
|
|
223
|
+
hasHeader?: boolean;
|
|
224
|
+
}
|
|
225
|
+
/**
|
|
226
|
+
* Insert an image at a position
|
|
227
|
+
*/
|
|
228
|
+
interface InsertImageCommand extends BaseCommand {
|
|
229
|
+
type: 'insertImage';
|
|
230
|
+
/** Position to insert at */
|
|
231
|
+
position: Position;
|
|
232
|
+
/** Image source (base64 or URL) */
|
|
233
|
+
src: string;
|
|
234
|
+
/** Image width in pixels */
|
|
235
|
+
width?: number;
|
|
236
|
+
/** Image height in pixels */
|
|
237
|
+
height?: number;
|
|
238
|
+
/** Alt text */
|
|
239
|
+
alt?: string;
|
|
240
|
+
}
|
|
241
|
+
/**
|
|
242
|
+
* Insert a hyperlink at a range
|
|
243
|
+
*/
|
|
244
|
+
interface InsertHyperlinkCommand extends BaseCommand {
|
|
245
|
+
type: 'insertHyperlink';
|
|
246
|
+
/** Range to make into a hyperlink */
|
|
247
|
+
range: Range;
|
|
248
|
+
/** URL of the hyperlink */
|
|
249
|
+
url: string;
|
|
250
|
+
/** Display text (replaces range text if provided) */
|
|
251
|
+
displayText?: string;
|
|
252
|
+
/** Tooltip */
|
|
253
|
+
tooltip?: string;
|
|
254
|
+
}
|
|
255
|
+
/**
|
|
256
|
+
* Remove a hyperlink but keep the text
|
|
257
|
+
*/
|
|
258
|
+
interface RemoveHyperlinkCommand extends BaseCommand {
|
|
259
|
+
type: 'removeHyperlink';
|
|
260
|
+
/** Range containing the hyperlink */
|
|
261
|
+
range: Range;
|
|
262
|
+
}
|
|
263
|
+
/**
|
|
264
|
+
* Insert a paragraph break
|
|
265
|
+
*/
|
|
266
|
+
interface InsertParagraphBreakCommand extends BaseCommand {
|
|
267
|
+
type: 'insertParagraphBreak';
|
|
268
|
+
/** Position to break at */
|
|
269
|
+
position: Position;
|
|
270
|
+
}
|
|
271
|
+
/**
|
|
272
|
+
* Merge paragraphs
|
|
273
|
+
*/
|
|
274
|
+
interface MergeParagraphsCommand extends BaseCommand {
|
|
275
|
+
type: 'mergeParagraphs';
|
|
276
|
+
/** First paragraph index */
|
|
277
|
+
paragraphIndex: number;
|
|
278
|
+
/** Number of paragraphs to merge with */
|
|
279
|
+
count: number;
|
|
280
|
+
}
|
|
281
|
+
/**
|
|
282
|
+
* Split a paragraph
|
|
283
|
+
*/
|
|
284
|
+
interface SplitParagraphCommand extends BaseCommand {
|
|
285
|
+
type: 'splitParagraph';
|
|
286
|
+
/** Position to split at */
|
|
287
|
+
position: Position;
|
|
288
|
+
}
|
|
289
|
+
/**
|
|
290
|
+
* Set template variable value
|
|
291
|
+
*/
|
|
292
|
+
interface SetVariableCommand extends BaseCommand {
|
|
293
|
+
type: 'setVariable';
|
|
294
|
+
/** Variable name */
|
|
295
|
+
name: string;
|
|
296
|
+
/** Variable value */
|
|
297
|
+
value: string;
|
|
298
|
+
}
|
|
299
|
+
/**
|
|
300
|
+
* Apply all template variables
|
|
301
|
+
*/
|
|
302
|
+
interface ApplyVariablesCommand extends BaseCommand {
|
|
303
|
+
type: 'applyVariables';
|
|
304
|
+
/** Variable values */
|
|
305
|
+
values: Record<string, string>;
|
|
306
|
+
}
|
|
307
|
+
/**
|
|
308
|
+
* Union of all command types
|
|
309
|
+
*/
|
|
310
|
+
type AgentCommand = InsertTextCommand | ReplaceTextCommand | DeleteTextCommand | FormatTextCommand | FormatParagraphCommand | ApplyStyleCommand | InsertTableCommand | InsertImageCommand | InsertHyperlinkCommand | RemoveHyperlinkCommand | InsertParagraphBreakCommand | MergeParagraphsCommand | SplitParagraphCommand | SetVariableCommand | ApplyVariablesCommand;
|
|
311
|
+
/**
|
|
312
|
+
* Document context for AI agents
|
|
313
|
+
*/
|
|
314
|
+
interface AgentContext {
|
|
315
|
+
/** Total paragraph count */
|
|
316
|
+
paragraphCount: number;
|
|
317
|
+
/** Total word count (approximate) */
|
|
318
|
+
wordCount: number;
|
|
319
|
+
/** Total character count */
|
|
320
|
+
characterCount: number;
|
|
321
|
+
/** Detected template variables */
|
|
322
|
+
variables: string[];
|
|
323
|
+
/** Variable count */
|
|
324
|
+
variableCount: number;
|
|
325
|
+
/** Available styles */
|
|
326
|
+
availableStyles: StyleInfo[];
|
|
327
|
+
/** Content outline (first N chars per paragraph) */
|
|
328
|
+
outline: ParagraphOutline[];
|
|
329
|
+
/** Document sections info */
|
|
330
|
+
sections: SectionInfo[];
|
|
331
|
+
/** Has tables */
|
|
332
|
+
hasTables: boolean;
|
|
333
|
+
/** Has images */
|
|
334
|
+
hasImages: boolean;
|
|
335
|
+
/** Has hyperlinks */
|
|
336
|
+
hasHyperlinks: boolean;
|
|
337
|
+
/** Document language */
|
|
338
|
+
language?: string;
|
|
339
|
+
}
|
|
340
|
+
/**
|
|
341
|
+
* Style information for context
|
|
342
|
+
*/
|
|
343
|
+
interface StyleInfo {
|
|
344
|
+
/** Style ID */
|
|
345
|
+
id: string;
|
|
346
|
+
/** Display name */
|
|
347
|
+
name: string;
|
|
348
|
+
/** Style type */
|
|
349
|
+
type: 'paragraph' | 'character' | 'table';
|
|
350
|
+
/** Is built-in style */
|
|
351
|
+
builtIn?: boolean;
|
|
352
|
+
}
|
|
353
|
+
/**
|
|
354
|
+
* Paragraph outline for context
|
|
355
|
+
*/
|
|
356
|
+
interface ParagraphOutline {
|
|
357
|
+
/** Paragraph index */
|
|
358
|
+
index: number;
|
|
359
|
+
/** First N characters */
|
|
360
|
+
preview: string;
|
|
361
|
+
/** Paragraph style */
|
|
362
|
+
style?: string;
|
|
363
|
+
/** Is heading */
|
|
364
|
+
isHeading?: boolean;
|
|
365
|
+
/** Heading level (1-9) */
|
|
366
|
+
headingLevel?: number;
|
|
367
|
+
/** Is list item */
|
|
368
|
+
isListItem?: boolean;
|
|
369
|
+
/** Is empty paragraph */
|
|
370
|
+
isEmpty?: boolean;
|
|
371
|
+
}
|
|
372
|
+
/**
|
|
373
|
+
* Section information
|
|
374
|
+
*/
|
|
375
|
+
interface SectionInfo {
|
|
376
|
+
/** Section index */
|
|
377
|
+
index: number;
|
|
378
|
+
/** Number of paragraphs */
|
|
379
|
+
paragraphCount: number;
|
|
380
|
+
/** Page size */
|
|
381
|
+
pageSize?: {
|
|
382
|
+
width: number;
|
|
383
|
+
height: number;
|
|
384
|
+
};
|
|
385
|
+
/** Is landscape */
|
|
386
|
+
isLandscape?: boolean;
|
|
387
|
+
/** Has header */
|
|
388
|
+
hasHeader?: boolean;
|
|
389
|
+
/** Has footer */
|
|
390
|
+
hasFooter?: boolean;
|
|
391
|
+
}
|
|
392
|
+
/**
|
|
393
|
+
* Context about the current selection
|
|
394
|
+
*/
|
|
395
|
+
interface SelectionContext {
|
|
396
|
+
/** Selected text */
|
|
397
|
+
selectedText: string;
|
|
398
|
+
/** Selection range */
|
|
399
|
+
range: Range;
|
|
400
|
+
/** Current formatting of selection */
|
|
401
|
+
formatting: Partial<TextFormatting>;
|
|
402
|
+
/** Current paragraph formatting */
|
|
403
|
+
paragraphFormatting: Partial<ParagraphFormatting>;
|
|
404
|
+
/** Text before selection (context) */
|
|
405
|
+
textBefore: string;
|
|
406
|
+
/** Text after selection (context) */
|
|
407
|
+
textAfter: string;
|
|
408
|
+
/** Paragraph containing selection */
|
|
409
|
+
paragraph: ParagraphContext;
|
|
410
|
+
/** Is selection within a table */
|
|
411
|
+
inTable?: boolean;
|
|
412
|
+
/** Is selection within a hyperlink */
|
|
413
|
+
inHyperlink?: boolean;
|
|
414
|
+
/** Suggested actions based on selection */
|
|
415
|
+
suggestedActions?: SuggestedAction[];
|
|
416
|
+
}
|
|
417
|
+
/**
|
|
418
|
+
* Paragraph context for selection
|
|
419
|
+
*/
|
|
420
|
+
interface ParagraphContext {
|
|
421
|
+
/** Paragraph index */
|
|
422
|
+
index: number;
|
|
423
|
+
/** Full paragraph text */
|
|
424
|
+
fullText: string;
|
|
425
|
+
/** Paragraph style */
|
|
426
|
+
style?: string;
|
|
427
|
+
/** Word count */
|
|
428
|
+
wordCount: number;
|
|
429
|
+
}
|
|
430
|
+
/**
|
|
431
|
+
* Suggested action for context menu
|
|
432
|
+
*/
|
|
433
|
+
interface SuggestedAction {
|
|
434
|
+
/** Action ID */
|
|
435
|
+
id: string;
|
|
436
|
+
/** Display label */
|
|
437
|
+
label: string;
|
|
438
|
+
/** Description */
|
|
439
|
+
description?: string;
|
|
440
|
+
/** Icon name */
|
|
441
|
+
icon?: string;
|
|
442
|
+
/** Priority (higher = more prominent) */
|
|
443
|
+
priority?: number;
|
|
444
|
+
}
|
|
445
|
+
/**
|
|
446
|
+
* Response from an agent action
|
|
447
|
+
*/
|
|
448
|
+
interface AgentResponse {
|
|
449
|
+
/** Success status */
|
|
450
|
+
success: boolean;
|
|
451
|
+
/** New text to insert (for rewrite/expand/etc.) */
|
|
452
|
+
newText?: string;
|
|
453
|
+
/** New formatted content */
|
|
454
|
+
newContent?: AgentContent[];
|
|
455
|
+
/** Commands to execute */
|
|
456
|
+
commands?: AgentCommand[];
|
|
457
|
+
/** Error message if failed */
|
|
458
|
+
error?: string;
|
|
459
|
+
/** Warning messages */
|
|
460
|
+
warnings?: string[];
|
|
461
|
+
/** Metadata about the response */
|
|
462
|
+
metadata?: Record<string, unknown>;
|
|
463
|
+
}
|
|
464
|
+
/**
|
|
465
|
+
* Content block in agent response
|
|
466
|
+
*/
|
|
467
|
+
interface AgentContent {
|
|
468
|
+
/** Content type */
|
|
469
|
+
type: 'text' | 'paragraph' | 'table' | 'image';
|
|
470
|
+
/** Text content */
|
|
471
|
+
text?: string;
|
|
472
|
+
/** Formatting */
|
|
473
|
+
formatting?: Partial<TextFormatting>;
|
|
474
|
+
/** Paragraph formatting */
|
|
475
|
+
paragraphFormatting?: Partial<ParagraphFormatting>;
|
|
476
|
+
/** Table data (for table type) */
|
|
477
|
+
tableData?: string[][];
|
|
478
|
+
/** Image src (for image type) */
|
|
479
|
+
imageSrc?: string;
|
|
480
|
+
}
|
|
481
|
+
/**
|
|
482
|
+
* AI action types for context menu
|
|
483
|
+
*/
|
|
484
|
+
type AIAction = 'askAI' | 'rewrite' | 'expand' | 'summarize' | 'translate' | 'explain' | 'fixGrammar' | 'makeFormal' | 'makeCasual' | 'custom';
|
|
485
|
+
|
|
486
|
+
export { type AgentContext as A, type FontOption as F, type Position as P, type Range as R, type StyleInfo as S, type AgentCommand as a, type PrintOptions as b, type SelectionContext as c, type AIAction as d, type AgentResponse as e, PrintButton as f, type PrintButtonProps as g, PrintStyles as h, formatPageRange as i, getDefaultPrintOptions as j, isPrintSupported as k, openPrintWindow as o, parsePageRange as p, triggerPrint as t };
|